[SERVER-77213] Move the all transactions-related state from OperationContext to TransactionResources Created: 17/May/23  Updated: 01/Feb/24

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Backlog - Catalog and Routing
Resolution: Unresolved Votes: 0
Labels: PM-2144-QW-Fallout, shardingemea-qw
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-77227 Layering violation between d_concurre... Closed
depends on SERVER-77123 Make the read concern for Transaction... Closed
depends on SERVER-77544 Don't register OpObservers on the Ser... Closed
depends on SERVER-77611 Add a static constructor/destructor f... Closed
depends on SERVER-78744 Access Locker through locker_api.h Closed
depends on SERVER-83330 Access RecoveryUnit and Locker throug... Closed
depends on SERVER-84229 Move LockManager::getLockerToClientMa... Closed
depends on SERVER-77556 Get rid of service_context_devnull_te... Closed
depends on SERVER-26879 Get rid of LockerNoop Closed
depends on SERVER-47204 Get rid of OperationContextNoop Closed
depends on SERVER-77224 Rename lock_state.h/.cpp to locker_im... Closed
depends on SERVER-77353 Get rid of the Locker implementation ... Closed
depends on SERVER-84481 Explicitly use RecoveryUnitNoop for s... Closed
depends on SERVER-84753 Devirtualise Locker and get rid of Lo... Closed
depends on SERVER-85434 Fold write_unit_of_work into shard_ro... Closed
is depended on by SERVER-77065 Figure out use cases and rules regard... Blocked
is depended on by SERVER-78735 Introduce invariant in Locker::unlock... Blocked
Assigned Teams:
Catalog and Routing
Sprint: Sharding EMEA 2023-05-29, Sharding EMEA 2023-06-12, Sharding EMEA 2023-06-26, Sharding EMEA 2023-07-10, Sharding EMEA 2023-10-02, Sharding EMEA 2023-10-16, Sharding EMEA 2023-10-30, CAR Team 2023-11-13, CAR Team 2023-11-27, CAR Team 2023-12-11, CAR Team 2023-12-25, CAR Team 2024-01-08
Participants:
Story Points: 3

 Description   

The TransactionResources class is becoming the sole data structure which will hold all kinds of resources that can be acquired by an active transaction, where transaction is defined as per this description.

We will be moving in the way where the transaction resources is what gets moved between contexts rather than swapping each individual resource (listed below) independently.

This ticket is specifically to move the Txn identification, Locker, RecoveryUnit and WriteUnitOfWork state from OperationContext to TransactionResources and remove all traces of it from OperationContext. This will also resolve circular dependency between the service_context library and the rest of the server, leaving it to be a low-level library for building any service.

As part of this change, we should also revisit all the swap* and replace* methods and how they are used. My interpretation is that they are used to implement various types of sub-transactions as part of the active one. For example, there is a sub-transaction kind, where we only replace the RecoveryUnit, but maintain the locks, which we call "Side Transaction". There are probably others and all these should be replaced by proper RAII types that operate on TransactionResources.



 Comments   
Comment by Kaloian Manassiev [ 20/Sep/23 ]

This ticket is a subset of the changes that will be done under SERVER-78744, so I am marking it as blocked until that's complete.

Comment by Jordi Serra Torrens [ 30/Aug/23 ]

As part of this ticket, consider moving WriteUnitOfWork from opCtx to TransactionResources as well.

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