summaryrefslogtreecommitdiff
path: root/jstests/concurrency
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2017-06-27 14:03:22 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2017-06-27 14:03:22 -0400
commit1871da3e8a38e7ac384c7bc0280017852f53d487 (patch)
tree192dce4301fcb4882bfde55340e24d281b64904c /jstests/concurrency
parent9ec56d840a68f8a9df39deb07f1cc12327bec044 (diff)
downloadmongo-1871da3e8a38e7ac384c7bc0280017852f53d487.tar.gz
SERVER-29277 Automatically retry operations on DatabaseDropPending.
Overrides the Mongo.prototype.find(), Mongo.prototype.runCommand(), and Mongo.prototype.runCommandWithMetadata() functions to automatically retry (for up to 10 minutes) on a DatabaseDropPending error response. The override is loaded in for only the FSM worker threads when running with replication and therefore doesn't impact the runner's connection or non-replica set configurations.
Diffstat (limited to 'jstests/concurrency')
-rw-r--r--jstests/concurrency/fsm_libs/cluster.js9
-rw-r--r--jstests/concurrency/fsm_libs/worker_thread.js11
2 files changed, 19 insertions, 1 deletions
diff --git a/jstests/concurrency/fsm_libs/cluster.js b/jstests/concurrency/fsm_libs/cluster.js
index f3e2429f898..110b3ce45e5 100644
--- a/jstests/concurrency/fsm_libs/cluster.js
+++ b/jstests/concurrency/fsm_libs/cluster.js
@@ -369,7 +369,7 @@ var Cluster = function(options) {
};
this.isReplication = function isReplication() {
- return options.replication.enabled;
+ return Cluster.isReplication(options);
};
this.shardCollection = function shardCollection() {
@@ -602,3 +602,10 @@ Cluster.isStandalone = function isStandalone(clusterOptions) {
return !clusterOptions.sharded.enabled && !clusterOptions.replication.enabled &&
!clusterOptions.masterSlave;
};
+
+/**
+ * Returns true if 'clusterOptions' represents a replica set, and returns false otherwise.
+ */
+Cluster.isReplication = function isReplication(clusterOptions) {
+ return clusterOptions.replication.enabled;
+};
diff --git a/jstests/concurrency/fsm_libs/worker_thread.js b/jstests/concurrency/fsm_libs/worker_thread.js
index 7a9bf6b3304..36063d5a7e5 100644
--- a/jstests/concurrency/fsm_libs/worker_thread.js
+++ b/jstests/concurrency/fsm_libs/worker_thread.js
@@ -39,6 +39,17 @@ var workerThread = (function() {
myDB = new Mongo(args.host).getDB(args.dbName);
}
+ if (Cluster.isReplication(args.clusterOptions)) {
+ // Operations that run after a "dropDatabase" command has been issued may fail with
+ // a "DatabaseDropPending" error response if they would create a new collection on
+ // that database while we're waiting for a majority of nodes in the replica set to
+ // confirm it has been dropped. We load the
+ // implicitly_retry_on_database_drop_pending.js file to make it so that the clients
+ // started by the concurrency framework automatically retry their operation in the
+ // face of this particular error response.
+ load('jstests/libs/override_methods/implicitly_retry_on_database_drop_pending.js');
+ }
+
workloads.forEach(function(workload) {
load(workload); // for $config
var config = parseConfig($config); // to normalize