summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorgregs <greg@10gen.com>2011-08-09 02:29:41 -0400
committergregs <greg@10gen.com>2011-08-09 02:29:41 -0400
commitb52af9b709dfa905eb4585c537b69b32da1caaaa (patch)
tree117abf10bab7f6eee84a24d8f1b244731cde1785 /shell
parent709c5f262803d2b2f2f5e5787a5a5eff9e4296bd (diff)
downloadmongo-b52af9b709dfa905eb4585c537b69b32da1caaaa.tar.gz
fix for sharding slaveok
Diffstat (limited to 'shell')
-rwxr-xr-xshell/servers.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/shell/servers.js b/shell/servers.js
index d7be8f74cba..e551559a79c 100755
--- a/shell/servers.js
+++ b/shell/servers.js
@@ -1331,11 +1331,11 @@ ReplSetTest.awaitRSClientHosts = function( conn, host, hostOk, rs ) {
return
}
- if( hostOk == undefined ) hostOk = true
+ if( hostOk == undefined ) hostOk = { ok : true }
if( host.host ) host = host.host
if( rs && rs.getMaster ) rs = rs.name
- print( "Awaiting " + host + " to be " + ( hostOk ? "ok" : " not ok " ) + " for " + conn + " (rs: " + rs + ")" )
+ print( "Awaiting " + host + " to be " + tojson( hostOk ) + " for " + conn + " (rs: " + rs + ")" )
var tests = 0
assert.soon( function() {
@@ -1347,10 +1347,19 @@ ReplSetTest.awaitRSClientHosts = function( conn, host, hostOk, rs ) {
if( rs && rs != rsName ) continue
for ( var i = 0; i < rsClientHosts[rsName].hosts.length; i++ ){
var clientHost = rsClientHosts[rsName].hosts[ i ];
- if( clientHost.addr != host )
- continue;
- if( clientHost.ok == hostOk )
- return true;
+ if( clientHost.addr != host ) continue
+
+ // Check that *all* host properties are set correctly
+ var propOk = true
+ for( var prop in hostOk ){
+ if( clientHost[prop] != hostOk[prop] ){
+ propOk = false
+ break
+ }
+ }
+
+ if( propOk ) return true;
+
}
}
return false;