Skip to content

Commit 650f20e

Browse files
authored
Default gateway.auto_import_dangling_indices to false (#58898)
Part of #48366. Now that there is a dedicated API for dangling indices, the auto-import behaviour can default to off.
1 parent 1ba1b9f commit 650f20e

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

server/src/internalClusterTest/java/org/elasticsearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java

+16-4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import java.util.Locale;
4343

4444
import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
45+
import static org.elasticsearch.gateway.DanglingIndicesState.AUTO_IMPORT_DANGLING_INDICES_SETTING;
4546
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
4647
import static org.elasticsearch.indices.recovery.RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING;
4748
import static org.elasticsearch.test.NodeRoles.nonMasterNode;
@@ -314,11 +315,15 @@ public void test3MasterNodes2Failed() throws Exception {
314315
public void testAllMasterEligibleNodesFailedDanglingIndexImport() throws Exception {
315316
internalCluster().setBootstrapMasterNodeIndex(0);
316317

318+
Settings settings = Settings.builder()
319+
.put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true)
320+
.build();
321+
317322
logger.info("--> start mixed data and master-eligible node and bootstrap cluster");
318-
String masterNode = internalCluster().startNode(); // node ordinal 0
323+
String masterNode = internalCluster().startNode(settings); // node ordinal 0
319324

320325
logger.info("--> start data-only node and ensure 2 nodes stable cluster");
321-
String dataNode = internalCluster().startDataOnlyNode(); // node ordinal 1
326+
String dataNode = internalCluster().startDataOnlyNode(settings); // node ordinal 1
322327
ensureStableCluster(2);
323328

324329
logger.info("--> index 1 doc and ensure index is green");
@@ -332,11 +337,18 @@ public void testAllMasterEligibleNodesFailedDanglingIndexImport() throws Excepti
332337
assertThat(client().prepareGet("test", "1").execute().actionGet().isExists(), equalTo(true));
333338

334339
logger.info("--> stop data-only node and detach it from the old cluster");
335-
Settings dataNodeDataPathSettings = internalCluster().dataPathSettings(dataNode);
340+
Settings dataNodeDataPathSettings = Settings.builder()
341+
.put(internalCluster().dataPathSettings(dataNode), true)
342+
.put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true)
343+
.build();
336344
assertBusy(() -> internalCluster().getInstance(GatewayMetaState.class, dataNode).allPendingAsyncStatesWritten());
337345
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(dataNode));
338346
final Environment environment = TestEnvironment.newEnvironment(
339-
Settings.builder().put(internalCluster().getDefaultSettings()).put(dataNodeDataPathSettings).build());
347+
Settings.builder()
348+
.put(internalCluster().getDefaultSettings())
349+
.put(dataNodeDataPathSettings)
350+
.put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true)
351+
.build());
340352
detachCluster(environment, false);
341353

342354
logger.info("--> stop master-eligible node, clear its data and start it again - new cluster should form");

server/src/main/java/org/elasticsearch/gateway/DanglingIndicesState.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class DanglingIndicesState implements ClusterStateListener {
6363
*/
6464
public static final Setting<Boolean> AUTO_IMPORT_DANGLING_INDICES_SETTING = Setting.boolSetting(
6565
"gateway.auto_import_dangling_indices",
66-
true,
66+
false,
6767
Setting.Property.NodeScope,
6868
Setting.Property.Deprecated
6969
);

0 commit comments

Comments
 (0)