Skip to content

Handle unrecognized SearchQueryRecord attributes during stream deserialization#573

Open
dzane17 wants to merge 1 commit into
opensearch-project:mainfrom
dzane17:fix/resilient-attribute-deserialization
Open

Handle unrecognized SearchQueryRecord attributes during stream deserialization#573
dzane17 wants to merge 1 commit into
opensearch-project:mainfrom
dzane17:fix/resilient-attribute-deserialization

Conversation

@dzane17
Copy link
Copy Markdown
Member

@dzane17 dzane17 commented Mar 25, 2026

Description

During rolling upgrades, newer nodes may send SearchQueryRecord attributes that older nodes don't recognize (e.g. SOURCE_TRUNCATED, FAILED). Currently Attribute.readFromStream calls Attribute.valueOf() which throws IllegalArgumentException on unknown values, causing the entire node response to fail.

This change makes deserialization forward-compatible by:

  • Catching IllegalArgumentException in readFromStream and returning null for unrecognized attribute names
  • Skipping unknown attributes in readAttributeMap while still consuming their values from the stream to maintain correct stream position

Unknown attributes are written via writeGenericValue, so readGenericValue correctly advances the stream past them. Attributes with custom serialization (SOURCE, TASK_RESOURCE_USAGES) already exist in all versions and will never be unknown.

Issues Resolved

List any issues this PR will resolve, e.g. Closes [...].

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@dzane17 dzane17 force-pushed the fix/resilient-attribute-deserialization branch from 6b7bd52 to 4742852 Compare March 25, 2026 21:47
@dzane17 dzane17 marked this pull request as ready for review March 25, 2026 23:15
@LilyCaroline17
Copy link
Copy Markdown
Contributor

LilyCaroline17 commented Mar 30, 2026

As long as we don't add any more custom attributes in the future, it looks good to me.

…alization

Signed-off-by: David Zane <davizane@amazon.com>
@dzane17 dzane17 force-pushed the fix/resilient-attribute-deserialization branch from 4742852 to 823173d Compare May 8, 2026 22:31
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.

2 participants