Coverity: add GUARDED_BY annotations to replication coordinator external state

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

      What

      Add `GUARDED_BY(_threadMutex)` to the member fields in `ReplicationCoordinatorExternalStateImpl` that are accessed without the mutex, and `REQUIRES(_threadMutex)` to the private helpers that read or write them. Fix all callers that must acquire the lock before invoking those helpers.

      Files: `replication_coordinator_external_state_impl.cpp` (lines 351, 361, 512, 517, 522, 538, 595).

      Resolves: SERVER-108741, SERVER-108742, SERVER-110036, SERVER-110582, SERVER-110600, SERVER-114009, SERVER-114010

      Why

      Coverity flags these members because they are written on one thread and read on another with no visible synchronization. Coverity cannot be run locally, so it is hard to verify whether a fix actually resolves a finding — a code change that looks correct might still leave the access pattern ambiguous to the analyzer. `GUARDED_BY` and `REQUIRES` annotations give the compiler the same information Coverity needs: every future callsite that touches these fields without `_threadMutex` is a build error. This makes the fix verifiable in the normal build and prevents the issue from being reintroduced on these variables in the future.

            Assignee:
            Denis Trailin
            Reporter:
            Denis Trailin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: