[SERVER-68875] Reflow the SessionWorkflow loop Created: 16/Aug/22  Updated: 29/Oct/23  Resolved: 11/Dec/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-70151 ServiceExecutorSynchronous thread_loc... Closed
is depended on by SERVER-68876 SessionWorkflow: use clientStrand onl... Closed
Problem/Incident
causes SERVER-72939 Fix data-race in `SessionWorkflow` un... Closed
Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2022-09-05, Service Arch 2022-09-19, Service Arch 2022-10-03, Service Arch 2022-10-17, Service Arch 2022-10-31, Service Arch 2022-11-14, Service Arch 2022-11-28, Service Arch 2022-12-12
Participants:
Linked BF Score: 120

 Description   

Redo the control flow between SessionWorkflow's scheduleNewLoop and startNewLoop.
(Details TBD)

This is difficult to follow. scheduleNewLoop schedules startNewLoop on the executor. The last thing the startNewLoop does is a getAsync to make scheduleNewLoop happen again, so there's a loop of mutual recursion.

Both functions behave differently based on whether the current command is an exhaust command or not. This is pretty weird, because the logic is distributed and there's not a clear line of execution. The significant thing about exhaust commands is that they skip the sourceMessage step, but after that they should behave the same as non-exhaust commands.

Refactor this loop so that each "loop" sets up a Future and attaches the appropriate continuations to get a single request received, processed, and sent. That's the goal. If that "request receive" part is a no-op, then the Future chain will be a little different. That's fine. The important thing is that we unify the exhaust-non-exhaust paths and get a clear linear execution that can be read off in the source code.



 Comments   
Comment by Githook User [ 11/Dec/22 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-68875 SessionWorkflow loop
Branch: master
https://github.com/mongodb/mongo/commit/a32134f0c24464f38922821cc5300ac315d43681

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