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

Add a utility for reliably fetching search attributes and memo #3687

Merged
merged 1 commit into from
Dec 8, 2022

Conversation

MichaelSnowden
Copy link
Contributor

What changed?

I added a utility for fetching the memo and search attributes from a workflow, depending on whether the close visibility task is complete or not.

Why?

I made this change because we need this method in the new archival queue.

How did you test it?

I tested this change by adding unit tests.

Potential risks

This could introduce a bug into the DescribeWorkflowExecution API since the extracted method is slightly different so that it only depends on a visibility manager and mutable state.

Is hotfix candidate?

No.

@yux0
Copy link
Contributor

yux0 commented Dec 3, 2022

What about add GetMemo and GetSearchAttributes into mutable state interface?

@MichaelSnowden
Copy link
Contributor Author

What about add GetMemo and GetSearchAttributes into mutable state interface?

Fixed, good idea!

Copy link
Collaborator

@rodrigozhou rodrigozhou left a comment

Choose a reason for hiding this comment

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

Overall, LGTM.

service/history/api/describeworkflow/api.go Outdated Show resolved Hide resolved
@@ -572,6 +573,35 @@ func (e *MutableStateImpl) GetLastWriteVersion() (int64, error) {
return common.EmptyVersion, nil
}

// GetMemo returns the memo of the workflow execution. If the close execution visibility task is incomplete, this method
// fetches the memo from the mutable state. Otherwise, it fetches the memo from the visibility storage backend.
func (e *MutableStateImpl) GetMemo(ctx context.Context, visibilityManager manager.VisibilityManager) (*commonpb.Memo, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You should be able to get VisibilityManager from shard?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't able to find one

service/history/api/describeworkflow/api.go Outdated Show resolved Hide resolved
@rodrigozhou
Copy link
Collaborator

rodrigozhou commented Dec 8, 2022

Not sure if there's any value in creating a "Fetcher" for this vs just creating a function in mutable state. Not a big deal though

@MichaelSnowden MichaelSnowden merged commit 8a71b94 into master Dec 8, 2022
@MichaelSnowden MichaelSnowden deleted the dynamic-fields-fetcher branch December 8, 2022 19:23
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