|
@@ -961,9 +961,10 @@ public class FullClusterRestartIT extends ParameterizedFullClusterRestartTestCas
|
|
|
assertTrue("expected to find a primary but didn't\n" + recoveryResponse, foundPrimary);
|
|
|
assertEquals("mismatch while checking for translog recovery\n" + recoveryResponse, shouldHaveTranslog, restoredFromTranslog);
|
|
|
|
|
|
- String currentLuceneVersion = IndexVersion.current().luceneVersion().toString();
|
|
|
- String bwcLuceneVersion = getOldClusterVersion().luceneVersion().toString();
|
|
|
- String minCompatibleBWCVersion = Version.CURRENT.minimumCompatibilityVersion().luceneVersion().toString();
|
|
|
+ var luceneVersion = IndexVersion.current().luceneVersion();
|
|
|
+ String currentLuceneVersion = luceneVersion.toString();
|
|
|
+ int currentLuceneVersionMajor = luceneVersion.major;
|
|
|
+ String bwcLuceneVersion = getOldClusterIndexVersion().luceneVersion().toString();
|
|
|
if (shouldHaveTranslog && false == currentLuceneVersion.equals(bwcLuceneVersion)) {
|
|
|
int numCurrentVersion = 0;
|
|
|
int numBwcVersion = 0;
|
|
@@ -975,19 +976,22 @@ public class FullClusterRestartIT extends ParameterizedFullClusterRestartTestCas
|
|
|
if (false == line.startsWith("p")) {
|
|
|
continue;
|
|
|
}
|
|
|
- Matcher m = Pattern.compile("(\\d+\\.\\d+\\.\\d+)$").matcher(line);
|
|
|
+ Matcher m = Pattern.compile("((\\d+)\\.\\d+\\.\\d+)$").matcher(line);
|
|
|
assertTrue(line, m.find());
|
|
|
String version = m.group(1);
|
|
|
+ int major = Integer.parseInt(m.group(2));
|
|
|
if (currentLuceneVersion.equals(version)) {
|
|
|
numCurrentVersion++;
|
|
|
} else if (bwcLuceneVersion.equals(version)) {
|
|
|
numBwcVersion++;
|
|
|
- } else if (minCompatibleBWCVersion.equals(version) && minCompatibleBWCVersion.equals(bwcLuceneVersion) == false) {
|
|
|
- // Our upgrade path from 7.non-last always goes through 7.last, which depending on timing can create 7.last
|
|
|
- // index segment. We ignore those.
|
|
|
+ } else if (major == currentLuceneVersionMajor - 1) {
|
|
|
+ // we can read one lucene version back. The upgrade path might have created old segment versions.
|
|
|
+ // that's ok, we just ignore them
|
|
|
continue;
|
|
|
} else {
|
|
|
- fail("expected version to be one of [" + currentLuceneVersion + "," + bwcLuceneVersion + "] but was " + line);
|
|
|
+ fail(
|
|
|
+ "expected lucene version to be one of [" + currentLuceneVersion + "," + bwcLuceneVersion + "] but was " + line
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
assertNotEquals(
|
|
@@ -1106,9 +1110,9 @@ public class FullClusterRestartIT extends ParameterizedFullClusterRestartTestCas
|
|
|
createSnapshot.setJsonEntity("{\"indices\": \"" + index + "\"}");
|
|
|
client().performRequest(createSnapshot);
|
|
|
|
|
|
- checkSnapshot("old_snap", count, getOldClusterVersion());
|
|
|
+ checkSnapshot("old_snap", count, getOldClusterVersion(), getOldClusterIndexVersion());
|
|
|
if (false == isRunningAgainstOldCluster()) {
|
|
|
- checkSnapshot("new_snap", count, Version.CURRENT);
|
|
|
+ checkSnapshot("new_snap", count, Version.CURRENT, IndexVersion.current());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1298,7 +1302,7 @@ public class FullClusterRestartIT extends ParameterizedFullClusterRestartTestCas
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
- private void checkSnapshot(final String snapshotName, final int count, final Version tookOnVersion) throws IOException {
|
|
|
+ private void checkSnapshot(String snapshotName, int count, Version tookOnVersion, IndexVersion tookOnIndexVersion) throws IOException {
|
|
|
// Check the snapshot metadata, especially the version
|
|
|
Request listSnapshotRequest = new Request("GET", "/_snapshot/repo/" + snapshotName);
|
|
|
Map<String, Object> snapResponse = entityAsMap(client().performRequest(listSnapshotRequest));
|
|
@@ -1308,7 +1312,7 @@ public class FullClusterRestartIT extends ParameterizedFullClusterRestartTestCas
|
|
|
// the format can change depending on the ES node version running & this test code running
|
|
|
assertThat(
|
|
|
XContentMapValues.extractValue("snapshots.version", snapResponse),
|
|
|
- either(Matchers.<Object>equalTo(List.of(tookOnVersion.toString()))).or(equalTo(List.of(tookOnVersion.indexVersion.toString())))
|
|
|
+ either(Matchers.<Object>equalTo(List.of(tookOnVersion.toString()))).or(equalTo(List.of(tookOnIndexVersion.toString())))
|
|
|
);
|
|
|
|
|
|
// Remove the routing setting and template so we can test restoring them.
|