SERVER-126193 Handle ShardNotFound errors with killOp in implicitly_retry_on_shard_transition_errors (#53410)
GitOrigin-RevId: 19e06ab65372ffab208286c3a8e8a3040daf66fd
This commit is contained in:
parent
73fac26a34
commit
dec5c32191
@ -25,7 +25,18 @@ assert.commandWorked(db.adminCommand({configureFailPoint: "mr_killop_test_fp", m
|
||||
|
||||
/** @return op code for map reduce op created by spawned shell. */
|
||||
function getOpCode() {
|
||||
const inProg = db.currentOp().inprog;
|
||||
let inProg;
|
||||
// In add/remove shard suites, we use localOps to get the opId on the mongoS rather than the
|
||||
// shard. This ensures that we don't end up with an opId for shard local operation on a shard
|
||||
// that no longer exists.
|
||||
if (TestData.hasRandomShardsAddedRemoved) {
|
||||
inProg = db
|
||||
.getSiblingDB("admin")
|
||||
.aggregate([{$currentOp: {localOps: true}}])
|
||||
.toArray();
|
||||
} else {
|
||||
inProg = db.currentOp().inprog;
|
||||
}
|
||||
|
||||
function isMapReduce(op) {
|
||||
if (!op.command) {
|
||||
|
||||
@ -83,6 +83,15 @@ const kCommandRetryableOnShardNotFoundError = {
|
||||
// will show up again)
|
||||
return command.shardDistribution[0].shard == "config";
|
||||
},
|
||||
"killOp": (command) => {
|
||||
// if the opId is not in the format "shardid:opid", then we can retry
|
||||
if (command.op.indexOf(":") == -1) {
|
||||
return true;
|
||||
}
|
||||
// only retryable if the target is the config shard (as eventually it will show up again)
|
||||
const shardId = command.op.split(":")[0];
|
||||
return shardId == "config";
|
||||
},
|
||||
};
|
||||
|
||||
function matchesRetryableError(error, retryableError) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user