diff options
author | Randolph Tan <randolph@10gen.com> | 2013-05-23 13:28:15 -0400 |
---|---|---|
committer | Dan Pasette <dan@10gen.com> | 2013-06-13 17:31:18 -0400 |
commit | 264aa37448eaef7f3bf46f0ba6ef5508d272b24c (patch) | |
tree | 9ce77ef2a17796a80dc6c49e7e0792ecb69e933c | |
parent | 9c4382ecb90f1044e3ba0e38991cf5c45281b7ea (diff) | |
download | mongo-264aa37448eaef7f3bf46f0ba6ef5508d272b24c.tar.gz |
SERVER-5351 migrations should use better slave count to determine up-to-date
-rw-r--r-- | src/mongo/s/d_migrate.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp index 1427624d9e1..139a640f5ce 100644 --- a/src/mongo/s/d_migrate.cpp +++ b/src/mongo/s/d_migrate.cpp @@ -1600,11 +1600,10 @@ namespace mongo { verify( ! min.isEmpty() ); verify( ! max.isEmpty() ); - slaveCount = ( getSlaveCount() / 2 ) + 1; + replSetMajorityCount = theReplSet ? theReplSet->config().getMajority() : 0; log() << "starting receiving-end of migration of chunk " << min << " -> " << max << - " for collection " << ns << " from " << from << - " (" << getSlaveCount() << " slaves detected)" << endl; + " for collection " << ns << " from " << from << endl; string errmsg; MoveTimingHelper timing( "to" , ns , min , max , 5 /* steps */ , errmsg ); @@ -1940,13 +1939,13 @@ namespace mongo { // if replication is on, try to force enough secondaries to catch up // TODO opReplicatedEnough should eventually honor priorities and geo-awareness // for now, we try to replicate to a sensible number of secondaries - return mongo::opReplicatedEnough( lastOpApplied , slaveCount ); + return mongo::opReplicatedEnough( lastOpApplied , replSetMajorityCount ); } bool flushPendingWrites( const ReplTime& lastOpApplied ) { if ( ! opReplicatedEnough( lastOpApplied ) ) { OpTime op( lastOpApplied ); - OCCASIONALLY warning() << "migrate commit waiting for " << slaveCount + OCCASIONALLY warning() << "migrate commit waiting for " << replSetMajorityCount << " slaves for '" << ns << "' " << min << " -> " << max << " waiting for: " << op << migrateLog; @@ -2024,7 +2023,7 @@ namespace mongo { long long numSteady; bool secondaryThrottle; - int slaveCount; + int replSetMajorityCount; enum State { READY , CLONE , CATCHUP , STEADY , COMMIT_START , DONE , FAIL , ABORT } state; string errmsg; |