diff options
| author | Dan Engelbrecht <[email protected]> | 2022-03-17 23:46:22 +0100 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-03-31 11:28:32 +0200 |
| commit | 1a5e3172a5876382a4ef45c160ae1228f9ba8e22 (patch) | |
| tree | 906eb128d6c6a759995bc1ea7449e9e6ce15a42d /zenstore/compactcas.cpp | |
| parent | Use bitpacking for Cas block location (diff) | |
| download | zen-1a5e3172a5876382a4ef45c160ae1228f9ba8e22.tar.xz zen-1a5e3172a5876382a4ef45c160ae1228f9ba8e22.zip | |
open blocks on demand
Diffstat (limited to 'zenstore/compactcas.cpp')
| -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(); } { |