Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fd3dde1
Add TransportVersion file
thecoop Jan 12, 2023
b75f0de
Update docs/changelog/92869.yaml
thecoop Jan 12, 2023
0bffdf2
Update for 8.6.1
thecoop Jan 12, 2023
591f740
Fix id numbers
thecoop Jan 12, 2023
719ff87
Delete docs/changelog/92869.yaml
thecoop Jan 12, 2023
5f0462e
Fix id numbers
thecoop Jan 12, 2023
0346113
Add initial methods to StreamInput and StreamOutput
thecoop Jan 13, 2023
3fcbd3b
test
pgomulka Jan 13, 2023
dc9ae45
remove compatibility test
pgomulka Jan 13, 2023
9689954
PR comments
thecoop Jan 16, 2023
c64e813
test cleanup
pgomulka Jan 16, 2023
7e9690a
cleanup
pgomulka Jan 16, 2023
064b1f2
Merge pull request #1 from pgomulka/transportversion
thecoop Jan 16, 2023
8b12530
More PR comments
thecoop Jan 18, 2023
6d3a1a4
Convert TcpTransport infrastructure to TransportVersion
thecoop Jan 16, 2023
f220765
Add isCompatible method
thecoop Jan 17, 2023
d7e919b
Update tests
thecoop Jan 17, 2023
7f865ad
Add full compatibility method to get things working
thecoop Jan 17, 2023
2b40f4b
Spread calculateMinimumCompatVersion around
thecoop Jan 17, 2023
ea1d729
More test fixes
thecoop Jan 17, 2023
4de6681
Splotless
thecoop Jan 17, 2023
e5db29d
Some hacks around TcpTransport.getVersion to make some tests pass
thecoop Jan 17, 2023
9c5d476
Merge branch 'main' into transportversion-tcptransport
thecoop Jan 19, 2023
421ac55
Add forRemoval to transportversion method deprecations
thecoop Jan 19, 2023
7aea01b
Update files in org.elasticsearch.action to use TransportVersion
thecoop Jan 19, 2023
fc1a1c4
Merge remote-tracking branch 'upstream/main' into transportversion-tc…
thecoop Jan 19, 2023
0e8712a
Merge remote-tracking branch 'upstream/main' into transportversion-tc…
thecoop Jan 24, 2023
4be49a0
Merge branch 'transportversion-tcptransport' into transportversion-ac…
thecoop Jan 24, 2023
ef01a4c
Merge remote-tracking branch 'upstream/main' into transportversion-ac…
thecoop Jan 24, 2023
27da56f
Update error messages
thecoop Jan 25, 2023
1ee6f37
Merge branch 'main' into transportversion-actions
thecoop Jan 26, 2023
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 @@ -7,7 +7,7 @@
*/
package org.elasticsearch.action;

import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.action.support.WriteRequest.RefreshPolicy;
import org.elasticsearch.action.support.WriteResponse;
Expand Down Expand Up @@ -118,7 +118,7 @@ public DocWriteResponse(ShardId shardId, String id, long seqNo, long primaryTerm
protected DocWriteResponse(ShardId shardId, StreamInput in) throws IOException {
super(in);
this.shardId = shardId;
if (in.getVersion().before(Version.V_8_0_0)) {
if (in.getTransportVersion().before(TransportVersion.V_8_0_0)) {
String type = in.readString();
assert MapperService.SINGLE_MAPPING_NAME.equals(type) : "Expected [_doc] but received [" + type + "]";
}
Expand All @@ -137,7 +137,7 @@ protected DocWriteResponse(ShardId shardId, StreamInput in) throws IOException {
protected DocWriteResponse(StreamInput in) throws IOException {
super(in);
shardId = new ShardId(in);
if (in.getVersion().before(Version.V_8_0_0)) {
if (in.getTransportVersion().before(TransportVersion.V_8_0_0)) {
String type = in.readString();
assert MapperService.SINGLE_MAPPING_NAME.equals(type) : "Expected [_doc] but received [" + type + "]";
}
Expand Down Expand Up @@ -266,7 +266,7 @@ public void writeTo(StreamOutput out) throws IOException {
}

private void writeWithoutShardId(StreamOutput out) throws IOException {
if (out.getVersion().before(Version.V_8_0_0)) {
if (out.getTransportVersion().before(TransportVersion.V_8_0_0)) {
out.writeString(MapperService.SINGLE_MAPPING_NAME);
}
out.writeString(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
package org.elasticsearch.action;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.index.mapper.MapperService;
Expand Down Expand Up @@ -41,7 +41,7 @@ public RestStatus status() {

public RoutingMissingException(StreamInput in) throws IOException {
super(in);
if (in.getVersion().before(Version.V_8_0_0)) {
if (in.getTransportVersion().before(TransportVersion.V_8_0_0)) {
in.readString();
}
id = in.readString();
Expand All @@ -50,7 +50,7 @@ public RoutingMissingException(StreamInput in) throws IOException {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
if (out.getVersion().before(Version.V_8_0_0)) {
if (out.getTransportVersion().before(TransportVersion.V_8_0_0)) {
out.writeString(MapperService.SINGLE_MAPPING_NAME);
}
out.writeString(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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

import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.cluster.ClusterInfo;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.ShardRouting;
Expand Down Expand Up @@ -67,7 +67,7 @@ public ClusterAllocationExplanation(
}

public ClusterAllocationExplanation(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(Version.V_7_15_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_15_0)) {
this.specificShard = in.readBoolean();
} else {
this.specificShard = true; // suppress "this is a random shard" warning in BwC situations
Expand All @@ -81,7 +81,7 @@ public ClusterAllocationExplanation(StreamInput in) throws IOException {

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_7_15_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_15_0)) {
out.writeBoolean(specificShard);
} // else suppress "this is a random shard" warning in BwC situations
shardRouting.writeTo(out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
package org.elasticsearch.action.admin.cluster.allocation;

import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.cluster.routing.AllocationId;
import org.elasticsearch.cluster.routing.ShardRoutingState;
Expand All @@ -34,7 +34,7 @@

public class DesiredBalanceResponse extends ActionResponse implements ChunkedToXContentObject {

private static final Version CLUSTER_BALANCE_STATS_VERSION = Version.V_8_7_0;
private static final TransportVersion CLUSTER_BALANCE_STATS_VERSION = TransportVersion.V_8_7_0;

private final DesiredBalanceStats stats;
private final ClusterBalanceStats clusterBalanceStats;
Expand All @@ -53,15 +53,17 @@ public DesiredBalanceResponse(
public static DesiredBalanceResponse from(StreamInput in) throws IOException {
return new DesiredBalanceResponse(
DesiredBalanceStats.readFrom(in),
in.getVersion().onOrAfter(CLUSTER_BALANCE_STATS_VERSION) ? ClusterBalanceStats.readFrom(in) : ClusterBalanceStats.EMPTY,
in.getTransportVersion().onOrAfter(CLUSTER_BALANCE_STATS_VERSION)
? ClusterBalanceStats.readFrom(in)
: ClusterBalanceStats.EMPTY,
in.readImmutableMap(StreamInput::readString, v -> v.readImmutableMap(StreamInput::readVInt, DesiredShards::from))
);
}

@Override
public void writeTo(StreamOutput out) throws IOException {
stats.writeTo(out);
if (out.getVersion().onOrAfter(CLUSTER_BALANCE_STATS_VERSION)) {
if (out.getTransportVersion().onOrAfter(CLUSTER_BALANCE_STATS_VERSION)) {
clusterBalanceStats.writeTo(out);
}
out.writeMap(
Expand Down Expand Up @@ -176,10 +178,10 @@ public record ShardView(
@Nullable Long forecastedShardSizeInBytes
) implements Writeable, ToXContentObject {

private static final Version ADD_FORECASTS_VERSION = Version.V_8_7_0;
private static final TransportVersion ADD_FORECASTS_VERSION = TransportVersion.V_8_7_0;

public static ShardView from(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(ADD_FORECASTS_VERSION)) {
if (in.getTransportVersion().onOrAfter(ADD_FORECASTS_VERSION)) {
return new ShardView(
ShardRoutingState.fromValue(in.readByte()),
in.readBoolean(),
Expand Down Expand Up @@ -220,7 +222,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(relocatingNodeIsDesired);
out.writeVInt(shardId);
out.writeString(index);
if (out.getVersion().onOrAfter(ADD_FORECASTS_VERSION)) {
if (out.getTransportVersion().onOrAfter(ADD_FORECASTS_VERSION)) {
out.writeOptionalDouble(forecastedWriteLoad);
out.writeOptionalLong(forecastedShardSizeInBytes);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
package org.elasticsearch.action.admin.cluster.configuration;

import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.MasterNodeRequest;
import org.elasticsearch.cluster.ClusterState;
Expand Down Expand Up @@ -72,7 +72,7 @@ public AddVotingConfigExclusionsRequest(String[] nodeIds, String[] nodeNames, Ti

public AddVotingConfigExclusionsRequest(StreamInput in) throws IOException {
super(in);
if (in.getVersion().before(Version.V_8_0_0)) {
if (in.getTransportVersion().before(TransportVersion.V_8_0_0)) {
final String[] legacyNodeDescriptions = in.readStringArray();
if (legacyNodeDescriptions.length > 0) {
throw new IllegalArgumentException("legacy [node_name] field was deprecated and must be empty");
Expand Down Expand Up @@ -185,7 +185,7 @@ public ActionRequestValidationException validate() {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
if (out.getVersion().before(Version.V_8_0_0)) {
if (out.getTransportVersion().before(TransportVersion.V_8_0_0)) {
out.writeStringArray(Strings.EMPTY_ARRAY);
}
out.writeStringArray(nodeIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

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

import org.elasticsearch.TransportVersion;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ValidateActions;
Expand All @@ -24,7 +25,7 @@
import java.util.Objects;

public class UpdateDesiredNodesRequest extends AcknowledgedRequest<UpdateDesiredNodesRequest> {
private static final Version DRY_RUN_VERSION = Version.V_8_4_0;
private static final TransportVersion DRY_RUN_VERSION = TransportVersion.V_8_4_0;

private final String historyID;
private final long version;
Expand Down Expand Up @@ -58,7 +59,7 @@ public UpdateDesiredNodesRequest(StreamInput in) throws IOException {
this.historyID = in.readString();
this.version = in.readLong();
this.nodes = in.readList(DesiredNode::readFrom);
if (in.getVersion().onOrAfter(DRY_RUN_VERSION)) {
if (in.getTransportVersion().onOrAfter(DRY_RUN_VERSION)) {
this.dryRun = in.readBoolean();
} else {
this.dryRun = false;
Expand All @@ -71,7 +72,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeString(historyID);
out.writeLong(version);
out.writeList(nodes);
if (out.getVersion().onOrAfter(DRY_RUN_VERSION)) {
if (out.getTransportVersion().onOrAfter(DRY_RUN_VERSION)) {
out.writeBoolean(dryRun);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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

import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand All @@ -19,7 +19,7 @@
import java.util.Objects;

public class UpdateDesiredNodesResponse extends ActionResponse implements ToXContentObject {
private static final Version DRY_RUN_SUPPORTING_VERSION = Version.V_8_4_0;
private static final TransportVersion DRY_RUN_SUPPORTING_VERSION = TransportVersion.V_8_4_0;

private final boolean replacedExistingHistoryId;
private final boolean dryRun;
Expand All @@ -36,13 +36,13 @@ public UpdateDesiredNodesResponse(boolean replacedExistingHistoryId, boolean dry
public UpdateDesiredNodesResponse(StreamInput in) throws IOException {
super(in);
this.replacedExistingHistoryId = in.readBoolean();
dryRun = in.getVersion().onOrAfter(DRY_RUN_SUPPORTING_VERSION) ? in.readBoolean() : false;
dryRun = in.getTransportVersion().onOrAfter(DRY_RUN_SUPPORTING_VERSION) ? in.readBoolean() : false;
}

@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(replacedExistingHistoryId);
if (out.getVersion().onOrAfter(DRY_RUN_SUPPORTING_VERSION)) {
if (out.getTransportVersion().onOrAfter(DRY_RUN_SUPPORTING_VERSION)) {
out.writeBoolean(dryRun);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.elasticsearch.action.admin.cluster.node.hotthreads;

import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.support.nodes.BaseNodesRequest;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.io.stream.StreamInput;
Expand Down Expand Up @@ -36,7 +36,7 @@ public NodesHotThreadsRequest(StreamInput in) throws IOException {
type = HotThreads.ReportType.of(in.readString());
interval = in.readTimeValue();
snapshots = in.readInt();
if (in.getVersion().onOrAfter(Version.V_7_16_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_16_0)) {
sortOrder = HotThreads.SortOrder.of(in.readString());
}
}
Expand Down Expand Up @@ -118,7 +118,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeString(type.getTypeValue());
out.writeTimeValue(interval);
out.writeInt(snapshots);
if (out.getVersion().onOrAfter(Version.V_7_16_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_16_0)) {
out.writeString(sortOrder.getOrderValue());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package org.elasticsearch.action.admin.cluster.node.info;

import org.elasticsearch.Build;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.nodes.BaseNodeResponse;
import org.elasticsearch.cluster.node.DiscoveryNode;
Expand Down Expand Up @@ -72,7 +73,7 @@ public NodeInfo(StreamInput in) throws IOException {
addInfoIfNonNull(HttpInfo.class, in.readOptionalWriteable(HttpInfo::new));
addInfoIfNonNull(PluginsAndModules.class, in.readOptionalWriteable(PluginsAndModules::new));
addInfoIfNonNull(IngestInfo.class, in.readOptionalWriteable(IngestInfo::new));
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_10_0)) {
addInfoIfNonNull(AggregationInfo.class, in.readOptionalWriteable(AggregationInfo::new));
}
}
Expand Down Expand Up @@ -193,7 +194,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalWriteable(getInfo(HttpInfo.class));
out.writeOptionalWriteable(getInfo(PluginsAndModules.class));
out.writeOptionalWriteable(getInfo(IngestInfo.class));
if (out.getVersion().onOrAfter(Version.V_7_10_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_10_0)) {
out.writeOptionalWriteable(getInfo(AggregationInfo.class));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.elasticsearch.action.admin.cluster.node.shutdown;

import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
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 @@ -148,14 +148,14 @@ static <T> void configureParser(ConstructingObjectParser<T, Void> parser) {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(isSafe);
if (out.getVersion().onOrAfter(Version.V_8_7_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_7_0)) {
reason.writeTo(out);
}
out.writeString(message);
}

public static Result readFrom(final StreamInput in) throws IOException {
if (in.getVersion().before(Version.V_8_7_0)) {
if (in.getTransportVersion().before(TransportVersion.V_8_7_0)) {
return new Result(in.readBoolean(), null, in.readString());
}
return new Result(in.readBoolean(), Reason.readFrom(in), in.readString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.elasticsearch.action.admin.cluster.node.shutdown;

import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.MasterNodeReadRequest;
import org.elasticsearch.common.Strings;
Expand Down Expand Up @@ -44,7 +44,7 @@ public PrevalidateNodeRemovalRequest(final StreamInput in) throws IOException {
names = in.readStringArray();
ids = in.readStringArray();
externalIds = in.readStringArray();
if (in.getVersion().onOrAfter(Version.V_8_7_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_7_0)) {
timeout = in.readTimeValue();
}
}
Expand All @@ -55,7 +55,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeStringArray(names);
out.writeStringArray(ids);
out.writeStringArray(externalIds);
if (out.getVersion().onOrAfter(Version.V_8_7_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_7_0)) {
out.writeTimeValue(timeout);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.elasticsearch.action.admin.cluster.node.tasks.list;

import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.tasks.BaseTasksRequest;
import org.elasticsearch.common.Strings;
Expand Down Expand Up @@ -40,7 +40,7 @@ public ListTasksRequest(StreamInput in) throws IOException {
super(in);
detailed = in.readBoolean();
waitForCompletion = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_7_13_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_13_0)) {
descriptions = in.readStringArray();
}
}
Expand All @@ -50,7 +50,7 @@ public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeBoolean(detailed);
out.writeBoolean(waitForCompletion);
if (out.getVersion().onOrAfter(Version.V_7_13_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_13_0)) {
out.writeStringArray(descriptions);
}
}
Expand Down
Loading