aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcachestore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zenserver/cache/structuredcachestore.cpp')
-rw-r--r--zenserver/cache/structuredcachestore.cpp21
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