|
@@ -131,7 +131,7 @@ import org.elasticsearch.index.translog.TranslogDeletionPolicy;
|
|
|
import org.elasticsearch.index.translog.TranslogOperationsUtils;
|
|
|
import org.elasticsearch.indices.breaker.NoneCircuitBreakerService;
|
|
|
import org.elasticsearch.test.IndexSettingsModule;
|
|
|
-import org.elasticsearch.test.VersionUtils;
|
|
|
+import org.elasticsearch.test.index.IndexVersionUtils;
|
|
|
import org.elasticsearch.threadpool.ThreadPool;
|
|
|
import org.elasticsearch.xcontent.XContentType;
|
|
|
import org.hamcrest.MatcherAssert;
|
|
@@ -140,6 +140,7 @@ import org.hamcrest.Matchers;
|
|
|
import java.io.Closeable;
|
|
|
import java.io.IOException;
|
|
|
import java.nio.charset.Charset;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Path;
|
|
|
import java.util.ArrayList;
|
|
@@ -6695,7 +6696,10 @@ public class InternalEngineTests extends EngineTestCase {
|
|
|
.settings(
|
|
|
Settings.builder()
|
|
|
.put(defaultSettings.getSettings())
|
|
|
- .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomPreviousCompatibleVersion(random(), Version.V_8_0_0))
|
|
|
+ .put(
|
|
|
+ IndexMetadata.SETTING_VERSION_CREATED,
|
|
|
+ IndexVersionUtils.randomPreviousCompatibleVersion(random(), IndexVersion.V_8_0_0).id()
|
|
|
+ )
|
|
|
.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), false)
|
|
|
)
|
|
|
.build();
|
|
@@ -6778,18 +6782,30 @@ public class InternalEngineTests extends EngineTestCase {
|
|
|
}
|
|
|
|
|
|
public void testStoreHonorsLuceneVersion() throws IOException {
|
|
|
- for (Version createdVersion : Arrays.asList(
|
|
|
- Version.CURRENT,
|
|
|
- VersionUtils.getPreviousMinorVersion(),
|
|
|
- VersionUtils.getFirstVersion()
|
|
|
+ // this expects a big IndexVersion bump when the lucene major version is bumped
|
|
|
+ IndexVersion lowestCompatiblePreviousVersion = IndexVersion.fromId((IndexVersion.current().id() / 1_000_000) * 1_000_000);
|
|
|
+
|
|
|
+ for (IndexVersion createdVersion : List.of(
|
|
|
+ IndexVersion.current(),
|
|
|
+ lowestCompatiblePreviousVersion,
|
|
|
+ IndexVersionUtils.getFirstVersion()
|
|
|
)) {
|
|
|
- Settings settings = Settings.builder().put(indexSettings()).put(IndexMetadata.SETTING_VERSION_CREATED, createdVersion).build();
|
|
|
+ Settings settings = Settings.builder()
|
|
|
+ .put(indexSettings())
|
|
|
+ .put(IndexMetadata.SETTING_VERSION_CREATED, createdVersion.id())
|
|
|
+ .build();
|
|
|
IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("test", settings);
|
|
|
try (
|
|
|
Store store = createStore(indexSettings, newDirectory());
|
|
|
InternalEngine engine = createEngine(config(indexSettings, store, createTempDir(), NoMergePolicy.INSTANCE, null))
|
|
|
) {
|
|
|
- ParsedDocument doc = testParsedDocument("1", null, new LuceneDocument(), new BytesArray("{}".getBytes("UTF-8")), null);
|
|
|
+ ParsedDocument doc = testParsedDocument(
|
|
|
+ "1",
|
|
|
+ null,
|
|
|
+ new LuceneDocument(),
|
|
|
+ new BytesArray("{}".getBytes(StandardCharsets.UTF_8)),
|
|
|
+ null
|
|
|
+ );
|
|
|
engine.index(appendOnlyPrimary(doc, false, 1));
|
|
|
engine.refresh("test");
|
|
|
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
|