-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add one-time versioning override #10763
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
89199a5
389c921
fea2041
6d94c7b
1fb01b7
0c85e67
80410f5
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 |
|---|---|---|
|
|
@@ -657,10 +657,28 @@ func GetOverridePinnedVersion(override *workflowpb.VersioningOverride) *deployme | |
| } | ||
| return nil | ||
| } | ||
|
|
||
| func GetOverrideOneTimeTargetVersion(override *workflowpb.VersioningOverride) *deploymentpb.WorkerDeploymentVersion { | ||
| return override.GetOneTime().GetTargetDeploymentVersion() | ||
| } | ||
|
|
||
| func GetOverrideTargetDeploymentVersion(override *workflowpb.VersioningOverride) *deploymentpb.WorkerDeploymentVersion { | ||
| switch { | ||
| case OverrideIsPinned(override): | ||
| return GetOverridePinnedVersion(override) | ||
| case override.GetOneTime() != nil: | ||
|
Contributor
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. Switch on the type directly. |
||
| return override.GetOneTime().GetTargetDeploymentVersion() | ||
| default: | ||
| // Auto-upgrade has no stored target version; the version is chosen by matching at task dispatch time | ||
| return nil | ||
| } | ||
| } | ||
|
cursor[bot] marked this conversation as resolved.
|
||
|
|
||
| func ExtractVersioningBehaviorFromOverride(override *workflowpb.VersioningOverride) enumspb.VersioningBehavior { | ||
| if override.GetAutoUpgrade() { | ||
| return enumspb.VERSIONING_BEHAVIOR_AUTO_UPGRADE | ||
| } else if override.GetPinned() != nil { | ||
| } else if override.GetPinned() != nil || override.GetOneTime() != nil { | ||
|
Shivs11 marked this conversation as resolved.
|
||
| // A pending one-time override routes like pinned; unlike pinned, it clears after a WFT completes on its target. | ||
| return enumspb.VERSIONING_BEHAVIOR_PINNED | ||
| } | ||
|
|
||
|
|
@@ -737,6 +755,11 @@ func ValidateVersioningOverrideAndGetReactivationEligibility(ctx context.Context | |
| return false, 0, serviceerror.NewInvalidArgument("must specify pinned override behavior if override is pinned.") | ||
| } | ||
| return validateVersionAndGetReactivationEligibility(ctx, p.GetVersion(), matchingClient, versionCache, tq, tqType, namespaceID) | ||
| } else if oneTime := override.GetOneTime(); oneTime != nil { | ||
| if oneTime.GetTargetDeploymentVersion() == nil { | ||
| return false, 0, serviceerror.NewInvalidArgument("must provide target deployment version if override is one-time.") | ||
| } | ||
| return validateVersionAndGetReactivationEligibility(ctx, oneTime.GetTargetDeploymentVersion(), matchingClient, versionCache, tq, tqType, namespaceID) | ||
| } | ||
|
|
||
| //nolint:staticcheck // SA1019: worker versioning v0.31 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -984,14 +984,14 @@ func (t *transferQueueActiveTaskExecutor) processStartChildExecution( | |
| } | ||
| } | ||
|
|
||
| // Pinned override is inherited if Task Queue of new run is compatible with the override version. | ||
| var inheritedPinnedOverride *workflowpb.VersioningOverride | ||
| if o := mutableState.GetExecutionInfo().GetVersioningInfo().GetVersioningOverride(); worker_versioning.OverrideIsPinned(o) { | ||
| inheritedPinnedOverride = o | ||
| // Pinned and one-time overrides are inherited if Task Queue of new run is compatible with the override version. | ||
|
Member
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. the reason why the child workflow path is receiving this special treatment but none of CAN/retry/cron paths are is because of the following idea:
|
||
| var inheritedVersioningOverride *workflowpb.VersioningOverride | ||
| if o := mutableState.GetExecutionInfo().GetVersioningInfo().GetVersioningOverride(); worker_versioning.GetOverrideTargetDeploymentVersion(o) != nil { | ||
| inheritedVersioningOverride = o | ||
| newTQ := attributes.GetTaskQueue().GetName() | ||
| if newTQ != mutableState.GetExecutionInfo().GetTaskQueue() && !newTQInPinnedVersion || | ||
| attributes.GetNamespaceId() != mutableState.GetExecutionInfo().GetNamespaceId() { // don't inherit pinned version if child is in a different namespace | ||
| inheritedPinnedOverride = nil | ||
| attributes.GetNamespaceId() != mutableState.GetExecutionInfo().GetNamespaceId() { // don't inherit override if child is in a different namespace | ||
| inheritedVersioningOverride = nil | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -1091,7 +1091,7 @@ func (t *transferQueueActiveTaskExecutor) processStartChildExecution( | |
| inheritedBuildId, | ||
| initiatedEvent.GetUserMetadata(), | ||
| shouldTerminateAndStartChild, | ||
| inheritedPinnedOverride, | ||
| inheritedVersioningOverride, | ||
| inheritedPinnedVersion, | ||
| priorities.Merge(mutableState.GetExecutionInfo().Priority, attributes.Priority), | ||
| inheritedAutoUpgradeInfo, | ||
|
|
@@ -1665,7 +1665,7 @@ func (t *transferQueueActiveTaskExecutor) startWorkflow( | |
| inheritedBuildId string, | ||
| userMetadata *sdkpb.UserMetadata, | ||
| shouldTerminateAndStartChild bool, | ||
| inheritedPinnedOverride *workflowpb.VersioningOverride, | ||
| inheritedVersioningOverride *workflowpb.VersioningOverride, | ||
| inheritedPinnedVersion *deploymentpb.WorkerDeploymentVersion, | ||
| priority *commonpb.Priority, | ||
| inheritedAutoUpgradeInfo *deploymentpb.InheritedAutoUpgradeInfo, | ||
|
|
@@ -1690,7 +1690,7 @@ func (t *transferQueueActiveTaskExecutor) startWorkflow( | |
| Memo: attributes.Memo, | ||
| SearchAttributes: attributes.SearchAttributes, | ||
| UserMetadata: userMetadata, | ||
| VersioningOverride: inheritedPinnedOverride, | ||
| VersioningOverride: inheritedVersioningOverride, | ||
| Priority: priority, | ||
| TimeSkippingConfig: attributes.GetTimeSkippingConfig(), | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed with @rkannan82 - i think we should add in a metric here since i am curious to see how many folks end up using this option; could be a good sign for us when we build the new move wrapper that we have in our minds