You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[AUTOCUT] Integration Test Failed for sql-3.9.0 #5739
Check out test report manifest linked above for steps to reproduce, cluster and integration test failure logs. For additional information checkout the wiki and OpenSearch Metrics Dashboard.
[RCA] CalcitePartialResultOnMappingConflictIT (new in PR #5657) fails only in the with-security config because the partial-result path is not engaged there
All seven failures in the 3.9.0 integ-test AUTOCUT are in a single new test class introduced by PR #5657 (partial-result mode for text/keyword mapping conflicts). The without-security config passes; only with-security fails, and the assertion pattern (unnarrowed row counts, missing warnings field) matches what happens when tryPartialResultAggregate bails out and the query falls through to the normal complete-result path. The proximate cause is inside PR #5657 itself; the feature was not exercised end-to-end with the security plugin.
Environment
Tenant: sql (opensearch-project/sql)
Refs checked:
upstream/main @ 18c39e381 (tip; commit that added the feature and the failing tests)
CalcitePartialResultOnMappingConflictIT was added by PR #5657 and did not exist before this commit. The seven failing test methods all set plugins.calcite.partial_result.on_mapping_conflict.enabled=true, then assert (a) the result narrows to the aggregatable (keyword) index subset only, and (b) the response carries a PARTIAL_RESULT entry in a warnings array. In the CI stderr the observed responses do neither:
Six assertEquals failures on datarows.length() with actual = expected + 1 or expected + 2 (e.g., expected:<2> but was:<3> for partialResultOnReturnsKeywordSubsetWithWarning at L267). Those extra rows are exactly the buckets contributed by the text indices that partial mode is supposed to exclude — so the query is returning the same rows as the partialResultOffReturnsCompleteResultWithoutWarning case (L246-L254), which is the complete-path result.
One JSONObject["warnings"] not found in partialResultWarningTruncatesLargeExcludedList at L415 — the response has no warnings array at all.
Both symptoms have one code path: tryPartialResultAggregate returned null, so pushDownAggregate proceeded down the normal branch (in-memory _source script per PR #5646), which returns every index's data and never records a warning. The method has only three ways to return null short of running the partitioner:
!QueryContext.isPartialResultEnabled(...) at L513 — reads a per-request override from Log4j ThreadContext and, if unset, falls back to the cluster setting. The tests set the persistent cluster setting via setPartialResult(true) and never populate the override, so this gate should return true regardless of thread propagation. Not a candidate.
!QueryContext.isWarningsSupported() at L517 — reads only from Log4j ThreadContext, with no cluster-setting fallback (QueryContext.java#L109-L111). Default when unset is false → this gate then bails out.
PartialResultAggregatePushdown.plan(...) returns null — this depends on the fetched per-index mappings and wouldn't differ between security configs on identically-provisioned test indices.
Path (2) is the fit. QueryContext.setWarningsSupported(true) is invoked exactly once, on the transport thread inside TransportPPLQueryAction.doExecute at L199. The value is stored in Log4j ThreadContext — a plain ThreadLocal<Map<String, String>> with no propagation across executor boundaries. OpenSearchQueryManager.scheduledoes snapshot the Log4j ThreadContext map before handing off to the sql-worker pool, so under normal routing the flag survives the handoff. Under the security plugin, however, the transport action is invoked from inside a TransportInterceptor that operates in an OpenSearch ThreadContext.stashContext() / restore scope — that scope preserves OpenSearch's transient/header ThreadContext, but is unrelated to Log4j's ThreadContext. Concretely, the security interceptor may:
run doExecute on a fresh worker thread whose Log4j ThreadContext map is empty from a prior clear (clearRequestScopedState explicitly sets warnings_supported=false), and/or
reset the log ThreadContext across the async wrap, leaving warnings_supported=false visible to tryPartialResultAggregate even though setWarningsSupported(true) was called upstream.
Either way, isWarningsSupported() returns false on the planning thread and the partial-result branch is skipped, exactly matching every failure.
The without-security config uses a plain transport chain, setWarningsSupported(true) runs on the same thread that eventually invokes pushDownAggregate (or OpenSearchQueryManager.schedule snapshots it in time), so the gate passes there and the tests pass. Same code, different threading — hence the security-only split.
Evidence
Failing tests + assertion messages (fetched from CI stderr for linux/x64/tar run 11545, file):
partialResultOnHandlesMultiFieldExpressionGroupKeyL352 — expected:<2> but was:<4>
partialResultOnHandlesNestedDottedFieldL303 — expected:<2> but was:<3>
partialResultWarningTruncatesLargeExcludedListL415 — JSONObject["warnings"] not found
partialResultOnHandlesEvalDerivedGroupKeyL327 — expected:<2> but was:<3>
partialResultOnReturnsKeywordSubsetWithWarningL267 — expected:<2> but was:<3>
partialResultKeepsNumericExcludesTextL376 — expected:<2> but was:<4>
partialResultKeepsKeywordGroupEvenWhenOutnumberedL398 — expected:<2> but was:<3>
All observed row counts equal what the complete-result path (partialResult=off) would produce (keyword-index buckets ∪ text-index buckets), matching the "partial path bypassed" hypothesis.
Config split: same 3.9.0 build 12182, sql component, run 11545 — with-security FAIL, without-security PASS. The test class is the sole failing suite; total run 7257 completed, 7 failed, 232 skipped.
Regression check: The test class and every symbol its bodies reference (Warning, PARTIAL_RESULT, tryPartialResultAggregate, PartialResultAggregatePushdown, setWarningsSupported, setPartialResultOverride) are all newly introduced by 18c39e381 (merged Sep 1). There is no prior working reference on main. So this is a first-appearance defect in the newly-landed feature, not a regression against an older release; the failure appeared the first time this test class ran against a with-security distribution.
Live verification: not attempted — reproducing the with-security path requires a distribution build with the security plugin installed, which is out of scope for the standard :opensearch-sql-plugin:run local server described in the tenant's reproduce guide.
Confidence: High
Three independent signals point at the same hypothesis: (a) the source code has exactly one bail-out at CalciteLogicalIndexScan.java#L517 whose default-when-missing behavior exactly matches the observed responses; (c) the failure is scoped to the commit that first introduced the code; and the with-security-only split is exactly the shape you get when a ThreadLocal gate is dropped by an executor handoff that the security plugin inserts and the plain path does not. The remaining uncertainty is which specific security-plugin thread transition drops the Log4j ThreadContext, not whether the drop is the cause.
Next steps
Reproduce locally in integ-test with security enabled and log QueryContext.isWarningsSupported() at CalciteLogicalIndexScan.java#L517 to confirm the flag is false at planning time. If yes, the fix is to move warnings_supported off Log4j ThreadContext — e.g., carry it on CalcitePlanContext (already threaded through planning and used for warnings) or on the request/plan itself so it isn't tied to a thread-local. That parallels the treatment of the collected warnings, which the same commit already stores on CalcitePlanContext for the same reason.
Unverified suggestion: the same threading concern applies to the partial_result_override per-request override at TransportPPLQueryAction.java#L201. Under with-security, an API-body partial_result: false sent from Dashboards could similarly fail to reach the planner and defer to the cluster setting instead. The AUTOCUT tests do not exercise this path (they set the cluster setting), so it would not be caught by the current suite. Worth covering when the primary fix lands.
Add a with-security variant of the new IT (or run the existing one under the secure test cluster) so this class of "feature depends on Log4j ThreadContext reaching the planner" never regresses silently again.
Activity
RyanL1997 commentedon Sep 2, 2026
@ryan-gh-bot can you do a rca of the above failure?
ryan-gh-bot commentedon Sep 2, 2026
Working on
/@triage(invoked by @RyanL1997) — posting result when done.ryan-gh-bot commentedon Sep 2, 2026
[RCA]
CalcitePartialResultOnMappingConflictIT(new in PR #5657) fails only in the with-security config because the partial-result path is not engaged thereAll seven failures in the 3.9.0 integ-test AUTOCUT are in a single new test class introduced by PR #5657 (partial-result mode for text/keyword mapping conflicts). The
without-securityconfig passes; onlywith-securityfails, and the assertion pattern (unnarrowed row counts, missingwarningsfield) matches what happens whentryPartialResultAggregatebails out and the query falls through to the normal complete-result path. The proximate cause is inside PR #5657 itself; the feature was not exercised end-to-end with the security plugin.Environment
sql(opensearch-project/sql)upstream/main @ 18c39e381(tip; commit that added the feature and the failing tests)Suspected location
opensearch/src/main/java/org/opensearch/sql/opensearch/storage/scan/CalciteLogicalIndexScan.java#L511-L555—tryPartialResultAggregate, the entry point that both feature gates short-circuit at L513 and L517.common/src/main/java/org/opensearch/sql/common/utils/QueryContext.java#L100-L110—setWarningsSupported/isWarningsSupported, backed by Log4j's per-threadThreadContext(map with no cross-thread propagation; note it is not OpenSearch'scommon.util.concurrent.ThreadContext).plugin/src/main/java/org/opensearch/sql/plugin/transport/TransportPPLQueryAction.java#L199-L201— the only placesetWarningsSupportedis called on the request path.integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePartialResultOnMappingConflictIT.java— the newly added tests that fail.Analysis
CalcitePartialResultOnMappingConflictITwas added by PR #5657 and did not exist before this commit. The seven failing test methods all setplugins.calcite.partial_result.on_mapping_conflict.enabled=true, then assert (a) the result narrows to the aggregatable (keyword) index subset only, and (b) the response carries aPARTIAL_RESULTentry in awarningsarray. In the CI stderr the observed responses do neither:assertEqualsfailures ondatarows.length()with actual = expected + 1 or expected + 2 (e.g.,expected:<2> but was:<3>forpartialResultOnReturnsKeywordSubsetWithWarningat L267). Those extra rows are exactly the buckets contributed by the text indices that partial mode is supposed to exclude — so the query is returning the same rows as thepartialResultOffReturnsCompleteResultWithoutWarningcase (L246-L254), which is the complete-path result.JSONObject["warnings"] not foundinpartialResultWarningTruncatesLargeExcludedListat L415 — the response has nowarningsarray at all.Both symptoms have one code path:
tryPartialResultAggregatereturnednull, sopushDownAggregateproceeded down the normal branch (in-memory _source script per PR #5646), which returns every index's data and never records a warning. The method has only three ways to returnnullshort of running the partitioner:!QueryContext.isPartialResultEnabled(...)at L513 — reads a per-request override from Log4jThreadContextand, if unset, falls back to the cluster setting. The tests set the persistent cluster setting viasetPartialResult(true)and never populate the override, so this gate should return true regardless of thread propagation. Not a candidate.!QueryContext.isWarningsSupported()at L517 — reads only from Log4jThreadContext, with no cluster-setting fallback (QueryContext.java#L109-L111). Default when unset isfalse→ this gate then bails out.PartialResultAggregatePushdown.plan(...)returnsnull— this depends on the fetched per-index mappings and wouldn't differ between security configs on identically-provisioned test indices.Path (2) is the fit.
QueryContext.setWarningsSupported(true)is invoked exactly once, on the transport thread insideTransportPPLQueryAction.doExecuteat L199. The value is stored in Log4jThreadContext— a plainThreadLocal<Map<String, String>>with no propagation across executor boundaries.OpenSearchQueryManager.scheduledoes snapshot the Log4jThreadContextmap before handing off to thesql-workerpool, so under normal routing the flag survives the handoff. Under the security plugin, however, the transport action is invoked from inside aTransportInterceptorthat operates in an OpenSearchThreadContext.stashContext()/ restore scope — that scope preserves OpenSearch's transient/header ThreadContext, but is unrelated to Log4j'sThreadContext. Concretely, the security interceptor may:doExecuteon a fresh worker thread whose Log4jThreadContextmap is empty from a prior clear (clearRequestScopedState explicitly setswarnings_supported=false), and/orwarnings_supported=falsevisible totryPartialResultAggregateeven thoughsetWarningsSupported(true)was called upstream.Either way,
isWarningsSupported()returnsfalseon the planning thread and the partial-result branch is skipped, exactly matching every failure.The
without-securityconfig uses a plain transport chain,setWarningsSupported(true)runs on the same thread that eventually invokespushDownAggregate(orOpenSearchQueryManager.schedulesnapshots it in time), so the gate passes there and the tests pass. Same code, different threading — hence the security-only split.Evidence
Failing tests + assertion messages (fetched from CI stderr for
linux/x64/tarrun 11545, file):partialResultOnHandlesMultiFieldExpressionGroupKeyL352 —expected:<2> but was:<4>partialResultOnHandlesNestedDottedFieldL303 —expected:<2> but was:<3>partialResultWarningTruncatesLargeExcludedListL415 —JSONObject["warnings"] not foundpartialResultOnHandlesEvalDerivedGroupKeyL327 —expected:<2> but was:<3>partialResultOnReturnsKeywordSubsetWithWarningL267 —expected:<2> but was:<3>partialResultKeepsNumericExcludesTextL376 —expected:<2> but was:<4>partialResultKeepsKeywordGroupEvenWhenOutnumberedL398 —expected:<2> but was:<3>All observed row counts equal what the complete-result path (
partialResult=off) would produce (keyword-index buckets ∪ text-index buckets), matching the "partial path bypassed" hypothesis.Config split: same 3.9.0 build 12182,
sqlcomponent, run 11545 —with-securityFAIL,without-securityPASS. The test class is the sole failing suite; total run 7257 completed, 7 failed, 232 skipped.Regression check: The test class and every symbol its bodies reference (
Warning,PARTIAL_RESULT,tryPartialResultAggregate,PartialResultAggregatePushdown,setWarningsSupported,setPartialResultOverride) are all newly introduced by18c39e381(merged Sep 1). There is no prior working reference onmain. So this is a first-appearance defect in the newly-landed feature, not a regression against an older release; the failure appeared the first time this test class ran against a with-security distribution.Live verification: not attempted — reproducing the with-security path requires a distribution build with the security plugin installed, which is out of scope for the standard
:opensearch-sql-plugin:runlocal server described in the tenant's reproduce guide.Confidence: High
Three independent signals point at the same hypothesis: (a) the source code has exactly one bail-out at
CalciteLogicalIndexScan.java#L517whose default-when-missing behavior exactly matches the observed responses; (c) the failure is scoped to the commit that first introduced the code; and the with-security-only split is exactly the shape you get when aThreadLocalgate is dropped by an executor handoff that the security plugin inserts and the plain path does not. The remaining uncertainty is which specific security-plugin thread transition drops the Log4jThreadContext, not whether the drop is the cause.Next steps
integ-testwith security enabled and logQueryContext.isWarningsSupported()atCalciteLogicalIndexScan.java#L517to confirm the flag isfalseat planning time. If yes, the fix is to movewarnings_supportedoff Log4jThreadContext— e.g., carry it onCalcitePlanContext(already threaded through planning and used for warnings) or on the request/plan itself so it isn't tied to a thread-local. That parallels the treatment of the collected warnings, which the same commit already stores onCalcitePlanContextfor the same reason.partial_result_overrideper-request override atTransportPPLQueryAction.java#L201. Under with-security, an API-bodypartial_result: falsesent from Dashboards could similarly fail to reach the planner and defer to the cluster setting instead. The AUTOCUT tests do not exercise this path (they set the cluster setting), so it would not be caught by the current suite. Worth covering when the primary fix lands.ThreadContextreaching the planner" never regresses silently again.3.9release branch once written.Automated response from @ryan-gh-bot (maintainer-triggered agent). About this agent.
RyanL1997 commentedon Sep 2, 2026
cc @ahkcs for the above - looks like it is related to #5657
Add a security-suite IT for the partial-result warning path (opensear…
Add a security-suite IT for the partial-result warning path (opensear…
Fix partial-result warnings gate lost across the security thread hand…
opensearch-ci-bot commentedon Sep 4, 2026
Closing the issue as the integration tests for sql passed for version: 3.9.0.
opensearch-ci-bot commentedon Sep 7, 2026
Closing the issue as the integration tests for sql passed for version: 3.9.0.
Carry the partial_result override off ThreadContext so it survives th…
Cover the shard-failure warning under the security plugin
Cover the shard-failure warning under the security plugin
Remove the opt-in partial-result mode for mapping conflicts
Remove the opt-in partial-result mode for mapping conflicts (#5814)
Cover the shard-failure warning under the security plugin
Cover the shard-failure warning under the security plugin
Cover the shard-failure warning under the security plugin
Remove the opt-in partial-result mode for mapping conflicts (opensear…
Remove the opt-in partial-result mode for mapping conflicts (#5814) (#…