[SERVER-34156] Consolidate to a single replication API method for checking if a replica set is being used Created: 27/Mar/18  Updated: 29/Oct/23  Resolved: 21/Jul/23

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Judah Schvimer Assignee: Kaitlin Mahar
Resolution: Fixed Votes: 0
Labels: former-quick-wins, master-slave, repl-shortlist
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-34107 Remove master-slave server status and... Closed
is related to SERVER-35020 Remove references to oplog.$main Backlog
is related to SERVER-79067 Standardize on interface for obtainin... Open
Assigned Teams:
Replication
Backwards Compatibility: Fully Compatible
Sprint: Repl 2020-06-29, Repl 2023-07-24
Participants:

 Description   

ReplSettings::usingReplsets(), ReplicationCoordinator::isReplEnabled(), and ReplicationCoordinator::getReplicationMode() all return the same info and so it is confusing to have separate methods and engineers are not sure which to use.
This ticket removes ReplicationCoordinator::isReplEnabled() and ReplicationCoordinator::getReplicationMode(), renames ReplSettings::usingReplSets() to isReplSet(), and replaces all usages of the first two methods with isReplSet().



 Comments   
Comment by Githook User [ 21/Jul/23 ]

Author:

{'name': 'Kaitlin Mahar', 'email': 'kaitlin.mahar@mongodb.com', 'username': 'kmahar'}

Message: SERVER-34156 Consolidate to a single replication API method for checking if a replica set is being used
Branch: master
https://github.com/mongodb/mongo/commit/c66591c6f642f8b77c794d365a8b17b4c86032df

Comment by Didier Nadeau [ 05/Jun/23 ]

There are two interfaces to get the repl settings : getGlobalReplSettings and ReplicationCoordinator::getSettings. We should decide which interface should be used and remove the other (if we can't due to a corner case, we should make it very clear this interface should only be used under precise circumstances).

Comment by Frederic Vitzikam [ 30/May/23 ]

There is at least one place where we check for replMode == repl::ReplicationCoordinator::modeReplSet inside a if(replMode != repl::ReplicationCoordinator::modeNone) which is redundant now : https://github.com/10gen/mongo/blob/master/src/mongo/db/commands/write_commands.cpp#L196

Comment by Judah Schvimer [ 27/Mar/18 ]

There are also some places that call getReplicationMode() explicitly, which is a third way of checking the same thing.

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