Skip to content

Commit

Permalink
[TEST] Fix test for 7.last upgrades (#82579) (#82589)
Browse files Browse the repository at this point in the history
Our bwc tests now always upgrade through 7.last.
This PR fixes a race condition related to potentially
seeing a 7.last index when we upgrade from 7.non-last.
  • Loading branch information
grcevski committed Jan 13, 2022
1 parent 49b44cb commit dae07f3
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,7 @@ public void testRecovery() throws Exception {

String currentLuceneVersion = Version.CURRENT.luceneVersion.toString();
String bwcLuceneVersion = getOldClusterVersion().luceneVersion.toString();
String minCompatibleBWCVersion = Version.CURRENT.minimumCompatibilityVersion().luceneVersion.toString();
if (shouldHaveTranslog && false == currentLuceneVersion.equals(bwcLuceneVersion)) {
int numCurrentVersion = 0;
int numBwcVersion = 0;
Expand All @@ -937,6 +938,10 @@ public void testRecovery() throws Exception {
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.
continue;
} else {
fail("expected version to be one of [" + currentLuceneVersion + "," + bwcLuceneVersion + "] but was " + line);
}
Expand Down

0 comments on commit dae07f3

Please sign in to comment.