-
Notifications
You must be signed in to change notification settings - Fork 917
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
Conversation
What about add GetMemo and GetSearchAttributes into mutable state interface? |
7df7b95
to
972ba6e
Compare
Fixed, good idea! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, LGTM.
972ba6e
to
18dbb5a
Compare
@@ -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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
18dbb5a
to
b081ff5
Compare
b081ff5
to
0901d04
Compare
0901d04
to
c3bf450
Compare
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 |
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.