-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Replication
-
None
-
Fully Compatible
-
ALL
-
Repl 2018-12-03
-
73
The ServerTransactionsMetrics class is a service context decoration that maintains server-wide stats for transactions, including the opTimes of uncommitted/aborted transactions. The sets of opTimes are modified by TransactionParticipant through the TransactionMetricsObserver in several places (e.g. onPrepare) and by the ReplicationCoordinator when getting the stable timestamp. There is no internal synchronization for the lists of opTimes, so they can be concurrently modified, leading to data races.
A simple fix would be to add a mutex to ServerTransactionsMetrics that protects these variables. The other member variables in the class are atomics, so they are already thread-safe.