summaryrefslogtreecommitdiff
path: root/jstests/replsets
diff options
context:
space:
mode:
authorJames Wahlin <james@mongodb.com>2018-07-20 09:05:04 -0400
committerJames Wahlin <james@mongodb.com>2018-07-27 14:14:20 -0400
commit54f1582fc6eb01de4d4c42f26fc133e623f065fb (patch)
tree5267a15f4d28a68d9ecf0dc0622c26fa52832a1d /jstests/replsets
parent9d5a4298d2dd876d0762b27221332f0d9cc1871e (diff)
SERVER-35031 Return MaxTimeMSExpired for maxTimeMS timeoutr4.0.1-rc1r4.0.1
Adds a new 'MaxTimeMSExpired' error code, returned when a timeout occurs due to exceeding of maxTimeMS. Timeouts unrelated to maxTimeMS will continue to return 'ExceededTimeLimit'. (cherry picked from commit 35528523c00b72a210dc5b78a427d90ed1c14331)
Diffstat (limited to 'jstests/replsets')
-rw-r--r--jstests/replsets/await_replication_timeout.js6
-rw-r--r--jstests/replsets/dbhash_at_cluster_time.js2
-rw-r--r--jstests/replsets/linearizable_read_concern.js2
-rw-r--r--jstests/replsets/read_after_optime.js2
-rw-r--r--jstests/replsets/read_committed_after_rollback.js2
-rw-r--r--jstests/replsets/read_committed_no_snapshots.js4
-rw-r--r--jstests/replsets/read_committed_with_catalog_changes.js2
-rw-r--r--jstests/replsets/stepdown_catch_up_opt.js2
8 files changed, 10 insertions, 12 deletions
diff --git a/jstests/replsets/await_replication_timeout.js b/jstests/replsets/await_replication_timeout.js
index 93600d2ca81..2fb4e6e9471 100644
--- a/jstests/replsets/await_replication_timeout.js
+++ b/jstests/replsets/await_replication_timeout.js
@@ -32,8 +32,7 @@
// Test maxTimeMS timeout
res = testDB.runCommand(
{insert: collName, documents: [{a: 1}], writeConcern: {w: 3}, maxTimeMS: 1000});
- assert.commandFailedWithCode(res, ErrorCodes.ExceededTimeLimit);
- assert.eq(ErrorCodes.ExceededTimeLimit, res.writeConcernError.code);
+ assert.commandFailedWithCode(res, ErrorCodes.MaxTimeMSExpired);
// Test with wtimeout < maxTimeMS
res = testDB.runCommand({
@@ -52,8 +51,7 @@
writeConcern: {w: 3, wtimeout: 10 * 1000},
maxTimeMS: 1000
});
- assert.commandFailedWithCode(res, ErrorCodes.ExceededTimeLimit);
- assert.eq(ErrorCodes.ExceededTimeLimit, res.writeConcernError.code);
+ assert.commandFailedWithCode(res, ErrorCodes.MaxTimeMSExpired);
// dropDatabase respects the 'w' field when it is stronger than the default of majority.
res = testDB.runCommand({dropDatabase: 1, writeConcern: {w: 3, wtimeout: 1000}});
diff --git a/jstests/replsets/dbhash_at_cluster_time.js b/jstests/replsets/dbhash_at_cluster_time.js
index d2a77899003..27f4e0f79db 100644
--- a/jstests/replsets/dbhash_at_cluster_time.js
+++ b/jstests/replsets/dbhash_at_cluster_time.js
@@ -98,7 +98,7 @@
// However, the "dbHash" command should block behind the transaction if "atClusterTime"
// wasn't specified.
res = assert.commandFailedWithCode(db.runCommand({dbHash: 1, maxTimeMS: 1000}),
- ErrorCodes.ExceededTimeLimit);
+ ErrorCodes.MaxTimeMSExpired);
otherSession.abortTransaction();
otherSession.endSession();
diff --git a/jstests/replsets/linearizable_read_concern.js b/jstests/replsets/linearizable_read_concern.js
index da544cc9e55..64ccaa32bc9 100644
--- a/jstests/replsets/linearizable_read_concern.js
+++ b/jstests/replsets/linearizable_read_concern.js
@@ -87,7 +87,7 @@ load('jstests/libs/write_concern_util.js');
var result = primary.getDB("test").runCommand(
{"find": "foo", "readConcern": {level: "linearizable"}, "maxTimeMS": 3000});
- assert.commandFailedWithCode(result, ErrorCodes.ExceededTimeLimit);
+ assert.commandFailedWithCode(result, ErrorCodes.MaxTimeMSExpired);
jsTestLog("Testing to make sure linearizable read command does not block forever.");
diff --git a/jstests/replsets/read_after_optime.js b/jstests/replsets/read_after_optime.js
index 1059d5b1c62..c9369074fee 100644
--- a/jstests/replsets/read_after_optime.js
+++ b/jstests/replsets/read_after_optime.js
@@ -28,7 +28,7 @@
readConcern: {afterOpTime: {ts: twoKSecTS, t: term}},
maxTimeMS: 5000,
}),
- ErrorCodes.ExceededTimeLimit);
+ ErrorCodes.MaxTimeMSExpired);
};
// Run the time out test 3 times with replication debug log level increased to 2
diff --git a/jstests/replsets/read_committed_after_rollback.js b/jstests/replsets/read_committed_after_rollback.js
index a4e6ffdacbd..bdb83b144a8 100644
--- a/jstests/replsets/read_committed_after_rollback.js
+++ b/jstests/replsets/read_committed_after_rollback.js
@@ -15,7 +15,7 @@ load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority.
coll.runCommand('find', {"readConcern": {"level": "majority"}, "maxTimeMS": 3000});
assert.commandFailedWithCode(
res,
- ErrorCodes.ExceededTimeLimit,
+ ErrorCodes.MaxTimeMSExpired,
"Expected read of " + coll.getFullName() + ' on ' + coll.getMongo().host + " to block");
}
diff --git a/jstests/replsets/read_committed_no_snapshots.js b/jstests/replsets/read_committed_no_snapshots.js
index df7ee835fd6..02bec8e69f7 100644
--- a/jstests/replsets/read_committed_no_snapshots.js
+++ b/jstests/replsets/read_committed_no_snapshots.js
@@ -66,7 +66,7 @@ load("jstests/replsets/rslib.js"); // For reconfig and startSetIfSupportsReadMa
assert.commandFailedWithCode(
noSnapshotSecondary.getDB(name).foo.runCommand(
'find', {"readConcern": {"level": "majority"}, "maxTimeMS": 1000}),
- ErrorCodes.ExceededTimeLimit);
+ ErrorCodes.MaxTimeMSExpired);
// Reconfig to make the no-snapshot secondary the primary
var config = primary.getDB("local").system.replset.findOne();
@@ -79,6 +79,6 @@ load("jstests/replsets/rslib.js"); // For reconfig and startSetIfSupportsReadMa
assert.commandFailedWithCode(
primary.getSiblingDB(name).foo.runCommand(
'find', {"readConcern": {"level": "majority"}, "maxTimeMS": 1000}),
- ErrorCodes.ExceededTimeLimit);
+ ErrorCodes.MaxTimeMSExpired);
replTest.stopSet();
})();
diff --git a/jstests/replsets/read_committed_with_catalog_changes.js b/jstests/replsets/read_committed_with_catalog_changes.js
index 95322fd3da5..b60fda763f2 100644
--- a/jstests/replsets/read_committed_with_catalog_changes.js
+++ b/jstests/replsets/read_committed_with_catalog_changes.js
@@ -218,7 +218,7 @@ load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority.
var res =
coll.runCommand('find', {"readConcern": {"level": "majority"}, "maxTimeMS": 5000});
assert.commandFailedWithCode(res,
- ErrorCodes.ExceededTimeLimit,
+ ErrorCodes.MaxTimeMSExpired,
"Expected read of " + coll.getFullName() + " to block");
}
diff --git a/jstests/replsets/stepdown_catch_up_opt.js b/jstests/replsets/stepdown_catch_up_opt.js
index 48bd11adde1..4fd88748ae4 100644
--- a/jstests/replsets/stepdown_catch_up_opt.js
+++ b/jstests/replsets/stepdown_catch_up_opt.js
@@ -17,7 +17,7 @@
// Error codes we expect to see.
// If the secondary is not caught up.
- var noCaughtUpSecondariesCode = 50;
+ const noCaughtUpSecondariesCode = ErrorCodes.ExceededTimeLimit;
// If the stepdown period is shorter than the secondaryCatchUpPeriodSecs argument.
var stepDownPeriodTooShortCode = 2;