diff options
author | Aaron <aaron@10gen.com> | 2010-03-30 14:19:33 -0700 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2010-03-30 14:19:33 -0700 |
commit | ba3934e273a912a39afc506508da590b30438771 (patch) | |
tree | f6a4318a749868a1f935782ddac4f2febba9a3eb | |
parent | ea8c66809211a667cb30b0ef97175c030f8170f3 (diff) | |
download | mongo-ba3934e273a912a39afc506508da590b30438771.tar.gz |
SERVER-847 timeouts allow finding a sync point, need when using small oplogs
-rw-r--r-- | jstests/repl/snapshot2.js | 13 | ||||
-rw-r--r-- | jstests/repl/snapshot3.js | 13 |
2 files changed, 14 insertions, 12 deletions
diff --git a/jstests/repl/snapshot2.js b/jstests/repl/snapshot2.js index 4ebd786781e..d65cad7b6e4 100644 --- a/jstests/repl/snapshot2.js +++ b/jstests/repl/snapshot2.js @@ -13,12 +13,13 @@ rp = new ReplPair( l, r, a ); rp.start(); rp.waitForSteadyState(); -big = new Array( 2000 ).toString(); +big = new Array( 2000 ).toString(); // overflow oplog, so test can't pass supriously rp.slave().setSlaveOk(); -for( i = 0; i < 1000; ++i ) { +for( i = 0; i < 500; ++i ) { rp.master().getDB( baseName )[ baseName ].save( { _id: new ObjectId(), i: i, b: big } ); if ( i % 250 == 249 ) { assert.soon( function() { return i+1 == rp.slave().getDB( baseName )[ baseName ].count(); } ); + sleep( 10 ); // give master a chance to grab a sync point - have such small oplogs the master log might overflow otherwise } } @@ -40,11 +41,11 @@ rp.left_.extraArgs_ = [ "--fastsync" ]; rp.start( true ); rp.waitForSteadyState(); -assert.eq( 1000, rp.master().getDB( baseName )[ baseName ].count() ); +assert.eq( 500, rp.master().getDB( baseName )[ baseName ].count() ); rp.slave().setSlaveOk(); -assert.eq( 1000, rp.slave().getDB( baseName )[ baseName ].count() ); -rp.master().getDB( baseName )[ baseName ].save( {i:1000} ); -assert.soon( function() { return 1001 == rp.slave().getDB( baseName )[ baseName ].count(); } ); +assert.eq( 500, rp.slave().getDB( baseName )[ baseName ].count() ); +rp.master().getDB( baseName )[ baseName ].save( {i:500} ); +assert.soon( function() { return 501 == rp.slave().getDB( baseName )[ baseName ].count(); } ); assert( !rawMongoProgramOutput().match( /resync/ ) ); assert( !rawMongoProgramOutput().match( /SyncException/ ) );
\ No newline at end of file diff --git a/jstests/repl/snapshot3.js b/jstests/repl/snapshot3.js index 296ebd08d4c..150731e6e6b 100644 --- a/jstests/repl/snapshot3.js +++ b/jstests/repl/snapshot3.js @@ -13,12 +13,13 @@ rp = new ReplPair( l, r, a ); rp.start(); rp.waitForSteadyState(); -big = new Array( 2000 ).toString(); +big = new Array( 2000 ).toString(); // overflow oplog, so test can't pass supriously rp.slave().setSlaveOk(); -for( i = 0; i < 1000; ++i ) { +for( i = 0; i < 500; ++i ) { rp.master().getDB( baseName )[ baseName ].save( { _id: new ObjectId(), i: i, b: big } ); if ( i % 250 == 249 ) { assert.soon( function() { return i+1 == rp.slave().getDB( baseName )[ baseName ].count(); } ); + sleep( 10 ); // give master a chance to grab a sync point - have such small oplogs the master log might overflow otherwise } } @@ -40,11 +41,11 @@ rp.left_.extraArgs_ = [ "--fastsync" ]; rp.start( true ); rp.waitForSteadyState(); -assert.eq( 1000, rp.master().getDB( baseName )[ baseName ].count() ); +assert.eq( 500, rp.master().getDB( baseName )[ baseName ].count() ); rp.slave().setSlaveOk(); -assert.eq( 1000, rp.slave().getDB( baseName )[ baseName ].count() ); -rp.master().getDB( baseName )[ baseName ].save( {i:1000} ); -assert.soon( function() { return 1001 == rp.slave().getDB( baseName )[ baseName ].count(); } ); +assert.eq( 500, rp.slave().getDB( baseName )[ baseName ].count() ); +rp.master().getDB( baseName )[ baseName ].save( {i:500} ); +assert.soon( function() { return 501 == rp.slave().getDB( baseName )[ baseName ].count(); } ); assert( !rawMongoProgramOutput().match( /resync/ ) ); assert( !rawMongoProgramOutput().match( /SyncException/ ) );
\ No newline at end of file |