[SERVER-9407] Helpers::removeRange always waits for 2 secondaries if secondaryThrottle is true Created: 19/Apr/13  Updated: 10/Dec/14  Resolved: 19/Apr/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 2.4.2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Randolph Tan Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-14708 A mixed single node & replicaset set ... Closed
Operating System: ALL
Participants:

 Description   

Relevant piece of code:

            if ( secondaryThrottle && numDeleted > 0 ) {
                if ( ! waitForReplication( c.getLastOp(), 2, 60 /* seconds to wait */ ) ) {
                    warning() << "replication to secondaries for removeRange at least 60 seconds behind" << endl;
                }
                millisWaitingForReplication += secondaryThrottleTime.millis();
            }

Note that 2 (num of secondaries to wait) is always passed to waitForReplication. This can cause the delete to needlessly wait for 60 seconds if there are less than 2 secondaries (and worse, if the node is not a member of a replica set at all!)



 Comments   
Comment by Asya Kamsky [ 08/Jul/14 ]

Note: if majority for replica set is <=1 then secondaryThrottle is set to false at the beginning of migration.

https://github.com/mongodb/mongo/blob/v2.4.1/src/mongo/s/d_migrate.cpp#L899-L915

However, that's majority for one of the "from" or "to" shards (the "from" shard) - if that's a replica set with majority>1 but "to" shard is a single server (or replica set with majority=1, or primary with some number of only arbiters) then this behavior (of waiting for w:2) will be triggered.

This code has been refactored so changing the link to point to 2.4 branch.

Workaround: if any shards are not a replica set or don't have majority>1 then set secondaryThrottle to false.

Comment by Eliot Horowitz (Inactive) [ 19/Apr/13 ]

w=2 means primary + 1 secondary
caller is responsible for knowing if its in a set

Generated at Thu Feb 08 03:20:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.