summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Zuikov <[email protected]>2022-06-10 06:23:03 +0300
committerArtem Zuikov <[email protected]>2022-06-10 06:23:03 +0300
commit4cedeaf3216cda904f47b76cc08e3ea32cf85756 (patch)
treeb4c42df9ef08b814ec8cff8eda19515d08d593c0
parent8cdab022c86fa4d6b2817426e81465bee17f6721 (diff)
KIKIMR-15071: fix blob cache reads (duplicates in cookie)
ref:0cb0563e12098edca3180bc0af316e52c9ef893a
-rw-r--r--ydb/core/tx/columnshard/blob_cache.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/ydb/core/tx/columnshard/blob_cache.cpp b/ydb/core/tx/columnshard/blob_cache.cpp
index 0ef5cb89c79..1bf137e435e 100644
--- a/ydb/core/tx/columnshard/blob_cache.cpp
+++ b/ydb/core/tx/columnshard/blob_cache.cpp
@@ -287,6 +287,8 @@ private:
}
void SendBatchReadRequest(const std::vector<TBlobRange>& blobRanges, const ui64 cookie, const TActorContext& ctx) {
+ Y_VERIFY(!blobRanges.empty());
+
if (blobRanges.front().BlobId.IsSmallBlob()) {
SendBatchReadRequestToTablet(blobRanges, cookie, ctx);
} else {
@@ -356,24 +358,22 @@ private:
ui64 cookie = ++ReadCookie;
for (auto& [target, rangesGroup] : groupedBlobRanges) {
- std::vector<TBlobRange> rangesBatch;
- rangesBatch.reserve(rangesGroup.size());
ui64 requestSize = 0;
for (auto& blobRange : rangesGroup) {
- if (!rangesBatch.empty() && (requestSize + blobRange.Size > MAX_REQUEST_BYTES)) {
- SendBatchReadRequest(rangesBatch, cookie, ctx);
- rangesBatch.clear();
+ if (requestSize && (requestSize + blobRange.Size > MAX_REQUEST_BYTES)) {
+ SendBatchReadRequest(CookieToRange[cookie], cookie, ctx);
cookie = ++ReadCookie;
requestSize = 0;
}
- rangesBatch.push_back(blobRange);
requestSize += blobRange.Size;
- CookieToRange[cookie].push_back(blobRange);
+ CookieToRange[cookie].emplace_back(std::move(blobRange));
}
- if (!rangesBatch.empty()) {
- SendBatchReadRequest(rangesBatch, cookie, ctx);
+ if (requestSize) {
+ SendBatchReadRequest(CookieToRange[cookie], cookie, ctx);
+ cookie = ++ReadCookie;
+ requestSize = 0;
}
}
@@ -382,10 +382,8 @@ private:
Y_VERIFY(!ranges.empty());
cookie = ++ReadCookie;
- for (auto& blobRange : ranges) {
- CookieToRange[cookie].push_back(blobRange);
- }
- SendBatchReadRequestToTablet(ranges, cookie, ctx);
+ CookieToRange[cookie] = std::move(ranges);
+ SendBatchReadRequestToTablet(CookieToRange[cookie], cookie, ctx);
}
}