|
70 | 70 | import org.elasticsearch.test.ESIntegTestCase; |
71 | 71 | import org.elasticsearch.test.InternalSettingsPlugin; |
72 | 72 | import org.elasticsearch.test.InternalTestCluster; |
73 | | -import org.elasticsearch.test.discovery.TestZenDiscovery; |
74 | 73 | import org.elasticsearch.test.engine.MockEngineSupport; |
75 | 74 | import org.elasticsearch.test.transport.MockTransportService; |
76 | 75 |
|
|
102 | 101 | @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE, numDataNodes = 0) |
103 | 102 | public class RemoveCorruptedShardDataCommandIT extends ESIntegTestCase { |
104 | 103 |
|
105 | | - @Override |
106 | | - protected Settings nodeSettings(int nodeOrdinal) { |
107 | | - return Settings.builder().put(super.nodeSettings(nodeOrdinal)) |
108 | | - .put(TestZenDiscovery.USE_ZEN2.getKey(), false) // no state persistence yet |
109 | | - .build(); |
110 | | - } |
111 | | - |
112 | 104 | @Override |
113 | 105 | protected Collection<Class<? extends Plugin>> nodePlugins() { |
114 | 106 | return Arrays.asList(MockTransportService.TestPlugin.class, MockEngineFactoryPlugin.class, InternalSettingsPlugin.class); |
@@ -260,7 +252,7 @@ public Settings onNodeStopped(String nodeName) throws Exception { |
260 | 252 | } |
261 | 253 |
|
262 | 254 | public void testCorruptTranslogTruncation() throws Exception { |
263 | | - internalCluster().startNodes(2, Settings.EMPTY); |
| 255 | + internalCluster().startNodes(2); |
264 | 256 |
|
265 | 257 | final String node1 = internalCluster().getNodeNames()[0]; |
266 | 258 | final String node2 = internalCluster().getNodeNames()[1]; |
@@ -436,10 +428,10 @@ public Settings onNodeStopped(String nodeName) throws Exception { |
436 | 428 | } |
437 | 429 |
|
438 | 430 | public void testCorruptTranslogTruncationOfReplica() throws Exception { |
439 | | - internalCluster().startNodes(2, Settings.EMPTY); |
| 431 | + internalCluster().startMasterOnlyNode(); |
440 | 432 |
|
441 | | - final String node1 = internalCluster().getNodeNames()[0]; |
442 | | - final String node2 = internalCluster().getNodeNames()[1]; |
| 433 | + final String node1 = internalCluster().startDataOnlyNode(); |
| 434 | + final String node2 = internalCluster().startDataOnlyNode(); |
443 | 435 | logger.info("--> nodes name: {}, {}", node1, node2); |
444 | 436 |
|
445 | 437 | final String indexName = "test"; |
@@ -481,12 +473,11 @@ public void testCorruptTranslogTruncationOfReplica() throws Exception { |
481 | 473 | final ShardId shardId = new ShardId(resolveIndex(indexName), 0); |
482 | 474 | final Set<Path> translogDirs = getDirs(node2, shardId, ShardPath.TRANSLOG_FOLDER_NAME); |
483 | 475 |
|
484 | | - // stop the cluster nodes. we don't use full restart so the node start up order will be the same |
485 | | - // and shard roles will be maintained |
| 476 | + // stop data nodes. After the restart the 1st node will be primary and the 2nd node will be replica |
486 | 477 | internalCluster().stopRandomDataNode(); |
487 | 478 | internalCluster().stopRandomDataNode(); |
488 | 479 |
|
489 | | - // Corrupt the translog file(s) |
| 480 | + // Corrupt the translog file(s) on the replica |
490 | 481 | logger.info("--> corrupting translog"); |
491 | 482 | TestTranslog.corruptRandomTranslogFile(logger, random(), translogDirs); |
492 | 483 |
|
@@ -555,8 +546,10 @@ public Settings onNodeStopped(String nodeName) throws Exception { |
555 | 546 | } |
556 | 547 |
|
557 | 548 | public void testResolvePath() throws Exception { |
| 549 | + internalCluster().startMasterOnlyNode(); |
| 550 | + |
558 | 551 | final int numOfNodes = randomIntBetween(1, 5); |
559 | | - final List<String> nodeNames = internalCluster().startNodes(numOfNodes, Settings.EMPTY); |
| 552 | + final List<String> nodeNames = internalCluster().startNodes(numOfNodes); |
560 | 553 |
|
561 | 554 | final String indexName = "test" + randomInt(100); |
562 | 555 | assertAcked(prepareCreate(indexName).setSettings(Settings.builder() |
|
0 commit comments