Skip to content

Commit d28c13e

Browse files
authored
More confident DS proxy phantom blob checking logic (#8611)
1 parent 25aad65 commit d28c13e

File tree

1 file changed

+10
-28
lines changed

1 file changed

+10
-28
lines changed

ydb/core/blobstorage/dsproxy/dsproxy_get_impl.cpp

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void TGetImpl::PrepareReply(NKikimrProto::EReplyStatus status, TString errorReas
5757

5858
// extra validation code for phantom logic
5959
if (PhantomCheck) {
60-
TSubgroupPartLayout possiblyWritten;
60+
TSubgroupPartLayout possiblyPresent;
6161

6262
for (ui32 idxInSubgroup = 0; idxInSubgroup < blobState.Disks.size(); ++idxInSubgroup) {
6363
const auto& disk = blobState.Disks[idxInSubgroup];
@@ -81,10 +81,13 @@ void TGetImpl::PrepareReply(NKikimrProto::EReplyStatus status, TString errorReas
8181
}
8282
switch (disk.DiskParts[partIdx].Situation) {
8383
case TBlobState::ESituation::Unknown:
84+
Y_DEBUG_ABORT_S("proxy didn't probe some valid parts of the blob while returning NODATA"
85+
<< " State# " << blobState.ToString());
86+
[[fallthrough]];
8487
case TBlobState::ESituation::Error:
8588
case TBlobState::ESituation::Present:
8689
case TBlobState::ESituation::Sent:
87-
possiblyWritten.AddItem(idxInSubgroup, partIdx, Info->Type);
90+
possiblyPresent.AddItem(idxInSubgroup, partIdx, Info->Type);
8891
break;
8992

9093
case TBlobState::ESituation::Absent:
@@ -95,32 +98,11 @@ void TGetImpl::PrepareReply(NKikimrProto::EReplyStatus status, TString errorReas
9598
}
9699
}
97100

98-
switch (Info->Type.GetErasure()) {
99-
case TBlobStorageGroupType::ErasureMirror3dc:
100-
if (possiblyWritten.GetDisksWithPart(0) || possiblyWritten.GetDisksWithPart(1) ||
101-
possiblyWritten.GetDisksWithPart(2)) {
102-
okay = false;
103-
}
104-
break;
105-
106-
case TBlobStorageGroupType::ErasureMirror3of4:
107-
if (possiblyWritten.GetDisksWithPart(0) || possiblyWritten.GetDisksWithPart(1)) {
108-
okay = false;
109-
}
110-
break;
111-
112-
default: {
113-
ui32 numDistinctParts = 0;
114-
for (ui32 partIdx = 0; partIdx < Info->Type.TotalPartCount(); ++partIdx) {
115-
if (possiblyWritten.GetDisksWithPart(partIdx)) {
116-
++numDistinctParts;
117-
}
118-
}
119-
if (numDistinctParts >= Info->Type.MinimalRestorablePartCount()) {
120-
okay = false;
121-
}
122-
break;
123-
}
101+
const TBlobStorageGroupInfo::TSubgroupVDisks zero(&Info->GetTopology());
102+
const auto& checker = Info->GetQuorumChecker();
103+
const bool canBeRestored = checker.GetBlobState(possiblyPresent, zero) != TBlobStorageGroupInfo::EBS_UNRECOVERABLE_FRAGMENTARY;
104+
if (canBeRestored) {
105+
okay = false; // there is a slight chance that we can restore that blob
124106
}
125107
}
126108

0 commit comments

Comments
 (0)