Skip to content

Introduce worker versioning into durable functions#3095

Merged
halspang merged 5 commits intodevfrom
halspang/worker_versioning
Jun 11, 2025
Merged

Introduce worker versioning into durable functions#3095
halspang merged 5 commits intodevfrom
halspang/worker_versioning

Conversation

@halspang
Copy link
Copy Markdown
Member

This commit adds the worker versioning options to the base DurableTaskOptions which are read through the host.json file. This change also includes a few changes for wiring the values through as well as testing.

Important

This change depends on multiple external changes/new versions:

As is, the tests in this PR will fail due to the lack of appropriate references. Once those releases are made, this PR will have to be updated. However, the code/tests are all complete in their implementation and are OK to be reviewed. This just cannot be merged until that point.

Comment thread test/e2e/Tests/Tests/VersioningTests.cs Outdated
Comment thread src/WebJobs.Extensions.DurableTask/Options/DurableTaskOptions.cs Outdated
@AnatoliB
Copy link
Copy Markdown
Collaborator

AnatoliB commented May 7, 2025

This problem is probably not introduced nor fixable in this PR, but I discovered an issue with orchestration rejection when testing this E2E, so I'll mention it here.

I have an orchestrator like this:

[Function(nameof(WaitForEventOrchestrator))]
public static async Task<string> WaitForEventOrchestrator(
    [OrchestrationTrigger] TaskOrchestrationContext context)
{
    context.SetCustomStatus("Waiting for Continue event...");
    await context.WaitForExternalEvent<object>("Continue");
    context.SetCustomStatus("Continue event received");
    return context.Version;
}

Versioning config in host.json:

"defaultVersion": "2.0",
"versionMatchStrategy": "CurrentOrOlder",
"versionFailureStrategy": "Reject",

When I start an orchestration and it gets paused waiting for an external event, as expected. Next, I shut the worker down, change defaultVersion to 1.0 to emulate the situation when an old worker is still around, start the worker again, and raise the external event. This worker is unable to complete the orchestration, but I'm observing two unexpected side effects:

  1. The persisted orchestration history keeps growing, adding EventRaised and orchestratorStarted to the table repeatedly and indefinitely.
  2. The custom status disappears.

Both can be significant issues for the user in some contexts.

@halspang halspang force-pushed the halspang/worker_versioning branch 2 times, most recently from f9cda9a to 15de604 Compare June 3, 2025 06:20
@halspang
Copy link
Copy Markdown
Member Author

halspang commented Jun 3, 2025

Updated the code to handle the sub-orchestration version use case you brought up @AnatoliB.

Note that this PR now also depends on this change: microsoft/durabletask-dotnet#437

So that means the dependencies are for a DurableTask.Core release and the packages in the PR above ^

halspang added 2 commits June 6, 2025 18:04
This commit adds the worker versioning options to the base
DurableTaskOptions which are read through the host.json file.
This change also includes a few changes for wiring the values
through as well as testing.

Signed-off-by: halspang <halspang@microsoft.com>
Signed-off-by: halspang <halspang@microsoft.com>
@halspang halspang force-pushed the halspang/worker_versioning branch 2 times, most recently from 881ff3f to c44d39e Compare June 7, 2025 01:21
Signed-off-by: halspang <halspang@microsoft.com>
@halspang halspang force-pushed the halspang/worker_versioning branch from c44d39e to 7b9c6a7 Compare June 9, 2025 17:57
Copy link
Copy Markdown
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial feedback. Haven't gone through the whole thing again yet.

Comment thread test/e2e/Tests/Tests/VersioningTests.cs Outdated
Comment thread src/Worker.Extensions.DurableTask/Worker.Extensions.DurableTask.csproj Outdated
Copy link
Copy Markdown
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished reviewing. Just a couple more things...

Comment thread src/Worker.Extensions.DurableTask/FunctionsOrchestrationContext.cs Outdated
Comment thread src/WebJobs.Extensions.DurableTask/LocalGrpcListener.cs
Signed-off-by: halspang <halspang@microsoft.com>
@halspang halspang force-pushed the halspang/worker_versioning branch from 30c1cf4 to ff16aaf Compare June 10, 2025 20:02
Signed-off-by: halspang <halspang@microsoft.com>
@halspang halspang merged commit 38fc852 into dev Jun 11, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants