-
Notifications
You must be signed in to change notification settings - Fork 179
Add support for FirstExecutionRunId to cancel and terminate #2692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for FirstExecutionRunId to cancel and terminate #2692
Conversation
| if (workflowChainId != null) { | ||
| TestWorkflowMutableState mutableStateByFirstRunId = getMutableState(workflowChainId, false); | ||
| if (mutableStateByFirstRunId != null) { | ||
| return mutableStateByFirstRunId; | ||
| } | ||
| } | ||
|
|
||
| TestWorkflowMutableState mutableState = getMutableState(executionId, false); | ||
| if (mutableState != null) { | ||
| if (workflowChainId == null) { | ||
| return mutableState; | ||
| } | ||
| WorkflowExecution mutableStateExecution = mutableState.getExecutionId().getExecution(); | ||
| if (mutableStateExecution.getRunId().equals(execution.getRunId()) | ||
| && firstExecutionRunId.equals(mutableState.getFirstExecutionRunId())) { | ||
| return mutableState; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering that workflow executions that have firstRunId are added to both maps in startWorkflowExecutionNoRunningCheckLocked, in what circumstances will the last if evaluate true (line 295)? If there is an execution with a matching first run ID, I'd expect it to have already returned inside the earlier if (line 285).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah good point, I think I overcomplicated the check. I simplified it a lot and should match how the current real server finds the correct mutable state. All the tests run on the real server and test server to validate this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add negative tests for what happens when the wrong first execution ID is provided to cancel/terminate request (both when there was and there wasn't continue-as-new).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
fceb387 to
7856212
Compare
Add support for FirstExecutionRunId to cancel and terminate to the Time skipping test server.
Note
Enable cancel and terminate operations to target a workflow chain via
firstExecutionRunId, not just the currentrunId.firstExecutionRunIdusingWorkflowChainId(namespace,workflowId,firstExecutionRunId).executionsByFirstExecutionRunId; exposegetFirstExecutionRunId()on mutable state.requestCancelWorkflowExecutionandterminateWorkflowExecutionto resolve executions viafirstExecutionRunIdwhen provided.FirstExecutionRunIdSupportTestcovering cancel/terminate byfirstExecutionRunIdand after continue-as-new.Written by Cursor Bugbot for commit 7856212. This will update automatically on new commits. Configure here.