Skip to content

Default gateway.auto_import_dangling_indices to false #58898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.util.Locale;

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

Settings settings = Settings.builder()
.put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true)
.build();

logger.info("--> start mixed data and master-eligible node and bootstrap cluster");
String masterNode = internalCluster().startNode(); // node ordinal 0
String masterNode = internalCluster().startNode(settings); // node ordinal 0

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

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

logger.info("--> stop data-only node and detach it from the old cluster");
Settings dataNodeDataPathSettings = internalCluster().dataPathSettings(dataNode);
Settings dataNodeDataPathSettings = Settings.builder()
.put(internalCluster().dataPathSettings(dataNode), true)
.put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true)
.build();
assertBusy(() -> internalCluster().getInstance(GatewayMetaState.class, dataNode).allPendingAsyncStatesWritten());
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(dataNode));
final Environment environment = TestEnvironment.newEnvironment(
Settings.builder().put(internalCluster().getDefaultSettings()).put(dataNodeDataPathSettings).build());
Settings.builder()
.put(internalCluster().getDefaultSettings())
.put(dataNodeDataPathSettings)
.put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true)
.build());
detachCluster(environment, false);

logger.info("--> stop master-eligible node, clear its data and start it again - new cluster should form");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class DanglingIndicesState implements ClusterStateListener {
*/
public static final Setting<Boolean> AUTO_IMPORT_DANGLING_INDICES_SETTING = Setting.boolSetting(
"gateway.auto_import_dangling_indices",
true,
false,
Setting.Property.NodeScope,
Setting.Property.Deprecated
);
Expand Down