diff options
author | Antonin Kral <a.kral@bobek.cz> | 2010-09-24 19:01:03 +0200 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2010-09-24 19:01:03 +0200 |
commit | 0ad0c09511a04ebe837f2acb859d47f2aa4e038a (patch) | |
tree | 109babcb556f6c5884b77853120717f0617c7a1e /shell/servers.js | |
parent | 03e58f81cad8dd4cfcd1530f327116f0cff6ceb3 (diff) | |
download | mongodb-0ad0c09511a04ebe837f2acb859d47f2aa4e038a.tar.gz |
Imported Upstream version 1.6.3
Diffstat (limited to 'shell/servers.js')
-rw-r--r-- | shell/servers.js | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/shell/servers.js b/shell/servers.js index 7b306d7..eb548ea 100644 --- a/shell/servers.js +++ b/shell/servers.js @@ -993,6 +993,7 @@ ReplSetTest = function( opts ){ this.name = opts.name || "testReplSet"; this.host = opts.host || getHostName(); this.numNodes = opts.nodes || 0; + this.oplogSize = opts.oplogSize || 2; this.useSeedList = opts.useSeedList || false; this.bridged = opts.bridged || false; @@ -1114,7 +1115,7 @@ ReplSetTest.prototype.getOptions = function( n , extra , putBinaryFirst ){ extra = {}; if ( ! extra.oplogSize ) - extra.oplogSize = "2"; + extra.oplogSize = this.oplogSize; var a = [] @@ -1124,8 +1125,12 @@ ReplSetTest.prototype.getOptions = function( n , extra , putBinaryFirst ){ a.push( "--replSet" ); - - a.push( this.getURL() ) + if( this.useSeedList ) { + a.push( this.getURL() ); + } + else { + a.push( this.name ); + } a.push( "--noprealloc", "--smallfiles" ); @@ -1188,6 +1193,21 @@ ReplSetTest.prototype.callIsMaster = function() { return master || false; } +ReplSetTest.prototype.awaitSecondaryNodes = function( timeout ) { + var master = this.getMaster(); + var slaves = this.liveNodes.slaves; + var len = slaves.length; + + this.attempt({context: this, timeout: 60000, desc: "Awaiting secondaries"}, function() { + var ready = true; + for(var i=0; i<len; i++) { + ready = ready && slaves[i].getDB("admin").runCommand({ismaster: 1})['secondary']; + } + + return ready; + }); +} + ReplSetTest.prototype.getMaster = function( timeout ) { var tries = 0; var sleepTime = 500; |