Skip to content

Commit 67150b1

Browse files
carlydfSushisource
andauthored
Add CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_USE_RAMPING_VERSION (#760)
<!-- Describe what has changed in this PR --> Add `CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_USE_RAMPING_VERSION` <!-- Tell your future self why have you made these changes --> To enable the use case of Continue-as-new-upgrading a user-specified cohort of Pinned workflows before any other workflows are upgraded. To do this, user would first set Ramp percentage to zero, then tell (likely via signal) their cohort of workflows to Continue-as-new with this initial behavior, watch that bake, repeat for whatever other cohorts are desired, and finally do a percentage-based ramp which applies to new workflows as well as workflows doing `CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE` <!-- Are there any breaking changes on binary or code level? --> No <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> Does not break the server --------- Co-authored-by: Spencer Judge <sjudge@hey.com>
1 parent 43b4618 commit 67150b1

5 files changed

Lines changed: 93 additions & 7 deletions

File tree

openapi/openapiv2.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12548,10 +12548,11 @@
1254812548
"type": "string",
1254912549
"enum": [
1255012550
"CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_UNSPECIFIED",
12551-
"CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE"
12551+
"CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE",
12552+
"CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_USE_RAMPING_VERSION"
1255212553
],
1255312554
"default": "CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_UNSPECIFIED",
12554-
"description": "Experimental. Defines the versioning behavior to be used by the first task of a new workflow run in a continue-as-new chain.\n\n - CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE: Start the new run with AutoUpgrade behavior. Use the Target Version of the workflow's task queue at\nstart-time, as AutoUpgrade workflows do. After the first workflow task completes, use whatever\nVersioning Behavior the workflow is annotated with in the workflow code.\n\nNote that if the previous workflow had a Pinned override, that override will be inherited by the\nnew workflow run regardless of the ContinueAsNewVersioningBehavior specified in the continue-as-new\ncommand. If a Pinned override is inherited by the new run, and the new run starts with AutoUpgrade\nbehavior, the base version of the new run will be the Target Version as described above, but the\neffective version will be whatever is specified by the Versioning Override until the override is removed."
12555+
"description": "Experimental. Defines the versioning behavior to be used by the first task of a new workflow run in a continue-as-new chain.\n\n - CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE: Experimental.\nStart the new run with AutoUpgrade behavior. Use the Target Version of the workflow's task queue at\nstart-time, as AutoUpgrade workflows do. After the first workflow task completes, use whatever\nVersioning Behavior the workflow is annotated with in the workflow code.\n\nNote that if the workflow being continued has a Pinned override, that override will be inherited by the\nnew workflow run regardless of the ContinueAsNewVersioningBehavior specified in the continue-as-new\ncommand. Versioning Override always takes precedence until it's removed manually via UpdateWorkflowExecutionOptions.\n - CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_USE_RAMPING_VERSION: Experimental.\nUse the Ramping Version of the workflow's task queue at start time, regardless of the workflow's\nTarget Version (according to f(workflow_id, ramp_percentage)). After the first workflow task completes,\nthe workflow will use whatever Versioning Behavior it is annotated with. If there is no Ramping\nVersion by the time that the first workflow task is dispatched, it will be sent to the Current Version.\n\nIt is highly discouraged to use this if the workflow is annotated with AutoUpgrade behavior, because\nthis setting ONLY applies to the first task of the workflow. If, after the first task, the workflow\nis AutoUpgrade, it will behave like a normal AutoUpgrade workflow and go to the Target Version, which\nmay be the Current Version instead of the Ramping Version.\n\nNote that if the workflow being continued has a Pinned override, that override will be inherited by the\nnew workflow run regardless of the ContinueAsNewVersioningBehavior specified in the continue-as-new\ncommand. Versioning Override always takes precedence until it's removed manually via UpdateWorkflowExecutionOptions."
1255512556
},
1255612557
"v1CountActivityExecutionsResponse": {
1255712558
"type": "object",
@@ -13906,9 +13907,13 @@
1390613907
"type": "string",
1390713908
"format": "int64",
1390813909
"description": "The revision number of the source deployment version of the parent/previous workflow."
13910+
},
13911+
"continueAsNewInitialVersioningBehavior": {
13912+
"$ref": "#/definitions/v1ContinueAsNewVersioningBehavior",
13913+
"description": "Experimental.\nIf this workflow is the result of a continue-as-new, this field is set to the initial_versioning_behavior\nspecified in that command.\nOnly used for the initial task of this run and the initial task of any retries of this run.\nNot passed to children or to future continue-as-new.\n\nNote: In the first release of Upgrade-on-CaN, when the only ContinueAsNewVersioningBehavior was AutoUpgrade,\na non-empty InheritedAutoUpgradeInfo meant that the workflow should start as AutoUpgrade. So for compatibility\nwith history events generated during that time, know that an UNSPECIFIED value here is equivalent to AutoUpgrade\nvalue if the InheritedAutoUpgradeInfo is non-empty."
1390913914
}
1391013915
},
13911-
"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."
13916+
"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.\nAlso used for Upgrade-on-CaN behaviors AutoUpgrade and UseRampingVersion."
1391213917
},
1391313918
"v1Input": {
1391413919
"type": "object",
@@ -18698,6 +18703,10 @@
1869818703
"type": "string",
1869918704
"format": "int64",
1870018705
"description": "Monotonic counter reflecting the latest routing decision for this workflow execution.\nUsed for staleness detection between history and matching when dispatching tasks to workers.\nIncremented when a workflow execution routes to a new deployment version, which happens\nwhen a worker of the new deployment version completes a workflow task.\nNote: Pinned tasks and sticky tasks send a value of 0 for this field since these tasks do not\nface the problem of inconsistent dispatching that arises from eventual consistency between\ntask queues and their partitions."
18706+
},
18707+
"continueAsNewInitialVersioningBehavior": {
18708+
"$ref": "#/definitions/v1ContinueAsNewVersioningBehavior",
18709+
"description": "Experimental.\nIf this workflow is the result of a continue-as-new, this field is set to the initial_versioning_behavior\nspecified in that command.\nOnly used for the initial task of this run and the initial task of any retries of this run.\nNot passed to children or to future continue-as-new.\n\nNote: In the first release of Upgrade-on-CaN, when the only ContinueAsNewVersioningBehavior was AutoUpgrade,\na non-empty InheritedAutoUpgradeInfo meant that the workflow should start as AutoUpgrade. So for compatibility\nwith ContinueAsNew history commands generated during that time, know that an UNSPECIFIED value here is equivalent\nto ContinueAsNewVersioningBehaviorAutoUpgrade if the behavior of the workflow is AutoUpgrade."
1870118710
}
1870218711
},
1870318712
"description": "Holds all the information about worker versioning for a particular workflow execution.\nExperimental. Versioning info is experimental and might change in the future."

openapi/openapiv3.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10868,9 +10868,28 @@ components:
1086810868
sourceDeploymentRevisionNumber:
1086910869
type: string
1087010870
description: The revision number of the source deployment version of the parent/previous workflow.
10871+
continueAsNewInitialVersioningBehavior:
10872+
enum:
10873+
- CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_UNSPECIFIED
10874+
- CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE
10875+
- CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_USE_RAMPING_VERSION
10876+
type: string
10877+
description: |-
10878+
Experimental.
10879+
If this workflow is the result of a continue-as-new, this field is set to the initial_versioning_behavior
10880+
specified in that command.
10881+
Only used for the initial task of this run and the initial task of any retries of this run.
10882+
Not passed to children or to future continue-as-new.
10883+
10884+
Note: In the first release of Upgrade-on-CaN, when the only ContinueAsNewVersioningBehavior was AutoUpgrade,
10885+
a non-empty InheritedAutoUpgradeInfo meant that the workflow should start as AutoUpgrade. So for compatibility
10886+
with history events generated during that time, know that an UNSPECIFIED value here is equivalent to AutoUpgrade
10887+
value if the InheritedAutoUpgradeInfo is non-empty.
10888+
format: enum
1087110889
description: |-
1087210890
Used as part of WorkflowExecutionStartedEventAttributes to pass down the AutoUpgrade behavior and source deployment version
1087310891
to a workflow execution whose parent/previous workflow has an AutoUpgrade behavior.
10892+
Also used for Upgrade-on-CaN behaviors AutoUpgrade and UseRampingVersion.
1087410893
Input:
1087510894
type: object
1087610895
properties:
@@ -16764,6 +16783,7 @@ components:
1676416783
enum:
1676516784
- CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_UNSPECIFIED
1676616785
- CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE
16786+
- CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_USE_RAMPING_VERSION
1676716787
type: string
1676816788
description: |-
1676916789
Experimental. Optionally decide the versioning behavior that the first task of the new run should use.
@@ -17538,6 +17558,24 @@ components:
1753817558
Note: Pinned tasks and sticky tasks send a value of 0 for this field since these tasks do not
1753917559
face the problem of inconsistent dispatching that arises from eventual consistency between
1754017560
task queues and their partitions.
17561+
continueAsNewInitialVersioningBehavior:
17562+
enum:
17563+
- CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_UNSPECIFIED
17564+
- CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE
17565+
- CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_USE_RAMPING_VERSION
17566+
type: string
17567+
description: |-
17568+
Experimental.
17569+
If this workflow is the result of a continue-as-new, this field is set to the initial_versioning_behavior
17570+
specified in that command.
17571+
Only used for the initial task of this run and the initial task of any retries of this run.
17572+
Not passed to children or to future continue-as-new.
17573+
17574+
Note: In the first release of Upgrade-on-CaN, when the only ContinueAsNewVersioningBehavior was AutoUpgrade,
17575+
a non-empty InheritedAutoUpgradeInfo meant that the workflow should start as AutoUpgrade. So for compatibility
17576+
with ContinueAsNew history commands generated during that time, know that an UNSPECIFIED value here is equivalent
17577+
to ContinueAsNewVersioningBehaviorAutoUpgrade if the behavior of the workflow is AutoUpgrade.
17578+
format: enum
1754117579
description: |-
1754217580
Holds all the information about worker versioning for a particular workflow execution.
1754317581
Experimental. Versioning info is experimental and might change in the future.

temporal/api/deployment/v1/message.proto

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ option csharp_namespace = "Temporalio.Api.Deployment.V1";
1111

1212
import "google/protobuf/timestamp.proto";
1313

14+
import "temporal/api/enums/v1/workflow.proto";
1415
import "temporal/api/enums/v1/deployment.proto";
1516
import "temporal/api/enums/v1/task_queue.proto";
1617
import "temporal/api/common/v1/message.proto";
@@ -316,9 +317,21 @@ message RoutingConfig {
316317

317318
// Used as part of WorkflowExecutionStartedEventAttributes to pass down the AutoUpgrade behavior and source deployment version
318319
// to a workflow execution whose parent/previous workflow has an AutoUpgrade behavior.
320+
// Also used for Upgrade-on-CaN behaviors AutoUpgrade and UseRampingVersion.
319321
message InheritedAutoUpgradeInfo {
320322
// The source deployment version of the parent/previous workflow.
321323
temporal.api.deployment.v1.WorkerDeploymentVersion source_deployment_version = 1;
322324
// The revision number of the source deployment version of the parent/previous workflow.
323325
int64 source_deployment_revision_number = 2;
326+
// Experimental.
327+
// If this workflow is the result of a continue-as-new, this field is set to the initial_versioning_behavior
328+
// specified in that command.
329+
// Only used for the initial task of this run and the initial task of any retries of this run.
330+
// Not passed to children or to future continue-as-new.
331+
//
332+
// Note: In the first release of Upgrade-on-CaN, when the only ContinueAsNewVersioningBehavior was AutoUpgrade,
333+
// a non-empty InheritedAutoUpgradeInfo meant that the workflow should start as AutoUpgrade. So for compatibility
334+
// with history events generated during that time, know that an UNSPECIFIED value here is equivalent to AutoUpgrade
335+
// value if the InheritedAutoUpgradeInfo is non-empty.
336+
temporal.api.enums.v1.ContinueAsNewVersioningBehavior continue_as_new_initial_versioning_behavior = 3;
324337
}

temporal/api/enums/v1/workflow.proto

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,31 @@ enum VersioningBehavior {
178178
enum ContinueAsNewVersioningBehavior {
179179
CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_UNSPECIFIED = 0;
180180

181+
// Experimental.
181182
// Start the new run with AutoUpgrade behavior. Use the Target Version of the workflow's task queue at
182183
// start-time, as AutoUpgrade workflows do. After the first workflow task completes, use whatever
183184
// Versioning Behavior the workflow is annotated with in the workflow code.
184185
//
185-
// Note that if the previous workflow had a Pinned override, that override will be inherited by the
186+
// Note that if the workflow being continued has a Pinned override, that override will be inherited by the
186187
// new workflow run regardless of the ContinueAsNewVersioningBehavior specified in the continue-as-new
187-
// command. If a Pinned override is inherited by the new run, and the new run starts with AutoUpgrade
188-
// behavior, the base version of the new run will be the Target Version as described above, but the
189-
// effective version will be whatever is specified by the Versioning Override until the override is removed.
188+
// command. Versioning Override always takes precedence until it's removed manually via UpdateWorkflowExecutionOptions.
190189
CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE = 1;
190+
191+
// Experimental.
192+
// Use the Ramping Version of the workflow's task queue at start time, regardless of the workflow's
193+
// Target Version (according to f(workflow_id, ramp_percentage)). After the first workflow task completes,
194+
// the workflow will use whatever Versioning Behavior it is annotated with. If there is no Ramping
195+
// Version by the time that the first workflow task is dispatched, it will be sent to the Current Version.
196+
//
197+
// It is highly discouraged to use this if the workflow is annotated with AutoUpgrade behavior, because
198+
// this setting ONLY applies to the first task of the workflow. If, after the first task, the workflow
199+
// is AutoUpgrade, it will behave like a normal AutoUpgrade workflow and go to the Target Version, which
200+
// may be the Current Version instead of the Ramping Version.
201+
//
202+
// Note that if the workflow being continued has a Pinned override, that override will be inherited by the
203+
// new workflow run regardless of the ContinueAsNewVersioningBehavior specified in the continue-as-new
204+
// command. Versioning Override always takes precedence until it's removed manually via UpdateWorkflowExecutionOptions.
205+
CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_USE_RAMPING_VERSION = 2;
191206
}
192207

193208
// SuggestContinueAsNewReason specifies why SuggestContinueAsNew is true.

temporal/api/workflow/v1/message.proto

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,17 @@ message WorkflowExecutionVersioningInfo {
231231
// face the problem of inconsistent dispatching that arises from eventual consistency between
232232
// task queues and their partitions.
233233
int64 revision_number = 8;
234+
// Experimental.
235+
// If this workflow is the result of a continue-as-new, this field is set to the initial_versioning_behavior
236+
// specified in that command.
237+
// Only used for the initial task of this run and the initial task of any retries of this run.
238+
// Not passed to children or to future continue-as-new.
239+
//
240+
// Note: In the first release of Upgrade-on-CaN, when the only ContinueAsNewVersioningBehavior was AutoUpgrade,
241+
// a non-empty InheritedAutoUpgradeInfo meant that the workflow should start as AutoUpgrade. So for compatibility
242+
// with ContinueAsNew history commands generated during that time, know that an UNSPECIFIED value here is equivalent
243+
// to ContinueAsNewVersioningBehaviorAutoUpgrade if the behavior of the workflow is AutoUpgrade.
244+
temporal.api.enums.v1.ContinueAsNewVersioningBehavior continue_as_new_initial_versioning_behavior = 9;
234245
}
235246

236247
// Holds information about ongoing transition of a workflow execution from one deployment to another.

0 commit comments

Comments
 (0)