aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-11-18 20:12:32 +0100
committerGitHub Enterprise <[email protected]>2024-11-18 20:12:32 +0100
commit16297766e7ed9e2f3b40cfba7218d30ba306077e (patch)
tree13256ceb10a6e02c79cc0936fa7f1448583c2ab4 /src
parent5.5.12-pre1 (diff)
downloadzen-16297766e7ed9e2f3b40cfba7218d30ba306077e.tar.xz
zen-16297766e7ed9e2f3b40cfba7218d30ba306077e.zip
fix oplog chunk batch get (#221)
* fix batch request not handling missing chunks correctly * fix CorrelationId in oplog batch chunk fetch
Diffstat (limited to 'src')
-rw-r--r--src/zenserver/projectstore/httpprojectstore.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/zenserver/projectstore/httpprojectstore.cpp b/src/zenserver/projectstore/httpprojectstore.cpp
index 710cbe5a7..2954bcdc0 100644
--- a/src/zenserver/projectstore/httpprojectstore.cpp
+++ b/src/zenserver/projectstore/httpprojectstore.cpp
@@ -576,22 +576,24 @@ HttpProjectService::HandleChunkBatchRequest(HttpRouterRequest& Req)
ResponsePtr += sizeof(ResponseHdr);
for (uint32_t ChunkIndex = 0; ChunkIndex < RequestHdr.ChunkCount; ++ChunkIndex)
{
- // const RequestChunkEntry& RequestedChunk = RequestedChunks[ChunkIndex];
- const IoBuffer& FoundChunk(OutBlobs[ChunkIndex + 1]);
- ResponseChunkEntry ResponseChunk;
- ResponseChunk.CorrelationId = ChunkIndex;
+ const RequestChunkEntry& RequestedChunk = RequestedChunks[ChunkIndex];
+ const IoBuffer& FoundChunk(OutBlobs[ChunkIndex + 1]);
+ ResponseChunkEntry ResponseChunk;
+ ResponseChunk.CorrelationId = RequestedChunk.CorrelationId;
if (FoundChunk)
{
ResponseChunk.ChunkSize = FoundChunk.Size();
+ m_ProjectStats.ChunkHitCount++;
}
else
{
ResponseChunk.ChunkSize = uint64_t(-1);
+ m_ProjectStats.ChunkMissCount++;
}
memcpy(ResponsePtr, &ResponseChunk, sizeof(ResponseChunk));
ResponsePtr += sizeof(ResponseChunk);
}
- m_ProjectStats.ChunkHitCount += RequestHdr.ChunkCount;
+ std::erase_if(OutBlobs, [](IoBuffer Buffer) -> bool { return !Buffer; });
return HttpReq.WriteResponse(HttpResponseCode::OK, HttpContentType::kBinary, OutBlobs);
}