Deduplicate ResetWorkflowExecution requests - #12042
Open
Qian-Cheng-nju wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
Persist the public reset request ID in the new reset run's existing
RequestIdsmap and use that marker when deduplicatingResetWorkflowExecutionretries.The marker does not replace
CreateRequestId, which continues to hold the original workflow-start request ID used by scheduler callback identity. It is distinguishable from history-event request IDs and CHASM-attached request IDs, and does not require a persistence schema change. History-based rebuild paths preserve the marker from the existing mutable state because no history event can recreate it. Internal reset paths do not add a public reset marker.Unit tests cover marker classification and preservation during mutable-state rebuilds. The functional test covers immediate retries and retries after
RebuildMutableState, both with and without an explicit run ID. It also checks that a different request ID still creates a new reset run.Why?
When a client retries
ResetWorkflowExecutionwith the samerequest_idafter losing a successful response, Temporal can create a second reset run and terminate the run created by the first request.tests/workflow_reset_test.goreproduces this by sending the same request twice and observing that the retry returns a different run ID and terminates the first reset run.The deduplication check only compared the current run's
CreateRequestId. Reset runs retain the original workflow-start request ID in that field for scheduler callback identity, so the reset request ID was unavailable for deduplication. A reset marker without a corresponding history event must also be copied when mutable state is rebuilt.How did you test it?
Commands:
On the base revision, retrying with the same request ID returns a different reset run ID. With this change, the test returns the original reset run ID before and after
RebuildMutableState, and confirms that the marker remains present after the rebuild.Potential risks
Each public reset run stores one additional request-ID entry. Rebuild preservation is limited to the Reset marker shape. Reset runs created before this change cannot gain the marker retroactively.