Skip to content

Commit b17674b

Browse files
authored
Remove REST historical features (#116929)
1 parent f3cd482 commit b17674b

File tree

22 files changed

+116
-491
lines changed

22 files changed

+116
-491
lines changed

qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/FullClusterRestartDownsampleIT.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.elasticsearch.test.cluster.FeatureFlag;
1919
import org.elasticsearch.test.cluster.local.LocalClusterConfigProvider;
2020
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
21-
import org.elasticsearch.test.rest.RestTestLegacyFeatures;
2221
import org.junit.Before;
2322
import org.junit.ClassRule;
2423
import org.junit.rules.RuleChain;
@@ -269,10 +268,6 @@ private String getRollupIndexName() throws IOException {
269268
}
270269

271270
public void testRollupIndex() throws Exception {
272-
assumeTrue(
273-
"Downsample got many stability improvements in 8.10.0",
274-
oldClusterHasFeature(RestTestLegacyFeatures.TSDB_DOWNSAMPLING_STABLE)
275-
);
276271
if (isRunningAgainstOldCluster()) {
277272
createIlmPolicy();
278273
createIndex();

qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/FullClusterRestartIT.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
4242
import org.elasticsearch.test.rest.ESRestTestCase;
4343
import org.elasticsearch.test.rest.ObjectPath;
44-
import org.elasticsearch.test.rest.RestTestLegacyFeatures;
4544
import org.elasticsearch.xcontent.ToXContent;
4645
import org.elasticsearch.xcontent.XContentBuilder;
4746
import org.elasticsearch.xcontent.XContentType;
@@ -262,7 +261,6 @@ public void testNewReplicas() throws Exception {
262261
}
263262

264263
public void testSearchTimeSeriesMode() throws Exception {
265-
assumeTrue("indexing time series indices changed in 8.2.0", oldClusterHasFeature(RestTestLegacyFeatures.TSDB_NEW_INDEX_FORMAT));
266264
int numDocs;
267265
if (isRunningAgainstOldCluster()) {
268266
numDocs = createTimeSeriesModeIndex(1);
@@ -300,7 +298,6 @@ public void testSearchTimeSeriesMode() throws Exception {
300298
}
301299

302300
public void testNewReplicasTimeSeriesMode() throws Exception {
303-
assumeTrue("indexing time series indices changed in 8.2.0", oldClusterHasFeature(RestTestLegacyFeatures.TSDB_NEW_INDEX_FORMAT));
304301
if (isRunningAgainstOldCluster()) {
305302
createTimeSeriesModeIndex(0);
306303
} else {

qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/LogsIndexModeFullClusterRestartIT.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.elasticsearch.test.MapMatcher;
2121
import org.elasticsearch.test.cluster.ElasticsearchCluster;
2222
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
23-
import org.elasticsearch.test.rest.RestTestLegacyFeatures;
2423
import org.hamcrest.Matcher;
2524
import org.hamcrest.Matchers;
2625
import org.junit.ClassRule;
@@ -125,8 +124,6 @@ protected ElasticsearchCluster getUpgradeCluster() {
125124
}""";
126125

127126
public void testLogsIndexing() throws IOException {
128-
assumeTrue("Test uses data streams", oldClusterHasFeature(RestTestLegacyFeatures.DATA_STREAMS_SUPPORTED));
129-
130127
if (isRunningAgainstOldCluster()) {
131128
assertOK(client().performRequest(putTemplate(client(), "logs-template", STANDARD_TEMPLATE)));
132129
assertOK(client().performRequest(createDataStream("logs-apache-production")));

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/DesiredNodesUpgradeIT.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.elasticsearch.common.settings.Settings;
2222
import org.elasticsearch.common.unit.ByteSizeValue;
2323
import org.elasticsearch.common.xcontent.support.XContentMapValues;
24-
import org.elasticsearch.test.rest.RestTestLegacyFeatures;
2524
import org.elasticsearch.xcontent.json.JsonXContent;
2625

2726
import java.io.IOException;
@@ -49,8 +48,6 @@ private enum ProcessorsPrecision {
4948
}
5049

5150
public void testUpgradeDesiredNodes() throws Exception {
52-
assumeTrue("Desired nodes was introduced in 8.1", oldClusterHasFeature(RestTestLegacyFeatures.DESIRED_NODE_API_SUPPORTED));
53-
5451
if (oldClusterHasFeature(DesiredNode.DOUBLE_PROCESSORS_SUPPORTED)) {
5552
assertUpgradedNodesCanReadDesiredNodes();
5653
} else if (oldClusterHasFeature(DesiredNode.RANGE_FLOAT_PROCESSORS_SUPPORTED)) {

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/DownsampleIT.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.elasticsearch.client.Response;
1616
import org.elasticsearch.common.Strings;
1717
import org.elasticsearch.common.settings.Settings;
18-
import org.elasticsearch.test.rest.RestTestLegacyFeatures;
1918
import org.junit.Before;
2019

2120
import java.io.IOException;
@@ -244,10 +243,6 @@ private String getRollupIndexName() throws IOException {
244243
}
245244

246245
public void testRollupIndex() throws Exception {
247-
assumeTrue(
248-
"Downsample got many stability improvements in 8.10.0",
249-
oldClusterHasFeature(RestTestLegacyFeatures.TSDB_DOWNSAMPLING_STABLE)
250-
);
251246
if (isOldCluster()) {
252247
createIlmPolicy();
253248
createIndex();

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/IndexingIT.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
import org.elasticsearch.common.Strings;
1919
import org.elasticsearch.common.time.DateUtils;
2020
import org.elasticsearch.common.xcontent.support.XContentMapValues;
21+
import org.elasticsearch.core.UpdateForV9;
2122
import org.elasticsearch.index.mapper.DateFieldMapper;
2223
import org.elasticsearch.index.mapper.TimeSeriesIdFieldMapper;
2324
import org.elasticsearch.test.ListMatcher;
24-
import org.elasticsearch.test.rest.RestTestLegacyFeatures;
2525
import org.elasticsearch.xcontent.XContentBuilder;
2626
import org.elasticsearch.xcontent.XContentType;
2727
import org.elasticsearch.xcontent.json.JsonXContent;
@@ -258,7 +258,6 @@ private void bulk(String index, String valueSuffix, int count) throws IOExceptio
258258

259259
public void testTsdb() throws IOException {
260260
final Version oldClusterVersion = Version.fromString(getOldClusterVersion());
261-
assumeTrue("indexing time series indices changed in 8.2.0", oldClusterHasFeature(RestTestLegacyFeatures.TSDB_NEW_INDEX_FORMAT));
262261

263262
StringBuilder bulk = new StringBuilder();
264263
if (isOldCluster()) {
@@ -385,6 +384,7 @@ private void tsdbBulk(StringBuilder bulk, String dim, long timeStart, long timeE
385384

386385
private void assertTsdbAgg(final Version oldClusterVersion, final List<String> expectedTsids, final Matcher<?>... expected)
387386
throws IOException {
387+
@UpdateForV9(owner = UpdateForV9.Owner.SEARCH_ANALYTICS)
388388
boolean onOrAfterTsidHashingVersion = oldClusterVersion.onOrAfter(Version.V_8_13_0);
389389
Request request = new Request("POST", "/tsdb/_search");
390390
request.addParameter("size", "0");
@@ -414,8 +414,6 @@ private void assertTsdbAgg(final Version oldClusterVersion, final List<String> e
414414
}
415415

416416
public void testSyntheticSource() throws IOException {
417-
assumeTrue("added in 8.4.0", oldClusterHasFeature(RestTestLegacyFeatures.SYNTHETIC_SOURCE_SUPPORTED));
418-
419417
if (isOldCluster()) {
420418
Request createIndex = new Request("PUT", "/synthetic");
421419
XContentBuilder indexSpec = XContentBuilder.builder(XContentType.JSON.xContent()).startObject();

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SnapshotBasedRecoveryIT.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.elasticsearch.index.query.QueryBuilders;
2525
import org.elasticsearch.repositories.blobstore.BlobStoreRepository;
2626
import org.elasticsearch.search.builder.SearchSourceBuilder;
27-
import org.elasticsearch.test.rest.RestTestLegacyFeatures;
2827
import org.elasticsearch.xcontent.XContentBuilder;
2928

3029
import java.io.IOException;
@@ -50,12 +49,6 @@ public SnapshotBasedRecoveryIT(@Name("upgradedNodes") int upgradedNodes) {
5049
}
5150

5251
public void testSnapshotBasedRecovery() throws Exception {
53-
assumeTrue(
54-
"Cancel shard allocation command is broken for initial versions of the desired_balance allocator",
55-
oldClusterHasFeature(RestTestLegacyFeatures.DESIRED_BALANCED_ALLOCATOR_SUPPORTED) == false
56-
|| oldClusterHasFeature(RestTestLegacyFeatures.DESIRED_BALANCED_ALLOCATOR_FIXED)
57-
);
58-
5952
final String indexName = "snapshot_based_recovery";
6053
final String repositoryName = "snapshot_based_recovery_repo";
6154
final int numDocs = 200;

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TsdbIT.java

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.elasticsearch.common.time.DateFormatter;
1616
import org.elasticsearch.common.time.FormatNames;
1717
import org.elasticsearch.test.rest.ObjectPath;
18-
import org.elasticsearch.test.rest.RestTestLegacyFeatures;
1918

2019
import java.io.IOException;
2120
import java.time.Instant;
@@ -24,8 +23,6 @@
2423
import static org.elasticsearch.cluster.metadata.DataStreamTestHelper.backingIndexEqualTo;
2524
import static org.hamcrest.Matchers.equalTo;
2625
import static org.hamcrest.Matchers.hasSize;
27-
import static org.hamcrest.Matchers.notNullValue;
28-
import static org.hamcrest.Matchers.nullValue;
2926

3027
public class TsdbIT extends AbstractRollingUpgradeTestCase {
3128

@@ -131,7 +128,6 @@ public TsdbIT(@Name("upgradedNodes") int upgradedNodes) {
131128
""";
132129

133130
public void testTsdbDataStream() throws Exception {
134-
assumeTrue("TSDB was GA-ed in 8.7.0", oldClusterHasFeature(RestTestLegacyFeatures.TSDB_GENERALLY_AVAILABLE));
135131
String dataStreamName = "k8s";
136132
if (isOldCluster()) {
137133
final String INDEX_TEMPLATE = """
@@ -155,70 +151,6 @@ public void testTsdbDataStream() throws Exception {
155151
}
156152
}
157153

158-
public void testTsdbDataStreamWithComponentTemplate() throws Exception {
159-
assumeTrue(
160-
"TSDB was GA-ed in 8.7.0 and bug was fixed in 8.11.0",
161-
oldClusterHasFeature(RestTestLegacyFeatures.TSDB_GENERALLY_AVAILABLE)
162-
&& (oldClusterHasFeature(RestTestLegacyFeatures.TSDB_EMPTY_TEMPLATE_FIXED) == false)
163-
);
164-
String dataStreamName = "template-with-component-template";
165-
if (isOldCluster()) {
166-
final String COMPONENT_TEMPLATE = """
167-
{
168-
"template": $TEMPLATE
169-
}
170-
""";
171-
var putComponentTemplate = new Request("POST", "/_component_template/1");
172-
String template = TEMPLATE.replace("\"time_series\"", "\"time_series\", \"routing_path\": [\"k8s.pod.uid\"]");
173-
putComponentTemplate.setJsonEntity(COMPONENT_TEMPLATE.replace("$TEMPLATE", template));
174-
assertOK(client().performRequest(putComponentTemplate));
175-
final String INDEX_TEMPLATE = """
176-
{
177-
"index_patterns": ["$PATTERN"],
178-
"composed_of": ["1"],
179-
"data_stream": {
180-
}
181-
}""";
182-
// Add composable index template
183-
String templateName = "2";
184-
var putIndexTemplateRequest = new Request("POST", "/_index_template/" + templateName);
185-
putIndexTemplateRequest.setJsonEntity(INDEX_TEMPLATE.replace("$PATTERN", dataStreamName));
186-
assertOK(client().performRequest(putIndexTemplateRequest));
187-
188-
performOldClustertOperations(templateName, dataStreamName);
189-
} else if (isMixedCluster()) {
190-
performMixedClusterOperations(dataStreamName);
191-
} else if (isUpgradedCluster()) {
192-
performUpgradedClusterOperations(dataStreamName);
193-
194-
var dataStreams = getDataStream(dataStreamName);
195-
assertThat(ObjectPath.evaluate(dataStreams, "data_streams.0.name"), equalTo(dataStreamName));
196-
assertThat(ObjectPath.evaluate(dataStreams, "data_streams.0.generation"), equalTo(2));
197-
String firstBackingIndex = ObjectPath.evaluate(dataStreams, "data_streams.0.indices.0.index_name");
198-
{
199-
var indices = getIndex(firstBackingIndex);
200-
var escapedBackingIndex = firstBackingIndex.replace(".", "\\.");
201-
assertThat(ObjectPath.evaluate(indices, escapedBackingIndex + ".data_stream"), equalTo(dataStreamName));
202-
assertThat(ObjectPath.evaluate(indices, escapedBackingIndex + ".settings.index.mode"), nullValue());
203-
String startTime = ObjectPath.evaluate(indices, escapedBackingIndex + ".settings.index.time_series.start_time");
204-
assertThat(startTime, nullValue());
205-
String endTime = ObjectPath.evaluate(indices, escapedBackingIndex + ".settings.index.time_series.end_time");
206-
assertThat(endTime, nullValue());
207-
}
208-
String secondBackingIndex = ObjectPath.evaluate(dataStreams, "data_streams.0.indices.1.index_name");
209-
{
210-
var indices = getIndex(secondBackingIndex);
211-
var escapedBackingIndex = secondBackingIndex.replace(".", "\\.");
212-
assertThat(ObjectPath.evaluate(indices, escapedBackingIndex + ".data_stream"), equalTo(dataStreamName));
213-
assertThat(ObjectPath.evaluate(indices, escapedBackingIndex + ".settings.index.mode"), equalTo("time_series"));
214-
String startTime = ObjectPath.evaluate(indices, escapedBackingIndex + ".settings.index.time_series.start_time");
215-
assertThat(startTime, notNullValue());
216-
String endTime = ObjectPath.evaluate(indices, escapedBackingIndex + ".settings.index.time_series.end_time");
217-
assertThat(endTime, notNullValue());
218-
}
219-
}
220-
}
221-
222154
private void performUpgradedClusterOperations(String dataStreamName) throws Exception {
223155
ensureGreen(dataStreamName);
224156
var rolloverRequest = new Request("POST", "/" + dataStreamName + "/_rollover");

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/UpgradeWithOldIndexSettingsIT.java

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@
1717
import org.elasticsearch.common.settings.Settings;
1818
import org.elasticsearch.common.xcontent.support.XContentMapValues;
1919
import org.elasticsearch.core.Strings;
20-
import org.elasticsearch.test.rest.RestTestLegacyFeatures;
2120

2221
import java.io.IOException;
2322
import java.util.Map;
2423

2524
import static org.elasticsearch.rest.action.search.RestSearchAction.TOTAL_HITS_AS_INT_PARAM;
26-
import static org.hamcrest.Matchers.is;
2725

2826
public class UpgradeWithOldIndexSettingsIT extends AbstractRollingUpgradeTestCase {
2927

@@ -35,33 +33,22 @@ public UpgradeWithOldIndexSettingsIT(@Name("upgradedNodes") int upgradedNodes) {
3533
private static final String EXPECTED_WARNING = "[index.indexing.slowlog.level] setting was deprecated in Elasticsearch and will "
3634
+ "be removed in a future release! See the breaking changes documentation for the next major version.";
3735

38-
private static final String EXPECTED_V8_WARNING = "[index.indexing.slowlog.level] setting was deprecated in the previous Elasticsearch"
39-
+ " release and is removed in this release.";
40-
4136
public void testOldIndexSettings() throws Exception {
4237
if (isOldCluster()) {
4338
Request createTestIndex = new Request("PUT", "/" + INDEX_NAME);
4439
createTestIndex.setJsonEntity("{\"settings\": {\"index.indexing.slowlog.level\": \"WARN\"}}");
4540
createTestIndex.setOptions(expectWarnings(EXPECTED_WARNING));
46-
if (oldClusterHasFeature(RestTestLegacyFeatures.INDEXING_SLOWLOG_LEVEL_SETTING_REMOVED)) {
47-
assertTrue(
48-
expectThrows(ResponseException.class, () -> client().performRequest(createTestIndex)).getMessage()
49-
.contains("unknown setting [index.indexing.slowlog.level]")
50-
);
41+
assertTrue(
42+
expectThrows(ResponseException.class, () -> client().performRequest(createTestIndex)).getMessage()
43+
.contains("unknown setting [index.indexing.slowlog.level]")
44+
);
5145

52-
Request createTestIndex1 = new Request("PUT", "/" + INDEX_NAME);
53-
client().performRequest(createTestIndex1);
54-
} else {
55-
// create index with settings no longer valid in 8.0
56-
client().performRequest(createTestIndex);
57-
}
46+
Request createTestIndex1 = new Request("PUT", "/" + INDEX_NAME);
47+
client().performRequest(createTestIndex1);
5848

5949
// add some data
6050
Request bulk = new Request("POST", "/_bulk");
6151
bulk.addParameter("refresh", "true");
62-
if (oldClusterHasFeature(RestTestLegacyFeatures.INDEXING_SLOWLOG_LEVEL_SETTING_REMOVED) == false) {
63-
bulk.setOptions(expectWarnings(EXPECTED_WARNING));
64-
}
6552
bulk.setJsonEntity(Strings.format("""
6653
{"index": {"_index": "%s"}}
6754
{"f1": "v1", "f2": "v2"}
@@ -71,34 +58,12 @@ public void testOldIndexSettings() throws Exception {
7158
// add some more data
7259
Request bulk = new Request("POST", "/_bulk");
7360
bulk.addParameter("refresh", "true");
74-
if (oldClusterHasFeature(RestTestLegacyFeatures.INDEXING_SLOWLOG_LEVEL_SETTING_REMOVED) == false) {
75-
bulk.setOptions(expectWarnings(EXPECTED_WARNING));
76-
}
7761
bulk.setJsonEntity(Strings.format("""
7862
{"index": {"_index": "%s"}}
7963
{"f1": "v3", "f2": "v4"}
8064
""", INDEX_NAME));
8165
client().performRequest(bulk);
8266
} else {
83-
if (oldClusterHasFeature(RestTestLegacyFeatures.INDEXING_SLOWLOG_LEVEL_SETTING_REMOVED) == false) {
84-
Request createTestIndex = new Request("PUT", "/" + INDEX_NAME + "/_settings");
85-
// update index settings should work
86-
createTestIndex.setJsonEntity("{\"index.indexing.slowlog.level\": \"INFO\"}");
87-
createTestIndex.setOptions(expectWarnings(EXPECTED_V8_WARNING));
88-
client().performRequest(createTestIndex);
89-
90-
// ensure we were able to change the setting, despite it having no effect
91-
Request indexSettingsRequest = new Request("GET", "/" + INDEX_NAME + "/_settings");
92-
Map<String, Object> response = entityAsMap(client().performRequest(indexSettingsRequest));
93-
94-
var slowLogLevel = (String) (XContentMapValues.extractValue(
95-
INDEX_NAME + ".settings.index.indexing.slowlog.level",
96-
response
97-
));
98-
99-
// check that we can read our old index settings
100-
assertThat(slowLogLevel, is("INFO"));
101-
}
10267
assertCount(INDEX_NAME, 2);
10368
}
10469
}
@@ -118,16 +83,6 @@ private void assertCount(String index, int countAtLeast) throws IOException {
11883
public static void updateIndexSettingsPermittingSlowlogDeprecationWarning(String index, Settings.Builder settings) throws IOException {
11984
Request request = new Request("PUT", "/" + index + "/_settings");
12085
request.setJsonEntity(org.elasticsearch.common.Strings.toString(settings.build()));
121-
if (oldClusterHasFeature(RestTestLegacyFeatures.DEPRECATION_WARNINGS_LEAK_FIXED) == false) {
122-
// There is a bug (fixed in 7.17.9 and 8.7.0 where deprecation warnings could leak into ClusterApplierService#applyChanges)
123-
// Below warnings are set (and leaking) from an index in this test case
124-
request.setOptions(expectVersionSpecificWarnings(v -> {
125-
v.compatible(
126-
"[index.indexing.slowlog.level] setting was deprecated in Elasticsearch and will be removed in a future release! "
127-
+ "See the breaking changes documentation for the next major version."
128-
);
129-
}));
130-
}
13186
client().performRequest(request);
13287
}
13388
}

test/framework/src/main/java/org/elasticsearch/cluster/metadata/DataStreamTestHelper.java

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -157,23 +157,14 @@ public static DataStream newInstance(
157157
.build();
158158
}
159159

160-
public static String getLegacyDefaultBackingIndexName(
161-
String dataStreamName,
162-
long generation,
163-
long epochMillis,
164-
boolean isNewIndexNameFormat
165-
) {
166-
if (isNewIndexNameFormat) {
167-
return String.format(
168-
Locale.ROOT,
169-
BACKING_INDEX_PREFIX + "%s-%s-%06d",
170-
dataStreamName,
171-
DATE_FORMATTER.formatMillis(epochMillis),
172-
generation
173-
);
174-
} else {
175-
return getLegacyDefaultBackingIndexName(dataStreamName, generation);
176-
}
160+
public static String getLegacyDefaultBackingIndexName(String dataStreamName, long generation, long epochMillis) {
161+
return String.format(
162+
Locale.ROOT,
163+
BACKING_INDEX_PREFIX + "%s-%s-%06d",
164+
dataStreamName,
165+
DATE_FORMATTER.formatMillis(epochMillis),
166+
generation
167+
);
177168
}
178169

179170
public static String getLegacyDefaultBackingIndexName(String dataStreamName, long generation) {

0 commit comments

Comments
 (0)