diff --git a/server/src/main/java/org/elasticsearch/indices/SystemIndexMappingUpdateService.java b/server/src/main/java/org/elasticsearch/indices/SystemIndexMappingUpdateService.java index f0620312c0db1..dd96d0b8c4c53 100644 --- a/server/src/main/java/org/elasticsearch/indices/SystemIndexMappingUpdateService.java +++ b/server/src/main/java/org/elasticsearch/indices/SystemIndexMappingUpdateService.java @@ -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.