Skip to content

Commit b1f9e4d

Browse files
committed
PR comments
1 parent 250883c commit b1f9e4d

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/AbstractRollingUpgradeTestCase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public String get() {
4747
.feature(FeatureFlag.TIME_SERIES_MODE);
4848

4949
// Avoid triggering bogus assertion when serialized parsed mappings don't match with original mappings, because _source key is
50-
// inconsistent. Assume "versionless" clusters (serverless) do not need this.
50+
// inconsistent. As usual, we operate under the premise that "versionless" clusters (serverless) are on the latest code and
51+
// do not need this.
5152
if (Version.tryParse(getOldClusterVersion()).map(v -> v.before(Version.fromString("8.18.0"))).orElse(false)) {
5253
cluster.jvmArg("-da:org.elasticsearch.index.mapper.DocumentMapper");
5354
cluster.jvmArg("-da:org.elasticsearch.index.mapper.MapperService");

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/FileSettingsUpgradeIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public class FileSettingsUpgradeIT extends ParameterizedRollingUpgradeTestCase {
3838
private static final RunnableTestRuleAdapter versionLimit = new RunnableTestRuleAdapter(
3939
() -> assumeTrue(
4040
"Only valid when upgrading from pre-file settings",
41-
Version.tryParse(getOldClusterVersion()).map(v -> v.before(new Version(8, 4, 0))).orElse(false) // Assume "versionless" clusters
42-
// do not need this
41+
Version.tryParse(getOldClusterVersion()).map(v -> v.before(new Version(8, 4, 0))).orElse(false)
4342
)
4443
);
4544

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SnapshotBasedRecoveryIT.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.elasticsearch.common.Strings;
2121
import org.elasticsearch.common.settings.Settings;
2222
import org.elasticsearch.common.xcontent.support.XContentMapValues;
23-
import org.elasticsearch.core.Tuple;
2423
import org.elasticsearch.index.query.QueryBuilder;
2524
import org.elasticsearch.index.query.QueryBuilders;
2625
import org.elasticsearch.repositories.blobstore.BlobStoreRepository;
@@ -97,14 +96,14 @@ public void testSnapshotBasedRecovery() throws Exception {
9796
// In that case we exclude the upgraded node from the shard allocation and cancel the shard to force moving
9897
// the primary to a node in the old version, this allows adding replicas in the first mixed round.
9998
logger.info("--> Primary node in first mixed round {} / {}", primaryNodeId, primaryNodeVersion);
100-
if (isOldClusterVersion(primaryNodeVersion.v1(), primaryNodeVersion.v2()) == false) {
99+
if (isOldClusterVersion(primaryNodeVersion.version(), primaryNodeVersion.buildHash()) == false) {
101100
logger.info("--> cancelling primary shard on node [{}]", primaryNodeId);
102101
cancelShard(indexName, 0, primaryNodeId);
103102
logger.info("--> done cancelling primary shard on node [{}]", primaryNodeId);
104103

105104
String currentPrimaryNodeId = getPrimaryNodeIdOfShard(indexName, 0);
106105
var currentPrimaryNodeVersion = getNodeVersion(currentPrimaryNodeId);
107-
assertTrue(isOldClusterVersion(currentPrimaryNodeVersion.v1(), currentPrimaryNodeVersion.v2()));
106+
assertTrue(isOldClusterVersion(currentPrimaryNodeVersion.version(), currentPrimaryNodeVersion.buildHash()));
108107
}
109108
} else {
110109
logger.info("--> not in first upgrade round, removing exclusions for [{}]", indexName);
@@ -147,11 +146,13 @@ private List<String> getUpgradedNodeIds() throws IOException {
147146
return upgradedNodes;
148147
}
149148

150-
private Tuple<String, String> getNodeVersion(String primaryNodeId) throws IOException {
149+
private record NodeVersion(String version, String buildHash) {}
150+
151+
private NodeVersion getNodeVersion(String primaryNodeId) throws IOException {
151152
Request request = new Request(HttpGet.METHOD_NAME, "_nodes/" + primaryNodeId);
152153
Response response = client().performRequest(request);
153154
Map<String, Object> responseAsMap = responseAsMap(response);
154-
return Tuple.tuple(
155+
return new NodeVersion(
155156
extractValue(responseAsMap, "nodes." + primaryNodeId + ".version"),
156157
extractValue(responseAsMap, "nodes." + primaryNodeId + ".build_hash")
157158
);

0 commit comments

Comments
 (0)