When redoing a key location request, wait until after we've checked whether we've satisfied our min rows

This commit is contained in:
A.J. Beamon 2023-06-20 16:02:12 -07:00
parent 902d87a72c
commit 75ec56bffb
1 changed files with 6 additions and 2 deletions

View File

@ -4400,6 +4400,7 @@ Future<RangeResultFamily> getExactRange(Reference<TransactionState> trState,
KeyRangeRef(keyAfter(output[output.size() - 1].key), locations[shard].range.end);
}
bool redoKeyLocationRequest = false;
if (!more || locations[shard].range.empty()) {
CODE_PROBE(true, "getExactrange (!more || locations[shard].first.empty())");
if (shard == locations.size() - 1) {
@ -4411,10 +4412,9 @@ Future<RangeResultFamily> getExactRange(Reference<TransactionState> trState,
output.more = false;
return output;
}
CODE_PROBE(true, "Multiple requests of key locations");
keys = KeyRangeRef(begin, end);
break;
redoKeyLocationRequest = true;
}
++shard;
@ -4428,6 +4428,10 @@ Future<RangeResultFamily> getExactRange(Reference<TransactionState> trState,
return output;
}
if (redoKeyLocationRequest) {
CODE_PROBE(true, "Multiple requests of key locations");
break;
}
} catch (Error& e) {
if (e.code() == error_code_wrong_shard_server || e.code() == error_code_all_alternatives_failed) {
const KeyRangeRef& range = locations[shard].range;