|
@@ -39,7 +39,7 @@ import org.elasticsearch.index.mapper.MapperService;
|
|
|
import org.elasticsearch.plugins.MapperPlugin;
|
|
|
import org.elasticsearch.test.AbstractChunkedSerializingTestCase;
|
|
|
import org.elasticsearch.test.ESTestCase;
|
|
|
-import org.elasticsearch.test.VersionUtils;
|
|
|
+import org.elasticsearch.test.index.IndexVersionUtils;
|
|
|
import org.elasticsearch.xcontent.ToXContent;
|
|
|
import org.elasticsearch.xcontent.XContentBuilder;
|
|
|
import org.elasticsearch.xcontent.XContentParser;
|
|
@@ -1765,12 +1765,12 @@ public class MetadataTests extends ESTestCase {
|
|
|
public void testHiddenAliasValidation() {
|
|
|
final String hiddenAliasName = "hidden_alias";
|
|
|
|
|
|
- IndexMetadata hidden1 = buildIndexWithAlias("hidden1", hiddenAliasName, true, Version.CURRENT, false);
|
|
|
- IndexMetadata hidden2 = buildIndexWithAlias("hidden2", hiddenAliasName, true, Version.CURRENT, false);
|
|
|
- IndexMetadata hidden3 = buildIndexWithAlias("hidden3", hiddenAliasName, true, Version.CURRENT, false);
|
|
|
+ IndexMetadata hidden1 = buildIndexWithAlias("hidden1", hiddenAliasName, true, IndexVersion.current(), false);
|
|
|
+ IndexMetadata hidden2 = buildIndexWithAlias("hidden2", hiddenAliasName, true, IndexVersion.current(), false);
|
|
|
+ IndexMetadata hidden3 = buildIndexWithAlias("hidden3", hiddenAliasName, true, IndexVersion.current(), false);
|
|
|
|
|
|
- IndexMetadata nonHidden = buildIndexWithAlias("nonhidden1", hiddenAliasName, false, Version.CURRENT, false);
|
|
|
- IndexMetadata unspecified = buildIndexWithAlias("nonhidden2", hiddenAliasName, null, Version.CURRENT, false);
|
|
|
+ IndexMetadata nonHidden = buildIndexWithAlias("nonhidden1", hiddenAliasName, false, IndexVersion.current(), false);
|
|
|
+ IndexMetadata unspecified = buildIndexWithAlias("nonhidden2", hiddenAliasName, null, IndexVersion.current(), false);
|
|
|
|
|
|
{
|
|
|
// Should be ok:
|
|
@@ -1863,14 +1863,14 @@ public class MetadataTests extends ESTestCase {
|
|
|
}
|
|
|
|
|
|
public void testSystemAliasValidationMixedVersionSystemAndRegularFails() {
|
|
|
- final Version random7xVersion = VersionUtils.randomVersionBetween(
|
|
|
+ final IndexVersion random7xVersion = IndexVersionUtils.randomVersionBetween(
|
|
|
random(),
|
|
|
- Version.V_7_0_0,
|
|
|
- VersionUtils.getPreviousVersion(Version.V_8_0_0)
|
|
|
+ IndexVersion.V_7_0_0,
|
|
|
+ IndexVersionUtils.getPreviousVersion(IndexVersion.V_8_0_0)
|
|
|
);
|
|
|
- final IndexMetadata currentVersionSystem = buildIndexWithAlias(".system1", SYSTEM_ALIAS_NAME, null, Version.CURRENT, true);
|
|
|
+ final IndexMetadata currentVersionSystem = buildIndexWithAlias(".system1", SYSTEM_ALIAS_NAME, null, IndexVersion.current(), true);
|
|
|
final IndexMetadata oldVersionSystem = buildIndexWithAlias(".oldVersionSystem", SYSTEM_ALIAS_NAME, null, random7xVersion, true);
|
|
|
- final IndexMetadata regularIndex = buildIndexWithAlias("regular1", SYSTEM_ALIAS_NAME, false, Version.CURRENT, false);
|
|
|
+ final IndexMetadata regularIndex = buildIndexWithAlias("regular1", SYSTEM_ALIAS_NAME, false, IndexVersion.current(), false);
|
|
|
|
|
|
IllegalStateException exception = expectThrows(
|
|
|
IllegalStateException.class,
|
|
@@ -1891,8 +1891,8 @@ public class MetadataTests extends ESTestCase {
|
|
|
}
|
|
|
|
|
|
public void testSystemAliasValidationNewSystemAndRegularFails() {
|
|
|
- final IndexMetadata currentVersionSystem = buildIndexWithAlias(".system1", SYSTEM_ALIAS_NAME, null, Version.CURRENT, true);
|
|
|
- final IndexMetadata regularIndex = buildIndexWithAlias("regular1", SYSTEM_ALIAS_NAME, false, Version.CURRENT, false);
|
|
|
+ final IndexMetadata currentVersionSystem = buildIndexWithAlias(".system1", SYSTEM_ALIAS_NAME, null, IndexVersion.current(), true);
|
|
|
+ final IndexMetadata regularIndex = buildIndexWithAlias("regular1", SYSTEM_ALIAS_NAME, false, IndexVersion.current(), false);
|
|
|
|
|
|
IllegalStateException exception = expectThrows(
|
|
|
IllegalStateException.class,
|
|
@@ -1913,26 +1913,26 @@ public class MetadataTests extends ESTestCase {
|
|
|
}
|
|
|
|
|
|
public void testSystemAliasOldSystemAndNewRegular() {
|
|
|
- final Version random7xVersion = VersionUtils.randomVersionBetween(
|
|
|
+ final IndexVersion random7xVersion = IndexVersionUtils.randomVersionBetween(
|
|
|
random(),
|
|
|
- Version.V_7_0_0,
|
|
|
- VersionUtils.getPreviousVersion(Version.V_8_0_0)
|
|
|
+ IndexVersion.V_7_0_0,
|
|
|
+ IndexVersionUtils.getPreviousVersion(IndexVersion.V_8_0_0)
|
|
|
);
|
|
|
final IndexMetadata oldVersionSystem = buildIndexWithAlias(".oldVersionSystem", SYSTEM_ALIAS_NAME, null, random7xVersion, true);
|
|
|
- final IndexMetadata regularIndex = buildIndexWithAlias("regular1", SYSTEM_ALIAS_NAME, false, Version.CURRENT, false);
|
|
|
+ final IndexMetadata regularIndex = buildIndexWithAlias("regular1", SYSTEM_ALIAS_NAME, false, IndexVersion.current(), false);
|
|
|
|
|
|
// Should be ok:
|
|
|
metadataWithIndices(oldVersionSystem, regularIndex);
|
|
|
}
|
|
|
|
|
|
public void testSystemIndexValidationAllRegular() {
|
|
|
- final Version random7xVersion = VersionUtils.randomVersionBetween(
|
|
|
+ final IndexVersion random7xVersion = IndexVersionUtils.randomVersionBetween(
|
|
|
random(),
|
|
|
- Version.V_7_0_0,
|
|
|
- VersionUtils.getPreviousVersion(Version.V_8_0_0)
|
|
|
+ IndexVersion.V_7_0_0,
|
|
|
+ IndexVersionUtils.getPreviousVersion(IndexVersion.V_8_0_0)
|
|
|
);
|
|
|
- final IndexMetadata currentVersionSystem = buildIndexWithAlias(".system1", SYSTEM_ALIAS_NAME, null, Version.CURRENT, true);
|
|
|
- final IndexMetadata currentVersionSystem2 = buildIndexWithAlias(".system2", SYSTEM_ALIAS_NAME, null, Version.CURRENT, true);
|
|
|
+ final IndexMetadata currentVersionSystem = buildIndexWithAlias(".system1", SYSTEM_ALIAS_NAME, null, IndexVersion.current(), true);
|
|
|
+ final IndexMetadata currentVersionSystem2 = buildIndexWithAlias(".system2", SYSTEM_ALIAS_NAME, null, IndexVersion.current(), true);
|
|
|
final IndexMetadata oldVersionSystem = buildIndexWithAlias(".oldVersionSystem", SYSTEM_ALIAS_NAME, null, random7xVersion, true);
|
|
|
|
|
|
// Should be ok
|
|
@@ -1940,13 +1940,13 @@ public class MetadataTests extends ESTestCase {
|
|
|
}
|
|
|
|
|
|
public void testSystemAliasValidationAllSystemSomeOld() {
|
|
|
- final Version random7xVersion = VersionUtils.randomVersionBetween(
|
|
|
+ final IndexVersion random7xVersion = IndexVersionUtils.randomVersionBetween(
|
|
|
random(),
|
|
|
- Version.V_7_0_0,
|
|
|
- VersionUtils.getPreviousVersion(Version.V_8_0_0)
|
|
|
+ IndexVersion.V_7_0_0,
|
|
|
+ IndexVersionUtils.getPreviousVersion(IndexVersion.V_8_0_0)
|
|
|
);
|
|
|
- final IndexMetadata currentVersionSystem = buildIndexWithAlias(".system1", SYSTEM_ALIAS_NAME, null, Version.CURRENT, true);
|
|
|
- final IndexMetadata currentVersionSystem2 = buildIndexWithAlias(".system2", SYSTEM_ALIAS_NAME, null, Version.CURRENT, true);
|
|
|
+ final IndexMetadata currentVersionSystem = buildIndexWithAlias(".system1", SYSTEM_ALIAS_NAME, null, IndexVersion.current(), true);
|
|
|
+ final IndexMetadata currentVersionSystem2 = buildIndexWithAlias(".system2", SYSTEM_ALIAS_NAME, null, IndexVersion.current(), true);
|
|
|
final IndexMetadata oldVersionSystem = buildIndexWithAlias(".oldVersionSystem", SYSTEM_ALIAS_NAME, null, random7xVersion, true);
|
|
|
|
|
|
// Should be ok:
|
|
@@ -1954,8 +1954,8 @@ public class MetadataTests extends ESTestCase {
|
|
|
}
|
|
|
|
|
|
public void testSystemAliasValidationAll8x() {
|
|
|
- final IndexMetadata currentVersionSystem = buildIndexWithAlias(".system1", SYSTEM_ALIAS_NAME, null, Version.CURRENT, true);
|
|
|
- final IndexMetadata currentVersionSystem2 = buildIndexWithAlias(".system2", SYSTEM_ALIAS_NAME, null, Version.CURRENT, true);
|
|
|
+ final IndexMetadata currentVersionSystem = buildIndexWithAlias(".system1", SYSTEM_ALIAS_NAME, null, IndexVersion.current(), true);
|
|
|
+ final IndexMetadata currentVersionSystem2 = buildIndexWithAlias(".system2", SYSTEM_ALIAS_NAME, null, IndexVersion.current(), true);
|
|
|
|
|
|
// Should be ok
|
|
|
metadataWithIndices(currentVersionSystem, currentVersionSystem2);
|
|
@@ -1973,7 +1973,7 @@ public class MetadataTests extends ESTestCase {
|
|
|
String indexName,
|
|
|
String aliasName,
|
|
|
@Nullable Boolean aliasIsHidden,
|
|
|
- Version indexCreationVersion,
|
|
|
+ IndexVersion indexCreationVersion,
|
|
|
boolean isSystem
|
|
|
) {
|
|
|
final AliasMetadata.Builder aliasMetadata = new AliasMetadata.Builder(aliasName);
|