Skip to content

Commit 060dbc3

Browse files
Shivs11carlydf
andauthored
WorkerDeployments becoming async in nature. (#647)
_**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 --> **What changed?** - Added a monotonically increasing counter which shall be used by the history service when scheduling workflow/activity tasks. - Add an enum in the RoutingConfig which shall convey the routing config propagation status. This shall allow users to have a peek at the exact stage where an update, scheduled by a worker-versioning write API, has reached. <!-- Tell your future self why have you made these changes --> **Why?** - The main purpose of this is to resolve out-of-sync history and matching partitions when it comes to deciding how to route tasks <!-- Are there any breaking changes on binary or code level? --> None, just new fields and enums, no new APIs <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> **Server PR** temporalio/temporal#8570 --------- Co-authored-by: Carly de Frondeville <[email protected]>
1 parent d674607 commit 060dbc3

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

openapi/openapiv2.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14114,9 +14114,24 @@
1411414114
"type": "string",
1411514115
"format": "date-time",
1411614116
"description": "Last time ramping version percentage was changed.\nIf ramping version is changed, this is also updated, even if the percentage stays the same."
14117+
},
14118+
"revisionNumber": {
14119+
"type": "string",
14120+
"format": "int64",
14121+
"description": "Monotonically increasing value which is incremented on every mutation \nto any field of this message to achieve eventual consistency between task queues and their partitions."
1411714122
}
1411814123
}
1411914124
},
14125+
"v1RoutingConfigUpdateState": {
14126+
"type": "string",
14127+
"enum": [
14128+
"ROUTING_CONFIG_UPDATE_STATE_UNSPECIFIED",
14129+
"ROUTING_CONFIG_UPDATE_STATE_IN_PROGRESS",
14130+
"ROUTING_CONFIG_UPDATE_STATE_COMPLETED"
14131+
],
14132+
"default": "ROUTING_CONFIG_UPDATE_STATE_UNSPECIFIED",
14133+
"description": "Indicates whether a change to the Routing Config has been\npropagated to all relevant Task Queues and their partitions.\n\n - ROUTING_CONFIG_UPDATE_STATE_IN_PROGRESS: Update to the RoutingConfig is currently in progress.\n - ROUTING_CONFIG_UPDATE_STATE_COMPLETED: Update to the RoutingConfig has completed successfully."
14134+
},
1412014135
"v1ScanWorkflowExecutionsResponse": {
1412114136
"type": "object",
1412214137
"properties": {
@@ -16092,6 +16107,10 @@
1609216107
"managerIdentity": {
1609316108
"type": "string",
1609416109
"description": "Identity of the client that has the exclusive right to make changes to this Worker Deployment.\nEmpty by default.\nIf this is set, clients whose identity does not match `manager_identity` will not be able to make changes\nto this Worker Deployment. They can either set their own identity as the manager or unset the field to proceed."
16110+
},
16111+
"routingConfigUpdateState": {
16112+
"$ref": "#/definitions/v1RoutingConfigUpdateState",
16113+
"description": "Indicates whether the routing_config has been fully propagated to all\nrelevant task queues and their partitions."
1609516114
}
1609616115
},
1609716116
"description": "A Worker Deployment (Deployment, for short) represents all workers serving \na shared set of Task Queues. Typically, a Deployment represents one service or \napplication.\nA Deployment contains multiple Deployment Versions, each representing a different \nversion of workers. (see documentation of WorkerDeploymentVersionInfo)\nDeployment records are created in Temporal server automatically when their\nfirst poller arrives to the server.\nExperimental. Worker Deployments are experimental and might significantly change in the future."
@@ -17143,6 +17162,11 @@
1714317162
"versionTransition": {
1714417163
"$ref": "#/definitions/v1DeploymentVersionTransition",
1714517164
"description": "When present, indicates the workflow is transitioning to a different deployment version\n(which may belong to the same deployment name or another). Can indicate one of the following\ntransitions: unversioned -> versioned, versioned -> versioned\non a different deployment version, or versioned -> unversioned.\nNot applicable to workflows with PINNED behavior.\nWhen a workflow with AUTO_UPGRADE behavior creates a new workflow task, it will automatically\nstart a transition to the task queue's current version if the task queue's current version is\ndifferent from the workflow's current deployment version.\nIf the AUTO_UPGRADE workflow is stuck due to backlogged activity or workflow tasks, those\ntasks will be redirected to the task queue's current version. As soon as a poller from\nthat deployment version is available to receive the task, the workflow will automatically\nstart a transition to that version and continue execution there.\nA version transition can only exist while there is a pending or started workflow task.\nOnce the pending workflow task completes on the transition's target version, the\ntransition completes and the workflow's `behavior`, and `deployment_version` fields are updated per the\nworker's task completion response.\nPending activities will not start new attempts during a transition. Once the transition is\ncompleted, pending activities will start their next attempt on the new version."
17165+
},
17166+
"revisionNumber": {
17167+
"type": "string",
17168+
"format": "int64",
17169+
"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."
1714617170
}
1714717171
},
1714817172
"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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11071,6 +11071,9 @@ components:
1107111071
Last time ramping version percentage was changed.
1107211072
If ramping version is changed, this is also updated, even if the percentage stays the same.
1107311073
format: date-time
11074+
revisionNumber:
11075+
type: string
11076+
description: "Monotonically increasing value which is incremented on every mutation \n to any field of this message to achieve eventual consistency between task queues and their partitions."
1107411077
Schedule:
1107511078
type: object
1107611079
properties:
@@ -13347,6 +13350,16 @@ components:
1334713350
Empty by default.
1334813351
If this is set, clients whose identity does not match `manager_identity` will not be able to make changes
1334913352
to this Worker Deployment. They can either set their own identity as the manager or unset the field to proceed.
13353+
routingConfigUpdateState:
13354+
enum:
13355+
- ROUTING_CONFIG_UPDATE_STATE_UNSPECIFIED
13356+
- ROUTING_CONFIG_UPDATE_STATE_IN_PROGRESS
13357+
- ROUTING_CONFIG_UPDATE_STATE_COMPLETED
13358+
type: string
13359+
description: |-
13360+
Indicates whether the routing_config has been fully propagated to all
13361+
relevant task queues and their partitions.
13362+
format: enum
1335013363
description: "A Worker Deployment (Deployment, for short) represents all workers serving \n a shared set of Task Queues. Typically, a Deployment represents one service or \n application.\n A Deployment contains multiple Deployment Versions, each representing a different \n version of workers. (see documentation of WorkerDeploymentVersionInfo)\n Deployment records are created in Temporal server automatically when their\n first poller arrives to the server.\n Experimental. Worker Deployments are experimental and might significantly change in the future."
1335113364
WorkerDeploymentInfo_WorkerDeploymentVersionSummary:
1335213365
type: object
@@ -14686,6 +14699,9 @@ components:
1468614699
worker's task completion response.
1468714700
Pending activities will not start new attempts during a transition. Once the transition is
1468814701
completed, pending activities will start their next attempt on the new version.
14702+
revisionNumber:
14703+
type: string
14704+
description: "Monotonic counter reflecting the latest routing decision for this workflow execution.\n Used for staleness detection between history and matching when dispatching tasks to workers.\n Incremented when a workflow execution routes to a new deployment version, which happens \n when a worker of the new deployment version completes a workflow task.\n Note: Pinned tasks and sticky tasks send a value of 0 for this field since these tasks do not\n face the problem of inconsistent dispatching that arises from eventual consistency between \n task queues and their partitions."
1468914705
description: |-
1469014706
Holds all the information about worker versioning for a particular workflow execution.
1469114707
Experimental. Versioning info is experimental and might change in the future.

temporal/api/deployment/v1/message.proto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ message WorkerDeploymentInfo {
201201
// to this Worker Deployment. They can either set their own identity as the manager or unset the field to proceed.
202202
string manager_identity = 6;
203203

204+
// Indicates whether the routing_config has been fully propagated to all
205+
// relevant task queues and their partitions.
206+
temporal.api.enums.v1.RoutingConfigUpdateState routing_config_update_state = 7;
207+
204208
message WorkerDeploymentVersionSummary {
205209
// Deprecated. Use `deployment_version`.
206210
string version = 1 [deprecated = true];
@@ -285,4 +289,7 @@ message RoutingConfig {
285289
// Last time ramping version percentage was changed.
286290
// If ramping version is changed, this is also updated, even if the percentage stays the same.
287291
google.protobuf.Timestamp ramping_version_percentage_changed_time = 6;
292+
// Monotonically increasing value which is incremented on every mutation
293+
// to any field of this message to achieve eventual consistency between task queues and their partitions.
294+
int64 revision_number = 10;
288295
}

temporal/api/enums/v1/task_queue.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,13 @@ enum RateLimitSource {
100100
// The value was set as the system default.
101101
RATE_LIMIT_SOURCE_SYSTEM = 3;
102102
}
103+
104+
// Indicates whether a change to the Routing Config has been
105+
// propagated to all relevant Task Queues and their partitions.
106+
enum RoutingConfigUpdateState {
107+
ROUTING_CONFIG_UPDATE_STATE_UNSPECIFIED = 0;
108+
// Update to the RoutingConfig is currently in progress.
109+
ROUTING_CONFIG_UPDATE_STATE_IN_PROGRESS = 1;
110+
// Update to the RoutingConfig has completed successfully.
111+
ROUTING_CONFIG_UPDATE_STATE_COMPLETED = 2;
112+
}

temporal/api/workflow/v1/message.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ message WorkflowExecutionVersioningInfo {
208208
// Pending activities will not start new attempts during a transition. Once the transition is
209209
// completed, pending activities will start their next attempt on the new version.
210210
DeploymentVersionTransition version_transition = 6;
211+
// Monotonic counter reflecting the latest routing decision for this workflow execution.
212+
// Used for staleness detection between history and matching when dispatching tasks to workers.
213+
// Incremented when a workflow execution routes to a new deployment version, which happens
214+
// when a worker of the new deployment version completes a workflow task.
215+
// Note: Pinned tasks and sticky tasks send a value of 0 for this field since these tasks do not
216+
// face the problem of inconsistent dispatching that arises from eventual consistency between
217+
// task queues and their partitions.
218+
int64 revision_number = 8;
211219
}
212220

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

0 commit comments

Comments
 (0)