diff options
author | Dwight <dmerriman@gmail.com> | 2008-11-20 18:03:41 -0500 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2008-11-20 18:03:41 -0500 |
commit | 6c1d07af9b8bbd59b6bbf019f73cc2a873cf6e85 (patch) | |
tree | 9e67005c25dd2217c2c1c0a14d953fbe52822f9c /db/replset.h | |
parent | 458de60cf02e49f5cdf5b7dfceeb62d36e2f12ac (diff) | |
download | mongo-6c1d07af9b8bbd59b6bbf019f73cc2a873cf6e85.tar.gz |
go 'dead' mode if replication pairing confused
Diffstat (limited to 'db/replset.h')
-rw-r--r-- | db/replset.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/db/replset.h b/db/replset.h index c82655a9825..e1e365653e2 100644 --- a/db/replset.h +++ b/db/replset.h @@ -72,10 +72,13 @@ public: extern ReplPair *replPair; -/* we should not allow most operations when not the master */ +/* we should not allow most operations when not the master + also we report not master if we are "dead" +*/ inline bool isMaster() { - return replPair == 0 || replPair->state == ReplPair::State_Master || - client->name == "local"; // local is always allowed + if( replPair == 0 ) return true; + if( client->dead ) return client->name == "local"; + return replPair->state == ReplPair::State_Master; } inline ReplPair::ReplPair(const char *remoteEnd, const char *arb) { @@ -92,6 +95,7 @@ inline ReplPair::ReplPair(const char *remoteEnd, const char *arb) { remote = remoteHost; // don't include ":27017" as it is default; in case ran in diff ways over time to normalizke the hostname format in sources collection } + uassert("arbiter parm is missing, use '-' for none", arb); arbHost = arb; uassert("arbiter parm is empty", !arbHost.empty()); } |