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 6.6.x version constants #42131

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
12 changes: 0 additions & 12 deletions server/src/main/java/org/elasticsearch/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ public class Version implements Comparable<Version>, ToXContentFragment {
public static final Version V_6_5_3 = new Version(V_6_5_3_ID, org.apache.lucene.util.Version.LUCENE_7_5_0);
public static final int V_6_5_4_ID = 6050499;
public static final Version V_6_5_4 = new Version(V_6_5_4_ID, org.apache.lucene.util.Version.LUCENE_7_5_0);
public static final int V_6_6_0_ID = 6060099;
public static final Version V_6_6_0 = new Version(V_6_6_0_ID, org.apache.lucene.util.Version.LUCENE_7_6_0);
public static final int V_6_6_1_ID = 6060199;
public static final Version V_6_6_1 = new Version(V_6_6_1_ID, org.apache.lucene.util.Version.LUCENE_7_6_0);
public static final int V_6_6_2_ID = 6060299;
public static final Version V_6_6_2 = new Version(V_6_6_2_ID, org.apache.lucene.util.Version.LUCENE_7_6_0);
public static final int V_6_7_0_ID = 6070099;
public static final Version V_6_7_0 = new Version(V_6_7_0_ID, org.apache.lucene.util.Version.LUCENE_7_7_0);
public static final int V_6_7_1_ID = 6070199;
Expand Down Expand Up @@ -162,12 +156,6 @@ public static Version fromId(int id) {
return V_6_7_2;
case V_6_7_0_ID:
return V_6_7_0;
case V_6_6_2_ID:
return V_6_6_2;
case V_6_6_1_ID:
return V_6_6_1;
case V_6_6_0_ID:
return V_6_6_0;
case V_6_5_4_ID:
return V_6_5_4;
case V_6_5_3_ID:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ String getDescription() {

if (clusterState.getLastAcceptedConfiguration().isEmpty()) {

// TODO handle the case that there is a 6.x node around here, when rolling upgrades are supported

final String bootstrappingDescription;

if (INITIAL_MASTER_NODES_SETTING.get(Settings.EMPTY).equals(INITIAL_MASTER_NODES_SETTING.get(settings))) {
Expand All @@ -165,7 +163,7 @@ String getDescription() {

return String.format(Locale.ROOT,
"master not discovered yet, this node has not previously joined a bootstrapped (v%d+) cluster, and %s: %s",
Version.V_6_6_0.major + 1, bootstrappingDescription, discoveryStateIgnoringQuorum);
Version.CURRENT.major + 1, bootstrappingDescription, discoveryStateIgnoringQuorum);
}

assert clusterState.getLastCommittedConfiguration().isEmpty() == false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext
}
}
final Builder builder;
if (parsedDeprecatedParams || parserContext.indexVersionCreated().before(Version.V_6_6_0)) {
if (parsedDeprecatedParams) {
// Legacy index-based shape
builder = new LegacyGeoShapeFieldMapper.Builder(name, deprecatedParameters);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ private void setupFieldTypeDeprecatedParameters(BuilderContext context) {
}
if (deprecatedParameters.tree != null) {
ft.setTree(deprecatedParameters.tree);
} else if (context.indexCreatedVersion().before(Version.V_6_6_0)) {
ft.setTree(DeprecatedParameters.PrefixTrees.GEOHASH);
}
if (deprecatedParameters.treeLevels != null) {
ft.setTreeLevels(deprecatedParameters.treeLevels);
Expand Down Expand Up @@ -527,8 +525,7 @@ protected void doXContentBody(XContentBuilder builder, boolean includeDefaults,
super.doXContentBody(builder, includeDefaults, params);

if (includeDefaults
|| (fieldType().tree().equals(indexCreatedVersion.onOrAfter(Version.V_6_6_0) ?
DeprecatedParameters.Defaults.TREE : DeprecatedParameters.PrefixTrees.GEOHASH)) == false) {
|| (fieldType().tree().equals(DeprecatedParameters.Defaults.TREE)) == false) {
builder.field(DeprecatedParameters.Names.TREE.getPreferredName(), fieldType().tree());
}

Expand Down
2 changes: 1 addition & 1 deletion server/src/test/java/org/elasticsearch/VersionTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public static void assertUnknownVersion(Version version) {

public void testIsCompatible() {
assertTrue(isCompatible(Version.CURRENT, Version.CURRENT.minimumCompatibilityVersion()));
assertFalse(isCompatible(Version.V_6_6_0, Version.V_7_0_0));
assertFalse(isCompatible(Version.fromString("6.6.0"), Version.fromString("7.0.0")));
assertFalse(isCompatible(Version.V_6_7_0, Version.V_7_0_0));
assertTrue(isCompatible(Version.V_6_8_0, Version.V_7_0_0));
assertFalse(isCompatible(Version.fromId(2000099), Version.V_7_0_0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ public void testSerialization() throws Exception {
assertThat(deserializedCSRequest.blocks(), equalTo(clusterStateRequest.blocks()));
assertThat(deserializedCSRequest.indices(), equalTo(clusterStateRequest.indices()));
assertOptionsMatch(deserializedCSRequest.indicesOptions(), clusterStateRequest.indicesOptions());
if (testVersion.onOrAfter(Version.V_6_6_0)) {
assertThat(deserializedCSRequest.waitForMetaDataVersion(), equalTo(clusterStateRequest.waitForMetaDataVersion()));
assertThat(deserializedCSRequest.waitForTimeout(), equalTo(clusterStateRequest.waitForTimeout()));
}
assertThat(deserializedCSRequest.waitForMetaDataVersion(), equalTo(clusterStateRequest.waitForMetaDataVersion()));
assertThat(deserializedCSRequest.waitForTimeout(), equalTo(clusterStateRequest.waitForTimeout()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected String fieldName() {
@Override
protected Settings createTestIndexSettings() {
// force the new shape impl
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_6_0, Version.CURRENT);
Version version = VersionUtils.randomIndexCompatibleVersion(random());
return Settings.builder()
.put(super.createTestIndexSettings())
.put(IndexMetaData.SETTING_VERSION_CREATED, version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ public void testAutoFollowerSoftDeletesDisabled() {
when(client.getRemoteClusterClient(anyString())).thenReturn(client);

ClusterState remoteState = randomBoolean() ? createRemoteClusterState("logs-20190101", false) :
createRemoteClusterState("logs-20190101", null);
createRemoteClusterState("logs-20190101", randomBoolean());

AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("logs-*"),
null, null, null, null, null, null, null, null, null, null, null);
Expand Down Expand Up @@ -953,13 +953,9 @@ void cleanFollowedRemoteIndices(ClusterState remoteClusterState, List<String> pa
assertThat(entries.get(0).getValue(), nullValue());
}

private static ClusterState createRemoteClusterState(String indexName, Boolean enableSoftDeletes) {
private static ClusterState createRemoteClusterState(String indexName, boolean enableSoftDeletes) {
Settings.Builder indexSettings;
if (enableSoftDeletes != null) {
indexSettings = settings(Version.CURRENT).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), enableSoftDeletes);
} else {
indexSettings = settings(Version.V_6_6_0);
}
indexSettings = settings(Version.CURRENT).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), enableSoftDeletes);

IndexMetaData indexMetaData = IndexMetaData.builder(indexName)
.settings(indexSettings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,7 @@ public AutoFollowStats(StreamInput in) throws IOException {
recentAutoFollowErrors = new TreeMap<>(in.readMap((Writeable.Reader<String>) StreamInput::readString,
(Writeable.Reader<Tuple<Long, ElasticsearchException>>) in1 -> new Tuple<>(-1L, in1.readException())));
}
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
autoFollowedClusters = new TreeMap<>(in.readMap(StreamInput::readString, AutoFollowedCluster::new));
} else {
autoFollowedClusters = Collections.emptyNavigableMap();
}
autoFollowedClusters = new TreeMap<>(in.readMap(StreamInput::readString, AutoFollowedCluster::new));
}

@Override
Expand All @@ -145,9 +141,7 @@ public void writeTo(StreamOutput out) throws IOException {
} else {
out.writeMap(recentAutoFollowErrors, StreamOutput::writeString, (out1, value) -> out1.writeException(value.v2()));
}
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
out.writeMap(autoFollowedClusters, StreamOutput::writeString, (out1, value) -> value.writeTo(out1));
}
out.writeMap(autoFollowedClusters, StreamOutput::writeString, (out1, value) -> value.writeTo(out1));
}

public long getNumberOfFailedFollowIndices() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
package org.elasticsearch.xpack.core.indexing;

import org.elasticsearch.Version;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand Down Expand Up @@ -61,14 +60,12 @@ public IndexerJobStats(StreamInput in) throws IOException {
this.numInputDocuments = in.readVLong();
this.numOuputDocuments = in.readVLong();
this.numInvocations = in.readVLong();
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
this.indexTime = in.readVLong();
this.searchTime = in.readVLong();
this.indexTotal = in.readVLong();
this.searchTotal = in.readVLong();
this.indexFailures = in.readVLong();
this.searchFailures = in.readVLong();
}
this.indexTime = in.readVLong();
this.searchTime = in.readVLong();
this.indexTotal = in.readVLong();
this.searchTotal = in.readVLong();
this.indexFailures = in.readVLong();
this.searchFailures = in.readVLong();
}

public long getNumPages() {
Expand Down Expand Up @@ -163,14 +160,12 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(numInputDocuments);
out.writeVLong(numOuputDocuments);
out.writeVLong(numInvocations);
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
out.writeVLong(indexTime);
out.writeVLong(searchTime);
out.writeVLong(indexTotal);
out.writeVLong(searchTotal);
out.writeVLong(indexFailures);
out.writeVLong(searchFailures);
}
out.writeVLong(indexTime);
out.writeVLong(searchTime);
out.writeVLong(indexTotal);
out.writeVLong(searchTotal);
out.writeVLong(indexFailures);
out.writeVLong(searchFailures);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws

@Override
public Version getMinimalSupportedVersion() {
return Version.V_6_6_0;
return Version.CURRENT.minimumCompatibilityVersion();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ public JobParams(String jobId) {
public JobParams(StreamInput in) throws IOException {
jobId = in.readString();
timeout = TimeValue.timeValueMillis(in.readVLong());
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
job = in.readOptionalWriteable(Job::new);
}
job = in.readOptionalWriteable(Job::new);
}

public String getJobId() {
Expand Down Expand Up @@ -209,9 +207,7 @@ public String getWriteableName() {
public void writeTo(StreamOutput out) throws IOException {
out.writeString(jobId);
out.writeVLong(timeout.millis());
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
out.writeOptionalWriteable(job);
}
out.writeOptionalWriteable(job);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,8 @@ public DatafeedParams(StreamInput in) throws IOException {
startTime = in.readVLong();
endTime = in.readOptionalLong();
timeout = TimeValue.timeValueMillis(in.readVLong());
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
jobId = in.readOptionalString();
datafeedIndices = in.readStringList();
}
jobId = in.readOptionalString();
datafeedIndices = in.readStringList();
}

DatafeedParams() {
Expand Down Expand Up @@ -272,10 +270,8 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(startTime);
out.writeOptionalLong(endTime);
out.writeVLong(timeout.millis());
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
out.writeOptionalString(jobId);
out.writeStringCollection(datafeedIndices);
}
out.writeOptionalString(jobId);
out.writeStringCollection(datafeedIndices);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
Expand Down Expand Up @@ -68,14 +66,7 @@ static AggProvider fromParsedAggs(AggregatorFactories.Builder parsedAggs) throws
}

static AggProvider fromStream(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(Version.V_6_7_0)) { // Has our bug fix for query/agg providers
return new AggProvider(in.readMap(), in.readOptionalWriteable(AggregatorFactories.Builder::new), in.readException());
} else if (in.getVersion().onOrAfter(Version.V_6_6_0)) { // Has the bug, but supports lazy objects
return new AggProvider(in.readMap(), null, null);
} else { // only supports eagerly parsed objects
// Upstream, we have read the bool already and know for sure that we have parsed aggs in the stream
return AggProvider.fromParsedAggs(new AggregatorFactories.Builder(in));
}
return new AggProvider(in.readMap(), in.readOptionalWriteable(AggregatorFactories.Builder::new), in.readException());
}

AggProvider(Map<String, Object> aggs, AggregatorFactories.Builder parsedAggs, Exception parsingException) {
Expand All @@ -92,29 +83,9 @@ static AggProvider fromStream(StreamInput in) throws IOException {

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_6_7_0)) { // Has our bug fix for query/agg providers
out.writeMap(aggs);
out.writeOptionalWriteable(parsedAggs);
out.writeException(parsingException);
} else if (out.getVersion().onOrAfter(Version.V_6_6_0)) { // Has the bug, but supports lazy objects
// We allow the lazy parsing nodes that have the bug throw any parsing errors themselves as
// they already have the ability to fully parse the passed Maps
out.writeMap(aggs);
} else { // only supports eagerly parsed objects
if (parsingException != null) {
if (parsingException instanceof IOException) {
throw (IOException) parsingException;
} else {
throw new ElasticsearchException(parsingException);
}
} else if (parsedAggs == null) {
// This is an admittedly rare case but we should fail early instead of writing null when there
// actually are aggregations defined
throw new ElasticsearchException("Unsupported operation: parsed aggregations are null");
}
// Upstream we already verified that this calling object is not null, no need to write a second boolean to the stream
parsedAggs.writeTo(out);
}
out.writeMap(aggs);
out.writeOptionalWriteable(parsedAggs);
out.writeException(parsingException);
}

public Exception getParsingException() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,7 @@ public DatafeedConfig(StreamInput in) throws IOException {
} else {
this.headers = Collections.emptyMap();
}
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
delayedDataCheckConfig = in.readOptionalWriteable(DelayedDataCheckConfig::new);
} else {
delayedDataCheckConfig = DelayedDataCheckConfig.defaultDelayedDataCheckConfig();
}
delayedDataCheckConfig = in.readOptionalWriteable(DelayedDataCheckConfig::new);
}

/**
Expand Down Expand Up @@ -435,9 +431,7 @@ public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_6_2_0)) {
out.writeMap(headers, StreamOutput::writeString, StreamOutput::writeString);
}
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
out.writeOptionalWriteable(delayedDataCheckConfig);
}
out.writeOptionalWriteable(delayedDataCheckConfig);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,7 @@ public DatafeedUpdate(StreamInput in) throws IOException {
}
this.scrollSize = in.readOptionalVInt();
this.chunkingConfig = in.readOptionalWriteable(ChunkingConfig::new);
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
delayedDataCheckConfig = in.readOptionalWriteable(DelayedDataCheckConfig::new);
} else {
delayedDataCheckConfig = null;
}
delayedDataCheckConfig = in.readOptionalWriteable(DelayedDataCheckConfig::new);
}

/**
Expand Down Expand Up @@ -181,9 +177,7 @@ public void writeTo(StreamOutput out) throws IOException {
}
out.writeOptionalVInt(scrollSize);
out.writeOptionalWriteable(chunkingConfig);
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
out.writeOptionalWriteable(delayedDataCheckConfig);
}
out.writeOptionalWriteable(delayedDataCheckConfig);
}

@Override
Expand Down
Loading