diff options
author | Benety Goh <benety@mongodb.com> | 2013-10-09 15:30:25 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2013-10-10 10:09:56 -0400 |
commit | 5bdf45f7e8d5c8b5645d8a20b4a94a331801d8df (patch) | |
tree | a866fa52cbef347b1e4114c3f35f735b4b011f8d /jstests/sharding/hash_basic.js | |
parent | 34f6c8e7db271ae320b0ae384b1d2f67cafb8e16 (diff) | |
download | mongo-5bdf45f7e8d5c8b5645d8a20b4a94a331801d8df.tar.gz |
SERVER-11122 wrap move chunk admin command in a retry loop to handle case when destination shard is not ready
Diffstat (limited to 'jstests/sharding/hash_basic.js')
-rw-r--r-- | jstests/sharding/hash_basic.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/jstests/sharding/hash_basic.js b/jstests/sharding/hash_basic.js index fd3c9bc42a1..14d598d0b17 100644 --- a/jstests/sharding/hash_basic.js +++ b/jstests/sharding/hash_basic.js @@ -74,10 +74,21 @@ assert.eq(chunkCountBefore + 3, chunkList.length); chunkList.forEach(function(chunkToMove) { var toShard = configDB.shards.findOne({ _id: { $ne: chunkToMove.shard }})._id; - var cmdRes = testDB.adminCommand({ moveChunk: 'test.user', - bounds: [ chunkToMove.min, chunkToMove.max ], - to: toShard, _waitForDelete: true }); - assert(cmdRes.ok, 'Cmd failed: ' + tojson(cmdRes)); + print(jsTestName() + " - moving chunk " + chunkToMove._id + " from shard " + + chunkToMove.shard + " to " + toShard + "..."); + + // Sometimes the TO-side shard isn't immediately ready, this + // causes problems on slow hosts. + // Remove when SERVER-10232 is fixed + + assert.soon(function() { + var cmdRes = testDB.adminCommand({ moveChunk: 'test.user', + bounds: [ chunkToMove.min, chunkToMove.max ], + to: toShard, _waitForDelete: true }); + print(jsTestName() + " - result from moving chunk " + chunkToMove._id + ": " + + tojson(cmdRes)); + return cmdRes.ok; + }, "Moving chunk " + chunkToMove._id, 10000, 1000); }); st.stop(); |