Skip to content

Commit 4eeaae3

Browse files
authored
Revert "Collapse transport versions (#127186)" (#134242)
This reverts commit 76c2ab5.
1 parent 54d707c commit 4eeaae3

File tree

14 files changed

+42
-51
lines changed

14 files changed

+42
-51
lines changed

docs/internal/Versioning.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,25 +85,6 @@ usually after each new minor release, to collapse the transport versions
8585
for the previous minor release. An example of such an operation can be found
8686
[here](https://github.com/elastic/elasticsearch/pull/104937).
8787

88-
#### Tips
89-
90-
- We collapse versions only on the `main` branch.
91-
- Use [TransportVersions.csv](../../server/src/main/resources/org/elasticsearch/TransportVersions.csv) as your guide.
92-
- For each release version listed in that file with a corresponding `INITIAL_ELASTICSEARCH_` entry corresponding to that version,
93-
- change the prefix to `V_`
94-
- replace all intervening entries since the previous patch `V_` entry with the new `V_` entry
95-
- look at all uses of the new `V_` entry and look for dead code that can be deleted
96-
97-
For example, if there's a version `1.2.3` in the CSV file,
98-
and `TransportVersions.java` has an entry called `INITIAL_ELASTICSEARCH_1_2_3`,
99-
then:
100-
- rename it to `V_1_2_3`,
101-
- replace any other intervening symbols between `V_1_2_2` and `V_1_2_3` with `V_1_2_3` itself, and
102-
- look through all the uses of the new `V_1_2_3` symbol; if any contain dead code, simplify it.
103-
104-
When in doubt, you can always leave the code as-is.
105-
This is an optional cleanup step that is never required for correctness.
106-
10788
### Minimum compatibility versions
10889

10990
The transport version used between two nodes is determined by the initial handshake

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ static TransportVersion def(int id) {
8585
public static final TransportVersion V_8_15_2 = def(8_702_0_03);
8686
public static final TransportVersion V_8_16_0 = def(8_772_0_01);
8787
public static final TransportVersion V_8_16_1 = def(8_772_0_04);
88-
public static final TransportVersion V_8_16_5 = def(8_772_0_05);
89-
public static final TransportVersion V_8_16_6 = def(8_772_0_06);
88+
public static final TransportVersion INITIAL_ELASTICSEARCH_8_16_5 = def(8_772_0_05);
89+
public static final TransportVersion INITIAL_ELASTICSEARCH_8_16_6 = def(8_772_0_06);
9090
public static final TransportVersion V_8_17_0 = def(8_797_0_02);
91-
public static final TransportVersion V_8_17_3 = def(8_797_0_03);
92-
public static final TransportVersion V_8_17_4 = def(8_797_0_04);
93-
public static final TransportVersion V_8_17_5 = def(8_797_0_05);
91+
public static final TransportVersion INITIAL_ELASTICSEARCH_8_17_3 = def(8_797_0_03);
92+
public static final TransportVersion INITIAL_ELASTICSEARCH_8_17_4 = def(8_797_0_04);
93+
public static final TransportVersion INITIAL_ELASTICSEARCH_8_17_5 = def(8_797_0_05);
9494
public static final TransportVersion INDEXING_PRESSURE_THROTTLING_STATS = def(8_798_0_00);
9595
public static final TransportVersion REINDEX_DATA_STREAMS = def(8_799_0_00);
9696
public static final TransportVersion ESQL_REMOVE_NODE_LEVEL_PLAN = def(8_800_0_00);
@@ -135,7 +135,7 @@ static TransportVersion def(int id) {
135135
public static final TransportVersion INFERENCE_REQUEST_ADAPTIVE_RATE_LIMITING = def(8_839_0_00);
136136
public static final TransportVersion ML_INFERENCE_IBM_WATSONX_RERANK_ADDED = def(8_840_0_00);
137137
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_18 = def(8_840_0_01);
138-
public static final TransportVersion V_8_18_0 = def(8_840_0_02);
138+
public static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_8_18 = def(8_840_0_02);
139139
public static final TransportVersion INITIAL_ELASTICSEARCH_8_18_7 = def(8_840_0_09);
140140
public static final TransportVersion INITIAL_ELASTICSEARCH_8_19 = def(8_841_0_00);
141141
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED_BACKPORT_8_X = def(8_841_0_01);
@@ -202,7 +202,16 @@ static TransportVersion def(int id) {
202202
public static final TransportVersion ESQL_SPLIT_ON_BIG_VALUES_8_19 = def(8_841_0_63);
203203
public static final TransportVersion ESQL_FIXED_INDEX_LIKE_8_19 = def(8_841_0_64);
204204
public static final TransportVersion INITIAL_ELASTICSEARCH_8_19_4 = def(8_841_0_68);
205-
public static final TransportVersion V_9_0_0 = def(9_000_0_09);
205+
public static final TransportVersion INITIAL_ELASTICSEARCH_9_0 = def(9_000_0_00);
206+
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES_90 = def(9_000_0_01);
207+
public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED_90 = def(9_000_0_02);
208+
public static final TransportVersion REMOVE_DESIRED_NODE_VERSION_90 = def(9_000_0_03);
209+
public static final TransportVersion ESQL_DRIVER_TASK_DESCRIPTION_90 = def(9_000_0_04);
210+
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_9_0 = def(9_000_0_05);
211+
public static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90 = def(9_000_0_06);
212+
public static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_90 = def(9_000_0_07);
213+
public static final TransportVersion RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90 = def(9_000_0_08);
214+
public static final TransportVersion STORED_SCRIPT_CONTENT_LENGTH_90 = def(9_000_0_09);
206215
public static final TransportVersion INITIAL_ELASTICSEARCH_9_0_7 = def(9_000_0_16);
207216
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED = def(9_001_0_00);
208217
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES = def(9_002_0_00);

server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public GetSnapshotsResponse(List<SnapshotInfo> snapshots, @Nullable String next,
5050
public GetSnapshotsResponse(StreamInput in) throws IOException {
5151
this.snapshots = in.readCollectionAsImmutableList(SnapshotInfo::readFrom);
5252
if (in.getTransportVersion().before(TransportVersions.REMOVE_SNAPSHOT_FAILURES)
53-
&& in.getTransportVersion().isPatchFrom(TransportVersions.V_9_0_0) == false) {
53+
&& in.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_SNAPSHOT_FAILURES_90) == false) {
5454
// Deprecated `failures` field
5555
in.readMap(StreamInput::readException);
5656
}
@@ -85,7 +85,7 @@ public int remaining() {
8585
public void writeTo(StreamOutput out) throws IOException {
8686
out.writeCollection(snapshots);
8787
if (out.getTransportVersion().before(TransportVersions.REMOVE_SNAPSHOT_FAILURES)
88-
&& out.getTransportVersion().isPatchFrom(TransportVersions.V_9_0_0) == false) {
88+
&& out.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_SNAPSHOT_FAILURES_90) == false) {
8989
// Deprecated `failures` field
9090
out.writeMap(Map.of(), StreamOutput::writeException);
9191
}

server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class PutStoredScriptRequest extends AcknowledgedRequest<PutStoredScriptR
4545
public PutStoredScriptRequest(StreamInput in) throws IOException {
4646
super(in);
4747
id = in.readOptionalString();
48-
if (in.getTransportVersion().isPatchFrom(TransportVersions.V_9_0_0)
48+
if (in.getTransportVersion().isPatchFrom(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH_90)
4949
|| in.getTransportVersion().onOrAfter(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH)) {
5050
contentLength = in.readVInt();
5151
} else {
@@ -106,7 +106,7 @@ public StoredScriptSource source() {
106106
public void writeTo(StreamOutput out) throws IOException {
107107
super.writeTo(out);
108108
out.writeOptionalString(id);
109-
if (out.getTransportVersion().isPatchFrom(TransportVersions.V_9_0_0)
109+
if (out.getTransportVersion().isPatchFrom(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH_90)
110110
|| out.getTransportVersion().onOrAfter(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH)) {
111111
out.writeVInt(contentLength);
112112
} else {

server/src/main/java/org/elasticsearch/action/search/SearchRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public SearchRequest(StreamInput in) throws IOException {
254254
finalReduce = true;
255255
}
256256
ccsMinimizeRoundtrips = in.readBoolean();
257-
if ((in.getTransportVersion().isPatchFrom(TransportVersions.V_9_0_0) == false
257+
if ((in.getTransportVersion().isPatchFrom(TransportVersions.RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90) == false
258258
&& in.getTransportVersion().before(TransportVersions.RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE)) && in.readBoolean()) {
259259
Version.readVersion(in); // and drop on the floor
260260
}
@@ -299,7 +299,7 @@ public void writeTo(StreamOutput out, boolean skipIndices) throws IOException {
299299
out.writeBoolean(finalReduce);
300300
}
301301
out.writeBoolean(ccsMinimizeRoundtrips);
302-
if ((out.getTransportVersion().isPatchFrom(TransportVersions.V_9_0_0) == false
302+
if ((out.getTransportVersion().isPatchFrom(TransportVersions.RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90) == false
303303
&& out.getTransportVersion().before(TransportVersions.RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE))) {
304304
out.writeBoolean(false);
305305
}

server/src/main/java/org/elasticsearch/action/support/IndexComponentSelector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static IndexComponentSelector getByKeyOrThrow(@Nullable String key) {
9393
public static IndexComponentSelector read(StreamInput in) throws IOException {
9494
byte id = in.readByte();
9595
if (in.getTransportVersion().onOrAfter(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR)
96-
|| in.getTransportVersion().isPatchFrom(TransportVersions.V_9_0_0)
96+
|| in.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR_9_0)
9797
|| in.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_18)
9898
|| in.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_19)) {
9999
return getById(id);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public static DesiredNode readFrom(StreamInput in) throws IOException {
162162
final var memory = ByteSizeValue.readFrom(in);
163163
final var storage = ByteSizeValue.readFrom(in);
164164
if (in.getTransportVersion().before(TransportVersions.REMOVE_DESIRED_NODE_VERSION)
165-
&& in.getTransportVersion().isPatchFrom(TransportVersions.V_9_0_0) == false) {
165+
&& in.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_DESIRED_NODE_VERSION_90) == false) {
166166
in.readOptionalString();
167167
}
168168
return new DesiredNode(settings, processors, processorsRange, memory, storage);
@@ -182,7 +182,7 @@ public void writeTo(StreamOutput out) throws IOException {
182182
memory.writeTo(out);
183183
storage.writeTo(out);
184184
if (out.getTransportVersion().before(TransportVersions.REMOVE_DESIRED_NODE_VERSION)
185-
&& out.getTransportVersion().isPatchFrom(TransportVersions.V_9_0_0) == false) {
185+
&& out.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_DESIRED_NODE_VERSION_90) == false) {
186186
out.writeOptionalString(null);
187187
}
188188
}

server/src/main/java/org/elasticsearch/common/unit/ByteSizeValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
import static org.elasticsearch.TransportVersions.BYTE_SIZE_VALUE_ALWAYS_USES_BYTES;
2929
import static org.elasticsearch.TransportVersions.BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_1;
30+
import static org.elasticsearch.TransportVersions.BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90;
3031
import static org.elasticsearch.TransportVersions.REVERT_BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_1;
31-
import static org.elasticsearch.TransportVersions.V_9_0_0;
3232
import static org.elasticsearch.common.unit.ByteSizeUnit.BYTES;
3333
import static org.elasticsearch.common.unit.ByteSizeUnit.GB;
3434
import static org.elasticsearch.common.unit.ByteSizeUnit.KB;
@@ -134,7 +134,7 @@ public void writeTo(StreamOutput out) throws IOException {
134134

135135
private static boolean alwaysUseBytes(TransportVersion tv) {
136136
return tv.onOrAfter(BYTE_SIZE_VALUE_ALWAYS_USES_BYTES)
137-
|| tv.isPatchFrom(V_9_0_0)
137+
|| tv.isPatchFrom(BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90)
138138
|| tv.between(BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_1, REVERT_BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_1);
139139
}
140140

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public TransportStats(StreamInput in) throws IOException {
7070
txCount = in.readVLong();
7171
txSize = in.readVLong();
7272
if (in.getTransportVersion().before(TransportVersions.TRANSPORT_STATS_HANDLING_TIME_REQUIRED)
73-
&& in.getTransportVersion().isPatchFrom(TransportVersions.V_9_0_0) == false) {
73+
&& in.getTransportVersion().isPatchFrom(TransportVersions.TRANSPORT_STATS_HANDLING_TIME_REQUIRED_90) == false) {
7474
in.readBoolean();
7575
}
7676
inboundHandlingTimeBucketFrequencies = new long[HandlingTimeTracker.BUCKET_COUNT];
@@ -100,7 +100,7 @@ public void writeTo(StreamOutput out) throws IOException {
100100
assert inboundHandlingTimeBucketFrequencies.length == HandlingTimeTracker.BUCKET_COUNT;
101101
assert outboundHandlingTimeBucketFrequencies.length == HandlingTimeTracker.BUCKET_COUNT;
102102
if (out.getTransportVersion().before(TransportVersions.TRANSPORT_STATS_HANDLING_TIME_REQUIRED)
103-
&& out.getTransportVersion().isPatchFrom(TransportVersions.V_9_0_0) == false) {
103+
&& out.getTransportVersion().isPatchFrom(TransportVersions.TRANSPORT_STATS_HANDLING_TIME_REQUIRED_90) == false) {
104104
out.writeBoolean(true);
105105
}
106106
for (long handlingTimeBucketFrequency : inboundHandlingTimeBucketFrequencies) {

server/src/test/java/org/elasticsearch/common/unit/ByteSizeValueTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import org.elasticsearch.ElasticsearchParseException;
1313
import org.elasticsearch.TransportVersion;
14-
import org.elasticsearch.TransportVersions;
1514
import org.elasticsearch.common.io.stream.BytesStreamOutput;
1615
import org.elasticsearch.common.io.stream.Writeable.Reader;
1716
import org.elasticsearch.test.AbstractWireSerializingTestCase;
@@ -23,6 +22,8 @@
2322
import java.util.function.Function;
2423

2524
import static org.elasticsearch.TransportVersions.BYTE_SIZE_VALUE_ALWAYS_USES_BYTES;
25+
import static org.elasticsearch.TransportVersions.BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90;
26+
import static org.elasticsearch.TransportVersions.INITIAL_ELASTICSEARCH_9_0;
2627
import static org.elasticsearch.TransportVersions.V_8_16_0;
2728
import static org.hamcrest.Matchers.containsString;
2829
import static org.hamcrest.Matchers.equalTo;
@@ -522,7 +523,7 @@ protected void assertEqualInstances(ByteSizeValue expectedInstance, ByteSizeValu
522523

523524
public void testBWCTransportFormat() throws IOException {
524525
var tenMegs = ByteSizeValue.ofMb(10);
525-
for (var tv : List.of(V_8_16_0)) {
526+
for (var tv : List.of(V_8_16_0, INITIAL_ELASTICSEARCH_9_0)) {
526527
try (BytesStreamOutput expected = new BytesStreamOutput(); BytesStreamOutput actual = new BytesStreamOutput()) {
527528
expected.writeZLong(10);
528529
ByteSizeUnit.MB.writeTo(expected);
@@ -538,7 +539,7 @@ public void testBWCTransportFormat() throws IOException {
538539
}
539540

540541
public void testTransportRoundTripsWithTwoDigitFractions() throws IOException {
541-
for (var tv : List.of(TransportVersion.current(), BYTE_SIZE_VALUE_ALWAYS_USES_BYTES, TransportVersions.V_9_0_0)) {
542+
for (var tv : List.of(TransportVersion.current(), BYTE_SIZE_VALUE_ALWAYS_USES_BYTES, BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90)) {
542543
for (var desiredUnit : ByteSizeUnit.values()) {
543544
if (desiredUnit == ByteSizeUnit.BYTES) {
544545
// Can't have a fraction of a byte!

0 commit comments

Comments
 (0)