Do not serialize with mutex in shard role api to discover replica state member during snapshot acquisition

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • CAR Team 2026-05-11
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Discovering the replica-set state as part of the snapshot acquisition is currently using a thread safe path that caused a performance regression under certain workloads with high concurrency.
      Given that:

      • We only need to know If writes are allowed (and not the precise state of the replica set node)
      • For locked acquisitions, RSTL lock is taken, which guarantees serialization with stepdown
      • For lock-free acquisitions, the replication term is checked optimistically to verify no stepdown occurred

      We can bypass the mutex within the shard role for the `getNodeRole` helper that used on purpose
      I updated the comment to warn developer to carefully use the `getNodeRole`

            Assignee:
            Enrico Golfieri
            Reporter:
            Enrico Golfieri
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: