diff options
author | Jack Mulrow <jack.mulrow@mongodb.com> | 2020-09-03 19:14:46 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-08 18:59:36 +0000 |
commit | 24ce8e9b42bc34d111999f516b8c5b2abedb8892 (patch) | |
tree | 1a5957e360d63e9855cad2ddacd20ff5a5070ea6 | |
parent | c72790bdc183f24043873125525f6a5be28ed6dd (diff) | |
download | mongo-24ce8e9b42bc34d111999f516b8c5b2abedb8892.tar.gz |
SERVER-50635 Retry index consistency check at ShardingTest shutdown on ShardNotFound errors
-rw-r--r-- | jstests/libs/override_methods/check_indexes_consistent_across_cluster.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/jstests/libs/override_methods/check_indexes_consistent_across_cluster.js b/jstests/libs/override_methods/check_indexes_consistent_across_cluster.js index 61f7603f4c5..d30673b0c5a 100644 --- a/jstests/libs/override_methods/check_indexes_consistent_across_cluster.js +++ b/jstests/libs/override_methods/check_indexes_consistent_across_cluster.js @@ -39,7 +39,21 @@ ShardingTest.prototype.checkIndexesConsistentAcrossCluster = function() { */ function makeGetIndexDocsFunc(ns) { return () => { - return ShardedIndexUtil.getPerShardIndexes(mongos.getCollection(ns)); + while (true) { + try { + return ShardedIndexUtil.getPerShardIndexes(mongos.getCollection(ns)); + } catch (e) { + // Getting the indexes can fail with ShardNotFound if the router's ShardRegistry + // reloads after choosing which shards to target and a chosen shard is no longer + // in the cluster. This error should be transient, so it can be retried on. + if (e.code === ErrorCodes.ShardNotFound) { + print("Retrying $indexStats aggregation on ShardNotFound error: " + + tojson(e)); + continue; + } + throw e; + } + } }; } |