Skip to content

Commit

Permalink
Add assertion to catch unwanted condition
Browse files Browse the repository at this point in the history
  • Loading branch information
williamrandolph committed Dec 1, 2023
1 parent de4c0ba commit 2533de0
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,21 @@ public void clusterChanged(ClusterChangedEvent event) {
}

// if we're in a mixed-version cluster, exit
if (state.nodes().getMaxNodeVersion().after(state.nodes().getSmallestNonClientNodeVersion())) {
if (state.hasMixedSystemIndexVersions()) {
logger.debug("Skipping system indices up-to-date check as cluster has mixed versions");
logger.trace(() -> "Min versions: " + state.getMinSystemIndexMappingVersions());
return;
}

assert state.nodes().getMaxNodeVersion().equals(state.nodes().getSmallestNonClientNodeVersion())
: "Shouldn't be upgrading system index mappings with max node version ["
+ state.nodes().getMaxNodeVersion()
+ "], min node version ["
+ state.nodes().getSmallestNonClientNodeVersion()
+ "], system index mapping versions ["
+ state.getMinSystemIndexMappingVersions()
+ "]";

if (isUpgradeInProgress.compareAndSet(false, true)) {
// Use a RefCountingRunnable so that we only release the lock once all upgrade attempts have succeeded or failed.
// The failures are logged in upgradeIndexMetadata(), so we don't actually care about them here.
Expand Down

0 comments on commit 2533de0

Please sign in to comment.