Skip to content

Commit 72a33b3

Browse files
authored
Remove transport version constant V_8_18_0 (elastic#138844) (elastic#138925)
ES-13702
1 parent 2f96f00 commit 72a33b3

File tree

78 files changed

+195
-829
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+195
-829
lines changed

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/AddIndexBlockRollingUpgradeIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import com.carrotsearch.randomizedtesting.annotations.Name;
1515

16-
import org.elasticsearch.TransportVersions;
16+
import org.elasticsearch.TransportVersion;
1717
import org.elasticsearch.client.Request;
1818
import org.elasticsearch.client.ResponseException;
1919
import org.elasticsearch.cluster.metadata.IndexMetadata;
@@ -39,7 +39,7 @@ public void testAddBlock() throws Exception {
3939
} else if (isMixedCluster()) {
4040
blockWrites();
4141
// this is used both for upgrading from 9.0.0 to current and from 8.18 to current.
42-
if (minimumTransportVersion().supports(TransportVersions.V_8_18_0) == false) {
42+
if (minimumTransportVersion().supports(TransportVersion.fromId(8840000)) == false) {
4343
assertNull(verifiedSettingValue());
4444
} else {
4545
assertThat(verifiedSettingValue(), Matchers.equalTo("true"));

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ static TransportVersion def(int id) {
9797
public static final TransportVersion INITIAL_ELASTICSEARCH_8_17_3 = def(8_797_0_03);
9898
public static final TransportVersion INITIAL_ELASTICSEARCH_8_17_4 = def(8_797_0_04);
9999
public static final TransportVersion INITIAL_ELASTICSEARCH_8_17_5 = def(8_797_0_05);
100-
public static final TransportVersion V_8_18_0 = def(8_840_0_00);
101100

102101
/*
103102
* STOP! READ THIS FIRST! No, really,

server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodeResponse.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ public ClusterStatsNodeResponse(StreamInput in) throws IOException {
5252
repositoryUsageStats = RepositoryUsageStats.EMPTY;
5353
searchCcsMetrics = new CCSTelemetrySnapshot();
5454
}
55-
if (in.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
56-
esqlCcsMetrics = new CCSTelemetrySnapshot(in);
57-
} else {
58-
esqlCcsMetrics = new CCSTelemetrySnapshot();
59-
}
55+
esqlCcsMetrics = new CCSTelemetrySnapshot(in);
6056
}
6157

6258
public ClusterStatsNodeResponse(
@@ -131,9 +127,7 @@ public void writeTo(StreamOutput out) throws IOException {
131127
repositoryUsageStats.writeTo(out);
132128
searchCcsMetrics.writeTo(out);
133129
} // else just drop these stats, ok for bwc
134-
if (out.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
135-
esqlCcsMetrics.writeTo(out);
136-
}
130+
esqlCcsMetrics.writeTo(out);
137131
}
138132

139133
}

server/src/main/java/org/elasticsearch/action/admin/cluster/stats/MappingStats.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
package org.elasticsearch.action.admin.cluster.stats;
1111

12-
import org.elasticsearch.TransportVersion;
1312
import org.elasticsearch.TransportVersions;
1413
import org.elasticsearch.cluster.metadata.IndexMetadata;
1514
import org.elasticsearch.cluster.metadata.MappingMetadata;
@@ -270,9 +269,7 @@ private static int countOccurrences(String script, Pattern pattern) {
270269
fieldTypeStats = in.readCollectionAsImmutableList(FieldStats::new);
271270
runtimeFieldStats = in.readCollectionAsImmutableList(RuntimeFieldStats::new);
272271
var transportVersion = in.getTransportVersion();
273-
sourceModeUsageCount = canReadOrWriteSourceModeTelemetry(transportVersion)
274-
? in.readImmutableMap(StreamInput::readString, StreamInput::readVInt)
275-
: Map.of();
272+
sourceModeUsageCount = in.readImmutableMap(StreamInput::readString, StreamInput::readVInt);
276273
}
277274

278275
@Override
@@ -284,14 +281,7 @@ public void writeTo(StreamOutput out) throws IOException {
284281
}
285282
out.writeCollection(fieldTypeStats);
286283
out.writeCollection(runtimeFieldStats);
287-
var transportVersion = out.getTransportVersion();
288-
if (canReadOrWriteSourceModeTelemetry(transportVersion)) {
289-
out.writeMap(sourceModeUsageCount, StreamOutput::writeVInt);
290-
}
291-
}
292-
293-
private static boolean canReadOrWriteSourceModeTelemetry(TransportVersion version) {
294-
return version.isPatchFrom(TransportVersions.V_8_17_0) || version.supports(TransportVersions.V_8_18_0);
284+
out.writeMap(sourceModeUsageCount, StreamOutput::writeVInt);
295285
}
296286

297287
private static OptionalLong ofNullable(Long l) {

server/src/main/java/org/elasticsearch/action/admin/indices/readonly/AddIndexBlockRequest.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
package org.elasticsearch.action.admin.indices.readonly;
1111

12-
import org.elasticsearch.TransportVersions;
1312
import org.elasticsearch.action.ActionRequestValidationException;
1413
import org.elasticsearch.action.IndicesRequest;
1514
import org.elasticsearch.action.support.IndicesOptions;
@@ -40,11 +39,7 @@ public AddIndexBlockRequest(StreamInput in) throws IOException {
4039
indices = in.readStringArray();
4140
indicesOptions = IndicesOptions.readIndicesOptions(in);
4241
block = APIBlock.readFrom(in);
43-
if (in.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
44-
markVerified = in.readBoolean();
45-
} else {
46-
markVerified = false;
47-
}
42+
markVerified = in.readBoolean();
4843
}
4944

5045
/**
@@ -132,9 +127,7 @@ public void writeTo(StreamOutput out) throws IOException {
132127
out.writeStringArray(indices);
133128
indicesOptions.writeIndicesOptions(out);
134129
block.writeTo(out);
135-
if (out.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
136-
out.writeBoolean(markVerified);
137-
}
130+
out.writeBoolean(markVerified);
138131
}
139132

140133
@Override

server/src/main/java/org/elasticsearch/action/admin/indices/readonly/TransportVerifyShardIndexBlockAction.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99
package org.elasticsearch.action.admin.indices.readonly;
1010

11-
import org.elasticsearch.TransportVersions;
1211
import org.elasticsearch.action.ActionListener;
1312
import org.elasticsearch.action.ActionType;
1413
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
@@ -181,11 +180,7 @@ public static final class ShardRequest extends ReplicationRequest<ShardRequest>
181180
ShardRequest(StreamInput in) throws IOException {
182181
super(in);
183182
clusterBlock = new ClusterBlock(in);
184-
if (in.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
185-
phase1 = in.readBoolean();
186-
} else {
187-
phase1 = true; // does not matter, not verified anyway
188-
}
183+
phase1 = in.readBoolean();
189184
}
190185

191186
public ShardRequest(final ShardId shardId, final ClusterBlock clusterBlock, boolean phase1, final TaskId parentTaskId) {
@@ -204,9 +199,7 @@ public String toString() {
204199
public void writeTo(final StreamOutput out) throws IOException {
205200
super.writeTo(out);
206201
clusterBlock.writeTo(out);
207-
if (out.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
208-
out.writeBoolean(phase1);
209-
}
202+
out.writeBoolean(phase1);
210203
}
211204

212205
public ClusterBlock clusterBlock() {

server/src/main/java/org/elasticsearch/action/admin/indices/resolve/ResolveClusterActionRequest.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,9 @@ public ResolveClusterActionRequest(StreamInput in) throws IOException {
8484
this.names = in.readStringArray();
8585
this.indicesOptions = IndicesOptions.readIndicesOptions(in);
8686
this.localIndicesRequested = localIndicesPresent(names);
87-
if (in.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
88-
this.clusterInfoOnly = in.readBoolean();
89-
this.isQueryingCluster = in.readBoolean();
90-
this.timeout = in.readOptionalTimeValue();
91-
} else {
92-
this.clusterInfoOnly = false;
93-
this.isQueryingCluster = false;
94-
}
87+
this.clusterInfoOnly = in.readBoolean();
88+
this.isQueryingCluster = in.readBoolean();
89+
this.timeout = in.readOptionalTimeValue();
9590
}
9691

9792
@Override
@@ -102,11 +97,9 @@ public void writeTo(StreamOutput out) throws IOException {
10297
}
10398
out.writeStringArray(names);
10499
indicesOptions.writeIndicesOptions(out);
105-
if (out.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
106-
out.writeBoolean(clusterInfoOnly);
107-
out.writeBoolean(isQueryingCluster);
108-
out.writeOptionalTimeValue(timeout);
109-
}
100+
out.writeBoolean(clusterInfoOnly);
101+
out.writeBoolean(isQueryingCluster);
102+
out.writeOptionalTimeValue(timeout);
110103
}
111104

112105
static String createVersionErrorMessage(TransportVersion versionFound) {

server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ public BulkRequest(StreamInput in) throws IOException {
112112
} else {
113113
incrementalState = BulkRequest.IncrementalState.EMPTY;
114114
}
115-
if (in.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
116-
includeSourceOnError = in.readBoolean();
117-
} // else default value is true
115+
includeSourceOnError = in.readBoolean();
118116
if (in.getTransportVersion().supports(STREAMS_ENDPOINT_PARAM_RESTRICTIONS)) {
119117
paramsUsed = in.readCollectionAsImmutableSet(StreamInput::readString);
120118
}
@@ -481,9 +479,7 @@ public void writeTo(StreamOutput out) throws IOException {
481479
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_16_0)) {
482480
incrementalState.writeTo(out);
483481
}
484-
if (out.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
485-
out.writeBoolean(includeSourceOnError);
486-
}
482+
out.writeBoolean(includeSourceOnError);
487483
if (out.getTransportVersion().supports(STREAMS_ENDPOINT_PARAM_RESTRICTIONS)) {
488484
out.writeCollection(paramsUsed, StreamOutput::writeString);
489485
}

server/src/main/java/org/elasticsearch/action/datastreams/GetDataStreamAction.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,7 @@ public String getIndexModeName() {
339339
@Override
340340
public void writeTo(StreamOutput out) throws IOException {
341341
dataStream.writeTo(out);
342-
if (out.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
343-
out.writeBoolean(failureStoreEffectivelyEnabled);
344-
}
342+
out.writeBoolean(failureStoreEffectivelyEnabled);
345343
dataStreamStatus.writeTo(out);
346344
out.writeOptionalString(indexTemplate);
347345
out.writeOptionalString(ilmPolicyName);

server/src/main/java/org/elasticsearch/action/index/IndexRequest.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,7 @@ public IndexRequest(@Nullable ShardId shardId, StreamInput in) throws IOExceptio
227227
}
228228
}
229229

230-
if (in.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
231-
includeSourceOnError = in.readBoolean();
232-
} // else default value is true
230+
includeSourceOnError = in.readBoolean();
233231

234232
if (in.getTransportVersion().supports(INDEX_REQUEST_INCLUDE_TSID)) {
235233
tsid = in.readBytesRefOrNullIfEmpty();
@@ -817,9 +815,7 @@ private void writeBody(StreamOutput out) throws IOException {
817815
out.writeBoolean(false); // obsolete originatesFromUpdateByDoc
818816
}
819817
}
820-
if (out.getTransportVersion().supports(TransportVersions.V_8_18_0)) {
821-
out.writeBoolean(includeSourceOnError);
822-
}
818+
out.writeBoolean(includeSourceOnError);
823819
if (out.getTransportVersion().supports(INDEX_REQUEST_INCLUDE_TSID)) {
824820
out.writeBytesRef(tsid);
825821
}

0 commit comments

Comments
 (0)