summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/shardingtest.js39
1 files changed, 23 insertions, 16 deletions
diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js
index 2087653e897..d19ed6bdad9 100644
--- a/src/mongo/shell/shardingtest.js
+++ b/src/mongo/shell/shardingtest.js
@@ -393,6 +393,27 @@ var ShardingTest = function(params) {
}
};
+ this.stopAllConfigServers = function(opts) {
+ if (this.configRS) {
+ this.configRS.stopSet(undefined, undefined, opts);
+ } else {
+ // Old style config triplet
+ for (var i = 0; i < this._configServers.length; i++) {
+ this.stopConfigServer(i, opts);
+ }
+ }
+ };
+
+ this.stopAllShards = function(opts) {
+ for (var i = 0; i < this._connections.length; i++) {
+ if (this._rs[i]) {
+ this._rs[i].test.stopSet(15, undefined, opts);
+ } else {
+ this.stopMongod(i, opts);
+ }
+ }
+ };
+
this.stopAllMongos = function(opts) {
for (var i = 0; i < this._mongos.length; i++) {
this.stopMongos(i, opts);
@@ -415,25 +436,11 @@ var ShardingTest = function(params) {
this.stopAllMongos(opts);
let startTime = new Date(); // Measure the execution time of shutting down shards.
- for (var i = 0; i < this._connections.length; i++) {
- if (this._rs[i]) {
- this._rs[i].test.stopSet(15, undefined, opts);
- } else {
- this.stopMongod(i, opts);
- }
- }
+ this.stopAllShards(opts);
print("ShardingTest stopped all shards, took " + (new Date() - startTime) + "ms for " +
this._connections.length + " shards.");
- if (this.configRS) {
- this.configRS.stopSet(undefined, undefined, opts);
- } else {
- // Old style config triplet
- for (var i = 0; i < this._configServers.length; i++) {
- this.stopConfigServer(i, opts);
- }
- }
-
+ this.stopAllConfigServers(opts);
if (!opts.noCleanData) {
print("ShardingTest stop deleting all dbpaths");
for (var i = 0; i < _alldbpaths.length; i++) {