Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 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
fc1a1c4
Merge remote-tracking branch 'upstream/main' into transportversion-tc…
thecoop Jan 19, 2023
64aa21a
Migrate org.elasticsearch.search to TransportVersion
thecoop Jan 19, 2023
0e8712a
Merge remote-tracking branch 'upstream/main' into transportversion-tc…
thecoop Jan 24, 2023
cd17e54
Merge branch 'transportversion-tcptransport' into transportversion-se…
thecoop Jan 24, 2023
67a2bde
Merge remote-tracking branch 'upstream/main' into transportversion-se…
thecoop Jan 24, 2023
f812a24
Fix test
thecoop Jan 24, 2023
392b5bf
Merge branch 'main' into transportversion-search
thecoop Jan 24, 2023
b5c167c
Update tests for new ESTestCase methods
thecoop Jan 24, 2023
89a72e4
Merge branch 'main' into transportversion-search
thecoop Jan 26, 2023
ea3d1fe
Remove excess imports
thecoop Jan 26, 2023
67d9cb3
Merge branch 'main' into transportversion-search
thecoop Jan 30, 2023
87c0017
Merge branch 'main' into transportversion-search
thecoop Jan 31, 2023
ee79d40
Update exception message
thecoop Jan 31, 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 @@ -8,7 +8,7 @@

package org.elasticsearch.search;

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.search.sort.MinAndMax;
Expand All @@ -25,7 +25,7 @@ public final class CanMatchShardResponse extends SearchPhaseResult {
public CanMatchShardResponse(StreamInput in) throws IOException {
super(in);
this.canMatch = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_7_6_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_6_0)) {
estimatedMinAndMax = in.readOptionalWriteable(MinAndMax::new);
} else {
estimatedMinAndMax = null;
Expand All @@ -40,7 +40,7 @@ public CanMatchShardResponse(boolean canMatch, MinAndMax<?> estimatedMinAndMax)
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(canMatch);
if (out.getVersion().onOrAfter(Version.V_7_6_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_6_0)) {
out.writeOptionalWriteable(estimatedMinAndMax);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import org.apache.lucene.document.InetAddressPoint;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.io.stream.NamedWriteable;
import org.elasticsearch.common.io.stream.StreamInput;
Expand Down Expand Up @@ -241,14 +241,14 @@ public DateTime(StreamInput in) throws IOException {
this.formatter = DateFormatter.forPattern(formatterPattern).withZone(this.timeZone);
this.parser = formatter.toDateMathParser();
this.resolution = DateFieldMapper.Resolution.ofOrdinal(in.readVInt());
if (in.getVersion().onOrAfter(Version.V_7_7_0) && in.getVersion().before(Version.V_8_0_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_7_0) && in.getTransportVersion().before(TransportVersion.V_8_0_0)) {
/* when deserialising from 7.7+ nodes expect a flag indicating if a pattern is of joda style
This is only used to support joda style indices in 7.x, in 8 we no longer support this.
All indices in 8 should use java style pattern. Hence we can ignore this flag.
*/
in.readBoolean();
}
if (in.getVersion().onOrAfter(Version.V_7_13_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_13_0)) {
this.formatSortValues = in.readBoolean();
} else {
this.formatSortValues = false;
Expand All @@ -265,14 +265,15 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeString(formatter.pattern());
out.writeString(timeZone.getId());
out.writeVInt(resolution.ordinal());
if (out.getVersion().onOrAfter(Version.V_7_7_0) && out.getVersion().before(Version.V_8_0_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_7_0)
&& out.getTransportVersion().before(TransportVersion.V_8_0_0)) {
/* when serializing to 7.7+ send out a flag indicating if a pattern is of joda style
This is only used to support joda style indices in 7.x, in 8 we no longer support this.
All indices in 8 should use java style pattern. Hence this flag is always false.
*/
out.writeBoolean(false);
}
if (out.getVersion().onOrAfter(Version.V_7_13_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_13_0)) {
out.writeBoolean(formatSortValues);
}
}
Expand Down
5 changes: 3 additions & 2 deletions server/src/main/java/org/elasticsearch/search/SearchHit.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import org.apache.lucene.search.Explanation;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.Version;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.Strings;
Expand Down Expand Up @@ -134,7 +135,7 @@ public SearchHit(StreamInput in) throws IOException {
docId = -1;
score = in.readFloat();
id = in.readOptionalText();
if (in.getVersion().before(Version.V_8_0_0)) {
if (in.getTransportVersion().before(TransportVersion.V_8_0_0)) {
in.readOptionalText();
}
nestedIdentity = in.readOptionalWriteable(NestedIdentity::new);
Expand All @@ -148,7 +149,7 @@ public SearchHit(StreamInput in) throws IOException {
if (in.readBoolean()) {
explanation = readExplanation(in);
}
if (in.getVersion().onOrAfter(Version.V_7_8_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_8_0)) {
documentFields.putAll(in.readMap(StreamInput::readString, DocumentField::new));
metaFields.putAll(in.readMap(StreamInput::readString, DocumentField::new));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.elasticsearch.search.aggregations.bucket.composite;

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 @@ -55,7 +55,7 @@ public abstract class CompositeValuesSourceBuilder<AB extends CompositeValuesSou
this.userValueTypeHint = ValueType.readFromStream(in);
}
this.missingBucket = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_7_16_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_16_0)) {
this.missingOrder = MissingOrder.readFromStream(in);
}
this.order = SortOrder.readFromStream(in);
Expand All @@ -77,7 +77,7 @@ public final void writeTo(StreamOutput out) throws IOException {
userValueTypeHint.writeTo(out);
}
out.writeBoolean(missingBucket);
if (out.getVersion().onOrAfter(Version.V_7_16_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_16_0)) {
missingOrder.writeTo(out);
}
order.writeTo(out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
package org.elasticsearch.search.aggregations.bucket.composite;

import org.apache.lucene.index.IndexReader;
import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.common.Rounding;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand Down Expand Up @@ -105,7 +105,7 @@ protected DateHistogramValuesSourceBuilder(StreamInput in) throws IOException {
super(in);
dateHistogramInterval = new DateIntervalWrapper(in);
timeZone = in.readOptionalZoneId();
if (in.getVersion().onOrAfter(Version.V_7_6_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_6_0)) {
offset = in.readLong();
}
}
Expand All @@ -114,7 +114,7 @@ protected DateHistogramValuesSourceBuilder(StreamInput in) throws IOException {
protected void innerWriteTo(StreamOutput out) throws IOException {
dateHistogramInterval.writeTo(out);
out.writeOptionalZoneId(timeZone);
if (out.getVersion().onOrAfter(Version.V_7_6_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_6_0)) {
out.writeLong(offset);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.PriorityQueue;
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.search.DocValueFormat;
Expand Down Expand Up @@ -80,15 +80,15 @@ public InternalComposite(StreamInput in) throws IOException {
formats.add(in.readNamedWriteable(DocValueFormat.class));
}
this.reverseMuls = in.readIntArray();
if (in.getVersion().onOrAfter(Version.V_7_16_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_16_0)) {
this.missingOrders = in.readArray(MissingOrder::readFromStream, MissingOrder[]::new);
} else {
this.missingOrders = new MissingOrder[reverseMuls.length];
Arrays.fill(missingOrders, MissingOrder.DEFAULT);
}
this.buckets = in.readList((input) -> new InternalBucket(input, sourceNames, formats, reverseMuls, missingOrders));
this.afterKey = in.readOptionalWriteable(CompositeKey::new);
this.earlyTerminated = in.getVersion().onOrAfter(Version.V_7_6_0) ? in.readBoolean() : false;
this.earlyTerminated = in.getTransportVersion().onOrAfter(TransportVersion.V_7_6_0) ? in.readBoolean() : false;
}

@Override
Expand All @@ -99,12 +99,12 @@ protected void doWriteTo(StreamOutput out) throws IOException {
out.writeNamedWriteable(format);
}
out.writeIntArray(reverseMuls);
if (out.getVersion().onOrAfter(Version.V_7_16_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_16_0)) {
out.writeArray((o, order) -> order.writeTo(o), missingOrders);
}
out.writeList(buckets);
out.writeOptionalWriteable(afterKey);
if (out.getVersion().onOrAfter(Version.V_7_6_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_6_0)) {
out.writeBoolean(earlyTerminated);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
package org.elasticsearch.search.aggregations.bucket.geogrid;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.common.geo.GeoBoundingBox;
import org.elasticsearch.common.geo.GeoPoint;
import org.elasticsearch.common.io.stream.StreamInput;
Expand Down Expand Up @@ -91,7 +91,7 @@ public GeoGridAggregationBuilder(StreamInput in) throws IOException {
precision = in.readVInt();
requiredSize = in.readVInt();
shardSize = in.readVInt();
if (in.getVersion().onOrAfter(Version.V_7_6_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_6_0)) {
geoBoundingBox = new GeoBoundingBox(in);
}
}
Expand All @@ -111,7 +111,7 @@ protected void innerWriteTo(StreamOutput out) throws IOException {
out.writeVInt(precision);
out.writeVInt(requiredSize);
out.writeVInt(shardSize);
if (out.getVersion().onOrAfter(Version.V_7_6_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_6_0)) {
geoBoundingBox.writeTo(out);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
package org.elasticsearch.search.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 @@ -157,7 +156,7 @@ public DateHistogramAggregationBuilder(StreamInput in) throws IOException {
dateHistogramInterval = new DateIntervalWrapper(in);
offset = in.readLong();
extendedBounds = in.readOptionalWriteable(LongBounds::new);
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_10_0)) {
hardBounds = in.readOptionalWriteable(LongBounds::new);
}
}
Expand All @@ -180,7 +179,7 @@ protected void innerWriteTo(StreamOutput out) throws IOException {
dateHistogramInterval.writeTo(out);
out.writeLong(offset);
out.writeOptionalWriteable(extendedBounds);
if (out.getVersion().onOrAfter(Version.V_7_10_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_10_0)) {
out.writeOptionalWriteable(hardBounds);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public HistogramAggregationBuilder(StreamInput in) throws IOException {
minDocCount = in.readVLong();
interval = in.readDouble();
offset = in.readDouble();
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_10_0)) {
extendedBounds = in.readOptionalWriteable(DoubleBounds::new);
hardBounds = in.readOptionalWriteable(DoubleBounds::new);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
package org.elasticsearch.search.aggregations.bucket.missing;

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.aggregations.AggregationBuilder;
Expand Down Expand Up @@ -82,7 +81,7 @@ protected void innerWriteTo(StreamOutput out) {
}

@Override
protected boolean serializeTargetValueType(Version version) {
protected boolean serializeTargetValueType(TransportVersion version) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
package org.elasticsearch.search.aggregations.bucket.range;

import org.apache.lucene.util.BytesRef;
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.search.DocValueFormat;
Expand Down Expand Up @@ -72,8 +72,8 @@ private static String generateKey(BytesRef from, BytesRef to, DocValueFormat for
private static Bucket createFromStream(StreamInput in, DocValueFormat format, boolean keyed) throws IOException {
// NOTE: the key is required in version == 8.0.0 and version <= 7.17.0,
// while it is optional for all subsequent versions.
String key = in.getVersion().equals(Version.V_8_0_0) ? in.readString()
: in.getVersion().onOrAfter(Version.V_7_17_1) ? in.readOptionalString()
String key = in.getTransportVersion().equals(TransportVersion.V_8_0_0) ? in.readString()
: in.getTransportVersion().onOrAfter(TransportVersion.V_7_17_1) ? in.readOptionalString()
: in.readString();
BytesRef from = in.readBoolean() ? in.readBytesRef() : null;
BytesRef to = in.readBoolean() ? in.readBytesRef() : null;
Expand All @@ -85,9 +85,9 @@ private static Bucket createFromStream(StreamInput in, DocValueFormat format, bo

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().equals(Version.V_8_0_0)) {
if (out.getTransportVersion().equals(TransportVersion.V_8_0_0)) {
out.writeString(key == null ? generateKey(from, to, format) : key);
} else if (out.getVersion().onOrAfter(Version.V_7_17_1)) {
} else if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_17_1)) {
out.writeOptionalString(key);
} else {
out.writeString(key == null ? generateKey(from, to, format) : key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
package org.elasticsearch.search.aggregations.bucket.range;

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.search.DocValueFormat;
Expand Down Expand Up @@ -160,19 +160,19 @@ private static String generateKey(double from, double to, DocValueFormat format)
public void writeTo(StreamOutput out) throws IOException {
// NOTE: the key is required in version == 8.0.0 and version <= 7.17.0,
// while it is optional for all subsequent versions.
if (out.getVersion().equals(Version.V_8_0_0)) {
if (out.getTransportVersion().equals(TransportVersion.V_8_0_0)) {
out.writeString(key == null ? generateKey(from, to, format) : key);
} else if (out.getVersion().onOrAfter(Version.V_7_17_1)) {
} else if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_17_1)) {
out.writeOptionalString(key);
} else {
out.writeString(key == null ? generateKey(from, to, format) : key);
}
out.writeDouble(from);
if (out.getVersion().onOrAfter(Version.V_7_17_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_17_0)) {
out.writeOptionalDouble(from);
}
out.writeDouble(to);
if (out.getVersion().onOrAfter(Version.V_7_17_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_17_0)) {
out.writeOptionalDouble(to);
}
out.writeVLong(docCount);
Expand Down Expand Up @@ -270,11 +270,11 @@ public InternalRange(StreamInput in) throws IOException {
for (int i = 0; i < size; i++) {
// NOTE: the key is required in version == 8.0.0 and version <= 7.17.0,
// while it is optional for all subsequent versions.
final String key = in.getVersion().equals(Version.V_8_0_0) ? in.readString()
: in.getVersion().onOrAfter(Version.V_7_17_1) ? in.readOptionalString()
final String key = in.getTransportVersion().equals(TransportVersion.V_8_0_0) ? in.readString()
: in.getTransportVersion().onOrAfter(TransportVersion.V_7_17_1) ? in.readOptionalString()
: in.readString();
double from = in.readDouble();
if (in.getVersion().onOrAfter(Version.V_7_17_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_17_0)) {
final Double originalFrom = in.readOptionalDouble();
if (originalFrom != null) {
from = originalFrom;
Expand All @@ -283,7 +283,7 @@ public InternalRange(StreamInput in) throws IOException {
}
}
double to = in.readDouble();
if (in.getVersion().onOrAfter(Version.V_7_17_0)) {
if (in.getTransportVersion().onOrAfter(TransportVersion.V_7_17_0)) {
final Double originalTo = in.readOptionalDouble();
if (originalTo != null) {
to = originalTo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import org.apache.lucene.search.ScoreMode;
import org.apache.lucene.search.ScorerSupplier;
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 @@ -174,8 +174,8 @@ public Range(StreamInput in) throws IOException {
toAsStr = in.readOptionalString();
from = in.readDouble();
to = in.readDouble();
originalFrom = in.getVersion().onOrAfter(Version.V_7_17_0) ? in.readOptionalDouble() : Double.valueOf(from);
originalTo = in.getVersion().onOrAfter(Version.V_7_17_0) ? in.readOptionalDouble() : Double.valueOf(to);
originalFrom = in.getTransportVersion().onOrAfter(TransportVersion.V_7_17_0) ? in.readOptionalDouble() : Double.valueOf(from);
originalTo = in.getTransportVersion().onOrAfter(TransportVersion.V_7_17_0) ? in.readOptionalDouble() : Double.valueOf(to);
}

@Override
Expand All @@ -185,7 +185,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalString(toAsStr);
out.writeDouble(from);
out.writeDouble(to);
if (out.getVersion().onOrAfter(Version.V_7_17_0)) {
if (out.getTransportVersion().onOrAfter(TransportVersion.V_7_17_0)) {
out.writeOptionalDouble(originalFrom);
out.writeOptionalDouble(originalTo);
}
Expand Down
Loading