diff options
| -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); } |