Skip to content

Commit 174fc85

Browse files
authored
stable-25-2: Fix get with blocked generation in better way (#29299)
2 parents 0f0f81d + 8c922a0 commit 174fc85

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

ydb/core/blob_depot/agent/storage_get.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ namespace NKikimr::NBlobDepot {
3232
if (CheckBlockForTablet(blk->Id, std::nullopt, &blockedGeneration) != NKikimrProto::OK) {
3333
return;
3434
}
35-
if (blockedGeneration != blk->Generation) {
35+
if (blockedGeneration < blk->Generation) {
3636
// this can happen only in distributed storage, but not possible in BlobDepot
37-
return EndWithError(NKikimrProto::ERROR, "incorrect blocked generation provided for"
38-
" ForceBlockTabletData in TEvGet query to BlobDepot");
37+
return EndWithError(NKikimrProto::ERROR, TStringBuilder() << "incorrect blocked generation"
38+
" provided for ForceBlockTabletData in TEvGet query to BlobDepot"
39+
<< " Id# " << blk->Id << " required Generation# " << blk->Generation
40+
<< " actual Generation# " << blockedGeneration);
3941
}
4042
}
4143

ydb/core/blobstorage/dsproxy/mock/model.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ namespace NFake {
114114
}
115115
if (const auto& blk = msg->ForceBlockTabletData; blk && blk->Generation) {
116116
auto it = Blocks.find(blk->Id);
117-
Y_VERIFY_S(it != Blocks.end() && it->second == blk->Generation, "incorrect ForceBlockTabletData"
117+
Y_VERIFY_S(it != Blocks.end() && blk->Generation <= it->second, "incorrect ForceBlockTabletData"
118118
<< " expected Generation# " << blk->Generation
119119
<< " having Generation# " << (it != Blocks.end() ? ToString(it->second) : "none"));
120120
}

ydb/core/tablet/tablet_req_rebuildhistory.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil
496496
return BuildHistory();
497497

498498
for (auto &xpair : RefsToCheckByGroup) {
499+
std::ranges::sort(xpair.second);
499500
if (!SendRefsCheck(xpair.second, xpair.first)) {
500501
BLOG_ERROR("TTabletReqRebuildHistoryGraph::MakeHistory SendRefsCheck A error", "TRRH06");
501502
if (IntrospectionTrace) {
@@ -519,6 +520,11 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil
519520
ui64 endRequestIdx = endIdx;
520521
ui64 totalSize = 0;
521522
for (ui64 i = firstRequestIdx; i != endIdx; ++i) {
523+
if (refs[i].Generation() != refs[firstRequestIdx].Generation()) {
524+
endRequestIdx = i;
525+
break;
526+
}
527+
522528
ui64 size = refs[i].BlobSize();
523529
Y_ABORT_UNLESS(size != 0);
524530

@@ -539,7 +545,8 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil
539545
q[i].Set(refs[i + firstRequestIdx] /*must be index read*/);
540546
}
541547
SendToBSProxy(SelfId(), group, new TEvBlobStorage::TEvGet(q, (ui32)count, TInstant::Max(),
542-
NKikimrBlobStorage::EGetHandleClass::FastRead, true, true, TEvBlobStorage::TEvGet::TForceBlockTabletData(Info->TabletID, BlockedGen)));
548+
NKikimrBlobStorage::EGetHandleClass::FastRead, true, true, TEvBlobStorage::TEvGet::TForceBlockTabletData(
549+
Info->TabletID, refs[firstRequestIdx].Generation())));
543550
++RequestsLeft;
544551

545552
firstRequestIdx = endRequestIdx;

0 commit comments

Comments
 (0)