From c1a45ebbb0530e3d0201321d725527f1eb83ffce Mon Sep 17 00:00:00 2001 From: "clang-format-7.0.1" Date: Fri, 26 Jul 2019 18:42:24 -0400 Subject: Apply formatting per `clang-format-7.0.1` --- jstests/noPassthrough/two_phase_index_build.js | 106 ++++++++++++------------- 1 file changed, 53 insertions(+), 53 deletions(-) (limited to 'jstests/noPassthrough/two_phase_index_build.js') diff --git a/jstests/noPassthrough/two_phase_index_build.js b/jstests/noPassthrough/two_phase_index_build.js index d427571b2ec..084a360df11 100644 --- a/jstests/noPassthrough/two_phase_index_build.js +++ b/jstests/noPassthrough/two_phase_index_build.js @@ -6,71 +6,71 @@ (function() { - // For 'assertIndexes'. - load("jstests/noPassthrough/libs/index_build.js"); - - const replSet = new ReplSetTest({ - nodes: [ - {}, - { - // Disallow elections on secondary. - rsConfig: { - priority: 0, - votes: 0, - }, +// For 'assertIndexes'. +load("jstests/noPassthrough/libs/index_build.js"); + +const replSet = new ReplSetTest({ + nodes: [ + {}, + { + // Disallow elections on secondary. + rsConfig: { + priority: 0, + votes: 0, }, - ] - }); + }, + ] +}); - // Allow the createIndexes command to use the index builds coordinator in single-phase mode. - replSet.startSet({setParameter: {enableIndexBuildsCoordinatorForCreateIndexesCommand: true}}); - replSet.initiate(); +// Allow the createIndexes command to use the index builds coordinator in single-phase mode. +replSet.startSet({setParameter: {enableIndexBuildsCoordinatorForCreateIndexesCommand: true}}); +replSet.initiate(); - const testDB = replSet.getPrimary().getDB('test'); - const coll = testDB.twoPhaseIndexBuild; - const collName = coll.getName(); - const secondaryColl = replSet.getSecondary().getDB('test')[collName]; +const testDB = replSet.getPrimary().getDB('test'); +const coll = testDB.twoPhaseIndexBuild; +const collName = coll.getName(); +const secondaryColl = replSet.getSecondary().getDB('test')[collName]; - const bulk = coll.initializeUnorderedBulkOp(); - const numDocs = 1000; - for (let i = 0; i < numDocs; i++) { - bulk.insert({a: i, b: i}); - } - assert.commandWorked(bulk.execute()); +const bulk = coll.initializeUnorderedBulkOp(); +const numDocs = 1000; +for (let i = 0; i < numDocs; i++) { + bulk.insert({a: i, b: i}); +} +assert.commandWorked(bulk.execute()); - // Use index builds coordinator for a two-phase build - assert.commandWorked(testDB.runCommand( - {twoPhaseCreateIndexes: coll.getName(), indexes: [{key: {a: 1}, name: 'a_1'}]})); +// Use index builds coordinator for a two-phase build +assert.commandWorked(testDB.runCommand( + {twoPhaseCreateIndexes: coll.getName(), indexes: [{key: {a: 1}, name: 'a_1'}]})); - IndexBuildTest.assertIndexes(coll, 2, ["_id_", "a_1"]); - assert.eq(numDocs, coll.find({a: {$gte: 0}}).hint({a: 1}).itcount()); +IndexBuildTest.assertIndexes(coll, 2, ["_id_", "a_1"]); +assert.eq(numDocs, coll.find({a: {$gte: 0}}).hint({a: 1}).itcount()); - const cmdNs = testDB.getName() + ".$cmd"; - const localDB = testDB.getSiblingDB("local"); - const oplogColl = localDB.oplog.rs; +const cmdNs = testDB.getName() + ".$cmd"; +const localDB = testDB.getSiblingDB("local"); +const oplogColl = localDB.oplog.rs; - // Ensure both oplog entries were written to the oplog. - assert.eq(1, oplogColl.find({op: "c", ns: cmdNs, "o.startIndexBuild": collName}).itcount()); - assert.eq(1, oplogColl.find({op: "c", ns: cmdNs, "o.commitIndexBuild": collName}).itcount()); +// Ensure both oplog entries were written to the oplog. +assert.eq(1, oplogColl.find({op: "c", ns: cmdNs, "o.startIndexBuild": collName}).itcount()); +assert.eq(1, oplogColl.find({op: "c", ns: cmdNs, "o.commitIndexBuild": collName}).itcount()); - // Ensure the secondary builds the index. - replSet.waitForAllIndexBuildsToFinish(testDB.getName(), collName); - IndexBuildTest.assertIndexes(secondaryColl, 2, ["_id_", "a_1"]); +// Ensure the secondary builds the index. +replSet.waitForAllIndexBuildsToFinish(testDB.getName(), collName); +IndexBuildTest.assertIndexes(secondaryColl, 2, ["_id_", "a_1"]); - // Use index build coordinator for a single-phase index build through the createIndexes - // command. - assert.commandWorked( - testDB.runCommand({createIndexes: coll.getName(), indexes: [{key: {b: 1}, name: 'b_1'}]})); +// Use index build coordinator for a single-phase index build through the createIndexes +// command. +assert.commandWorked( + testDB.runCommand({createIndexes: coll.getName(), indexes: [{key: {b: 1}, name: 'b_1'}]})); - IndexBuildTest.assertIndexes(coll, 3, ["_id_", "a_1", "b_1"]); - assert.eq(numDocs, coll.find({a: {$gte: 0}}).hint({b: 1}).itcount()); +IndexBuildTest.assertIndexes(coll, 3, ["_id_", "a_1", "b_1"]); +assert.eq(numDocs, coll.find({a: {$gte: 0}}).hint({b: 1}).itcount()); - // Ensure only one oplog entry was written to the oplog. - assert.eq(1, oplogColl.find({op: "c", ns: cmdNs, "o.createIndexes": collName}).itcount()); +// Ensure only one oplog entry was written to the oplog. +assert.eq(1, oplogColl.find({op: "c", ns: cmdNs, "o.createIndexes": collName}).itcount()); - // Ensure the secondary builds the index. - replSet.waitForAllIndexBuildsToFinish(testDB.getName(), collName); - IndexBuildTest.assertIndexes(secondaryColl, 3, ["_id_", "a_1", "b_1"]); +// Ensure the secondary builds the index. +replSet.waitForAllIndexBuildsToFinish(testDB.getName(), collName); +IndexBuildTest.assertIndexes(secondaryColl, 3, ["_id_", "a_1", "b_1"]); - replSet.stopSet(); +replSet.stopSet(); })(); -- cgit v1.2.1