-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Replication
-
Fully Compatible
-
Repl 2025-11-10, Repl 2025-11-24
-
200
-
None
-
None
-
None
-
None
-
None
-
None
-
None
RCI has public accessors for some of its members. Those accessors take RCI._mutex, which blocks critical operations. Performance could be improved by caching those members in atomics and reading from the atomics in cases where only a single value is read. An example is getMyLastWrittenOpTime:
OpTime ReplicationCoordinatorImpl::getMyLastWrittenOpTime() const { stdx::lock_guard lock(_mutex); return _getMyLastWrittenOpTime(lock); } OpTimeAndWallTime ReplicationCoordinatorImpl::_getMyLastWrittenOpTimeAndWallTime(WithLock) const { return _topCoord->getMyLastWrittenOpTimeAndWallTime(); }
Without changing the internal accessor, we could rewrite the public accessor to read and return an atomic:
OpTime ReplicationCoordinatorImpl::getMyLastWrittenOpTime() const { return _myLastWrittenOpTimeCached.load(); }
This is safe as long as we store new lastWritten values while holding RCI._mutex.
- causes
-
SERVER-113843 Lock free ReplicationCoordinatorImpl accessors have races caught by TSAN
-
- Closed
-
- related to
-
SERVER-113982 DataWithLockFreeReads is not properly synchronized
-
- In Code Review
-
-
SERVER-114107 Revert DataWithLockFreeReads
-
- Closed
-
-
SERVER-113880 Add a cached _currentCommittedSnapshot
-
- Open
-