Skip to content

Commit 9263046

Browse files
carlydfSushisourceShahabT
authored
change Version to struct, prevent misconfiguration of VersioningOverride (#579)
_**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._ What changed? - Make override a one of and add different pinned override types. - Change version from string to struct - Make nil Version represent "send tasks away from versioned workers and to unversioned workers" Why? - To prevent misconfiguration and to expand the override definition to accommodate the new PinnedUntilContinueAsNew behaviors. - Using a string to represent structured data, whose subfields frequently need to be considered separately, is brittle and not good for anyone using it. Struct is better. - "unversioned version" is contradictory, and nil is a nice way to represent that the versioning story of a task queue is no longer in the control of the Deployment whose `RoutingConfig` you are reading. <!-- Are there any breaking changes on binary or code level? --> Variables are being deprecated, but the content of the code is not changing. The idea of "Unset Ramp" having a separate meaning from "0% Ramp" is removed. 0% ramp now is the only way to have "no ramp" / 100% of traffic going to Current Version. Nil `ramping_deployment_version` + non-zero `ramping_version_percentage` is the way to ramp traffic to unversioned workers. The SDK interface for this could look like: ``` deployment := client.GetHandle(deploymentName) // set current to a version deployment.SetCurrentVersion(buildId) -> current set to deploymentName/buildId deployment.UnsetCurrentVersion() -> current set to nil // set current to unversioned deployment.UnsetCurrentVersion() -> current set to nil deployment.SetRampingVersion(buildId, 50) -> ramp set to (deploymentName/buildId, 50) deployment.UnsetRampingVersion() -> ramp set to (nil, 0%) deployment.RampToUnversioned(50) -> set to (nil, 50%) ``` <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> **Server PR** --------- Co-authored-by: Spencer Judge <[email protected]> Co-authored-by: Shahab Tajik <[email protected]>
1 parent c765266 commit 9263046

File tree

8 files changed

+757
-272
lines changed

8 files changed

+757
-272
lines changed

openapi/openapiv2.json

Lines changed: 238 additions & 51 deletions
Large diffs are not rendered by default.

openapi/openapiv3.yaml

Lines changed: 305 additions & 97 deletions
Large diffs are not rendered by default.

temporal/api/deployment/v1/message.proto

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ message WorkerDeploymentOptions {
2121
// Required. Worker Deployment name.
2222
string deployment_name = 1;
2323
// The Build ID of the worker. Required when `worker_versioning_mode==VERSIONED`, in which case,
24-
// the worker will be part of a Deployment Version identified by "<deployment_name>.<build_id>".
24+
// the worker will be part of a Deployment Version.
2525
string build_id = 2;
2626
// Required. Versioning Mode for this worker. Must be the same for all workers with the
2727
// same `deployment_name` and `build_id` combination, across all Task Queues.
28-
// When `worker_versioning_mode==VERSIONED`, the worker will be part of a Deployment Version
29-
// identified by "<deployment_name>.<build_id>".
28+
// When `worker_versioning_mode==VERSIONED`, the worker will be part of a Deployment Version.
3029
temporal.api.enums.v1.WorkerVersioningMode worker_versioning_mode = 3;
3130
}
3231

@@ -95,8 +94,11 @@ message DeploymentListInfo {
9594
// their first poller arrives to the server.
9695
// Experimental. Worker Deployments are experimental and might significantly change in the future.
9796
message WorkerDeploymentVersionInfo {
98-
// The fully-qualified string representation of the version, in the form "<deployment_name>.<build_id>".
99-
string version = 1;
97+
// Deprecated. Use `deployment_version`.
98+
string version = 1 [deprecated = true];
99+
100+
// Required.
101+
WorkerDeploymentVersion deployment_version = 11;
100102
string deployment_name = 2;
101103
google.protobuf.Timestamp create_time = 3;
102104

@@ -185,40 +187,60 @@ message WorkerDeploymentInfo {
185187
string last_modifier_identity = 5;
186188

187189
message WorkerDeploymentVersionSummary {
188-
// The fully-qualified string representation of the version, in the form "<deployment_name>.<build_id>".
189-
string version = 1;
190+
// Deprecated. Use `deployment_version`.
191+
string version = 1 [deprecated = true];
192+
193+
// Required.
194+
WorkerDeploymentVersion deployment_version = 4;
190195
google.protobuf.Timestamp create_time = 2;
191196
enums.v1.VersionDrainageStatus drainage_status = 3;
192197
}
193198
}
194199

200+
// A Worker Deployment Version (Version, for short) represents a
201+
// version of workers within a Worker Deployment. (see documentation of WorkerDeploymentVersionInfo)
202+
// Version records are created in Temporal server automatically when their
203+
// first poller arrives to the server.
204+
// Experimental. Worker Deployment Versions are experimental and might significantly change in the future.
205+
message WorkerDeploymentVersion {
206+
// A unique identifier for this Version within the Deployment it is a part of.
207+
// Not necessarily unique within the namespace.
208+
// The combination of `deployment_name` and `build_id` uniquely identifies this
209+
// Version within the namespace, because Deployment names are unique within a namespace.
210+
string build_id = 1;
211+
212+
// Identifies the Worker Deployment this Version is part of.
213+
string deployment_name = 2;
214+
}
215+
195216
message VersionMetadata {
196217
// Arbitrary key-values.
197218
map<string, temporal.api.common.v1.Payload> entries = 1;
198219
}
199220

200221
message RoutingConfig {
201-
// Always present. Specifies which Deployment Version should should receive new workflow
202-
// executions and tasks of existing unversioned or AutoUpgrade workflows.
203-
// Can be one of the following:
204-
// - A Deployment Version identifier in the form "<deployment_name>.<build_id>".
205-
// - Or, the "__unversioned__" special value, to represent all the unversioned workers (those
206-
// with `UNVERSIONED` (or unspecified) `WorkerVersioningMode`.)
207-
// Note: Current Version is overridden by the Ramping Version for a portion of traffic when a ramp
208-
// is set (see `ramping_version`.)
209-
string current_version = 1;
210-
// When present, it means the traffic is being shifted from the Current Version to the Ramping
211-
// Version.
212-
// Must always be different from Current Version. Can be one of the following:
213-
// - A Deployment Version identifier in the form "<deployment_name>.<build_id>".
214-
// - Or, the "__unversioned__" special value, to represent all the unversioned workers (those
215-
// with `UNVERSIONED` (or unspecified) `WorkerVersioningMode`.)
222+
// Specifies which Deployment Version should receive new workflow executions and tasks of
223+
// existing unversioned or AutoUpgrade workflows.
224+
// Nil value means no Version in this Deployment (except Ramping Version, if present) receives traffic other than tasks of previously Pinned workflows. In absence of a Current Version, remaining traffic after any ramp (if set) goes to unversioned workers (those with `UNVERSIONED` (or unspecified) `WorkerVersioningMode`.).
225+
// Note: Current Version is overridden by the Ramping Version for a portion of traffic when ramp percentage
226+
// is non-zero (see `ramping_deployment_version` and `ramping_version_percentage`).
227+
temporal.api.deployment.v1.WorkerDeploymentVersion current_deployment_version = 7;
228+
// Deprecated. Use `current_deployment_version`.
229+
string current_version = 1 [deprecated = true];
230+
231+
// When ramp percentage is non-zero, that portion of traffic is shifted from the Current Version to the Ramping Version.
232+
// Must always be different from `current_deployment_version` unless both are nil.
233+
// Nil value represents all the unversioned workers (those with `UNVERSIONED` (or unspecified) `WorkerVersioningMode`.)
216234
// Note that it is possible to ramp from one Version to another Version, or from unversioned
217235
// workers to a particular Version, or from a particular Version to unversioned workers.
218-
string ramping_version = 2;
236+
temporal.api.deployment.v1.WorkerDeploymentVersion ramping_deployment_version = 9;
237+
// Deprecated. Use `ramping_deployment_version`.
238+
string ramping_version = 2 [deprecated = true];
239+
219240
// Percentage of tasks that are routed to the Ramping Version instead of the Current Version.
220241
// Valid range: [0, 100]. A 100% value means the Ramping Version is receiving full traffic but
221242
// not yet "promoted" to be the Current Version, likely due to pending validations.
243+
// A 0% value means the Ramping Version is receiving no traffic.
222244
float ramping_version_percentage = 3;
223245
// Last time current version was changed.
224246
google.protobuf.Timestamp current_version_changed_time = 4;

temporal/api/history/v1/message.proto

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,15 @@ message WorkflowExecutionStartedEventAttributes {
125125
// of starting on the Current Version of its Task Queue.
126126
// This is set only if the child workflow is starting on a Task Queue belonging to the same
127127
// Worker Deployment Version.
128-
string parent_pinned_worker_deployment_version = 34;
128+
// Deprecated. Use `parent_pinned_deployment_version`.
129+
string parent_pinned_worker_deployment_version = 34 [deprecated = true];
130+
131+
// When present, it means this is a child workflow of a parent that is Pinned to this Worker
132+
// Deployment Version. In this case, child workflow will start as Pinned to this Version instead
133+
// of starting on the Current Version of its Task Queue.
134+
// This is set only if the child workflow is starting on a Task Queue belonging to the same
135+
// Worker Deployment Version.
136+
temporal.api.deployment.v1.WorkerDeploymentVersion parent_pinned_deployment_version = 36;
129137

130138
// Priority metadata
131139
temporal.api.common.v1.Priority priority = 35;
@@ -216,11 +224,11 @@ message WorkflowTaskStartedEventAttributes {
216224
int64 history_size_bytes = 5;
217225
// Version info of the worker to whom this task was dispatched.
218226
// Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
219-
temporal.api.common.v1.WorkerVersionStamp worker_version = 6;
227+
temporal.api.common.v1.WorkerVersionStamp worker_version = 6 [deprecated = true];
220228
// Used by server internally to properly reapply build ID redirects to an execution
221229
// when rebuilding it from events.
222230
// Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
223-
int64 build_id_redirect_counter = 7;
231+
int64 build_id_redirect_counter = 7 [deprecated = true];
224232
}
225233

226234
message WorkflowTaskCompletedEventAttributes {
@@ -231,12 +239,13 @@ message WorkflowTaskCompletedEventAttributes {
231239
// Identity of the worker who completed this task
232240
string identity = 3;
233241
// Binary ID of the worker who completed this task
234-
string binary_checksum = 4;
242+
// Deprecated. Replaced with `deployment_version`.
243+
string binary_checksum = 4 [deprecated = true];
235244
// Version info of the worker who processed this workflow task. If present, the `build_id` field
236245
// within is also used as `binary_checksum`, which may be omitted in that case (it may also be
237246
// populated to preserve compatibility).
238-
// Deprecated. Use `deployment` and `versioning_behavior` instead.
239-
temporal.api.common.v1.WorkerVersionStamp worker_version = 5;
247+
// Deprecated. Use `deployment_version` and `versioning_behavior` instead.
248+
temporal.api.common.v1.WorkerVersionStamp worker_version = 5 [deprecated = true];
240249
// Data the SDK wishes to record for itself, but server need not interpret, and does not
241250
// directly impact workflow state.
242251
temporal.api.sdk.v1.WorkflowTaskCompletedMetadata sdk_metadata = 6;
@@ -247,7 +256,7 @@ message WorkflowTaskCompletedEventAttributes {
247256
// The deployment that completed this task. May or may not be set for unversioned workers,
248257
// depending on whether a value is sent by the SDK. This value updates workflow execution's
249258
// `versioning_info.deployment`.
250-
// Deprecated. Replaced with `worker_deployment_version`.
259+
// Deprecated. Replaced with `deployment_version`.
251260
temporal.api.deployment.v1.Deployment deployment = 7 [deprecated = true];
252261
// Versioning behavior sent by the worker that completed this task for this particular workflow
253262
// execution. UNSPECIFIED means the task was completed by an unversioned worker. This value
@@ -256,11 +265,16 @@ message WorkflowTaskCompletedEventAttributes {
256265
// The Worker Deployment Version that completed this task. Must be set if `versioning_behavior`
257266
// is set. This value updates workflow execution's `versioning_info.version`.
258267
// Experimental. Worker Deployments are experimental and might significantly change in the future.
259-
string worker_deployment_version = 9;
268+
// Deprecated. Replaced with `deployment_version`.
269+
string worker_deployment_version = 9 [deprecated = true];
260270
// The name of Worker Deployment that completed this task. Must be set if `versioning_behavior`
261271
// is set. This value updates workflow execution's `worker_deployment_name`.
262272
// Experimental. Worker Deployments are experimental and might significantly change in the future.
263273
string worker_deployment_name = 10;
274+
// The Worker Deployment Version that completed this task. Must be set if `versioning_behavior`
275+
// is set. This value updates workflow execution's `versioning_info.deployment_version`.
276+
// Experimental. Worker Deployments are experimental and might significantly change in the future.
277+
temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 11;
264278
}
265279

266280
message WorkflowTaskTimedOutEventAttributes {
@@ -287,14 +301,14 @@ message WorkflowTaskFailedEventAttributes {
287301
string new_run_id = 7;
288302
// TODO: ?
289303
int64 fork_event_version = 8;
290-
// DEPRECATED since 1.21 - use `worker_version` instead.
304+
// DEPRECATED since 1.21 - This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
291305
// If a worker explicitly failed this task, its binary id
292-
string binary_checksum = 9;
306+
string binary_checksum = 9 [deprecated = true];
293307
// Version info of the worker who processed this workflow task. If present, the `build_id` field
294308
// within is also used as `binary_checksum`, which may be omitted in that case (it may also be
295309
// populated to preserve compatibility).
296-
// Deprecated. Use the info inside the corresponding WorkflowTaskStartedEvent
297-
temporal.api.common.v1.WorkerVersionStamp worker_version = 10;
310+
// Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
311+
temporal.api.common.v1.WorkerVersionStamp worker_version = 10 [deprecated = true];
298312
}
299313

300314
message ActivityTaskScheduledEventAttributes {
@@ -337,7 +351,8 @@ message ActivityTaskScheduledEventAttributes {
337351
temporal.api.common.v1.RetryPolicy retry_policy = 12;
338352
// If this is set, the activity would be assigned to the Build ID of the workflow. Otherwise,
339353
// Assignment rules of the activity's Task Queue will be used to determine the Build ID.
340-
bool use_workflow_build_id = 13;
354+
// Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
355+
bool use_workflow_build_id = 13 [deprecated = true];
341356
// Priority metadata. If this message is not present, or any fields are not
342357
// present, they inherit the values from the workflow.
343358
temporal.api.common.v1.Priority priority = 14;
@@ -357,11 +372,11 @@ message ActivityTaskStartedEventAttributes {
357372
temporal.api.failure.v1.Failure last_failure = 5;
358373
// Version info of the worker to whom this task was dispatched.
359374
// Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
360-
temporal.api.common.v1.WorkerVersionStamp worker_version = 6;
375+
temporal.api.common.v1.WorkerVersionStamp worker_version = 6 [deprecated = true];
361376
// Used by server internally to properly reapply build ID redirects to an execution
362377
// when rebuilding it from events.
363378
// Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
364-
int64 build_id_redirect_counter = 7;
379+
int64 build_id_redirect_counter = 7 [deprecated = true];
365380
}
366381

367382
message ActivityTaskCompletedEventAttributes {
@@ -374,8 +389,8 @@ message ActivityTaskCompletedEventAttributes {
374389
// id of the worker that completed this task
375390
string identity = 4;
376391
// Version info of the worker who processed this workflow task.
377-
// Deprecated. Use the info inside the corresponding ActivityTaskStartedEvent
378-
temporal.api.common.v1.WorkerVersionStamp worker_version = 5;
392+
// Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
393+
temporal.api.common.v1.WorkerVersionStamp worker_version = 5 [deprecated = true];
379394
}
380395

381396
message ActivityTaskFailedEventAttributes {
@@ -389,8 +404,8 @@ message ActivityTaskFailedEventAttributes {
389404
string identity = 4;
390405
temporal.api.enums.v1.RetryState retry_state = 5;
391406
// Version info of the worker who processed this workflow task.
392-
// Deprecated. Use the info inside the corresponding ActivityTaskStartedEvent
393-
temporal.api.common.v1.WorkerVersionStamp worker_version = 6;
407+
// Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
408+
temporal.api.common.v1.WorkerVersionStamp worker_version = 6 [deprecated = true];
394409
}
395410

396411
message ActivityTaskTimedOutEventAttributes {
@@ -424,8 +439,8 @@ message ActivityTaskCanceledEventAttributes {
424439
// id of the worker who canceled this activity
425440
string identity = 5;
426441
// Version info of the worker who processed this workflow task.
427-
// Deprecated. Use the info inside the corresponding ActivityTaskStartedEvent
428-
temporal.api.common.v1.WorkerVersionStamp worker_version = 6;
442+
// Deprecated. This field should be cleaned up when versioning-2 API is removed. [cleanup-experimental-wv]
443+
temporal.api.common.v1.WorkerVersionStamp worker_version = 6 [deprecated = true];;
429444
}
430445

431446
message TimerStartedEventAttributes {

temporal/api/taskqueue/v1/message.proto

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,28 @@ message TaskQueueMetadata {
3535

3636
// Experimental. Worker Deployments are experimental and might significantly change in the future.
3737
message TaskQueueVersioningInfo {
38-
// Always present. Specifies which Deployment Version should receive new workflow
39-
// executions and tasks of existing unversioned or AutoUpgrade workflows.
40-
// Can be one of the following:
41-
// - A Deployment Version identifier in the form "<deployment_name>.<build_id>".
42-
// - Or, the "__unversioned__" special value, to represent all the unversioned workers (those
43-
// with `UNVERSIONED` (or unspecified) `WorkerVersioningMode`.)
44-
// Note: Current Version is overridden by the Ramping Version for a portion of traffic when a ramp
45-
// is set (see `ramping_version`.)
46-
string current_version = 1;
47-
// When present, it means the traffic is being shifted from the Current Version to the Ramping
48-
// Version.
49-
// Must always be different from `current_version`. Can be one of the following:
50-
// - A Deployment Version identifier in the form "<deployment_name>.<build_id>".
51-
// - Or, the "__unversioned__" special value, to represent all the unversioned workers (those
52-
// with `UNVERSIONED` (or unspecified) `WorkerVersioningMode`.)
38+
// Specifies which Deployment Version should receive new workflow executions and tasks of
39+
// existing unversioned or AutoUpgrade workflows.
40+
// Nil value represents all the unversioned workers (those with `UNVERSIONED` (or unspecified) `WorkerVersioningMode`.)
41+
// Note: Current Version is overridden by the Ramping Version for a portion of traffic when ramp percentage
42+
// is non-zero (see `ramping_deployment_version` and `ramping_version_percentage`).
43+
temporal.api.deployment.v1.WorkerDeploymentVersion current_deployment_version = 7;
44+
// Deprecated. Use `current_deployment_version`.
45+
string current_version = 1 [deprecated = true];
46+
47+
// When ramp percentage is non-zero, that portion of traffic is shifted from the Current Version to the Ramping Version.
48+
// Must always be different from `current_deployment_version` unless both are nil.
49+
// Nil value represents all the unversioned workers (those with `UNVERSIONED` (or unspecified) `WorkerVersioningMode`.)
5350
// Note that it is possible to ramp from one Version to another Version, or from unversioned
5451
// workers to a particular Version, or from a particular Version to unversioned workers.
55-
string ramping_version = 2;
52+
temporal.api.deployment.v1.WorkerDeploymentVersion ramping_deployment_version = 9;
53+
// Deprecated. Use `ramping_deployment_version`.
54+
string ramping_version = 2 [deprecated = true];
55+
5656
// Percentage of tasks that are routed to the Ramping Version instead of the Current Version.
5757
// Valid range: [0, 100]. A 100% value means the Ramping Version is receiving full traffic but
5858
// not yet "promoted" to be the Current Version, likely due to pending validations.
59+
// A 0% value means the Ramping Version is receiving no traffic.
5960
float ramping_version_percentage = 3;
6061
// Last time versioning information of this Task Queue changed.
6162
google.protobuf.Timestamp update_time = 4;

0 commit comments

Comments
 (0)