summaryrefslogtreecommitdiff
path: root/jstests/sharding/csrs_upgrade_during_count.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/csrs_upgrade_during_count.js')
-rw-r--r--jstests/sharding/csrs_upgrade_during_count.js65
1 files changed, 32 insertions, 33 deletions
diff --git a/jstests/sharding/csrs_upgrade_during_count.js b/jstests/sharding/csrs_upgrade_during_count.js
index d9c4b465323..320d354de7c 100644
--- a/jstests/sharding/csrs_upgrade_during_count.js
+++ b/jstests/sharding/csrs_upgrade_during_count.js
@@ -15,12 +15,12 @@ load("jstests/libs/csrs_upgrade_util.js");
coordinator.setupSCCCCluster();
jsTest.log("Inserting initial data");
- var res = coordinator.getMongos(0).adminCommand({split: coordinator.getShardedCollectionName(),
- middle: {_id: 0}});
+ var res = coordinator.getMongos(0)
+ .adminCommand({split: coordinator.getShardedCollectionName(), middle: {_id: 0}});
assert.commandWorked(res);
assert.commandWorked(coordinator.getMongos(0).adminCommand({
moveChunk: coordinator.getShardedCollectionName(),
- find: { _id: 0 },
+ find: {_id: 0},
to: coordinator.getShardName(1)
}));
@@ -28,10 +28,10 @@ load("jstests/libs/csrs_upgrade_util.js");
for (var i = -1000; i < 1000; i++) {
inserts.push({_id: i, num: Math.abs(i) % 4});
}
- assert.writeOK(coordinator.getShardedCollection().insert(inserts,
- {writeConcern: {w: 'majority'}}));
- assert.writeOK(coordinator.getUnshardedCollection().insert(inserts,
- {writeConcern: {w: 'majority'}}));
+ assert.writeOK(
+ coordinator.getShardedCollection().insert(inserts, {writeConcern: {w: 'majority'}}));
+ assert.writeOK(
+ coordinator.getUnshardedCollection().insert(inserts, {writeConcern: {w: 'majority'}}));
assert.commandWorked(coordinator.getShardedCollection().createIndex({_id: 1, num: 1}));
assert.commandWorked(coordinator.getUnshardedCollection().createIndex({_id: 1, num: 1}));
@@ -41,39 +41,38 @@ load("jstests/libs/csrs_upgrade_util.js");
jsTest.log("Starting count ops in the background");
- var joinParallelShell = startParallelShell(
- function() {
- db = db.getSiblingDB('csrs_upgrade_during_count');
- for (var i = 0; i < 4000; i++) {
- if (i % 100 == 0) {
- print("Performing count iteration: " + i);
- }
- // Force mongos to reload chunk distribution from the config servers.
- assert.commandWorked(db.adminCommand('flushRouterConfig'));
-
- assert.eq(2000, db.unsharded.count());
- assert.eq(2000, db.sharded.count());
- assert.eq(250, db.unsharded.count({_id: {$gte: 0, $lt: 500}, num: {$in: [0, 3]}}));
- assert.eq(250, db.sharded.count({_id: {$gte: 0, $lt: 500}, num: {$in: [0, 3]}}));
-
- if (i == 0) {
- // Insert a document to a special collection to signal to main test thread that
- // the parallel shell has started running counts.
- assert.writeOK(db.signal.insert({started: true}));
- }
+ var joinParallelShell = startParallelShell(function() {
+ db = db.getSiblingDB('csrs_upgrade_during_count');
+ for (var i = 0; i < 4000; i++) {
+ if (i % 100 == 0) {
+ print("Performing count iteration: " + i);
}
+ // Force mongos to reload chunk distribution from the config servers.
+ assert.commandWorked(db.adminCommand('flushRouterConfig'));
+
+ assert.eq(2000, db.unsharded.count());
+ assert.eq(2000, db.sharded.count());
+ assert.eq(250, db.unsharded.count({_id: {$gte: 0, $lt: 500}, num: {$in: [0, 3]}}));
+ assert.eq(250, db.sharded.count({_id: {$gte: 0, $lt: 500}, num: {$in: [0, 3]}}));
+
+ if (i == 0) {
+ // Insert a document to a special collection to signal to main test thread that
+ // the parallel shell has started running counts.
+ assert.writeOK(db.signal.insert({started: true}));
+ }
+ }
- // Signal to main test thread that parallel shell is finished running.
- assert.writeOK(db.signal.update({}, {finished: true}));
+ // Signal to main test thread that parallel shell is finished running.
+ assert.writeOK(db.signal.update({}, {finished: true}));
- jsTestLog("Finished performing count ops in parallel shell");
- }, coordinator.getMongos(0).port);
+ jsTestLog("Finished performing count ops in parallel shell");
+ }, coordinator.getMongos(0).port);
// Wait for parallel shell to start doing count ops.
var signalColl = coordinator.getMongos(0).getDB(coordinator.getTestDBName()).signal;
assert.soon(function() {
- return signalColl.findOne();
- });
+ return signalColl.findOne();
+ });
coordinator.shutdownOneSCCCNode();
coordinator.allowAllCSRSNodesToVote();