Skip to content

Commit

Permalink
Fix directory casting
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Kale <[email protected]>
  • Loading branch information
Sachin Kale committed Oct 29, 2023
1 parent 8d918b9 commit 9e1468b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ public void close(String reason, boolean flushEngine, boolean deleted) throws IO
/*
ToDo : Fix this https://github.com/opensearch-project/OpenSearch/issues/8003
*/
private RemoteSegmentStoreDirectory getRemoteDirectory() {
public RemoteSegmentStoreDirectory getRemoteDirectory() {
assert indexSettings.isRemoteStoreEnabled();
assert remoteStore.directory() instanceof FilterDirectory : "Store.directory is not an instance of FilterDirectory";
FilterDirectory remoteStoreDirectory = (FilterDirectory) remoteStore.directory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,18 +506,12 @@ private GatedCloseable<IndexCommit> acquireLock(IndexShard indexShard, ShardId s
}

private void validateSegmentFilesFromAcquiredLock(IndexShard indexShard, long primaryTerm, long generation) throws IOException {
Store remoteStore = indexShard.remoteStore();
Store store = indexShard.store();
try {
remoteStore.incRef();
store.incRef();
String metadataFilename = ((RemoteSegmentStoreDirectory) remoteStore.directory()).getMetadataFileForCommit(
primaryTerm,
generation
);
RemoteSegmentMetadata remoteSegmentMetadata = ((RemoteSegmentStoreDirectory) remoteStore.directory()).readMetadataFile(
metadataFilename
);
RemoteSegmentStoreDirectory remoteDirectory = indexShard.getRemoteDirectory();
String metadataFilename = remoteDirectory.getMetadataFileForCommit(primaryTerm, generation);
RemoteSegmentMetadata remoteSegmentMetadata = remoteDirectory.readMetadataFile(metadataFilename);
Optional<String> segmentInfosFileName = remoteSegmentMetadata.getMetadata()
.keySet()
.stream()
Expand All @@ -536,7 +530,6 @@ private void validateSegmentFilesFromAcquiredLock(IndexShard indexShard, long pr
}
}
} finally {
remoteStore.decRef();
store.decRef();
}
}
Expand Down

0 comments on commit 9e1468b

Please sign in to comment.