diff options
author | jannaerin <golden.janna@gmail.com> | 2018-02-07 17:38:49 -0500 |
---|---|---|
committer | jannaerin <golden.janna@gmail.com> | 2018-03-09 00:40:40 -0500 |
commit | da1e0304e8eb91711ea1c78eb8f62538b53680e7 (patch) | |
tree | e55d32a40a76a39e01d8848c5a17d97ad640b18e /jstests/sharding/find_and_modify_after_multi_write.js | |
parent | 0d5370783beeb4936a181dd2f69387da4b5e816c (diff) | |
download | mongo-da1e0304e8eb91711ea1c78eb8f62538b53680e7.tar.gz |
SERVER-32052 Update ShardingTest to default to starting shard servers as replica sets
Diffstat (limited to 'jstests/sharding/find_and_modify_after_multi_write.js')
-rw-r--r-- | jstests/sharding/find_and_modify_after_multi_write.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/jstests/sharding/find_and_modify_after_multi_write.js b/jstests/sharding/find_and_modify_after_multi_write.js index 15f54120706..749f999c54c 100644 --- a/jstests/sharding/find_and_modify_after_multi_write.js +++ b/jstests/sharding/find_and_modify_after_multi_write.js @@ -11,42 +11,42 @@ var testDB = st.s.getDB('test'); assert.commandWorked(testDB.adminCommand({enableSharding: 'test'})); - st.ensurePrimaryShard('test', 'shard0000'); + st.ensurePrimaryShard('test', st.shard0.shardName); assert.commandWorked(testDB.adminCommand({shardCollection: 'test.user', key: {x: 1}})); assert.commandWorked(testDB.adminCommand({split: 'test.user', middle: {x: 0}})); assert.commandWorked(testDB.adminCommand( - {moveChunk: 'test.user', find: {x: 0}, to: 'shard0001', _waitForDelete: true})); + {moveChunk: 'test.user', find: {x: 0}, to: st.shard1.shardName, _waitForDelete: true})); var testDB2 = st.s1.getDB('test'); testDB2.user.insert({x: 123456}); // Move chunk to bump version on a different mongos. assert.commandWorked(testDB.adminCommand( - {moveChunk: 'test.user', find: {x: 0}, to: 'shard0000', _waitForDelete: true})); + {moveChunk: 'test.user', find: {x: 0}, to: st.shard0.shardName, _waitForDelete: true})); // Issue a targetted findAndModify and check that it was upserted to the right shard. assert.commandWorked(testDB2.runCommand( {findAndModify: 'user', query: {x: 100}, update: {$set: {y: 1}}, upsert: true})); - assert.neq(null, st.d0.getDB('test').user.findOne({x: 100})); - assert.eq(null, st.d1.getDB('test').user.findOne({x: 100})); + assert.neq(null, st.rs0.getPrimary().getDB('test').user.findOne({x: 100})); + assert.eq(null, st.rs1.getPrimary().getDB('test').user.findOne({x: 100})); // At this point, s1 thinks the version of 'test.user' is 2, bounce it again so it gets // incremented to 3 assert.commandWorked(testDB.adminCommand( - {moveChunk: 'test.user', find: {x: 0}, to: 'shard0001', _waitForDelete: true})); + {moveChunk: 'test.user', find: {x: 0}, to: st.shard1.shardName, _waitForDelete: true})); assert.commandWorked(testDB2.runCommand( {findAndModify: 'user', query: {x: 200}, update: {$set: {y: 1}}, upsert: true})); - assert.eq(null, st.d0.getDB('test').user.findOne({x: 200})); - assert.neq(null, st.d1.getDB('test').user.findOne({x: 200})); + assert.eq(null, st.rs0.getPrimary().getDB('test').user.findOne({x: 200})); + assert.neq(null, st.rs1.getPrimary().getDB('test').user.findOne({x: 200})); // At this point, s0 thinks the version of 'test.user' is 3, bounce it again so it gets // incremented to 4 assert.commandWorked(testDB.adminCommand( - {moveChunk: 'test.user', find: {x: 0}, to: 'shard0000', _waitForDelete: true})); + {moveChunk: 'test.user', find: {x: 0}, to: st.shard0.shardName, _waitForDelete: true})); // Ensure that write commands with multi version do not reset the connection shard version // to @@ -56,8 +56,8 @@ assert.commandWorked(testDB2.runCommand( {findAndModify: 'user', query: {x: 300}, update: {$set: {y: 1}}, upsert: true})); - assert.neq(null, st.d0.getDB('test').user.findOne({x: 300})); - assert.eq(null, st.d1.getDB('test').user.findOne({x: 300})); + assert.neq(null, st.rs0.getPrimary().getDB('test').user.findOne({x: 300})); + assert.eq(null, st.rs1.getPrimary().getDB('test').user.findOne({x: 300})); st.stop(); }; |