aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-06-19 09:29:50 +0200
committerGitHub Enterprise <[email protected]>2025-06-19 09:29:50 +0200
commit583e98fc49a4c3ebe24208d082ce5fe71ccef0ef (patch)
tree2b39bf5f346512c03a897e89b473ee4513247031
parentsymbol gen hack-fix for linux (#442) (diff)
downloadzen-583e98fc49a4c3ebe24208d082ce5fe71ccef0ef.tar.xz
zen-583e98fc49a4c3ebe24208d082ce5fe71ccef0ef.zip
make sure we unregister from GC before we drop bucket/namespaces (#443)
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zenstore/cache/cachedisklayer.cpp4
-rw-r--r--src/zenstore/cache/structuredcachestore.cpp1
3 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1b4693053..c2b498ff0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@
- Improvement: `zen build --cloud-url` option now accepts URLs without the `api/v2/builds/` part in urls
- Bugfix: Range requests for build blobs that reached end of blob now works correctly
- Bugfix: Gracefully handle a malformed response when querying list of blocks
+- Bugfix: Make sure we unregister cache namespaces and buckets when dropping them
## 5.6.12
- Bugfix: Don't require `--namespace` option when using `zen list-namespaces` command
diff --git a/src/zenstore/cache/cachedisklayer.cpp b/src/zenstore/cache/cachedisklayer.cpp
index 0d2aef612..15a1c9650 100644
--- a/src/zenstore/cache/cachedisklayer.cpp
+++ b/src/zenstore/cache/cachedisklayer.cpp
@@ -2004,6 +2004,8 @@ ZenCacheDiskLayer::CacheBucket::Drop()
{
ZEN_TRACE_CPU("Z$::Bucket::Drop");
+ m_Gc.RemoveGcReferencer(*this);
+
RwLock::ExclusiveLockScope _(m_IndexLock);
std::vector<std::unique_ptr<RwLock::ExclusiveLockScope>> ShardLocks;
@@ -3165,7 +3167,7 @@ ZenCacheDiskLayer::CacheBucket::RemoveExpiredData(GcCtx& Ctx, GcStats& Stats)
return nullptr;
}
- if (Ctx.Settings.IsDeleteMode)
+ if (Ctx.Settings.IsDeleteMode && !ExpiredEntries.empty())
{
for (const DiskIndexEntry& Entry : ExpiredEntries)
{
diff --git a/src/zenstore/cache/structuredcachestore.cpp b/src/zenstore/cache/structuredcachestore.cpp
index 5ce254fac..d956384ca 100644
--- a/src/zenstore/cache/structuredcachestore.cpp
+++ b/src/zenstore/cache/structuredcachestore.cpp
@@ -297,6 +297,7 @@ ZenCacheNamespace::EnumerateBucketContents(std::string_view
std::function<void()>
ZenCacheNamespace::Drop()
{
+ m_Gc.RemoveGcStorage(this);
return m_DiskLayer.Drop();
}