diff options
Diffstat (limited to 'jstests/sharding/move_chunk_insert_with_write_retryability.js')
-rw-r--r-- | jstests/sharding/move_chunk_insert_with_write_retryability.js | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/jstests/sharding/move_chunk_insert_with_write_retryability.js b/jstests/sharding/move_chunk_insert_with_write_retryability.js index 0f755de41c4..c6a79000712 100644 --- a/jstests/sharding/move_chunk_insert_with_write_retryability.js +++ b/jstests/sharding/move_chunk_insert_with_write_retryability.js @@ -1,48 +1,48 @@ load("jstests/sharding/move_chunk_with_session_helper.js"); (function() { - "use strict"; +"use strict"; - load("jstests/libs/retryable_writes_util.js"); +load("jstests/libs/retryable_writes_util.js"); - if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) { - jsTestLog("Retryable writes are not supported, skipping test"); - return; - } +if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) { + jsTestLog("Retryable writes are not supported, skipping test"); + return; +} - // Prevent unnecessary elections in the first shard replica set. Shard 'rs1' shard will need its - // secondary to get elected, so we don't give it a zero priority. - var st = new ShardingTest({ - mongos: 2, - shards: { - rs0: {nodes: [{rsConfig: {}}, {rsConfig: {priority: 0}}]}, - rs1: {nodes: [{rsConfig: {}}, {rsConfig: {}}]} - } - }); - assert.commandWorked(st.s.adminCommand({enableSharding: 'test'})); - st.ensurePrimaryShard('test', st.shard0.shardName); +// Prevent unnecessary elections in the first shard replica set. Shard 'rs1' shard will need its +// secondary to get elected, so we don't give it a zero priority. +var st = new ShardingTest({ + mongos: 2, + shards: { + rs0: {nodes: [{rsConfig: {}}, {rsConfig: {priority: 0}}]}, + rs1: {nodes: [{rsConfig: {}}, {rsConfig: {}}]} + } +}); +assert.commandWorked(st.s.adminCommand({enableSharding: 'test'})); +st.ensurePrimaryShard('test', st.shard0.shardName); - var coll = 'insert'; - var cmd = { - insert: coll, - documents: [{x: 10}, {x: 30}], - ordered: false, - lsid: {id: UUID()}, - txnNumber: NumberLong(34), - }; - var setup = function() {}; - var checkRetryResult = function(result, retryResult) { - assert.eq(result.ok, retryResult.ok); - assert.eq(result.n, retryResult.n); - assert.eq(result.writeErrors, retryResult.writeErrors); - assert.eq(result.writeConcernErrors, retryResult.writeConcernErrors); - }; - var checkDocuments = function(coll) { - assert.eq(1, coll.find({x: 10}).itcount()); - assert.eq(1, coll.find({x: 30}).itcount()); - }; +var coll = 'insert'; +var cmd = { + insert: coll, + documents: [{x: 10}, {x: 30}], + ordered: false, + lsid: {id: UUID()}, + txnNumber: NumberLong(34), +}; +var setup = function() {}; +var checkRetryResult = function(result, retryResult) { + assert.eq(result.ok, retryResult.ok); + assert.eq(result.n, retryResult.n); + assert.eq(result.writeErrors, retryResult.writeErrors); + assert.eq(result.writeConcernErrors, retryResult.writeConcernErrors); +}; +var checkDocuments = function(coll) { + assert.eq(1, coll.find({x: 10}).itcount()); + assert.eq(1, coll.find({x: 30}).itcount()); +}; - testMoveChunkWithSession(st, coll, cmd, setup, checkRetryResult, checkDocuments); +testMoveChunkWithSession(st, coll, cmd, setup, checkRetryResult, checkDocuments); - st.stop(); +st.stop(); })(); |