Skip to content
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 @@ -9,7 +9,6 @@
package org.elasticsearch.aggregations.bucket.histogram;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.Version;
import org.elasticsearch.common.Rounding;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand Down Expand Up @@ -123,15 +122,15 @@ public AutoDateHistogramAggregationBuilder(String name) {
public AutoDateHistogramAggregationBuilder(StreamInput in) throws IOException {
super(in);
numBuckets = in.readVInt();
if (in.getVersion().onOrAfter(Version.V_7_3_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_3_0)) {
minimumIntervalExpression = in.readOptionalString();
}
}

@Override
protected void innerWriteTo(StreamOutput out) throws IOException {
out.writeVInt(numBuckets);
if (out.getVersion().onOrAfter(Version.V_7_3_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_3_0)) {
out.writeOptionalString(minimumIntervalExpression);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
package org.elasticsearch.aggregations.bucket.histogram;

import org.apache.lucene.util.PriorityQueue;
import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder.RoundingInfo;
import org.elasticsearch.common.Rounding;
import org.elasticsearch.common.io.stream.StreamInput;
Expand Down Expand Up @@ -226,7 +226,7 @@ public InternalAutoDateHistogram(StreamInput in) throws IOException {
format = in.readNamedWriteable(DocValueFormat.class);
buckets = in.readList(stream -> new Bucket(stream, format));
this.targetBuckets = in.readVInt();
if (in.getVersion().onOrAfter(Version.V_8_3_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_3_0)) {
bucketInnerInterval = in.readVLong();
} else {
bucketInnerInterval = 1; // Calculated on merge.
Expand All @@ -239,7 +239,7 @@ protected void doWriteTo(StreamOutput out) throws IOException {
out.writeNamedWriteable(format);
out.writeList(buckets);
out.writeVInt(targetBuckets);
if (out.getVersion().onOrAfter(Version.V_8_3_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_3_0)) {
out.writeVLong(bucketInnerInterval);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package org.elasticsearch.aggregations.metric;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.Version;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.search.MultiValueMode;
Expand Down Expand Up @@ -56,14 +55,14 @@ public boolean supportsSampling() {
*/
public MatrixStatsAggregationBuilder(StreamInput in) throws IOException {
super(in);
if (in.getVersion().onOrAfter(Version.V_8_7_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_8_7_0)) {
multiValueMode = MultiValueMode.readMultiValueModeFrom(in);
}
}

@Override
protected void innerWriteTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_8_7_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_7_0)) {
multiValueMode.writeTo(out);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
package org.elasticsearch.ingest.common;

import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
Expand Down Expand Up @@ -57,7 +57,7 @@ public Request(boolean sorted, String ecsCompatibility) {
Request(StreamInput in) throws IOException {
super(in);
this.sorted = in.readBoolean();
this.ecsCompatibility = in.getVersion().onOrAfter(Version.V_8_0_0)
this.ecsCompatibility = in.getTransportVersion().onOrAfter(TransportVersion.V_8_0_0)
? in.readString()
: GrokProcessor.DEFAULT_ECS_COMPATIBILITY_MODE;
}
Expand All @@ -71,7 +71,7 @@ public ActionRequestValidationException validate() {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeBoolean(sorted);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_0_0)) {
out.writeString(ecsCompatibility);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.elasticsearch.ingest.geoip.stats;

import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.FailedNodeException;
import org.elasticsearch.action.support.nodes.BaseNodeResponse;
Expand Down Expand Up @@ -166,7 +166,7 @@ protected NodeResponse(StreamInput in) throws IOException {
stats = in.readBoolean() ? new GeoIpDownloaderStats(in) : null;
databases = in.readSet(StreamInput::readString);
filesInTemp = in.readSet(StreamInput::readString);
configDatabases = in.getVersion().onOrAfter(Version.V_8_0_0) ? in.readSet(StreamInput::readString) : null;
configDatabases = in.getTransportVersion().onOrAfter(TransportVersion.V_8_0_0) ? in.readSet(StreamInput::readString) : null;
}

protected NodeResponse(
Expand Down Expand Up @@ -208,7 +208,7 @@ public void writeTo(StreamOutput out) throws IOException {
}
out.writeCollection(databases, StreamOutput::writeString);
out.writeCollection(filesInTemp, StreamOutput::writeString);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_0_0)) {
out.writeCollection(configDatabases, StreamOutput::writeString);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.search.MultiSearchResponse;
import org.elasticsearch.common.Strings;
Expand Down Expand Up @@ -102,7 +102,7 @@ public String toString() {
MultiSearchTemplateResponse(StreamInput in) throws IOException {
super(in);
items = in.readArray(Item::new, Item[]::new);
if (in.getVersion().onOrAfter(Version.V_7_0_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_0_0)) {
tookInMillis = in.readVLong();
} else {
tookInMillis = -1L;
Expand Down Expand Up @@ -136,7 +136,7 @@ public TimeValue getTook() {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeArray(items);
if (out.getVersion().onOrAfter(Version.V_7_0_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_0_0)) {
out.writeVLong(tookInMillis);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ protected PercolateQueryBuilder(String field, Supplier<BytesReference> documentS
super(in);
field = in.readString();
name = in.readOptionalString();
if (in.getVersion().before(Version.V_8_0_0)) {
if (in.getTransportVersion().before(TransportVersion.V_8_0_0)) {
String documentType = in.readOptionalString();
assert documentType == null;
}
indexedDocumentIndex = in.readOptionalString();
if (in.getVersion().before(Version.V_8_0_0)) {
if (in.getTransportVersion().before(TransportVersion.V_8_0_0)) {
String indexedDocumentType = in.readOptionalString();
assert indexedDocumentType == null;
}
Expand Down Expand Up @@ -259,12 +259,12 @@ protected void doWriteTo(StreamOutput out) throws IOException {
}
out.writeString(field);
out.writeOptionalString(name);
if (out.getVersion().before(Version.V_8_0_0)) {
if (out.getTransportVersion().before(TransportVersion.V_8_0_0)) {
// In 7x, typeless percolate queries are represented by null documentType values
out.writeOptionalString(null);
}
out.writeOptionalString(indexedDocumentIndex);
if (out.getVersion().before(Version.V_8_0_0)) {
if (out.getTransportVersion().before(TransportVersion.V_8_0_0)) {
// In 7x, typeless percolate queries are represented by null indexedDocumentType values
out.writeOptionalString(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public void testUpgradeDesiredNodes() throws Exception {
return;
}

if (UPGRADE_FROM_VERSION.onOrAfter(Processors.DOUBLE_PROCESSORS_SUPPORT_VERSION)) {
if (UPGRADE_FROM_VERSION.transportVersion.onOrAfter(Processors.DOUBLE_PROCESSORS_SUPPORT_VERSION)) {
assertUpgradedNodesCanReadDesiredNodes();
} else if (UPGRADE_FROM_VERSION.onOrAfter(DesiredNode.RANGE_FLOAT_PROCESSORS_SUPPORT_VERSION)) {
} else if (UPGRADE_FROM_VERSION.transportVersion.onOrAfter(DesiredNode.RANGE_FLOAT_PROCESSORS_SUPPORT_VERSION)) {
assertDesiredNodesUpdatedWithRoundedUpFloatsAreIdempotent();
} else {
assertDesiredNodesWithFloatProcessorsAreRejectedInOlderVersions();
Expand Down
4 changes: 2 additions & 2 deletions server/src/main/java/org/elasticsearch/Build.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static URL getElasticsearchCodeSourceLocation() {
public static Build readBuild(StreamInput in) throws IOException {
final Type type;
// be lenient when reading on the wire, the enumeration values from other versions might be different than what we know
if (in.getVersion().before(Version.V_8_3_0)) {
if (in.getTransportVersion().before(TransportVersion.V_8_3_0)) {
// this was the flavor, which is always the default distribution now
in.readString();
}
Expand All @@ -167,7 +167,7 @@ public static Build readBuild(StreamInput in) throws IOException {
}

public static void writeBuild(Build build, StreamOutput out) throws IOException {
if (out.getVersion().before(Version.V_8_3_0)) {
if (out.getTransportVersion().before(TransportVersion.V_8_3_0)) {
// this was the flavor, which is always the default distribution now
out.writeString("default");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected void masterOperation(
@Override
protected void doExecute(Task task, UpdateDesiredNodesRequest request, ActionListener<UpdateDesiredNodesResponse> listener) {
final var minNodeVersion = clusterService.state().nodes().getMinNodeVersion();
if (request.isCompatibleWithVersion(minNodeVersion) == false) {
if (request.isCompatibleWithVersion(minNodeVersion.transportVersion) == false) {
listener.onFailure(
new IllegalArgumentException(
"Unable to use processor ranges, floating-point (with greater precision) processors "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
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;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
Expand Down Expand Up @@ -99,7 +98,7 @@ public boolean isDryRun() {
return dryRun;
}

public boolean isCompatibleWithVersion(Version version) {
public boolean isCompatibleWithVersion(TransportVersion version) {
if (version.onOrAfter(DesiredNode.RANGE_FLOAT_PROCESSORS_SUPPORT_VERSION)) {
return true;
}
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.info;

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.node.ReportingService;
Expand Down Expand Up @@ -41,7 +41,7 @@ public PluginsAndModules(StreamInput in) throws IOException {

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_8_3_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_8_3_0)) {
out.writeList(plugins);
} else {
out.writeList(plugins.stream().map(PluginRuntimeInfo::descriptor).toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.elasticsearch.action.admin.indices.rollover;

import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.common.io.stream.NamedWriteable;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.xcontent.ToXContentFragment;
Expand Down Expand Up @@ -41,7 +41,7 @@ protected Condition(String name, Type type) {
* Checks if this condition is available in a specific version.
* This makes sure BWC when introducing a new condition which is not recognized by older versions.
*/
boolean includedInVersion(Version version) {
boolean includedInVersion(TransportVersion version) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ok to convert, it is certainly only used in a transport context

return true;
}

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

package org.elasticsearch.action.admin.indices.rollover;

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.xcontent.XContentBuilder;
Expand Down Expand Up @@ -62,7 +62,7 @@ public static MaxPrimaryShardDocsCondition fromXContent(XContentParser parser) t
}

@Override
boolean includedInVersion(Version version) {
return version.onOrAfter(Version.V_8_2_0);
boolean includedInVersion(TransportVersion version) {
return version.onOrAfter(TransportVersion.V_8_2_0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.elasticsearch.action.admin.indices.rollover;

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.core.TimeValue;
Expand Down Expand Up @@ -64,7 +64,7 @@ public static MinAgeCondition fromXContent(XContentParser parser) throws IOExcep
}

@Override
boolean includedInVersion(Version version) {
return version.onOrAfter(Version.V_8_4_0);
boolean includedInVersion(TransportVersion version) {
return version.onOrAfter(TransportVersion.V_8_4_0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.elasticsearch.action.admin.indices.rollover;

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.xcontent.XContentBuilder;
Expand Down Expand Up @@ -62,7 +62,7 @@ public static MinDocsCondition fromXContent(XContentParser parser) throws IOExce
}

@Override
boolean includedInVersion(Version version) {
return version.onOrAfter(Version.V_8_4_0);
boolean includedInVersion(TransportVersion version) {
return version.onOrAfter(TransportVersion.V_8_4_0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.elasticsearch.action.admin.indices.rollover;

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.xcontent.XContentBuilder;
Expand Down Expand Up @@ -62,7 +62,7 @@ public static MinPrimaryShardDocsCondition fromXContent(XContentParser parser) t
}

@Override
boolean includedInVersion(Version version) {
return version.onOrAfter(Version.V_8_4_0);
boolean includedInVersion(TransportVersion version) {
return version.onOrAfter(TransportVersion.V_8_4_0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.elasticsearch.action.admin.indices.rollover;

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.unit.ByteSizeValue;
Expand Down Expand Up @@ -63,7 +63,7 @@ public static MinPrimaryShardSizeCondition fromXContent(XContentParser parser) t
}

@Override
boolean includedInVersion(Version version) {
return version.onOrAfter(Version.V_8_4_0);
boolean includedInVersion(TransportVersion version) {
return version.onOrAfter(TransportVersion.V_8_4_0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.elasticsearch.action.admin.indices.rollover;

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.unit.ByteSizeValue;
Expand Down Expand Up @@ -63,7 +63,7 @@ public static MinSizeCondition fromXContent(XContentParser parser) throws IOExce
}

@Override
boolean includedInVersion(Version version) {
return version.onOrAfter(Version.V_8_4_0);
boolean includedInVersion(TransportVersion version) {
return version.onOrAfter(TransportVersion.V_8_4_0);
}
}
Loading