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
Fixes multiple storage integration test failures spanning search execution, remote store uploads, recovery, snapshots, shard allocation, and index creation.
Changes:
MetadataCreateIndexService: Disable derived source for non-optimized indices to avoid DerivedSource is not supported mapping errors
QueryPhase: Fix execution order — check queryPlanIR() == null before accessing DataFusion.
RemoteStoreRefreshListener: Propagate userData to underlying SegmentInfos during remote metadata upload, fixing global checkpoint regression on primary failover
RemoteStoreUploaderService: Re-enable afterSyncToRemote callback for FileCache eviction eligibility after remote upload
Store: Use index UUID + shard ID for temp shard paths to avoid collisions; remove unused convertCatalogSnapshotToSegmentInfos dead code
IndexShard: Use null-safe getIndexingThrottlerOrNull() in indexingStats(); propagate IOException from getFormatAwareSegmentMetadataMap for proper failure detection
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
Functionality includes testing.
API changes companion pull request created, if applicable.
Public documentation issue/PR created, if applicable.
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 directory unwrapping uses a double FilterDirectory cast chain without null checks or type validation. If storeDirectory is not a FilterDirectory wrapping another FilterDirectory, this will throw a ClassCastException at runtime. There is no guard to verify the actual type before casting.
The condition disables derived source when OPTIMIZED_INDEX_ENABLED_SETTING is null OR equals "false". This means any index that doesn't explicitly set the optimized index setting will have derived source disabled, which could be an overly broad change affecting indices that never intended to use derived source at all. The logic should be validated to ensure it doesn't inadvertently break existing index creation behavior.
if (indexSettingsBuilder.get(IndexSettings.OPTIMIZED_INDEX_ENABLED_SETTING.getKey()) == null || indexSettingsBuilder.get(IndexSettings.OPTIMIZED_INDEX_ENABLED_SETTING.getKey()).equals("false")) {
indexSettingsBuilder.put(IndexSettings.INDEX_DERIVED_SOURCE_SETTING.getKey(), false);
}
The code directly accesses SegmentInfos.userData as a public field rather than using a setter method. This is a Lucene internal field and direct mutation bypasses any encapsulation or validation that Lucene may enforce, and could break with future Lucene upgrades.
The code calls searchContext.request().source().queryPlanIR() without null-checking source(). If searchContext.request().source() returns null, this will throw a NullPointerException. The previous code had the same pattern but the fix should ensure null safety.
if (searchContext.request().source().queryPlanIR() == null) {
Latest suggestions up to 405d431
Explore these optional code suggestions:
Category
Suggestion
Impact
Possible issue
Safely unwrap directory to avoid ClassCastException
The double FilterDirectory unwrapping assumes a specific directory wrapping structure that may not always hold, causing a ClassCastException at runtime. Consider using a safer approach by checking the type before casting, or using a utility method to unwrap to the desired type. If the structure is not as expected, the code should handle it gracefully rather than throwing an unchecked exception.
Why: The double FilterDirectory unwrapping with hard casts is fragile and will throw a ClassCastException if the directory structure doesn't match exactly. The suggested loop-based unwrapping is more robust and handles varying directory wrapping depths.
Medium
General
Avoid overriding explicitly set derived source setting
The condition explicitly sets INDEX_DERIVED_SOURCE_SETTING to false whenever the optimized index setting is absent or "false", which may override a user-explicitly-set value for INDEX_DERIVED_SOURCE_SETTING. You should also check whether INDEX_DERIVED_SOURCE_SETTING is already set before overriding it to avoid unintentionally overwriting user configuration.
Why: The current code unconditionally overrides INDEX_DERIVED_SOURCE_SETTING to false even if a user explicitly set it, which could silently override user configuration. Adding a null check before overriding prevents unintended behavior.
Low
Use setter method instead of direct field assignment
Directly assigning to userData field of SegmentInfos bypasses any encapsulation or validation that setUserData might provide, and may cause inconsistency if setUserData performs additional logic. It would be safer to use the setUserData method on SegmentInfos if available, or ensure this direct field assignment is intentional and documented.
if (catalogSnapshotCloned instanceof SegmentInfosCatalogSnapshot) {
- ((SegmentInfosCatalogSnapshot) catalogSnapshotCloned).getSegmentInfos().userData = userData;+ // Directly set userData on SegmentInfos to ensure consistency with catalogSnapshot userData+ SegmentInfos segmentInfos = ((SegmentInfosCatalogSnapshot) catalogSnapshotCloned).getSegmentInfos();+ segmentInfos.setUserData(userData, false);
}
Suggestion importance[1-10]: 5
__
Why: Directly assigning to the userData public field of SegmentInfos bypasses any encapsulation; using setUserData is safer and more consistent with how userData is set elsewhere in the codebase.
Safely unwrap directory to avoid ClassCastException
The double FilterDirectory unwrapping assumes a specific directory wrapping structure that may not always hold, causing a ClassCastException at runtime. Consider using a safer approach by checking the type before casting, or using a utility method to unwrap to the target type. Additionally, if storeDirectory is not a FilterDirectory, this will throw a ClassCastException without a meaningful error message.
Why: The double FilterDirectory unwrapping with hard casts is fragile and will throw a ClassCastException if the directory structure doesn't match exactly. The suggested loop-based unwrapping is more robust and defensive.
Medium
Guard against null source before accessing queryPlanIR
The call to searchContext.request().source() may return null if no source is set, causing a NullPointerException. The original code had the same issue, but since this is being restructured, it's worth adding a null check for searchContext.request().source() before calling queryPlanIR().
-if (searchContext.request().source().queryPlanIR() == null) {+if (searchContext.request().source() == null || searchContext.request().source().queryPlanIR() == null) {
boolean rescore = executeInternal(searchContext, queryPhaseSearcher);
if (rescore) { // only if we do a regular search
rescoreProcessor.process(searchContext);
}
suggestProcessor.process(searchContext);
} else if (searchContext.getDFResults() != null) {
SearchEngineResultConversionUtils.convertDFResultGeneric(searchContext);
}
Suggestion importance[1-10]: 5
__
Why: If searchContext.request().source() returns null, calling queryPlanIR() on it would cause a NullPointerException. Adding a null check is a valid defensive improvement, though this may be an unlikely scenario in practice.
Low
General
Avoid overriding explicitly set derived source setting
The condition sets INDEX_DERIVED_SOURCE_SETTING to false whenever the optimized index setting is null or "false", but this will unconditionally override any explicitly set value for INDEX_DERIVED_SOURCE_SETTING. You should also check if INDEX_DERIVED_SOURCE_SETTING is already explicitly set before overriding it.
Why: The current code unconditionally overrides INDEX_DERIVED_SOURCE_SETTING even if it was explicitly set by the user. Adding a null check for the derived source setting before overriding prevents unintended behavior.
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
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
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
Fixes multiple storage integration test failures spanning search execution, remote store uploads, recovery, snapshots, shard allocation, and index creation.
Changes:
DerivedSource is not supportedmapping errorsqueryPlanIR() == nullbefore accessing DataFusion.SegmentInfosduring remote metadata upload, fixing global checkpoint regression on primary failoverafterSyncToRemotecallback for FileCache eviction eligibility after remote uploadconvertCatalogSnapshotToSegmentInfosdead codegetIndexingThrottlerOrNull()inindexingStats(); propagateIOExceptionfromgetFormatAwareSegmentMetadataMapfor proper failure detectionRelated Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
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.