From cd6d0e524c8f016ed1fb3ea9fc10ccdd52718282 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Thu, 18 Sep 2025 15:45:11 -0700 Subject: [PATCH 1/4] Cutover to the new transport version system 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. --- ...ValidateTransportVersionResourcesTask.java | 2 +- .../org/elasticsearch/TransportVersions.java | 23 +++++++++++-------- .../esql_lookup_join_on_expression.csv | 1 + ...request_adaptive_rate_limiting_removed.csv | 1 + .../initial_elasticsearch_8_18_7.csv | 1 + .../initial_elasticsearch_8_18_8.csv | 1 + .../initial_elasticsearch_8_19_4.csv | 1 + .../initial_elasticsearch_8_19_5.csv | 1 + .../initial_elasticsearch_9_0_7.csv | 1 + .../initial_elasticsearch_9_0_8.csv | 1 + .../initial_elasticsearch_9_1_5.csv | 1 + .../resources/transport/upper_bounds/8.18.csv | 2 +- .../resources/transport/upper_bounds/8.19.csv | 1 + .../resources/transport/upper_bounds/9.0.csv | 2 +- .../elasticsearch/TransportVersionTests.java | 10 ++++++++ 15 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 server/src/main/resources/transport/definitions/referable/esql_lookup_join_on_expression.csv create mode 100644 server/src/main/resources/transport/definitions/referable/inference_request_adaptive_rate_limiting_removed.csv create mode 100644 server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_18_7.csv create mode 100644 server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_18_8.csv create mode 100644 server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_19_4.csv create mode 100644 server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_19_5.csv create mode 100644 server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_9_0_7.csv create mode 100644 server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_9_0_8.csv create mode 100644 server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_9_1_5.csv create mode 100644 server/src/main/resources/transport/upper_bounds/8.19.csv diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/ValidateTransportVersionResourcesTask.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/ValidateTransportVersionResourcesTask.java index 829ce577891df..606aef675094a 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/ValidateTransportVersionResourcesTask.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/ValidateTransportVersionResourcesTask.java @@ -245,7 +245,7 @@ private void validateUpperBound( } TransportVersionUpperBound existingUpperBound = getResources().get().getUpperBoundFromUpstream(upperBound.name()); - if (existingUpperBound != null) { + if (existingUpperBound != null && getShouldValidatePrimaryIdNotPatch().get()) { if (upperBound.definitionId().patch() != 0 && upperBound.definitionId().base() != existingUpperBound.definitionId().base()) { throwUpperBoundFailure( upperBound, diff --git a/server/src/main/java/org/elasticsearch/TransportVersions.java b/server/src/main/java/org/elasticsearch/TransportVersions.java index 4a9817165c172..5fb913413b872 100644 --- a/server/src/main/java/org/elasticsearch/TransportVersions.java +++ b/server/src/main/java/org/elasticsearch/TransportVersions.java @@ -20,10 +20,16 @@ import java.util.TreeSet; /** - *

Transport version is used to coordinate compatible wire protocol communication between nodes, at a fine-grained level. This replaces - * and supersedes the old Version constants.

+ * Legacy container for transport version constants. * - *

Before adding a new version constant, please read the block comment at the end of the list of constants.

+ * ____ ___ _ _ ___ _____ _____ ____ ___ _____ _____ _ _ ___ ____ _____ ___ _ _____ + * | _ \ / _ \ | \ | |/ _ \_ _| | ____| _ \_ _|_ _| |_ _| | | |_ _/ ___| | ___|_ _| | | ____| + * | | | | | | | | \| | | | || | | _| | | | | | | | | | | |_| || |\___ \ | |_ | || | | _| + * | |_| | |_| | | |\ | |_| || | | |___| |_| | | | | | | | _ || | ___) | | _| | || |___| |___ + * |____/ \___/ |_| \_|\___/ |_| |_____|____/___| |_| |_| |_| |_|___|____/ |_| |___|_____|_____| + * + * DO NOT EDIT THIS FILE! New transport versions should be added using the new transport version system. + * See docs/internal/Versioning.md. */ public class TransportVersions { @@ -170,8 +176,6 @@ static TransportVersion def(int id) { public static final TransportVersion ML_INFERENCE_IBM_WATSONX_RERANK_ADDED = def(8_840_0_00); public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_18 = def(8_840_0_01); public static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_8_18 = def(8_840_0_02); - public static final TransportVersion INITIAL_ELASTICSEARCH_8_18_7 = def(8_840_0_09); - public static final TransportVersion INITIAL_ELASTICSEARCH_8_18_8 = def(8_840_0_10); public static final TransportVersion INITIAL_ELASTICSEARCH_8_19 = def(8_841_0_00); public static final TransportVersion INITIAL_ELASTICSEARCH_9_0 = def(9_000_0_00); public static final TransportVersion REMOVE_SNAPSHOT_FAILURES_90 = def(9_000_0_01); @@ -183,8 +187,6 @@ static TransportVersion def(int id) { public static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_90 = def(9_000_0_07); public static final TransportVersion RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90 = def(9_000_0_08); public static final TransportVersion STORED_SCRIPT_CONTENT_LENGTH_90 = def(9_000_0_09); - public static final TransportVersion INITIAL_ELASTICSEARCH_9_0_7 = def(9_000_0_16); - public static final TransportVersion INITIAL_ELASTICSEARCH_9_0_8 = def(9_000_0_17); /* * STOP! READ THIS FIRST! No, really, @@ -194,9 +196,9 @@ static TransportVersion def(int id) { * ___) || || |_| | __/|_| | _ <| |___ / ___ \| |_| | | | | _ || | ___) | | _| | || _ < ___) || | |_| * |____/ |_| \___/|_| (_) |_| \_\_____/_/ \_\____/ |_| |_| |_|___|____/ |_| |___|_| \_\____/ |_| (_) * - * A new transport version should be added EVERY TIME a change is made to the serialization protocol of one or more classes. Each - * 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). + * DO NOT EDIT THIS FILE. * +<<<<<<< HEAD * ADDING A TRANSPORT VERSION * To add a new transport version, add a new constant at the bottom of the list, above this comment. Don't add other lines, * comments, etc. The version id has the following layout: @@ -237,6 +239,9 @@ static TransportVersion def(int id) { * git diff v8.11.0..main -- server/src/main/java/org/elasticsearch/TransportVersions.java * * In branches 8.7-8.10 see server/src/main/java/org/elasticsearch/TransportVersion.java for the equivalent definitions. +======= + * Transport version must now be added with the new transport version system. See docs/internal/Versioning.md +>>>>>>> c61ab3c5e36 (Cutover to the new transport version system) */ /** diff --git a/server/src/main/resources/transport/definitions/referable/esql_lookup_join_on_expression.csv b/server/src/main/resources/transport/definitions/referable/esql_lookup_join_on_expression.csv new file mode 100644 index 0000000000000..eca4f5f5927ef --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/esql_lookup_join_on_expression.csv @@ -0,0 +1 @@ +9163000 diff --git a/server/src/main/resources/transport/definitions/referable/inference_request_adaptive_rate_limiting_removed.csv b/server/src/main/resources/transport/definitions/referable/inference_request_adaptive_rate_limiting_removed.csv new file mode 100644 index 0000000000000..0ec8fe176b47a --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/inference_request_adaptive_rate_limiting_removed.csv @@ -0,0 +1 @@ +9164000 diff --git a/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_18_7.csv b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_18_7.csv new file mode 100644 index 0000000000000..5af327888fb4e --- /dev/null +++ b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_18_7.csv @@ -0,0 +1 @@ +8840009 diff --git a/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_18_8.csv b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_18_8.csv new file mode 100644 index 0000000000000..dc6eb6d2171bf --- /dev/null +++ b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_18_8.csv @@ -0,0 +1 @@ +8840010 diff --git a/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_19_4.csv b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_19_4.csv new file mode 100644 index 0000000000000..04a2755e6a789 --- /dev/null +++ b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_19_4.csv @@ -0,0 +1 @@ +8841068 diff --git a/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_19_5.csv b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_19_5.csv new file mode 100644 index 0000000000000..86155d0db458c --- /dev/null +++ b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_8_19_5.csv @@ -0,0 +1 @@ +8841069 diff --git a/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_9_0_7.csv b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_9_0_7.csv new file mode 100644 index 0000000000000..b82bc033838f7 --- /dev/null +++ b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_9_0_7.csv @@ -0,0 +1 @@ +9000016 diff --git a/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_9_0_8.csv b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_9_0_8.csv new file mode 100644 index 0000000000000..bb00fbf020a65 --- /dev/null +++ b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_9_0_8.csv @@ -0,0 +1 @@ +9000017 diff --git a/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_9_1_5.csv b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_9_1_5.csv new file mode 100644 index 0000000000000..7b15abc1a7bbe --- /dev/null +++ b/server/src/main/resources/transport/definitions/unreferable/initial_elasticsearch_9_1_5.csv @@ -0,0 +1 @@ +9112008 diff --git a/server/src/main/resources/transport/upper_bounds/8.18.csv b/server/src/main/resources/transport/upper_bounds/8.18.csv index 4eb5140004ea6..ffc592e1809ee 100644 --- a/server/src/main/resources/transport/upper_bounds/8.18.csv +++ b/server/src/main/resources/transport/upper_bounds/8.18.csv @@ -1 +1 @@ -initial_elasticsearch_8_18_6,8840008 +initial_elasticsearch_8_18_8,8840010 diff --git a/server/src/main/resources/transport/upper_bounds/8.19.csv b/server/src/main/resources/transport/upper_bounds/8.19.csv new file mode 100644 index 0000000000000..3cc6f439c5ea5 --- /dev/null +++ b/server/src/main/resources/transport/upper_bounds/8.19.csv @@ -0,0 +1 @@ +initial_elasticsearch_8_19_5,8841069 diff --git a/server/src/main/resources/transport/upper_bounds/9.0.csv b/server/src/main/resources/transport/upper_bounds/9.0.csv index f8f50cc6d7839..8ad2ed1a4cacf 100644 --- a/server/src/main/resources/transport/upper_bounds/9.0.csv +++ b/server/src/main/resources/transport/upper_bounds/9.0.csv @@ -1 +1 @@ -initial_elasticsearch_9_0_6,9000015 +initial_elasticsearch_9_0_8,9000017 diff --git a/server/src/test/java/org/elasticsearch/TransportVersionTests.java b/server/src/test/java/org/elasticsearch/TransportVersionTests.java index 73ec26b631fee..a3709954b04e4 100644 --- a/server/src/test/java/org/elasticsearch/TransportVersionTests.java +++ b/server/src/test/java/org/elasticsearch/TransportVersionTests.java @@ -25,6 +25,7 @@ import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.endsWith; +import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.lessThan; @@ -414,4 +415,13 @@ public void testMoreLikeThis() { ) ); } + + public void testTransportVersionsLocked() { + assertThat( + "TransportVersions.java is locked. Generate transport versions with TransportVersion.fromName " + + "and generateTransportVersion gradle task", + TransportVersions.DEFINED_VERSIONS.getLast().id(), + equalTo(9_162_0_00) + ); + } } From c486a1caef60cb0d283a81b0e71fe7b2661d3390 Mon Sep 17 00:00:00 2001 From: elasticsearchmachine Date: Thu, 18 Sep 2025 23:05:22 +0000 Subject: [PATCH 2/4] [CI] Auto commit changes from spotless --- .../src/main/java/org/elasticsearch/TransportVersions.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/TransportVersions.java b/server/src/main/java/org/elasticsearch/TransportVersions.java index 5fb913413b872..76c53881c32e2 100644 --- a/server/src/main/java/org/elasticsearch/TransportVersions.java +++ b/server/src/main/java/org/elasticsearch/TransportVersions.java @@ -198,7 +198,7 @@ static TransportVersion def(int id) { * * DO NOT EDIT THIS FILE. * -<<<<<<< HEAD + <<<<<<< HEAD * ADDING A TRANSPORT VERSION * To add a new transport version, add a new constant at the bottom of the list, above this comment. Don't add other lines, * comments, etc. The version id has the following layout: @@ -239,9 +239,9 @@ static TransportVersion def(int id) { * git diff v8.11.0..main -- server/src/main/java/org/elasticsearch/TransportVersions.java * * In branches 8.7-8.10 see server/src/main/java/org/elasticsearch/TransportVersion.java for the equivalent definitions. -======= + ======= * Transport version must now be added with the new transport version system. See docs/internal/Versioning.md ->>>>>>> c61ab3c5e36 (Cutover to the new transport version system) + >>>>>>> c61ab3c5e36 (Cutover to the new transport version system) */ /** From d3fe5270fc8cc6abf9ec603cac27f213d47c6ea2 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Thu, 18 Sep 2025 16:09:00 -0700 Subject: [PATCH 3/4] remove unnecessary files --- .../definitions/referable/esql_lookup_join_on_expression.csv | 1 - .../inference_request_adaptive_rate_limiting_removed.csv | 1 - 2 files changed, 2 deletions(-) delete mode 100644 server/src/main/resources/transport/definitions/referable/esql_lookup_join_on_expression.csv delete mode 100644 server/src/main/resources/transport/definitions/referable/inference_request_adaptive_rate_limiting_removed.csv diff --git a/server/src/main/resources/transport/definitions/referable/esql_lookup_join_on_expression.csv b/server/src/main/resources/transport/definitions/referable/esql_lookup_join_on_expression.csv deleted file mode 100644 index eca4f5f5927ef..0000000000000 --- a/server/src/main/resources/transport/definitions/referable/esql_lookup_join_on_expression.csv +++ /dev/null @@ -1 +0,0 @@ -9163000 diff --git a/server/src/main/resources/transport/definitions/referable/inference_request_adaptive_rate_limiting_removed.csv b/server/src/main/resources/transport/definitions/referable/inference_request_adaptive_rate_limiting_removed.csv deleted file mode 100644 index 0ec8fe176b47a..0000000000000 --- a/server/src/main/resources/transport/definitions/referable/inference_request_adaptive_rate_limiting_removed.csv +++ /dev/null @@ -1 +0,0 @@ -9164000 From 6c284a39a3343e19a4769bf5f836e784778cd41a Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Thu, 18 Sep 2025 20:22:33 -0700 Subject: [PATCH 4/4] update test --- .../org/elasticsearch/TransportVersions.java | 43 ------------------- .../elasticsearch/TransportVersionTests.java | 2 +- 2 files changed, 1 insertion(+), 44 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/TransportVersions.java b/server/src/main/java/org/elasticsearch/TransportVersions.java index 76c53881c32e2..5b78a1b9d30c5 100644 --- a/server/src/main/java/org/elasticsearch/TransportVersions.java +++ b/server/src/main/java/org/elasticsearch/TransportVersions.java @@ -198,50 +198,7 @@ static TransportVersion def(int id) { * * DO NOT EDIT THIS FILE. * - <<<<<<< HEAD - * ADDING A TRANSPORT VERSION - * To add a new transport version, add a new constant at the bottom of the list, above this comment. Don't add other lines, - * comments, etc. The version id has the following layout: - * - * M_NNN_S_PP - * - * M - The major version of Elasticsearch - * NNN - The server version part - * S - The subsidiary version part. It should always be 0 here, it is only used in subsidiary repositories. - * PP - The patch version part - * - * To determine the id of the next TransportVersion constant, do the following: - * - Use the same major version, unless bumping majors - * - Bump the server version part by 1, unless creating a patch version - * - Leave the subsidiary part as 0 - * - Bump the patch part if creating a patch version - * - * If a patch version is created, it should be placed sorted among the other existing constants. - * - * REVERTING A TRANSPORT VERSION - * - * If you revert a commit with a transport version change, you MUST ensure there is a NEW transport version representing the reverted - * change. DO NOT let the transport version go backwards, it must ALWAYS be incremented. - * - * DETERMINING TRANSPORT VERSIONS FROM GIT HISTORY - * - * If your git checkout has the expected minor-version-numbered branches and the expected release-version tags then you can find the - * transport versions known by a particular release ... - * - * git show v8.11.0:server/src/main/java/org/elasticsearch/TransportVersions.java | grep '= def' - * - * ... or by a particular branch ... - * - * git show 8.11:server/src/main/java/org/elasticsearch/TransportVersions.java | grep '= def' - * - * ... and you can see which versions were added in between two versions too ... - * - * git diff v8.11.0..main -- server/src/main/java/org/elasticsearch/TransportVersions.java - * - * In branches 8.7-8.10 see server/src/main/java/org/elasticsearch/TransportVersion.java for the equivalent definitions. - ======= * Transport version must now be added with the new transport version system. See docs/internal/Versioning.md - >>>>>>> c61ab3c5e36 (Cutover to the new transport version system) */ /** diff --git a/server/src/test/java/org/elasticsearch/TransportVersionTests.java b/server/src/test/java/org/elasticsearch/TransportVersionTests.java index a3709954b04e4..b8e9e59719da5 100644 --- a/server/src/test/java/org/elasticsearch/TransportVersionTests.java +++ b/server/src/test/java/org/elasticsearch/TransportVersionTests.java @@ -421,7 +421,7 @@ public void testTransportVersionsLocked() { "TransportVersions.java is locked. Generate transport versions with TransportVersion.fromName " + "and generateTransportVersion gradle task", TransportVersions.DEFINED_VERSIONS.getLast().id(), - equalTo(9_162_0_00) + equalTo(9_000_0_09) ); } }