[SERVER-38810] Use the Client mutex or the SessionCatalog mutex for concurrency control of the TransactionParticipant Created: 02/Jan/19 Updated: 29/Oct/23 Resolved: 15/Feb/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 4.1.9 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Kaloian Manassiev | Assignee: | Andy Schwerin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||
| Sprint: | Sharding 2019-01-14, Sharding 2019-01-28, Sharding 2019-02-11, Sharding 2019-02-25 | ||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||
| Linked BF Score: | 0 | ||||||||||||||||||||||||||||
| Description |
|
This ticket is for implementing the TransactionParticipant concurrency control change to look like this:
This rule can also be expressed as: When the Session holding the TransactionParticipant is checked-out, use the OperationContext concurrency rules (i.e., the Client mutex); When it is not checked-out only use the SessionCatalog’s mutex. Prepare transaction in this case becomes:
Session invalidation and killAllExpiredTranasctions becomes:
Session invalidation on stepDown and shutDown becomes:
All TP methods, which require the session to be checked-out will be changed to not accept OperationContext anymore, but to take it from the parent Session object and all methods which expose observable state will be changed to either acquire the client mutex or to accept a WithLock to indicate that they should be run under the client mutex. |
| Comments |
| Comment by Githook User [ 15/Feb/19 ] |
|
Author: {'name': 'Andy Schwerin', 'email': 'schwerin@mongodb.com', 'username': 'amschwerin'}Message: This type simplifies and clarifies concurrency control in TransactionParticipant by: (1) Removing TP's own mutexes and using the Session concurrency control rules, (2) Separating the two types of state in (1) into separate sub-structures in (3) Putting all methods formerly on TransactionParticipant onto new member The two types introduced by (3) are designed to enforce proper concurrency It is worth noting that with this change, locking the Client is not needed often |
| Comment by Githook User [ 11/Jan/19 ] |
|
Author: {'username': 'kaloianm', 'email': 'kaloian.manassiev@mongodb.com', 'name': 'Kaloian Manassiev'}Message: |
| Comment by Githook User [ 10/Jan/19 ] |
|
Author: {'username': 'amschwerin', 'email': 'schwerin@mongodb.com', 'name': 'Andy Schwerin'}Message: This patch introduces two new types for gaining access to sessions in The new types are ObservableSession and SessionToKill. With this (1) by binding the session to an OperationContext for regular use, by (2) In the callback passed to SessionCatalog::scanSessions, in which (3) By calling SessionCatalog::checkOutSessionForKill, which returns a This patch eliminates Session::_mutex, which is no longer required, as |