diff options
author | Aaron <aaron@10gen.com> | 2010-02-16 11:30:50 -0800 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2010-02-16 11:30:50 -0800 |
commit | e0dbd0131feb120ad53cdf00514f8f5ff2885b5d (patch) | |
tree | 49cc22f2d1d3a904da8814f24a032eb43acc4745 /jstests/disk | |
parent | ee1eb4a1c27e8de707f9e4c44a9763a2a33e4bdd (diff) | |
download | mongo-e0dbd0131feb120ad53cdf00514f8f5ff2885b5d.tar.gz |
SERVER-623 set new slave sync point to known master tail
Diffstat (limited to 'jstests/disk')
-rw-r--r-- | jstests/disk/slavefromsnapshot.js | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/jstests/disk/slavefromsnapshot.js b/jstests/disk/slavefromsnapshot.js index ec575dbfeaa..6fec4511f11 100644 --- a/jstests/disk/slavefromsnapshot.js +++ b/jstests/disk/slavefromsnapshot.js @@ -7,24 +7,27 @@ var basePath = "/data/db/" + baseName; var m = startMongod( "--master", "--port", ports[ 0 ], "--dbpath", basePath + "_master", "--nohttpinterface", "--oplogSize", "1" ); -m.getDB( baseName )[ baseName ].save( {i:1} ); +big = new Array( 2000 ).toString(); +for( i = 0; i < 1000; ++i ) + m.getDB( baseName )[ baseName ].save( { _id: new ObjectId(), i: i, b: big } ); m.getDB( "admin" ).runCommand( {fsync:1,lock:1} ); copyDbpath( basePath + "_master", basePath + "_slave1" ); -printjson( listFiles( basePath + "_slave1" ) ); m.getDB( "admin" ).$cmd.sys.unlock.findOne(); var s1 = startMongoProgram( "mongod", "--slave", "--source", "127.0.0.1:" + ports[ 0 ], "--port", ports[ 1 ], "--dbpath", basePath + "_slave1", "--nohttpinterface" ); -assert.eq( 1, s1.getDB( baseName )[ baseName ].findOne().i ); -m.getDB( baseName )[ baseName ].save( {i:2} ); -assert.soon( function() { return 2 == s1.getDB( baseName )[ baseName ].count(); } ); +assert.eq( 1000, s1.getDB( baseName )[ baseName ].count() ); +m.getDB( baseName )[ baseName ].save( {i:1000} ); +assert.soon( function() { return 1001 == s1.getDB( baseName )[ baseName ].count(); } ); s1.getDB( "admin" ).runCommand( {fsync:1,lock:1} ); copyDbpath( basePath + "_slave1", basePath + "_slave2" ); s1.getDB( "admin" ).$cmd.sys.unlock.findOne(); var s2 = startMongoProgram( "mongod", "--slave", "--source", "127.0.0.1:" + ports[ 0 ], "--port", ports[ 2 ], "--dbpath", basePath + "_slave2", "--nohttpinterface" ); -assert.eq( 2, s2.getDB( baseName )[ baseName ].count() ); -m.getDB( baseName )[ baseName ].save( {i:3} ); -assert.soon( function() { return 3 == s2.getDB( baseName )[ baseName ].count(); } ); -assert.soon( function() { return 3 == s1.getDB( baseName )[ baseName ].count(); } ); +assert.eq( 1001, s2.getDB( baseName )[ baseName ].count() ); +m.getDB( baseName )[ baseName ].save( {i:1001} ); +assert.soon( function() { return 1002 == s2.getDB( baseName )[ baseName ].count(); } ); +assert.soon( function() { return 1002 == s1.getDB( baseName )[ baseName ].count(); } ); + +assert( !rawMongoProgramOutput().match( /resync: cloning database/ ) );
\ No newline at end of file |