|
@@ -41,18 +41,14 @@ import org.elasticsearch.test.TestCustomMetaData;
|
|
|
import org.elasticsearch.test.junit.annotations.TestLogging;
|
|
|
import org.elasticsearch.transport.RemoteTransportException;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
import java.util.EnumSet;
|
|
|
import java.util.Optional;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
-import java.util.concurrent.CountDownLatch;
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.TimeoutException;
|
|
|
-import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
import static org.hamcrest.Matchers.containsString;
|
|
|
-import static org.hamcrest.Matchers.either;
|
|
|
import static org.hamcrest.Matchers.equalTo;
|
|
|
import static org.hamcrest.Matchers.is;
|
|
|
import static org.hamcrest.Matchers.not;
|
|
@@ -97,38 +93,6 @@ public class ZenDiscoveryIT extends ESIntegTestCase {
|
|
|
assertThat(numRecoveriesAfterNewMaster, equalTo(numRecoveriesBeforeNewMaster));
|
|
|
}
|
|
|
|
|
|
- public void testNodeFailuresAreProcessedOnce() throws IOException {
|
|
|
- Settings masterNodeSettings = Settings.builder()
|
|
|
- .put(Node.NODE_DATA_SETTING.getKey(), false)
|
|
|
- .build();
|
|
|
- String master = internalCluster().startNode(masterNodeSettings);
|
|
|
- Settings dateNodeSettings = Settings.builder()
|
|
|
- .put(Node.NODE_MASTER_SETTING.getKey(), false)
|
|
|
- .build();
|
|
|
- internalCluster().startNodes(2, dateNodeSettings);
|
|
|
- client().admin().cluster().prepareHealth().setWaitForNodes("3").get();
|
|
|
-
|
|
|
- ClusterService clusterService = internalCluster().getInstance(ClusterService.class, master);
|
|
|
- final AtomicInteger numUpdates = new AtomicInteger();
|
|
|
- final CountDownLatch nodesStopped = new CountDownLatch(1);
|
|
|
- clusterService.addStateApplier(event -> {
|
|
|
- numUpdates.incrementAndGet();
|
|
|
- try {
|
|
|
- // block until both nodes have stopped to accumulate node failures
|
|
|
- nodesStopped.await();
|
|
|
- } catch (InterruptedException e) {
|
|
|
- //meh
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- internalCluster().stopRandomNonMasterNode();
|
|
|
- internalCluster().stopRandomNonMasterNode();
|
|
|
- nodesStopped.countDown();
|
|
|
-
|
|
|
- client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).get(); // wait for all to be processed
|
|
|
- assertThat(numUpdates.get(), either(equalTo(1)).or(equalTo(2))); // due to batching, both nodes can be handled in same CS update
|
|
|
- }
|
|
|
-
|
|
|
public void testHandleNodeJoin_incompatibleClusterState()
|
|
|
throws InterruptedException, ExecutionException, TimeoutException {
|
|
|
String masterNode = internalCluster().startMasterOnlyNode();
|