summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTad Marshall <tad@10gen.com>2013-05-13 11:12:02 -0400
committerEric Milkie <milkie@10gen.com>2013-05-17 10:13:58 -0400
commitc8db9c81f2311ec49ffe50a3cf97d9e50de86a84 (patch)
treefb6125d50da44782f24137e785881a44b9cbbb18
parent582288be1c56f76a731b891c451808959d0659c2 (diff)
downloadmongo-c8db9c81f2311ec49ffe50a3cf97d9e50de86a84.tar.gz
SERVER-9638 Handle case of previous moveChunk not finished yet
Depending on the speeds of operations in the shards, it is possible that the "to" shard has not finished a migration when we try the next one. Use assert.soon() to wait a little and retry when this happens.
-rw-r--r--jstests/sharding/no_empty_reset.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/jstests/sharding/no_empty_reset.js b/jstests/sharding/no_empty_reset.js
index 62ef74cc6b0..91207147e90 100644
--- a/jstests/sharding/no_empty_reset.js
+++ b/jstests/sharding/no_empty_reset.js
@@ -29,7 +29,18 @@ 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, _waitForDelete : true }) )
+assert.soon(
+ function () {
+ var result = admin.runCommand( { moveChunk: "" + coll,
+ find: { _id: -1 },
+ to: fullShard.shardName,
+ _waitForDelete: true } );
+ jsTestLog('moveChunk result = ' + tojson(result));
+ return result.ok;
+ },
+ "Setup FAILURE: Unable to move chunk from " + emptyShard.shardName +
+ " to " + fullShard.shardName
+);
jsTestLog( "Resetting shard version via first mongos..." )
@@ -48,4 +59,5 @@ st.printShardingStatus()
assert.eq( 0, emptyColl.find().itcount() )
-
+jsTestLog("DONE!");
+st.stop();