Skip to content

Commit b8d73a1

Browse files
authored
Default gateway.auto_import_dangling_indices to false (#59302)
Backport of #58898. Part of #48366. Now that there is a dedicated API for dangling indices, the auto-import behaviour can default to off. Also add a note to the breaking changes for 7.9.0.
1 parent 691759f commit b8d73a1

File tree

4 files changed

+49
-5
lines changed

4 files changed

+49
-5
lines changed

docs/reference/migration/migrate_7_9.asciidoc

+26
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ your application to {es} 7.9.
1010
See also <<release-highlights>> and <<es-release-notes>>.
1111

1212
* <<breaking_79_script_cache_changes>>
13+
* <<breaking_79_settings_changes>>
1314

1415
//NOTE: The notable-breaking-changes tagged regions are re-used in the
1516
//Installation and Upgrade Guide
@@ -67,5 +68,30 @@ setting. You may use `script.context.$CONTEXT.max_compilations_rate` for the par
6768
context. For example, for the `processor_conditional` context, use
6869
`script.context.processor_conditional.max_compilations_rate`.
6970
71+
====
72+
73+
[discrete]
74+
[[breaking_79_settings_changes]]
75+
=== Settings changes
76+
77+
[[deprecate_auto_import_dangling_indices]]
78+
.Automatically importing dangling indices is disabled by default.
79+
80+
[%collapsible]
81+
====
82+
*Details* +
83+
Automatically importing <<dangling-indices,dangling indices>> into the cluster
84+
is unsafe and is now disabled by default. This feature will be removed entirely
85+
in {es} 8.0.0.
86+
87+
*Impact* +
88+
Use the <<dangling-indices-api,Dangling indices API>> to list, delete or import
89+
any dangling indices manually.
90+
91+
Alternatively you can enable automatic imports of dangling indices, recovering
92+
the unsafe behaviour of earlier versions, by setting
93+
`gateway.auto_import_dangling_indices` to `true`. This setting is deprecated
94+
and will be removed in {es} 8.0.0. We do not recommend using this setting.
95+
7096
====
7197
//end::notable-breaking-changes[]

docs/reference/release-notes/7.9.asciidoc

+6
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ Thread pool write queue size::
3131
`indexing_pressure.memory.limit` setting. This setting configures a limit to
3232
the number of bytes allowed to be consumed by outstanding indexing requests.
3333
{es-issue}59263[#59263]
34+
35+
Dangling indices::
36+
* Automatically importing dangling indices is now deprecated, disabled by
37+
default, and will be removed in {es} 8.0. See the
38+
<<deprecate_auto_import_dangling_indices,migration notes>>.
39+
{es-pull}58176[#58176] {es-pull}58898[#58898] (issue: {es-issue}48366[#48366])

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", "type1", "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
@@ -64,7 +64,7 @@ public class DanglingIndicesState implements ClusterStateListener {
6464
*/
6565
public static final Setting<Boolean> AUTO_IMPORT_DANGLING_INDICES_SETTING = Setting.boolSetting(
6666
"gateway.auto_import_dangling_indices",
67-
true,
67+
false,
6868
Setting.Property.NodeScope,
6969
Setting.Property.Deprecated
7070
);

0 commit comments

Comments
 (0)