diff options
author | Antonin Kral <a.kral@bobek.cz> | 2011-12-15 09:35:47 +0100 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2011-12-15 09:35:47 +0100 |
commit | f0d9a01bccdaeb466c12c92057914bbfef59526c (patch) | |
tree | 7679efa1f0daf7d1d906882a15dc77af6b7aef32 /db/repl/rs_initialsync.cpp | |
parent | 5d342a758c6095b4d30aba0750b54f13b8916f51 (diff) | |
download | mongodb-f0d9a01bccdaeb466c12c92057914bbfef59526c.tar.gz |
Imported Upstream version 2.0.2
Diffstat (limited to 'db/repl/rs_initialsync.cpp')
-rw-r--r-- | db/repl/rs_initialsync.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/db/repl/rs_initialsync.cpp b/db/repl/rs_initialsync.cpp index 101b03a..112d739 100644 --- a/db/repl/rs_initialsync.cpp +++ b/db/repl/rs_initialsync.cpp @@ -81,6 +81,7 @@ namespace mongo { const Member* ReplSetImpl::getMemberToSyncTo() { Member *closest = 0; + bool buildIndexes = true; // wait for 2N pings before choosing a sync target if (_cfg) { @@ -90,11 +91,15 @@ namespace mongo { OCCASIONALLY log() << "waiting for " << needMorePings << " pings from other members before syncing" << endl; return NULL; } + + buildIndexes = myConfig().buildIndexes; } // find the member with the lowest ping time that has more data than me for (Member *m = _members.head(); m; m = m->next()) { if (m->hbinfo().up() && + // make sure members with buildIndexes sync from other members w/indexes + (!buildIndexes || (buildIndexes && m->config().buildIndexes)) && (m->state() == MemberState::RS_PRIMARY || (m->state() == MemberState::RS_SECONDARY && m->hbinfo().opTime > lastOpTimeWritten)) && (!closest || m->hbinfo().ping < closest->hbinfo().ping)) { |