Skip to content

Commit

Permalink
Remove some 7.7 and 7.8 transport versions
Browse files Browse the repository at this point in the history
  • Loading branch information
thecoop committed Dec 12, 2024
1 parent d514315 commit 4f7774a
Show file tree
Hide file tree
Showing 24 changed files with 38 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public String getWriteableName() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_7_0;
return TransportVersions.ZERO;
}

@Override
Expand Down Expand Up @@ -166,7 +166,7 @@ public String getWriteableName() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_7_0;
return TransportVersions.ZERO;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public String getWriteableName() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_7_0;
return TransportVersions.ZERO;
}

@Override
Expand Down Expand Up @@ -167,7 +167,7 @@ public String getWriteableName() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_7_0;
return TransportVersions.ZERO;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public String getWriteableName() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_7_0;
return TransportVersions.ZERO;
}

@Override
Expand Down Expand Up @@ -311,7 +311,7 @@ public String getWriteableName() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_7_0;
return TransportVersions.ZERO;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.elasticsearch.script;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand Down Expand Up @@ -79,7 +78,7 @@ public ScriptException(StreamInput in) throws IOException {
scriptStack = Arrays.asList(in.readStringArray());
script = in.readString();
lang = in.readString();
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_7_0) && in.readBoolean()) {
if (in.readBoolean()) {
pos = new Position(in);
} else {
pos = null;
Expand All @@ -92,13 +91,11 @@ protected void writeTo(StreamOutput out, Writer<Throwable> nestedExceptionsWrite
out.writeStringCollection(scriptStack);
out.writeString(script);
out.writeString(lang);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_7_0)) {
if (pos == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
pos.writeTo(out);
}
if (pos == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
pos.writeTo(out);
}
}

Expand Down
14 changes: 0 additions & 14 deletions server/src/main/java/org/elasticsearch/search/DocValueFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,6 @@ private DateTime(StreamInput in) throws IOException {
this.formatter = DateFormatter.forPattern(formatterPattern).withZone(this.timeZone).withLocale(locale);
this.parser = formatter.toDateMathParser();
this.resolution = DateFieldMapper.Resolution.ofOrdinal(in.readVInt());
if (in.getTransportVersion().between(TransportVersions.V_7_7_0, TransportVersions.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();
}
this.formatSortValues = in.readBoolean();
}

Expand All @@ -302,13 +295,6 @@ public void writeTo(StreamOutput out) throws IOException {
}
out.writeString(timeZone.getId());
out.writeVInt(resolution.ordinal());
if (out.getTransportVersion().between(TransportVersions.V_7_7_0, TransportVersions.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);
}
out.writeBoolean(formatSortValues);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,7 @@ private BanParentTaskRequest(StreamInput in) throws IOException {
parentTaskId = TaskId.readFromStream(in);
ban = in.readBoolean();
reason = ban ? in.readString() : null;
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_8_0)) {
waitForCompletion = in.readBoolean();
} else {
waitForCompletion = false;
}
waitForCompletion = in.readBoolean();
}

@Override
Expand All @@ -348,9 +344,7 @@ public void writeTo(StreamOutput out) throws IOException {
if (ban) {
out.writeString(reason);
}
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_8_0)) {
out.writeBoolean(waitForCompletion);
}
out.writeBoolean(waitForCompletion);
}
}

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

package org.elasticsearch.transport;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.cluster.ClusterName;
Expand Down Expand Up @@ -355,11 +354,7 @@ public ProxyModeInfo(String address, String serverName, int maxSocketConnections

private ProxyModeInfo(StreamInput input) throws IOException {
address = input.readString();
if (input.getTransportVersion().onOrAfter(TransportVersions.V_7_7_0)) {
serverName = input.readString();
} else {
serverName = null;
}
serverName = input.readString();
maxSocketConnections = input.readVInt();
numSocketsConnected = input.readVInt();
}
Expand All @@ -376,9 +371,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(address);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_7_0)) {
out.writeString(serverName);
}
out.writeString(serverName);
out.writeVInt(maxSocketConnections);
out.writeVInt(numSocketsConnected);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package org.elasticsearch.action;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.StreamInput;
Expand Down Expand Up @@ -43,15 +42,7 @@ public void testOriginalIndicesSerialization() throws IOException {
OriginalIndices originalIndices2 = OriginalIndices.readOriginalIndices(in);

assertThat(originalIndices2.indices(), equalTo(originalIndices.indices()));
// indices options are not equivalent when sent to an older version and re-read due
// to the addition of hidden indices as expand to hidden indices is always true when
// read from a prior version
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_7_0)
|| originalIndices.indicesOptions().expandWildcardsHidden()) {
assertThat(originalIndices2.indicesOptions(), equalTo(originalIndices.indicesOptions()));
} else if (originalIndices.indicesOptions().expandWildcardsHidden()) {
assertThat(originalIndices2.indicesOptions(), equalTo(originalIndices.indicesOptions()));
}
assertThat(originalIndices2.indicesOptions(), equalTo(originalIndices.indicesOptions()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.elasticsearch.action.admin.cluster.shards;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.StreamInput;
Expand Down Expand Up @@ -54,12 +53,7 @@ public void testSerialization() throws Exception {
in.setTransportVersion(version);
ClusterSearchShardsRequest deserialized = new ClusterSearchShardsRequest(in);
assertArrayEquals(request.indices(), deserialized.indices());
// indices options are not equivalent when sent to an older version and re-read due
// to the addition of hidden indices as expand to hidden indices is always true when
// read from a prior version
if (version.onOrAfter(TransportVersions.V_7_7_0) || request.indicesOptions().expandWildcardsHidden()) {
assertEquals(request.indicesOptions(), deserialized.indicesOptions());
}
assertEquals(request.indicesOptions(), deserialized.indicesOptions());
assertEquals(request.routing(), deserialized.routing());
assertEquals(request.preference(), deserialized.preference());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,7 @@ public void testBwcSerialization() throws Exception {
assertEquals(request.ackTimeout(), in.readTimeValue());
assertArrayEquals(request.indices(), in.readStringArray());
final IndicesOptions indicesOptions = IndicesOptions.readIndicesOptions(in);
// indices options are not equivalent when sent to an older version and re-read due
// to the addition of hidden indices as expand to hidden indices is always true when
// read from a prior version
// TODO update version on backport!
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_7_0)
|| request.indicesOptions().expandWildcardsHidden()) {
assertEquals(request.indicesOptions(), indicesOptions);
}
assertEquals(request.indicesOptions(), indicesOptions);
assertEquals(request.waitForActiveShards(), ActiveShardCount.readFrom(in));
}
}
Expand Down Expand Up @@ -92,13 +85,7 @@ public void testBwcSerialization() throws Exception {
assertEquals(sample.masterNodeTimeout(), deserializedRequest.masterNodeTimeout());
assertEquals(sample.ackTimeout(), deserializedRequest.ackTimeout());
assertArrayEquals(sample.indices(), deserializedRequest.indices());
// indices options are not equivalent when sent to an older version and re-read due
// to the addition of hidden indices as expand to hidden indices is always true when
// read from a prior version
// TODO change version on backport
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_7_0) || sample.indicesOptions().expandWildcardsHidden()) {
assertEquals(sample.indicesOptions(), deserializedRequest.indicesOptions());
}
assertEquals(sample.indicesOptions(), deserializedRequest.indicesOptions());
assertEquals(sample.waitForActiveShards(), deserializedRequest.waitForActiveShards());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@

import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.IndexVersions;
import org.elasticsearch.index.analysis.AnalyzerScope;
import org.elasticsearch.index.analysis.IndexAnalyzers;
import org.elasticsearch.index.analysis.NamedAnalyzer;
Expand Down Expand Up @@ -578,25 +575,6 @@ public void testAnalyzers() {
);
}

@UpdateForV9(owner = UpdateForV9.Owner.SEARCH_FOUNDATIONS)
@AwaitsFix(bugUrl = "this is testing legacy functionality so can likely be removed in 9.0")
public void testDeprecatedParameters() {
// 'index' is declared explicitly, 'store' is not, but is one of the previously always-accepted params
String mapping = """
{"type":"test_mapper","index":false,"store":true,"required":"value"}""";
TestMapper mapper = fromMapping(mapping, IndexVersions.V_7_8_0, TransportVersions.V_7_8_0);
assertWarnings("Parameter [store] has no effect on type [test_mapper] and will be removed in future");
assertFalse(mapper.index);
assertEquals("""
{"field":{"type":"test_mapper","index":false,"required":"value"}}""", Strings.toString(mapper));

MapperParsingException e = expectThrows(
MapperParsingException.class,
() -> fromMapping(mapping, IndexVersions.V_8_0_0, TransportVersions.V_8_0_0)
);
assertEquals("unknown parameter [store] on mapper [field] of type [test_mapper]", e.getMessage());
}

public void testLinkedAnalyzers() throws IOException {
String mapping = """
{"type":"test_mapper","analyzer":"_standard","required":"value"}""";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,6 @@ public Optional<Set<String>> getOutputFieldNames() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_7_0;
return TransportVersions.ZERO;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,6 @@ public Optional<Set<String>> getOutputFieldNames() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_7_0;
return TransportVersions.ZERO;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,6 @@ public String getType() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_8_0;
return TransportVersions.ZERO;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ public BucketCardinality bucketCardinality() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_7_0;
return TransportVersions.ZERO;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public String getWriteableName() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_8_0;
return TransportVersions.ZERO;
}

@Override
Expand Down Expand Up @@ -173,7 +173,7 @@ static Diff<AutoscalingPolicyMetadata> readFrom(final StreamInput in) throws IOE

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_8_0;
return TransportVersions.ZERO;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
package org.elasticsearch.xpack.core.analytics.action;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.FailedNodeException;
import org.elasticsearch.action.support.nodes.BaseNodeResponse;
Expand Down Expand Up @@ -138,36 +137,13 @@ public NodeResponse(DiscoveryNode node, EnumCounters<Item> counters) {

public NodeResponse(StreamInput in) throws IOException {
super(in);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_8_0)) {
counters = new EnumCounters<>(in, Item.class);
} else {
counters = new EnumCounters<>(Item.class);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_7_0)) {
counters.inc(Item.BOXPLOT, in.readVLong());
}
counters.inc(Item.CUMULATIVE_CARDINALITY, in.readZLong());
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_7_0)) {
counters.inc(Item.STRING_STATS, in.readVLong());
counters.inc(Item.TOP_METRICS, in.readVLong());
}
}
counters = new EnumCounters<>(in, Item.class);
}

@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_8_0)) {
counters.writeTo(out);
} else {
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_7_0)) {
out.writeVLong(counters.get(Item.BOXPLOT));
}
out.writeZLong(counters.get(Item.CUMULATIVE_CARDINALITY));
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_7_0)) {
out.writeVLong(counters.get(Item.STRING_STATS));
out.writeVLong(counters.get(Item.TOP_METRICS));
}
}
counters.writeTo(out);
}

public EnumCounters<Item> getStats() {
Expand Down
Loading

0 comments on commit 4f7774a

Please sign in to comment.