Remove nil search attributes from history events / mutable state / ch… #9091
+551
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changed?
Remove nil search attributes from history events / mutable state / chasm node
Why?
Search attributes can be explicitly set as null on the following events:
Workflow Start
Upsert Search Attributes
Continue-as-new
Starting a workflow or continuing a workflow as new with a nil search attribute records the
{key: nil}mapping in mutable state and the history event.Upserting search attributes erases any current search attribute value from persistence (mutable state and visibility record).
Upserting the search attribute as nil in the SDK retains the mapping in the WorkflowInfo as a {key: nil} mapping. On a continue-as-new event, SDK sends this mapping to Server, and the search attribute gets repopulated with the null search attribute in the history event and mutable state.
This last scenario can cause inconsistency between the expected search attributes and what is recorded in history. After upserting a nil search attribute, the mutable state and visibility record no longer shows this search attribute. But, once continuing as new, the search attribute reappears, leading to unexpected NDE if the search attribute is also deregistered.
CHASM change
This also removes nil search attributes from CHASM nodes on replacement. This mirrors the change to Workflow History Events and Mutable State.
How did you test it?