Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support unpinned workflows #6887

Open
wants to merge 30 commits into
base: versioning-3
Choose a base branch
from
Open

Conversation

ShahabT
Copy link
Contributor

@ShahabT ShahabT commented Nov 25, 2024

What changed?

Add Matching and History changes to properly route unpinned workflow tasks.

Why?

How did you test it?

Tests will come in separate PR.

Potential risks

Documentation

Is hotfix candidate?

…g-behaviors

# Conflicts:
#	api/deployment/v1/message.go-helpers.pb.go
#	api/deployment/v1/message.pb.go
#	common/worker_versioning/worker_versioning.go
#	proto/internal/temporal/server/api/deployment/v1/message.proto
…g-behaviors

# Conflicts:
#	api/persistence/v1/executions.pb.go
#	service/matching/task_queue_partition_manager.go
…shahab/transfer-versioning-info

# Conflicts:
#	service/history/workflow/mutable_state_impl.go
…er-versioning-info

# Conflicts:
#	api/deployment/v1/message.pb.go
#	api/historyservice/v1/request_response.pb.go
#	api/persistence/v1/tasks.pb.go
#	api/taskqueue/v1/message.pb.go
#	proto/internal/temporal/server/api/deployment/v1/message.proto
#	proto/internal/temporal/server/api/historyservice/v1/request_response.proto
…haviors

# Conflicts:
#	common/worker_versioning/worker_versioning.go
…g-behaviors

# Conflicts:
#	common/worker_versioning/worker_versioning.go
#	service/history/workflow/util.go
@ShahabT ShahabT changed the base branch from versioning-3 to shahab/routing-behaviors November 25, 2024 21:33
@ShahabT ShahabT marked this pull request as ready for review November 25, 2024 23:55
@ShahabT ShahabT requested a review from a team as a code owner November 25, 2024 23:55
func Deployment(deployment *deployment.Deployment) ZapTag {
val := "UNVERSIONED"
if deployment != nil {
val = deployment.SeriesName + ":" + deployment.GetBuildId()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use GetXXX() format everywhere for consistency. Also all these log tag thing is aiming to 0 allocations and 0 overhead if tag is not used but I guess there is no good way to make it work here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make deployment a string here and call DeploymentToString before passing deployment to this func. Let's make tags trivial simple.

@@ -110,7 +110,7 @@ message VersioningData {
message DeploymentData {
// Set of deployments that this task queue belongs to.
// Current deployment is defined implicitly as the deployment with the most recent last_became_current_time.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you specify TaskQueueData.last_became_current_time?

@@ -110,7 +110,7 @@ message VersioningData {
message DeploymentData {
// Set of deployments that this task queue belongs to.
// Current deployment is defined implicitly as the deployment with the most recent last_became_current_time.
repeated Deployment deployment = 1;
repeated Deployment deployments = 1;

message Deployment {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This nested Deployment is a bad sign. DeploymentDataItem?

}
wfDeployment := mutableState.GetEffectiveDeployment()
if !directiveDeployment.Equal(wfDeployment) {
// This must be a task scheduled before the workflow transitions to the current
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same way as we refer "workflow task" as WFT everywhere in comments, I would suggest to refer "activity task" as AT, not just "task".

return nil, serviceerrors.NewObsoleteMatchingTask("wrong task queue type")
}

dispatchDeployment := worker_versioning.DeploymentFromCapabilities(req.PollRequest.WorkerVersionCapabilities)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dispatchDeployment := worker_versioning.DeploymentFromCapabilities(req.PollRequest.WorkerVersionCapabilities)
pollerDeployment := worker_versioning.DeploymentFromCapabilities(req.PollRequest.WorkerVersionCapabilities)

}

dispatchDeployment := worker_versioning.DeploymentFromCapabilities(req.PollRequest.WorkerVersionCapabilities)
directiveDeployment := req.GetDirectiveDeployment()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
directiveDeployment := req.GetDirectiveDeployment()
scheduledDeployment := req.GetScheduledDeployment()

-- deployment which history wanted when it scheduled a WFT.

if errors.Is(err, workflow.ErrPinnedWorkflowCannotTransition) {
// This must be a task from a time that the workflow was unpinned, but it's
// now pinned so can't transition. Matching can drop the task safely.
return nil, serviceerrors.NewObsoleteMatchingTask("workflow is not eligible for transition")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return nil, serviceerrors.NewObsoleteMatchingTask("workflow is not eligible for transition")
return nil, serviceerrors.NewObsoleteMatchingTask(workflow.ErrPinnedWorkflowCannotTransition.Error())

Base automatically changed from shahab/routing-behaviors to versioning-3 November 26, 2024 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants