diff options
| author | Dan Engelbrecht <[email protected]> | 2025-05-30 11:51:05 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-05-30 11:51:05 +0200 |
| commit | 42aa2c9a8124ada33c88f5c608e4865b1ff84c64 (patch) | |
| tree | 4c237a2e515f73a256ee290e8f9a113f0a2060f2 /src/zenstore/filecas.cpp | |
| parent | frequent disk space check (#407) (diff) | |
| download | zen-42aa2c9a8124ada33c88f5c608e4865b1ff84c64.tar.xz zen-42aa2c9a8124ada33c88f5c608e4865b1ff84c64.zip | |
faster oplog validate (#408)
Improvement: Faster oplog validate to reduce GC wall time and disk I/O pressure
Diffstat (limited to 'src/zenstore/filecas.cpp')
| -rw-r--r-- | src/zenstore/filecas.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/zenstore/filecas.cpp b/src/zenstore/filecas.cpp index 6354edf70..56979f267 100644 --- a/src/zenstore/filecas.cpp +++ b/src/zenstore/filecas.cpp @@ -564,8 +564,24 @@ FileCasStrategy::HaveChunk(const IoHash& ChunkHash) { ZEN_ASSERT(m_IsInitialized); - RwLock::SharedLockScope _(m_Lock); - return m_Index.contains(ChunkHash); + { + RwLock::SharedLockScope _(m_Lock); + if (auto It = m_Index.find(ChunkHash); It == m_Index.end()) + { + return false; + } + } + + ShardingHelper Name(m_RootDirectory, ChunkHash); + const std::filesystem::path ChunkPath = Name.ShardedPath.ToPath(); + RwLock::SharedLockScope ShardLock(LockForHash(ChunkHash)); + + if (IsFile(ChunkPath)) + { + return true; + } + + return false; } void |