From 3a1e37f5104f6cd4812581eac7fef1bf6d36bd3e Mon Sep 17 00:00:00 2001 From: Sooraj Sinha Date: Mon, 7 Oct 2024 18:52:34 +0530 Subject: [PATCH] Always send coordination metadata in diff Signed-off-by: Sooraj Sinha --- CHANGELOG.md | 1 + .../org/opensearch/gateway/remote/ClusterStateDiffManifest.java | 2 +- .../gateway/remote/model/ClusterStateDiffManifestTests.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e3a515fb8008..ed92b0c189216 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Fix race condition in node-join and node-left ([#15521](https://github.com/opensearch-project/OpenSearch/pull/15521)) - Streaming bulk request hangs ([#16158](https://github.com/opensearch-project/OpenSearch/pull/16158)) - Fix warnings from SLF4J on startup when repository-s3 is installed ([#16194](https://github.com/opensearch-project/OpenSearch/pull/16194)) +- Fix coordination metadata diff in remote cluster state publication ([#16215](https://github.com/opensearch-project/OpenSearch/pull/16215)) ### Security diff --git a/server/src/main/java/org/opensearch/gateway/remote/ClusterStateDiffManifest.java b/server/src/main/java/org/opensearch/gateway/remote/ClusterStateDiffManifest.java index a97b3e1bc6c4b..0309080c971e0 100644 --- a/server/src/main/java/org/opensearch/gateway/remote/ClusterStateDiffManifest.java +++ b/server/src/main/java/org/opensearch/gateway/remote/ClusterStateDiffManifest.java @@ -89,7 +89,7 @@ public ClusterStateDiffManifest( ) { fromStateUUID = previousState.stateUUID(); toStateUUID = state.stateUUID(); - coordinationMetadataUpdated = !Metadata.isCoordinationMetadataEqual(state.metadata(), previousState.metadata()); + coordinationMetadataUpdated = true; settingsMetadataUpdated = !Metadata.isSettingsMetadataEqual(state.metadata(), previousState.metadata()); transientSettingsMetadataUpdated = !Metadata.isTransientSettingsMetadataEqual(state.metadata(), previousState.metadata()); templatesMetadataUpdated = !Metadata.isTemplatesMetadataEqual(state.metadata(), previousState.metadata()); diff --git a/server/src/test/java/org/opensearch/gateway/remote/model/ClusterStateDiffManifestTests.java b/server/src/test/java/org/opensearch/gateway/remote/model/ClusterStateDiffManifestTests.java index e716822939a58..27d5f0167b14d 100644 --- a/server/src/test/java/org/opensearch/gateway/remote/model/ClusterStateDiffManifestTests.java +++ b/server/src/test/java/org/opensearch/gateway/remote/model/ClusterStateDiffManifestTests.java @@ -298,7 +298,7 @@ private ClusterStateDiffManifest updateAndVerifyState( assertEquals(customsToRemove, manifest.getCustomMetadataDeleted()); assertEquals(new ArrayList<>(clusterStateCustomsToAdd.keySet()), manifest.getClusterStateCustomUpdated()); assertEquals(clusterStateCustomsToRemove, manifest.getClusterStateCustomDeleted()); - assertEquals(updateCoordinationState, manifest.isCoordinationMetadataUpdated()); + assertTrue(manifest.isCoordinationMetadataUpdated()); assertEquals(updatePersistentSettings, manifest.isSettingsMetadataUpdated()); assertEquals(updateTemplates, manifest.isTemplatesMetadataUpdated()); assertEquals(updateTransientSettings, manifest.isTransientSettingsMetadataUpdated());