diff options
author | Antonin Kral <a.kral@bobek.cz> | 2011-12-15 10:02:19 +0100 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2011-12-15 10:02:46 +0100 |
commit | 0b48f8ada2acb0de830b23f8cefc8e3fea28d915 (patch) | |
tree | f7c2811269b6b53199412be2dd5ec02eea15d55d /db/repl/rs_initialsync.cpp | |
parent | 85f1cd56145b90a32b7ccdc750000deeed54fe22 (diff) | |
parent | f0d9a01bccdaeb466c12c92057914bbfef59526c (diff) | |
download | mongodb-0b48f8ada2acb0de830b23f8cefc8e3fea28d915.tar.gz |
Merge branch 'upstream/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)) { |