diff options
Diffstat (limited to 'zenstore')
| -rw-r--r-- | zenstore/compactcas.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp index aaefa9c6c..cbad4aef1 100644 --- a/zenstore/compactcas.cpp +++ b/zenstore/compactcas.cpp @@ -179,6 +179,11 @@ CasContainerStrategy::ChunkBlock::Write(const void* Data, uint64_t Size, uint64_ void CasContainerStrategy::ChunkBlock::Flush() { + void* FileHandle = m_SmallObjectFile.Handle(); + if (FileHandle == nullptr) + { + return; + } m_SmallObjectFile.Flush(); } @@ -254,7 +259,9 @@ CasContainerStrategy::InsertChunk(const void* ChunkData, size_t ChunkSize, const m_CurrentInsertOffset = 0; } const uint64_t InsertOffset = m_CurrentInsertOffset; - m_CurrentBlock.lock()->Write(ChunkData, ChunkSize, InsertOffset); + auto CurrentBlock = m_CurrentBlock.lock(); + CurrentBlock->Open(); + CurrentBlock->Write(ChunkData, ChunkSize, InsertOffset); m_CurrentInsertOffset = AlignPositon(InsertOffset + ChunkSize, m_PayloadAlignment); const CasLocation Location(m_CurrentBlockIndex, InsertOffset, ChunkSize); @@ -348,6 +355,7 @@ CasContainerStrategy::Scrub(ScrubContext& Ctx) uint64_t WindowEnd = WindowSize; auto& SmallObjectFile = *Block.second; const uint64_t FileSize = SmallObjectFile.FileSize(); + SmallObjectFile.Open(); do { @@ -600,6 +608,7 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx) { RwLock::ExclusiveLockScope _i(m_InsertLock); BlockFile = m_OpenBlocks[BlockIndex]; + BlockFile->Open(); } { |