Skip to content

Commit 79212da

Browse files
author
Christoph Büscher
committed
Remove handling of 6.0.x versions
Relates to #41164.
1 parent 0531987 commit 79212da

File tree

46 files changed

+110
-747
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+110
-747
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/core/MainResponseTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected org.elasticsearch.action.main.MainResponse createServerTestInstance()
3838
ClusterName clusterName = new ClusterName(randomAlphaOfLength(10));
3939
String nodeName = randomAlphaOfLength(10);
4040
final String date = new Date(randomNonNegativeLong()).toString();
41-
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_0_1, Version.CURRENT);
41+
Version version = VersionUtils.randomVersionBetween(random(), Version.CURRENT.minimumCompatibilityVersion(), Version.CURRENT);
4242
Build build = new Build(
4343
Build.Flavor.UNKNOWN, Build.Type.UNKNOWN, randomAlphaOfLength(8), date, randomBoolean(),
4444
version.toString()

modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorMatchedSlotSubFetchPhase.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ public void hitsExecute(SearchContext context, SearchHit[] hits) throws IOExcept
6161
innerHitsExecute(context.query(), context.searcher(), hits);
6262
}
6363

64-
static void innerHitsExecute(Query mainQuery,
65-
IndexSearcher indexSearcher,
66-
SearchHit[] hits) throws IOException {
64+
static void innerHitsExecute(Query mainQuery, IndexSearcher indexSearcher, SearchHit[] hits) throws IOException {
6765
List<PercolateQuery> percolateQueries = locatePercolatorQuery(mainQuery);
6866
if (percolateQueries.isEmpty()) {
6967
return;

modules/percolator/src/test/java/org/elasticsearch/percolator/PercolatorFieldMapperTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,6 @@ public void testCreateCandidateQuery_oldIndex() throws Exception {
412412
assertThat(t.v1().clauses().get(0).getQuery(), instanceOf(CoveringQuery.class));
413413
assertThat(t.v1().clauses().get(1).getQuery(), instanceOf(TermQuery.class));
414414

415-
t = fieldType.createCandidateQuery(indexReader, Version.V_6_0_0);
416-
assertTrue(t.v2());
417-
assertEquals(2, t.v1().clauses().size());
418-
assertThat(t.v1().clauses().get(0).getQuery(), instanceOf(TermInSetQuery.class));
419-
assertThat(t.v1().clauses().get(1).getQuery(), instanceOf(TermQuery.class));
420415
}
421416

422417
public void testExtractTermsAndRanges_numberFields() throws Exception {

modules/percolator/src/test/java/org/elasticsearch/percolator/QueryAnalyzerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.apache.lucene.queries.BlendedTermQuery;
3131
import org.apache.lucene.queries.CommonTermsQuery;
3232
import org.apache.lucene.search.BooleanClause;
33+
import org.apache.lucene.search.BooleanClause.Occur;
3334
import org.apache.lucene.search.BooleanQuery;
3435
import org.apache.lucene.search.BoostQuery;
3536
import org.apache.lucene.search.ConstantScoreQuery;
@@ -44,7 +45,6 @@
4445
import org.apache.lucene.search.TermInSetQuery;
4546
import org.apache.lucene.search.TermQuery;
4647
import org.apache.lucene.search.TermRangeQuery;
47-
import org.apache.lucene.search.BooleanClause.Occur;
4848
import org.apache.lucene.search.join.QueryBitSetProducer;
4949
import org.apache.lucene.search.join.ScoreMode;
5050
import org.apache.lucene.search.spans.SpanFirstQuery;
@@ -61,6 +61,7 @@
6161
import org.elasticsearch.index.search.ESToParentBlockJoinQuery;
6262
import org.elasticsearch.percolator.QueryAnalyzer.QueryExtraction;
6363
import org.elasticsearch.percolator.QueryAnalyzer.Result;
64+
import org.elasticsearch.percolator.QueryAnalyzer.UnsupportedQueryException;
6465
import org.elasticsearch.test.ESTestCase;
6566

6667
import java.util.ArrayList;
@@ -73,7 +74,6 @@
7374
import java.util.function.Consumer;
7475
import java.util.stream.Collectors;
7576

76-
import static org.elasticsearch.percolator.QueryAnalyzer.UnsupportedQueryException;
7777
import static org.elasticsearch.percolator.QueryAnalyzer.analyze;
7878
import static org.hamcrest.Matchers.equalTo;
7979
import static org.hamcrest.Matchers.is;

server/src/main/java/org/elasticsearch/Version.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ public class Version implements Comparable<Version>, ToXContentFragment {
4646
*/
4747
public static final int V_EMPTY_ID = 0;
4848
public static final Version V_EMPTY = new Version(V_EMPTY_ID, org.apache.lucene.util.Version.LATEST);
49-
public static final int V_6_0_0_ID = 6000099;
50-
public static final Version V_6_0_0 =
51-
new Version(V_6_0_0_ID, org.apache.lucene.util.Version.LUCENE_7_0_1);
52-
public static final int V_6_0_1_ID = 6000199;
53-
public static final Version V_6_0_1 =
54-
new Version(V_6_0_1_ID, org.apache.lucene.util.Version.LUCENE_7_0_1);
5549
public static final int V_6_1_0_ID = 6010099;
5650
public static final Version V_6_1_0 = new Version(V_6_1_0_ID, org.apache.lucene.util.Version.LUCENE_7_1_0);
5751
public static final int V_6_1_1_ID = 6010199;
@@ -212,10 +206,6 @@ public static Version fromId(int id) {
212206
return V_6_1_1;
213207
case V_6_1_0_ID:
214208
return V_6_1_0;
215-
case V_6_0_1_ID:
216-
return V_6_0_1;
217-
case V_6_0_0_ID:
218-
return V_6_0_0;
219209
case V_EMPTY_ID:
220210
return V_EMPTY;
221211
default:

server/src/test/java/org/elasticsearch/action/admin/cluster/settings/ClusterUpdateSettingsResponseTests.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@
1919

2020
package org.elasticsearch.action.admin.cluster.settings;
2121

22-
import org.elasticsearch.Version;
2322
import org.elasticsearch.common.settings.ClusterSettings;
2423
import org.elasticsearch.common.settings.Setting;
2524
import org.elasticsearch.common.settings.Settings;
2625
import org.elasticsearch.common.settings.Settings.Builder;
2726
import org.elasticsearch.common.xcontent.XContentParser;
2827
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
29-
import org.elasticsearch.test.VersionUtils;
3028

31-
import java.io.IOException;
3229
import java.util.List;
3330
import java.util.Set;
3431
import java.util.function.Predicate;
@@ -99,9 +96,4 @@ protected ClusterUpdateSettingsResponse createTestInstance() {
9996
protected ClusterUpdateSettingsResponse createBlankInstance() {
10097
return new ClusterUpdateSettingsResponse();
10198
}
102-
103-
public void testOldSerialisation() throws IOException {
104-
ClusterUpdateSettingsResponse original = createTestInstance();
105-
assertSerialization(original, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, Version.V_6_4_0));
106-
}
10799
}

server/src/test/java/org/elasticsearch/action/admin/indices/close/CloseIndexResponseTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void testBwcSerialization() throws Exception {
4848
{
4949
final CloseIndexResponse response = randomResponse();
5050
try (BytesStreamOutput out = new BytesStreamOutput()) {
51-
out.setVersion(randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_2_0)));
51+
out.setVersion(randomVersionBetween(random(), Version.V_7_0_0, VersionUtils.getPreviousVersion(Version.V_7_2_0)));
5252
response.writeTo(out);
5353

5454
final AcknowledgedResponse deserializedResponse = new AcknowledgedResponse();
@@ -65,7 +65,7 @@ public void testBwcSerialization() throws Exception {
6565

6666
final CloseIndexResponse deserializedResponse = new CloseIndexResponse();
6767
try (StreamInput in = out.bytes().streamInput()) {
68-
in.setVersion(randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_2_0)));
68+
in.setVersion(randomVersionBetween(random(), Version.V_7_0_0, VersionUtils.getPreviousVersion(Version.V_7_2_0)));
6969
deserializedResponse.readFrom(in);
7070
}
7171
assertThat(deserializedResponse.isAcknowledged(), equalTo(response.isAcknowledged()));

server/src/test/java/org/elasticsearch/action/admin/indices/rollover/RolloverResponseTests.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@
2020
package org.elasticsearch.action.admin.indices.rollover;
2121

2222

23-
import org.elasticsearch.Version;
2423
import org.elasticsearch.common.unit.ByteSizeValue;
2524
import org.elasticsearch.common.unit.TimeValue;
2625
import org.elasticsearch.common.xcontent.XContentParser;
2726
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
28-
import org.elasticsearch.test.VersionUtils;
2927

30-
import java.io.IOException;
3128
import java.util.ArrayList;
3229
import java.util.HashMap;
3330
import java.util.List;
@@ -131,9 +128,4 @@ protected RolloverResponse mutateInstance(RolloverResponse response) {
131128
throw new UnsupportedOperationException();
132129
}
133130
}
134-
135-
public void testOldSerialisation() throws IOException {
136-
RolloverResponse original = createTestInstance();
137-
assertSerialization(original, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, Version.V_6_4_0));
138-
}
139131
}

server/src/test/java/org/elasticsearch/action/main/MainResponseTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected MainResponse createTestInstance() {
4141
ClusterName clusterName = new ClusterName(randomAlphaOfLength(10));
4242
String nodeName = randomAlphaOfLength(10);
4343
final String date = new Date(randomNonNegativeLong()).toString();
44-
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_0_1, Version.CURRENT);
44+
Version version = VersionUtils.randomVersionBetween(random(), Version.CURRENT.minimumCompatibilityVersion(), Version.CURRENT);
4545
Build build = new Build(
4646
Build.Flavor.UNKNOWN, Build.Type.UNKNOWN, randomAlphaOfLength(8), date, randomBoolean(),
4747
version.toString()

server/src/test/java/org/elasticsearch/cluster/block/ClusterBlockTests.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
import java.util.List;
3333

3434
import static java.util.EnumSet.copyOf;
35-
import static org.elasticsearch.test.VersionUtils.getPreviousVersion;
3635
import static org.elasticsearch.test.VersionUtils.randomVersion;
37-
import static org.elasticsearch.test.VersionUtils.randomVersionBetween;
3836
import static org.hamcrest.CoreMatchers.endsWith;
3937
import static org.hamcrest.CoreMatchers.equalTo;
4038
import static org.hamcrest.CoreMatchers.not;
@@ -62,45 +60,6 @@ public void testSerialization() throws Exception {
6260
}
6361
}
6462

65-
public void testBwcSerialization() throws Exception {
66-
for (int runs = 0; runs < randomIntBetween(5, 20); runs++) {
67-
// Generate a random cluster block in version < 7.0.0
68-
final Version version = randomVersionBetween(random(), Version.V_6_0_0, getPreviousVersion(Version.V_6_7_0));
69-
final ClusterBlock expected = randomClusterBlock(version);
70-
assertNull(expected.uuid());
71-
72-
// Serialize to node in current version
73-
final BytesStreamOutput out = new BytesStreamOutput();
74-
expected.writeTo(out);
75-
76-
// Deserialize and check the cluster block
77-
final ClusterBlock actual = new ClusterBlock(out.bytes().streamInput());
78-
assertClusterBlockEquals(expected, actual);
79-
}
80-
81-
for (int runs = 0; runs < randomIntBetween(5, 20); runs++) {
82-
// Generate a random cluster block in current version
83-
final ClusterBlock expected = randomClusterBlock(Version.CURRENT);
84-
85-
// Serialize to node in version < 7.0.0
86-
final BytesStreamOutput out = new BytesStreamOutput();
87-
out.setVersion(randomVersionBetween(random(), Version.V_6_0_0, getPreviousVersion(Version.V_6_7_0)));
88-
expected.writeTo(out);
89-
90-
// Deserialize and check the cluster block
91-
final StreamInput in = out.bytes().streamInput();
92-
in.setVersion(out.getVersion());
93-
final ClusterBlock actual = new ClusterBlock(in);
94-
95-
assertThat(actual.id(), equalTo(expected.id()));
96-
assertThat(actual.status(), equalTo(expected.status()));
97-
assertThat(actual.description(), equalTo(expected.description()));
98-
assertThat(actual.retryable(), equalTo(expected.retryable()));
99-
assertThat(actual.disableStatePersistence(), equalTo(expected.disableStatePersistence()));
100-
assertArrayEquals(actual.levels().toArray(), expected.levels().toArray());
101-
}
102-
}
103-
10463
public void testToStringDanglingComma() {
10564
final ClusterBlock clusterBlock = randomClusterBlock();
10665
assertThat(clusterBlock.toString(), not(endsWith(",")));

server/src/test/java/org/elasticsearch/cluster/coordination/JoinTaskExecutorTests.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.elasticsearch.cluster.coordination;
2020

2121
import org.elasticsearch.Version;
22-
import org.elasticsearch.cluster.coordination.JoinTaskExecutor;
2322
import org.elasticsearch.cluster.metadata.IndexMetaData;
2423
import org.elasticsearch.cluster.metadata.MetaData;
2524
import org.elasticsearch.cluster.node.DiscoveryNode;
@@ -30,7 +29,6 @@
3029
import org.elasticsearch.test.VersionUtils;
3130

3231
import static org.elasticsearch.test.VersionUtils.getPreviousVersion;
33-
import static org.elasticsearch.test.VersionUtils.incompatibleFutureVersion;
3432
import static org.elasticsearch.test.VersionUtils.maxCompatibleVersion;
3533
import static org.elasticsearch.test.VersionUtils.randomCompatibleVersion;
3634
import static org.elasticsearch.test.VersionUtils.randomVersion;
@@ -89,17 +87,6 @@ public void testPreventJoinClusterWithUnsupportedNodeVersions() {
8987
});
9088
}
9189

92-
if (minNodeVersion.before(Version.V_6_0_0)) {
93-
Version tooHigh = incompatibleFutureVersion(minNodeVersion);
94-
expectThrows(IllegalStateException.class, () -> {
95-
if (randomBoolean()) {
96-
JoinTaskExecutor.ensureNodesCompatibility(tooHigh, nodes);
97-
} else {
98-
JoinTaskExecutor.ensureNodesCompatibility(tooHigh, minNodeVersion, maxNodeVersion);
99-
}
100-
});
101-
}
102-
10390
if (minNodeVersion.onOrAfter(Version.V_7_0_0)) {
10491
Version oldMajor = Version.V_6_4_0.minimumCompatibilityVersion();
10592
expectThrows(IllegalStateException.class, () -> JoinTaskExecutor.ensureMajorVersionBarrier(oldMajor, minNodeVersion));

server/src/test/java/org/elasticsearch/common/lucene/uid/VersionsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public void testLuceneVersionOnUnknownVersions() {
202202

203203
// too old version, major should be the oldest supported lucene version minus 1
204204
version = Version.fromString("5.2.1");
205-
assertEquals(Version.V_6_0_0.luceneVersion.major - 1, version.luceneVersion.major);
205+
assertEquals(Version.getDeclaredVersions(Version.class).get(0).luceneVersion.major - 1, version.luceneVersion.major);
206206

207207
// future version, should be the same version as today
208208
version = Version.fromString("8.77.1");

server/src/test/java/org/elasticsearch/get/LegacyGetActionIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void testGetFieldsMetaDataWithRouting() throws Exception {
4646
.setSettings(
4747
Settings.builder()
4848
.put("index.refresh_interval", -1)
49-
.put(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey(), Version.V_6_0_0))); // multi-types in 6.0.0
49+
.put(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey(), Version.V_7_0_0)));
5050

5151
try (XContentBuilder source = jsonBuilder().startObject().field("field1", "value").endObject()) {
5252
client()

server/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.elasticsearch.plugins.Plugin;
3131
import org.elasticsearch.test.ESSingleNodeTestCase;
3232
import org.elasticsearch.test.InternalSettingsPlugin;
33+
import org.elasticsearch.test.VersionUtils;
3334

3435
import java.io.IOException;
3536
import java.util.Collection;
@@ -61,17 +62,17 @@ public void testThatDefaultAndStandardAnalyzerAreTheSameInstance() {
6162

6263
public void testThatInstancesAreTheSameAlwaysForKeywordAnalyzer() {
6364
assertThat(PreBuiltAnalyzers.KEYWORD.getAnalyzer(Version.CURRENT),
64-
is(PreBuiltAnalyzers.KEYWORD.getAnalyzer(Version.V_6_0_0)));
65+
is(PreBuiltAnalyzers.KEYWORD.getAnalyzer(Version.CURRENT.minimumCompatibilityVersion())));
6566
}
6667

6768
public void testThatInstancesAreCachedAndReused() {
68-
assertSame(PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.CURRENT),
69-
PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.CURRENT));
7069
// same es version should be cached
71-
assertSame(PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.V_6_2_1),
72-
PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.V_6_2_1));
73-
assertNotSame(PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.V_6_0_0),
74-
PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.V_6_0_1));
70+
Version randomVersion = VersionUtils.randomCompatibleVersion(random(), Version.CURRENT);
71+
assertSame(PreBuiltAnalyzers.STANDARD.getAnalyzer(randomVersion),
72+
PreBuiltAnalyzers.STANDARD.getAnalyzer(randomVersion));
73+
// other random version should not be cached
74+
Version otherVersion = randomValueOtherThan(randomVersion, () -> VersionUtils.randomCompatibleVersion(random(), Version.CURRENT));
75+
assertNotSame(PreBuiltAnalyzers.STANDARD.getAnalyzer(randomVersion), PreBuiltAnalyzers.STANDARD.getAnalyzer(otherVersion));
7576

7677
// Same Lucene version should be cached:
7778
assertSame(PreBuiltAnalyzers.STOP.getAnalyzer(Version.V_6_2_1),

0 commit comments

Comments
 (0)