[SERVER-71478] Add method for knowing if we are a primary in ReplicationCoordinator Created: 18/Nov/22  Updated: 05/Dec/22

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

Type: Improvement Priority: Major - P3
Reporter: Jordi Olivares Provencio Assignee: Backlog - Replication Team
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-71400 Investigate using a shared mutex for ... Closed
Assigned Teams:
Replication
Participants:

 Description   

During the PR discussion of SERVER-59673 it was discovered that currently there's no easy way of knowing if we are a primary/standalone/secondary.

One way is to use ReplicationCoordinator::getMemberState() but it is discouraged due to the internal mutex it locks, causing possible high contention. SERVER-71400 has been created to see if this can be alleviated.

As a workaround for that a lot of times we end up using ReplicationCoordinator::canAcceptWritesForDatabase with an arbitrary database name that is known to require replication (i.e. not the local database).

To ease readability it would be best if there were a method that does precisely what we want instead so future improvements are centralized there.


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