microsoft / durabletask-go

The Durable Task Framework is a lightweight, embeddable engine for writing durable, fault-tolerant business logic (orchestrations) as ordinary code.
Apache License 2.0
178 stars 25 forks source link

Support Orchestration ID Reuse Policies #45

Closed kaibocai closed 7 months ago

kaibocai commented 7 months ago

This PR tries to update the logic to support reuse orchestration ID, more details can be found https://github.com/microsoft/durabletask-go/issues/42, https://github.com/dapr/dapr/issues/7101

Corresponding protobuf updates can be found https://github.com/microsoft/durabletask-protobuf/pull/19 It adds enum InstanceExistOption which contains three options THROW_IF_EXIST, TERMINATE_IF_EXIST, SKIP_IF_EXIST. THROW_IF_EXIST will be the default behavior which is also the current behavior.

kaibocai commented 7 months ago

Just add a more concrete implementation, but also got two questions

  1. Question: from the customer side SKIP_IF_EXIST and TERMINATE_IF_EXIST have the same behavior if success. Do customers need to know the difference between them? SKIP_IF_EXIST uses the old instance, whereas TERMINATE_IF_EXIST terminates the old instance and creates a new instance with the same instance ID.
  2. Seems this client file is only used for test, do we also need to update it's schedule instance logic at https://github.com/microsoft/durabletask-go/blob/ba82393dfeb37cb228d2c759b8b542826884ef58/backend/client.go#L40
kaibocai commented 7 months ago

Open a new PR https://github.com/microsoft/durabletask-go/pull/46, closing this one.