summaryrefslogtreecommitdiff
path: root/db/repl
diff options
context:
space:
mode:
Diffstat (limited to 'db/repl')
-rw-r--r--db/repl/consensus.cpp6
-rw-r--r--db/repl/manager.cpp3
-rw-r--r--db/repl/replset_commands.cpp4
-rw-r--r--db/repl/rs.cpp2
-rw-r--r--db/repl/rs.h4
-rw-r--r--db/repl/rs_member.h4
6 files changed, 17 insertions, 6 deletions
diff --git a/db/repl/consensus.cpp b/db/repl/consensus.cpp
index f764abe..dadb22e 100644
--- a/db/repl/consensus.cpp
+++ b/db/repl/consensus.cpp
@@ -154,6 +154,12 @@ namespace mongo {
log() << "couldn't find member with id " << whoid << rsLog;
vote = -10000;
}
+ else if( primary && primary == rs._self && rs.lastOpTimeWritten >= hopeful->hbinfo().opTime ) {
+ // hbinfo is not updated, so we have to check the primary's last optime separately
+ log() << "I am already primary, " << hopeful->fullName()
+ << " can try again once I've stepped down" << rsLog;
+ vote = -10000;
+ }
else if( primary && primary->hbinfo().opTime >= hopeful->hbinfo().opTime ) {
// other members might be aware of more up-to-date nodes
log() << hopeful->fullName() << " is trying to elect itself but " <<
diff --git a/db/repl/manager.cpp b/db/repl/manager.cpp
index ed39c31..d2e0764 100644
--- a/db/repl/manager.cpp
+++ b/db/repl/manager.cpp
@@ -64,6 +64,9 @@ namespace mongo {
void Manager::starting() {
Client::initThread("rs Manager");
+ if (!noauth) {
+ cc().getAuthenticationInfo()->authorize("local");
+ }
}
void Manager::noteARemoteIsPrimary(const Member *m) {
diff --git a/db/repl/replset_commands.cpp b/db/repl/replset_commands.cpp
index dc8567a..1d110ac 100644
--- a/db/repl/replset_commands.cpp
+++ b/db/repl/replset_commands.cpp
@@ -274,7 +274,7 @@ namespace mongo {
s << p("Not using --replSet");
else {
s << p("Still starting up, or else set is not yet " + a("http://www.mongodb.org/display/DOCS/Replica+Set+Configuration#InitialSetup", "", "initiated")
- + ".<br>" + ReplSet::startupStatusMsg);
+ + ".<br>" + ReplSet::startupStatusMsg.get());
}
}
else {
@@ -305,7 +305,7 @@ namespace mongo {
s << p("Not using --replSet");
else {
s << p("Still starting up, or else set is not yet " + a("http://www.mongodb.org/display/DOCS/Replica+Set+Configuration#InitialSetup", "", "initiated")
- + ".<br>" + ReplSet::startupStatusMsg);
+ + ".<br>" + ReplSet::startupStatusMsg.get());
}
}
else {
diff --git a/db/repl/rs.cpp b/db/repl/rs.cpp
index 90ed9f4..bbfb057 100644
--- a/db/repl/rs.cpp
+++ b/db/repl/rs.cpp
@@ -321,7 +321,7 @@ namespace mongo {
}
ReplSetImpl::StartupStatus ReplSetImpl::startupStatus = PRESTART;
- string ReplSetImpl::startupStatusMsg;
+ DiagStr ReplSetImpl::startupStatusMsg;
extern BSONObj *getLastErrorDefault;
diff --git a/db/repl/rs.h b/db/repl/rs.h
index 1419ad6..ea9aef1 100644
--- a/db/repl/rs.h
+++ b/db/repl/rs.h
@@ -244,7 +244,7 @@ namespace mongo {
EMPTYUNREACHABLE=4, STARTED=5, SOON=6
};
static StartupStatus startupStatus;
- static string startupStatusMsg;
+ static DiagStr startupStatusMsg;
static string stateAsHtml(MemberState state);
/* todo thread */
@@ -420,7 +420,7 @@ namespace mongo {
}
if( theReplSet == 0 ) {
result.append("startupStatus", ReplSet::startupStatus);
- errmsg = ReplSet::startupStatusMsg.empty() ? "replset unknown error 2" : ReplSet::startupStatusMsg;
+ errmsg = ReplSet::startupStatusMsg.empty() ? "replset unknown error 2" : ReplSet::startupStatusMsg.get();
if( ReplSet::startupStatus == 3 )
result.append("info", "run rs.initiate(...) if not yet done for the set");
return false;
diff --git a/db/repl/rs_member.h b/db/repl/rs_member.h
index 017b6ea..b685c04 100644
--- a/db/repl/rs_member.h
+++ b/db/repl/rs_member.h
@@ -19,6 +19,8 @@
#pragma once
+#include "../../util/concurrency/value.h"
+
namespace mongo {
@@ -74,7 +76,7 @@ namespace mongo {
time_t upSince;
long long downSince;
time_t lastHeartbeat;
- string lastHeartbeatMsg;
+ DiagStr lastHeartbeatMsg;
OpTime opTime;
int skew;