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:28:04 -0400 |
commit | 0a4d62f611f4c12a01dca53dc21181091a9bf51e (patch) | |
tree | f268729e72163e922c6295cca8606f4d460c5b49 | |
parent | 5a3244c1b1424f4fbeb006f501c450074f4127f2 (diff) | |
download | mongo-0a4d62f611f4c12a01dca53dc21181091a9bf51e.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 84a7f3961b3..f56670e0299 100644 --- a/src/mongo/s/d_migrate.cpp +++ b/src/mongo/s/d_migrate.cpp @@ -1437,11 +1437,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 ); @@ -1769,13 +1768,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; @@ -1853,7 +1852,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; |