summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorGreg Studer <greg@10gen.com>2013-08-22 10:22:06 -0400
committerGreg Studer <greg@10gen.com>2013-08-22 10:22:06 -0400
commit7dfeb872e97a331d88f34a56b5a68ca4fb2ac93f (patch)
treea6cc554e9ab445acbcfe09914c8d1502b97a7e48 /jstests
parent3696ac227caa1dd04aa133ad202b8250ebd7c02d (diff)
downloadmongo-7dfeb872e97a331d88f34a56b5a68ca4fb2ac93f.tar.gz
SERVER-10599 cleanup_orphaned_cmd.js need to wait for migration to finish so test deterministic
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/cleanup_orphaned_cmd.js11
-rw-r--r--jstests/sharding/cleanup_orphaned_cmd_hashed.js6
-rw-r--r--jstests/sharding/cleanup_orphaned_cmd_prereload.js15
3 files changed, 25 insertions, 7 deletions
diff --git a/jstests/sharding/cleanup_orphaned_cmd.js b/jstests/sharding/cleanup_orphaned_cmd.js
index 38f9719c227..872d124cfda 100644
--- a/jstests/sharding/cleanup_orphaned_cmd.js
+++ b/jstests/sharding/cleanup_orphaned_cmd.js
@@ -16,7 +16,10 @@ assert( admin.runCommand({ enableSharding : coll.getDB() + "" }).ok );
printjson( admin.runCommand({ movePrimary : coll.getDB() + "", to : shards[0]._id }) );
assert( admin.runCommand({ shardCollection : coll + "", key : { _id : 1 } }).ok );
assert( admin.runCommand({ split : coll + "", middle : { _id : 0 } }).ok );
-assert( admin.runCommand({ moveChunk : coll + "", find : { _id : 0 }, to : shards[1]._id }).ok );
+assert( admin.runCommand({ moveChunk : coll + "",
+ find : { _id : 0 },
+ to : shards[1]._id,
+ _waitForDelete : true }).ok );
st.printShardingStatus();
@@ -55,7 +58,11 @@ jsTest.log( "Moving half the data out again (making a hole)..." );
assert( admin.runCommand({ split : coll + "", middle : { _id : -35 } }).ok );
assert( admin.runCommand({ split : coll + "", middle : { _id : -10 } }).ok );
-assert( admin.runCommand({ moveChunk : coll + "", find : { _id : -35 }, to : shards[1]._id }).ok );
+// Make sure we wait for the deletion here, otherwise later cleanup could fail
+assert( admin.runCommand({ moveChunk : coll + "",
+ find : { _id : -35 },
+ to : shards[1]._id,
+ _waitForDelete : true }).ok );
// 1/4 the data is on the first shard
diff --git a/jstests/sharding/cleanup_orphaned_cmd_hashed.js b/jstests/sharding/cleanup_orphaned_cmd_hashed.js
index 5165bde661f..db19e55a79f 100644
--- a/jstests/sharding/cleanup_orphaned_cmd_hashed.js
+++ b/jstests/sharding/cleanup_orphaned_cmd_hashed.js
@@ -24,10 +24,12 @@ assert( admin.runCommand({ split : coll + "", middle : { _id : NumberLong(50) }
assert( admin.runCommand({ split : coll + "", middle : { _id : NumberLong(100) } }).ok );
assert( admin.runCommand({ moveChunk : coll + "", bounds : [{ _id : NumberLong(-100) },
{ _id : NumberLong(-50) }],
- to : shards[1]._id }).ok );
+ to : shards[1]._id,
+ _waitForDelete : true }).ok );
assert( admin.runCommand({ moveChunk : coll + "", bounds : [{ _id : NumberLong(50) },
{ _id : NumberLong(100) }],
- to : shards[0]._id }).ok );
+ to : shards[0]._id,
+ _waitForDelete : true }).ok );
st.printShardingStatus();
jsTest.log( "Inserting some docs on each shard, so 1/2 will be orphaned..." );
diff --git a/jstests/sharding/cleanup_orphaned_cmd_prereload.js b/jstests/sharding/cleanup_orphaned_cmd_prereload.js
index d2dbd276a04..5b34748f7d5 100644
--- a/jstests/sharding/cleanup_orphaned_cmd_prereload.js
+++ b/jstests/sharding/cleanup_orphaned_cmd_prereload.js
@@ -21,8 +21,14 @@ jsTest.log( "Moving some chunks to shard1..." );
assert( admin.runCommand({ split : coll + "", middle : { _id : 0 } }).ok );
assert( admin.runCommand({ split : coll + "", middle : { _id : 1 } }).ok );
-assert( admin.runCommand({ moveChunk : coll + "", find : { _id : 0 }, to : shards[1]._id }).ok );
-assert( admin.runCommand({ moveChunk : coll + "", find : { _id : 1 }, to : shards[1]._id }).ok );
+assert( admin.runCommand({ moveChunk : coll + "",
+ find : { _id : 0 },
+ to : shards[1]._id,
+ _waitForDelete : true }).ok );
+assert( admin.runCommand({ moveChunk : coll + "",
+ find : { _id : 1 },
+ to : shards[1]._id,
+ _waitForDelete : true }).ok );
var metadata = st.shard1.getDB( "admin" )
.runCommand({ getShardVersion : coll + "", fullMetadata : true }).metadata;
@@ -50,7 +56,10 @@ assert.eq( metadata.shardVersion.t, 0 );
assert.neq( metadata.collVersion.t, 0 );
assert.eq( metadata.pending.length, 0 );
-assert( admin.runCommand({ moveChunk : coll + "", find : { _id : 1 }, to : shards[0]._id }).ok );
+assert( admin.runCommand({ moveChunk : coll + "",
+ find : { _id : 1 },
+ to : shards[0]._id,
+ _waitForDelete : true }).ok );
var metadata = st.shard0.getDB( "admin" )
.runCommand({ getShardVersion : coll + "", fullMetadata : true }).metadata;