Skip to content

[Backport 3.9] Fix UnsupportedOperationException merging an empty object with a populated sibling index (#5791) - #5864

Merged
ahkcs merged 1 commit into
opensearch-project:3.9from
ahkcs:backport/backport-5791-to-3.9
Oct 12, 2026
Merged

ahkcs merged 1 commit into
opensearch-project:3.9from
ahkcs:backport/backport-5791-to-3.9

Conversation

@ahkcs

@ahkcs ahkcs commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

Description

Backport of #5791 to 3.9. Clean cherry-pick, matches main.

Verified on this branch: spotlessCheck, unit tests for common, core, ppl, opensearch and opensearch-sql-plugin, and :integ-test:compileTestJava.

Related Issues

Backport of #5791

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • Commits are signed per the DCO using --signoff.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…lated sibling (opensearch-project#5791)

cloneDeep() only allocated a mutable properties map when the source object had
properties; for an empty object it left copy.properties as the class-default
ImmutableMap.of(). When a wildcard describe merges two indices whose only
difference is one carrying a leaf under an otherwise-empty object path, and the
empty side is merged first, MergeRuleHelper's in-place put of the sibling's leaf
lands on that immutable map and throws UnsupportedOperationException.

Always give the copy a mutable LinkedHashMap so the deep merge can add fields
regardless of whether the object started empty.

The crash only reproduces when the empty-object index sorts first in the
unordered map getIndexMappings returns, so the added regression test pins that
iteration order to reproduce deterministically.

Signed-off-by: Kai Huang <[email protected]>
(cherry picked from commit d7af0dc)
Signed-off-by: Kai Huang <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.86%. Comparing base (bb7514f) to head (dd87319).
⚠️ Report is 1 commits behind head on 3.9.

❌ Your project check has failed because the head coverage (62.86%) is below the target coverage (99.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##                3.9    #5864      +/-   ##
============================================
- Coverage     62.86%   62.86%   -0.01%     
+ Complexity     8782     8781       -1     
============================================
  Files           938      938              
  Lines         40145    40144       -1     
  Branches       4519     4518       -1     
============================================
- Hits          25238    25237       -1     
  Misses        14106    14106              
  Partials        801      801              
Flag Coverage Δ
sql-engine 62.86% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ahkcs
ahkcs merged commit cdb477d into opensearch-project:3.9 Oct 12, 2026
45 of 47 checks passed
joshuali925 pushed a commit to opensearch-project/observability-stack that referenced this pull request Oct 15, 2026
…indices (#482)

OpenSearch 3.9.0 ships opensearch-project/sql#5657, which made wildcard
PPL/SQL queries throw UnsupportedOperationException when one index maps an
empty object and a sibling index maps a leaf under the same path. After the
first rollover of otel-v1-apm-span, events.attributes is an empty object in
the new index, so every query on otel-v1-apm-span-* can fail, including
Agent Traces. The fix (opensearch-project/sql#5791) was backported to 3.9 in
opensearch-project/sql#5864 and is in the 3.9.1 staging image.

OpenSearch Dashboards stays on 3.9.0.

Signed-off-by: Kyle Hounslow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants