diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-08-02 16:54:09 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-08-02 16:54:09 -0400 |
commit | 37be79e22469ed1632c95290fc5269cdc989bcdb (patch) | |
tree | 0985a7695a6197b6fbd3bc9809681d8cb6b8ae05 | |
parent | cafe5555c97eb1d37df7a0147058d14018edab2a (diff) | |
download | mongo-37be79e22469ed1632c95290fc5269cdc989bcdb.tar.gz |
fix isMaster detection SERVER-1544
-rw-r--r-- | db/repl_block.cpp | 5 | ||||
-rw-r--r-- | db/replpair.h | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/db/repl_block.cpp b/db/repl_block.cpp index 6f68789560b..9cff24f3839 100644 --- a/db/repl_block.cpp +++ b/db/repl_block.cpp @@ -24,6 +24,7 @@ #include "../util/background.h" #include "../util/mongoutils/str.h" #include "../client/dbclient.h" +#include "replpair.h" //#define REPLDEBUG(x) log() << "replBlock: " << x << endl; #define REPLDEBUG(x) @@ -154,8 +155,10 @@ namespace mongo { RARELY { REPLDEBUG( "looking for : " << op << " w=" << w ); } - if ( w <= 1 || ! replSettings.master ) + + if ( w <= 1 || ! _isMaster() ) return true; + w--; // now this is the # of slaves i need scoped_lock mylk(_mutex); for ( map<Ident,Info>::iterator i=_slaves.begin(); i!=_slaves.end(); i++){ diff --git a/db/replpair.h b/db/replpair.h index 4897a0abf7a..19b79bd3eba 100644 --- a/db/replpair.h +++ b/db/replpair.h @@ -111,7 +111,7 @@ namespace mongo { If 'client' is not specified, the current client is used. */ - inline bool _isMaster( const char *client = 0 ) { + inline bool _isMaster() { if( replSet ) { if( theReplSet ) return theReplSet->isPrimary(); @@ -142,7 +142,7 @@ namespace mongo { return false; } inline bool isMaster(const char *client = 0) { - if( _isMaster(client) ) + if( _isMaster() ) return true; if ( !client ) { Database *database = cc().database(); |