microsoft / microsoft/durabletask-mssql

Recursive purge is not recursive

Open
#293 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2
Dominant language
C#
Stars
105
Forks
36
PR merge metrics
No merged PRs in 30d

Description

Invoking DurableTaskClient.PurgeInstanceAsync with PurgeInstanceOptions.Recursive = true does not result in sub-orchestrations being purged. The documentation for this method states that sub-orchestrations should be purged when this flag is set.

Example:

var purgeInstanceOptions = new PurgeInstanceOptions
{
    Recursive = true
};

await client.PurgeInstanceAsync("my_instance_id", purgeInstanceOptions);

with rows in the Instances table that have ParentInstanceID=my_instance_id (in addition to the required InstanceID=my_instance_id row that has a RuntimeStatus of Completed, Terminated, or Failed), executes the following SQL:

declare @p1 dt.InstanceIDs
insert into @p1 values('my_instance_id')

exec dt.PurgeInstanceStateByID @InstanceIDs=@p1

(Stored procedure PurgeInstanceStateByID only uses the provided InstanceIDs - it does not perform a recursive CTE.)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at DurableTaskClient.PurgeInstanceAsync and PurgeInstanceOptions. Inspect how the recursive instance ID set is passed to dt.PurgeInstanceStateByID, using the Instances rows and ParentInstanceID example as the reproduction. Done means purging a completed, terminated, or failed parent also removes its sub-orchestrations.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.