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
Exclude license header check for HighlightFunctionIT - #5733
Excludes HighlightFunctionIT from license-header checks because RAT 0.18 misdetects its first 256 bytes (import FULLTEXT_RELEVANCE_FUNC) as unsupported IBM424_rtl charset. This began failing today because opensearch-project/OpenSearch#22770 upgraded Apache RAT from 0.15 to 0.18. Remove after the upstream RAT fix.
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.
The PROBE_TIMEOUT of 10 seconds is generous, but if both probes (resolve and field_caps) are issued sequentially and each takes near the timeout, the total delay approaches 20 seconds. For a query that would otherwise respond quickly, this could appear as a hang. Consider whether a shorter timeout or a combined budget is more appropriate, or document that queries may experience this latency when pruning is enabled.
The prunedIndexName is memoized and reused across multiple build() calls. If the same builder instance is used for different queries or if the filter changes between calls, the stale pruned name from the first call will be incorrectly applied to subsequent queries. This can cause queries to read the wrong set of indices.
/** Memoized because build() runs once per scan on the calling thread. */@EqualsAndHashCode.Exclude@ToString.ExcludeprivateOpenSearchRequest.IndexNameprunedIndexName;
The memoization of prunedIndexName is not thread-safe. If build() is called concurrently from multiple threads, race conditions could occur where pruning runs multiple times or returns inconsistent results. Consider using synchronization or making the field volatile with proper double-checked locking.
if (prunedIndexName == null) {
- prunedIndexName =- client- .getNodeClient()- .map(- nodeClient -> new IndexPruner(nodeClient).prune(indexName, sourceBuilder.query()))- .orElse(indexName);- log.info(- "Index expression has {} names after pruning", prunedIndexName.getIndexNames().length);- log.debug("Pruned index expression from {} to {}", indexName, prunedIndexName);+ synchronized (this) {+ if (prunedIndexName == null) {+ prunedIndexName =+ client+ .getNodeClient()+ .map(+ nodeClient -> new IndexPruner(nodeClient).prune(indexName, sourceBuilder.query()))+ .orElse(indexName);+ log.info(+ "Index expression has {} names after pruning", prunedIndexName.getIndexNames().length);+ log.debug("Pruned index expression from {} to {}", indexName, prunedIndexName);+ }+ }
}
return prunedIndexName;
Suggestion importance[1-10]: 7
__
Why: Valid concern about thread-safety in the memoization pattern. The comment states "Memoized because build() runs once per scan on the calling thread," but without explicit synchronization, concurrent access could lead to race conditions or multiple pruning operations.
Medium
General
Reduce probe timeout duration
The 10-second timeout for pruning probes is very generous and could significantly delay query execution if probes fail or are slow. Consider reducing this timeout to 1-2 seconds to prevent excessive query latency, especially since the fallback behavior is to query the full expression.
-private static final TimeValue PROBE_TIMEOUT = TimeValue.timeValueSeconds(10);+private static final TimeValue PROBE_TIMEOUT = TimeValue.timeValueSeconds(2);
Suggestion importance[1-10]: 4
__
Why: While reducing the timeout from 10s to 2s could improve responsiveness, the PR documentation explicitly states the timeout is "generous because a fallback can fail the query, not merely slow it." The current value appears to be a deliberate design choice to avoid false failures.
dai-chen
changed the title
Exclude license header check for HighlightFunctionIT due to RAT charset issue
Exclude license header check for HighlightFunctionIT
Aug 31, 2026
dai-chen
changed the title
Exclude license header check for HighlightFunctionIT
Exclude license header check for HighlightFunctionITAug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
infrastructureChanges to infrastructure, testing, CI/CD, pipelines, etc.
2 participants
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.
Description
Excludes
HighlightFunctionITfrom license-header checks because RAT 0.18 misdetects its first 256 bytes (importFULLTEXT_RELEVANCE_FUNC) as unsupportedIBM424_rtlcharset. This began failing today because opensearch-project/OpenSearch#22770 upgraded Apache RAT from 0.15 to 0.18. Remove after the upstream RAT fix.Related Issues
N/A
Check List
--signoffor-s.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.