How cadence do keep execution history order? #4684
-
For sequence workflow, I could understand the EventID is incr 1 by 1, and ResetWorkflowExecution opeartion is clear. But for parallel workflow (using workflow.Go function), how cadence keep the EventID always be same evenly in history replay? If I want to reset just single one branch of parallel, but other branch history event happend after the event id point, what will happen? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The trick is within the SDK and has nothing to do with server. For more details, see this dispatcherImpl https://github.com/uber-go/cadence-client/blob/26294594c6dd6b74e8d626a929968cace8e3148a/internal/internal_workflow.go#L157 |
Beta Was this translation helpful? Give feedback.
The trick is within the SDK and has nothing to do with server.
SDK will make sure all the goroutines( they are called coroutine in the Go SDK) are executed in a deterministic order.
And that's exactly why it's required to use
workflow.Go
because nativego func...
will lead to non-deterministic error.For more details, see this dispatcherImpl https://github.com/uber-go/cadence-client/blob/26294594c6dd6b74e8d626a929968cace8e3148a/internal/internal_workflow.go#L157
Which provides ExecuteUntilAllBlocked
https://github.com/uber-go/cadence-client/blob/26294594c6dd6b74e8d626a929968cace8e3148a/internal/internal_workflow.go#L901