[SERVER-62576] Do not relinquish cursors across commands for snapshot reads and multi-statement transactions Created: 12/Jan/22  Updated: 06/Dec/22

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

Type: Task Priority: Major - P3
Reporter: Ian Boros Assignee: Backlog - Storage Execution Team
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-69159 Enable positioned cursors across find... Closed
Duplicate
is duplicated by SERVER-61407 Placeholder to revisit multi-doc tran... Closed
Related
related to SERVER-60741 Retain valid and positioned cursors a... Closed
Assigned Teams:
Storage Execution
Sprint: Execution Team 2022-08-08, Execution Team 2022-08-22, Execution Team 2022-09-05, Execution Team 2022-09-19
Participants:

 Description   

When implementing SERVER-60741, I excluded snapshot reads from using the behavior which preserves cursors across commands. This decision was based on a mistaken assumption, and we should change snapshot reads to stash their RecoveryUnit across getMores. We should also change query plans opened in multi statements transactions to not give up their storage cursors across commands. The bit about stashing the RecoveryUnit is already taken care of in this case.



 Comments   
Comment by Dianna Hohensee (Inactive) [ 19/Sep/22 ]

Additional Relevant Info Note:

Multi-document transactions originally cleaned up associated getMore state (ClientCursors) when aborted: SERVER-33690. However, a solution to a deadlock scenario was to skip cleanup of getMore state when a multi-document transaction gets aborted and instead to rely upon drivers or server cursor timeouts to close the cursors: SERVER-35217. The deadlock may no longer be a concern, as fewer locks are taken by the relevant code. My initial investigation in SERVER-69143 was encouraging.

Comment by Dianna Hohensee (Inactive) [ 19/Sep/22 ]

See the PR for details on where the work for this ticket was left off, if reviving. I think the solution to this problem will more likely involve a different direction, wherein we choose to merge ClientCursor with TransactionParticipant. Or at least we need to do something about abortTransaction destructing the RecoveryUnit without clearing open getMore state / ClientCursors that hold open storage cursors – RU destructor reasonably invariants that no storage cursors are open.

Comment by Dianna Hohensee (Inactive) [ 25/Aug/22 ]

Looks like the command layer/infrastructure is where we stash transaction resources: see here and here. I think the most straightforward / easiest way to handle multi-doc transactions is to have read commands not stash the RU but otherwise perform all the other new logic we're adding for cross cmd positioned cursors. Change the enablement flag to an enum that's either kEnabledStashRecoveryUnit or kEnabledDeferStashingRecoveryUnit – or some such names.

Comment by Dianna Hohensee (Inactive) [ 25/Aug/22 ]

Splitting off snapshot reads enablement to SERVER-69159. Snapshot can be enabled easily, multi-doc will take more work to reconcile RecoveryUnit stashing.

Comment by Dianna Hohensee (Inactive) [ 25/Aug/22 ]

Testing.

Generated at Thu Feb 08 05:55:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.