Skip to content

Commit

Permalink
Versioning History <-> Matching protos (#6874)
Browse files Browse the repository at this point in the history
## What changed?
<!-- Describe what has changed in this PR -->
Add versioning v3 fields to the internal APIs between History and
Matching so they can send needed info when tasks are scheduled or
started.

## Why?
<!-- Tell your future self why have you made these changes -->

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
  • Loading branch information
ShahabT authored and dnr committed Nov 26, 2024
1 parent dd10149 commit daa0082
Show file tree
Hide file tree
Showing 9 changed files with 2,727 additions and 2,591 deletions.
4,936 changes: 2,503 additions & 2,433 deletions api/historyservice/v1/request_response.pb.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions api/matchingservice/v1/request_response.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion api/persistence/v1/tasks.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

332 changes: 186 additions & 146 deletions api/taskqueue/v1/message.pb.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ message DeploymentLocalState {
map<string, TaskQueueFamilyInfo> task_queue_families = 2;
bool is_current = 3;
google.protobuf.Timestamp create_time = 4;
map<string, temporal.api.common.v1.Payload> metadata = 5;
map<string, temporal.api.common.v1.Payload> metadata = 5;

message TaskQueueFamilyInfo {
// key: taskQueueType, val: TaskQueueInfo
map<int32,TaskQueueInfo> task_queues = 1;
Expand Down Expand Up @@ -75,4 +75,4 @@ message DeploymentWorkflowMemo {
temporal.api.deployment.v1.Deployment deployment = 1;
google.protobuf.Timestamp create_time = 2;
bool is_current_deployment = 3;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

import "temporal/api/activity/v1/message.proto";
import "temporal/api/deployment/v1/message.proto";
import "temporal/api/common/v1/message.proto";
import "temporal/api/history/v1/message.proto";
import "temporal/api/taskqueue/v1/message.proto";
Expand Down Expand Up @@ -155,6 +156,7 @@ message GetMutableStateResponse {
string assigned_build_id = 22;
string inherited_build_id = 23;
repeated temporal.server.api.persistence.v1.VersionedTransition transition_history = 24;
temporal.api.workflow.v1.WorkflowExecutionVersioningInfo versioning_info = 25;
}

message PollMutableStateRequest {
Expand Down Expand Up @@ -238,6 +240,10 @@ message RecordWorkflowTaskStartedRequest {
temporal.api.workflowservice.v1.PollWorkflowTaskQueueRequest poll_request = 6;
temporal.server.api.clock.v1.VectorClock clock = 7;
temporal.server.api.taskqueue.v1.BuildIdRedirectInfo build_id_redirect_info = 8;
// Presence of this value means matching has redirected the task to a deployment other than
// the directive deployment that History passed when scheduling the task.
temporal.api.deployment.v1.Deployment directive_deployment = 9;

}

message RecordWorkflowTaskStartedResponse {
Expand Down Expand Up @@ -274,6 +280,13 @@ message RecordActivityTaskStartedRequest {
temporal.api.workflowservice.v1.PollActivityTaskQueueRequest poll_request = 6;
temporal.server.api.clock.v1.VectorClock clock = 7;
temporal.server.api.taskqueue.v1.BuildIdRedirectInfo build_id_redirect_info = 8;
// Presence of this value means matching has redirected the task to a deployment other than
// the directive deployment that History passed when scheduling the task.
temporal.api.deployment.v1.Deployment directive_deployment = 9;
// Whether the directive deployment contains the activity's task queue. Used by History to
// determine if the activity redirect should affect the workflow.
// Only set if `directive_deployment` is set (i.e. the task is redirected).
bool directive_deployment_contains_task_queue = 10;
}

message RecordActivityTaskStartedResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ message AddWorkflowTaskRequest {

message AddWorkflowTaskResponse {
// When present, it means that the task is spooled to a versioned queue of this build ID
// Deprecated. [cleanup-old-wv]
string assigned_build_id = 1;
}

Expand All @@ -145,6 +146,7 @@ message AddActivityTaskRequest {

message AddActivityTaskResponse {
// When present, it means that the task is spooled to a versioned queue of this build ID
// Deprecated. [cleanup-old-wv]
string assigned_build_id = 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ message TaskInfo {
temporal.server.api.clock.v1.VectorClock clock = 7;
// How this task should be directed. (Missing means the default for
// TaskVersionDirective, which is unversioned.)
// Deprecated. No need to store this for new versioning [cleanup-old-wv]
temporal.server.api.taskqueue.v1.TaskVersionDirective version_directive = 8;
}

Expand Down
25 changes: 18 additions & 7 deletions proto/internal/temporal/server/api/taskqueue/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ option go_package = "go.temporal.io/server/api/taskqueue/v1;taskqueue";

import "google/protobuf/empty.proto";

import "temporal/api/taskqueue/v1/message.proto";
import "temporal/api/deployment/v1/message.proto";
import "temporal/api/enums/v1/task_queue.proto";
import "temporal/api/enums/v1/workflow.proto";
import "temporal/api/taskqueue/v1/message.proto";
import "temporal/server/api/enums/v1/task.proto";

// TaskVersionDirective controls how matching should direct a task.
Expand All @@ -48,6 +50,11 @@ message TaskVersionDirective {
// containing this build ID. [cleanup-old-wv]
string assigned_build_id = 2;
}

// Workflow's effective behavior when the task is scheduled.
temporal.api.enums.v1.VersioningBehavior behavior = 3;
// Workflow's effective deployment when the task is scheduled.
temporal.api.deployment.v1.Deployment deployment = 4;
}

message InternalTaskQueueStatus {
Expand Down Expand Up @@ -80,27 +87,31 @@ message TaskQueuePartition {
}
}

// Information about redirect intention sent by Matching to History in Record*TaskStarted calls
// Information about redirect intention sent by Matching to History in Record*TaskStarted calls.
// Deprecated.
message BuildIdRedirectInfo {
// build ID asked by History in the directive or the one calculated based on the assignment rules.
// this is the source of the redirect rule chain applied. (the target of the redirect rule chain is
// the poller's build ID reported in WorkerVersionCapabilities)
string assigned_build_id = 1;
}

// Information about task forwarding from one partition to its parent. Versioning decisions for activity/workflow
// tasks are made at the source partition and sent to the parent partition in this message so that parent partition
// does not have to make versioning decision again. For Query/Nexus tasks, this works differently as the child's
// versioning decision is ignored and the parent partition makes a fresh decision.
// Information about task forwarding from one partition to its parent.
message TaskForwardInfo {
// RPC name of the partition forwarded the task.
// In case of multiple hops, this is the source partition of the last hop.
string source_partition = 1;
temporal.server.api.enums.v1.TaskSource task_source = 2;
// Redirect info is not present for Query and Nexus tasks.
// Redirect info is not present for Query and Nexus tasks. Versioning decisions for activity/workflow
// tasks are made at the source partition and sent to the parent partition in this message so that parent partition
// does not have to make versioning decision again. For Query/Nexus tasks, this works differently as the child's
// versioning decision is ignored and the parent partition makes a fresh decision.
// Deprecated. [cleanup-old-wv]
BuildIdRedirectInfo redirect_info = 3;
// Build ID that should be used to dispatch the task to. Ignored in Query and Nexus tasks.
// Deprecated. [cleanup-old-wv]
string dispatch_build_id = 4;
// Only used for old versioning. [cleanup-old-wv]
// Deprecated. [cleanup-old-wv]
string dispatch_version_set = 5;
}

0 comments on commit daa0082

Please sign in to comment.