diff options
author | Greg Studer <greg@10gen.com> | 2012-10-17 13:08:24 -0400 |
---|---|---|
committer | Greg Studer <greg@10gen.com> | 2012-10-17 16:06:56 -0400 |
commit | 83d73563c47df15373b95e4d4428e323d6005b55 (patch) | |
tree | d278e211e5567d013abe1dc64df9f378a1ff8a0d /jstests | |
parent | 54217e5e20eb5d1604dba4bf8f3368903f23686b (diff) | |
download | mongo-83d73563c47df15373b95e4d4428e323d6005b55.tar.gz |
SERVER-7376 test fixes for 2.2
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/sharding/addshard5.js | 4 | ||||
-rw-r--r-- | jstests/sharding/count1.js | 2 | ||||
-rw-r--r-- | jstests/sharding/count2.js | 2 | ||||
-rw-r--r-- | jstests/sharding/error1.js | 2 | ||||
-rw-r--r-- | jstests/sharding/geo_near_random2.js | 2 | ||||
-rw-r--r-- | jstests/sharding/key_many.js | 2 | ||||
-rw-r--r-- | jstests/sharding/key_string.js | 2 | ||||
-rw-r--r-- | jstests/sharding/limit_push.js | 2 | ||||
-rw-r--r-- | jstests/sharding/multi_mongos1.js | 4 | ||||
-rw-r--r-- | jstests/sharding/no_empty_reset.js | 2 | ||||
-rw-r--r-- | jstests/sharding/shard2.js | 10 | ||||
-rw-r--r-- | jstests/sharding/shard3.js | 8 | ||||
-rw-r--r-- | jstests/sharding/shard4.js | 3 | ||||
-rw-r--r-- | jstests/sharding/shard5.js | 2 | ||||
-rw-r--r-- | jstests/slowNightly/sharding_rs2.js | 2 |
15 files changed, 25 insertions, 24 deletions
diff --git a/jstests/sharding/addshard5.js b/jstests/sharding/addshard5.js index b272ae4ab1e..a62dbe43c98 100644 --- a/jstests/sharding/addshard5.js +++ b/jstests/sharding/addshard5.js @@ -36,8 +36,8 @@ coll.insert({ hello : "world" }) assert.eq( null, coll.getDB().getLastError() ) // Migrate the collection to and from shard2 so shard1 loads the shard2 host -printjson( admin.runCommand({ moveChunk : coll + "", find : { _id : 0 }, to : shards[1]._id }) ) -printjson( admin.runCommand({ moveChunk : coll + "", find : { _id : 0 }, to : shards[0]._id }) ) +printjson( admin.runCommand({ moveChunk : coll + "", find : { _id : 0 }, to : shards[1]._id, _waitForDelete : true }) ) +printjson( admin.runCommand({ moveChunk : coll + "", find : { _id : 0 }, to : shards[0]._id, _waitForDelete : true }) ) // // Drop and re-add shard with last shard's host diff --git a/jstests/sharding/count1.js b/jstests/sharding/count1.js index 4af42caf7a1..c7994c22712 100644 --- a/jstests/sharding/count1.js +++ b/jstests/sharding/count1.js @@ -63,7 +63,7 @@ assert.eq( 6 , db.foo.find().count() , "basic count after split " ); assert.eq( 6 , db.foo.find().sort( { name : 1 } ).count() , "basic count after split sorted " ); // part 4 -s.adminCommand( { movechunk : "test.foo" , find : { name : "allan" } , to : secondary.getMongo().name } ); +s.adminCommand( { movechunk : "test.foo" , find : { name : "allan" } , to : secondary.getMongo().name , _waitForDelete : true } ); assert.eq( 3 , primary.foo.find().toArray().length , "primary count" ); assert.eq( 3 , secondary.foo.find().toArray().length , "secondary count" ); diff --git a/jstests/sharding/count2.js b/jstests/sharding/count2.js index ae0559ddb1a..edac3b692ec 100644 --- a/jstests/sharding/count2.js +++ b/jstests/sharding/count2.js @@ -26,7 +26,7 @@ assert.eq( 3, db2.count( { name : { $gte: "aaa" , $lt: "ddd" } } ) , "initial co s1.printChunks( "test.foo" ) -s1.adminCommand( { movechunk : "test.foo" , find : { name : "aaa" } , to : s1.getOther( s1.getServer( "test" ) ).name } ); +s1.adminCommand( { movechunk : "test.foo" , find : { name : "aaa" } , to : s1.getOther( s1.getServer( "test" ) ).name, _waitForDelete : true }); assert.eq( 3, db1.count( { name : { $gte: "aaa" , $lt: "ddd" } } ) , "post count mongos1" ); diff --git a/jstests/sharding/error1.js b/jstests/sharding/error1.js index b60ffa82226..97614c8addf 100644 --- a/jstests/sharding/error1.js +++ b/jstests/sharding/error1.js @@ -24,7 +24,7 @@ db.foo2.save( { _id : 3 , num : 15 } ); db.foo2.save( { _id : 4 , num : 20 } ); s.adminCommand( { split : "test.foo2" , middle : { num : 10 } } ); -s.adminCommand( { movechunk : "test.foo2" , find : { num : 20 } , to : s.getOther( s.getServer( "test" ) ).name } ); +s.adminCommand( { movechunk : "test.foo2" , find : { num : 20 } , to : s.getOther( s.getServer( "test" ) ).name, _waitForDelete : true } ); print( "a: " + a.foo2.count() ); print( "b: " + b.foo2.count() ); diff --git a/jstests/sharding/geo_near_random2.js b/jstests/sharding/geo_near_random2.js index b9800274bb9..71b0406cf7a 100644 --- a/jstests/sharding/geo_near_random2.js +++ b/jstests/sharding/geo_near_random2.js @@ -18,7 +18,7 @@ test.insertPts(5000); for (var i = (test.nPts/10); i < test.nPts; i+= (test.nPts/10)){ s.adminCommand({split: ('test.' + testName), middle: {_id: i} }); try { - s.adminCommand({moveChunk: ('test.' + testName), find: {_id: i-1}, to: ('shard000' + (i%3))}); + s.adminCommand({moveChunk: ('test.' + testName), find: {_id: i-1}, to: ('shard000' + (i%3)), _waitForDelete : true }); } catch (e) { // ignore this error if (! e.match(/that chunk is already on that shard/)){ diff --git a/jstests/sharding/key_many.js b/jstests/sharding/key_many.js index 42cacddb76b..75a9784096f 100644 --- a/jstests/sharding/key_many.js +++ b/jstests/sharding/key_many.js @@ -98,7 +98,7 @@ for ( var i=0; i<types.length; i++ ){ s.adminCommand( { split : longName , find : makeObjectDotted( curT.values[3] ) } ); s.adminCommand( { split : longName , find : makeObjectDotted( curT.values[3] ) } ); - s.adminCommand( { movechunk : longName , find : makeObjectDotted( curT.values[0] ) , to : secondary.getMongo().name } ); + s.adminCommand( { movechunk : longName , find : makeObjectDotted( curT.values[0] ) , to : secondary.getMongo().name, _waitForDelete : true } ); s.printChunks(); diff --git a/jstests/sharding/key_string.js b/jstests/sharding/key_string.js index bbc5dfb49ec..63ed7771db8 100644 --- a/jstests/sharding/key_string.js +++ b/jstests/sharding/key_string.js @@ -24,7 +24,7 @@ s.adminCommand( { split : "test.foo" , find : { name : "joe" } } ); // [Minkey - s.adminCommand( { split : "test.foo" , find : { name : "joe" } } ); // * [allan -> sara) , [sara -> Maxkey) s.adminCommand( { split : "test.foo" , find : { name : "joe" } } ); // [alan -> joe) , [joe -> sara] -s.adminCommand( { movechunk : "test.foo" , find : { name : "allan" } , to : seconday.getMongo().name } ); +s.adminCommand( { movechunk : "test.foo" , find : { name : "allan" } , to : seconday.getMongo().name, _waitForDelete : true } ); s.printChunks(); diff --git a/jstests/sharding/limit_push.js b/jstests/sharding/limit_push.js index 75ad271deb3..0ab14566190 100644 --- a/jstests/sharding/limit_push.js +++ b/jstests/sharding/limit_push.js @@ -16,7 +16,7 @@ s.adminCommand( { shardcollection : "test.limit_push" , key : { x : 1 } } ); // Now split the and move the data between the shards s.adminCommand( { split : "test.limit_push", middle : { x : 50 }} ); -s.adminCommand( { moveChunk: "test.limit_push", find : { x : 51}, to : "shard0000" }) +s.adminCommand( { moveChunk: "test.limit_push", find : { x : 51}, to : "shard0000", _waitForDelete : true }) // Check that the chunck have split correctly assert.eq( 2 , s.config.chunks.count() , "wrong number of chunks"); diff --git a/jstests/sharding/multi_mongos1.js b/jstests/sharding/multi_mongos1.js index 9778ff6059d..79b6dc08a48 100644 --- a/jstests/sharding/multi_mongos1.js +++ b/jstests/sharding/multi_mongos1.js @@ -43,11 +43,11 @@ s1.adminCommand( { split : "test.foo" , middle : { num : 1 } } ); s1.adminCommand( { split : "test.foo" , middle : { num : N } } ); // s2 is now stale w.r.t boundaires around { num: 1 } -res = s2.getDB( "admin" ).runCommand( { movechunk : "test.foo" , find : { num : 1 } , to : s1.getOther( s1.getServer( "test" ) ).name } ); +res = s2.getDB( "admin" ).runCommand( { movechunk : "test.foo" , find : { num : 1 } , to : s1.getOther( s1.getServer( "test" ) ).name, _waitForDelete : true } ); assert.eq( 0 , res.ok , "a move with stale boundaries should not have succeeded" + tojson(res) ); // s2 must have reloaded as a result of a failed move; retrying should work -res = s2.getDB( "admin" ).runCommand( { movechunk : "test.foo" , find : { num : 1 } , to : s1.getOther( s1.getServer( "test" ) ).name } ); +res = s2.getDB( "admin" ).runCommand( { movechunk : "test.foo" , find : { num : 1 } , to : s1.getOther( s1.getServer( "test" ) ).name, _waitForDelete : true } ); assert.eq( 1 , res.ok , "mongos did not reload after a failed migrate" + tojson(res) ); // s1 is not stale about the boundaries of [MinKey->1) diff --git a/jstests/sharding/no_empty_reset.js b/jstests/sharding/no_empty_reset.js index 3f37e6f956f..62ef74cc6b0 100644 --- a/jstests/sharding/no_empty_reset.js +++ b/jstests/sharding/no_empty_reset.js @@ -29,7 +29,7 @@ var fullShard = st.getShard( coll, { _id : 1 } ) var emptyShard = st.getShard( coll, { _id : -1 } ) var admin = st.s.getDB( "admin" ) -printjson( admin.runCommand({ moveChunk : "" + coll, find : { _id : -1 }, to : fullShard.shardName }) ) +printjson( admin.runCommand({ moveChunk : "" + coll, find : { _id : -1 }, to : fullShard.shardName, _waitForDelete : true }) ) jsTestLog( "Resetting shard version via first mongos..." ) diff --git a/jstests/sharding/shard2.js b/jstests/sharding/shard2.js index d7eeb764967..ff03bf7b24b 100644 --- a/jstests/sharding/shard2.js +++ b/jstests/sharding/shard2.js @@ -57,10 +57,10 @@ placeCheck( 2 ); // NOTE: at this point we have 2 shard on 1 server // test move shard -assert.throws( function(){ s.adminCommand( { movechunk : "test.foo" , find : { num : 1 } , to : primary.getMongo().name } ); } ); -assert.throws( function(){ s.adminCommand( { movechunk : "test.foo" , find : { num : 1 } , to : "adasd" } ) } ); +assert.throws( function(){ s.adminCommand( { movechunk : "test.foo" , find : { num : 1 } , to : primary.getMongo().name, _waitForDelete : true } ); } ); +assert.throws( function(){ s.adminCommand( { movechunk : "test.foo" , find : { num : 1 } , to : "adasd", _waitForDelete : true } ) } ); -s.adminCommand( { movechunk : "test.foo" , find : { num : 1 } , to : secondary.getMongo().name } ); +s.adminCommand( { movechunk : "test.foo" , find : { num : 1 } , to : secondary.getMongo().name, _waitForDelete : true } ); assert.eq( 2 , secondary.foo.find().length() , "secondary should have 2 after move shard" ); assert.eq( 1 , primary.foo.find().length() , "primary should only have 1 after move shard" ); @@ -221,10 +221,10 @@ assert.eq( 2 , s.onNumShards( "foo" ) , "on 2 shards" ); secondary.foo.insert( { num : -3 } ); -s.adminCommand( { movechunk : "test.foo" , find : { num : -2 } , to : secondary.getMongo().name } ); +s.adminCommand( { movechunk : "test.foo" , find : { num : -2 } , to : secondary.getMongo().name, _waitForDelete : true } ); assert.eq( 1 , s.onNumShards( "foo" ) , "on 1 shards" ); -s.adminCommand( { movechunk : "test.foo" , find : { num : -2 } , to : primary.getMongo().name } ); +s.adminCommand( { movechunk : "test.foo" , find : { num : -2 } , to : primary.getMongo().name, _waitForDelete : true } ); assert.eq( 2 , s.onNumShards( "foo" ) , "on 2 shards again" ); assert.eq( 3 , s.config.chunks.count() , "only 3 chunks" ); diff --git a/jstests/sharding/shard3.js b/jstests/sharding/shard3.js index 7b9cc33ccd1..785bcae1a40 100644 --- a/jstests/sharding/shard3.js +++ b/jstests/sharding/shard3.js @@ -37,7 +37,7 @@ assert.eq( 0 , secondary.count() , "s1" ) assert.eq( 1 , s.onNumShards( "foo" ) , "on 1 shards" ); s.adminCommand( { split : "test.foo" , middle : { num : 2 } } ); -s.adminCommand( { movechunk : "test.foo" , find : { num : 3 } , to : s.getOther( s.getServer( "test" ) ).name } ); +s.adminCommand( { movechunk : "test.foo" , find : { num : 3 } , to : s.getOther( s.getServer( "test" ) ).name, _waitForDelete : true } ); assert( primary.find().toArray().length > 0 , "blah 1" ); assert( secondary.find().toArray().length > 0 , "blah 2" ); @@ -89,7 +89,7 @@ assert( a.findOne( { num : 1 } ) , "pre move 1" ) s.printCollectionInfo( "test.foo" ); myto = s.getOther( s.getServer( "test" ) ).name print( "counts before move: " + tojson( s.shardCounts( "foo" ) ) ); -s.adminCommand( { movechunk : "test.foo" , find : { num : 1 } , to : myto } ) +s.adminCommand( { movechunk : "test.foo" , find : { num : 1 } , to : myto, _waitForDelete : true } ) print( "counts after move: " + tojson( s.shardCounts( "foo" ) ) ); s.printCollectionInfo( "test.foo" ); assert.eq( 1 , s.onNumShards( "foo" ) , "on 1 shard again" ); @@ -132,7 +132,7 @@ s.adminCommand( { shardcollection : "test.foo" , key : { num : 1 } } ); a.save( { num : 2 } ); a.save( { num : 3 } ); s.adminCommand( { split : "test.foo" , middle : { num : 2 } } ); -s.adminCommand( { movechunk : "test.foo" , find : { num : 3 } , to : s.getOther( s.getServer( "test" ) ).name } ); +s.adminCommand( { movechunk : "test.foo" , find : { num : 3 } , to : s.getOther( s.getServer( "test" ) ).name, _waitForDelete : true } ); s.printShardingStatus(); s.printCollectionInfo( "test.foo" , "after dropDatabase setup" ); @@ -165,7 +165,7 @@ assert.eq( 3 , dba.foo.count() , "Ba" ); assert.eq( 3 , dbb.foo.count() , "Bb" ); s.adminCommand( { split : "test2.foo" , middle : { num : 2 } } ); -s.adminCommand( { movechunk : "test2.foo" , find : { num : 3 } , to : s.getOther( s.getServer( "test2" ) ).name } ); +s.adminCommand( { movechunk : "test2.foo" , find : { num : 3 } , to : s.getOther( s.getServer( "test2" ) ).name, _waitForDelete : true } ); assert.eq( 2 , s.onNumShards( "foo" , "test2" ) , "B on 2 shards" ); diff --git a/jstests/sharding/shard4.js b/jstests/sharding/shard4.js index 2d7a0dff6ad..6b48b02bc2f 100644 --- a/jstests/sharding/shard4.js +++ b/jstests/sharding/shard4.js @@ -1,6 +1,7 @@ // shard4.js s = new ShardingTest( "shard4" , 2 , 50 , 2 ); +s.stopBalancer() s2 = s._mongos[1]; @@ -19,7 +20,7 @@ assert.eq( 7 , s.getDB( "test" ).foo.find().toArray().length , "normal A" ); assert.eq( 7 , s2.getDB( "test" ).foo.find().toArray().length , "other A" ); s.adminCommand( { split : "test.foo" , middle : { num : 4 } } ); -s.adminCommand( { movechunk : "test.foo" , find : { num : 3 } , to : s.getOther( s.getServer( "test" ) ).name } ); +s.adminCommand( { movechunk : "test.foo" , find : { num : 3 } , to : s.getOther( s.getServer( "test" ) ).name, _waitForDelete : true } ); assert( s._connections[0].getDB( "test" ).foo.find().toArray().length > 0 , "blah 1" ); assert( s._connections[1].getDB( "test" ).foo.find().toArray().length > 0 , "blah 2" ); diff --git a/jstests/sharding/shard5.js b/jstests/sharding/shard5.js index 050a7d70281..ba40014dad6 100644 --- a/jstests/sharding/shard5.js +++ b/jstests/sharding/shard5.js @@ -21,7 +21,7 @@ assert.eq( 7 , s.getDB( "test" ).foo.find().toArray().length , "normal A" ); assert.eq( 7 , s2.getDB( "test" ).foo.find().toArray().length , "other A" ); s.adminCommand( { split : "test.foo" , middle : { num : 4 } } ); -s.adminCommand( { movechunk : "test.foo" , find : { num : 3 } , to : s.getOther( s.getServer( "test" ) ).name } ); +s.adminCommand( { movechunk : "test.foo" , find : { num : 3 } , to : s.getOther( s.getServer( "test" ) ).name, _waitForDelete : true } ); assert( s._connections[0].getDB( "test" ).foo.find().toArray().length > 0 , "blah 1" ); assert( s._connections[1].getDB( "test" ).foo.find().toArray().length > 0 , "blah 2" ); diff --git a/jstests/slowNightly/sharding_rs2.js b/jstests/slowNightly/sharding_rs2.js index dde363a52b7..c5a22d95b8f 100644 --- a/jstests/slowNightly/sharding_rs2.js +++ b/jstests/slowNightly/sharding_rs2.js @@ -125,7 +125,7 @@ s.adminCommand( { split : "test.foo" , middle : { x : 50 } } ) db.printShardingStatus() other = s.config.shards.findOne( { _id : { $ne : serverName } } ); -s.adminCommand( { moveChunk : "test.foo" , find : { x : 10 } , to : other._id } ) +s.adminCommand( { moveChunk : "test.foo" , find : { x : 10 } , to : other._id, _waitForDelete : true } ) assert.eq( 100 , t.count() , "C3" ) assert.eq( 50 , rs.test.getMaster().getDB( "test" ).foo.count() , "C4" ) |