Skip to content

Commit c71ffe5

Browse files
authored
Remove usages of 8_6_X transport versions (#136336)
1 parent a509378 commit c71ffe5

File tree

19 files changed

+58
-180
lines changed

19 files changed

+58
-180
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ static TransportVersion def(int id) {
6161
public static final TransportVersion V_7_9_0 = def(7_09_00_99);
6262
public static final TransportVersion V_7_10_0 = def(7_10_00_99);
6363
public static final TransportVersion V_8_0_0 = def(8_00_00_99);
64-
public static final TransportVersion V_8_6_0 = def(8_06_00_99);
65-
public static final TransportVersion V_8_6_1 = def(8_06_01_99);
6664
public static final TransportVersion V_8_7_0 = def(8_07_00_99);
6765
public static final TransportVersion V_8_7_1 = def(8_07_01_99);
6866
public static final TransportVersion V_8_8_0 = def(8_08_00_99);

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
@@ -40,11 +40,7 @@ public ClusterStatsNodeResponse(StreamInput in) throws IOException {
4040
this.nodeInfo = new NodeInfo(in);
4141
this.nodeStats = new NodeStats(in);
4242
this.shardsStats = in.readArray(ShardStats::new, ShardStats[]::new);
43-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_6_0)) {
44-
searchUsageStats = new SearchUsageStats(in);
45-
} else {
46-
searchUsageStats = new SearchUsageStats();
47-
}
43+
searchUsageStats = new SearchUsageStats(in);
4844
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_16_0)) {
4945
repositoryUsageStats = RepositoryUsageStats.readFrom(in);
5046
searchCcsMetrics = new CCSTelemetrySnapshot(in);
@@ -120,9 +116,7 @@ public void writeTo(StreamOutput out) throws IOException {
120116
nodeInfo.writeTo(out);
121117
nodeStats.writeTo(out);
122118
out.writeArray(shardsStats);
123-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_6_0)) {
124-
searchUsageStats.writeTo(out);
125-
}
119+
searchUsageStats.writeTo(out);
126120
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_16_0)) {
127121
repositoryUsageStats.writeTo(out);
128122
searchCcsMetrics.writeTo(out);

server/src/main/java/org/elasticsearch/cluster/coordination/PublicationTransportHandler.java

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.apache.logging.log4j.Logger;
1313
import org.elasticsearch.ElasticsearchException;
1414
import org.elasticsearch.TransportVersion;
15-
import org.elasticsearch.TransportVersions;
1615
import org.elasticsearch.action.ActionListener;
1716
import org.elasticsearch.action.ActionRunnable;
1817
import org.elasticsearch.action.support.ChannelActionListener;
@@ -92,8 +91,6 @@ public class PublicationTransportHandler {
9291
TransportRequestOptions.Type.STATE
9392
);
9493

95-
public static final TransportVersion INCLUDES_LAST_COMMITTED_DATA_VERSION = TransportVersions.V_8_6_0;
96-
9794
private final SerializationStatsTracker serializationStatsTracker = new SerializationStatsTracker();
9895

9996
public PublicationTransportHandler(
@@ -187,29 +184,20 @@ private ClusterState deserializeAndApplyDiff(BytesTransportRequest request, Stre
187184
ClusterState incomingState;
188185
try {
189186
final Diff<ClusterState> diff;
190-
final boolean includesLastCommittedData = request.version().onOrAfter(INCLUDES_LAST_COMMITTED_DATA_VERSION);
191187
final boolean clusterUuidCommitted;
192188
final CoordinationMetadata.VotingConfiguration lastCommittedConfiguration;
193189

194190
// Close stream early to release resources used by the de-compression as early as possible
195191
try (StreamInput input = in) {
196192
diff = ClusterState.readDiffFrom(input, currentState.nodes().getLocalNode());
197-
if (includesLastCommittedData) {
198-
clusterUuidCommitted = in.readBoolean();
199-
lastCommittedConfiguration = new CoordinationMetadata.VotingConfiguration(in);
200-
} else {
201-
clusterUuidCommitted = false;
202-
lastCommittedConfiguration = null;
203-
}
193+
clusterUuidCommitted = in.readBoolean();
194+
lastCommittedConfiguration = new CoordinationMetadata.VotingConfiguration(in);
204195
assert input.read() == -1;
205196
}
206197
incomingState = diff.apply(currentState); // might throw IncompatibleClusterStateVersionException
207-
if (includesLastCommittedData) {
208-
final var adjustedMetadata = incomingState.metadata()
209-
.withLastCommittedValues(clusterUuidCommitted, lastCommittedConfiguration);
210-
if (adjustedMetadata != incomingState.metadata()) {
211-
incomingState = ClusterState.builder(incomingState).metadata(adjustedMetadata).build();
212-
}
198+
final var adjustedMetadata = incomingState.metadata().withLastCommittedValues(clusterUuidCommitted, lastCommittedConfiguration);
199+
if (adjustedMetadata != incomingState.metadata()) {
200+
incomingState = ClusterState.builder(incomingState).metadata(adjustedMetadata).build();
213201
}
214202
} catch (IncompatibleClusterStateVersionException e) {
215203
incompatibleClusterStateDiffReceivedCount.incrementAndGet();
@@ -305,10 +293,8 @@ private ReleasableBytesReference serializeDiffClusterState(
305293
stream.setTransportVersion(version);
306294
stream.writeBoolean(false);
307295
diff.writeTo(stream);
308-
if (version.onOrAfter(INCLUDES_LAST_COMMITTED_DATA_VERSION)) {
309-
stream.writeBoolean(newState.metadata().clusterUUIDCommitted());
310-
newState.getLastCommittedConfiguration().writeTo(stream);
311-
}
296+
stream.writeBoolean(newState.metadata().clusterUUIDCommitted());
297+
newState.getLastCommittedConfiguration().writeTo(stream);
312298
uncompressedBytes = stream.position();
313299
} catch (IOException e) {
314300
throw new ElasticsearchException("failed to serialize cluster state diff for publishing to node {}", e, node);

server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,6 @@ public Iterator<Setting<?>> settings() {
610610

611611
public static final String INDEX_STATE_FILE_PREFIX = "state-";
612612

613-
static final TransportVersion STATS_AND_FORECAST_ADDED = TransportVersions.V_8_6_0;
614-
615613
private final int routingNumShards;
616614
private final int routingFactor;
617615
private final int routingPartitionSize;
@@ -1726,15 +1724,9 @@ private static class IndexMetadataDiff implements Diff<IndexMetadata> {
17261724
}
17271725
isSystem = in.readBoolean();
17281726
timestampRange = IndexLongFieldRange.readFrom(in);
1729-
if (in.getTransportVersion().onOrAfter(STATS_AND_FORECAST_ADDED)) {
1730-
stats = in.readOptionalWriteable(IndexMetadataStats::new);
1731-
indexWriteLoadForecast = in.readOptionalDouble();
1732-
shardSizeInBytesForecast = in.readOptionalLong();
1733-
} else {
1734-
stats = null;
1735-
indexWriteLoadForecast = null;
1736-
shardSizeInBytesForecast = null;
1737-
}
1727+
stats = in.readOptionalWriteable(IndexMetadataStats::new);
1728+
indexWriteLoadForecast = in.readOptionalDouble();
1729+
shardSizeInBytesForecast = in.readOptionalLong();
17381730
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
17391731
eventIngestedRange = IndexLongFieldRange.readFrom(in);
17401732
} else {
@@ -1773,11 +1765,9 @@ public void writeTo(StreamOutput out) throws IOException {
17731765
}
17741766
out.writeBoolean(isSystem);
17751767
timestampRange.writeTo(out);
1776-
if (out.getTransportVersion().onOrAfter(STATS_AND_FORECAST_ADDED)) {
1777-
out.writeOptionalWriteable(stats);
1778-
out.writeOptionalDouble(indexWriteLoadForecast);
1779-
out.writeOptionalLong(shardSizeInBytesForecast);
1780-
}
1768+
out.writeOptionalWriteable(stats);
1769+
out.writeOptionalDouble(indexWriteLoadForecast);
1770+
out.writeOptionalLong(shardSizeInBytesForecast);
17811771
eventIngestedRange.writeTo(out);
17821772
if (out.getTransportVersion().supports(INDEX_RESHARDING_METADATA)) {
17831773
out.writeOptionalWriteable(reshardingMetadata);
@@ -1880,11 +1870,9 @@ public static IndexMetadata readFrom(StreamInput in, @Nullable Function<String,
18801870
builder.system(in.readBoolean());
18811871
builder.timestampRange(IndexLongFieldRange.readFrom(in));
18821872

1883-
if (in.getTransportVersion().onOrAfter(STATS_AND_FORECAST_ADDED)) {
1884-
builder.stats(in.readOptionalWriteable(IndexMetadataStats::new));
1885-
builder.indexWriteLoadForecast(in.readOptionalDouble());
1886-
builder.shardSizeInBytesForecast(in.readOptionalLong());
1887-
}
1873+
builder.stats(in.readOptionalWriteable(IndexMetadataStats::new));
1874+
builder.indexWriteLoadForecast(in.readOptionalDouble());
1875+
builder.shardSizeInBytesForecast(in.readOptionalLong());
18881876
builder.eventIngestedRange(IndexLongFieldRange.readFrom(in));
18891877
if (in.getTransportVersion().supports(INDEX_RESHARDING_METADATA)) {
18901878
builder.reshardingMetadata(in.readOptionalWriteable(IndexReshardingMetadata::new));
@@ -1932,11 +1920,9 @@ public void writeTo(StreamOutput out, boolean mappingsAsHash) throws IOException
19321920
}
19331921
out.writeBoolean(isSystem);
19341922
timestampRange.writeTo(out);
1935-
if (out.getTransportVersion().onOrAfter(STATS_AND_FORECAST_ADDED)) {
1936-
out.writeOptionalWriteable(stats);
1937-
out.writeOptionalDouble(writeLoadForecast);
1938-
out.writeOptionalLong(shardSizeInBytesForecast);
1939-
}
1923+
out.writeOptionalWriteable(stats);
1924+
out.writeOptionalDouble(writeLoadForecast);
1925+
out.writeOptionalLong(shardSizeInBytesForecast);
19401926
eventIngestedRange.writeTo(out);
19411927
if (out.getTransportVersion().supports(INDEX_RESHARDING_METADATA)) {
19421928
out.writeOptionalWriteable(reshardingMetadata);

server/src/main/java/org/elasticsearch/cluster/routing/ShardRouting.java

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

1010
package org.elasticsearch.cluster.routing;
1111

12-
import org.elasticsearch.TransportVersion;
1312
import org.elasticsearch.TransportVersions;
1413
import org.elasticsearch.cluster.node.DiscoveryNode;
1514
import org.elasticsearch.cluster.routing.RecoverySource.ExistingStoreRecoverySource;
@@ -42,7 +41,6 @@ public final class ShardRouting implements Writeable, ToXContentObject {
4241
* Used if shard size is not available
4342
*/
4443
public static final long UNAVAILABLE_EXPECTED_SHARD_SIZE = -1;
45-
private static final TransportVersion RELOCATION_FAILURE_INFO_VERSION = TransportVersions.V_8_6_0;
4644

4745
private final ShardId shardId;
4846
private final String currentNodeId;
@@ -342,11 +340,7 @@ public ShardRouting(ShardId shardId, StreamInput in) throws IOException {
342340
recoverySource = null;
343341
}
344342
unassignedInfo = in.readOptionalWriteable(UnassignedInfo::fromStreamInput);
345-
if (in.getTransportVersion().onOrAfter(RELOCATION_FAILURE_INFO_VERSION)) {
346-
relocationFailureInfo = RelocationFailureInfo.readFrom(in);
347-
} else {
348-
relocationFailureInfo = RelocationFailureInfo.NO_FAILURES;
349-
}
343+
relocationFailureInfo = RelocationFailureInfo.readFrom(in);
350344
allocationId = in.readOptionalWriteable(AllocationId::new);
351345
if (state == ShardRoutingState.RELOCATING || state == ShardRoutingState.INITIALIZING || state == ShardRoutingState.STARTED) {
352346
expectedShardSize = in.readLong();
@@ -380,9 +374,7 @@ public void writeToThin(StreamOutput out) throws IOException {
380374
recoverySource.writeTo(out);
381375
}
382376
out.writeOptionalWriteable(unassignedInfo);
383-
if (out.getTransportVersion().onOrAfter(RELOCATION_FAILURE_INFO_VERSION)) {
384-
relocationFailureInfo.writeTo(out);
385-
}
377+
relocationFailureInfo.writeTo(out);
386378
out.writeOptionalWriteable(allocationId);
387379
if (state == ShardRoutingState.RELOCATING || state == ShardRoutingState.INITIALIZING || state == ShardRoutingState.STARTED) {
388380
out.writeLong(expectedShardSize);

server/src/main/java/org/elasticsearch/index/shard/IndexingStats.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public static class Stats implements Writeable, ToXContentFragment {
3535
private static final TransportVersion INDEX_STATS_AND_METADATA_INCLUDE_PEAK_WRITE_LOAD = TransportVersion.fromName(
3636
"index_stats_and_metadata_include_peak_write_load"
3737
);
38-
private static final TransportVersion WRITE_LOAD_AVG_SUPPORTED_VERSION = TransportVersions.V_8_6_0;
3938
private static final TransportVersion WRITE_LOAD_INCLUDES_BUFFER_WRITES = TransportVersion.fromName(
4039
"write_load_includes_buffer_writes"
4140
);
@@ -74,10 +73,8 @@ public Stats(StreamInput in) throws IOException {
7473
noopUpdateCount = in.readVLong();
7574
isThrottled = in.readBoolean();
7675
throttleTimeInMillis = in.readLong();
77-
if (in.getTransportVersion().onOrAfter(WRITE_LOAD_AVG_SUPPORTED_VERSION)) {
78-
totalIndexingTimeSinceShardStartedInNanos = in.readLong();
79-
totalActiveTimeInNanos = in.readLong();
80-
}
76+
totalIndexingTimeSinceShardStartedInNanos = in.readLong();
77+
totalActiveTimeInNanos = in.readLong();
8178
if (in.getTransportVersion().supports(INDEXING_STATS_INCLUDES_RECENT_WRITE_LOAD)) {
8279
recentIndexingLoad = in.readDouble();
8380
} else {
@@ -312,10 +309,8 @@ public void writeTo(StreamOutput out) throws IOException {
312309
out.writeVLong(noopUpdateCount);
313310
out.writeBoolean(isThrottled);
314311
out.writeLong(throttleTimeInMillis);
315-
if (out.getTransportVersion().onOrAfter(WRITE_LOAD_AVG_SUPPORTED_VERSION)) {
316-
out.writeLong(totalIndexingTimeSinceShardStartedInNanos);
317-
out.writeLong(totalActiveTimeInNanos);
318-
}
312+
out.writeLong(totalIndexingTimeSinceShardStartedInNanos);
313+
out.writeLong(totalActiveTimeInNanos);
319314
if (out.getTransportVersion().supports(INDEXING_STATS_INCLUDES_RECENT_WRITE_LOAD)) {
320315
out.writeDouble(recentIndexingLoad);
321316
}

server/src/main/java/org/elasticsearch/search/dfs/DfsSearchResult.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ public DfsSearchResult(StreamInput in) throws IOException {
6060
DfsKnnResults results = in.readOptionalWriteable(DfsKnnResults::new);
6161
knnResults = results != null ? List.of(results) : List.of();
6262
}
63-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_6_0)) {
64-
searchProfileDfsPhaseResult = in.readOptionalWriteable(SearchProfileDfsPhaseResult::new);
65-
}
63+
searchProfileDfsPhaseResult = in.readOptionalWriteable(SearchProfileDfsPhaseResult::new);
6664
}
6765

6866
public DfsSearchResult(ShardSearchContextId contextId, SearchShardTarget shardTarget, ShardSearchRequest shardSearchRequest) {
@@ -146,9 +144,7 @@ public void writeTo(StreamOutput out) throws IOException {
146144
}
147145
out.writeOptionalWriteable(knnResults == null || knnResults.isEmpty() ? null : knnResults.get(0));
148146
}
149-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_6_0)) {
150-
out.writeOptionalWriteable(searchProfileDfsPhaseResult);
151-
}
147+
out.writeOptionalWriteable(searchProfileDfsPhaseResult);
152148
}
153149

154150
public static void writeFieldStats(StreamOutput out, Map<String, CollectionStatistics> fieldStatistics) throws IOException {

server/src/main/java/org/elasticsearch/search/profile/SearchProfileQueryPhaseResult.java

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

1010
package org.elasticsearch.search.profile;
1111

12-
import org.elasticsearch.TransportVersions;
1312
import org.elasticsearch.common.io.stream.StreamInput;
1413
import org.elasticsearch.common.io.stream.StreamOutput;
1514
import org.elasticsearch.common.io.stream.Writeable;
@@ -43,9 +42,7 @@ public SearchProfileQueryPhaseResult(
4342
}
4443

4544
public SearchProfileQueryPhaseResult(StreamInput in) throws IOException {
46-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_6_0)) {
47-
searchProfileDfsPhaseResult = in.readOptionalWriteable(SearchProfileDfsPhaseResult::new);
48-
}
45+
searchProfileDfsPhaseResult = in.readOptionalWriteable(SearchProfileDfsPhaseResult::new);
4946
int profileSize = in.readVInt();
5047
List<QueryProfileShardResult> queryProfileResults = new ArrayList<>(profileSize);
5148
for (int i = 0; i < profileSize; i++) {
@@ -58,9 +55,7 @@ public SearchProfileQueryPhaseResult(StreamInput in) throws IOException {
5855

5956
@Override
6057
public void writeTo(StreamOutput out) throws IOException {
61-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_6_0)) {
62-
out.writeOptionalWriteable(searchProfileDfsPhaseResult);
63-
}
58+
out.writeOptionalWriteable(searchProfileDfsPhaseResult);
6459
out.writeVInt(queryProfileResults.size());
6560
for (QueryProfileShardResult queryShardResult : queryProfileResults) {
6661
queryShardResult.writeTo(out);

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/InferTrainedModelDeploymentAction.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -278,22 +278,14 @@ public Response(StreamInput in) throws IOException {
278278
super(in);
279279

280280
// Multiple results added in 8.6.1
281-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_6_1)) {
282-
results = in.readNamedWriteableCollectionAsList(InferenceResults.class);
283-
} else {
284-
results = List.of(in.readNamedWriteable(InferenceResults.class));
285-
}
281+
results = in.readNamedWriteableCollectionAsList(InferenceResults.class);
286282
}
287283

288284
@Override
289285
public void writeTo(StreamOutput out) throws IOException {
290286
super.writeTo(out);
291287

292-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_6_1)) {
293-
out.writeNamedWriteableCollection(results);
294-
} else {
295-
out.writeNamedWriteable(results.get(0));
296-
}
288+
out.writeNamedWriteableCollection(results);
297289
}
298290

299291
public List<InferenceResults> getResults() {

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/StartTrainedModelDeploymentAction.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,7 @@ public Request(StreamInput in) throws IOException {
176176
threadsPerAllocation = in.readVInt();
177177
queueCapacity = in.readVInt();
178178
this.cacheSize = in.readOptionalWriteable(ByteSizeValue::readFrom);
179-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_6_0)) {
180-
this.priority = in.readEnum(Priority.class);
181-
} else {
182-
this.priority = Priority.NORMAL;
183-
}
179+
this.priority = in.readEnum(Priority.class);
184180
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
185181
this.deploymentId = in.readString();
186182
} else {
@@ -302,9 +298,7 @@ public void writeTo(StreamOutput out) throws IOException {
302298
out.writeVInt(threadsPerAllocation);
303299
out.writeVInt(queueCapacity);
304300
out.writeOptionalWriteable(cacheSize);
305-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_6_0)) {
306-
out.writeEnum(priority);
307-
}
301+
out.writeEnum(priority);
308302
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
309303
out.writeString(deploymentId);
310304
}
@@ -574,11 +568,7 @@ public TaskParams(StreamInput in) throws IOException {
574568
this.numberOfAllocations = in.readVInt();
575569
this.queueCapacity = in.readVInt();
576570
this.cacheSize = in.readOptionalWriteable(ByteSizeValue::readFrom);
577-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_6_0)) {
578-
this.priority = in.readEnum(Priority.class);
579-
} else {
580-
this.priority = Priority.NORMAL;
581-
}
571+
this.priority = in.readEnum(Priority.class);
582572
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
583573
this.deploymentId = in.readString();
584574
} else {
@@ -638,9 +628,7 @@ public void writeTo(StreamOutput out) throws IOException {
638628
out.writeVInt(numberOfAllocations);
639629
out.writeVInt(queueCapacity);
640630
out.writeOptionalWriteable(cacheSize);
641-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_6_0)) {
642-
out.writeEnum(priority);
643-
}
631+
out.writeEnum(priority);
644632
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
645633
out.writeString(deploymentId);
646634
}

0 commit comments

Comments
 (0)