summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2015-10-07 14:26:38 -0400
committerSpencer T Brody <spencer@mongodb.com>2015-10-07 18:14:38 -0400
commit8c7455b8260da4ae9ced9285e18c7df8850bf36e (patch)
tree367a9cc2254d6435eecaeee574c59eb5080fb18e /jstests/noPassthroughWithMongod
parent00986be0d72a97783270814b32a25c982197af44 (diff)
downloadmongo-8c7455b8260da4ae9ced9285e18c7df8850bf36e.tar.gz
SERVER-20806 Calculate 'other' shard after running movePrimary, not before, in balance_repl.js
Diffstat (limited to 'jstests/noPassthroughWithMongod')
-rw-r--r--jstests/noPassthroughWithMongod/balance_repl.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/jstests/noPassthroughWithMongod/balance_repl.js b/jstests/noPassthroughWithMongod/balance_repl.js
index 55bd00c37fa..a2ab6cab8b7 100644
--- a/jstests/noPassthroughWithMongod/balance_repl.js
+++ b/jstests/noPassthroughWithMongod/balance_repl.js
@@ -1,18 +1,17 @@
+(function() {
+"use strict";
var otherOptions = { rs: true , numReplicas: 2 , chunksize: 1 , nopreallocj: true };
var s = new ShardingTest({ shards: 2, verbose: 1, other: otherOptions });
assert.writeOK(s.config.settings.update({ _id: "balancer" },
{ $set: { stopped: true }}, true ));
-db = s.getDB( "test" );
+var db = s.getDB( "test" );
var bulk = db.foo.initializeUnorderedBulkOp();
for (var i = 0; i < 2100; i++) {
bulk.insert({ _id: i, x: i });
}
assert.writeOK(bulk.execute());
-serverName = s.getServerName( "test" )
-other = s.config.shards.findOne( { _id : { $ne : serverName } } );
-
s.adminCommand( { enablesharding : "test" } )
s.ensurePrimaryShard('test', 'test-rs0');
s.adminCommand( { shardcollection : "test.foo" , key : { _id : 1 } } );
@@ -21,10 +20,11 @@ for ( i=0; i<20; i++ )
s.adminCommand( { split : "test.foo" , middle : { _id : i * 100 } } );
assert.eq( 2100, db.foo.find().itcount() );
-coll = db.foo;
+var coll = db.foo;
coll.setSlaveOk();
-
+var serverName = s.getServerName( "test" );
+var other = s.config.shards.findOne( { _id : { $ne : serverName } } );
for ( i=0; i<20; i++ ) {
// Needs to waitForDelete because we'll be performing a slaveOk query,
@@ -41,5 +41,5 @@ for ( i=0; i<20; i++ ) {
s.stop();
-
+}());