Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
Signed-off-by: Kartik Ganesh <gkart@amazon.com>
  • Loading branch information
kartg committed Dec 7, 2022
1 parent 54a8ebf commit 8fd8800
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions server/src/main/java/org/opensearch/snapshots/RestoreService.java
Original file line number Diff line number Diff line change
Expand Up @@ -1263,22 +1263,12 @@ private static IndexMetadata addSnapshotToIndexSettings(IndexMetadata metadata,
.put(metadata.getSettings());
// Check for extended backwards compatibility feature flag
if (isSearchableSnapshotsExtendedCompatibilityEnabled()) {
settingsBuilder.put(
IndexSettings.SEARCHABLE_SNAPSHOT_MINIMUM_VERSION.getKey(),
getSearchableSnapshotsExtendedCompatibilityMinimumVersion()
);
// The oldest snapshot version we can read is ES 6.0
settingsBuilder.put(IndexSettings.SEARCHABLE_SNAPSHOT_MINIMUM_VERSION.getKey(), 6000099);
}
return IndexMetadata.builder(metadata).settings(settingsBuilder.build()).build();
}

/**
* Currently, the oldest snapshot version we can successfully read using extended
* compatibility for searchable snapshots is ES 6.0
*/
private static int getSearchableSnapshotsExtendedCompatibilityMinimumVersion() {
return 6000099;
}

private static boolean isSearchableSnapshotsExtendedCompatibilityEnabled() {
return org.opensearch.Version.CURRENT.after(org.opensearch.Version.V_2_4_0)
&& FeatureFlags.isEnabled(SEARCHABLE_SNAPSHOT_EXTENDED_COMPATIBILITY);
Expand Down

0 comments on commit 8fd8800

Please sign in to comment.