0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
This commit is contained in:
Aaron 2009-01-30 14:57:01 -05:00
parent 4b1a2ca999
commit 2ecf386ce6

View File

@ -14,21 +14,20 @@ writeOne = function( n ) {
n.getDB( baseName ).z.save( { _id: new ObjectId(), i: ++writeOneIdx } );
}
getOne = function( n ) {
print( tojson( n.getDB( baseName ).z.find( { i: writeOneIdx } ).toArray() ) );
getCount = function( n ) {
return n.getDB( baseName ).z.find( { i: writeOneIdx } ).toArray().length;
}
checkWrite = function( m, s ) {
writeOne( m );
assert.eq( 1, getOne( m ) );
assert.eq( 1, getCount( m ) );
s.setSlaveOk();
assert.soon( function() {
if ( -1 == s.getDBNames().indexOf( baseName ) )
return false;
if ( -1 == s.getDB( baseName ).getCollectionNames().indexOf( "z" ) )
return false;
return 1 == getOne( s );
return 1 == getCount( s );
} );
}
@ -37,8 +36,6 @@ a = startMongod( "--port", "27018", "--dbpath", "/data/db/" + baseName + "-arbit
l = startMongod( "--port", "27019", "--dbpath", "/data/db/" + baseName + "-left", "--pairwith", "127.0.0.1:27020", "127.0.0.1:27018", "--oplogSize", "1" );
r = startMongod( "--port", "27020", "--dbpath", "/data/db/" + baseName + "-right", "--pairwith", "127.0.0.1:27019", "127.0.0.1:27018", "--oplogSize", "1" );
print( a.slaveOk );
assert.soon( function() {
am = ismaster( a );
lm = ismaster( l );