-
Notifications
You must be signed in to change notification settings - Fork 53
Changing the default dedupe statuses behavior #622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
8357e15
b434062
b8fc30b
c54e0cb
47bcb33
d8c26b3
64c3ba9
796f522
87a9bec
b6c7145
02b2427
dedcf9e
0b9a89e
098d9a3
c10c1bf
212d1aa
acddee1
68d84a3
edf3564
50b4ee9
6eb7b51
e600a5a
bf426ec
50e42d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| using System.Collections.Immutable; | ||
| using System.Diagnostics; | ||
| using System.Text; | ||
| using DurableTask.Core.Exceptions; | ||
| using DurableTask.Core.History; | ||
| using Google.Protobuf.WellKnownTypes; | ||
| using Microsoft.DurableTask.Client.Entities; | ||
|
|
@@ -73,6 +74,7 @@ public override ValueTask DisposeAsync() | |
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| // The behavior of this method when the dedupe statuses field is null depends on the server-side implementation. | ||
| public override async Task<string> ScheduleNewOrchestrationInstanceAsync( | ||
| TaskName orchestratorName, | ||
| object? input = null, | ||
|
|
@@ -124,9 +126,7 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync( | |
| } | ||
|
|
||
| // Set orchestration ID reuse policy for deduplication support | ||
| // Note: This requires the protobuf to support OrchestrationIdReusePolicy field | ||
| // If the protobuf doesn't support it yet, this will need to be updated when the protobuf is updated | ||
| if (options?.DedupeStatuses != null && options.DedupeStatuses.Count > 0) | ||
| if (options?.DedupeStatuses != null) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason for removing the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is indeed a behavior change. My thinking is:
Previously, I think both situations would default to whatever the backend does |
||
| { | ||
| // Parse and validate all status strings to enum first | ||
| ImmutableHashSet<OrchestrationRuntimeStatus> dedupeStatuses = options.DedupeStatuses | ||
|
|
@@ -143,19 +143,30 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync( | |
|
|
||
| // Convert dedupe statuses to protobuf statuses and create reuse policy | ||
| IEnumerable<P.OrchestrationStatus> dedupeStatusesProto = dedupeStatuses.Select(s => s.ToGrpcStatus()); | ||
| P.OrchestrationIdReusePolicy? policy = ProtoUtils.ConvertDedupeStatusesToReusePolicy(dedupeStatusesProto); | ||
|
|
||
| if (policy != null) | ||
| { | ||
| request.OrchestrationIdReusePolicy = policy; | ||
| } | ||
| request.OrchestrationIdReusePolicy = ProtoUtils.ConvertDedupeStatusesToReusePolicy(dedupeStatusesProto); | ||
| } | ||
|
|
||
| using Activity? newActivity = TraceHelper.StartActivityForNewOrchestration(request); | ||
|
|
||
| P.CreateInstanceResponse? result = await this.sidecarClient.StartInstanceAsync( | ||
| try | ||
| { | ||
| P.CreateInstanceResponse? result = await this.sidecarClient.StartInstanceAsync( | ||
| request, cancellationToken: cancellation); | ||
| return result.InstanceId; | ||
| return result.InstanceId; | ||
sophiatev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| catch (RpcException e) when (e.StatusCode == StatusCode.AlreadyExists) | ||
| { | ||
| throw new OrchestrationAlreadyExistsException(e.Status.Detail); | ||
| } | ||
| catch (RpcException e) when (e.StatusCode == StatusCode.InvalidArgument) | ||
| { | ||
| throw new ArgumentException(e.Status.Detail); | ||
sophiatev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| catch (RpcException e) when (e.StatusCode == StatusCode.Cancelled) | ||
| { | ||
| throw new OperationCanceledException( | ||
| $"The {nameof(this.ScheduleNewOrchestrationInstanceAsync)} operation was canceled.", e, cancellation); | ||
| } | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
|
|
@@ -479,6 +490,9 @@ public override Task<PurgeResult> PurgeAllInstancesAsync( | |
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| // Whether or not this method throws a <see cref="InvalidOperationException"/> or terminates the existing instance | ||
| // when <paramref name="restartWithNewInstanceId"/> is <c>false</c> and the existing instance is not in a terminal state | ||
| // depends on the server-side implementation. | ||
| public override async Task<string> RestartAsync( | ||
| string instanceId, | ||
| bool restartWithNewInstanceId = false, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.