summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPol Pinol Castuera <pol.pinol@mongodb.com>2023-01-26 10:49:10 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-14 12:51:08 +0000
commitb468884bdea3f1f770e513855f2c02c2cb05e5bf (patch)
tree0caff84b3712a86be4b341d11b632f057e914e4f
parent2147a8ee35182636a5c9106206dc46fda9a97c1b (diff)
downloadmongo-b468884bdea3f1f770e513855f2c02c2cb05e5bf.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.js39
-rw-r--r--jstests/libs/override_methods/network_error_and_txn_override.js12
2 files changed, 0 insertions, 51 deletions
diff --git a/jstests/concurrency/fsm_libs/cluster.js b/jstests/concurrency/fsm_libs/cluster.js
index 8c3f58d43bb..7d0ff611c45 100644
--- a/jstests/concurrency/fsm_libs/cluster.js
+++ b/jstests/concurrency/fsm_libs/cluster.js
@@ -389,33 +389,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);
};
@@ -509,18 +482,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 e95ef379a3a..10c6bc0de8a 100644
--- a/jstests/libs/override_methods/network_error_and_txn_override.js
+++ b/jstests/libs/override_methods/network_error_and_txn_override.js
@@ -846,18 +846,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.