diff options
author | Pol Pinol Castuera <pol.pinol@mongodb.com> | 2023-01-26 10:49:10 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-02-14 12:16:55 +0000 |
commit | 8416ab993835c986ce421d1c423766e795355ed5 (patch) | |
tree | 3a44ad35978a48a3a5d49abf13ac513e7dba3622 | |
parent | aca8292911932c12df36e2ea0b462f49f8feceb2 (diff) | |
download | mongo-8416ab993835c986ce421d1c423766e795355ed5.tar.gz |
SERVER-72868 Remove checks at cluster.js because listCollections and listIndexes automatically retry on NotWritablePrimary errors.
(cherry picked from commit f1134e89296bd57a014af29d02aa1cb93ac864d2)
-rw-r--r-- | jstests/concurrency/fsm_libs/cluster.js | 39 | ||||
-rw-r--r-- | jstests/libs/override_methods/network_error_and_txn_override.js | 12 |
2 files changed, 0 insertions, 51 deletions
diff --git a/jstests/concurrency/fsm_libs/cluster.js b/jstests/concurrency/fsm_libs/cluster.js index 381131e2b54..837dcb71160 100644 --- a/jstests/concurrency/fsm_libs/cluster.js +++ b/jstests/concurrency/fsm_libs/cluster.js @@ -394,33 +394,6 @@ var Cluster = function(options) { assert(initialized, 'cluster must be initialized first'); assert(this.isSharded(), 'cluster is not sharded'); - // If we are continuously stepping down shards, the config server may have stale view of the - // cluster, so retry on retryable errors, e.g. NotWritablePrimary. - if (this.shouldPerformContinuousStepdowns()) { - assert.soon(() => { - try { - st.shardColl.apply(st, arguments); - return true; - } catch (e) { - // The shardCollection command requires the config server primary to call - // listCollections and listIndexes on shards before sharding the collection, - // both of which can fail with a retryable error if the config server's view of - // the cluster is stale. This is safe to retry because no actual work has been - // done. - // - // TODO SERVER-30949: Remove this try catch block once listCollections and - // listIndexes automatically retry on NotWritablePrimary errors. - if (e.code === 18630 || // listCollections failure - e.code === 18631) { // listIndexes failure - print("Caught retryable error from shardCollection, retrying: " + - tojson(e)); - return false; - } - throw e; - } - }); - } - st.shardColl.apply(st, arguments); }; @@ -514,18 +487,6 @@ var Cluster = function(options) { var res = db.adminCommand({listDatabases: 1}); assert.commandWorked(res); res.databases.forEach(dbInfo => { - // Don't perform listCollections on the admin or config database through a mongos - // connection when stepping down the config server primary, because both are stored - // on the config server, and listCollections may return a NotPrimaryError if the - // mongos is stale. - // - // TODO SERVER-30949: listCollections through mongos should automatically retry on - // NotWritablePrimary errors. Once that is true, remove this check. - if (isSteppingDownConfigServers && isMongos && - (dbInfo.name === "admin" || dbInfo.name === "config")) { - return; - } - const validateOptions = {full: true, enforceFastCount: true}; // TODO (SERVER-24266): Once fast counts are tolerant to unclean shutdowns, remove // the check for TestData.allowUncleanShutdowns. diff --git a/jstests/libs/override_methods/network_error_and_txn_override.js b/jstests/libs/override_methods/network_error_and_txn_override.js index fc1ec89b266..46e6cc27d5e 100644 --- a/jstests/libs/override_methods/network_error_and_txn_override.js +++ b/jstests/libs/override_methods/network_error_and_txn_override.js @@ -844,18 +844,6 @@ function shouldRetryWithNetworkErrorOverride( return kContinue; } - // listCollections and listIndexes called through mongos may return OperationFailed if - // the request to establish a cursor on the targeted shard fails with a network error. - // - // TODO SERVER-30949: Remove this check once those two commands retry on retryable - // errors automatically. - if ((cmdName === "listCollections" || cmdName === "listIndexes") && - res.code === ErrorCodes.OperationFailed && res.hasOwnProperty("errmsg") && - res.errmsg.indexOf("failed to read command response from shard") >= 0) { - logError("Retrying failed mongos cursor command"); - return kContinue; - } - // Some sharding commands return raw responses from all contacted shards and there won't // be a top level code if shards returned more than one error code, in which case retry // if any error is retryable. |