64
64
import org .apache .lucene .util .BytesRefBuilder ;
65
65
import org .apache .lucene .util .Version ;
66
66
import org .opensearch .ExceptionsHelper ;
67
- import org .opensearch .LegacyESVersion ;
68
67
import org .opensearch .common .Nullable ;
69
68
import org .opensearch .common .UUIDs ;
70
69
import org .opensearch .common .bytes .BytesReference ;
87
86
import org .opensearch .env .NodeEnvironment ;
88
87
import org .opensearch .env .ShardLock ;
89
88
import org .opensearch .env .ShardLockObtainFailedException ;
90
- import org .opensearch .index .IndexModule ;
91
89
import org .opensearch .index .IndexSettings ;
92
90
import org .opensearch .index .engine .CombinedDeletionPolicy ;
93
91
import org .opensearch .index .engine .Engine ;
@@ -223,10 +221,8 @@ public Directory directory() {
223
221
public SegmentInfos readLastCommittedSegmentsInfo () throws IOException {
224
222
failIfCorrupted ();
225
223
try {
226
- if (IndexModule .Type .REMOTE_SNAPSHOT .match (indexSettings )
227
- && IndexSettings .SEARCHABLE_SNAPSHOT_MINIMUM_VERSION .exists (indexSettings .getSettings ())) {
228
- int minimumVersion = Integer .parseInt (IndexSettings .SEARCHABLE_SNAPSHOT_MINIMUM_VERSION .get (indexSettings .getSettings ()));
229
- return readAnySegmentsInfo (directory (), LegacyESVersion .fromId (minimumVersion ));
224
+ if (indexSettings .isRemoteSnapshot () && indexSettings .getExtendedCompatibilitySnapshotVersion () != null ) {
225
+ return readSegmentInfosExtendedCompatbility (directory (), indexSettings .getExtendedCompatibilitySnapshotVersion ());
230
226
} else {
231
227
return readSegmentsInfo (null , directory ());
232
228
}
@@ -239,7 +235,7 @@ public SegmentInfos readLastCommittedSegmentsInfo() throws IOException {
239
235
/**
240
236
* Returns the segments info for the given commit or for the latest commit if the given commit is <code>null</code>.
241
237
* This method will throw an exception if the index is older than the standard backwards compatibility
242
- * policy ( current major - 1). See also {@link #readAnySegmentsInfo (Directory, org.opensearch.Version)}.
238
+ * policy ( current major - 1). See also {@link #readSegmentInfosExtendedCompatbility (Directory, org.opensearch.Version)}.
243
239
*
244
240
* @throws IOException if the index is corrupted or the segments file is not present
245
241
*/
@@ -264,7 +260,8 @@ private static SegmentInfos readSegmentsInfo(IndexCommit commit, Directory direc
264
260
*
265
261
* @throws IOException if the index is corrupted or the segments file is not present
266
262
*/
267
- private static SegmentInfos readAnySegmentsInfo (Directory directory , org .opensearch .Version minimumVersion ) throws IOException {
263
+ private static SegmentInfos readSegmentInfosExtendedCompatbility (Directory directory , org .opensearch .Version minimumVersion )
264
+ throws IOException {
268
265
try {
269
266
return Lucene .readSegmentInfosExtendedCompatbility (directory , minimumVersion );
270
267
} catch (EOFException eof ) {
0 commit comments