summaryrefslogtreecommitdiff
path: root/jstests/parallel
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:17:50 -0500
committerJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:18:14 -0500
commit4ae691e8edc87d0e3cfb633bb91c328426be007b (patch)
tree52079a593f54382ca13a2e741633eab1b6271893 /jstests/parallel
parenta025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff)
downloadmongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/parallel')
-rw-r--r--jstests/parallel/allops.js40
-rw-r--r--jstests/parallel/basic.js16
-rw-r--r--jstests/parallel/basicPlus.js35
-rw-r--r--jstests/parallel/checkMultiThread.js18
-rw-r--r--jstests/parallel/del.js81
-rw-r--r--jstests/parallel/insert.js20
-rw-r--r--jstests/parallel/manyclients.js32
-rw-r--r--jstests/parallel/repl.js68
-rw-r--r--jstests/parallel/shellfork.js50
-rw-r--r--jstests/parallel/update_serializability1.js20
-rw-r--r--jstests/parallel/update_serializability2.js21
11 files changed, 205 insertions, 196 deletions
diff --git a/jstests/parallel/allops.js b/jstests/parallel/allops.js
index aff77ced7fe..b0d6e7188a3 100644
--- a/jstests/parallel/allops.js
+++ b/jstests/parallel/allops.js
@@ -8,34 +8,34 @@ Random.setRandomSeed();
t = new ParallelTester();
-for( id = 0; id < 10; ++id ) {
- var g = new EventGenerator( id, "jstests_parallel_allops", Random.randInt( 20 ) );
- for( var j = 0; j < 1000; ++j ) {
- var op = Random.randInt( 3 );
- switch( op ) {
- case 0: // insert
- g.addInsert( { _id:Random.randInt( 1000 ) } );
+for (id = 0; id < 10; ++id) {
+ var g = new EventGenerator(id, "jstests_parallel_allops", Random.randInt(20));
+ for (var j = 0; j < 1000; ++j) {
+ var op = Random.randInt(3);
+ switch (op) {
+ case 0: // insert
+ g.addInsert({_id: Random.randInt(1000)});
break;
- case 1: // remove
- g.addRemove( { _id:Random.randInt( 1000 ) } );
+ case 1: // remove
+ g.addRemove({_id: Random.randInt(1000)});
break;
- case 2: // update
- g.addUpdate( {_id:{$lt:1000}}, { _id:Random.randInt( 1000 ) } );
+ case 2: // update
+ g.addUpdate({_id: {$lt: 1000}}, {_id: Random.randInt(1000)});
break;
default:
- assert( false, "Invalid op code" );
+ assert(false, "Invalid op code");
}
}
- t.add( EventGenerator.dispatch, g.getEvents() );
+ t.add(EventGenerator.dispatch, g.getEvents());
}
-var g = new EventGenerator( id, "jstests_parallel_allops", Random.randInt( 5 ) );
-for( var j = 1000; j < 3000; ++j ) {
- g.addCheckCount( j - 1000, { _id: {$gte:1000} }, j % 100 == 0, j % 500 == 0 );
- g.addInsert( {_id:j} );
+var g = new EventGenerator(id, "jstests_parallel_allops", Random.randInt(5));
+for (var j = 1000; j < 3000; ++j) {
+ g.addCheckCount(j - 1000, {_id: {$gte: 1000}}, j % 100 == 0, j % 500 == 0);
+ g.addInsert({_id: j});
}
-t.add( EventGenerator.dispatch, g.getEvents() );
+t.add(EventGenerator.dispatch, g.getEvents());
-t.run( "one or more tests failed" );
+t.run("one or more tests failed");
-assert( f.validate().valid );
+assert(f.validate().valid);
diff --git a/jstests/parallel/basic.js b/jstests/parallel/basic.js
index 5d9183556a1..e863d0d5f45 100644
--- a/jstests/parallel/basic.js
+++ b/jstests/parallel/basic.js
@@ -3,15 +3,15 @@ load('jstests/libs/parallelTester.js');
Random.setRandomSeed();
-var params = ParallelTester.createJstestsLists( 4 );
+var params = ParallelTester.createJstestsLists(4);
var t = new ParallelTester();
-for( i in params ) {
- t.add( ParallelTester.fileTester, params[ i ] );
+for (i in params) {
+ t.add(ParallelTester.fileTester, params[i]);
}
-t.run( "one or more tests failed", true );
+t.run("one or more tests failed", true);
-db.getCollectionNames().forEach( function( x ) {
- v = db[ x ].validate();
- assert( v.valid, "validate failed for " + x + " with " + tojson( v ) );
- } ); \ No newline at end of file
+db.getCollectionNames().forEach(function(x) {
+ v = db[x].validate();
+ assert(v.valid, "validate failed for " + x + " with " + tojson(v));
+}); \ No newline at end of file
diff --git a/jstests/parallel/basicPlus.js b/jstests/parallel/basicPlus.js
index 2153923c67a..2ecb20d6c21 100644
--- a/jstests/parallel/basicPlus.js
+++ b/jstests/parallel/basicPlus.js
@@ -6,26 +6,29 @@ c.drop();
Random.setRandomSeed();
-var params = ParallelTester.createJstestsLists( 4 );
+var params = ParallelTester.createJstestsLists(4);
var t = new ParallelTester();
-for( i in params ) {
- t.add( ParallelTester.fileTester, params[ i ] );
+for (i in params) {
+ t.add(ParallelTester.fileTester, params[i]);
}
-for( var i = 4; i < 8; ++i ) {
- var g = new EventGenerator( i, "jstests_parallel_basicPlus", Random.randInt( 20 ) );
- for( var j = ( i - 4 ) * 3000; j < ( i - 3 ) * 3000; ++j ) {
- var expected = j - ( ( i - 4 ) * 3000 );
- g.addCheckCount( expected, {_id:{$gte:((i-4)*3000),$lt:((i-3)*3000)}}, expected % 1000 == 0, expected % 500 == 0 );
- g.addInsert( {_id:j} );
+for (var i = 4; i < 8; ++i) {
+ var g = new EventGenerator(i, "jstests_parallel_basicPlus", Random.randInt(20));
+ for (var j = (i - 4) * 3000; j < (i - 3) * 3000; ++j) {
+ var expected = j - ((i - 4) * 3000);
+ g.addCheckCount(expected,
+ {_id: {$gte: ((i - 4) * 3000), $lt: ((i - 3) * 3000)}},
+ expected % 1000 == 0,
+ expected % 500 == 0);
+ g.addInsert({_id: j});
}
- t.add( EventGenerator.dispatch, g.getEvents() );
+ t.add(EventGenerator.dispatch, g.getEvents());
}
-t.run( "one or more tests failed", true );
+t.run("one or more tests failed", true);
-assert( c.validate().valid, "validate failed" );
-db.getCollectionNames().forEach( function( x ) {
- v = db[ x ].validate();
- assert( v.valid, "validate failed for " + x + " with " + tojson( v ) );
- } ); \ No newline at end of file
+assert(c.validate().valid, "validate failed");
+db.getCollectionNames().forEach(function(x) {
+ v = db[x].validate();
+ assert(v.valid, "validate failed for " + x + " with " + tojson(v));
+}); \ No newline at end of file
diff --git a/jstests/parallel/checkMultiThread.js b/jstests/parallel/checkMultiThread.js
index 0332fe32e84..a6b92689bec 100644
--- a/jstests/parallel/checkMultiThread.js
+++ b/jstests/parallel/checkMultiThread.js
@@ -2,13 +2,19 @@ load('jstests/libs/parallelTester.js');
var start = new Date();
print("start: " + start);
-var func = function() { db.runCommand({$eval: "sleep(10000);", nolock: true}); return new Date();};
-a = new ScopedThread( func );
-b = new ScopedThread( func );
+var func = function() {
+ db.runCommand({$eval: "sleep(10000);", nolock: true});
+ return new Date();
+};
+a = new ScopedThread(func);
+b = new ScopedThread(func);
a.start();
b.start();
a.join();
b.join();
-assert.lt( a.returnData().getMilliseconds(), start.getMilliseconds() + 15000, "A took more than 15s" );
-assert.lt( b.returnData().getMilliseconds(), start.getMilliseconds() + 15000, "B took more than 15s" );
-
+assert.lt(a.returnData().getMilliseconds(),
+ start.getMilliseconds() + 15000,
+ "A took more than 15s");
+assert.lt(b.returnData().getMilliseconds(),
+ start.getMilliseconds() + 15000,
+ "B took more than 15s");
diff --git a/jstests/parallel/del.js b/jstests/parallel/del.js
index 17c97bc499b..3128f89d05e 100644
--- a/jstests/parallel/del.js
+++ b/jstests/parallel/del.js
@@ -3,71 +3,66 @@ load('jstests/libs/parallelTester.js');
N = 1000;
HOST = db.getMongo().host;
-a = db.getSisterDB( "fooa" );
-b = db.getSisterDB( "foob" );
+a = db.getSisterDB("fooa");
+b = db.getSisterDB("foob");
a.dropDatabase();
b.dropDatabase();
-function del1( dbname, host, max ){
- var m = new Mongo( host );
- var db = m.getDB( "foo" + dbname );
+function del1(dbname, host, max) {
+ var m = new Mongo(host);
+ var db = m.getDB("foo" + dbname);
var t = db.del;
- while ( !db.del_parallel.count() ){
+ while (!db.del_parallel.count()) {
var r = Math.random();
- var n = Math.floor( Math.random() * max );
- if ( r < .9 ){
- t.insert( { x : n } );
+ var n = Math.floor(Math.random() * max);
+ if (r < .9) {
+ t.insert({x: n});
+ } else if (r < .98) {
+ t.remove({x: n});
+ } else if (r < .99) {
+ t.remove({x: {$lt: n}});
+ } else {
+ t.remove({x: {$gt: n}});
}
- else if ( r < .98 ){
- t.remove( { x : n } );
- }
- else if ( r < .99 ){
- t.remove( { x : { $lt : n } } );
- }
- else {
- t.remove( { x : { $gt : n } } );
- }
- if ( r > .9999 )
- print( t.count() );
+ if (r > .9999)
+ print(t.count());
}
}
-function del2( dbname, host, max ){
- var m = new Mongo( host );
- var db = m.getDB( "foo" + dbname );
+function del2(dbname, host, max) {
+ var m = new Mongo(host);
+ var db = m.getDB("foo" + dbname);
var t = db.del;
- while ( !db.del_parallel.count() ){
+ while (!db.del_parallel.count()) {
var r = Math.random();
- var n = Math.floor( Math.random() * max );
+ var n = Math.floor(Math.random() * max);
var s = Math.random() > .5 ? 1 : -1;
-
- if ( r < .5 ){
- t.findOne( { x : n } );
- }
- else if ( r < .75 ){
- t.find( { x : { $lt : n } } ).sort( { x : s } ).itcount();
- }
- else {
- t.find( { x : { $gt : n } } ).sort( { x : s } ).itcount();
+
+ if (r < .5) {
+ t.findOne({x: n});
+ } else if (r < .75) {
+ t.find({x: {$lt: n}}).sort({x: s}).itcount();
+ } else {
+ t.find({x: {$gt: n}}).sort({x: s}).itcount();
}
}
}
all = [];
-all.push( fork( del1 , "a", HOST, N ) );
-all.push( fork( del2 , "a", HOST, N ) );
-all.push( fork( del1 , "b", HOST, N ) );
-all.push( fork( del2 , "b", HOST, N ) );
+all.push(fork(del1, "a", HOST, N));
+all.push(fork(del2, "a", HOST, N));
+all.push(fork(del1, "b", HOST, N));
+all.push(fork(del2, "b", HOST, N));
-for ( i=0; i<all.length; i++ )
+for (i = 0; i < all.length; i++)
all[i].start();
-for ( i=0; i<10; i++ ){
- sleep( 2000 );
- print( "dropping" );
+for (i = 0; i < 10; i++) {
+ sleep(2000);
+ print("dropping");
a.dropDatabase();
b.dropDatabase();
}
@@ -75,5 +70,5 @@ for ( i=0; i<10; i++ ){
a.del_parallel.save({done: 1});
b.del_parallel.save({done: 1});
-for ( i=0; i<all.length; i++ )
+for (i = 0; i < all.length; i++)
all[i].join();
diff --git a/jstests/parallel/insert.js b/jstests/parallel/insert.js
index 64a357905c5..e2dee8053d9 100644
--- a/jstests/parallel/insert.js
+++ b/jstests/parallel/insert.js
@@ -3,23 +3,23 @@ load('jstests/libs/parallelTester.js');
f = db.jstests_parallel_insert;
f.drop();
-f.ensureIndex( {who:1} );
+f.ensureIndex({who: 1});
Random.setRandomSeed();
t = new ParallelTester();
-for( id = 0; id < 10; ++id ) {
- var g = new EventGenerator( id, "jstests_parallel_insert", Random.randInt( 20 ) );
- for( j = 0; j < 1000; ++j ) {
- if ( j % 50 == 0 ) {
- g.addCheckCount( j, {who:id} );
+for (id = 0; id < 10; ++id) {
+ var g = new EventGenerator(id, "jstests_parallel_insert", Random.randInt(20));
+ for (j = 0; j < 1000; ++j) {
+ if (j % 50 == 0) {
+ g.addCheckCount(j, {who: id});
}
- g.addInsert( { i:j, who:id } );
+ g.addInsert({i: j, who: id});
}
- t.add( EventGenerator.dispatch, g.getEvents() );
+ t.add(EventGenerator.dispatch, g.getEvents());
}
-t.run( "one or more tests failed" );
+t.run("one or more tests failed");
-assert( f.validate().valid );
+assert(f.validate().valid);
diff --git a/jstests/parallel/manyclients.js b/jstests/parallel/manyclients.js
index 1e845601aef..ca31f333635 100644
--- a/jstests/parallel/manyclients.js
+++ b/jstests/parallel/manyclients.js
@@ -3,7 +3,7 @@ load('jstests/libs/parallelTester.js');
f = db.jstests_parallel_manyclients;
f.drop();
-f.ensureIndex( {who:1} );
+f.ensureIndex({who: 1});
Random.setRandomSeed();
@@ -11,31 +11,29 @@ t = new ParallelTester();
// Reducing the number of threads to 100 because of WT-1989
numThreads = 100;
-buildInfo = db.adminCommand( "buildInfo" );
+buildInfo = db.adminCommand("buildInfo");
-if ( buildInfo.bits < 64 ||
- buildInfo.buildEnvironment.target_os != "linux" ||
- buildInfo.debug ) {
+if (buildInfo.bits < 64 || buildInfo.buildEnvironment.target_os != "linux" || buildInfo.debug) {
numThreads = 50;
}
-numThreads = Math.min( numThreads, db.serverStatus().connections.available / 3 );
+numThreads = Math.min(numThreads, db.serverStatus().connections.available / 3);
-print( "numThreads: " + numThreads );
+print("numThreads: " + numThreads);
-for( id = 0; id < numThreads; ++id ) {
- var g = new EventGenerator( id, "jstests_parallel_manyclients", Random.randInt( 20 ) );
- for( j = 0; j < 1000; ++j ) {
- if ( j % 50 == 0 ) {
- g.addCheckCount( j, {who:id}, false );
+for (id = 0; id < numThreads; ++id) {
+ var g = new EventGenerator(id, "jstests_parallel_manyclients", Random.randInt(20));
+ for (j = 0; j < 1000; ++j) {
+ if (j % 50 == 0) {
+ g.addCheckCount(j, {who: id}, false);
}
- g.addInsert( { i:j, who:id } );
+ g.addInsert({i: j, who: id});
}
- t.add( EventGenerator.dispatch, g.getEvents() );
+ t.add(EventGenerator.dispatch, g.getEvents());
}
-print( "done preparing test" );
+print("done preparing test");
-t.run( "one or more tests failed" );
+t.run("one or more tests failed");
-assert( f.validate().valid );
+assert(f.validate().valid);
diff --git a/jstests/parallel/repl.js b/jstests/parallel/repl.js
index 714d0f7742e..314cd4df335 100644
--- a/jstests/parallel/repl.js
+++ b/jstests/parallel/repl.js
@@ -3,59 +3,59 @@ load('jstests/libs/parallelTester.js');
baseName = "parallel_repl";
-rt = new ReplTest( baseName );
+rt = new ReplTest(baseName);
-m = rt.start( true );
-s = rt.start( false );
+m = rt.start(true);
+s = rt.start(false);
// tests need to run against master server
-db = m.getDB( "test" );
+db = m.getDB("test");
host = db.getMongo().host;
Random.setRandomSeed();
t = new ParallelTester();
-for( id = 0; id < 10; ++id ) {
- var g = new EventGenerator( id, baseName, Random.randInt( 20 ), host );
- for( var j = 0; j < 1000; ++j ) {
- var op = Random.randInt( 3 );
- switch( op ) {
- case 0: // insert
- g.addInsert( { _id:Random.randInt( 1000 ) } );
+for (id = 0; id < 10; ++id) {
+ var g = new EventGenerator(id, baseName, Random.randInt(20), host);
+ for (var j = 0; j < 1000; ++j) {
+ var op = Random.randInt(3);
+ switch (op) {
+ case 0: // insert
+ g.addInsert({_id: Random.randInt(1000)});
break;
- case 1: // remove
- g.addRemove( { _id:Random.randInt( 1000 ) } );
+ case 1: // remove
+ g.addRemove({_id: Random.randInt(1000)});
break;
- case 2: // update
- g.addUpdate( {_id:{$lt:1000}}, {$inc:{a:5}} );
+ case 2: // update
+ g.addUpdate({_id: {$lt: 1000}}, {$inc: {a: 5}});
break;
default:
- assert( false, "Invalid op code" );
+ assert(false, "Invalid op code");
}
}
- t.add( EventGenerator.dispatch, g.getEvents() );
+ t.add(EventGenerator.dispatch, g.getEvents());
}
-var g = new EventGenerator( id, baseName, Random.randInt( 5 ), host );
-for( var j = 1000; j < 3000; ++j ) {
- g.addCheckCount( j - 1000, { _id: {$gte:1000} }, j % 100 == 0, j % 500 == 0 );
- g.addInsert( {_id:j} );
+var g = new EventGenerator(id, baseName, Random.randInt(5), host);
+for (var j = 1000; j < 3000; ++j) {
+ g.addCheckCount(j - 1000, {_id: {$gte: 1000}}, j % 100 == 0, j % 500 == 0);
+ g.addInsert({_id: j});
}
-t.add( EventGenerator.dispatch, g.getEvents() );
+t.add(EventGenerator.dispatch, g.getEvents());
-t.run( "one or more tests failed" );
+t.run("one or more tests failed");
-masterValidation = m.getDB( "test" )[ baseName ].validate();
-assert( masterValidation.valid, tojson( masterValidation ) );
+masterValidation = m.getDB("test")[baseName].validate();
+assert(masterValidation.valid, tojson(masterValidation));
-slaveValidation = s.getDB( "test" )[ baseName ].validate();
-assert( slaveValidation.valid, tojson( slaveValidation ) );
+slaveValidation = s.getDB("test")[baseName].validate();
+assert(slaveValidation.valid, tojson(slaveValidation));
-assert.soon( function() {
- mh = m.getDB( "test" ).runCommand( "dbhash" );
-// printjson( mh );
- sh = s.getDB( "test" ).runCommand( "dbhash" );
-// printjson( sh );
- return mh.md5 == sh.md5;
- } );
+assert.soon(function() {
+ mh = m.getDB("test").runCommand("dbhash");
+ // printjson( mh );
+ sh = s.getDB("test").runCommand("dbhash");
+ // printjson( sh );
+ return mh.md5 == sh.md5;
+});
diff --git a/jstests/parallel/shellfork.js b/jstests/parallel/shellfork.js
index ad05c0d4fbe..571f917fc4a 100644
--- a/jstests/parallel/shellfork.js
+++ b/jstests/parallel/shellfork.js
@@ -1,36 +1,40 @@
load('jstests/libs/parallelTester.js');
-a = fork( function( a, b ) { return a / b; }, 10, 2 );
+a = fork(function(a, b) {
+ return a / b;
+}, 10, 2);
a.start();
-b = fork( function( a, b, c ) { return a + b + c; }, 18, " is a ", "multiple of 3" );
-makeFunny = function( text ) {
+b = fork(function(a, b, c) {
+ return a + b + c;
+}, 18, " is a ", "multiple of 3");
+makeFunny = function(text) {
return text + " ha ha!";
};
-c = fork( makeFunny, "paisley" );
+c = fork(makeFunny, "paisley");
c.start();
b.start();
b.join();
-assert.eq( 5, a.returnData() );
-assert.eq( "18 is a multiple of 3", b.returnData() );
-assert.eq( "paisley ha ha!", c.returnData() );
+assert.eq(5, a.returnData());
+assert.eq("18 is a multiple of 3", b.returnData());
+assert.eq("paisley ha ha!", c.returnData());
-z = fork( function( a ) {
- load('jstests/libs/parallelTester.js');
- var y = fork( function( a ) {
- return a + 1; }, 5 );
- y.start();
- return y.returnData() + a;
- }, 1 );
+z = fork(function(a) {
+ load('jstests/libs/parallelTester.js');
+ var y = fork(function(a) {
+ return a + 1;
+ }, 5);
+ y.start();
+ return y.returnData() + a;
+}, 1);
z.start();
-assert.eq( 7, z.returnData() );
-
+assert.eq(7, z.returnData());
t = 1;
-z = new ScopedThread( function() {
- assert( typeof( t ) == "undefined", "t not undefined" );
- t = 5;
- return t;
- } );
+z = new ScopedThread(function() {
+ assert(typeof(t) == "undefined", "t not undefined");
+ t = 5;
+ return t;
+});
z.start();
-assert.eq( 5, z.returnData() );
-assert.eq( 1, t ); \ No newline at end of file
+assert.eq(5, z.returnData());
+assert.eq(1, t); \ No newline at end of file
diff --git a/jstests/parallel/update_serializability1.js b/jstests/parallel/update_serializability1.js
index 55fc119101d..6fc41204c3c 100644
--- a/jstests/parallel/update_serializability1.js
+++ b/jstests/parallel/update_serializability1.js
@@ -5,23 +5,25 @@ t.drop();
N = 100000;
bulk = t.initializeUnorderedBulkOp();
-for ( var i = 0; i < N; i++ ) {
- bulk.insert( { _id : i, a : i, b: N-i, x : 1, y : 1 } );
+for (var i = 0; i < N; i++) {
+ bulk.insert({_id: i, a: i, b: N - i, x: 1, y: 1});
}
bulk.execute();
-t.ensureIndex( { a : 1 } );
-t.ensureIndex( { b : 1 } );
+t.ensureIndex({a: 1});
+t.ensureIndex({b: 1});
-s1 = startParallelShell( "db.update_serializability1.update( { a : { $gte : 0 } }, { $set : { b : " + (N+1) + ", x : 2 } }, false, true );" );
-s2 = startParallelShell( "db.update_serializability1.update( { b : { $lte : " + N + " } }, { $set : { a : -1, y : 2 } }, false, true );" );
+s1 = startParallelShell("db.update_serializability1.update( { a : { $gte : 0 } }, { $set : { b : " +
+ (N + 1) + ", x : 2 } }, false, true );");
+s2 = startParallelShell("db.update_serializability1.update( { b : { $lte : " + N +
+ " } }, { $set : { a : -1, y : 2 } }, false, true );");
s1();
s2();
// some of each type should have gotten done
-assert( t.find( { x : 2 } ).count() > 0 );
-assert( t.find( { y : 2 } ).count() > 0 );
+assert(t.find({x: 2}).count() > 0);
+assert(t.find({y: 2}).count() > 0);
// both operations should never happen on a document
-assert.eq( 0, t.find( { x : 2, y : 2 } ).count() );
+assert.eq(0, t.find({x: 2, y: 2}).count());
diff --git a/jstests/parallel/update_serializability2.js b/jstests/parallel/update_serializability2.js
index c99eafea9ef..c2672491177 100644
--- a/jstests/parallel/update_serializability2.js
+++ b/jstests/parallel/update_serializability2.js
@@ -6,27 +6,28 @@ function test() {
var N = 100000;
var bulk = t.initializeUnorderedBulkOp();
- for ( var i = 0; i < N; i++ ) {
- bulk.insert( { _id : i, a : i, b: N-i, x : 1, y : 1 } );
+ for (var i = 0; i < N; i++) {
+ bulk.insert({_id: i, a: i, b: N - i, x: 1, y: 1});
}
bulk.execute();
- t.ensureIndex( { a : 1 } );
- t.ensureIndex( { b : 1 } );
+ t.ensureIndex({a: 1});
+ t.ensureIndex({b: 1});
- var s1 = startParallelShell( "db.update_serializability1.update( { a : { $gte : 0 } }, { $set : { x : 2 } }, false, true );" );
- var s2 = startParallelShell( "db.update_serializability1.update( { b : { $lte : " + N + " } }, { $set : { y : 2 } }, false, true );" );
+ var s1 = startParallelShell(
+ "db.update_serializability1.update( { a : { $gte : 0 } }, { $set : { x : 2 } }, false, true );");
+ var s2 = startParallelShell("db.update_serializability1.update( { b : { $lte : " + N +
+ " } }, { $set : { y : 2 } }, false, true );");
s1();
s2();
// both operations should happen on every document
- assert.eq( N, t.find( { x : 2, y : 2 } ).count() );
+ assert.eq(N, t.find({x: 2, y: 2}).count());
}
if (db.serverStatus().storageEngine.name == 'mmapv1') {
- jsTest.log('skipping test on mmapv1'); // This is only guaranteed on other engines.
-}
-else {
+ jsTest.log('skipping test on mmapv1'); // This is only guaranteed on other engines.
+} else {
test();
}