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

Fix GetWorkflowExecution in PostgreSQL #3816

Merged

Conversation

rodrigozhou
Copy link
Collaborator

What changed?
In PostgreSQL, fix trimming run id in GetWorkflowExecution.
Refactored some code, and added new unit tests to cover GetWorkflowExeccution function.

Why?
In PostgreSQL, when doing SELECT, the run id has to be trimmed as it returns with trailing spaces. The existing select function is doing it, but the GetWorkflowExecution was missing.

How did you test it?
New unit tests.

Potential risks
None, GetWorkflowExecution is only used when removing SA and memo from mutable state is enabled (currently not used anywhere).

Is hotfix candidate?
No.

@rodrigozhou rodrigozhou requested a review from a team as a code owner January 19, 2023 16:37
@@ -303,11 +303,11 @@ func (s *visibilitySuite) TestDeleteSelect() {
s.NoError(err)
s.Equal(0, int(rowsAffected))

selectFilter := sqlplugin.VisibilitySelectFilter{
getFilter := sqlplugin.VisibilityGetFilter{
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we using Get instead of Select here, now? Also, if we are doing that, we should rename the tests accordingly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm, I could just leave unchanged. SelectFilter with only namespace and run id will do a Get anyway under the hood.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should leave this unchanged, at least in this PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, now I remember why I changed.
It's because in the new code, I made it not return an error in this case.
Currently, since Select calls Get in this case, it returns an error if the row is not found, which is kind of misleading because it's a Select.
Also, there's no actual use case of Select for the (namespace, run id) in the code, only in these tests.
I'll leave unchanged in this PR, and move to where I actually need this.

Copy link
Contributor

@MichaelSnowden MichaelSnowden left a comment

Choose a reason for hiding this comment

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

Some questions

@rodrigozhou rodrigozhou merged commit b9bba94 into temporalio:master Jan 24, 2023
@rodrigozhou rodrigozhou deleted the fix-postgres-get-wf-execution branch January 24, 2023 20:20
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.

3 participants