diff options
author | Spencer T Brody <spencer@mongodb.com> | 2015-10-08 16:52:04 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2015-10-08 17:17:26 -0400 |
commit | 5ebaba96ce8d8cc17686ae4cdf043c470fbfc1e8 (patch) | |
tree | 9dc71e2a43332b15635c0535feda3009da98869b /jstests/sharding | |
parent | 0116be44abc6e7fce14e462c8087074bf5e71f8c (diff) | |
download | mongo-5ebaba96ce8d8cc17686ae4cdf043c470fbfc1e8.tar.gz |
SERVER-20676 Retry move chunk if it fails due to stale chunk boundaries
This reverts commit 0891369a428c69283544d4689883eab4e7e31dd9.
Diffstat (limited to 'jstests/sharding')
-rw-r--r-- | jstests/sharding/move_stale_mongos.js | 25 | ||||
-rw-r--r-- | jstests/sharding/split_chunk.js | 6 |
2 files changed, 30 insertions, 1 deletions
diff --git a/jstests/sharding/move_stale_mongos.js b/jstests/sharding/move_stale_mongos.js new file mode 100644 index 00000000000..beaa7d34987 --- /dev/null +++ b/jstests/sharding/move_stale_mongos.js @@ -0,0 +1,25 @@ +// +// Tests that stale mongoses can properly move chunks. +// + +var st = new ShardingTest({shards: 2, mongos: 2}); +var admin = st.s0.getDB('admin'); +var testDb = 'test'; +var testNs = 'test.foo'; +var shards = st.getShardNames(); + +assert.commandWorked(admin.runCommand({enableSharding: testDb})); +st.ensurePrimaryShard(testDb, shards[0]); +assert.commandWorked(admin.runCommand({shardCollection: testNs, key: {_id: 1}})); +var curShardIndex = 0; + +for (var i = 0; i < 100; i += 10) { + assert.commandWorked(st.s0.getDB('admin').runCommand({split: testNs, middle: {_id: i}})); + var nextShardIndex = (curShardIndex + 1) % shards.length; + assert.commandWorked(st.s1.getDB('admin').runCommand({moveChunk: testNs, + find: {_id: i + 5}, + to: shards[nextShardIndex]})); + curShardIndex = nextShardIndex; +} + +st.stop();
\ No newline at end of file diff --git a/jstests/sharding/split_chunk.js b/jstests/sharding/split_chunk.js index 2f18f8c8504..0f3a33f324d 100644 --- a/jstests/sharding/split_chunk.js +++ b/jstests/sharding/split_chunk.js @@ -12,13 +12,17 @@ var testDB = st.s.getDB('test'); testDB.adminCommand({ enableSharding: 'test' }); var callSplit = function(db, minKey, maxKey, splitPoints) { + var res = st.s.adminCommand({getShardVersion: "test.user"}); + assert.commandWorked(res); + var shardVersion = [res.version, res.versionEpoch]; return db.runCommand({ splitChunk: 'test.user', from: 'shard0000', min: minKey, max: maxKey, keyPattern: { x: 1 }, - splitKeys: splitPoints + splitKeys: splitPoints, + shardVersion: shardVersion, }); }; |