Skip to content

Commit bb59b3b

Browse files
committed
Remove version 8_1 checks
1 parent 9dbe154 commit bb59b3b

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ static TransportVersion def(int id) {
173173
public static final TransportVersion INFERENCE_REQUEST_ADAPTIVE_RATE_LIMITING = def(8_839_0_00);
174174
public static final TransportVersion ML_INFERENCE_IBM_WATSONX_RERANK_ADDED = def(8_840_0_00);
175175
public static final TransportVersion ELASTICSEARCH_9_0 = def(9_000_0_00);
176+
public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED = def(9_0002_0_00);
176177

177178
/*
178179
* STOP! READ THIS FIRST! No, really,

server/src/main/java/org/elasticsearch/transport/TransportStats.java

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,16 @@ public TransportStats(StreamInput in) throws IOException {
6969
rxSize = in.readVLong();
7070
txCount = in.readVLong();
7171
txSize = in.readVLong();
72-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0) && in.readBoolean()) {
73-
inboundHandlingTimeBucketFrequencies = new long[HandlingTimeTracker.BUCKET_COUNT];
74-
for (int i = 0; i < inboundHandlingTimeBucketFrequencies.length; i++) {
75-
inboundHandlingTimeBucketFrequencies[i] = in.readVLong();
76-
}
77-
outboundHandlingTimeBucketFrequencies = new long[HandlingTimeTracker.BUCKET_COUNT];
78-
for (int i = 0; i < inboundHandlingTimeBucketFrequencies.length; i++) {
79-
outboundHandlingTimeBucketFrequencies[i] = in.readVLong();
80-
}
81-
} else {
82-
inboundHandlingTimeBucketFrequencies = new long[0];
83-
outboundHandlingTimeBucketFrequencies = new long[0];
72+
if (in.getTransportVersion().before(TransportVersions.TRANSPORT_STATS_HANDLING_TIME_REQUIRED)) {
73+
in.readBoolean();
74+
}
75+
inboundHandlingTimeBucketFrequencies = new long[HandlingTimeTracker.BUCKET_COUNT];
76+
for (int i = 0; i < inboundHandlingTimeBucketFrequencies.length; i++) {
77+
inboundHandlingTimeBucketFrequencies[i] = in.readVLong();
78+
}
79+
outboundHandlingTimeBucketFrequencies = new long[HandlingTimeTracker.BUCKET_COUNT];
80+
for (int i = 0; i < inboundHandlingTimeBucketFrequencies.length; i++) {
81+
outboundHandlingTimeBucketFrequencies[i] = in.readVLong();
8482
}
8583
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
8684
transportActionStats = Collections.unmodifiableMap(in.readOrderedMap(StreamInput::readString, TransportActionStats::new));
@@ -98,15 +96,15 @@ public void writeTo(StreamOutput out) throws IOException {
9896
out.writeVLong(rxSize);
9997
out.writeVLong(txCount);
10098
out.writeVLong(txSize);
101-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_1_0)) {
102-
assert (inboundHandlingTimeBucketFrequencies.length > 0) == (outboundHandlingTimeBucketFrequencies.length > 0);
99+
assert (inboundHandlingTimeBucketFrequencies.length > 0) == (outboundHandlingTimeBucketFrequencies.length > 0);
100+
if (out.getTransportVersion().before(TransportVersions.TRANSPORT_STATS_HANDLING_TIME_REQUIRED)) {
103101
out.writeBoolean(inboundHandlingTimeBucketFrequencies.length > 0);
104-
for (long handlingTimeBucketFrequency : inboundHandlingTimeBucketFrequencies) {
105-
out.writeVLong(handlingTimeBucketFrequency);
106-
}
107-
for (long handlingTimeBucketFrequency : outboundHandlingTimeBucketFrequencies) {
108-
out.writeVLong(handlingTimeBucketFrequency);
109-
}
102+
}
103+
for (long handlingTimeBucketFrequency : inboundHandlingTimeBucketFrequencies) {
104+
out.writeVLong(handlingTimeBucketFrequency);
105+
}
106+
for (long handlingTimeBucketFrequency : outboundHandlingTimeBucketFrequencies) {
107+
out.writeVLong(handlingTimeBucketFrequency);
110108
}
111109
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
112110
out.writeMap(transportActionStats, StreamOutput::writeWriteable);

0 commit comments

Comments
 (0)