summaryrefslogtreecommitdiff
path: root/jstests/repl
diff options
context:
space:
mode:
authorKristina <kristina@10gen.com>2011-07-13 11:05:44 -0400
committerKristina <kristina@10gen.com>2011-07-13 11:05:44 -0400
commitec180477cbe490c1b731d9f9fc3fa2fce5b31d4f (patch)
treee5dd771fbbf35c5392cce5e0b934a5f7e9d7b555 /jstests/repl
parent90492cab19180f3c8c45552d2b8101840c2859c9 (diff)
downloadmongo-ec180477cbe490c1b731d9f9fc3fa2fce5b31d4f.tar.gz
repl test debugging
Diffstat (limited to 'jstests/repl')
-rw-r--r--jstests/repl/repl2.js27
1 files changed, 18 insertions, 9 deletions
diff --git a/jstests/repl/repl2.js b/jstests/repl/repl2.js
index f30de7f300e..b290c618031 100644
--- a/jstests/repl/repl2.js
+++ b/jstests/repl/repl2.js
@@ -1,34 +1,43 @@
// Test resync command
soonCount = function( count ) {
- assert.soon( function() {
+ assert.soon( function() {
// print( "check count" );
// print( "count: " + s.getDB( baseName ).z.find().count() );
- return s.getDB("foo").a.find().count() == count;
- } );
+ return s.getDB("foo").a.find().count() == count;
+ } );
}
doTest = function( signal ) {
-
+ print("signal: "+signal);
+
var rt = new ReplTest( "repl2tests" );
// implicit small oplog makes slave get out of sync
m = rt.start( true, { oplogSize : "1" } );
s = rt.start( false );
-
+
am = m.getDB("foo").a
-
+
am.save( { _id: new ObjectId() } );
soonCount( 1 );
assert.eq( 0, s.getDB( "admin" ).runCommand( { "resync" : 1 } ).ok );
rt.stop( false , signal );
-
+
big = new Array( 2000 ).toString();
for( i = 0; i < 1000; ++i )
am.save( { _id: new ObjectId(), i: i, b: big } );
s = rt.start( false , null , true );
- assert.soon( function() { return 1 == s.getDB( "admin" ).runCommand( { "resync" : 1 } ).ok; } );
+
+ print("earliest op in master: "+tojson(m.getDB("local").oplog.$main.find().sort({$natural:1}).limit(1).next()));
+ print("latest op on slave: "+tojson(s.getDB("local").sources.findOne()));
+
+ assert.soon( function() {
+ var result = s.getDB( "admin" ).runCommand( { "resync" : 1 } );
+ print("resync says: "+tojson(result));
+ return result.ok == 1;
+ } );
soonCount( 1001 );
assert.automsg( "m.getDB( 'local' ).getCollection( 'oplog.$main' ).stats().size > 0" );
@@ -36,7 +45,7 @@ doTest = function( signal ) {
as = s.getDB("foo").a
assert.eq( 1, as.find( { i: 0 } ).count() );
assert.eq( 1, as.find( { i: 999 } ).count() );
-
+
assert.eq( 0, s.getDB( "admin" ).runCommand( { "resync" : 1 } ).ok );
rt.stop();