Skip to content
Closed
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0359c4f
Address and remove all occurrences of the Java annotation @UpdateForV…
alexey-ivanov-es Dec 2, 2024
fea2615
Merge remote-tracking branch 'refs/remotes/upstream/main' into ES-9378
alexey-ivanov-es Dec 4, 2024
9355aa5
More changes for V9
alexey-ivanov-es Dec 4, 2024
af4d6d6
Remove unused versions
alexey-ivanov-es Dec 4, 2024
7ebfa1e
Fix compilation
alexey-ivanov-es Dec 4, 2024
dbfdffa
Fix compilation
alexey-ivanov-es Dec 4, 2024
7e16865
Remove unused import
alexey-ivanov-es Dec 4, 2024
75691c2
Checkstyle fixes
alexey-ivanov-es Dec 4, 2024
4f20def
Remove annotation (ES-9734)
alexey-ivanov-es Dec 4, 2024
73e715e
Merge branch 'main' into ES-9378
alexey-ivanov-es Dec 9, 2024
58866bd
Remove unused ThreadPoolTypes
alexey-ivanov-es Dec 9, 2024
2071242
Merge branch 'main' into ES-9378
alexey-ivanov-es Dec 11, 2024
16e5f4a
Merge remote-tracking branch 'refs/remotes/origin/ES-9378' into ES-9378
alexey-ivanov-es Dec 11, 2024
691ceb7
Revert changes about IndexVersions
alexey-ivanov-es Dec 11, 2024
1562b27
More updates for V9
alexey-ivanov-es Dec 11, 2024
6736d8c
Merge branch 'main' into ES-9378
alexey-ivanov-es Dec 11, 2024
cc9268c
Update TransportGetFeatureUpgradeStatusActionTests
alexey-ivanov-es Dec 11, 2024
852f4be
Merge branch 'main' into ES-9378
alexey-ivanov-es Dec 11, 2024
d7420d4
Update NodeEnvironment.getBestDowngradeVersion
alexey-ivanov-es Dec 12, 2024
00beba2
Merge branch 'main' into ES-9378
alexey-ivanov-es Dec 12, 2024
2708b04
Update NodeEnvironmentTests.testIndexCompatibilityChecks
alexey-ivanov-es Dec 12, 2024
f458502
Spotless
alexey-ivanov-es Dec 12, 2024
a7b77d1
Restore check in RestCompatibleVersionHelper
alexey-ivanov-es Dec 12, 2024
5fa378f
Merge branch 'main' into ES-9378
alexey-ivanov-es Dec 12, 2024
2b63f8c
Remove unused system property
alexey-ivanov-es Dec 12, 2024
cfcd121
Merge branch 'main' into ES-9378
alexey-ivanov-es Dec 13, 2024
cdc716a
Address review comments
alexey-ivanov-es Dec 13, 2024
662d81e
Revert "Remove unused versions"
alexey-ivanov-es Dec 13, 2024
5ccd08e
Restore index versions
alexey-ivanov-es Dec 13, 2024
d4e3d31
Revert "Remove unused system property"
alexey-ivanov-es Dec 16, 2024
cd9b451
Merge branch 'main' into ES-9378
alexey-ivanov-es Dec 16, 2024
d25d217
Merge branch 'main' into ES-9378
alexey-ivanov-es Dec 17, 2024
0910600
Merge branch 'main' into ES-9378
alexey-ivanov-es Dec 17, 2024
5fe78c0
Merge branch 'main' into ES-9378
alexey-ivanov-es Dec 18, 2024
85d45e7
Merge branch 'main' into ES-9378
alexey-ivanov-es Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ public void apply(Project project) {
// setup the test task
TaskProvider<? extends Test> yamlRestCompatTestTask = registerTestTask(project, yamlCompatTestSourceSet);
yamlRestCompatTestTask.configure(testTask -> {
testTask.systemProperty("tests.restCompat", true);
// Use test runner and classpath from "normal" yaml source set
FileCollection outputFileCollection = yamlCompatTestSourceSet.getOutput();
testTask.setTestClassesDirs(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;

import org.apache.lucene.tests.util.TimeUnits;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.cluster.FeatureFlag;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
Expand Down Expand Up @@ -43,15 +42,9 @@ public ClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate
super(testCandidate);
}

@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA) // remove restCompat check
@ParametersFactory
public static Iterable<Object[]> parameters() throws Exception {
String restCompatProperty = System.getProperty("tests.restCompat");
if ("true".equals(restCompatProperty)) {
return createParametersWithLegacyNodeSelectorSupport();
} else {
return createParameters();
}
return createParameters();
}

@Override
Expand Down
5 changes: 2 additions & 3 deletions server/src/main/java/org/elasticsearch/ReleaseVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
package org.elasticsearch;

import org.elasticsearch.common.Strings;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.core.UpdateForV10;
import org.elasticsearch.internal.BuildExtension;
import org.elasticsearch.plugins.ExtensionLoader;

Expand Down Expand Up @@ -114,8 +114,7 @@ private static IntFunction<String> lookupFunction(NavigableMap<Integer, List<Ver
// this will no longer be the case with ES 10 (which won't know about ES v8.x where we introduced separated versions)
// maybe keep the release mapping around in the csv file?
// SEP for now
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA)
// @UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA)
@UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA)
Version oldVersion = Version.fromId(id);
return oldVersion.toString();
}
Expand Down
20 changes: 9 additions & 11 deletions server/src/main/java/org/elasticsearch/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.core.Assertions;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.monitor.jvm.JvmInfo;
import org.elasticsearch.xcontent.ToXContentFragment;
import org.elasticsearch.xcontent.XContentBuilder;
Expand Down Expand Up @@ -238,17 +238,15 @@ public class Version implements VersionId<Version>, ToXContentFragment {
VERSION_STRINGS = Map.copyOf(builderByString);
}

@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA)
// Re-enable this assertion once the rest api version is bumped
private static void assertRestApiVersion() {
// assert RestApiVersion.current().major == CURRENT.major && RestApiVersion.previous().major == CURRENT.major - 1
// : "RestApiVersion must be upgraded "
// + "to reflect major from Version.CURRENT ["
// + CURRENT.major
// + "]"
// + " but is still set to ["
// + RestApiVersion.current().major
// + "]";
assert RestApiVersion.current().major == CURRENT.major && RestApiVersion.previous().major == CURRENT.major - 1
: "RestApiVersion must be upgraded "
+ "to reflect major from Version.CURRENT ["
+ CURRENT.major
+ "]"
+ " but is still set to ["
+ RestApiVersion.current().major
+ "]";
}

public static Version readVersion(StreamInput in) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.elasticsearch.common.xcontent.ChunkedToXContentHelper;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.index.shard.IndexLongFieldRange;
import org.elasticsearch.indices.SystemIndexDescriptor;
import org.elasticsearch.xcontent.ToXContent;
Expand Down Expand Up @@ -1037,12 +1036,6 @@ public static ClusterState readFrom(StreamInput in, DiscoveryNode localNode) thr
return builder.build();
}

/**
* If the cluster state does not contain transport version information, this is the version
* that is inferred for all nodes on version 8.8.0 or above.
*/
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA)
public static final TransportVersion INFERRED_TRANSPORT_VERSION = TransportVersions.V_8_8_0;
public static final Version VERSION_INTRODUCING_TRANSPORT_VERSIONS = Version.V_8_8_0;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,30 +510,6 @@ public Iterator<Setting<?>> settings() {
Property.ServerlessPublic
);

/**
* Legacy index setting, kept for 7.x BWC compatibility. This setting has no effect in 8.x. Do not use.
* TODO: Remove in 9.0
*/
@Deprecated
public static final Setting<String> INDEX_ROLLUP_SOURCE_UUID = Setting.simpleString(
"index.rollup.source.uuid",
Property.IndexScope,
Property.PrivateIndex,
Property.IndexSettingDeprecatedInV7AndRemovedInV8
);

/**
* Legacy index setting, kept for 7.x BWC compatibility. This setting has no effect in 8.x. Do not use.
* TODO: Remove in 9.0
*/
@Deprecated
public static final Setting<String> INDEX_ROLLUP_SOURCE_NAME = Setting.simpleString(
"index.rollup.source.name",
Property.IndexScope,
Property.PrivateIndex,
Property.IndexSettingDeprecatedInV7AndRemovedInV8
);

public static final String KEY_IN_SYNC_ALLOCATIONS = "in_sync_allocations";

public static final List<String> PARTIALLY_MOUNTED_INDEX_TIER_PREFERENCE = List.of(DataTier.DATA_FROZEN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,7 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
IndexSettings.MODE,
IndexMetadata.INDEX_ROUTING_PATH,
IndexSettings.TIME_SERIES_START_TIME,
IndexSettings.TIME_SERIES_END_TIME,

// Legacy index settings we must keep around for BWC from 7.x
EngineConfig.INDEX_OPTIMIZE_AUTO_GENERATED_IDS,
IndexMetadata.INDEX_ROLLUP_SOURCE_NAME,
IndexMetadata.INDEX_ROLLUP_SOURCE_UUID,
IndexSettings.MAX_ADJACENCY_MATRIX_FILTERS_SETTING,
IndexingSlowLog.INDEX_INDEXING_SLOWLOG_LEVEL_SETTING,
SearchSlowLog.INDEX_SEARCH_SLOWLOG_LEVEL,
Store.FORCE_RAM_TERM_DICT
IndexSettings.TIME_SERIES_END_TIME
);

public static final IndexScopedSettings DEFAULT_SCOPED_SETTINGS = new IndexScopedSettings(Settings.EMPTY, BUILT_IN_INDEX_SETTINGS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,10 @@ public enum Property {
PrivateIndex,

/**
* Indicates that this index-level setting was deprecated in {@link Version#V_7_17_0} and is
* forbidden in indices created from {@link Version#V_8_0_0} onwards.
* Indicates that this index-level setting was deprecated in {@link Version#V_8_18_0} and is
* forbidden in indices created from {@link Version#V_9_0_0} onwards.
*/
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA) // introduce IndexSettingDeprecatedInV8AndRemovedInV9 to replace this constant
IndexSettingDeprecatedInV7AndRemovedInV8,
IndexSettingDeprecatedInV8AndRemovedInV9,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need it?


/**
* Indicates that this setting is accessible by non-operator users (public) in serverless
Expand All @@ -175,7 +174,7 @@ public enum Property {
private static final EnumSet<Property> DEPRECATED_PROPERTIES = EnumSet.of(
Property.Deprecated,
Property.DeprecatedWarning,
Property.IndexSettingDeprecatedInV7AndRemovedInV8
Property.IndexSettingDeprecatedInV8AndRemovedInV9
);

@SuppressWarnings("this-escape")
Expand Down Expand Up @@ -214,7 +213,7 @@ private Setting(
checkPropertyRequiresIndexScope(propertiesAsSet, Property.NotCopyableOnResize);
checkPropertyRequiresIndexScope(propertiesAsSet, Property.InternalIndex);
checkPropertyRequiresIndexScope(propertiesAsSet, Property.PrivateIndex);
checkPropertyRequiresIndexScope(propertiesAsSet, Property.IndexSettingDeprecatedInV7AndRemovedInV8);
checkPropertyRequiresIndexScope(propertiesAsSet, Property.IndexSettingDeprecatedInV8AndRemovedInV9);
checkPropertyRequiresNodeScope(propertiesAsSet);
this.properties = propertiesAsSet;
}
Expand Down Expand Up @@ -449,15 +448,15 @@ public boolean hasIndexScope() {
private boolean isDeprecated() {
return properties.contains(Property.Deprecated)
|| properties.contains(Property.DeprecatedWarning)
|| properties.contains(Property.IndexSettingDeprecatedInV7AndRemovedInV8);
|| properties.contains(Property.IndexSettingDeprecatedInV8AndRemovedInV9);
}

private boolean isDeprecatedWarningOnly() {
return properties.contains(Property.DeprecatedWarning);
}

public boolean isDeprecatedAndRemoved() {
return properties.contains(Property.IndexSettingDeprecatedInV7AndRemovedInV8);
return properties.contains(Property.IndexSettingDeprecatedInV8AndRemovedInV9);
}

/**
Expand Down
30 changes: 9 additions & 21 deletions server/src/main/java/org/elasticsearch/env/NodeEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.lucene.store.NativeFSLockFactory;
import org.elasticsearch.Build;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodeRole;
Expand Down Expand Up @@ -86,8 +87,6 @@
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -525,7 +524,7 @@ static void checkForIndexCompatibility(Logger logger, DataPath... dataPaths) thr
logger.info("oldest index version recorded in NodeMetadata {}", metadata.oldestIndexVersion());

if (metadata.oldestIndexVersion().before(IndexVersions.MINIMUM_COMPATIBLE)) {
String bestDowngradeVersion = getBestDowngradeVersion(metadata.previousNodeVersion().toString());
BuildVersion bestDowngradeVersion = getBestDowngradeVersion(metadata.previousNodeVersion());
throw new IllegalStateException(
"Cannot start this node because it holds metadata for indices with version ["
+ metadata.oldestIndexVersion().toReleaseVersion()
Expand Down Expand Up @@ -1504,28 +1503,17 @@ private static void tryWriteTempFile(Path path) throws IOException {
/**
* Get a useful version string to direct a user's downgrade operation
*
* <p>If a user is trying to install 8.0 but has incompatible indices, the user should
* downgrade to 7.17.x. We return 7.17.0, unless the user is trying to upgrade from
* a 7.17.x release, in which case we return the last installed version.
* <p>If a user is trying to install 9.0 (current major) but has incompatible indices, the user should
* downgrade to 8.18.x (last minor of the previous major). We return 8.18.0, unless the user is trying to upgrade from
* a 8.18.x release, in which case we return the last installed version.
* @return Version to downgrade to
*/
// visible for testing
static String getBestDowngradeVersion(String previousNodeVersion) {
// this method should only be called in the context of an upgrade to 8.x
assert Build.current().version().startsWith("9.") == false;
Pattern pattern = Pattern.compile("^7\\.(\\d+)\\.\\d+$");
Matcher matcher = pattern.matcher(previousNodeVersion);
if (matcher.matches()) {
try {
int minorVersion = Integer.parseInt(matcher.group(1));
if (minorVersion >= 17) {
return previousNodeVersion;
}
} catch (NumberFormatException e) {
// continue and return default
}
static BuildVersion getBestDowngradeVersion(BuildVersion previousNodeVersion) {
if (previousNodeVersion.onOrAfterMinimumCompatible()) {
return previousNodeVersion;
}
return "7.17.0";
return BuildVersion.fromVersionId(Version.CURRENT.minimumCompatibilityVersion().id);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok to use Version here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not ideal. Maybe we need a BuildVersion.getMinimumCompatible method to calculate this without invoking Version. @ryan what do you think?

}

}
4 changes: 1 addition & 3 deletions server/src/main/java/org/elasticsearch/env/NodeMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.elasticsearch.env;

import org.elasticsearch.Build;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.gateway.MetadataStateFormat;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.IndexVersions;
Expand Down Expand Up @@ -158,12 +157,11 @@ public void setOldestIndexVersion(int oldestIndexVersion) {
this.oldestIndexVersion = IndexVersion.fromId(oldestIndexVersion);
}

@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA) // version is required in the node metadata from v9 onwards
public NodeMetadata build() {
final IndexVersion oldestIndexVersion;

if (this.nodeVersion == null) {
nodeVersion = BuildVersion.fromVersionId(0);
throw new IllegalStateException("Node version is required in node metadata");
}
if (this.previousNodeVersion == null) {
previousNodeVersion = nodeVersion;
Expand Down
14 changes: 0 additions & 14 deletions server/src/main/java/org/elasticsearch/index/IndexSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -748,20 +748,6 @@ public Iterator<Setting<?>> settings() {
Property.ServerlessPublic
);

/**
* Legacy index setting, kept for 7.x BWC compatibility. This setting has no effect in 8.x. Do not use.
* TODO: Remove in 9.0
*/
@Deprecated
public static final Setting<Integer> MAX_ADJACENCY_MATRIX_FILTERS_SETTING = Setting.intSetting(
"index.max_adjacency_matrix_filters",
100,
2,
Property.Dynamic,
Property.IndexScope,
Property.IndexSettingDeprecatedInV7AndRemovedInV8
);

/**
* The `index.mapping.ignore_above` setting defines the maximum length for the content of a field that will be indexed
* or stored. If the length of the field’s content exceeds this limit, the field value will be ignored during indexing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static NavigableMap<Integer, IndexVersion> getAllVersionIds(Class<?> cls) {
return Collections.unmodifiableNavigableMap(builder);
}

@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA)
@UpdateForV9(owner = UpdateForV9.Owner.SEARCH_FOUNDATIONS)
// We can simplify this once we've removed all references to index versions earlier than MINIMUM_COMPATIBLE
static Collection<IndexVersion> getAllVersions() {
return VERSION_IDS.values().stream().filter(v -> v.onOrAfter(MINIMUM_COMPATIBLE)).toList();
Expand Down
14 changes: 0 additions & 14 deletions server/src/main/java/org/elasticsearch/index/IndexingSlowLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,6 @@ public final class IndexingSlowLog implements IndexingOperationListener {
Property.IndexScope
);

/**
* Legacy index setting, kept for 7.x BWC compatibility. This setting has no effect in 8.x. Do not use.
* TODO: Remove in 9.0
*/
@Deprecated
public static final Setting<SlowLogLevel> INDEX_INDEXING_SLOWLOG_LEVEL_SETTING = new Setting<>(
INDEX_INDEXING_SLOWLOG_PREFIX + ".level",
SlowLogLevel.TRACE.name(),
SlowLogLevel::parse,
Property.Dynamic,
Property.IndexScope,
Property.IndexSettingDeprecatedInV7AndRemovedInV8
);

private static final Logger indexLogger = LogManager.getLogger(INDEX_INDEXING_SLOWLOG_PREFIX + ".index");

private final Index index;
Expand Down
14 changes: 0 additions & 14 deletions server/src/main/java/org/elasticsearch/index/SearchSlowLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,6 @@ public final class SearchSlowLog implements SearchOperationListener {
Property.IndexScope
);

/**
* Legacy index setting, kept for 7.x BWC compatibility. This setting has no effect in 8.x. Do not use.
* TODO: Remove in 9.0
*/
@Deprecated
public static final Setting<SlowLogLevel> INDEX_SEARCH_SLOWLOG_LEVEL = new Setting<>(
INDEX_SEARCH_SLOWLOG_PREFIX + ".level",
SlowLogLevel.TRACE.name(),
SlowLogLevel::parse,
Property.Dynamic,
Property.IndexScope,
Property.IndexSettingDeprecatedInV7AndRemovedInV8
);

private static final ToXContent.Params FORMAT_PARAMS = new ToXContent.MapParams(Collections.singletonMap("pretty", "false"));

public SearchSlowLog(IndexSettings indexSettings, SlowLogFieldProvider slowLogFieldProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,6 @@ public Supplier<RetentionLeases> retentionLeasesSupplier() {
// don't convert to Setting<> and register... we only set this in tests and register via a test plugin
public static final String USE_COMPOUND_FILE = "index.use_compound_file";

/**
* Legacy index setting, kept for 7.x BWC compatibility. This setting has no effect in 8.x. Do not use.
* TODO: Remove in 9.0
*/
@Deprecated
public static final Setting<Boolean> INDEX_OPTIMIZE_AUTO_GENERATED_IDS = Setting.boolSetting(
"index.optimize_auto_generated_id",
true,
Property.IndexScope,
Property.Dynamic,
Property.IndexSettingDeprecatedInV7AndRemovedInV8
);

private final TranslogConfig translogConfig;

private final LongSupplier relativeTimeInNanosSupplier;
Expand Down
Loading