aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/cache/structuredcachestore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-10-23 10:47:49 +0200
committerGitHub <[email protected]>2023-10-23 10:47:49 +0200
commit4b4229e3c3da530e3885ef666fea1c3200aa77de (patch)
tree978ecae501777c2baf54951f7107afc6f45dd76c /src/zenserver/cache/structuredcachestore.cpp
parentFilter expired cache entries against ExpiredKeys - not CAS entries to retain ... (diff)
downloadzen-4b4229e3c3da530e3885ef666fea1c3200aa77de.tar.xz
zen-4b4229e3c3da530e3885ef666fea1c3200aa77de.zip
Remove any unreferenced blocks in block store on open (#492)
* Remove any unreferenced blocks in block store on open
Diffstat (limited to 'src/zenserver/cache/structuredcachestore.cpp')
-rw-r--r--src/zenserver/cache/structuredcachestore.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/zenserver/cache/structuredcachestore.cpp b/src/zenserver/cache/structuredcachestore.cpp
index 207323451..77316a5dc 100644
--- a/src/zenserver/cache/structuredcachestore.cpp
+++ b/src/zenserver/cache/structuredcachestore.cpp
@@ -1120,18 +1120,13 @@ TEST_CASE("z$.gc")
const bool Exists = Zcs.Get(Bucket, Key, CacheValue);
CHECK(!Exists);
}
+ // GC could not remove the currently written block so size will not be zero
+ CHECK_NE(0, Zcs.StorageSize().DiskSize);
}
}
{
- // GC could not remove the currently written block so size will not be zero
+ // Unreferenced blocks will be pruned so size should now be zero
ZenCacheNamespace Zcs(Gc, *JobQueue, TempDir.Path() / "cache", true);
- CHECK_NE(0, Zcs.StorageSize().DiskSize);
-
- // GC again and now the stray write block should be removed
- GcContext GcCtx(GcClock::Now() + std::chrono::minutes(2), GcClock::Now() + std::chrono::minutes(2));
- GcCtx.CollectSmallObjects(true);
- Gc.CollectGarbage(GcCtx);
-
CHECK_EQ(0, Zcs.StorageSize().DiskSize);
}
}