aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2026-03-04 13:58:26 +0100
committerGitHub Enterprise <[email protected]>2026-03-04 13:58:26 +0100
commit6e51634c31cfbe6ad99e27bcefe7ec3bd06dd5c5 (patch)
treef41f32b07c21598989b1d45559688c567ac9ce13
parentHTTP improvements (#803) (diff)
downloadzen-6e51634c31cfbe6ad99e27bcefe7ec3bd06dd5c5.tar.xz
zen-6e51634c31cfbe6ad99e27bcefe7ec3bd06dd5c5.zip
IterateChunks callback is multithreaded - make sure AttachmentsSize can handle it (#804)
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zenserver/storage/cache/httpstructuredcache.cpp4
2 files changed, 3 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3fc60ee14..c4b484d53 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@
- Bugfix: `--plain-progress` style progress bar should now show elapsed time correctly
- Bugfix: Time spent indexing local and remote state during `zen builds download` now show the correct time
- Bugfix: ObjectStore failed to correctly parse urls with sub folder paths causing 404 to be returned
+- Bugfix: Total attachment size when querying for bucket sizes could end up incorrect
## 5.7.21
- Feature: Added `--security-config-path` option to zenserver to configure security settings
diff --git a/src/zenserver/storage/cache/httpstructuredcache.cpp b/src/zenserver/storage/cache/httpstructuredcache.cpp
index 72f29d14e..00151f79e 100644
--- a/src/zenserver/storage/cache/httpstructuredcache.cpp
+++ b/src/zenserver/storage/cache/httpstructuredcache.cpp
@@ -654,7 +654,7 @@ HttpStructuredCacheService::HandleCacheNamespaceRequest(HttpServerRequest& Reque
auto NewEnd = std::unique(AllAttachments.begin(), AllAttachments.end());
AllAttachments.erase(NewEnd, AllAttachments.end());
- uint64_t AttachmentsSize = 0;
+ std::atomic<uint64_t> AttachmentsSize = 0;
m_CidStore.IterateChunks(
AllAttachments,
@@ -746,7 +746,7 @@ HttpStructuredCacheService::HandleCacheBucketRequest(HttpServerRequest& Request,
ResponseWriter << "Size" << ValuesSize;
ResponseWriter << "AttachmentCount" << ContentStats.Attachments.size();
- uint64_t AttachmentsSize = 0;
+ std::atomic<uint64_t> AttachmentsSize = 0;
WorkerThreadPool& WorkerPool = GetMediumWorkerPool(EWorkloadType::Background);