Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 0 additions & 2 deletions server/src/main/java/org/elasticsearch/TransportVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ static TransportVersion def(int id) {
public static final TransportVersion V_7_10_0 = def(7_10_00_99);
public static final TransportVersion V_7_13_0 = def(7_13_00_99);
public static final TransportVersion V_7_14_0 = def(7_14_00_99);
public static final TransportVersion V_7_15_0 = def(7_15_00_99);
public static final TransportVersion V_7_15_1 = def(7_15_01_99);
public static final TransportVersion V_7_16_0 = def(7_16_00_99);
public static final TransportVersion V_7_17_0 = def(7_17_00_99);
public static final TransportVersion V_7_17_1 = def(7_17_01_99);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

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

import org.elasticsearch.TransportVersions;
import org.elasticsearch.cluster.ClusterInfo;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.ShardRouting;
Expand Down Expand Up @@ -80,11 +79,7 @@ public ClusterAllocationExplanation(
}

public ClusterAllocationExplanation(StreamInput in) throws IOException {
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) {
this.specificShard = in.readBoolean();
} else {
this.specificShard = true; // suppress "this is a random shard" warning in BwC situations
}
this.specificShard = in.readBoolean();
this.shardRouting = new ShardRouting(in);
this.currentNode = in.readOptionalWriteable(DiscoveryNode::new);
this.relocationTargetNode = in.readOptionalWriteable(DiscoveryNode::new);
Expand All @@ -94,9 +89,7 @@ public ClusterAllocationExplanation(StreamInput in) throws IOException {

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) {
out.writeBoolean(specificShard);
} // else suppress "this is a random shard" warning in BwC situations
out.writeBoolean(specificShard);
shardRouting.writeTo(out);
out.writeOptionalWriteable(currentNode);
out.writeOptionalWriteable(relocationTargetNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ public record UnassignedInfo(
@Nullable String lastAllocatedNodeId
) implements ToXContentFragment, Writeable {

/**
* The version that the {@code lastAllocatedNode} field was added in. Used to adapt streaming of this class as appropriate for the
* version of the node sending/receiving it. Should be removed once wire compatibility with this version is no longer necessary.
*/
private static final TransportVersion VERSION_LAST_ALLOCATED_NODE_ADDED = TransportVersions.V_7_15_0;
private static final TransportVersion VERSION_UNPROMOTABLE_REPLICA_ADDED = TransportVersions.V_8_7_0;

public static final DateFormatter DATE_TIME_FORMATTER = DateFormatter.forPattern("date_optional_time").withZone(ZoneOffset.UTC);
Expand Down Expand Up @@ -315,11 +310,7 @@ public static UnassignedInfo fromStreamInput(StreamInput in) throws IOException
var lastAllocationStatus = AllocationStatus.readFrom(in);
var failedNodeIds = in.readCollectionAsImmutableSet(StreamInput::readString);
String lastAllocatedNodeId;
if (in.getTransportVersion().onOrAfter(VERSION_LAST_ALLOCATED_NODE_ADDED)) {
lastAllocatedNodeId = in.readOptionalString();
} else {
lastAllocatedNodeId = null;
}
lastAllocatedNodeId = in.readOptionalString();
return new UnassignedInfo(
reason,
message,
Expand All @@ -335,9 +326,7 @@ public static UnassignedInfo fromStreamInput(StreamInput in) throws IOException
}

public void writeTo(StreamOutput out) throws IOException {
if (reason.equals(Reason.NODE_RESTARTING) && out.getTransportVersion().before(VERSION_LAST_ALLOCATED_NODE_ADDED)) {
out.writeByte((byte) Reason.NODE_LEFT.ordinal());
} else if (reason.equals(Reason.UNPROMOTABLE_REPLICA) && out.getTransportVersion().before(VERSION_UNPROMOTABLE_REPLICA_ADDED)) {
if (reason.equals(Reason.UNPROMOTABLE_REPLICA) && out.getTransportVersion().before(VERSION_UNPROMOTABLE_REPLICA_ADDED)) {
out.writeByte((byte) Reason.PRIMARY_FAILED.ordinal());
} else if (reason.equals(Reason.RESHARD_ADDED)
&& out.getTransportVersion().before(TransportVersions.UNASSIGENEDINFO_RESHARD_ADDED)) {
Expand All @@ -355,9 +344,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVInt(failedAllocations);
lastAllocationStatus.writeTo(out);
out.writeStringCollection(failedNodeIds);
if (out.getTransportVersion().onOrAfter(VERSION_LAST_ALLOCATED_NODE_ADDED)) {
out.writeOptionalString(lastAllocatedNodeId);
}
out.writeOptionalString(lastAllocatedNodeId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@

public class RecoverySettings {
public static final IndexVersion SNAPSHOT_RECOVERIES_SUPPORTED_INDEX_VERSION = IndexVersions.V_7_15_0;
public static final TransportVersion SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION = TransportVersions.V_7_15_0;
public static final IndexVersion SEQ_NO_SNAPSHOT_RECOVERIES_SUPPORTED_VERSION = IndexVersions.V_7_16_0;
public static final TransportVersion SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_TRANSPORT_VERSION = TransportVersions.V_7_16_0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public RecoverySnapshotFileRequest(StreamInput in) throws IOException {

@Override
public void writeTo(StreamOutput out) throws IOException {
assert out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)
: "Unexpected serialization version " + out.getTransportVersion();
super.writeTo(out);
out.writeString(repository);
indexId.writeTo(out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,7 @@ public FileDetail(StreamInput in) throws IOException {
length = in.readVLong();
recovered = in.readVLong();
reused = in.readBoolean();
if (in.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)) {
recoveredFromSnapshot = in.readLong();
}
recoveredFromSnapshot = in.readLong();
}

@Override
Expand All @@ -653,9 +651,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(length);
out.writeVLong(recovered);
out.writeBoolean(reused);
if (out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)) {
out.writeLong(recoveredFromSnapshot);
}
out.writeLong(recoveredFromSnapshot);
}

void addRecoveredBytes(long bytes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ public FeatureUsageInfo(StreamInput in) throws IOException {
}
this.name = in.readString();
this.lastUsedTime = ZonedDateTime.ofInstant(Instant.ofEpochSecond(in.readLong()), ZoneOffset.UTC);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) {
this.context = in.readOptionalString();
} else {
this.context = null;
}
this.context = in.readOptionalString();
this.licenseLevel = in.readString();
}

Expand All @@ -70,9 +66,7 @@ public void writeTo(StreamOutput out) throws IOException {
}
out.writeString(name);
out.writeLong(lastUsedTime.toEpochSecond());
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) {
out.writeOptionalString(this.context);
}
out.writeOptionalString(this.context);
out.writeString(licenseLevel);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.ResourceNotFoundException;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.DocWriteResponse;
Expand Down Expand Up @@ -327,9 +326,7 @@ private void addResultFieldAndFinish(Writeable response, XContentBuilder source)
os = Streams.noCloseStream(os);
TransportVersion minNodeVersion = clusterService.state().getMinTransportVersion();
TransportVersion.writeVersion(minNodeVersion, new OutputStreamStreamOutput(os));
if (minNodeVersion.onOrAfter(TransportVersions.V_7_15_0)) {
os = CompressorFactory.COMPRESSOR.threadLocalOutputStream(os);
}
os = CompressorFactory.COMPRESSOR.threadLocalOutputStream(os);
try (OutputStreamStreamOutput out = new OutputStreamStreamOutput(os)) {
out.setTransportVersion(minNodeVersion);
response.writeTo(out);
Expand Down Expand Up @@ -580,11 +577,7 @@ public int read() {
TransportVersion version = TransportVersion.readVersion(new InputStreamStreamInput(encodedIn));
assert version.onOrBefore(TransportVersion.current()) : version + " >= " + TransportVersion.current();
final StreamInput input;
if (version.onOrAfter(TransportVersions.V_7_15_0)) {
input = CompressorFactory.COMPRESSOR.threadLocalStreamInput(encodedIn);
} else {
input = new InputStreamStreamInput(encodedIn);
}
input = CompressorFactory.COMPRESSOR.threadLocalStreamInput(encodedIn);
try (StreamInput in = new NamedWriteableAwareStreamInput(input, registry)) {
in.setTransportVersion(version);
return reader.read(in);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
package org.elasticsearch.xpack.core.termsenum.action;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.IndicesRequest;
import org.elasticsearch.action.OriginalIndices;
import org.elasticsearch.action.support.IndicesOptions;
Expand Down Expand Up @@ -78,12 +77,7 @@ public NodeTermsEnumRequest(StreamInput in) throws IOException {
for (int i = 0; i < numShards; i++) {
shardIds.add(new ShardId(in));
}
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_15_1)) {
originalIndices = OriginalIndices.readOriginalIndices(in);
} else {
String[] indicesNames = shardIds.stream().map(ShardId::getIndexName).distinct().toArray(String[]::new);
this.originalIndices = new OriginalIndices(indicesNames, null);
}
originalIndices = OriginalIndices.readOriginalIndices(in);
}

@Override
Expand All @@ -106,9 +100,7 @@ public void writeTo(StreamOutput out) throws IOException {
for (ShardId shardId : shardIds) {
shardId.writeTo(out);
}
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_15_1)) {
OriginalIndices.writeOriginalIndices(originalIndices, out);
}
OriginalIndices.writeOriginalIndices(originalIndices, out);
}

public String field() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
package org.elasticsearch.license;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.license.GetFeatureUsageResponse.FeatureUsageInfo;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.TransportVersionUtils;

import java.io.IOException;
import java.time.ZoneOffset;
Expand Down Expand Up @@ -46,10 +44,6 @@ public void assertStreamInputOutput(TransportVersion version, String family, Str
assertThat(fui2.getLicenseLevel(), equalTo("gold"));
}

public void testPre715StreamFormat() throws IOException {
assertStreamInputOutput(TransportVersionUtils.getPreviousVersion(TransportVersions.V_7_15_0), null, null);
}

public void testStreamFormat() throws IOException {
assertStreamInputOutput(TransportVersion.current(), "family", "context");
// family and context are optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ public EqlSearchRequest(StreamInput in) throws IOException {
size = in.readVInt();
fetchSize = in.readVInt();
query = in.readString();
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) {
this.ccsMinimizeRoundtrips = in.readBoolean();
}
this.ccsMinimizeRoundtrips = in.readBoolean();
this.waitForCompletionTimeout = in.readOptionalTimeValue();
this.keepAlive = in.readOptionalTimeValue();
this.keepOnCompletion = in.readBoolean();
Expand Down Expand Up @@ -486,9 +484,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVInt(size);
out.writeVInt(fetchSize);
out.writeString(query);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_15_0)) {
out.writeBoolean(ccsMinimizeRoundtrips);
}
out.writeBoolean(ccsMinimizeRoundtrips);
out.writeOptionalTimeValue(waitForCompletionTimeout);
out.writeOptionalTimeValue(keepAlive);
out.writeBoolean(keepOnCompletion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected EqlSearchRequest mutateInstanceForVersion(EqlSearchRequest instance, T
mutatedInstance.size(instance.size());
mutatedInstance.fetchSize(instance.fetchSize());
mutatedInstance.query(instance.query());
mutatedInstance.ccsMinimizeRoundtrips(version.onOrAfter(TransportVersions.V_7_15_0) == false || instance.ccsMinimizeRoundtrips());
mutatedInstance.ccsMinimizeRoundtrips(instance.ccsMinimizeRoundtrips());
mutatedInstance.waitForCompletionTimeout(instance.waitForCompletionTimeout());
mutatedInstance.keepAlive(instance.keepAlive());
mutatedInstance.keepOnCompletion(instance.keepOnCompletion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,28 +124,19 @@ private PinnedQueryBuilder(QueryBuilder organicQuery, List<String> ids, List<Spe
*/
public PinnedQueryBuilder(StreamInput in) throws IOException {
super(in);
if (in.getTransportVersion().before(TransportVersions.V_7_15_0)) {
ids = in.readStringCollectionAsList();
docs = null;
} else {
ids = in.readOptionalStringCollectionAsList();
docs = in.readBoolean() ? in.readCollectionAsList(SpecifiedDocument::new) : null;
}
ids = in.readOptionalStringCollectionAsList();
docs = in.readBoolean() ? in.readCollectionAsList(SpecifiedDocument::new) : null;
organicQuery = in.readNamedWriteable(QueryBuilder.class);
}

@Override
protected void doWriteTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().before(TransportVersions.V_7_15_0)) {
out.writeStringCollection(this.ids);
out.writeOptionalStringCollection(this.ids);
if (docs == null) {
out.writeBoolean(false);
} else {
out.writeOptionalStringCollection(this.ids);
if (docs == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
out.writeCollection(docs);
}
out.writeBoolean(true);
out.writeCollection(docs);
}
out.writeNamedWriteable(organicQuery);
}
Expand Down