diff options
author | clang-format-7.0.1 <adam.martin@10gen.com> | 2019-07-26 18:20:35 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-07-27 11:02:23 -0400 |
commit | 134a4083953270e8a11430395357fb70a29047ad (patch) | |
tree | dd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/sharding/count_slaveok.js | |
parent | 1e46b5049003f427047e723ea5fab15b5a9253ca (diff) | |
download | mongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz |
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/sharding/count_slaveok.js')
-rw-r--r-- | jstests/sharding/count_slaveok.js | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/jstests/sharding/count_slaveok.js b/jstests/sharding/count_slaveok.js index f93ed7e0fa6..596509c1c2d 100644 --- a/jstests/sharding/count_slaveok.js +++ b/jstests/sharding/count_slaveok.js @@ -7,67 +7,67 @@ TestData.skipCheckingUUIDsConsistentAcrossCluster = true; (function() { - 'use strict'; +'use strict'; - load("jstests/replsets/rslib.js"); +load("jstests/replsets/rslib.js"); - var st = new ShardingTest({shards: 1, mongos: 1, other: {rs: true, rs0: {nodes: 2}}}); - var rst = st.rs0; +var st = new ShardingTest({shards: 1, mongos: 1, other: {rs: true, rs0: {nodes: 2}}}); +var rst = st.rs0; - // Insert data into replica set - var conn = new Mongo(st.s.host); +// Insert data into replica set +var conn = new Mongo(st.s.host); - var coll = conn.getCollection('test.countSlaveOk'); - coll.drop(); +var coll = conn.getCollection('test.countSlaveOk'); +coll.drop(); - var bulk = coll.initializeUnorderedBulkOp(); - for (var i = 0; i < 300; i++) { - bulk.insert({i: i % 10}); - } - assert.writeOK(bulk.execute()); +var bulk = coll.initializeUnorderedBulkOp(); +for (var i = 0; i < 300; i++) { + bulk.insert({i: i % 10}); +} +assert.writeOK(bulk.execute()); - var connA = conn; - var connB = new Mongo(st.s.host); - var connC = new Mongo(st.s.host); +var connA = conn; +var connB = new Mongo(st.s.host); +var connC = new Mongo(st.s.host); - st.printShardingStatus(); +st.printShardingStatus(); - // Wait for client to update itself and replication to finish - rst.awaitReplication(); +// Wait for client to update itself and replication to finish +rst.awaitReplication(); - var primary = rst.getPrimary(); - var sec = rst.getSecondary(); +var primary = rst.getPrimary(); +var sec = rst.getSecondary(); - // Data now inserted... stop the master, since only two in set, other will still be secondary - rst.stop(rst.getPrimary()); - printjson(rst.status()); +// Data now inserted... stop the master, since only two in set, other will still be secondary +rst.stop(rst.getPrimary()); +printjson(rst.status()); - // Wait for the mongos to recognize the slave - awaitRSClientHosts(conn, sec, {ok: true, secondary: true}); +// Wait for the mongos to recognize the slave +awaitRSClientHosts(conn, sec, {ok: true, secondary: true}); - // Make sure that mongos realizes that primary is already down - awaitRSClientHosts(conn, primary, {ok: false}); +// Make sure that mongos realizes that primary is already down +awaitRSClientHosts(conn, primary, {ok: false}); - // Need to check slaveOk=true first, since slaveOk=false will destroy conn in pool when - // master is down - conn.setSlaveOk(); +// Need to check slaveOk=true first, since slaveOk=false will destroy conn in pool when +// master is down +conn.setSlaveOk(); - // count using the command path - assert.eq(30, coll.find({i: 0}).count()); - // count using the query path - assert.eq(30, coll.find({i: 0}).itcount()); - assert.eq(10, coll.distinct("i").length); +// count using the command path +assert.eq(30, coll.find({i: 0}).count()); +// count using the query path +assert.eq(30, coll.find({i: 0}).itcount()); +assert.eq(10, coll.distinct("i").length); - try { - conn.setSlaveOk(false); - // Should throw exception, since not slaveOk'd - coll.find({i: 0}).count(); +try { + conn.setSlaveOk(false); + // Should throw exception, since not slaveOk'd + coll.find({i: 0}).count(); - print("Should not reach here!"); - assert(false); - } catch (e) { - print("Non-slaveOk'd connection failed."); - } + print("Should not reach here!"); + assert(false); +} catch (e) { + print("Non-slaveOk'd connection failed."); +} - st.stop(); +st.stop(); })(); |