From e605b9581fc09085f11b79f72a78da124db62325 Mon Sep 17 00:00:00 2001 From: Lakshya Taragi Date: Tue, 19 Mar 2024 10:26:24 +0530 Subject: [PATCH] Mark restored indices as remote backed during migration Signed-off-by: Lakshya Taragi --- .../RemoteStoreMigrationAllocationIT.java | 69 +++++---- .../RemoteStoreMigrationSettingsUpdateIT.java | 140 +++++++++++++++--- .../TransportClusterUpdateSettingsAction.java | 4 +- .../metadata/MetadataCreateIndexService.java | 8 +- .../opensearch/snapshots/RestoreService.java | 18 ++- 5 files changed, 186 insertions(+), 53 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/remotemigration/RemoteStoreMigrationAllocationIT.java b/server/src/internalClusterTest/java/org/opensearch/remotemigration/RemoteStoreMigrationAllocationIT.java index 6ad6e6711780a..b8a70a5f10de7 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotemigration/RemoteStoreMigrationAllocationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotemigration/RemoteStoreMigrationAllocationIT.java @@ -30,11 +30,11 @@ import java.util.Map; import java.util.Optional; -import static org.opensearch.cluster.metadata.IndexMetadata.*; -import static org.opensearch.node.remotestore.RemoteStoreNodeService.Direction.REMOTE_STORE; -import static org.opensearch.node.remotestore.RemoteStoreNodeService.Direction.NONE; +import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_STORE_ENABLED; import static org.opensearch.node.remotestore.RemoteStoreNodeService.CompatibilityMode.MIXED; import static org.opensearch.node.remotestore.RemoteStoreNodeService.CompatibilityMode.STRICT; +import static org.opensearch.node.remotestore.RemoteStoreNodeService.Direction.NONE; +import static org.opensearch.node.remotestore.RemoteStoreNodeService.Direction.REMOTE_STORE; import static org.opensearch.node.remotestore.RemoteStoreNodeService.MIGRATION_DIRECTION_SETTING; import static org.opensearch.node.remotestore.RemoteStoreNodeService.REMOTE_STORE_COMPATIBILITY_MODE_SETTING; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; @@ -42,10 +42,10 @@ @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0, autoManageMasterNodes = false) public class RemoteStoreMigrationAllocationIT extends MigrationBaseTestCase { - private static final String TEST_INDEX = "test_index"; - protected static final String NAME = "remote_store_migration"; + public static final String TEST_INDEX = "test_index"; + public static final String NAME = "remote_store_migration"; - private final ClusterUpdateSettingsRequest updateSettingsRequest = new ClusterUpdateSettingsRequest(); + private static final ClusterUpdateSettingsRequest updateSettingsRequest = new ClusterUpdateSettingsRequest(); private Client client; // tests for primary shard copy allocation with MIXED mode and REMOTE_STORE direction @@ -73,7 +73,10 @@ public void testDontAllocateNewPrimaryShardOnNonRemoteNodeForMixedModeAndRemoteS Decision decision = getDecisionForTargetNode(nonRemoteNode, true, true, false); Decision.Type type = Decision.Type.NO; assertEquals(type, decision.type()); - assertEquals("[remote_store migration_direction]: primary shard copy can not be allocated to a non-remote node", decision.getExplanation().toLowerCase(Locale.ROOT)); + assertEquals( + "[remote_store migration_direction]: primary shard copy can not be allocated to a non-remote node", + decision.getExplanation().toLowerCase(Locale.ROOT) + ); logger.info(" --> attempt allocation"); attemptAllocation(nonRemoteNodeName); @@ -275,7 +278,10 @@ public void testAllocateNewReplicaShardOnNonRemoteNodeIfPrimaryShardOnRemoteNode Decision.Type type = Decision.Type.YES; assertEquals(type, decision.type()); - assertEquals("[remote_store migration_direction]: replica shard copy can be allocated to a non-remote node", decision.getExplanation().toLowerCase(Locale.ROOT)); + assertEquals( + "[remote_store migration_direction]: replica shard copy can be allocated to a non-remote node", + decision.getExplanation().toLowerCase(Locale.ROOT) + ); logger.info(" --> allocate replica shard on non-remote node"); attemptAllocation(nonRemoteNodeName); @@ -304,8 +310,7 @@ public void testAlwaysAllocateNewShardForStrictMode() throws Exception { DiscoveryNode remoteNode2 = assertNodeInCluster(remoteNodeName2); nodes.add(remoteNode1); nodes.add(remoteNode2); - } - else { + } else { initializeCluster(false); setClusterMode(STRICT.mode); addRemote = false; @@ -364,6 +369,7 @@ public void testAlwaysAllocateNewShardForStrictMode() throws Exception { } // test for remote store backed index + public void testDontAllocateToNonRemoteNodeForRemoteStoreBackedIndex() throws Exception { logger.info(" --> initialize cluster with remote master node"); initializeCluster(true); @@ -382,8 +388,7 @@ public void testDontAllocateToNonRemoteNodeForRemoteStoreBackedIndex() throws Ex logger.info(" --> verify expected decision for allocating a new shard on a non-remote node"); if (isReplicaAllocation) { prepareIndexWithAllocatedPrimary(remoteNode, Optional.empty()); - } - else { + } else { prepareIndexWithoutReplica(Optional.empty()); } @@ -430,20 +435,20 @@ public void initializeCluster(boolean remoteClusterManager) { } // set the compatibility mode of cluster [strict, mixed] - public void setClusterMode(String mode) { + public static void setClusterMode(String mode) { updateSettingsRequest.persistentSettings(Settings.builder().put(REMOTE_STORE_COMPATIBILITY_MODE_SETTING.getKey(), mode)); - assertAcked(client.admin().cluster().updateSettings(updateSettingsRequest).actionGet()); + assertAcked(internalCluster().client().admin().cluster().updateSettings(updateSettingsRequest).actionGet()); } // set the migration direction for cluster [remote_store, docrep, none] - public void setDirection(String direction) { + public static void setDirection(String direction) { updateSettingsRequest.persistentSettings(Settings.builder().put(MIGRATION_DIRECTION_SETTING.getKey(), direction)); - assertAcked(client.admin().cluster().updateSettings(updateSettingsRequest).actionGet()); + assertAcked(internalCluster().client().admin().cluster().updateSettings(updateSettingsRequest).actionGet()); } // verify that the given nodeName exists in cluster - public DiscoveryNode assertNodeInCluster(String nodeName) { - Map nodes = client.admin().cluster().prepareState().get().getState().nodes().getNodes(); + public static DiscoveryNode assertNodeInCluster(String nodeName) { + Map nodes = internalCluster().client().admin().cluster().prepareState().get().getState().nodes().getNodes(); DiscoveryNode discoveryNode = null; for (Map.Entry entry : nodes.entrySet()) { DiscoveryNode node = entry.getValue(); @@ -457,9 +462,9 @@ public DiscoveryNode assertNodeInCluster(String nodeName) { } // returns a comma-separated list of node names excluding `except` - private String allNodesExcept(String except) { + public static String allNodesExcept(String except) { StringBuilder exclude = new StringBuilder(); - DiscoveryNodes allNodes = client.admin().cluster().prepareState().get().getState().nodes(); + DiscoveryNodes allNodes = internalCluster().client().admin().cluster().prepareState().get().getState().nodes(); for (DiscoveryNode node : allNodes) { if (node.getName().equals(except) == false) { exclude.append(node.getName()).append(","); @@ -511,13 +516,15 @@ private Decision getDecisionForTargetNode( } // create a new test index - public void prepareIndexWithoutReplica(Optional name) { + public static void prepareIndexWithoutReplica(Optional name) { String indexName = name.orElse(TEST_INDEX); - client.admin() + internalCluster().client() + .admin() .indices() .prepareCreate(indexName) .setSettings( - Settings.builder().put("index.number_of_shards", 1) + Settings.builder() + .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) .put("index.routing.allocation.exclude._name", allNodesExcept(null)) ) @@ -531,7 +538,8 @@ public void prepareIndexWithAllocatedPrimary(DiscoveryNode primaryShardNode, Opt .indices() .prepareCreate(indexName) .setSettings( - Settings.builder().put("index.number_of_shards", 1) + Settings.builder() + .put("index.number_of_shards", 1) .put("index.number_of_replicas", 1) .put("index.routing.allocation.include._name", primaryShardNode.getName()) .put("index.routing.allocation.exclude._name", allNodesExcept(primaryShardNode.getName())) @@ -573,7 +581,15 @@ private void attemptAllocation(String targetNodeName) { } private ShardRouting getShardRouting(boolean isPrimary) { - IndexShardRoutingTable table = client.admin().cluster().prepareState().execute().actionGet().getState().getRoutingTable().index(TEST_INDEX).shard(0); + IndexShardRoutingTable table = client.admin() + .cluster() + .prepareState() + .execute() + .actionGet() + .getState() + .getRoutingTable() + .index(TEST_INDEX) + .shard(0); return (isPrimary ? table.primaryShard() : table.replicaShards().get(0)); } @@ -581,8 +597,7 @@ private ShardRouting getShardRouting(boolean isPrimary) { private void assertNonAllocation(boolean isPrimary) { if (isPrimary) { ensureRed(TEST_INDEX); - } - else { + } else { ensureYellowAndNoInitializingShards(TEST_INDEX); } ShardRouting shardRouting = getShardRouting(isPrimary); diff --git a/server/src/internalClusterTest/java/org/opensearch/remotemigration/RemoteStoreMigrationSettingsUpdateIT.java b/server/src/internalClusterTest/java/org/opensearch/remotemigration/RemoteStoreMigrationSettingsUpdateIT.java index 0724d53472ea2..b7a3eea09234f 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotemigration/RemoteStoreMigrationSettingsUpdateIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotemigration/RemoteStoreMigrationSettingsUpdateIT.java @@ -8,30 +8,42 @@ package org.opensearch.remotemigration; +import org.opensearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.metadata.IndexMetadata; import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.SettingsException; +import org.opensearch.core.rest.RestStatus; import org.opensearch.index.IndexSettings; import org.opensearch.indices.replication.common.ReplicationType; +import org.opensearch.snapshots.SnapshotInfo; +import org.opensearch.snapshots.SnapshotState; import org.opensearch.test.InternalTestCluster; import org.opensearch.test.OpenSearchIntegTestCase; +import java.nio.file.Path; import java.util.Optional; -import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REPLICATION_TYPE; -import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_STORE_ENABLED; import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_SEGMENT_STORE_REPOSITORY; +import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_STORE_ENABLED; import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY; +import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REPLICATION_TYPE; import static org.opensearch.index.IndexSettings.INDEX_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING; +import static org.opensearch.node.remotestore.RemoteStoreNodeService.CompatibilityMode.MIXED; import static org.opensearch.node.remotestore.RemoteStoreNodeService.CompatibilityMode.STRICT; +import static org.opensearch.node.remotestore.RemoteStoreNodeService.Direction.NONE; import static org.opensearch.node.remotestore.RemoteStoreNodeService.Direction.REMOTE_STORE; -import static org.opensearch.node.remotestore.RemoteStoreNodeService.CompatibilityMode.MIXED; - +import static org.opensearch.remotemigration.RemoteStoreMigrationAllocationIT.TEST_INDEX; +import static org.opensearch.remotemigration.RemoteStoreMigrationAllocationIT.assertNodeInCluster; +import static org.opensearch.remotemigration.RemoteStoreMigrationAllocationIT.prepareIndexWithoutReplica; +import static org.opensearch.remotemigration.RemoteStoreMigrationAllocationIT.setClusterMode; +import static org.opensearch.remotemigration.RemoteStoreMigrationAllocationIT.setDirection; +import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0, autoManageMasterNodes = false) -public class RemoteStoreMigrationSettingsUpdateIT extends RemoteStoreMigrationAllocationIT { - - protected static final String NAME = "remote_store_migration"; +public class RemoteStoreMigrationSettingsUpdateIT extends MigrationBaseTestCase { + private Client client; // remote store backed index setting tests @@ -44,8 +56,9 @@ public void testNewIndexIsRemoteStoreBackedForRemoteStoreDirectionAndMixedMode() logger.info(" --> add non-remote node"); addRemote = false; - internalCluster().startNode(); + String remoteNodeName = internalCluster().startNode(); internalCluster().validateClusterFormed(); + assertNodeInCluster(remoteNodeName); logger.info(" --> create an index"); prepareIndexWithoutReplica(Optional.of(indexName1)); @@ -59,8 +72,9 @@ public void testNewIndexIsRemoteStoreBackedForRemoteStoreDirectionAndMixedMode() logger.info(" --> add remote node"); addRemote = true; - internalCluster().startNode(); + String nonRemoteNodeName = internalCluster().startNode(); internalCluster().validateClusterFormed(); + assertNodeInCluster(nonRemoteNodeName); logger.info(" --> create another index"); prepareIndexWithoutReplica(Optional.of(indexName2)); @@ -69,9 +83,75 @@ public void testNewIndexIsRemoteStoreBackedForRemoteStoreDirectionAndMixedMode() assertRemoteStoreBackedIndex(indexName2); } + public void testNewRestoredIndexIsRemoteStoreBackedForRemoteStoreDirectionAndMixedMode() throws Exception { + logger.info(" --> initialize cluster: gives non remote cluster manager"); + initializeCluster(false); + + logger.info(" --> add remote and non-remote nodes"); + setClusterMode(MIXED.mode); + addRemote = false; + String nonRemoteNodeName = internalCluster().startNode(); + addRemote = true; + String remoteNodeName = internalCluster().startNode(); + internalCluster().validateClusterFormed(); + assertNodeInCluster(nonRemoteNodeName); + assertNodeInCluster(remoteNodeName); + + logger.info(" --> create a non remote-backed index"); + client.admin() + .indices() + .prepareCreate(TEST_INDEX) + .setSettings( + Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).build() + ) + .get(); + + logger.info(" --> verify that non remote stored backed index is created"); + assertNonRemoteStoreBackedIndex(TEST_INDEX); + + logger.info(" --> create repository"); + String snapshotName = "test-snapshot"; + String snapshotRepoName = "test-restore-snapshot-repo"; + Path snapshotRepoNameAbsolutePath = randomRepoPath().toAbsolutePath(); + assertAcked( + clusterAdmin().preparePutRepository(snapshotRepoName) + .setType("fs") + .setSettings(Settings.builder().put("location", snapshotRepoNameAbsolutePath)) + ); + + logger.info(" --> create snapshot of non remote stored backed index"); + + SnapshotInfo snapshotInfo = client().admin() + .cluster() + .prepareCreateSnapshot(snapshotRepoName, snapshotName) + .setIndices(TEST_INDEX) + .setWaitForCompletion(true) + .get() + .getSnapshotInfo(); + + assertEquals(SnapshotState.SUCCESS, snapshotInfo.state()); + assertTrue(snapshotInfo.successfulShards() > 0); + assertEquals(0, snapshotInfo.failedShards()); + + logger.info(" --> restore index from snapshot under NONE direction"); + String restoredIndexName1 = TEST_INDEX + "-restored1"; + restoreSnapshot(snapshotRepoName, snapshotName, restoredIndexName1); + + logger.info(" --> verify that restored index is non remote-backed"); + assertNonRemoteStoreBackedIndex(restoredIndexName1); + + logger.info(" --> restore index from snapshot under REMOTE_STORE direction"); + setDirection(REMOTE_STORE.direction); + String restoredIndexName2 = TEST_INDEX + "-restored2"; + restoreSnapshot(snapshotRepoName, snapshotName, restoredIndexName2); + + logger.info(" --> verify that restored index is non remote-backed"); + assertRemoteStoreBackedIndex(restoredIndexName2); + } // compatibility mode setting test - public void testSwitchToStrictMode() throws Exception { + + public void testSwitchToStrictMode() throws Exception { logger.info(" --> initialize cluster"); initializeCluster(false); @@ -82,12 +162,11 @@ public void testSwitchToStrictMode() throws Exception { addRemote = false; String nonRemoteNodeName = internalCluster().startNode(); internalCluster().validateClusterFormed(); + assertNodeInCluster(remoteNodeName); + assertNodeInCluster(nonRemoteNodeName); logger.info(" --> attempt switching to strict mode"); - SettingsException exception = assertThrows( - SettingsException.class, - () -> setClusterMode(STRICT.mode) - ); + SettingsException exception = assertThrows(SettingsException.class, () -> setClusterMode(STRICT.mode)); assertEquals( "can not switch to STRICT compatibility mode when the cluster contains both remote and non-remote nodes", exception.getMessage() @@ -103,7 +182,7 @@ public void testSwitchToStrictMode() throws Exception { // verify that the created index is not remote store backed private void assertNonRemoteStoreBackedIndex(String indexName) { - Settings indexSettings = internalCluster().client().admin().indices().prepareGetIndex().execute().actionGet().getSettings().get(indexName); + Settings indexSettings = client.admin().indices().prepareGetIndex().execute().actionGet().getSettings().get(indexName); assertEquals(ReplicationType.DOCUMENT.toString(), indexSettings.get(SETTING_REPLICATION_TYPE)); assertNull(indexSettings.get(SETTING_REMOTE_STORE_ENABLED)); assertNull(indexSettings.get(SETTING_REMOTE_SEGMENT_STORE_REPOSITORY)); @@ -112,12 +191,39 @@ private void assertNonRemoteStoreBackedIndex(String indexName) { // verify that the created index is remote store backed private void assertRemoteStoreBackedIndex(String indexName) { - Settings indexSettings = internalCluster().client().admin().indices().prepareGetIndex().execute().actionGet().getSettings().get(indexName); + Settings indexSettings = client.admin().indices().prepareGetIndex().execute().actionGet().getSettings().get(indexName); assertEquals(ReplicationType.SEGMENT.toString(), indexSettings.get(SETTING_REPLICATION_TYPE)); assertEquals("true", indexSettings.get(SETTING_REMOTE_STORE_ENABLED)); assertEquals(REPOSITORY_NAME, indexSettings.get(SETTING_REMOTE_SEGMENT_STORE_REPOSITORY)); assertEquals(REPOSITORY_2_NAME, indexSettings.get(SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY)); - assertEquals(IndexSettings.DEFAULT_REMOTE_TRANSLOG_BUFFER_INTERVAL, INDEX_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING.get(indexSettings)); + assertEquals( + IndexSettings.DEFAULT_REMOTE_TRANSLOG_BUFFER_INTERVAL, + INDEX_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING.get(indexSettings) + ); + } + + // restore indices from a snapshot + private void restoreSnapshot(String snapshotRepoName, String snapshotName, String restoredIndexName) { + RestoreSnapshotResponse restoreSnapshotResponse = client.admin() + .cluster() + .prepareRestoreSnapshot(snapshotRepoName, snapshotName) + .setWaitForCompletion(false) + .setIndices(TEST_INDEX) + .setRenamePattern(TEST_INDEX) + .setRenameReplacement(restoredIndexName) + .get(); + + assertEquals(restoreSnapshotResponse.status(), RestStatus.ACCEPTED); + ensureGreen(restoredIndexName); + } + + private void initializeCluster(boolean remoteClusterManager) { + addRemote = remoteClusterManager; + internalCluster().setBootstrapClusterManagerNodeIndex(0); + internalCluster().startNodes(1); + client = internalCluster().client(); + setClusterMode(STRICT.mode); + setDirection(NONE.direction); } } 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 8a7f16433cc69..618e16e085985 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 @@ -283,7 +283,9 @@ private void validateCompatibilityModeSettingRequest(ClusterUpdateSettingsReques hasNonRemoteNode = true; } if (hasRemoteNode && hasNonRemoteNode) { - throw new SettingsException("can not switch to STRICT compatibility mode when the cluster contains both remote and non-remote nodes"); + throw new SettingsException( + "can not switch to STRICT compatibility mode when the cluster contains both remote and non-remote nodes" + ); } } } diff --git a/server/src/main/java/org/opensearch/cluster/metadata/MetadataCreateIndexService.java b/server/src/main/java/org/opensearch/cluster/metadata/MetadataCreateIndexService.java index 85761e8bce20e..f645d95b69526 100644 --- a/server/src/main/java/org/opensearch/cluster/metadata/MetadataCreateIndexService.java +++ b/server/src/main/java/org/opensearch/cluster/metadata/MetadataCreateIndexService.java @@ -1011,7 +1011,11 @@ public static void updateRemoteStoreSettings(Settings.Builder settingsBuilder, S * @param clusterState state of cluster * @param clusterSettings cluster level settings */ - public static void updateRemoteStoreSettingsForMigration(Settings.Builder settingsBuilder, ClusterState clusterState, ClusterSettings clusterSettings) { + public static void updateRemoteStoreSettingsForMigration( + Settings.Builder settingsBuilder, + ClusterState clusterState, + ClusterSettings clusterSettings + ) { String value = settingsBuilder.get(SETTING_REMOTE_STORE_ENABLED); if (value != null && value.toLowerCase(Locale.ROOT).equals("true")) { return; @@ -1025,7 +1029,7 @@ public static void updateRemoteStoreSettingsForMigration(Settings.Builder settin if (isMixedMode && isRemoteStoreMigrationDirection) { String segmentRepo, translogRepo; - Map nodes = clusterState.nodes().getNodes();; + Map nodes = clusterState.nodes().getNodes(); for (Map.Entry entry : nodes.entrySet()) { DiscoveryNode node = entry.getValue(); if (node.isRemoteStoreNode()) { diff --git a/server/src/main/java/org/opensearch/snapshots/RestoreService.java b/server/src/main/java/org/opensearch/snapshots/RestoreService.java index 14099f2e27c54..cb518bbb5e380 100644 --- a/server/src/main/java/org/opensearch/snapshots/RestoreService.java +++ b/server/src/main/java/org/opensearch/snapshots/RestoreService.java @@ -671,9 +671,15 @@ private Settings getOverrideSettingsInternal() { clusterService.getSettings(), clusterService.getClusterSettings() ); - // remote store settings needs to be overridden if the remote store feature is enabled in the - // cluster where snapshot is being restored. + // remote store settings needs to be overridden in the cluster where snapshot is being restored if: + // 1. the remote store feature is enabled + // 2. cluster is undergoing remote store migration MetadataCreateIndexService.updateRemoteStoreSettings(settingsBuilder, clusterService.getSettings()); + MetadataCreateIndexService.updateRemoteStoreSettingsForMigration( + settingsBuilder, + clusterService.state(), + clusterService.getClusterSettings() + ); return settingsBuilder.build(); } @@ -691,8 +697,8 @@ private void updateReplicationStrategy( settingsBuilder.put(SETTING_REPLICATION_TYPE, ReplicationType.SEGMENT); } else if (!INDEX_REPLICATION_TYPE_SETTING.exists(requestSettings) && clusterSettings.get(IndicesService.CLUSTER_INDEX_RESTRICT_REPLICATION_TYPE_SETTING)) { - settingsBuilder.put(SETTING_REPLICATION_TYPE, clusterSettings.get(CLUSTER_REPLICATION_TYPE_SETTING).name()); - } + settingsBuilder.put(SETTING_REPLICATION_TYPE, clusterSettings.get(CLUSTER_REPLICATION_TYPE_SETTING).name()); + } } private void populateIgnoredShards(String index, final Set ignoreShards) { @@ -1109,8 +1115,8 @@ public static RestoreInProgress.Entry restoreInProgress(ClusterState state, Stri static class CleanRestoreStateTaskExecutor implements - ClusterStateTaskExecutor, - ClusterStateTaskListener { + ClusterStateTaskExecutor, + ClusterStateTaskListener { static class Task { final String uuid;