Coverity: add GUARDED_BY to transaction coordinator state and fix SharedPromise write-lock

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

      What

      Add `GUARDED_BY(_mutex)` to unprotected members in `TransactionCoordinator`, `TransactionCoordinatorService`, and `TransactionCoordinatorFuturesUtil`. Add `REQUIRES(_mutex)` to private helpers. Replace `readLock()` with `writeLock()` for all `SharedPromise::emplaceValue` / `setError` calls in `replication_coordinator_impl.h`.

      Files: `transaction_coordinator.cpp` (lines 479, 533, 570), `transaction_coordinator_service.cpp` (lines 324, 328, 371), `transaction_coordinator_futures_util.h` (line 385), `transaction_coordinator_service.h` (line 169), `replication_coordinator_impl.h` (line 2083).

      Resolves: SERVER-108434, SERVER-108438, SERVER-108620, SERVER-108880, SERVER-110694, SERVER-110876, SERVER-111619, SERVER-111636, SERVER-112391, SERVER-116204, SERVER-108524

      Why

      Two-phase commit state must be consistent throughout the coordinator lifecycle. Because Coverity cannot be run locally, `GUARDED_BY` annotations are the most practical way to confirm a fix is complete and to prevent these variables from being accessed without the lock again in the future — a clean build is the proof. The `SharedPromise` `readLock` issue allows concurrent fulfillments; replacing it with `writeLock` restores mutual exclusion at the fulfillment site.

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

              Created:
              Updated: