|
42 | 42 | import org.elasticsearch.test.junit.annotations.TestLogging; |
43 | 43 | import org.elasticsearch.transport.RemoteTransportException; |
44 | 44 |
|
45 | | -import java.io.IOException; |
46 | 45 | import java.util.EnumSet; |
47 | 46 | import java.util.Optional; |
48 | 47 | import java.util.concurrent.CompletableFuture; |
49 | | -import java.util.concurrent.CountDownLatch; |
50 | 48 | import java.util.concurrent.ExecutionException; |
51 | 49 | import java.util.concurrent.TimeUnit; |
52 | 50 | import java.util.concurrent.TimeoutException; |
53 | | -import java.util.concurrent.atomic.AtomicInteger; |
54 | 51 |
|
55 | 52 | import static org.hamcrest.Matchers.containsString; |
56 | | -import static org.hamcrest.Matchers.either; |
57 | 53 | import static org.hamcrest.Matchers.equalTo; |
58 | 54 | import static org.hamcrest.Matchers.is; |
59 | 55 | import static org.hamcrest.Matchers.not; |
@@ -105,45 +101,6 @@ public void testNoShardRelocationsOccurWhenElectedMasterNodeFails() throws Excep |
105 | 101 | assertThat(numRecoveriesAfterNewMaster, equalTo(numRecoveriesBeforeNewMaster)); |
106 | 102 | } |
107 | 103 |
|
108 | | - public void testNodeFailuresAreProcessedOnce() throws IOException { |
109 | | - Settings defaultSettings = Settings.builder() |
110 | | - .put(FaultDetection.PING_TIMEOUT_SETTING.getKey(), "1s") |
111 | | - .put(FaultDetection.PING_RETRIES_SETTING.getKey(), "1") |
112 | | - .build(); |
113 | | - |
114 | | - Settings masterNodeSettings = Settings.builder() |
115 | | - .put(Node.NODE_DATA_SETTING.getKey(), false) |
116 | | - .put(defaultSettings) |
117 | | - .build(); |
118 | | - String master = internalCluster().startNode(masterNodeSettings); |
119 | | - Settings dateNodeSettings = Settings.builder() |
120 | | - .put(Node.NODE_MASTER_SETTING.getKey(), false) |
121 | | - .put(defaultSettings) |
122 | | - .build(); |
123 | | - internalCluster().startNodes(2, dateNodeSettings); |
124 | | - client().admin().cluster().prepareHealth().setWaitForNodes("3").get(); |
125 | | - |
126 | | - ClusterService clusterService = internalCluster().getInstance(ClusterService.class, master); |
127 | | - final AtomicInteger numUpdates = new AtomicInteger(); |
128 | | - final CountDownLatch nodesStopped = new CountDownLatch(1); |
129 | | - clusterService.addStateApplier(event -> { |
130 | | - numUpdates.incrementAndGet(); |
131 | | - try { |
132 | | - // block until both nodes have stopped to accumulate node failures |
133 | | - nodesStopped.await(); |
134 | | - } catch (InterruptedException e) { |
135 | | - //meh |
136 | | - } |
137 | | - }); |
138 | | - |
139 | | - internalCluster().stopRandomNonMasterNode(); |
140 | | - internalCluster().stopRandomNonMasterNode(); |
141 | | - nodesStopped.countDown(); |
142 | | - |
143 | | - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).get(); // wait for all to be processed |
144 | | - assertThat(numUpdates.get(), either(equalTo(1)).or(equalTo(2))); // due to batching, both nodes can be handled in same CS update |
145 | | - } |
146 | | - |
147 | 104 | public void testHandleNodeJoin_incompatibleClusterState() |
148 | 105 | throws InterruptedException, ExecutionException, TimeoutException { |
149 | 106 | String masterNode = internalCluster().startMasterOnlyNode(); |
|
0 commit comments