Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit fe8844b

Browse files
committed
Enhance searchable snapshots to enable a read-only view of older snapshots (opensearch-project#5429)
* Enhance searchable snapshots to enable a read-only view of older snapshots This change removes the guardrails around N-1 backward compatibility and uses Lucene's "expert" APIs to read snapshots (Lucene segments) older than N-1 on a best-effort basis. The functionality is gated by an additional feature flag, separate from the searchable snapshots flag. Note that the Lucene integration is rather inefficient because the necessary "expert" Lucene APIs are still package-private. Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Added some unit tests This change also includes a test index ZIP file for the unit tests. The change also introduces a bug fix in the readAnySegmentsInfo method to close the reader before returning the SegmentInfos object - this avoids dangling/open file handles. Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Incorporating PR feedback Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Incorporate PR comments from andrross Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Remove use of IndexSetting for minimum version for snapshots backwards compatibility Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Moved ES 6.3.0 test data to a subdirectory This change also includes an update to the file name to clarify that it is an ES index, and changing the associated markdown file name to just README.md. All tests that reference this ZIP file have corresponding changes to the path they reference. Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Update unit tests to use try-with-resources Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Added FeatureFlagSetter helper class Also refactored unit test classes to use the helper class. Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Incorporating PR feedback from @mch2 Signed-off-by: Kartik Ganesh <gkart@amazon.com> * Fix IndexSettingsTests Updated the asserts in IndexSettingsTests to account for the new defaulting behavior. Signed-off-by: Kartik Ganesh <gkart@amazon.com> Signed-off-by: Kartik Ganesh <gkart@amazon.com>
1 parent 094c1d8 commit fe8844b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

server/src/main/java/org/opensearch/common/lucene/Lucene.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import org.apache.lucene.index.SegmentReader;
5858
import org.apache.lucene.index.StandardDirectoryReader;
5959
import org.apache.lucene.index.StandardDirectoryReader;
60+
import org.apache.lucene.index.StandardDirectoryReader;
6061
import org.apache.lucene.search.DocIdSetIterator;
6162
import org.apache.lucene.search.Explanation;
6263
import org.apache.lucene.search.FieldDoc;

server/src/main/java/org/opensearch/index/IndexSettings.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ public final class IndexSettings {
589589
private final String remoteStoreTranslogRepository;
590590
private final String remoteStoreRepository;
591591
private final boolean isRemoteSnapshot;
592-
private Version extendedCompatibilitySnapshotVersion;
592+
private final Version extendedCompatibilitySnapshotVersion;
593593

594594
// volatile fields are updated via #updateIndexMetadata(IndexMetadata) under lock
595595
private volatile Settings settings;
@@ -755,6 +755,7 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
755755
remoteStoreTranslogRepository = settings.get(IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY);
756756
remoteStoreRepository = settings.get(IndexMetadata.SETTING_REMOTE_STORE_REPOSITORY);
757757
isRemoteSnapshot = IndexModule.Type.REMOTE_SNAPSHOT.match(this.settings);
758+
758759
if (isRemoteSnapshot && FeatureFlags.isEnabled(SEARCHABLE_SNAPSHOT_EXTENDED_COMPATIBILITY)) {
759760
extendedCompatibilitySnapshotVersion = SEARCHABLE_SNAPSHOT_EXTENDED_COMPATIBILITY_MINIMUM_VERSION;
760761
} else {

0 commit comments

Comments
 (0)