diff options
| author | Dan Engelbrecht <[email protected]> | 2023-10-20 13:31:09 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-20 13:31:09 +0200 |
| commit | 7cdafe520216f01f27094dc4a353256071510922 (patch) | |
| tree | 341e3f79cb5419c3bcb235773790d36aaff572bc /src/zenserver/cache/structuredcachestore.cpp | |
| parent | Cache (rpc) activitity recording improvements (#482) (diff) | |
| download | zen-7cdafe520216f01f27094dc4a353256071510922.tar.xz zen-7cdafe520216f01f27094dc4a353256071510922.zip | |
Don't prune block locations due to missing blocks a startup (#487)
* Don't prune block locations due to missing blocks a startup
This makes the behaviour consistent with FileCas - you can have an index that is not fully backed by data.
Asking for a location that is not backed by data results in getting an empty result back
Also, don't try to GC blocks that are unknown to the block store at the time of snapshot (to avoid removing data that comes in after GatherReferences in GC)
Diffstat (limited to 'src/zenserver/cache/structuredcachestore.cpp')
| -rw-r--r-- | src/zenserver/cache/structuredcachestore.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/zenserver/cache/structuredcachestore.cpp b/src/zenserver/cache/structuredcachestore.cpp index 786053adc..207323451 100644 --- a/src/zenserver/cache/structuredcachestore.cpp +++ b/src/zenserver/cache/structuredcachestore.cpp @@ -1123,7 +1123,15 @@ TEST_CASE("z$.gc") } } { + // GC could not remove the currently written block so size will not 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); } } |