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

Remove unnecessary aliasing/unaliasing of scheduled workflow search attributes #3943

Merged
merged 1 commit into from
Feb 11, 2023

Conversation

alexshtin
Copy link
Member

What changed?
Remove unnecessary aliasing/unaliasing of scheduled workflow search attributes.

Why?
They are getting unaliases when workflow is actually started.

How did you test it?
Functional tests over sqlite.

Potential risks
No risks.

Is hotfix candidate?
No.

@alexshtin alexshtin requested a review from a team as a code owner February 11, 2023 00:31
@alexshtin alexshtin changed the title Remove unnecessary aliasing/unaliasing of start workflow search attributes Remove unnecessary aliasing/unaliasing of scheduled workflow search attributes Feb 11, 2023
@alexshtin alexshtin requested a review from dnr February 11, 2023 00:31
if err != nil {
return err
}
if err := wh.validateSearchAttributes(unaliasedStartWorkflowSas, namespaceName); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

I actually don't like bellow lint message. I always do explicit error return. Because what it suggests looks like the function returns results of another function.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, this contradicts the standard Go style of having the error path exit early and the happy path flow to the end of the function. Sometimes for short functions I might return a call directly but if there are other error returns I agree the last one should also be an error return for consistency

@@ -3164,22 +3170,6 @@ func (wh *WorkflowHandler) DescribeSchedule(ctx context.Context, request *workfl
return err
}

// map action search attributes
Copy link
Member

Choose a reason for hiding this comment

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

maybe just replace with a comment like

// Search attributes in the Action are already in external ("aliased") form. Do not alias them here.

@@ -3070,7 +3071,12 @@ func (wh *WorkflowHandler) validateStartWorkflowArgsForSchedule(
return errIDReusePolicyNotAllowed
}

if err := wh.validateSearchAttributes(startWorkflow.GetSearchAttributes(), namespaceName); err != nil {
// Unalias startWorkflow search attributes only for validation. Keep aliases in request.
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
// Unalias startWorkflow search attributes only for validation. Keep aliases in request.
// Unalias startWorkflow search attributes only for validation. Keep aliases in the request, because the request will be sent back to frontend to start workflows, which will unalias at that point.

@alexshtin alexshtin merged commit 4f5b1b0 into temporalio:master Feb 11, 2023
@alexshtin alexshtin deleted the fix/schedule-unalias branch February 11, 2023 01:32
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