diff options
| author | Dan Engelbrecht <[email protected]> | 2022-05-01 22:55:43 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-05-01 22:55:43 +0200 |
| commit | 6e6035499b3fe40b22e1be5aee9ac3a9675d27b0 (patch) | |
| tree | dba08d49e0c7f9f02654917ea81a1d86c683a5bb /zenserver/cache/structuredcachestore.cpp | |
| parent | collectgarbage for compactcas and structured cache uses shared implementation (diff) | |
| download | zen-6e6035499b3fe40b22e1be5aee9ac3a9675d27b0.tar.xz zen-6e6035499b3fe40b22e1be5aee9ac3a9675d27b0.zip | |
remove m_TotalSize for blockstore
fix scrub logic in structured cache store
Diffstat (limited to 'zenserver/cache/structuredcachestore.cpp')
| -rw-r--r-- | zenserver/cache/structuredcachestore.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp index d313cd0c2..f26d599ab 100644 --- a/zenserver/cache/structuredcachestore.cpp +++ b/zenserver/cache/structuredcachestore.cpp @@ -1376,10 +1376,7 @@ ZenCacheDiskLayer::CacheBucket::Get(const IoHash& HashKey, ZenCacheValue& OutVal { return GetStandaloneCacheValue(Location, HashKey, OutValue); } - if (GetInlineCacheValue(Location, OutValue)) - { - return true; - } + return GetInlineCacheValue(Location, OutValue); } return false; @@ -1463,16 +1460,16 @@ ZenCacheDiskLayer::CacheBucket::Scrub(ScrubContext& Ctx) if (Loc.IsFlagSet(DiskLocation::kStandaloneFile)) { - if (GetInlineCacheValue(Loc, Value)) + if (GetStandaloneCacheValue(Loc, HashKey, Value)) { - // Validate contents + // Note: we cannot currently validate contents since we don't + // have a content hash! continue; } } - else if (GetStandaloneCacheValue(Loc, HashKey, Value)) + else if (GetInlineCacheValue(Loc, Value)) { - // Note: we cannot currently validate contents since we don't - // have a content hash! + // Validate contents continue; } // Value not found @@ -1724,6 +1721,12 @@ ZenCacheDiskLayer::CacheBucket::CollectGarbage(GcContext& GcCtx) { RwLock::SharedLockScope __(m_IndexLock); + Stopwatch Timer; + const auto ____ = MakeGuard([&Timer, &WriteBlockTimeUs, &WriteBlockLongestTimeUs] { + uint64_t ElapsedUs = Timer.GetElapsedTimeUs(); + WriteBlockTimeUs += ElapsedUs; + WriteBlockLongestTimeUs = std::max(ElapsedUs, WriteBlockLongestTimeUs); + }); if (m_Index.contains(Key)) { // Someone added it back, let the file on disk be |