Add method for knowing if we are a primary in ReplicationCoordinator

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Replication
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            [DO NOT USE] Backlog - Replication Team
            Reporter:
            Jordi Olivares Provencio
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: