aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexvru <alexvru@ydb.tech>2022-11-30 15:00:36 +0300
committeralexvru <alexvru@ydb.tech>2022-11-30 15:00:36 +0300
commit37ac01ae0477d78543b88ed2d338d87e4dc77dbd (patch)
tree02aefe26c93212a98f5df76145bde4d6cef24132
parent8b8f6d9c60b9095f67a533f0d80c06b3ca2f2ce5 (diff)
downloadydb-37ac01ae0477d78543b88ed2d338d87e4dc77dbd.tar.gz
Fix assembly logic for donor reply collection
-rw-r--r--ydb/core/blobstorage/vdisk/repl/query_donor.h33
1 files changed, 23 insertions, 10 deletions
diff --git a/ydb/core/blobstorage/vdisk/repl/query_donor.h b/ydb/core/blobstorage/vdisk/repl/query_donor.h
index 852cc6296b4..67cda9de3b9 100644
--- a/ydb/core/blobstorage/vdisk/repl/query_donor.h
+++ b/ydb/core/blobstorage/vdisk/repl/query_donor.h
@@ -11,6 +11,7 @@ namespace NKikimr {
std::unique_ptr<TEvBlobStorage::TEvVGetResult> Result;
TActorId ParentId;
std::deque<std::pair<TVDiskID, TActorId>> Donors;
+ TDynBitMap UnresolvedItems;
public:
TDonorQueryActor(TEvBlobStorage::TEvEnrichNotYet& msg, std::deque<std::pair<TVDiskID, TActorId>> donors)
@@ -27,6 +28,13 @@ namespace NKikimr {
ParentId = parentId;
Become(&TThis::StateFunc);
LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::BS_VDISK_GET, SelfId() << " starting Donor-mode query");
+
+ const auto& result = Result->Record;
+ UnresolvedItems.Reserve(result.ResultSize());
+ for (size_t i = 0; i < result.ResultSize(); ++i) {
+ UnresolvedItems[i] = result.GetResult(i).GetStatus() == NKikimrProto::NOT_YET;
+ }
+
Step();
}
@@ -50,14 +58,11 @@ namespace NKikimr {
auto query = fun(vdiskId, TInstant::Max(), NKikimrBlobStorage::EGetHandleClass::AsyncRead, flags, {}, {}, std::nullopt);
bool action = false;
-
- const auto& result = Result->Record;
- for (ui64 i = 0; i < result.ResultSize(); ++i) {
- const auto& r = result.GetResult(i);
- if (r.GetStatus() == NKikimrProto::NOT_YET) {
- query->AddExtremeQuery(LogoBlobIDFromLogoBlobID(r.GetBlobID()), r.GetShift(), r.GetSize(), &i);
- action = true;
- }
+ Y_FOR_EACH_BIT(i, UnresolvedItems) {
+ const auto& r = Result->Record.GetResult(i);
+ const ui64 cookie = i;
+ query->AddExtremeQuery(LogoBlobIDFromLogoBlobID(r.GetBlobID()), r.GetShift(), r.GetSize(), &cookie);
+ action = true;
}
if (action) {
@@ -74,8 +79,12 @@ namespace NKikimr {
LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::BS_VDISK_GET, SelfId() << " received " << ev->Get()->ToString());
auto& result = Result->Record;
for (const auto& item : ev->Get()->Record.GetResult()) {
- auto *res = result.MutableResult(item.GetCookie());
- if (item.GetStatus() == NKikimrProto::OK || (item.GetStatus() == NKikimrProto::ERROR && res->GetStatus() == NKikimrProto::NOT_YET)) {
+ const ui64 index = item.GetCookie();
+ Y_VERIFY_DEBUG(UnresolvedItems[index]);
+
+ if (item.GetStatus() == NKikimrProto::OK || item.GetStatus() == NKikimrProto::ERROR) {
+ auto *res = result.MutableResult(index);
+
std::optional<ui64> cookie = res->HasCookie() ? std::make_optional(res->GetCookie()) : std::nullopt;
res->CopyFrom(item);
if (cookie) { // retain original cookie
@@ -83,6 +92,10 @@ namespace NKikimr {
} else {
res->ClearCookie();
}
+
+ if (res->GetStatus() == NKikimrProto::OK) {
+ UnresolvedItems[index] = false;
+ }
}
}
Step();