diff options
| author | Dan Engelbrecht <[email protected]> | 2024-11-18 20:12:32 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-11-18 20:12:32 +0100 |
| commit | 16297766e7ed9e2f3b40cfba7218d30ba306077e (patch) | |
| tree | 13256ceb10a6e02c79cc0936fa7f1448583c2ab4 | |
| parent | 5.5.12-pre1 (diff) | |
| download | zen-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
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | src/zenserver/projectstore/httpprojectstore.cpp | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f2e25cbe..f7faad64e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ - Improvement: Added more details in post GC log. - Bugfix: Fixed race condition in oplog writes which could cause used attachments to be incorrectly removed by GC - Bugfix: fixed issue with ZenServerInstance::SpawnServer. Previously it would assign a child identifier twice, which could lead to confusing log output when running tests +- Bugfix: Fixed batch request not handling missing chunks correctly +- Bugfix: Fixed CorrelationId in oplog batch chunk fetch ## 5.5.11 - Bugfix: Fixed memory leak in cache (would leak GetBatchHandle instances) 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); } |