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 the 6.7 version constants. #42039

Merged
merged 6 commits into from
May 22, 2019
Merged
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 @@ -20,7 +20,6 @@
package org.elasticsearch.index.reindex;

import org.apache.logging.log4j.Logger;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.support.ActionFilters;
Expand Down Expand Up @@ -82,18 +81,13 @@ protected void doExecute(Task task, UpdateByQueryRequest request, ActionListener
*/
static class AsyncIndexBySearchAction extends AbstractAsyncBulkByScrollAction<UpdateByQueryRequest, TransportUpdateByQueryAction> {

private final boolean useSeqNoForCAS;

AsyncIndexBySearchAction(BulkByScrollTask task, Logger logger, ParentTaskAssigningClient client,
ThreadPool threadPool, TransportUpdateByQueryAction action, UpdateByQueryRequest request, ClusterState clusterState,
ActionListener<BulkByScrollResponse> listener) {
super(task,
// not all nodes support sequence number powered optimistic concurrency control, we fall back to version
clusterState.nodes().getMinNodeVersion().onOrAfter(Version.V_6_7_0) == false,
// all nodes support sequence number powered optimistic concurrency control and we can use it
clusterState.nodes().getMinNodeVersion().onOrAfter(Version.V_6_7_0),
// use sequence number powered optimistic concurrency control
false, true,
logger, client, threadPool, action, request, listener);
useSeqNoForCAS = clusterState.nodes().getMinNodeVersion().onOrAfter(Version.V_6_7_0);
}

@Override
Expand Down
7 changes: 1 addition & 6 deletions server/src/main/java/org/elasticsearch/Build.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,7 @@ public static void writeBuild(Build build, StreamOutput out) throws IOException
out.writeString(build.flavor().displayName());
}
if (out.getVersion().onOrAfter(Version.V_6_3_0)) {
final Type buildType;
if (out.getVersion().before(Version.V_6_7_0) && build.type() == Type.DOCKER) {
buildType = Type.TAR;
} else {
buildType = build.type();
}
final Type buildType = build.type();
out.writeString(buildType.displayName());
}
out.writeString(build.shortHash());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1010,19 +1010,19 @@ private enum ElasticsearchExceptionHandle {
COORDINATION_STATE_REJECTED_EXCEPTION(org.elasticsearch.cluster.coordination.CoordinationStateRejectedException.class,
org.elasticsearch.cluster.coordination.CoordinationStateRejectedException::new, 150, Version.V_7_0_0),
SNAPSHOT_IN_PROGRESS_EXCEPTION(org.elasticsearch.snapshots.SnapshotInProgressException.class,
org.elasticsearch.snapshots.SnapshotInProgressException::new, 151, Version.V_6_7_0),
org.elasticsearch.snapshots.SnapshotInProgressException::new, 151, UNKNOWN_VERSION_ADDED),
NO_SUCH_REMOTE_CLUSTER_EXCEPTION(org.elasticsearch.transport.NoSuchRemoteClusterException.class,
org.elasticsearch.transport.NoSuchRemoteClusterException::new, 152, Version.V_6_7_0),
org.elasticsearch.transport.NoSuchRemoteClusterException::new, 152, UNKNOWN_VERSION_ADDED),
RETENTION_LEASE_ALREADY_EXISTS_EXCEPTION(
org.elasticsearch.index.seqno.RetentionLeaseAlreadyExistsException.class,
org.elasticsearch.index.seqno.RetentionLeaseAlreadyExistsException::new,
153,
Version.V_6_7_0),
UNKNOWN_VERSION_ADDED),
RETENTION_LEASE_NOT_FOUND_EXCEPTION(
org.elasticsearch.index.seqno.RetentionLeaseNotFoundException.class,
org.elasticsearch.index.seqno.RetentionLeaseNotFoundException::new,
154,
Version.V_6_7_0),
UNKNOWN_VERSION_ADDED),
SHARD_NOT_IN_PRIMARY_MODE_EXCEPTION(
org.elasticsearch.index.shard.ShardNotInPrimaryModeException.class,
org.elasticsearch.index.shard.ShardNotInPrimaryModeException::new,
Expand Down
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 @@ -78,12 +78,6 @@ public class Version implements Comparable<Version>, ToXContentFragment {
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;
public static final Version V_6_7_1 = new Version(V_6_7_1_ID, org.apache.lucene.util.Version.LUCENE_7_7_0);
public static final int V_6_7_2_ID = 6070299;
public static final Version V_6_7_2 = new Version(V_6_7_2_ID, org.apache.lucene.util.Version.LUCENE_7_7_0);
public static final int V_6_8_0_ID = 6080099;
public static final Version V_6_8_0 = new Version(V_6_8_0_ID, org.apache.lucene.util.Version.LUCENE_7_7_0);
public static final int V_6_8_1_ID = 6080199;
Expand Down Expand Up @@ -130,12 +124,6 @@ public static Version fromId(int id) {
return V_6_8_1;
case V_6_8_0_ID:
return V_6_8_0;
case V_6_7_1_ID:
return V_6_7_1;
case V_6_7_2_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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected void ensureMaxSeqNoEqualsToGlobalCheckpoint(final SeqNoStats seqNoStat
// that guarantee that all operations have been flushed to Lucene.
final Version indexVersionCreated = engineConfig.getIndexSettings().getIndexVersionCreated();
if (indexVersionCreated.onOrAfter(Version.V_7_2_0) ||
(seqNoStats.getGlobalCheckpoint() != SequenceNumbers.UNASSIGNED_SEQ_NO && indexVersionCreated.onOrAfter(Version.V_6_7_0))) {
(seqNoStats.getGlobalCheckpoint() != SequenceNumbers.UNASSIGNED_SEQ_NO)) {
if (seqNoStats.getMaxSeqNo() != seqNoStats.getGlobalCheckpoint()) {
throw new IllegalStateException("Maximum sequence number [" + seqNoStats.getMaxSeqNo()
+ "] from last commit does not match global checkpoint [" + seqNoStats.getGlobalCheckpoint() + "]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.lucene.store.RateLimiter;
import org.apache.lucene.util.ArrayUtil;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.StepListener;
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
Expand Down Expand Up @@ -112,8 +111,7 @@ public RecoverySourceHandler(final IndexShard shard, RecoveryTargetHandler recov
this.shardId = this.request.shardId().id();
this.logger = Loggers.getLogger(getClass(), request.shardId(), "recover to " + request.targetNode().getName());
this.chunkSizeInBytes = fileChunkSizeInBytes;
// if the target is on an old version, it won't be able to handle out-of-order file chunks.
this.maxConcurrentFileChunks = request.targetNode().getVersion().onOrAfter(Version.V_6_7_0) ? maxConcurrentFileChunks : 1;
this.maxConcurrentFileChunks = maxConcurrentFileChunks;
}

public StartRecoveryRequest getRequest() {
Expand Down
31 changes: 1 addition & 30 deletions server/src/test/java/org/elasticsearch/BuildTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.io.InputStream;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -193,35 +192,7 @@ public void testSerialization() {
throw new AssertionError();
});
}

public void testSerializationBWC() throws IOException {
final WriteableBuild dockerBuild = new WriteableBuild(new Build(randomFrom(Build.Flavor.values()), Build.Type.DOCKER,
randomAlphaOfLength(6), randomAlphaOfLength(6), randomBoolean(), randomAlphaOfLength(6)));

final List<Version> versions = Version.getDeclaredVersions(Version.class);
final Version post63Pre67Version = randomFrom(versions.stream()
.filter(v -> v.onOrAfter(Version.V_6_3_0) && v.before(Version.V_6_7_0)).collect(Collectors.toList()));
final Version post67Pre70Version = randomFrom(versions.stream()
.filter(v -> v.onOrAfter(Version.V_6_7_0) && v.before(Version.V_7_0_0)).collect(Collectors.toList()));
final Version post70Version = randomFrom(versions.stream().filter(v -> v.onOrAfter(Version.V_7_0_0)).collect(Collectors.toList()));

final WriteableBuild post63pre67 = copyWriteable(dockerBuild, writableRegistry(), WriteableBuild::new, post63Pre67Version);
final WriteableBuild post67pre70 = copyWriteable(dockerBuild, writableRegistry(), WriteableBuild::new, post67Pre70Version);
final WriteableBuild post70 = copyWriteable(dockerBuild, writableRegistry(), WriteableBuild::new, post70Version);

assertThat(post63pre67.build.flavor(), equalTo(dockerBuild.build.flavor()));
assertThat(post67pre70.build.flavor(), equalTo(dockerBuild.build.flavor()));
assertThat(post70.build.flavor(), equalTo(dockerBuild.build.flavor()));

assertThat(post63pre67.build.type(), equalTo(Build.Type.TAR));
assertThat(post67pre70.build.type(), equalTo(dockerBuild.build.type()));
assertThat(post70.build.type(), equalTo(dockerBuild.build.type()));

assertThat(post63pre67.build.getQualifiedVersion(), equalTo(post63Pre67Version.toString()));
assertThat(post67pre70.build.getQualifiedVersion(), equalTo(post67Pre70Version.toString()));
assertThat(post70.build.getQualifiedVersion(), equalTo(dockerBuild.build.getQualifiedVersion()));
}


public void testFlavorParsing() {
for (final Build.Flavor flavor : Build.Flavor.values()) {
// strict or not should not impact parsing at all here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ public void testShardLockObtainFailedException() throws IOException {

public void testSnapshotInProgressException() throws IOException {
SnapshotInProgressException orig = new SnapshotInProgressException("boom");
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_7_0, Version.CURRENT);
Version version = VersionUtils.randomIndexCompatibleVersion(random());
SnapshotInProgressException ex = serialize(orig, version);
assertEquals(orig.getMessage(), ex.getMessage());
}
Expand Down
1 change: 0 additions & 1 deletion server/src/test/java/org/elasticsearch/VersionTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ 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.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));
assertFalse(isCompatible(Version.fromId(2000099), Version.V_6_5_0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,11 +519,7 @@ public void testStartedShardEntrySerialization() throws Exception {
final StartedShardEntry deserialized = new StartedShardEntry(in);
assertThat(deserialized.shardId, equalTo(shardId));
assertThat(deserialized.allocationId, equalTo(allocationId));
if (version.onOrAfter(Version.V_6_7_0)) {
assertThat(deserialized.primaryTerm, equalTo(primaryTerm));
} else {
assertThat(deserialized.primaryTerm, equalTo(0L));
}
assertThat(deserialized.primaryTerm, equalTo(primaryTerm));
assertThat(deserialized.message, equalTo(message));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private ClusterBlock randomClusterBlock() {
}

private ClusterBlock randomClusterBlock(final Version version) {
final String uuid = (version.onOrAfter(Version.V_6_7_0) && randomBoolean()) ? UUIDs.randomBase64UUID() : null;
final String uuid = randomBoolean() ? UUIDs.randomBase64UUID() : null;
final List<ClusterBlockLevel> levels = Arrays.asList(ClusterBlockLevel.values());
return new ClusterBlock(randomInt(), uuid, "cluster block #" + randomInt(), randomBoolean(), randomBoolean(), randomBoolean(),
randomFrom(RestStatus.values()), copyOf(randomSubsetOf(randomIntBetween(1, levels.size()), levels)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,9 @@ public AutoFollowStats(StreamInput in) throws IOException {
numberOfFailedFollowIndices = in.readVLong();
numberOfFailedRemoteClusterStateRequests = in.readVLong();
numberOfSuccessfulFollowIndices = in.readVLong();
if (in.getVersion().onOrAfter(Version.V_6_7_0)) {
// note: the casts to the following Writeable.Reader<T> instances are needed by some IDEs (e.g. Eclipse 4.8) as a compiler help
recentAutoFollowErrors = new TreeMap<>(in.readMap((Writeable.Reader<String>) StreamInput::readString,
(Writeable.Reader<Tuple<Long, ElasticsearchException>>) in1 -> new Tuple<>(in1.readZLong(), in1.readException())));
} else {
// note: the casts to the following Writeable.Reader<T> instances are needed by some IDEs (e.g. Eclipse 4.8) as a compiler help
recentAutoFollowErrors = new TreeMap<>(in.readMap((Writeable.Reader<String>) StreamInput::readString,
(Writeable.Reader<Tuple<Long, ElasticsearchException>>) in1 -> new Tuple<>(-1L, in1.readException())));
}
// note: the casts to the following Writeable.Reader<T> instances are needed by some IDEs (e.g. Eclipse 4.8) as a compiler help
recentAutoFollowErrors = new TreeMap<>(in.readMap((Writeable.Reader<String>) StreamInput::readString,
(Writeable.Reader<Tuple<Long, ElasticsearchException>>) in1 -> new Tuple<>(in1.readZLong(), in1.readException())));
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
autoFollowedClusters = new TreeMap<>(in.readMap(StreamInput::readString, AutoFollowedCluster::new));
} else {
Expand All @@ -137,14 +131,11 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(numberOfFailedFollowIndices);
out.writeVLong(numberOfFailedRemoteClusterStateRequests);
out.writeVLong(numberOfSuccessfulFollowIndices);
if (out.getVersion().onOrAfter(Version.V_6_7_0)) {
out.writeMap(recentAutoFollowErrors, StreamOutput::writeString, (out1, value) -> {
out1.writeZLong(value.v1());
out1.writeException(value.v2());
});
} else {
out.writeMap(recentAutoFollowErrors, StreamOutput::writeString, (out1, value) -> out1.writeException(value.v2()));
}
out.writeMap(recentAutoFollowErrors, StreamOutput::writeString, (out1, value) -> {
out1.writeZLong(value.v1());
out1.writeException(value.v2());
});

if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
out.writeMap(autoFollowedClusters, StreamOutput::writeString, (out1, value) -> value.writeTo(out1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
*/
package org.elasticsearch.xpack.core.ccr.action;

import org.elasticsearch.Version;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.xcontent.ObjectParser;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentBuilder;
Expand Down Expand Up @@ -153,21 +151,7 @@ public Request(StreamInput in) throws IOException {
remoteCluster = in.readString();
leaderIndexPatterns = in.readStringList();
followIndexNamePattern = in.readOptionalString();
if (in.getVersion().onOrAfter(Version.V_6_7_0)) {
parameters = new FollowParameters(in);
} else {
parameters = new FollowParameters();
parameters.maxReadRequestOperationCount = in.readOptionalVInt();
parameters.maxReadRequestSize = in.readOptionalWriteable(ByteSizeValue::new);
parameters.maxOutstandingReadRequests = in.readOptionalVInt();
parameters.maxWriteRequestOperationCount = in.readOptionalVInt();
parameters.maxWriteRequestSize = in.readOptionalWriteable(ByteSizeValue::new);
parameters.maxOutstandingWriteRequests = in.readOptionalVInt();
parameters.maxWriteBufferCount = in.readOptionalVInt();
parameters.maxWriteBufferSize = in.readOptionalWriteable(ByteSizeValue::new);
parameters.maxRetryDelay = in.readOptionalTimeValue();
parameters.readPollTimeout = in.readOptionalTimeValue();
}
parameters = new FollowParameters(in);
}

@Override
Expand All @@ -177,20 +161,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeString(remoteCluster);
out.writeStringCollection(leaderIndexPatterns);
out.writeOptionalString(followIndexNamePattern);
if (out.getVersion().onOrAfter(Version.V_6_7_0)) {
parameters.writeTo(out);
} else {
out.writeOptionalVInt(parameters.maxReadRequestOperationCount);
out.writeOptionalWriteable(parameters.maxReadRequestSize);
out.writeOptionalVInt(parameters.maxOutstandingReadRequests);
out.writeOptionalVInt(parameters.maxWriteRequestOperationCount);
out.writeOptionalWriteable(parameters.maxWriteRequestSize);
out.writeOptionalVInt(parameters.maxOutstandingWriteRequests);
out.writeOptionalVInt(parameters.maxWriteBufferCount);
out.writeOptionalWriteable(parameters.maxWriteBufferSize);
out.writeOptionalTimeValue(parameters.maxRetryDelay);
out.writeOptionalTimeValue(parameters.readPollTimeout);
}
parameters.writeTo(out);
}

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

package org.elasticsearch.xpack.core.ccr.action;

import org.elasticsearch.Version;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionResponse;
Expand Down Expand Up @@ -169,9 +168,7 @@ public Request(StreamInput in) throws IOException {
this.leaderIndex = in.readString();
this.followerIndex = in.readString();
this.parameters = new FollowParameters(in);
if (in.getVersion().onOrAfter(Version.V_6_7_0)) {
waitForActiveShards(ActiveShardCount.readFrom(in));
}
waitForActiveShards(ActiveShardCount.readFrom(in));
}

@Override
Expand All @@ -181,9 +178,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeString(leaderIndex);
out.writeString(followerIndex);
parameters.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_6_7_0)) {
waitForActiveShards.writeTo(out);
}
waitForActiveShards.writeTo(out);
}

@Override
Expand Down
Loading