-
Notifications
You must be signed in to change notification settings - Fork 805
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 encoding bug to index context header in search attributes #6148
Conversation
searchAttr = appendContextHeaderToSearchAttributes(searchAttr, attributes.Header.Fields, t.config.ValidSearchAttributes()) | ||
// fail open to avoid blocking the task processing | ||
if newSearchAttr, err := appendContextHeaderToSearchAttributes(searchAttr, attributes.Header.Fields, t.config.ValidSearchAttributes()); err != nil { | ||
t.logger.Error("unable to parse search attributes", tag.Error(err)) |
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.
nit: inconsistent error message in active/passive executors. I'd go with: "failed to add headers to search attributes"
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.
good catch
@@ -1978,8 +1979,12 @@ func createRecordWorkflowExecutionStartedRequest( | |||
} | |||
var searchAttributes map[string][]byte | |||
if enableContextHeaderInVisibility { | |||
contextValueJsonString, err := json.Marshal("contextValue") | |||
if err != nil { | |||
panic(err) // must not happen in tests |
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.
nit: pass testing.T here and call t.Fatal
instead of panic
What changed?
json marshal raw string bytes before store in search attributes
Why?
Context Header stores the raw string bytes; but search attributes should store json strings rather than raw string bytes. Otherwise, it will cause unmarshal error in creating visibility message.
How did you test it?
unit test
Potential risks
Release notes
Documentation Changes