public void Update(DocumentId documentId, byte[] blob) { Document document; try { document = m_documentStore.GetDocumentForUpdate(documentId, -1); } catch (DocumentLockedException) { m_log.InfoFormat("Update failed because document is locked by another transaction, documentId(bytes):{0}", documentId.GetBytesReprestnation()); throw; } DBTimeStamp++; m_databaseFileWriter.BeginTimestamp(DBTimeStamp, 1); long documentLocation = m_databaseFileWriter.WriteDocument(documentId, blob); if (blob.Length > 0) { m_cacheProvider.Set(documentLocation, blob); } m_databaseFileWriter.Flush(); if (document != null) { document.Update(DBTimeStamp, documentLocation, blob.Length, true); } else { m_documentStore.AddNewDocument(documentId, DBTimeStamp, documentLocation, blob.Length); } }