Skip to content

Commit 21031d5

Browse files
authored
Improve resiliency of TransportVersionUtils.getNextVersion (elastic#141285)
1 parent 3a99741 commit 21031d5

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

muted-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,6 @@ tests:
282282
- class: org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT
283283
method: test {csv-spec:spatial.ConvertFromStringParseError}
284284
issue: https://github.com/elastic/elasticsearch/issues/139213
285-
- class: org.elasticsearch.persistent.ClusterPersistentTasksCustomMetadataTests
286-
method: testMinVersionSerialization
287-
issue: https://github.com/elastic/elasticsearch/issues/140804
288-
- class: org.elasticsearch.persistent.PersistentTasksCustomMetadataTests
289-
method: testMinVersionSerialization
290-
issue: https://github.com/elastic/elasticsearch/issues/140805
291285
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeForkIT
292286
method: test {csv-spec:string.Url_encode_component tests with table reads}
293287
issue: https://github.com/elastic/elasticsearch/issues/140809

server/src/test/java/org/elasticsearch/persistent/BasePersistentTasksCustomMetadataTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public void testMinVersionSerialization() throws IOException {
210210
TestPersistentTasksPlugin.TestPersistentTasksExecutor.NAME,
211211
new TestPersistentTasksPlugin.TestParams(
212212
null,
213-
getNextVersion(streamVersion),
213+
getNextVersion(streamVersion, true),
214214
randomBoolean() ? Optional.empty() : Optional.of("test")
215215
),
216216
randomAssignment()

test/framework/src/main/java/org/elasticsearch/test/TransportVersionUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ public static TransportVersion getNextVersion(TransportVersion version) {
9090
public static TransportVersion getNextVersion(TransportVersion version, boolean createIfNecessary) {
9191
TransportVersion higher = (isPatchVersion(version) ? RELEASED_VERSIONS : NON_PATCH_VERSIONS).higher(version);
9292
if (higher != null && isPatchVersion(version) && isPatchVersion(higher) == false) {
93-
throw new IllegalStateException(
94-
"couldn't determine next version as version [" + version + "] is patch, and is the newest patch"
95-
);
93+
// The provided version is a patch, and the latest patch for that minor. We don't want to just return the next "higher" version
94+
// as it might not be "newer" and may result in incorrect semantics. Instead, we should delegate to "createIfNecessary" here.
95+
higher = null;
9696
}
9797

9898
if (higher == null) {

0 commit comments

Comments
 (0)