Remove obsolete index setting `index.version.minimum_compatible`. (#23593)
This commit is contained in:
parent
0e95c90e9f
commit
4f694a3312
|
@ -226,7 +226,6 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContent {
|
|||
public static final String SETTING_VERSION_CREATED_STRING = "index.version.created_string";
|
||||
public static final String SETTING_VERSION_UPGRADED = "index.version.upgraded";
|
||||
public static final String SETTING_VERSION_UPGRADED_STRING = "index.version.upgraded_string";
|
||||
public static final String SETTING_VERSION_MINIMUM_COMPATIBLE = "index.version.minimum_compatible";
|
||||
public static final String SETTING_CREATION_DATE = "index.creation_date";
|
||||
/**
|
||||
* The user provided name for an index. This is the plain string provided by the user when the index was created.
|
||||
|
@ -311,7 +310,6 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContent {
|
|||
|
||||
private final Version indexCreatedVersion;
|
||||
private final Version indexUpgradedVersion;
|
||||
private final org.apache.lucene.util.Version minimumCompatibleLuceneVersion;
|
||||
|
||||
private final ActiveShardCount waitForActiveShards;
|
||||
|
||||
|
@ -319,7 +317,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContent {
|
|||
ImmutableOpenMap<String, MappingMetaData> mappings, ImmutableOpenMap<String, AliasMetaData> aliases,
|
||||
ImmutableOpenMap<String, Custom> customs, ImmutableOpenIntMap<Set<String>> inSyncAllocationIds,
|
||||
DiscoveryNodeFilters requireFilters, DiscoveryNodeFilters initialRecoveryFilters, DiscoveryNodeFilters includeFilters, DiscoveryNodeFilters excludeFilters,
|
||||
Version indexCreatedVersion, Version indexUpgradedVersion, org.apache.lucene.util.Version minimumCompatibleLuceneVersion,
|
||||
Version indexCreatedVersion, Version indexUpgradedVersion,
|
||||
int routingNumShards, int routingPartitionSize, ActiveShardCount waitForActiveShards) {
|
||||
|
||||
this.index = index;
|
||||
|
@ -341,7 +339,6 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContent {
|
|||
this.initialRecoveryFilters = initialRecoveryFilters;
|
||||
this.indexCreatedVersion = indexCreatedVersion;
|
||||
this.indexUpgradedVersion = indexUpgradedVersion;
|
||||
this.minimumCompatibleLuceneVersion = minimumCompatibleLuceneVersion;
|
||||
this.routingNumShards = routingNumShards;
|
||||
this.routingFactor = routingNumShards / numberOfShards;
|
||||
this.routingPartitionSize = routingPartitionSize;
|
||||
|
@ -401,13 +398,6 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContent {
|
|||
return indexUpgradedVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link org.apache.lucene.util.Version} of the oldest lucene segment in the index
|
||||
*/
|
||||
public org.apache.lucene.util.Version getMinimumCompatibleVersion() {
|
||||
return minimumCompatibleLuceneVersion;
|
||||
}
|
||||
|
||||
public long getCreationDate() {
|
||||
return settings.getAsLong(SETTING_CREATION_DATE, -1L);
|
||||
}
|
||||
|
@ -1052,17 +1042,6 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContent {
|
|||
}
|
||||
Version indexCreatedVersion = Version.indexCreated(settings);
|
||||
Version indexUpgradedVersion = settings.getAsVersion(IndexMetaData.SETTING_VERSION_UPGRADED, indexCreatedVersion);
|
||||
String stringLuceneVersion = settings.get(SETTING_VERSION_MINIMUM_COMPATIBLE);
|
||||
final org.apache.lucene.util.Version minimumCompatibleLuceneVersion;
|
||||
if (stringLuceneVersion != null) {
|
||||
try {
|
||||
minimumCompatibleLuceneVersion = org.apache.lucene.util.Version.parse(stringLuceneVersion);
|
||||
} catch (ParseException ex) {
|
||||
throw new IllegalStateException("Cannot parse lucene version [" + stringLuceneVersion + "] in the [" + SETTING_VERSION_MINIMUM_COMPATIBLE + "] setting", ex);
|
||||
}
|
||||
} else {
|
||||
minimumCompatibleLuceneVersion = null;
|
||||
}
|
||||
|
||||
if (primaryTerms == null) {
|
||||
initializePrimaryTerms();
|
||||
|
@ -1081,7 +1060,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContent {
|
|||
final String uuid = settings.get(SETTING_INDEX_UUID, INDEX_UUID_NA_VALUE);
|
||||
return new IndexMetaData(new Index(index, uuid), version, primaryTerms, state, numberOfShards, numberOfReplicas, tmpSettings, mappings.build(),
|
||||
tmpAliases.build(), customs.build(), filledInSyncAllocationIds.build(), requireFilters, initialRecoveryFilters, includeFilters, excludeFilters,
|
||||
indexCreatedVersion, indexUpgradedVersion, minimumCompatibleLuceneVersion, getRoutingNumShards(), routingPartitionSize, waitForActiveShards);
|
||||
indexCreatedVersion, indexUpgradedVersion, getRoutingNumShards(), routingPartitionSize, waitForActiveShards);
|
||||
}
|
||||
|
||||
public static void toXContent(IndexMetaData indexMetaData, XContentBuilder builder, ToXContent.Params params) throws IOException {
|
||||
|
|
|
@ -603,9 +603,6 @@ public class MetaDataCreateIndexService extends AbstractComponent {
|
|||
.put(IndexMetaData.SETTING_ROUTING_PARTITION_SIZE, sourceMetaData.getRoutingPartitionSize())
|
||||
.put(IndexMetaData.INDEX_SHRINK_SOURCE_NAME.getKey(), shrinkFromIndex.getName())
|
||||
.put(IndexMetaData.INDEX_SHRINK_SOURCE_UUID.getKey(), shrinkFromIndex.getUUID());
|
||||
if (sourceMetaData.getMinimumCompatibleVersion() != null) {
|
||||
indexSettingsBuilder.put(IndexMetaData.SETTING_VERSION_MINIMUM_COMPATIBLE, sourceMetaData.getMinimumCompatibleVersion());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -329,7 +329,6 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements
|
|||
// No reason to pollute the settings, we didn't really upgrade anything
|
||||
metaDataBuilder.put(IndexMetaData.builder(indexMetaData)
|
||||
.settings(Settings.builder().put(indexMetaData.getSettings())
|
||||
.put(IndexMetaData.SETTING_VERSION_MINIMUM_COMPATIBLE, entry.getValue().v2())
|
||||
.put(IndexMetaData.SETTING_VERSION_UPGRADED, entry.getValue().v1())
|
||||
)
|
||||
);
|
||||
|
|
|
@ -91,7 +91,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_INDEX_UUI
|
|||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_VERSION_CREATED;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_VERSION_MINIMUM_COMPATIBLE;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_VERSION_UPGRADED;
|
||||
import static org.elasticsearch.common.util.set.Sets.newHashSet;
|
||||
|
||||
|
@ -132,7 +131,6 @@ public class RestoreService extends AbstractComponent implements ClusterStateApp
|
|||
unremovable.add(SETTING_NUMBER_OF_REPLICAS);
|
||||
unremovable.add(SETTING_AUTO_EXPAND_REPLICAS);
|
||||
unremovable.add(SETTING_VERSION_UPGRADED);
|
||||
unremovable.add(SETTING_VERSION_MINIMUM_COMPATIBLE);
|
||||
UNREMOVABLE_SETTINGS = unmodifiableSet(unremovable);
|
||||
}
|
||||
|
||||
|
|
|
@ -191,8 +191,6 @@ public class MetaDataCreateIndexServiceTests extends ESTestCase {
|
|||
assertEquals("1", builder.build().get("index.allocation.max_retries"));
|
||||
assertEquals(version, builder.build().getAsVersion("index.version.created", null));
|
||||
assertEquals(upgraded, builder.build().getAsVersion("index.version.upgraded", null));
|
||||
assertEquals(minCompat.luceneVersion.toString(), builder.build().get("index.version.minimum_compatible", null));
|
||||
|
||||
}
|
||||
|
||||
private DiscoveryNode newNode(String nodeId) {
|
||||
|
|
|
@ -86,8 +86,7 @@ public class MetaDataIndexUpgradeServiceTests extends ESTestCase {
|
|||
final IndexMetaData metaData = newIndexMeta("foo", Settings.builder()
|
||||
.put(IndexMetaData.SETTING_VERSION_UPGRADED, Version.V_5_0_0_beta1)
|
||||
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.fromString("2.4.0"))
|
||||
.put(IndexMetaData.SETTING_VERSION_MINIMUM_COMPATIBLE,
|
||||
Version.CURRENT.luceneVersion.toString()).build());
|
||||
.build());
|
||||
String message = expectThrows(IllegalStateException.class, () -> service.upgradeIndexMetaData(metaData,
|
||||
Version.CURRENT.minimumIndexCompatibilityVersion())).getMessage();
|
||||
assertEquals(message, "The index [[foo/BOOM]] was created with version [2.4.0] but the minimum compatible version is [5.0.0]." +
|
||||
|
@ -96,8 +95,7 @@ public class MetaDataIndexUpgradeServiceTests extends ESTestCase {
|
|||
IndexMetaData goodMeta = newIndexMeta("foo", Settings.builder()
|
||||
.put(IndexMetaData.SETTING_VERSION_UPGRADED, Version.V_5_0_0_beta1)
|
||||
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.fromString("5.1.0"))
|
||||
.put(IndexMetaData.SETTING_VERSION_MINIMUM_COMPATIBLE,
|
||||
Version.CURRENT.luceneVersion.toString()).build());
|
||||
.build());
|
||||
service.upgradeIndexMetaData(goodMeta, Version.V_5_0_0.minimumIndexCompatibilityVersion());
|
||||
}
|
||||
|
||||
|
@ -113,5 +111,4 @@ public class MetaDataIndexUpgradeServiceTests extends ESTestCase {
|
|||
IndexMetaData metaData = IndexMetaData.builder(name).settings(build).build();
|
||||
return metaData;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue