Repository navigation
fix issue 148 - sub-orchestrations cannot reuse existing instance ids - #330
Usein Mambediiev (usemam) wants to merge 7 commits into
Conversation
|
Chris Gillum (@cgillum) could please take a look? Thank you. |
andystaples
left a comment
There was a problem hiding this comment.
Requesting changes for two P1 data-consistency issues in the new sub-orchestration instance-ID reuse path:
- A concurrent checkpoint can purge another parent's newly active child execution.
- A duplicate checkpoint can commit a purge and restart of a completed child even though checkpoint deduplication raises an error.
Both issues were reproduced against this PR's SQL in an isolated SQL Server 2022 database. For the second issue, the same replay against the merge-base SQL preserves the completed child's status and history. The inline comments include the failure sequences and requested changes.
|
Hi andystaples |
andystaples
left a comment
There was a problem hiding this comment.
Requesting changes for a stale child checkpoint that can overwrite a newly reused execution.
|
|
||
| IF EXISTS (SELECT 1 FROM @SubOrchestrationsToRecreate) | ||
| BEGIN | ||
| EXEC __SchemaNamePlaceholder__.PurgeInstanceStateByID @SubOrchestrationsToRecreate |
There was a problem hiding this comment.
[P1] Reject stale child checkpoints after reusing an instance ID
Purging the completed child's history removes the duplicate-checkpoint protection for its previous execution. If a delayed checkpoint from that execution arrives after the child has been recreated, _CheckpointOrchestration treats the execution ID mismatch as ContinueAsNew. It deletes the new execution's history and writes the old execution ID and status back to Instances, while the new ExecutionStarted event remains queued. The new child can be stranded, and any history it has already written can be lost.
Please prevent checkpoints for a previous execution from modifying the replacement while preserving legitimate ContinueAsNew behavior, and add a regression that checkpoints the old child after its ID is reused.
Fixes #148
Terminal targets (
Completed/Failed/Terminated) are now purged via the existingPurgeInstanceStateByIDbefore the insert, mirroringCreateInstance's overwrite path. Active instances are untouched.Tests
Re-enabled the disabled
RetryFailedSubOrchestration(true)case; addedReuseCompletedSubOrchestrationIDandCannotRecreateRunningSubOrchestrationInstance.