Skip to content

Commit 94708bf

Browse files
authored
[Worker Versioning GA]: Add autoUpgrade information inside of events (#665)
_**READ BEFORE MERGING:** All PRs require approval by both Server AND SDK teams before merging! This is why the number of required approvals is "2" and not "1"--two reviewers from the same team is NOT sufficient. If your PR is not approved by someone in BOTH teams, it may be summarily reverted._ <!-- Describe what has changed in this PR --> - Add InheritedAutoUpgradeInfo message and store it inside of StartWorkflowExecutionAttributes. <!-- Tell your future self why have you made these changes --> - So that replication, on the passive cluster, can also use the revision number mechanics and ensure that workflow tasks get dispatched to the correct worker. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** - Discussion to follow <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> - temporalio/temporal#8632
1 parent a22489c commit 94708bf

File tree

5 files changed

+96
-52
lines changed

5 files changed

+96
-52
lines changed

openapi/openapiv2.json

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12065,6 +12065,21 @@
1206512065
],
1206612066
"default": "INDEXED_VALUE_TYPE_UNSPECIFIED"
1206712067
},
12068+
"v1InheritedAutoUpgradeInfo": {
12069+
"type": "object",
12070+
"properties": {
12071+
"sourceDeploymentVersion": {
12072+
"$ref": "#/definitions/v1WorkerDeploymentVersion",
12073+
"description": "The source deployment version of the parent/previous workflow."
12074+
},
12075+
"sourceDeploymentRevisionNumber": {
12076+
"type": "string",
12077+
"format": "int64",
12078+
"description": "The revision number of the source deployment version of the parent/previous workflow."
12079+
}
12080+
},
12081+
"description": "Used as part of WorkflowExecutionStartedEventAttributes to pass down the AutoUpgrade behavior and source deployment version \nto a workflow execution whose parent/previous workflow has an AutoUpgrade behavior."
12082+
},
1206812083
"v1Input": {
1206912084
"type": "object",
1207012085
"properties": {
@@ -17194,7 +17209,11 @@
1719417209
},
1719517210
"inheritedPinnedVersion": {
1719617211
"$ref": "#/definitions/v1WorkerDeploymentVersion",
17197-
"description": "If present, the new workflow should start on this version with pinned base behavior.\nChild of pinned parent will inherit the parent's version if the Child's Task Queue belongs to that version.\n\nNew run initiated by workflow ContinueAsNew of pinned run, will inherit the previous run's version if the\nnew run's Task Queue belongs to that version.\n\nNew run initiated by workflow Cron will never inherit.\n\nNew run initiated by workflow Retry will only inherit if the retried run is effectively pinned at the time\nof retry, and the retried run inherited a pinned version when it started (ie. it is a child of a pinned\nparent, or a CaN of a pinned run, and is running on a Task Queue in the inherited version).\n\nPinned override is inherited if Task Queue of new run is compatible with the override version.\nOverride is inherited separately and takes precedence over inherited base version."
17212+
"description": "If present, the new workflow should start on this version with pinned base behavior.\nChild of pinned parent will inherit the parent's version if the Child's Task Queue belongs to that version.\n\nA new run initiated by workflow ContinueAsNew of pinned run, will inherit the previous run's version if the\nnew run's Task Queue belongs to that version.\n\nA new run initiated by workflow Cron will never inherit.\n\nA new run initiated by workflow Retry will only inherit if the retried run is effectively pinned at the time\nof retry, and the retried run inherited a pinned version when it started (ie. it is a child of a pinned\nparent, or a CaN of a pinned run, and is running on a Task Queue in the inherited version).\n\nPinned override is inherited if Task Queue of new run is compatible with the override version.\nOverride is inherited separately and takes precedence over inherited base version.\n\nNote: This field is mutually exclusive with inherited_auto_upgrade_info. \nAdditionaly, versioning_override, if present, overrides this field during routing decisions."
17213+
},
17214+
"inheritedAutoUpgradeInfo": {
17215+
"$ref": "#/definitions/v1InheritedAutoUpgradeInfo",
17216+
"description": "If present, the new workflow begins with AutoUpgrade behavior. Before dispatching the\nfirst workflow task, this field is set to the deployment version on which the parent/\nprevious run was operating. This inheritance only happens when the task queues belong to\nthe same deployment version. The first workflow task will then be dispatched to either\nthis inherited deployment version, or the current deployment version of the task queue's\nDeployment. After the first workflow task, the effective behavior depends on worker-sent\nvalues in subsequent workflow tasks.\n\nInheritance rules:\n - ContinueAsNew and child workflows: inherit AutoUpgrade behavior and deployment version\n - Cron: never inherits\n - Retry: inherits only if the retried run is effectively AutoUpgrade at the time of\n retry, and inherited AutoUpgrade behavior when it started (i.e. it is a child of an\n AutoUpgrade parent or ContinueAsNew of an AutoUpgrade run, running on the same\n deployment as the parent/previous run)\n\nAdditional notes: \n- This field is mutually exclusive with `inherited_pinned_version`. \n- `versioning_override`, if present, overrides this field during routing decisions.\n- SDK implementations do not interact with this field and is only used internally by \n the server to ensure task routing correctness."
1719817217
},
1719917218
"eagerExecutionAccepted": {
1720017219
"type": "boolean",
@@ -17349,7 +17368,7 @@
1734917368
"properties": {
1735017369
"behavior": {
1735117370
"$ref": "#/definitions/v1VersioningBehavior",
17352-
"description": "Versioning behavior determines how the server should treat this execution when workers are\nupgraded. When present it means this workflow execution is versioned; UNSPECIFIED means\nunversioned. See the comments in `VersioningBehavior` enum for more info about different\nbehaviors.\nThis field is first set after an execution completes its first workflow task on a versioned\nworker, and set again on completion of every subsequent workflow task.\nFor child workflows of Pinned parents, this will be set to Pinned (along with `deployment_version`) when\nthe the child starts so that child's first workflow task goes to the same Version as the\nparent. After the first workflow task, it depends on the child workflow itself if it wants\nto stay pinned or become unpinned (according to Versioning Behavior set in the worker).\nNote that `behavior` is overridden by `versioning_override` if the latter is present."
17371+
"description": "Versioning behavior determines how the server should treat this execution when workers are\nupgraded. When present it means this workflow execution is versioned; UNSPECIFIED means\nunversioned. See the comments in `VersioningBehavior` enum for more info about different\nbehaviors.\n\nChild workflows or CaN executions **inherit** their parent/previous run's effective Versioning \nBehavior and Version (except when the new execution runs on a task queue not belonging to the \nsame deployment version as the parent/previous run's task queue). The first workflow task will\nbe dispatched according to the inherited behavior (or to the current version of the task-queue's \ndeployment in the case of AutoUpgrade.) After completion of their first workflow task the \nDeployment Version and Behavior of the execution will update according to configuration on the worker.\n\nNote that `behavior` is overridden by `versioning_override` if the latter is present."
1735317372
},
1735417373
"deployment": {
1735517374
"$ref": "#/definitions/v1Deployment",
@@ -17361,7 +17380,7 @@
1736117380
},
1736217381
"deploymentVersion": {
1736317382
"$ref": "#/definitions/v1WorkerDeploymentVersion",
17364-
"description": "The Worker Deployment Version that completed the last workflow task of this workflow execution.\nAn absent value means no workflow task is completed, or the workflow is unversioned.\nIf present, and `behavior` is UNSPECIFIED, the last task of this workflow execution was completed\nby a worker that is not using versioning but _is_ passing Deployment Name and Build ID.\n\nFor child workflows of Pinned parents, this will be set to the parent's Pinned Version when\nthe child starts, so that the child's first workflow task goes to the same Version as the parent.\nNote that if `versioning_override.behavior` is PINNED then `versioning_override.pinned_version`\nwill override this value."
17383+
"description": "The Worker Deployment Version that completed the last workflow task of this workflow execution.\nAn absent value means no workflow task is completed, or the workflow is unversioned.\nIf present, and `behavior` is UNSPECIFIED, the last task of this workflow execution was completed\nby a worker that is not using versioning but _is_ passing Deployment Name and Build ID.\n\nChild workflows or CaN executions **inherit** their parent/previous run's effective Versioning \nBehavior and Version (except when the new execution runs on a task queue not belonging to the \nsame deployment version as the parent/previous run's task queue). The first workflow task will\nbe dispatched according to the inherited behavior (or to the current version of the task-queue's \ndeployment in the case of AutoUpgrade.) After completion of their first workflow task the \nDeployment Version and Behavior of the execution will update according to configuration on the worker.\n\nNote that if `versioning_override.behavior` is PINNED then `versioning_override.pinned_version`\nwill override this value."
1736517384
},
1736617385
"versioningOverride": {
1736717386
"$ref": "#/definitions/v1VersioningOverride",

openapi/openapiv3.yaml

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8918,6 +8918,17 @@ components:
89188918
description: |-
89198919
History events are the method by which Temporal SDKs advance (or recreate) workflow state.
89208920
See the `EventType` enum for more info about what each event is for.
8921+
InheritedAutoUpgradeInfo:
8922+
type: object
8923+
properties:
8924+
sourceDeploymentVersion:
8925+
allOf:
8926+
- $ref: '#/components/schemas/WorkerDeploymentVersion'
8927+
description: The source deployment version of the parent/previous workflow.
8928+
sourceDeploymentRevisionNumber:
8929+
type: string
8930+
description: The revision number of the source deployment version of the parent/previous workflow.
8931+
description: "Used as part of WorkflowExecutionStartedEventAttributes to pass down the AutoUpgrade behavior and source deployment version \n to a workflow execution whose parent/previous workflow has an AutoUpgrade behavior."
89218932
Input:
89228933
type: object
89238934
properties:
@@ -14694,21 +14705,11 @@ components:
1469414705
inheritedPinnedVersion:
1469514706
allOf:
1469614707
- $ref: '#/components/schemas/WorkerDeploymentVersion'
14697-
description: |-
14698-
If present, the new workflow should start on this version with pinned base behavior.
14699-
Child of pinned parent will inherit the parent's version if the Child's Task Queue belongs to that version.
14700-
14701-
New run initiated by workflow ContinueAsNew of pinned run, will inherit the previous run's version if the
14702-
new run's Task Queue belongs to that version.
14703-
14704-
New run initiated by workflow Cron will never inherit.
14705-
14706-
New run initiated by workflow Retry will only inherit if the retried run is effectively pinned at the time
14707-
of retry, and the retried run inherited a pinned version when it started (ie. it is a child of a pinned
14708-
parent, or a CaN of a pinned run, and is running on a Task Queue in the inherited version).
14709-
14710-
Pinned override is inherited if Task Queue of new run is compatible with the override version.
14711-
Override is inherited separately and takes precedence over inherited base version.
14708+
description: "If present, the new workflow should start on this version with pinned base behavior.\n Child of pinned parent will inherit the parent's version if the Child's Task Queue belongs to that version.\n\n A new run initiated by workflow ContinueAsNew of pinned run, will inherit the previous run's version if the\n new run's Task Queue belongs to that version.\n\n A new run initiated by workflow Cron will never inherit.\n\n A new run initiated by workflow Retry will only inherit if the retried run is effectively pinned at the time\n of retry, and the retried run inherited a pinned version when it started (ie. it is a child of a pinned\n parent, or a CaN of a pinned run, and is running on a Task Queue in the inherited version).\n\n Pinned override is inherited if Task Queue of new run is compatible with the override version.\n Override is inherited separately and takes precedence over inherited base version.\n\n Note: This field is mutually exclusive with inherited_auto_upgrade_info. \n Additionaly, versioning_override, if present, overrides this field during routing decisions."
14709+
inheritedAutoUpgradeInfo:
14710+
allOf:
14711+
- $ref: '#/components/schemas/InheritedAutoUpgradeInfo'
14712+
description: "If present, the new workflow begins with AutoUpgrade behavior. Before dispatching the\n first workflow task, this field is set to the deployment version on which the parent/\n previous run was operating. This inheritance only happens when the task queues belong to\n the same deployment version. The first workflow task will then be dispatched to either\n this inherited deployment version, or the current deployment version of the task queue's\n Deployment. After the first workflow task, the effective behavior depends on worker-sent\n values in subsequent workflow tasks.\n\n Inheritance rules:\n - ContinueAsNew and child workflows: inherit AutoUpgrade behavior and deployment version\n - Cron: never inherits\n - Retry: inherits only if the retried run is effectively AutoUpgrade at the time of\n retry, and inherited AutoUpgrade behavior when it started (i.e. it is a child of an\n AutoUpgrade parent or ContinueAsNew of an AutoUpgrade run, running on the same\n deployment as the parent/previous run)\n \n Additional notes: \n - This field is mutually exclusive with `inherited_pinned_version`. \n - `versioning_override`, if present, overrides this field during routing decisions.\n - SDK implementations do not interact with this field and is only used internally by \n the server to ensure task routing correctness."
1471214713
eagerExecutionAccepted:
1471314714
type: boolean
1471414715
description: |-
@@ -14841,18 +14842,7 @@ components:
1484114842
- VERSIONING_BEHAVIOR_PINNED
1484214843
- VERSIONING_BEHAVIOR_AUTO_UPGRADE
1484314844
type: string
14844-
description: |-
14845-
Versioning behavior determines how the server should treat this execution when workers are
14846-
upgraded. When present it means this workflow execution is versioned; UNSPECIFIED means
14847-
unversioned. See the comments in `VersioningBehavior` enum for more info about different
14848-
behaviors.
14849-
This field is first set after an execution completes its first workflow task on a versioned
14850-
worker, and set again on completion of every subsequent workflow task.
14851-
For child workflows of Pinned parents, this will be set to Pinned (along with `deployment_version`) when
14852-
the the child starts so that child's first workflow task goes to the same Version as the
14853-
parent. After the first workflow task, it depends on the child workflow itself if it wants
14854-
to stay pinned or become unpinned (according to Versioning Behavior set in the worker).
14855-
Note that `behavior` is overridden by `versioning_override` if the latter is present.
14845+
description: "Versioning behavior determines how the server should treat this execution when workers are\n upgraded. When present it means this workflow execution is versioned; UNSPECIFIED means\n unversioned. See the comments in `VersioningBehavior` enum for more info about different\n behaviors.\n\n Child workflows or CaN executions **inherit** their parent/previous run's effective Versioning \n Behavior and Version (except when the new execution runs on a task queue not belonging to the \n same deployment version as the parent/previous run's task queue). The first workflow task will\n be dispatched according to the inherited behavior (or to the current version of the task-queue's \n deployment in the case of AutoUpgrade.) After completion of their first workflow task the \n Deployment Version and Behavior of the execution will update according to configuration on the worker.\n \n Note that `behavior` is overridden by `versioning_override` if the latter is present."
1485614846
format: enum
1485714847
deployment:
1485814848
allOf:
@@ -14871,16 +14861,7 @@ components:
1487114861
deploymentVersion:
1487214862
allOf:
1487314863
- $ref: '#/components/schemas/WorkerDeploymentVersion'
14874-
description: |-
14875-
The Worker Deployment Version that completed the last workflow task of this workflow execution.
14876-
An absent value means no workflow task is completed, or the workflow is unversioned.
14877-
If present, and `behavior` is UNSPECIFIED, the last task of this workflow execution was completed
14878-
by a worker that is not using versioning but _is_ passing Deployment Name and Build ID.
14879-
14880-
For child workflows of Pinned parents, this will be set to the parent's Pinned Version when
14881-
the child starts, so that the child's first workflow task goes to the same Version as the parent.
14882-
Note that if `versioning_override.behavior` is PINNED then `versioning_override.pinned_version`
14883-
will override this value.
14864+
description: "The Worker Deployment Version that completed the last workflow task of this workflow execution.\n An absent value means no workflow task is completed, or the workflow is unversioned.\n If present, and `behavior` is UNSPECIFIED, the last task of this workflow execution was completed\n by a worker that is not using versioning but _is_ passing Deployment Name and Build ID.\n\n Child workflows or CaN executions **inherit** their parent/previous run's effective Versioning \n Behavior and Version (except when the new execution runs on a task queue not belonging to the \n same deployment version as the parent/previous run's task queue). The first workflow task will\n be dispatched according to the inherited behavior (or to the current version of the task-queue's \n deployment in the case of AutoUpgrade.) After completion of their first workflow task the \n Deployment Version and Behavior of the execution will update according to configuration on the worker.\n\n Note that if `versioning_override.behavior` is PINNED then `versioning_override.pinned_version`\n will override this value."
1488414865
versioningOverride:
1488514866
allOf:
1488614867
- $ref: '#/components/schemas/VersioningOverride'

temporal/api/deployment/v1/message.proto

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,12 @@ message RoutingConfig {
293293
// to any field of this message to achieve eventual consistency between task queues and their partitions.
294294
int64 revision_number = 10;
295295
}
296+
297+
// Used as part of WorkflowExecutionStartedEventAttributes to pass down the AutoUpgrade behavior and source deployment version
298+
// to a workflow execution whose parent/previous workflow has an AutoUpgrade behavior.
299+
message InheritedAutoUpgradeInfo {
300+
// The source deployment version of the parent/previous workflow.
301+
temporal.api.deployment.v1.WorkerDeploymentVersion source_deployment_version = 1;
302+
// The revision number of the source deployment version of the parent/previous workflow.
303+
int64 source_deployment_revision_number = 2;
304+
}

0 commit comments

Comments
 (0)