-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix IndexShardTests: Add explicit null-check for Engine reference and fix FileMetadata serialization handling #20444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix IndexShardTests: Add explicit null-check for Engine reference and fix FileMetadata serialization handling #20444
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Comment |
|
❌ Gradle check result for 0ae6d0b: FAILURE 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? |
|
❌ Gradle check result for 6154c82: null 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? |
|
❌ Gradle check result for e1948d5: FAILURE 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? |
| Collection<FileMetadata> localFileMetadataList = catalogSnapshotRef.getRef().getFileMetadataList(); | ||
| Set<String> localFiles = localFileMetadataList.stream() | ||
| .filter(fm -> !RemoteStoreRefreshListener.EXCLUDE_FILES.contains(fm.file())) | ||
| .map(FileMetadata::serialize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these are local file references, why are we using serialize? We should be using FileMetadata::file here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a check below which checks if the uploadedFiles contains these local files and uploadedFile names are serialized. I have updated the name to serializedLocalFiles for better readability of the code.
| if(isOptimizedIndex()) | ||
| { | ||
| segmentNFile = file; | ||
| } | ||
| else | ||
| { | ||
| segmentNFile = fileMetadata.file(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are doing a new FileMetadata(file) call, file should already be delimited with data format name, why is the segmentsNFile reference okay to be updated as file here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These segmentNFiles are used by caller syncSegmentsFromGivenRemoteSegmentStore. syncSegmentsFromGivenRemoteSegmentStore API calls OpenInput on this segmentNFile so for normal storeDirectory we need the name in plain file format but for compositeStoreDirectory we need the serialized name so that it can be routed to correct directory.
|
❌ Gradle check result for 13fbfed: FAILURE 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? |
| @Override | ||
| public void deleteFile(String name) throws IOException { | ||
| String remoteFilename = getExistingRemoteFilename(name); | ||
| String fileName = new FileMetadata(name).toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can we use serialize directly here?
| assert segmentNFile == null : "There should be only one SegmentInfosSnapshot file"; | ||
| if(isOptimizedIndex()) | ||
| { | ||
| if(isOptimizedIndex()){ | ||
| segmentNFile = file; | ||
| } | ||
| else | ||
| { | ||
| else{ | ||
| segmentNFile = fileMetadata.file(); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: formatting
|
❌ Gradle check result for 007efe5: FAILURE 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? |
d2f1abe
into
opensearch-project:feature/datafusion
… fix FileMetadata serialization handling (opensearch-project#20444) * Fixing IndexShardTests recovery tests * Removed unnecessary comment * updated getNativeBytesused api * Fixed RemoteStoreListenerTests and resolved comments * nit fix --------- Co-authored-by: Kamal Nayan <[email protected]>
Description
This PR fixes failing
IndexShardTestsby addressing two main issues:Problem 1: Engine Null Reference
Several
IndexShardTestswere failing withNullPointerExceptionwhen tests accessed shard methods before the engine was fully initialized or after it was closed.Problem 2: FileMetadata Serialization
For non-optimized (standard Lucene) indices, file names were incorrectly being used in serialized format (e.g.,
segment_1.si:::lucene) instead of plain file names (e.g.,segment_1.si), causing file lookup failures and test issues.Problem 3: RemoteStoreRefreshListenerTests Failing:
Because of the changes made to RemoteStoreRefreshListener class to support mulit-format because of which all tests in RemoteStoreRefreshListenerTests were failing.
Tests Now Passing (4 tests fixed)
testCloseShardWhileEngineIsWarmingtestEstimateTotalDocSizetestIndexingOperationsListenerstestSyncSegmentsFromGivenRemoteSegmentStoreAll RemoteStoreRefreshListenerTests are fixed now:
Before this fix 81 tests were passing:


After this fix 85 tests are passing. Most of the remaining failed tests are related to translogOps compression during shardClose call:
Tests: