Skip to content

Commit ddf1713

Browse files
authored
[9.0] Cutover to the new transport version system (elastic#135046)
This commit updates the latest transport version ids to use the new gradle managed system. It also adds a test to ensure new constants are not added to TransportVersions.java.
1 parent 3bf3ed9 commit ddf1713

File tree

13 files changed

+32
-52
lines changed

13 files changed

+32
-52
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/ValidateTransportVersionResourcesTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ private void validateUpperBound(
255255
}
256256

257257
TransportVersionUpperBound existingUpperBound = getResources().get().getUpperBoundFromUpstream(upperBound.name());
258-
if (existingUpperBound != null) {
258+
if (existingUpperBound != null && getShouldValidatePrimaryIdNotPatch().get()) {
259259
if (upperBound.definitionId().patch() != 0 && upperBound.definitionId().base() != existingUpperBound.definitionId().base()) {
260260
throwUpperBoundFailure(
261261
upperBound,

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

Lines changed: 11 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@
2020
import java.util.TreeSet;
2121

2222
/**
23-
* <p>Transport version is used to coordinate compatible wire protocol communication between nodes, at a fine-grained level. This replaces
24-
* and supersedes the old Version constants.</p>
23+
* Legacy container for transport version constants.
2524
*
26-
* <p>Before adding a new version constant, please read the block comment at the end of the list of constants.</p>
25+
* ____ ___ _ _ ___ _____ _____ ____ ___ _____ _____ _ _ ___ ____ _____ ___ _ _____
26+
* | _ \ / _ \ | \ | |/ _ \_ _| | ____| _ \_ _|_ _| |_ _| | | |_ _/ ___| | ___|_ _| | | ____|
27+
* | | | | | | | | \| | | | || | | _| | | | | | | | | | | |_| || |\___ \ | |_ | || | | _|
28+
* | |_| | |_| | | |\ | |_| || | | |___| |_| | | | | | | | _ || | ___) | | _| | || |___| |___
29+
* |____/ \___/ |_| \_|\___/ |_| |_____|____/___| |_| |_| |_| |_|___|____/ |_| |___|_____|_____|
30+
*
31+
* DO NOT EDIT THIS FILE! New transport versions should be added using the new transport version system.
32+
* See docs/internal/Versioning.md.
2733
*/
2834
public class TransportVersions {
2935

@@ -170,8 +176,6 @@ static TransportVersion def(int id) {
170176
public static final TransportVersion ML_INFERENCE_IBM_WATSONX_RERANK_ADDED = def(8_840_0_00);
171177
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_18 = def(8_840_0_01);
172178
public static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_8_18 = def(8_840_0_02);
173-
public static final TransportVersion INITIAL_ELASTICSEARCH_8_18_7 = def(8_840_0_09);
174-
public static final TransportVersion INITIAL_ELASTICSEARCH_8_18_8 = def(8_840_0_10);
175179
public static final TransportVersion INITIAL_ELASTICSEARCH_8_19 = def(8_841_0_00);
176180
public static final TransportVersion INITIAL_ELASTICSEARCH_9_0 = def(9_000_0_00);
177181
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES_90 = def(9_000_0_01);
@@ -183,8 +187,6 @@ static TransportVersion def(int id) {
183187
public static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_90 = def(9_000_0_07);
184188
public static final TransportVersion RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90 = def(9_000_0_08);
185189
public static final TransportVersion STORED_SCRIPT_CONTENT_LENGTH_90 = def(9_000_0_09);
186-
public static final TransportVersion INITIAL_ELASTICSEARCH_9_0_7 = def(9_000_0_16);
187-
public static final TransportVersion INITIAL_ELASTICSEARCH_9_0_8 = def(9_000_0_17);
188190

189191
/*
190192
* STOP! READ THIS FIRST! No, really,
@@ -194,49 +196,9 @@ static TransportVersion def(int id) {
194196
* ___) || || |_| | __/|_| | _ <| |___ / ___ \| |_| | | | | _ || | ___) | | _| | || _ < ___) || | |_|
195197
* |____/ |_| \___/|_| (_) |_| \_\_____/_/ \_\____/ |_| |_| |_|___|____/ |_| |___|_| \_\____/ |_| (_)
196198
*
197-
* A new transport version should be added EVERY TIME a change is made to the serialization protocol of one or more classes. Each
198-
* transport version should only be used in a single merged commit (apart from the BwC versions copied from o.e.Version, ≤V_8_8_1).
199-
*
200-
* ADDING A TRANSPORT VERSION
201-
* To add a new transport version, add a new constant at the bottom of the list, above this comment. Don't add other lines,
202-
* comments, etc. The version id has the following layout:
203-
*
204-
* M_NNN_S_PP
205-
*
206-
* M - The major version of Elasticsearch
207-
* NNN - The server version part
208-
* S - The subsidiary version part. It should always be 0 here, it is only used in subsidiary repositories.
209-
* PP - The patch version part
210-
*
211-
* To determine the id of the next TransportVersion constant, do the following:
212-
* - Use the same major version, unless bumping majors
213-
* - Bump the server version part by 1, unless creating a patch version
214-
* - Leave the subsidiary part as 0
215-
* - Bump the patch part if creating a patch version
216-
*
217-
* If a patch version is created, it should be placed sorted among the other existing constants.
218-
*
219-
* REVERTING A TRANSPORT VERSION
220-
*
221-
* If you revert a commit with a transport version change, you MUST ensure there is a NEW transport version representing the reverted
222-
* change. DO NOT let the transport version go backwards, it must ALWAYS be incremented.
223-
*
224-
* DETERMINING TRANSPORT VERSIONS FROM GIT HISTORY
225-
*
226-
* If your git checkout has the expected minor-version-numbered branches and the expected release-version tags then you can find the
227-
* transport versions known by a particular release ...
228-
*
229-
* git show v8.11.0:server/src/main/java/org/elasticsearch/TransportVersions.java | grep '= def'
230-
*
231-
* ... or by a particular branch ...
232-
*
233-
* git show 8.11:server/src/main/java/org/elasticsearch/TransportVersions.java | grep '= def'
234-
*
235-
* ... and you can see which versions were added in between two versions too ...
236-
*
237-
* git diff v8.11.0..main -- server/src/main/java/org/elasticsearch/TransportVersions.java
199+
* DO NOT EDIT THIS FILE.
238200
*
239-
* In branches 8.7-8.10 see server/src/main/java/org/elasticsearch/TransportVersion.java for the equivalent definitions.
201+
* Transport version must now be added with the new transport version system. See docs/internal/Versioning.md
240202
*/
241203

242204
/**
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8840009
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8840010
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8841068
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8841069
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9000016
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9000017
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9112008
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
initial_elasticsearch_8_18_6,8840008
1+
initial_elasticsearch_8_18_8,8840010

0 commit comments

Comments
 (0)