|
31 | 31 | import org.elasticsearch.env.TestEnvironment;
|
32 | 32 | import org.elasticsearch.gateway.GatewayMetaState;
|
33 | 33 | import org.elasticsearch.gateway.PersistedClusterStateService;
|
34 |
| -import org.elasticsearch.indices.IndicesService; |
35 | 34 | import org.elasticsearch.node.Node;
|
36 | 35 | import org.elasticsearch.test.ESIntegTestCase;
|
37 | 36 | import org.elasticsearch.test.InternalTestCluster;
|
|
41 | 40 | import java.util.List;
|
42 | 41 | import java.util.Locale;
|
43 | 42 |
|
44 |
| -import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE; |
45 |
| -import static org.elasticsearch.gateway.DanglingIndicesState.AUTO_IMPORT_DANGLING_INDICES_SETTING; |
46 |
| -import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; |
47 | 43 | import static org.elasticsearch.indices.recovery.RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING;
|
48 | 44 | import static org.elasticsearch.test.NodeRoles.nonMasterNode;
|
49 |
| -import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; |
50 | 45 | import static org.hamcrest.Matchers.containsString;
|
51 | 46 | import static org.hamcrest.Matchers.equalTo;
|
52 | 47 | import static org.hamcrest.Matchers.notNullValue;
|
@@ -312,67 +307,6 @@ public void test3MasterNodes2Failed() throws Exception {
|
312 | 307 | ensureStableCluster(4);
|
313 | 308 | }
|
314 | 309 |
|
315 |
| - public void testAllMasterEligibleNodesFailedDanglingIndexImport() throws Exception { |
316 |
| - internalCluster().setBootstrapMasterNodeIndex(0); |
317 |
| - |
318 |
| - Settings settings = Settings.builder() |
319 |
| - .put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true) |
320 |
| - .build(); |
321 |
| - |
322 |
| - logger.info("--> start mixed data and master-eligible node and bootstrap cluster"); |
323 |
| - String masterNode = internalCluster().startNode(settings); // node ordinal 0 |
324 |
| - |
325 |
| - logger.info("--> start data-only node and ensure 2 nodes stable cluster"); |
326 |
| - String dataNode = internalCluster().startDataOnlyNode(settings); // node ordinal 1 |
327 |
| - ensureStableCluster(2); |
328 |
| - |
329 |
| - logger.info("--> index 1 doc and ensure index is green"); |
330 |
| - client().prepareIndex("test").setId("1").setSource("field1", "value1").setRefreshPolicy(IMMEDIATE).get(); |
331 |
| - ensureGreen("test"); |
332 |
| - assertBusy(() -> internalCluster().getInstances(IndicesService.class).forEach( |
333 |
| - indicesService -> assertTrue(indicesService.allPendingDanglingIndicesWritten()))); |
334 |
| - |
335 |
| - logger.info("--> verify 1 doc in the index"); |
336 |
| - assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), 1L); |
337 |
| - assertThat(client().prepareGet("test", "1").execute().actionGet().isExists(), equalTo(true)); |
338 |
| - |
339 |
| - logger.info("--> stop data-only node and detach it from the old cluster"); |
340 |
| - Settings dataNodeDataPathSettings = Settings.builder() |
341 |
| - .put(internalCluster().dataPathSettings(dataNode), true) |
342 |
| - .put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true) |
343 |
| - .build(); |
344 |
| - assertBusy(() -> internalCluster().getInstance(GatewayMetaState.class, dataNode).allPendingAsyncStatesWritten()); |
345 |
| - internalCluster().stopRandomNode(InternalTestCluster.nameFilter(dataNode)); |
346 |
| - final Environment environment = TestEnvironment.newEnvironment( |
347 |
| - Settings.builder() |
348 |
| - .put(internalCluster().getDefaultSettings()) |
349 |
| - .put(dataNodeDataPathSettings) |
350 |
| - .put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true) |
351 |
| - .build()); |
352 |
| - detachCluster(environment, false); |
353 |
| - |
354 |
| - logger.info("--> stop master-eligible node, clear its data and start it again - new cluster should form"); |
355 |
| - internalCluster().restartNode(masterNode, new InternalTestCluster.RestartCallback(){ |
356 |
| - @Override |
357 |
| - public boolean clearData(String nodeName) { |
358 |
| - return true; |
359 |
| - } |
360 |
| - }); |
361 |
| - |
362 |
| - logger.info("--> start data-only only node and ensure 2 nodes stable cluster"); |
363 |
| - internalCluster().startDataOnlyNode(dataNodeDataPathSettings); |
364 |
| - ensureStableCluster(2); |
365 |
| - |
366 |
| - logger.info("--> verify that the dangling index exists and has green status"); |
367 |
| - assertBusy(() -> { |
368 |
| - assertThat(indexExists("test"), equalTo(true)); |
369 |
| - }); |
370 |
| - ensureGreen("test"); |
371 |
| - |
372 |
| - logger.info("--> verify the doc is there"); |
373 |
| - assertThat(client().prepareGet("test", "1").execute().actionGet().isExists(), equalTo(true)); |
374 |
| - } |
375 |
| - |
376 | 310 | public void testNoInitialBootstrapAfterDetach() throws Exception {
|
377 | 311 | internalCluster().setBootstrapMasterNodeIndex(0);
|
378 | 312 | String masterNode = internalCluster().startMasterOnlyNode();
|
|
0 commit comments