summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordwight <dwight@Dwights-MacBook-2.local>2009-08-17 21:46:18 -0400
committerdwight <dwight@Dwights-MacBook-2.local>2009-08-17 21:46:18 -0400
commit740318b133dd3b29ce39e31cf64a97093f05f686 (patch)
treed498af778bdece65c74ea2937c9f18a798441d04
parent4b4efd2e484eea4eae2b48d469b78a0c3ea041c7 (diff)
downloadmongo-740318b133dd3b29ce39e31cf64a97093f05f686.tar.gz
isMaster() - still wasn't right
-rw-r--r--db/repl.h10
-rw-r--r--db/replset.h3
2 files changed, 12 insertions, 1 deletions
diff --git a/db/repl.h b/db/repl.h
index 10ebc67de85..8ad647af577 100644
--- a/db/repl.h
+++ b/db/repl.h
@@ -41,10 +41,18 @@ namespace mongo {
class DBClientConnection;
class DBClientCursor;
- // --slave = SimpleSlave
+
+ /* replication slave? (possibly with slave or repl pair nonmaster)
+ --slave cmd line setting -> SimpleSlave
+ */
typedef enum { NotSlave=0, SimpleSlave, ReplPairSlave } SlaveTypes;
extern SlaveTypes slave;
+
+ /* true means we are master and doing replication. if we are not writing to oplog (no --master or repl pairing),
+ this won't be true.
+ */
extern bool master;
+
extern int opIdMem;
bool cloneFrom(const char *masterHost, string& errmsg, const string& fromdb, bool logForReplication,
diff --git a/db/replset.h b/db/replset.h
index 8c03d690804..45790af0828 100644
--- a/db/replset.h
+++ b/db/replset.h
@@ -111,6 +111,9 @@ namespace mongo {
If 'client' is not specified, the current client is used.
*/
inline bool isMaster( const char *client = 0 ) {
+ if( !slave )
+ return true;
+
if ( !client )
client = database->name.c_str();