diff options
author | Cheahuychou Mao <cheahuychou.mao@mongodb.com> | 2019-12-13 17:58:58 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-12-13 17:58:58 +0000 |
commit | ece2e8f36cff8f996ae584708a9dab80b6419e63 (patch) | |
tree | 801eb6a3a26e50158c0396731d16a850ad00cbd6 /jstests/sharding/create_idx_empty_primary.js | |
parent | 7b814efb10fff13671ae3beab7eee7e54aa27691 (diff) | |
download | mongo-ece2e8f36cff8f996ae584708a9dab80b6419e63.tar.gz |
SERVER-45103 Sharded index commands shouldn't target primary shard if it doesn't own chunks
Diffstat (limited to 'jstests/sharding/create_idx_empty_primary.js')
-rw-r--r-- | jstests/sharding/create_idx_empty_primary.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/jstests/sharding/create_idx_empty_primary.js b/jstests/sharding/create_idx_empty_primary.js index 86b81983a43..24dcca43700 100644 --- a/jstests/sharding/create_idx_empty_primary.js +++ b/jstests/sharding/create_idx_empty_primary.js @@ -1,5 +1,7 @@ /** - * Test to make sure that the createIndex command gets sent to all shards. + * Test to make sure that the createIndex command gets sent to all shards if the mongos + * version is last-stable, and to shards that own chunks only if the mongos version is + * latest. */ (function() { 'use strict'; @@ -20,14 +22,17 @@ assert.commandWorked(testDB.user.insert({_id: 0})); var res = testDB.user.ensureIndex({i: 1}); assert.commandWorked(res); +// TODO (SERVER-45017): Remove this check when v4.4 becomes last-stable. +const isLastStableMongos = (jsTestOptions().mongosBinVersion === "last-stable"); + var indexes = testDB.user.getIndexes(); -assert.eq(2, indexes.length); +assert.eq(isLastStableMongos ? 2 : 1, indexes.length); indexes = st.rs0.getPrimary().getDB('test').user.getIndexes(); assert.eq(2, indexes.length); indexes = st.rs1.getPrimary().getDB('test').user.getIndexes(); -assert.eq(2, indexes.length); +assert.eq(isLastStableMongos ? 2 : 1, indexes.length); st.stop(); })(); |