aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/projectstore/projectstore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-10-10 13:12:02 +0200
committerGitHub <[email protected]>2023-10-10 13:12:02 +0200
commit7df585a13cd8d445396bbfbc10ad127dce89b272 (patch)
tree32da843f1f032504a8c8de0127f735fef53c8619 /src/zenserver/projectstore/projectstore.cpp
parentfixed GC logging output stats (#458) (diff)
downloadzen-7df585a13cd8d445396bbfbc10ad127dce89b272.tar.xz
zen-7df585a13cd8d445396bbfbc10ad127dce89b272.zip
cache reference tracking (#455)
- Feature: Add caching of referenced CId content for structured cache records, this avoid disk thrashing when gathering references for GC - disabled by default, enable with `--cache-reference-cache-enabled` - Improvement: Faster collection of referenced CId content in project store
Diffstat (limited to 'src/zenserver/projectstore/projectstore.cpp')
-rw-r--r--src/zenserver/projectstore/projectstore.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index e000976ea..02760f6dd 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -507,14 +507,17 @@ ProjectStore::Oplog::GatherReferences(GcContext& GcCtx)
return;
}
- tsl::robin_set<IoHash> AttachmentHashes;
+ std::vector<IoHash> Cids;
+ Cids.reserve(1024);
IterateOplog([&](CbObject Op) {
- Op.IterateAttachments([&](CbFieldView Visitor) {
- IoHash Attachment = Visitor.AsAttachment();
- AttachmentHashes.insert(Attachment);
- });
+ Op.IterateAttachments([&](CbFieldView Visitor) { Cids.emplace_back(Visitor.AsAttachment()); });
+ if (Cids.size() >= 1024)
+ {
+ GcCtx.AddRetainedCids(Cids);
+ Cids.clear();
+ }
});
- GcCtx.AddRetainedCids(std::vector<IoHash>(AttachmentHashes.begin(), AttachmentHashes.end()));
+ GcCtx.AddRetainedCids(Cids);
}
uint64_t