From d9ec3fa628c7b0ba3d25692e277ba26814820b20 Mon Sep 17 00:00:00 2001 From: William Brafford Date: Fri, 3 Nov 2023 16:09:24 -0400 Subject: [PATCH] Don't update system index mappings in mixed clusters (#101778) (#101798) * Don't update system index mappings in mixed clusters #99668 seems to have introduced a bug where SystemIndexMappingUpdateService updates system index mappings even in mixed clusters. This PR restores the old version-based check in order to be sure that there's no update until the cluster is fully upgraded. The timing of the mapping update seems to be causing worse problems, corrupting persisted cluster state. Fixes #99778, #101331 * Remove broken assertion The compatibility versions objects are not showing up correctly, so we shouldn't assert on them. --- docs/changelog/101778.yaml | 7 +++++++ .../test/java/org/elasticsearch/upgrades/RecoveryIT.java | 2 -- .../indices/SystemIndexMappingUpdateService.java | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 docs/changelog/101778.yaml diff --git a/docs/changelog/101778.yaml b/docs/changelog/101778.yaml new file mode 100644 index 0000000000000..9ad2f0c9154c3 --- /dev/null +++ b/docs/changelog/101778.yaml @@ -0,0 +1,7 @@ +pr: 101778 +summary: Don't update system index mappings in mixed clusters +area: Infra/Core +type: bug +issues: + - 101331 + - 99778 diff --git a/qa/rolling-upgrade-legacy/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java b/qa/rolling-upgrade-legacy/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java index f08427f8949a5..93254f4084188 100644 --- a/qa/rolling-upgrade-legacy/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java +++ b/qa/rolling-upgrade-legacy/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java @@ -8,7 +8,6 @@ package org.elasticsearch.upgrades; import org.apache.http.util.EntityUtils; -import org.apache.lucene.tests.util.LuceneTestCase; import org.elasticsearch.Version; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.client.Request; @@ -53,7 +52,6 @@ /** * In depth testing of the recovery mechanism during a rolling restart. */ -@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/99778") public class RecoveryIT extends AbstractRollingTestCase { private static String CLUSTER_NAME = System.getProperty("tests.clustername"); diff --git a/server/src/main/java/org/elasticsearch/indices/SystemIndexMappingUpdateService.java b/server/src/main/java/org/elasticsearch/indices/SystemIndexMappingUpdateService.java index a0667db91daf6..6f272d29efee2 100644 --- a/server/src/main/java/org/elasticsearch/indices/SystemIndexMappingUpdateService.java +++ b/server/src/main/java/org/elasticsearch/indices/SystemIndexMappingUpdateService.java @@ -92,7 +92,7 @@ public void clusterChanged(ClusterChangedEvent event) { } // if we're in a mixed-version cluster, exit - if (state.hasMixedSystemIndexVersions()) { + if (state.nodes().getMaxNodeVersion().after(state.nodes().getSmallestNonClientNodeVersion())) { logger.debug("Skipping system indices up-to-date check as cluster has mixed versions"); return; }