summaryrefslogtreecommitdiff
path: root/jstests/sharding/multi_mongos2.js
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-02-15 14:07:58 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2018-03-09 17:18:49 -0500
commitb9e20190b647fea262a8f4e154bbf18d9934a3ba (patch)
treec61003bc12d86333fe7cfc717f23a89777e5cce3 /jstests/sharding/multi_mongos2.js
parentdbfc1e30a2e06732c5cd3d20aabfff67737f3521 (diff)
downloadmongo-b9e20190b647fea262a8f4e154bbf18d9934a3ba.tar.gz
SERVER-32198 Make ShardedConnectionInfo::getVersion return boost::optional
This allows the logic for making the shard version decision to be concentrated in CollectionShardingState entirely.
Diffstat (limited to 'jstests/sharding/multi_mongos2.js')
-rw-r--r--jstests/sharding/multi_mongos2.js26
1 files changed, 8 insertions, 18 deletions
diff --git a/jstests/sharding/multi_mongos2.js b/jstests/sharding/multi_mongos2.js
index aef63e6b684..27d6dd447c7 100644
--- a/jstests/sharding/multi_mongos2.js
+++ b/jstests/sharding/multi_mongos2.js
@@ -6,26 +6,20 @@
assert.commandWorked(st.s0.adminCommand({enablesharding: "test"}));
st.ensurePrimaryShard('test', st.shard1.shardName);
+
+ // "test.foo" - sharded (by mongos 0)
assert.commandWorked(st.s0.adminCommand({shardcollection: "test.foo", key: {num: 1}}));
- // Test queries
+ // "test.existing" - unsharded
assert.writeOK(st.s0.getDB('test').existing.insert({_id: 1}));
assert.eq(1, st.s0.getDB('test').existing.count({_id: 1}));
assert.eq(1, st.s1.getDB('test').existing.count({_id: 1}));
+ // "test.existing" - unsharded to sharded (by mongos 1)
assert.commandWorked(st.s1.adminCommand({shardcollection: "test.existing", key: {_id: 1}}));
assert.commandWorked(st.s1.adminCommand({split: "test.existing", middle: {_id: 5}}));
-
- assert.commandWorked(st.s1.adminCommand({
- moveChunk: "test.existing",
- find: {_id: 1},
- to: st.getOther(st.getPrimaryShard("test")).name
- }));
-
- printjson(st.s1.adminCommand({"getShardVersion": "test.existing"}));
- printjson(new Mongo(st.getPrimaryShard("test").name).getDB("admin").adminCommand({
- "getShardVersion": "test.existing"
- }));
+ assert.commandWorked(
+ st.s1.adminCommand({moveChunk: "test.existing", find: {_id: 1}, to: st.shard0.shardName}));
assert.eq(1, st.s0.getDB('test').existing.count({_id: 1})); // SERVER-2828
assert.eq(1, st.s1.getDB('test').existing.count({_id: 1}));
@@ -52,12 +46,8 @@
assert.writeOK(st.s1.adminCommand({shardcollection: "test.existing3", key: {_id: 1}}));
assert.commandWorked(st.s1.adminCommand({split: "test.existing3", middle: {_id: 5}}));
-
- assert.commandWorked(st.s0.adminCommand({
- moveChunk: "test.existing3",
- find: {_id: 1},
- to: st.getOther(st.getPrimaryShard("test")).name
- }));
+ assert.commandWorked(
+ st.s0.adminCommand({moveChunk: "test.existing3", find: {_id: 1}, to: st.shard0.shardName}));
st.stop();
})();