summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2016-03-10 17:54:49 -0500
committerSpencer T Brody <spencer@mongodb.com>2016-03-18 16:46:30 -0400
commitfde6349069e18220e5d417f9d12dffab36b8942a (patch)
treef165d947e2d4f9e490808bdb9f0837a2a613181c /jstests
parent2412d7d3f090196ba933a2b9ba57f840ad46992a (diff)
downloadmongo-fde6349069e18220e5d417f9d12dffab36b8942a.tar.gz
SERVER-23076 Prevent coll_epoch_test1.js from routing inserts to the wrong shard
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/coll_epoch_test1.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/jstests/sharding/coll_epoch_test1.js b/jstests/sharding/coll_epoch_test1.js
index 0a65589ece6..3f6f3160b34 100644
--- a/jstests/sharding/coll_epoch_test1.js
+++ b/jstests/sharding/coll_epoch_test1.js
@@ -26,8 +26,10 @@ config.shards.find().forEach(function(doc) {
jsTest.log("Enabling sharding for the first time...");
admin.runCommand({enableSharding: coll.getDB() + ""});
+// TODO(PM-85): Make sure we *always* move the primary after collection lifecyle project is complete
st.ensurePrimaryShard(coll.getDB().getName(), 'shard0001');
admin.runCommand({shardCollection: coll + "", key: {_id: 1}});
+st.configRS.awaitLastOpCommitted(); // TODO: Remove after collection lifecyle project (PM-85)
var bulk = insertMongos.getCollection(coll + "").initializeUnorderedBulkOp();
for (var i = 0; i < 100; i++) {
@@ -76,11 +78,8 @@ var getOtherShard = function(shard) {
var otherShard = getOtherShard(config.databases.findOne({_id: coll.getDB() + ""}).primary);
assert.commandWorked(admin.runCommand({movePrimary: coll.getDB() + "", to: otherShard}));
-if (st.configRS) {
- // If we are in CSRS mode need to make sure that staleMongos will actually get
- // the most recent config data.
- st.configRS.awaitLastOpCommitted();
-}
+st.configRS.awaitLastOpCommitted(); // TODO: Remove after collection lifecyle project (PM-85)
+
jsTest.log("moved primary...");
bulk = insertMongos.getCollection(coll + "").initializeUnorderedBulkOp();