Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-71478

Add method for knowing if we are a primary in ReplicationCoordinator

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Replication

    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.

      Attachments

        Activity

          People

            backlog-server-repl Backlog - Replication Team
            jordi.olivares-provencio@mongodb.com Jordi Olivares Provencio
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated: