[SERVER-40489] ReplicaSetMonitor should ignore "primary" field in isMaster response Created: 05/Apr/19  Updated: 29/Oct/23  Resolved: 05/Jun/19

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

Type: Improvement Priority: Minor - P4
Reporter: A. Jesse Jiryu Davis Assignee: Shaileja Jain (Inactive)
Resolution: Fixed Votes: 0
Labels: neweng, sa-intern-tickets
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.2
Sprint: Service Arch 2019-06-03, Service Arch 2019-06-17
Participants:

 Description   

The following code in Refresher::receivedIsMasterBeforeFoundMaster is unnecessary now that ReplicaSetMonitor has been rewritten with task executors. Its purpose was to scan a possible primary as soon as possible, but now all possible servers are scanned concurrently. Remove this code for simplicity's sake:

    // If this node thinks the primary is someone we haven't tried, make that the next
    // hostToScan.
    if (!reply.primary.empty() && !_scan->triedHosts.count(reply.primary)) {
        std::deque<HostAndPort>::iterator it = std::stable_partition(
            _scan->hostsToScan.begin(), _scan->hostsToScan.end(), HostIs(reply.primary));
 
        if (it == _scan->hostsToScan.begin()) {
            // reply.primary wasn't in hostsToScan
            _scan->hostsToScan.push_front(reply.primary);
        }
    }



 Comments   
Comment by Githook User [ 04/Jun/19 ]

Author:

{'name': 'Shaileja Jain', 'email': 'shaileja.jain@gmail.com', 'username': 'shailejajain'}

Message: SERVER-40489 Simplify scan for primary by removing unnecessary receivedIsMasterBeforeFoundMaster helper function
Branch: master
https://github.com/mongodb/mongo/commit/ed173f027ae8940bb93c57c580993192dc534fb0

Generated at Thu Feb 08 04:55:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.