|
20 | 20 | import org.elasticsearch.common.Strings; |
21 | 21 | import org.elasticsearch.common.settings.Settings; |
22 | 22 | import org.elasticsearch.common.xcontent.support.XContentMapValues; |
23 | | -import org.elasticsearch.core.Tuple; |
24 | 23 | import org.elasticsearch.index.query.QueryBuilder; |
25 | 24 | import org.elasticsearch.index.query.QueryBuilders; |
26 | 25 | import org.elasticsearch.repositories.blobstore.BlobStoreRepository; |
@@ -97,14 +96,14 @@ public void testSnapshotBasedRecovery() throws Exception { |
97 | 96 | // In that case we exclude the upgraded node from the shard allocation and cancel the shard to force moving |
98 | 97 | // the primary to a node in the old version, this allows adding replicas in the first mixed round. |
99 | 98 | 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) { |
101 | 100 | logger.info("--> cancelling primary shard on node [{}]", primaryNodeId); |
102 | 101 | cancelShard(indexName, 0, primaryNodeId); |
103 | 102 | logger.info("--> done cancelling primary shard on node [{}]", primaryNodeId); |
104 | 103 |
|
105 | 104 | String currentPrimaryNodeId = getPrimaryNodeIdOfShard(indexName, 0); |
106 | 105 | var currentPrimaryNodeVersion = getNodeVersion(currentPrimaryNodeId); |
107 | | - assertTrue(isOldClusterVersion(currentPrimaryNodeVersion.v1(), currentPrimaryNodeVersion.v2())); |
| 106 | + assertTrue(isOldClusterVersion(currentPrimaryNodeVersion.version(), currentPrimaryNodeVersion.buildHash())); |
108 | 107 | } |
109 | 108 | } else { |
110 | 109 | logger.info("--> not in first upgrade round, removing exclusions for [{}]", indexName); |
@@ -147,11 +146,13 @@ private List<String> getUpgradedNodeIds() throws IOException { |
147 | 146 | return upgradedNodes; |
148 | 147 | } |
149 | 148 |
|
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 { |
151 | 152 | Request request = new Request(HttpGet.METHOD_NAME, "_nodes/" + primaryNodeId); |
152 | 153 | Response response = client().performRequest(request); |
153 | 154 | Map<String, Object> responseAsMap = responseAsMap(response); |
154 | | - return Tuple.tuple( |
| 155 | + return new NodeVersion( |
155 | 156 | extractValue(responseAsMap, "nodes." + primaryNodeId + ".version"), |
156 | 157 | extractValue(responseAsMap, "nodes." + primaryNodeId + ".build_hash") |
157 | 158 | ); |
|
0 commit comments