diff options
Diffstat (limited to 'jstests/sharding/stale_version_write.js')
-rw-r--r-- | jstests/sharding/stale_version_write.js | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/jstests/sharding/stale_version_write.js b/jstests/sharding/stale_version_write.js index bd603124548..1183e369b2e 100644 --- a/jstests/sharding/stale_version_write.js +++ b/jstests/sharding/stale_version_write.js @@ -1,37 +1,37 @@ // Tests whether a reset sharding version triggers errors (function() { - 'use strict'; +'use strict'; - var st = new ShardingTest({shards: 1, mongos: 2}); +var st = new ShardingTest({shards: 1, mongos: 2}); - var mongosA = st.s0; - var mongosB = st.s1; +var mongosA = st.s0; +var mongosB = st.s1; - jsTest.log("Adding new collections..."); +jsTest.log("Adding new collections..."); - var collA = mongosA.getCollection(jsTestName() + ".coll"); - assert.writeOK(collA.insert({hello: "world"})); +var collA = mongosA.getCollection(jsTestName() + ".coll"); +assert.writeOK(collA.insert({hello: "world"})); - var collB = mongosB.getCollection("" + collA); - assert.writeOK(collB.insert({hello: "world"})); +var collB = mongosB.getCollection("" + collA); +assert.writeOK(collB.insert({hello: "world"})); - jsTest.log("Enabling sharding..."); +jsTest.log("Enabling sharding..."); - assert.commandWorked(mongosA.getDB("admin").adminCommand({enableSharding: "" + collA.getDB()})); - assert.commandWorked( - mongosA.getDB("admin").adminCommand({shardCollection: "" + collA, key: {_id: 1}})); +assert.commandWorked(mongosA.getDB("admin").adminCommand({enableSharding: "" + collA.getDB()})); +assert.commandWorked( + mongosA.getDB("admin").adminCommand({shardCollection: "" + collA, key: {_id: 1}})); - // MongoD doesn't know about the config shard version *until* MongoS tells it - collA.findOne(); +// MongoD doesn't know about the config shard version *until* MongoS tells it +collA.findOne(); - jsTest.log("Trigger shard version mismatch..."); +jsTest.log("Trigger shard version mismatch..."); - assert.writeOK(collB.insert({goodbye: "world"})); +assert.writeOK(collB.insert({goodbye: "world"})); - print("Inserted..."); +print("Inserted..."); - assert.eq(3, collA.find().itcount()); - assert.eq(3, collB.find().itcount()); +assert.eq(3, collA.find().itcount()); +assert.eq(3, collB.find().itcount()); - st.stop(); +st.stop(); })(); |