summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-03-22 17:24:09 -0700
committerAaron <aaron@10gen.com>2010-03-22 17:24:09 -0700
commitf6ea3d75f4576c007553d53f5bb9496e6b0c6f19 (patch)
tree4deff43ab25f1eda9a574a6e48e0e268df885238
parentb3ee79ea6265da26e961d2e8e40e69efd6790c9f (diff)
downloadmongo-f6ea3d75f4576c007553d53f5bb9496e6b0c6f19.tar.gz
parallel repl test
-rw-r--r--jstests/parallel/repl.js55
-rw-r--r--mongo.xcodeproj/project.pbxproj2
2 files changed, 57 insertions, 0 deletions
diff --git a/jstests/parallel/repl.js b/jstests/parallel/repl.js
new file mode 100644
index 00000000000..cb9b770610b
--- /dev/null
+++ b/jstests/parallel/repl.js
@@ -0,0 +1,55 @@
+// test all operations in parallel
+
+baseName = "parallel_repl"
+
+rt = new ReplTest( baseName );
+
+m = rt.start( true );
+s = rt.start( false );
+
+db = m.getDB( "test" );
+
+Random.setRandomSeed();
+
+t = new ParallelTester();
+
+for( id = 0; id < 10; ++id ) {
+ var g = new EventGenerator( id, baseName, 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 ) } );
+ break;
+ case 2: // update
+ g.addUpdate( {_id:{$lt:1000}}, {a:{$inc:5}} );
+ break;
+ default:
+ assert( false, "Invalid op code" );
+ }
+ }
+ t.add( EventGenerator.dispatch, g.getEvents() );
+}
+
+var g = new EventGenerator( id, baseName, 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.run( "one or more tests failed" );
+
+assert( m.getDB( "test" )[ baseName ].validate().valid );
+assert( s.getDB( "test" )[ baseName ].validate().valid );
+
+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/mongo.xcodeproj/project.pbxproj b/mongo.xcodeproj/project.pbxproj
index 97e7e5056a9..f0042da60be 100644
--- a/mongo.xcodeproj/project.pbxproj
+++ b/mongo.xcodeproj/project.pbxproj
@@ -502,6 +502,7 @@
93BDCE401157E7280097FE87 /* repl10.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = repl10.js; sourceTree = "<group>"; };
93BDCE411157E7280097FE87 /* repl11.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = repl11.js; sourceTree = "<group>"; };
93BDCE92115817210097FE87 /* pair7.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = pair7.js; sourceTree = "<group>"; };
+ 93BDCEB9115830CB0097FE87 /* repl.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = repl.js; sourceTree = "<group>"; };
93BFA0E311330A8C0045D084 /* not2.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = not2.js; sourceTree = "<group>"; };
93C38E940FA66622007D6E4A /* basictests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = basictests.cpp; sourceTree = "<group>"; };
93C8E6FE11457D9000F28017 /* master1.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = master1.js; sourceTree = "<group>"; };
@@ -1273,6 +1274,7 @@
93F0956F10E165E50053380C /* parallel */ = {
isa = PBXGroup;
children = (
+ 93BDCEB9115830CB0097FE87 /* repl.js */,
93BCE5A610F3FB5200FA139B /* basicPlus.js */,
93BCE5A510F3F8E900FA139B /* manyclients.js */,
93BCE4B510F3C8DB00FA139B /* allops.js */,