-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Sharding
-
Fully Compatible
-
Sharding 2020-10-19
When a command inside a running transaction returns a response, its (uncommitted) state is stashed into some map on session's in a structure called TxnResources. This stash includes things like locks, the current storage engine transaction and any collections the transaction has created.
Stashing the uncommitted collections will create a new shared pointer for the TxnResources to hold onto.
Unstashing the uncommitted collections asserts that the OperationContext does not know of any existing uncommitted collections.
The stash -> unstash works so long as an operation context is destroyed after each "statement". This is the typical case as each new request over the wire creates a new operation context. However, internal code can send commands directly into the local system. This entry point executes all of the transaction related stashing logic, but also allows for the caller to provide the same operation context for each statement.
The latter case can run into the above assertion when the transaction attempts (explicitly, or implicitly) to create a collection. This ticket is to make the stashing logic appropriately clean up the UncommittedCollections associated with an OpCtx.
Original Description
Assumptions exist for creating collections in replica set transactions that are outside of the scope of completion for Resharding's Milestone 1. In order to avoid spending too much time trying to debug collection creation in transactions, collection creation at the beginning of a resharding operation must be done outside of a transaction.
Right now, this includes creating the config.reshardingOperations collection before attempting to insert to that collection here.
Whoever works on this ticket must also find other places where collections are being written to in transactions as part of resharding, and assess whether it's possible that an operation leads to implicit collection creation. If so, the resharding collection must be optimistically outside of a transaction.
For questions about how to implement this, and for code review, refer to Dan Gottlieb.
- is depended on by
-
SERVER-51209 Fill in missing gaps in Resharding workflow to complete Milestone 1
- Closed
-
SERVER-51210 Call setInitialChunksAndZones from the config server reshardCollection command
- Closed
- is related to
-
SERVER-51350 Move collection creation inside a replica set transaction for Resharding collections
- Closed