[SERVER-39610] Reformat TransactionParticipant comments and remove last references to the metrics mutex Created: 15/Feb/19  Updated: 29/Oct/23  Resolved: 03/Jul/19

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 4.2.1, 4.3.1

Type: Task Priority: Major - P3
Reporter: Judah Schvimer Assignee: William Schultz (Inactive)
Resolution: Fixed Votes: 0
Labels: prepare_optional
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-36685 Reverse order of TransactionParticipa... Closed
is related to SERVER-38810 Use the Client mutex or the SessionCa... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.2
Sprint: Repl 2019-06-17, Repl 2019-07-01, Repl 2019-07-15
Participants:

 Description   

This is just follow up clean up to SERVER-38810.
Some comments could use rewrapping and there is a dangling reference to a non-existent mutex.



 Comments   
Comment by Githook User [ 15/Aug/19 ]

Author:

{'name': 'William Schultz', 'email': 'william.schultz@mongodb.com', 'username': 'will62794'}

Message: SERVER-39610 Remove outdated references to the metrics mutex in the TransactionParticipant and simplify some metrics reporting logic

(cherry picked from commit f92ac762f68f65461b060abc6c94fe95446afba6)
Branch: v4.2
https://github.com/mongodb/mongo/commit/9df434b51a1a3ee5cae7b2a1790be48e53534c36

Comment by William Schultz (Inactive) [ 03/Jul/19 ]

After looking into further cleanup of the metrics tracking logic, the refactoring seems somewhat non-trivial, and may take more time than I expected. Going to close this ticket since the basic cleanup here is done.

Comment by Githook User [ 02/Jul/19 ]

Author:

{'name': 'William Schultz', 'username': 'will62794', 'email': 'william.schultz@mongodb.com'}

Message: SERVER-39610 Remove outdated references to the metrics mutex in the TransactionParticipant and simplify some metrics reporting logic
Branch: master
https://github.com/mongodb/mongo/commit/f92ac762f68f65461b060abc6c94fe95446afba6

Comment by Judah Schvimer [ 12/Jun/19 ]

The above SGTM, cleaning up duplicated state seems worthwhile.

Comment by William Schultz (Inactive) [ 12/Jun/19 ]

There may be some additional, optional cleanup that can be done here related to metrics tracking. In SERVER-36685, which predated the concurrency control refactoring from SERVER-38810, we introduced a _metricsMutex which was a second mutex in addition to the TransactionParticipant's own mutex. I believe that we introduced that mutex so that we could access the TransactionMetricsObserver object without needing to acquire the TP mutex. There were some cases where we would be holding the Client lock when calling reportUnstashedState so we made ourselves prone to deadlock since there were other places where we acquired the TP mutex followed by the Client lock i.e. an opposite lock acquisition order. Now that concurrency control of the TP is mainly handled by the Client lock, it should be safe to read any of the transaction stats data from inside reportUnstashedState, since we should be holding the appropriate Client lock inside there. It seems that some of the state from the TP was duplicated into the SingleTransactionStats class (e.g. autocommit) so that stat reporting could access this data when only holding the metrics mutex and not the TP mutex. We could consider cleaning up any duplicate data and just read it directly from the TP.

Comment by William Schultz (Inactive) [ 12/Jun/19 ]

Looks like many of the comments in TransactionParticipant were already re-formatted in this commit.

Generated at Thu Feb 08 04:52:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.