summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/repl/rs.cpp10
-rw-r--r--src/mongo/db/repl/rs.h11
-rw-r--r--src/mongo/db/repl/rs_initiate.cpp6
-rw-r--r--src/mongo/db/repl/rs_sync.cpp24
4 files changed, 17 insertions, 34 deletions
diff --git a/src/mongo/db/repl/rs.cpp b/src/mongo/db/repl/rs.cpp
index cf095b1e80e..9bbbaf864de 100644
--- a/src/mongo/db/repl/rs.cpp
+++ b/src/mongo/db/repl/rs.cpp
@@ -851,7 +851,7 @@ namespace mongo {
return;
cc().getAuthenticationInfo()->authorize("local","_repl");
}
-
+
void ReplSetImpl::setMinValid(BSONObj obj) {
BSONObjBuilder builder;
builder.appendTimestamp("ts", obj["ts"].date());
@@ -860,13 +860,5 @@ namespace mongo {
Helpers::putSingleton("local.replset.minvalid", builder.obj());
}
- OpTime ReplSetImpl::getMinValid() {
- Lock::DBRead lk("local.replset.minvalid");
- BSONObj mv;
- if (Helpers::getSingleton("local.replset.minvalid", mv)) {
- return mv["ts"]._opTime();
- }
- return OpTime();
- }
}
diff --git a/src/mongo/db/repl/rs.h b/src/mongo/db/repl/rs.h
index 834f999814e..5bd41d11311 100644
--- a/src/mongo/db/repl/rs.h
+++ b/src/mongo/db/repl/rs.h
@@ -539,17 +539,8 @@ namespace mongo {
void syncRollback(OplogReader& r);
void syncThread();
const OpTime lastOtherOpTime() const;
-
- /**
- * When a member reaches its minValid optime it is in a consistent state. Thus, minValid is
- * set as the last step in initial sync (if no minValid is set, this indicates that initial
- * sync is necessary). It is also used during "normal" sync: the last op in each batch is
- * used to set minValid, to indicate that we are in a consistent state when the batch has
- * been fully applied.
- */
static void setMinValid(BSONObj obj);
- static OpTime getMinValid();
-
+
int oplogVersion;
private:
IndexPrefetchConfig _indexPrefetchConfig;
diff --git a/src/mongo/db/repl/rs_initiate.cpp b/src/mongo/db/repl/rs_initiate.cpp
index d1eef6ca82b..fb21023cd4d 100644
--- a/src/mongo/db/repl/rs_initiate.cpp
+++ b/src/mongo/db/repl/rs_initiate.cpp
@@ -247,12 +247,6 @@ namespace mongo {
result.append("info", "Config now saved locally. Should come online in about a minute.");
ReplSet::startupStatus = ReplSet::SOON;
ReplSet::startupStatusMsg.set("Received replSetInitiate - should come online shortly.");
-
- // Dummy minvalid - just something non-null so we can be "up"
- OpTime minvalid(1, 0);
- BSONObjBuilder bob;
- bob.appendTimestamp("ts", minvalid.asDate());
- ReplSet::setMinValid(bob.done());
}
catch( DBException& e ) {
log() << "replSet replSetInitiate exception: " << e.what() << rsLog;
diff --git a/src/mongo/db/repl/rs_sync.cpp b/src/mongo/db/repl/rs_sync.cpp
index e61110dc95f..3c71b075bd3 100644
--- a/src/mongo/db/repl/rs_sync.cpp
+++ b/src/mongo/db/repl/rs_sync.cpp
@@ -565,15 +565,21 @@ namespace replset {
}
}
- minvalid = getMinValid();
- if( minvalid <= lastOpTimeWritten ) {
- golive=true;
- }
- else {
- sethbmsg(str::stream() << "still syncing, not yet to minValid optime " <<
- minvalid.toString());
+ {
+ Lock::DBRead lk("local.replset.minvalid");
+ BSONObj mv;
+ if( Helpers::getSingleton("local.replset.minvalid", mv) ) {
+ minvalid = mv["ts"]._opTime();
+ if( minvalid <= lastOpTimeWritten ) {
+ golive=true;
+ }
+ else {
+ sethbmsg(str::stream() << "still syncing, not yet to minValid optime " << minvalid.toString());
+ }
+ }
+ else
+ golive = true; /* must have been the original member */
}
-
if( golive ) {
sethbmsg("");
changeState(MemberState::RS_SECONDARY);
@@ -668,7 +674,7 @@ namespace replset {
}
/* do we have anything at all? */
- if (getMinValid().isNull() || lastOpTimeWritten.isNull()) {
+ if( lastOpTimeWritten.isNull() ) {
syncDoInitialSync();
return; // _syncThread will be recalled, starts from top again in case sync failed.
}