From 06c34bde154660c6832b37c88762f9485ee32a8c Mon Sep 17 00:00:00 2001 From: Shourya Dutta Biswas <114977491+shourya035@users.noreply.github.com> Date: Thu, 18 Jul 2024 14:11:17 +0530 Subject: [PATCH] Addressing comments Signed-off-by: Shourya Dutta Biswas <114977491+shourya035@users.noreply.github.com> --- .../org/opensearch/remotemigration/MigrationBaseTestCase.java | 4 ++-- .../settings/TransportClusterUpdateSettingsAction.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/remotemigration/MigrationBaseTestCase.java b/server/src/internalClusterTest/java/org/opensearch/remotemigration/MigrationBaseTestCase.java index 0b7a6e90b5cb6..e4e681a5433b5 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotemigration/MigrationBaseTestCase.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotemigration/MigrationBaseTestCase.java @@ -297,8 +297,8 @@ public void completeDocRepToRemoteMigration() { .prepareUpdateSettings() .setPersistentSettings( Settings.builder() - .put(REMOTE_STORE_COMPATIBILITY_MODE_SETTING.getKey(), "strict") - .put(MIGRATION_DIRECTION_SETTING.getKey(), "none") + .putNull(REMOTE_STORE_COMPATIBILITY_MODE_SETTING.getKey()) + .putNull(MIGRATION_DIRECTION_SETTING.getKey()) ) .get() .isAcknowledged() diff --git a/server/src/main/java/org/opensearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java b/server/src/main/java/org/opensearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java index 26c2962fc8e1f..f50657317f454 100644 --- a/server/src/main/java/org/opensearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java +++ b/server/src/main/java/org/opensearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java @@ -285,7 +285,7 @@ public ClusterState execute(final ClusterState currentState) { flow. That way we are not interfering with the usual settings update and the cluster state mutation that comes along with it */ - if (isCompatibilityModeChanging == true && isSwitchToStrictCompatibilityMode(request) == true) { + if (isCompatibilityModeChanging && isSwitchToStrictCompatibilityMode(request)) { ClusterState newStateAfterIndexMdChanges = finalizeMigration(clusterState); changed = newStateAfterIndexMdChanges != currentState; return newStateAfterIndexMdChanges; @@ -307,6 +307,7 @@ public ClusterState execute(final ClusterState currentState) { public boolean validateCompatibilityModeSettingRequest(ClusterUpdateSettingsRequest request, ClusterState clusterState) { Settings settings = Settings.builder().put(request.persistentSettings()).put(request.transientSettings()).build(); if (RemoteStoreNodeService.REMOTE_STORE_COMPATIBILITY_MODE_SETTING.exists(settings)) { + logger.info("Compat mode setting : {}", RemoteStoreNodeService.REMOTE_STORE_COMPATIBILITY_MODE_SETTING.get(settings).mode); String value = RemoteStoreNodeService.REMOTE_STORE_COMPATIBILITY_MODE_SETTING.get(settings).mode; validateAllNodesOfSameVersion(clusterState.nodes()); if (RemoteStoreNodeService.CompatibilityMode.STRICT.mode.equals(value)) {