Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove handling of 6.0.x versions #42036

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -38,7 +38,7 @@ protected org.elasticsearch.action.main.MainResponse createServerTestInstance()
ClusterName clusterName = new ClusterName(randomAlphaOfLength(10));
String nodeName = randomAlphaOfLength(10);
final String date = new Date(randomNonNegativeLong()).toString();
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_0_1, Version.CURRENT);
Version version = VersionUtils.randomVersionBetween(random(), Version.CURRENT.minimumCompatibilityVersion(), Version.CURRENT);
Build build = new Build(
Build.Flavor.UNKNOWN, Build.Type.UNKNOWN, randomAlphaOfLength(8), date, randomBoolean(),
version.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ public void hitsExecute(SearchContext context, SearchHit[] hits) throws IOExcept
innerHitsExecute(context.query(), context.searcher(), hits);
}

static void innerHitsExecute(Query mainQuery,
IndexSearcher indexSearcher,
SearchHit[] hits) throws IOException {
static void innerHitsExecute(Query mainQuery, IndexSearcher indexSearcher, SearchHit[] hits) throws IOException {
List<PercolateQuery> percolateQueries = locatePercolatorQuery(mainQuery);
if (percolateQueries.isEmpty()) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,6 @@ public void testCreateCandidateQuery_oldIndex() throws Exception {
assertThat(t.v1().clauses().get(0).getQuery(), instanceOf(CoveringQuery.class));
assertThat(t.v1().clauses().get(1).getQuery(), instanceOf(TermQuery.class));

t = fieldType.createCandidateQuery(indexReader, Version.V_6_0_0);
assertTrue(t.v2());
assertEquals(2, t.v1().clauses().size());
assertThat(t.v1().clauses().get(0).getQuery(), instanceOf(TermInSetQuery.class));
assertThat(t.v1().clauses().get(1).getQuery(), instanceOf(TermQuery.class));
}

public void testExtractTermsAndRanges_numberFields() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.lucene.queries.BlendedTermQuery;
import org.apache.lucene.queries.CommonTermsQuery;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.BoostQuery;
import org.apache.lucene.search.ConstantScoreQuery;
Expand All @@ -44,7 +45,6 @@
import org.apache.lucene.search.TermInSetQuery;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TermRangeQuery;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.join.QueryBitSetProducer;
import org.apache.lucene.search.join.ScoreMode;
import org.apache.lucene.search.spans.SpanFirstQuery;
Expand All @@ -61,6 +61,7 @@
import org.elasticsearch.index.search.ESToParentBlockJoinQuery;
import org.elasticsearch.percolator.QueryAnalyzer.QueryExtraction;
import org.elasticsearch.percolator.QueryAnalyzer.Result;
import org.elasticsearch.percolator.QueryAnalyzer.UnsupportedQueryException;
import org.elasticsearch.test.ESTestCase;

import java.util.ArrayList;
Expand All @@ -73,7 +74,6 @@
import java.util.function.Consumer;
import java.util.stream.Collectors;

import static org.elasticsearch.percolator.QueryAnalyzer.UnsupportedQueryException;
import static org.elasticsearch.percolator.QueryAnalyzer.analyze;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
Expand Down
10 changes: 0 additions & 10 deletions server/src/main/java/org/elasticsearch/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ public class Version implements Comparable<Version>, ToXContentFragment {
*/
public static final int V_EMPTY_ID = 0;
public static final Version V_EMPTY = new Version(V_EMPTY_ID, org.apache.lucene.util.Version.LATEST);
public static final int V_6_0_0_ID = 6000099;
public static final Version V_6_0_0 =
new Version(V_6_0_0_ID, org.apache.lucene.util.Version.LUCENE_7_0_1);
public static final int V_6_0_1_ID = 6000199;
public static final Version V_6_0_1 =
new Version(V_6_0_1_ID, org.apache.lucene.util.Version.LUCENE_7_0_1);
public static final int V_6_1_0_ID = 6010099;
public static final Version V_6_1_0 = new Version(V_6_1_0_ID, org.apache.lucene.util.Version.LUCENE_7_1_0);
public static final int V_6_1_1_ID = 6010199;
Expand Down Expand Up @@ -212,10 +206,6 @@ public static Version fromId(int id) {
return V_6_1_1;
case V_6_1_0_ID:
return V_6_1_0;
case V_6_0_1_ID:
return V_6_0_1;
case V_6_0_0_ID:
return V_6_0_0;
case V_EMPTY_ID:
return V_EMPTY;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@

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

import org.elasticsearch.Version;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.Settings.Builder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.test.VersionUtils;

import java.io.IOException;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
Expand Down Expand Up @@ -99,9 +96,4 @@ protected ClusterUpdateSettingsResponse createTestInstance() {
protected ClusterUpdateSettingsResponse createBlankInstance() {
return new ClusterUpdateSettingsResponse();
}

public void testOldSerialisation() throws IOException {
ClusterUpdateSettingsResponse original = createTestInstance();
assertSerialization(original, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, Version.V_6_4_0));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void testBwcSerialization() throws Exception {
{
final CloseIndexResponse response = randomResponse();
try (BytesStreamOutput out = new BytesStreamOutput()) {
out.setVersion(randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_2_0)));
out.setVersion(randomVersionBetween(random(), Version.V_7_0_0, VersionUtils.getPreviousVersion(Version.V_7_2_0)));
response.writeTo(out);

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

final CloseIndexResponse deserializedResponse = new CloseIndexResponse();
try (StreamInput in = out.bytes().streamInput()) {
in.setVersion(randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_2_0)));
in.setVersion(randomVersionBetween(random(), Version.V_7_0_0, VersionUtils.getPreviousVersion(Version.V_7_2_0)));
deserializedResponse.readFrom(in);
}
assertThat(deserializedResponse.isAcknowledged(), equalTo(response.isAcknowledged()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@
package org.elasticsearch.action.admin.indices.rollover;


import org.elasticsearch.Version;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
import org.elasticsearch.test.VersionUtils;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -131,9 +128,4 @@ protected RolloverResponse mutateInstance(RolloverResponse response) {
throw new UnsupportedOperationException();
}
}

public void testOldSerialisation() throws IOException {
RolloverResponse original = createTestInstance();
assertSerialization(original, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, Version.V_6_4_0));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected MainResponse createTestInstance() {
ClusterName clusterName = new ClusterName(randomAlphaOfLength(10));
String nodeName = randomAlphaOfLength(10);
final String date = new Date(randomNonNegativeLong()).toString();
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_0_1, Version.CURRENT);
Version version = VersionUtils.randomVersionBetween(random(), Version.CURRENT.minimumCompatibilityVersion(), Version.CURRENT);
Build build = new Build(
Build.Flavor.UNKNOWN, Build.Type.UNKNOWN, randomAlphaOfLength(8), date, randomBoolean(),
version.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
import java.util.List;

import static java.util.EnumSet.copyOf;
import static org.elasticsearch.test.VersionUtils.getPreviousVersion;
import static org.elasticsearch.test.VersionUtils.randomVersion;
import static org.elasticsearch.test.VersionUtils.randomVersionBetween;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
Expand Down Expand Up @@ -62,45 +60,6 @@ public void testSerialization() throws Exception {
}
}

public void testBwcSerialization() throws Exception {
for (int runs = 0; runs < randomIntBetween(5, 20); runs++) {
// Generate a random cluster block in version < 7.0.0
final Version version = randomVersionBetween(random(), Version.V_6_0_0, getPreviousVersion(Version.V_6_7_0));
final ClusterBlock expected = randomClusterBlock(version);
assertNull(expected.uuid());

// Serialize to node in current version
final BytesStreamOutput out = new BytesStreamOutput();
expected.writeTo(out);

// Deserialize and check the cluster block
final ClusterBlock actual = new ClusterBlock(out.bytes().streamInput());
assertClusterBlockEquals(expected, actual);
}

for (int runs = 0; runs < randomIntBetween(5, 20); runs++) {
// Generate a random cluster block in current version
final ClusterBlock expected = randomClusterBlock(Version.CURRENT);

// Serialize to node in version < 7.0.0
final BytesStreamOutput out = new BytesStreamOutput();
out.setVersion(randomVersionBetween(random(), Version.V_6_0_0, getPreviousVersion(Version.V_6_7_0)));
expected.writeTo(out);

// Deserialize and check the cluster block
final StreamInput in = out.bytes().streamInput();
in.setVersion(out.getVersion());
final ClusterBlock actual = new ClusterBlock(in);

assertThat(actual.id(), equalTo(expected.id()));
assertThat(actual.status(), equalTo(expected.status()));
assertThat(actual.description(), equalTo(expected.description()));
assertThat(actual.retryable(), equalTo(expected.retryable()));
assertThat(actual.disableStatePersistence(), equalTo(expected.disableStatePersistence()));
assertArrayEquals(actual.levels().toArray(), expected.levels().toArray());
}
}

public void testToStringDanglingComma() {
final ClusterBlock clusterBlock = randomClusterBlock();
assertThat(clusterBlock.toString(), not(endsWith(",")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package org.elasticsearch.cluster.coordination;

import org.elasticsearch.Version;
import org.elasticsearch.cluster.coordination.JoinTaskExecutor;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.cluster.node.DiscoveryNode;
Expand All @@ -30,7 +29,6 @@
import org.elasticsearch.test.VersionUtils;

import static org.elasticsearch.test.VersionUtils.getPreviousVersion;
import static org.elasticsearch.test.VersionUtils.incompatibleFutureVersion;
import static org.elasticsearch.test.VersionUtils.maxCompatibleVersion;
import static org.elasticsearch.test.VersionUtils.randomCompatibleVersion;
import static org.elasticsearch.test.VersionUtils.randomVersion;
Expand Down Expand Up @@ -89,17 +87,6 @@ public void testPreventJoinClusterWithUnsupportedNodeVersions() {
});
}

if (minNodeVersion.before(Version.V_6_0_0)) {
Version tooHigh = incompatibleFutureVersion(minNodeVersion);
expectThrows(IllegalStateException.class, () -> {
if (randomBoolean()) {
JoinTaskExecutor.ensureNodesCompatibility(tooHigh, nodes);
} else {
JoinTaskExecutor.ensureNodesCompatibility(tooHigh, minNodeVersion, maxNodeVersion);
}
});
}

if (minNodeVersion.onOrAfter(Version.V_7_0_0)) {
Version oldMajor = Version.V_6_4_0.minimumCompatibilityVersion();
expectThrows(IllegalStateException.class, () -> JoinTaskExecutor.ensureMajorVersionBarrier(oldMajor, minNodeVersion));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public void testLuceneVersionOnUnknownVersions() {

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

// future version, should be the same version as today
version = Version.fromString("8.77.1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void testGetFieldsMetaDataWithRouting() throws Exception {
.setSettings(
Settings.builder()
.put("index.refresh_interval", -1)
.put(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey(), Version.V_6_0_0))); // multi-types in 6.0.0
.put(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey(), Version.V_7_0_0)));

try (XContentBuilder source = jsonBuilder().startObject().field("field1", "value").endObject()) {
client()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.test.InternalSettingsPlugin;
import org.elasticsearch.test.VersionUtils;

import java.io.IOException;
import java.util.Collection;
Expand Down Expand Up @@ -61,17 +62,17 @@ public void testThatDefaultAndStandardAnalyzerAreTheSameInstance() {

public void testThatInstancesAreTheSameAlwaysForKeywordAnalyzer() {
assertThat(PreBuiltAnalyzers.KEYWORD.getAnalyzer(Version.CURRENT),
is(PreBuiltAnalyzers.KEYWORD.getAnalyzer(Version.V_6_0_0)));
is(PreBuiltAnalyzers.KEYWORD.getAnalyzer(Version.CURRENT.minimumCompatibilityVersion())));
}

public void testThatInstancesAreCachedAndReused() {
assertSame(PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.CURRENT),
PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.CURRENT));
// same es version should be cached
assertSame(PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.V_6_2_1),
PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.V_6_2_1));
assertNotSame(PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.V_6_0_0),
PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.V_6_0_1));
Version randomVersion = VersionUtils.randomCompatibleVersion(random(), Version.CURRENT);
assertSame(PreBuiltAnalyzers.STANDARD.getAnalyzer(randomVersion),
PreBuiltAnalyzers.STANDARD.getAnalyzer(randomVersion));
// other random version should not be cached
Version otherVersion = randomValueOtherThan(randomVersion, () -> VersionUtils.randomCompatibleVersion(random(), Version.CURRENT));
assertNotSame(PreBuiltAnalyzers.STANDARD.getAnalyzer(randomVersion), PreBuiltAnalyzers.STANDARD.getAnalyzer(otherVersion));

// Same Lucene version should be cached:
assertSame(PreBuiltAnalyzers.STOP.getAnalyzer(Version.V_6_2_1),
Expand Down
Loading