From c47aca4e2d680b968ed54a311c00c72a7a649008 Mon Sep 17 00:00:00 2001 From: Kartik Ganesh Date: Mon, 9 Jan 2023 14:44:18 -0800 Subject: [PATCH] Fixed unit tests All unit tests pass and the code compiles, but actual functionality is still broken because some backwards compatibility logic was removed in the current branch that is retained in 2.x Signed-off-by: Kartik Ganesh --- server/src/main/java/org/opensearch/LegacyESVersion.java | 2 ++ .../index/store/remote/directory/RemoteSnapshotDirectory.java | 2 +- .../src/test/java/org/opensearch/common/lucene/LuceneTests.java | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/opensearch/LegacyESVersion.java b/server/src/main/java/org/opensearch/LegacyESVersion.java index 8cd60084ad710..f0d1e3356c542 100644 --- a/server/src/main/java/org/opensearch/LegacyESVersion.java +++ b/server/src/main/java/org/opensearch/LegacyESVersion.java @@ -48,6 +48,8 @@ */ public class LegacyESVersion extends Version { + public static final LegacyESVersion V_6_0_0 = new LegacyESVersion(6000099, org.apache.lucene.util.Version.fromBits(7, 0, 0)); + // todo move back to Version.java if retiring legacy version support protected static final ImmutableOpenIntMap idToVersion; protected static final ImmutableOpenMap stringToVersion; diff --git a/server/src/main/java/org/opensearch/index/store/remote/directory/RemoteSnapshotDirectory.java b/server/src/main/java/org/opensearch/index/store/remote/directory/RemoteSnapshotDirectory.java index e723c831b213d..840dc37569081 100644 --- a/server/src/main/java/org/opensearch/index/store/remote/directory/RemoteSnapshotDirectory.java +++ b/server/src/main/java/org/opensearch/index/store/remote/directory/RemoteSnapshotDirectory.java @@ -38,7 +38,7 @@ */ public final class RemoteSnapshotDirectory extends Directory { - public static final Version SEARCHABLE_SNAPSHOT_EXTENDED_COMPATIBILITY_MINIMUM_VERSION = LegacyESVersion.fromId(6000099); + public static final Version SEARCHABLE_SNAPSHOT_EXTENDED_COMPATIBILITY_MINIMUM_VERSION = LegacyESVersion.V_6_0_0; private static final String VIRTUAL_FILE_PREFIX = BlobStoreRepository.VIRTUAL_DATA_BLOB_PREFIX; diff --git a/server/src/test/java/org/opensearch/common/lucene/LuceneTests.java b/server/src/test/java/org/opensearch/common/lucene/LuceneTests.java index 67ff269a5827c..966c47b2f42d9 100644 --- a/server/src/test/java/org/opensearch/common/lucene/LuceneTests.java +++ b/server/src/test/java/org/opensearch/common/lucene/LuceneTests.java @@ -334,7 +334,7 @@ public void testNumDocs() throws IOException { */ public void testReadSegmentInfosExtendedCompatibility() throws IOException { final String pathToTestIndex = "/indices/bwc/es-6.3.0/testIndex-es-6.3.0.zip"; - final Version minVersion = LegacyESVersion.fromId(6000099); + final Version minVersion = LegacyESVersion.V_6_0_0; Path tmp = createTempDir(); TestUtil.unzip(getClass().getResourceAsStream(pathToTestIndex), tmp); try (MockDirectoryWrapper dir = newMockFSDirectory(tmp)) {