durabletask-extensions icon indicating copy to clipboard operation
durabletask-extensions copied to clipboard

Add rewind to point functionality

Open lucaslorentz opened this issue 5 years ago • 3 comments

Implement a rewind to point functionality where you chose the point in history that you want to rewind to.

Algorithm:

  • Find last execution
  • Retrieve all events from last execution
  • Replace all events after the desired point by generic nop events
  • For every removed event of types: TaskCompleted, TaskFailed:
    • Find the corresponding TaskScheduled event and add it to activity queue
  • For every removed event of type: TimerFired
    • Find the corresponding TimerCreated event and add it to orchestration queue
  • For every removed event of types: SubOrchestrationInstanceCompleted, SubOrchestrationInstanceFailed:
    • Find the corresponding SubOrchestrationInstanceCreated event and add it to orchestration queue.
  • If it is a suborchestration, rewind parent orchestration from the suborchestration completed/failed event forward

Concerns:

  • Would this repeat the instanceId of suborchestrations and give it a new execution?

lucaslorentz avatar Dec 31 '20 15:12 lucaslorentz

The algorithm was improved and implemented at https://github.com/lucaslorentz/durabletask-extensions/blob/fb014b5c47bc7dd5da0c7f23ee4a916727cd5d3a/src/LLL.DurableTask.EFCore/EFCoreOrchestrationServiceClient.cs#L284

It also rewinds suborchestrations that had their completion event rewound in the current orchestration. It also rewinds parent orchestrations to before the current orchestration completion event.

There is no API yet though that allows us to chose the rewind point.

lucaslorentz avatar Nov 19 '22 18:11 lucaslorentz

Is it possible to use this improved Rewind algorithm with the AzureStorage backend?

I am hitting durabletask#811 and noticed you had replied there. But it looks like this improved Rewind only works with EFCore. Is my understanding correct?

Also, thanks for your work on this @lucaslorentz. durabletask-extensions looks great.

nathan815 avatar Jan 17 '24 00:01 nathan815

@nathan815 You understood correctly. The rewind logic is specific to each storage implementation, it is not possible to use the implementation I did with AzureStorage backend.

lucaslorentz avatar Jan 17 '24 00:01 lucaslorentz