diff options
| author | Dan Engelbrecht <[email protected]> | 2024-12-17 14:19:38 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-12-17 14:19:38 +0100 |
| commit | cd3b08b6c2e904b5908820f55f928b4fbc74ed4a (patch) | |
| tree | 1c02b3aa35bbdeaacfbe338760f2f24ad28f5a09 /src | |
| parent | more memory tagging and fixes (#263) (diff) | |
| download | zen-cd3b08b6c2e904b5908820f55f928b4fbc74ed4a.tar.xz zen-cd3b08b6c2e904b5908820f55f928b4fbc74ed4a.zip | |
remove all referenced attachments in op from pending chunk references (#267)
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenserver/projectstore/httpprojectstore.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/zenserver/projectstore/httpprojectstore.cpp b/src/zenserver/projectstore/httpprojectstore.cpp index eb6407e1f..0b8e5f13b 100644 --- a/src/zenserver/projectstore/httpprojectstore.cpp +++ b/src/zenserver/projectstore/httpprojectstore.cpp @@ -1061,12 +1061,8 @@ HttpProjectService::HandleOplogOpNewRequest(HttpRouterRequest& Req) bool IsValid = true; std::vector<IoHash> MissingChunks; - std::vector<IoHash> ReferencedChunks; CbPackage::AttachmentResolver Resolver = [&](const IoHash& Hash) -> SharedBuffer { - // We want to add all chunks here so we can properly clear them from the 'prep' call where we retained them earlier - ReferencedChunks.push_back(Hash); - if (m_CidStore.ContainsChunk(Hash)) { // Return null attachment as we already have it, no point in reading it and storing it again @@ -1155,6 +1151,9 @@ HttpProjectService::HandleOplogOpNewRequest(HttpRouterRequest& Req) return HttpReq.WriteResponse(HttpResponseCode::BadRequest, HttpContentType::kText, "No oplog entry key specified"); } + std::vector<IoHash> ReferencedChunks; + Core.IterateAttachments([&ReferencedChunks](CbFieldView View) { ReferencedChunks.push_back(View.AsAttachment()); }); + // Write core to oplog size_t AttachmentCount = Package.GetAttachments().size(); @@ -1168,7 +1167,10 @@ HttpProjectService::HandleOplogOpNewRequest(HttpRouterRequest& Req) m_ProjectStats.ChunkWriteCount += AttachmentCount; // Once we stored the op, we no longer need to retain any chunks this op references - FoundLog->RemovePendingChunkReferences(ReferencedChunks); + if (!ReferencedChunks.empty()) + { + FoundLog->RemovePendingChunkReferences(ReferencedChunks); + } m_ProjectStats.OpWriteCount++; ZEN_DEBUG("'{}/{}' op #{} ({}) - '{}'", ProjectId, OplogId, OpLsn, NiceBytes(Payload.Size()), Core["key"sv].AsString()); |