You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sz...@apache.org on 2018/11/20 01:28:41 UTC
incubator-ratis git commit: RATIS-429. RaftReconfigurationTest fails
intermittently.
Repository: incubator-ratis
Updated Branches:
refs/heads/master 96a3b1bfe -> 68bb4c918
RATIS-429. RaftReconfigurationTest fails intermittently.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ratis/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ratis/commit/68bb4c91
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ratis/tree/68bb4c91
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ratis/diff/68bb4c91
Branch: refs/heads/master
Commit: 68bb4c9189659da48f2069f3f96754914bc20d30
Parents: 96a3b1b
Author: Tsz Wo Nicholas Sze <sz...@apache.org>
Authored: Mon Nov 19 17:28:19 2018 -0800
Committer: Tsz Wo Nicholas Sze <sz...@apache.org>
Committed: Mon Nov 19 17:28:19 2018 -0800
----------------------------------------------------------------------
.../TestRaftReconfigurationWithHadoopRpc.java | 7 +-
.../java/org/apache/ratis/RaftTestUtil.java | 4 +-
.../impl/RaftReconfigurationBaseTest.java | 189 ++++++++-----------
.../ratis/server/impl/RaftServerTestUtil.java | 7 +-
.../grpc/TestRaftReconfigurationWithGrpc.java | 11 +-
.../netty/TestRaftReconfigurationWithNetty.java | 10 +-
...TestRaftReconfigurationWithSimulatedRpc.java | 10 +-
7 files changed, 96 insertions(+), 142 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/68bb4c91/ratis-hadoop/src/test/java/org/apache/ratis/hadooprpc/TestRaftReconfigurationWithHadoopRpc.java
----------------------------------------------------------------------
diff --git a/ratis-hadoop/src/test/java/org/apache/ratis/hadooprpc/TestRaftReconfigurationWithHadoopRpc.java b/ratis-hadoop/src/test/java/org/apache/ratis/hadooprpc/TestRaftReconfigurationWithHadoopRpc.java
index df432fc..000d47b 100644
--- a/ratis-hadoop/src/test/java/org/apache/ratis/hadooprpc/TestRaftReconfigurationWithHadoopRpc.java
+++ b/ratis-hadoop/src/test/java/org/apache/ratis/hadooprpc/TestRaftReconfigurationWithHadoopRpc.java
@@ -30,16 +30,17 @@ import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.IPC_CLIENT_CONN
import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.IPC_CLIENT_CONNECT_TIMEOUT_KEY;
public class TestRaftReconfigurationWithHadoopRpc
- extends RaftReconfigurationBaseTest {
+ extends RaftReconfigurationBaseTest<MiniRaftClusterWithHadoopRpc>
+ implements MiniRaftClusterWithHadoopRpc.Factory.Get {
static {
((Log4JLogger) Client.LOG).getLogger().setLevel(Level.ERROR);
}
@Override
- public MiniRaftCluster getCluster(int peerNum) throws IOException {
+ public MiniRaftClusterWithHadoopRpc newCluster(int numPeers) {
final Configuration hadoopConf = new Configuration();
hadoopConf.setInt(IPC_CLIENT_CONNECT_TIMEOUT_KEY, 1000);
hadoopConf.setInt(IPC_CLIENT_CONNECT_MAX_RETRIES_KEY, 0);
- return MiniRaftClusterWithHadoopRpc.FACTORY.newCluster(peerNum, prop, hadoopConf);
+ return MiniRaftClusterWithHadoopRpc.FACTORY.newCluster(numPeers, getProperties(), hadoopConf);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/68bb4c91/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java
----------------------------------------------------------------------
diff --git a/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java b/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java
index e4d9c8c..e305241 100644
--- a/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java
+++ b/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java
@@ -102,13 +102,13 @@ public interface RaftTestUtil {
}
}
- static String waitAndKillLeader(MiniRaftCluster cluster) throws InterruptedException {
+ static RaftPeerId waitAndKillLeader(MiniRaftCluster cluster) throws InterruptedException {
final RaftServerImpl leader = waitForLeader(cluster);
Assert.assertNotNull(leader);
LOG.info("killing leader = " + leader);
cluster.killServer(leader.getId());
- return leader.getId().toString();
+ return leader.getId();
}
static boolean logEntriesContains(RaftLog log, SimpleMessage... expectedMessages) {
http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/68bb4c91/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftReconfigurationBaseTest.java
----------------------------------------------------------------------
diff --git a/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftReconfigurationBaseTest.java b/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftReconfigurationBaseTest.java
index 7fde1c5..edb7565 100644
--- a/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftReconfigurationBaseTest.java
+++ b/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftReconfigurationBaseTest.java
@@ -25,7 +25,6 @@ import org.apache.ratis.RaftTestUtil;
import org.apache.ratis.RaftTestUtil.SimpleMessage;
import org.apache.ratis.client.RaftClient;
import org.apache.ratis.client.RaftClientRpc;
-import org.apache.ratis.conf.RaftProperties;
import org.apache.ratis.protocol.*;
import org.apache.ratis.server.RaftServerConfigKeys;
import org.apache.ratis.server.storage.RaftLog;
@@ -33,7 +32,6 @@ import org.apache.ratis.server.storage.RaftStorageTestUtils;
import org.apache.ratis.util.JavaUtils;
import org.apache.ratis.util.LogUtils;
import org.junit.Assert;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.internal.util.reflection.Whitebox;
@@ -41,14 +39,19 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import static java.util.Arrays.asList;
import static org.apache.ratis.server.impl.RaftServerTestUtil.waitAndCheckNewConf;
-public abstract class RaftReconfigurationBaseTest extends BaseTest {
+public abstract class RaftReconfigurationBaseTest<CLUSTER extends MiniRaftCluster>
+ extends BaseTest
+ implements MiniRaftCluster.Factory.Get<CLUSTER> {
static {
LogUtils.setLogLevel(RaftServerImpl.LOG, Level.DEBUG);
LogUtils.setLogLevel(RaftClient.LOG, Level.DEBUG);
@@ -59,19 +62,10 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
private static final DelayLocalExecutionInjection leaderPlaceHolderDelay =
new DelayLocalExecutionInjection(LeaderState.APPEND_PLACEHOLDER);
- protected static final RaftProperties prop = new RaftProperties();
-
static final int STAGING_CATCHUP_GAP = 10;
- @BeforeClass
- public static void setup() {
- // set a small gap for tests
- RaftServerConfigKeys.setStagingCatchupGap(prop, STAGING_CATCHUP_GAP);
- }
-
- public abstract MiniRaftCluster getCluster(int peerNum) throws IOException;
- private static int getStagingGap() {
- return STAGING_CATCHUP_GAP;
+ {
+ RaftServerConfigKeys.setStagingCatchupGap(getProperties(), STAGING_CATCHUP_GAP);
}
/**
@@ -79,10 +73,7 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
*/
@Test
public void testAddPeers() throws Exception {
- LOG.info("Start testAddPeers");
- MiniRaftCluster cluster = getCluster(3);
- cluster.start();
- try {
+ runWithNewCluster(3, cluster -> {
RaftTestUtil.waitForLeader(cluster);
// add new peers
@@ -93,9 +84,7 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
// wait for the new configuration to take effect
waitAndCheckNewConf(cluster, allPeers, 0, null);
- } finally {
- cluster.shutdown();
- }
+ });
}
/**
@@ -103,10 +92,7 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
*/
@Test
public void testRemovePeers() throws Exception {
- LOG.info("Start testRemovePeers");
- MiniRaftCluster cluster = getCluster(5);
- cluster.start();
- try {
+ runWithNewCluster(5, cluster -> {
RaftTestUtil.waitForLeader(cluster);
// remove peers, leader still included in the new conf
@@ -118,9 +104,7 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
// wait for the new configuration to take effect
waitAndCheckNewConf(cluster, allPeers, 2, null);
- } finally {
- cluster.shutdown();
- }
+ });
}
/**
@@ -128,20 +112,15 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
*/
@Test
public void testAddRemovePeers() throws Exception {
- LOG.info("Start testAddRemovePeers");
- testAddRemovePeers(false);
+ runWithNewCluster(5, cluster -> runTestAddRemovePeers(false, cluster));
}
@Test
public void testLeaderStepDown() throws Exception {
- LOG.info("Start testLeaderStepDown");
- testAddRemovePeers(true);
+ runWithNewCluster(5, cluster -> runTestAddRemovePeers(true, cluster));
}
- private void testAddRemovePeers(boolean leaderStepdown) throws Exception {
- MiniRaftCluster cluster = getCluster(5);
- cluster.start();
- try {
+ private void runTestAddRemovePeers(boolean leaderStepdown, CLUSTER cluster) throws Exception {
RaftTestUtil.waitForLeader(cluster);
PeerChanges change = cluster.addNewPeers(2, true);
@@ -153,22 +132,19 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
// wait for the new configuration to take effect
waitAndCheckNewConf(cluster, allPeers, 2, null);
- } finally {
- cluster.shutdown();
- }
}
@Test(timeout = 30000)
public void testReconfTwice() throws Exception {
- LOG.info("Start testReconfTwice");
- final MiniRaftCluster cluster = getCluster(3);
- cluster.start();
- try {
+ runWithNewCluster(3, this::runTestReconfTwice);
+ }
+
+ void runTestReconfTwice(CLUSTER cluster) throws Exception {
final RaftPeerId leaderId = RaftTestUtil.waitForLeader(cluster).getId();
final RaftClient client = cluster.createClient(leaderId);
// submit some msgs before reconf
- for (int i = 0; i < getStagingGap() * 2; i++) {
+ for (int i = 0; i < STAGING_CATCHUP_GAP * 2; i++) {
RaftClientReply reply = client.send(new SimpleMessage("m" + i));
Assert.assertTrue(reply.isSuccess());
}
@@ -218,25 +194,20 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
// each reconf will generate two configurations: (old, new) and (new)
// each leader change generates one configuration.
// expectedConf = 1 (init) + 2*2 (two conf changes) + #leader
- final int expechedConf = leader2.equals(leaderId)? 6: 7;
- Assert.assertEquals(expechedConf, confManager.numOfConf());
+ final int expectedConf = leader2.equals(leaderId)? 6: 7;
+ Assert.assertEquals(server.getId() + ": " + confManager, expectedConf, confManager.numOfConf());
});
- } finally {
- cluster.shutdown();
- }
}
@Test
public void testReconfTimeout() throws Exception {
- LOG.info("Start testReconfTimeout");
// originally 3 peers
- final MiniRaftCluster cluster = getCluster(3);
- cluster.start();
- try {
- RaftTestUtil.waitForLeader(cluster);
- final RaftPeerId leaderId = cluster.getLeader().getId();
- final RaftClient client = cluster.createClient(leaderId);
+ runWithNewCluster(3, this::runTestReconfTimeout);
+ }
+ void runTestReconfTimeout(CLUSTER cluster) throws Exception {
+ final RaftPeerId leaderId = RaftTestUtil.waitForLeader(cluster).getId();
+ try (final RaftClient client = cluster.createClient(leaderId)) {
PeerChanges c1 = cluster.addNewPeers(2, false);
LOG.info("Start changing the configuration: {}",
@@ -273,25 +244,22 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
cluster.restartServer(np.getId(), false);
}
Assert.assertTrue(client.setConfiguration(c1.allPeersInNewConf).isSuccess());
- client.close();
- } finally {
- cluster.shutdown();
}
}
@Test
public void testBootstrapReconf() throws Exception {
- LOG.info("Start testBootstrapReconf");
// originally 3 peers
- final MiniRaftCluster cluster = getCluster(3);
- cluster.start();
- try {
+ runWithNewCluster(3, this::runTestBootstrapReconf);
+ }
+
+ void runTestBootstrapReconf(CLUSTER cluster) throws Exception {
RaftTestUtil.waitForLeader(cluster);
final RaftPeerId leaderId = cluster.getLeader().getId();
final RaftClient client = cluster.createClient(leaderId);
// submit some msgs before reconf
- for (int i = 0; i < getStagingGap() * 2; i++) {
+ for (int i = 0; i < STAGING_CATCHUP_GAP * 2; i++) {
RaftClientReply reply = client.send(new SimpleMessage("m" + i));
Assert.assertTrue(reply.isSuccess());
}
@@ -322,9 +290,6 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
cluster.getRaftServerImpl(newPeer.getId()).getState().getLog()
.getEntries(0, Long.MAX_VALUE));
}
- } finally {
- cluster.shutdown();
- }
}
/**
@@ -333,39 +298,42 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
*/
@Test
public void testKillLeaderDuringReconf() throws Exception {
- LOG.info("Start testKillLeaderDuringReconf");
// originally 3 peers
- final MiniRaftCluster cluster = getCluster(3);
- cluster.start();
+ runWithNewCluster(3, this::runTestKillLeaderDuringReconf);
+ }
+
+ void runTestKillLeaderDuringReconf(CLUSTER cluster) throws Exception {
final AtomicBoolean clientRunning = new AtomicBoolean(true);
Thread clientThread = null;
try {
- RaftTestUtil.waitForLeader(cluster);
- final RaftPeerId leaderId = cluster.getLeader().getId();
- final RaftClient client = cluster.createClient(leaderId);
+ final RaftPeerId leaderId = RaftTestUtil.waitForLeader(cluster).getId();
PeerChanges c1 = cluster.addNewPeers(1, false);
PeerChanges c2 = cluster.removePeers(1, false, asList(c1.newPeers));
- LOG.info("Start changing the configuration: {}",
- asList(c2.allPeersInNewConf));
- final AtomicReference<Boolean> success = new AtomicReference<>();
+ LOG.info("Start setConf: {}", asList(c2.allPeersInNewConf));
+ LOG.info(cluster.printServers());
+
+ final CompletableFuture<Void> setConf = new CompletableFuture<>();
clientThread = new Thread(() -> {
- try {
- boolean r = false;
- while (clientRunning.get() && !r) {
- r = client.setConfiguration(c2.allPeersInNewConf).isSuccess();
+ try(final RaftClient client = cluster.createClient(leaderId)) {
+ for(int i = 0; clientRunning.get() && !setConf.isDone(); i++) {
+ final RaftClientReply reply = client.setConfiguration(c2.allPeersInNewConf);
+ if (reply.isSuccess()) {
+ setConf.complete(null);
+ }
+ LOG.info("setConf attempt #{} failed, {}", i, cluster.printServers());
}
- success.set(r);
- client.close();
- } catch (IOException ignored) {
+ } catch(Exception e) {
+ LOG.error("Failed to setConf", e);
+ setConf.completeExceptionally(e);
}
});
clientThread.start();
+ TimeUnit.SECONDS.sleep(1);
// the leader cannot generate the (old, new) conf, and it will keep
// bootstrapping the 2 new peers since they have not started yet
- LOG.info(cluster.printServers());
Assert.assertFalse(cluster.getLeader().getRaftConf().isTransitional());
// only the first empty entry got committed
@@ -374,24 +342,29 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
Assert.assertTrue("committedIndex is " + committedIndex,
committedIndex <= 1);
- LOG.info("kill the current leader");
- final String oldLeaderId = RaftTestUtil.waitAndKillLeader(cluster);
+ final RaftPeerId killed = RaftTestUtil.waitAndKillLeader(cluster);
+ Assert.assertEquals(leaderId, killed);
+ final RaftPeerId newLeaderId = RaftTestUtil.waitForLeader(cluster).getId();
+ LOG.info("newLeaderId: {}", newLeaderId);
+
LOG.info("start new peers: {}", Arrays.asList(c1.newPeers));
for (RaftPeer np : c1.newPeers) {
cluster.restartServer(np.getId(), false);
}
- Thread.sleep(3000);
- // the client should get the NotLeaderException from the first leader, and
- // will retry the same setConfiguration request
- waitAndCheckNewConf(cluster, c2.allPeersInNewConf, 2,
- Collections.singletonList(oldLeaderId));
+ try {
+ setConf.get(10, TimeUnit.SECONDS);
+ } catch(TimeoutException ignored) {
+ }
+
+ // the client fails with the first leader, and then retry the same setConfiguration request
+ waitAndCheckNewConf(cluster, c2.allPeersInNewConf, 2, Collections.singletonList(leaderId));
+ setConf.get(1, TimeUnit.SECONDS);
} finally {
if (clientThread != null) {
clientRunning.set(false);
clientThread.interrupt();
}
- cluster.shutdown();
}
}
@@ -407,15 +380,13 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
*/
@Test
public void testNoChangeRequest() throws Exception {
- LOG.info("Start testNoChangeRequest");
// originally 3 peers
- final MiniRaftCluster cluster = getCluster(3);
- try {
- cluster.start();
- RaftTestUtil.waitForLeader(cluster);
+ runWithNewCluster(3, this::runTestNoChangeRequest);
+ }
- final RaftServerImpl leader = cluster.getLeader();
- final RaftClient client = cluster.createClient(leader.getId());
+ void runTestNoChangeRequest(CLUSTER cluster) throws Exception {
+ final RaftServerImpl leader = RaftTestUtil.waitForLeader(cluster);
+ try(final RaftClient client = cluster.createClient(leader.getId())) {
client.send(new SimpleMessage("m"));
final RaftLog leaderLog = leader.getState().getLog();
@@ -429,8 +400,6 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
.getLog().getLastCommittedIndex());
Assert.assertSame(confBefore, cluster.getLeader().getRaftConf());
client.close();
- } finally {
- cluster.shutdown();
}
}
@@ -440,11 +409,12 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
*/
@Test
public void testOverlappedSetConfRequests() throws Exception {
- LOG.info("Start testOverlappedSetConfRequests");
// originally 3 peers
- final MiniRaftCluster cluster = getCluster(3);
+ runWithNewCluster(3, this::runTestOverlappedSetConfRequests);
+ }
+
+ void runTestOverlappedSetConfRequests(CLUSTER cluster) throws Exception {
try {
- cluster.start();
RaftTestUtil.waitForLeader(cluster);
final RaftPeerId leaderId = cluster.getLeader().getId();
@@ -491,7 +461,6 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
Assert.assertTrue(caughtException.get());
} finally {
logSyncDelay.clear();
- cluster.shutdown();
}
}
@@ -501,11 +470,12 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
*/
@Test
public void testRevertConfigurationChange() throws Exception {
- LOG.info("Start testRevertConfigurationChange");
+ runWithNewCluster(5, this::runTestRevertConfigurationChange);
+ }
+
+ void runTestRevertConfigurationChange(CLUSTER cluster) throws Exception {
RaftLog log2 = null;
- final MiniRaftCluster cluster = getCluster(5);
try {
- cluster.start();
RaftTestUtil.waitForLeader(cluster);
final RaftServerImpl leader = cluster.getLeader();
@@ -572,7 +542,6 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
log2 = null;
} finally {
RaftStorageTestUtils.printLog(log2, s -> LOG.info(s));
- cluster.shutdown();
}
}
@@ -583,7 +552,7 @@ public abstract class RaftReconfigurationBaseTest extends BaseTest {
@Test
public void testLeaderNotReadyException() throws Exception {
LOG.info("Start testLeaderNotReadyException");
- final MiniRaftCluster cluster = getCluster(1).initServers();
+ final MiniRaftCluster cluster = newCluster(1).initServers();
try {
// delay 1s for each logSync call
cluster.getServers().forEach(
http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/68bb4c91/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftServerTestUtil.java
----------------------------------------------------------------------
diff --git a/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftServerTestUtil.java b/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftServerTestUtil.java
index b18f794..ea9b9a2 100644
--- a/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftServerTestUtil.java
+++ b/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftServerTestUtil.java
@@ -22,6 +22,7 @@ import org.apache.ratis.MiniRaftCluster;
import org.apache.ratis.protocol.ClientId;
import org.apache.ratis.protocol.RaftGroupId;
import org.apache.ratis.protocol.RaftPeer;
+import org.apache.ratis.protocol.RaftPeerId;
import org.apache.ratis.util.JavaUtils;
import org.apache.ratis.util.LogUtils;
import org.apache.ratis.util.TimeDuration;
@@ -42,14 +43,14 @@ public class RaftServerTestUtil {
}
public static void waitAndCheckNewConf(MiniRaftCluster cluster,
- RaftPeer[] peers, int numOfRemovedPeers, Collection<String> deadPeers)
+ RaftPeer[] peers, int numOfRemovedPeers, Collection<RaftPeerId> deadPeers)
throws Exception {
final TimeDuration sleepTime = cluster.getTimeoutMax().apply(n -> n * (numOfRemovedPeers + 2));
JavaUtils.attempt(() -> waitAndCheckNewConf(cluster, peers, deadPeers),
10, sleepTime, "waitAndCheckNewConf", LOG);
}
private static void waitAndCheckNewConf(MiniRaftCluster cluster,
- RaftPeer[] peers, Collection<String> deadPeers) {
+ RaftPeer[] peers, Collection<RaftPeerId> deadPeers) {
LOG.info("waitAndCheckNewConf: peers={}, deadPeers={}, {}", Arrays.asList(peers), deadPeers, cluster.printServers());
Assert.assertNotNull(cluster.getLeader());
@@ -59,7 +60,7 @@ public class RaftServerTestUtil {
.setConf(peers).setLogEntryIndex(0).build();
for (RaftServerImpl server : cluster.iterateServerImpls()) {
LOG.info("checking {}", server);
- if (deadPeers != null && deadPeers.contains(server.getId().toString())) {
+ if (deadPeers != null && deadPeers.contains(server.getId())) {
if (current.containsInConf(server.getId())) {
deadIncluded++;
}
http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/68bb4c91/ratis-test/src/test/java/org/apache/ratis/grpc/TestRaftReconfigurationWithGrpc.java
----------------------------------------------------------------------
diff --git a/ratis-test/src/test/java/org/apache/ratis/grpc/TestRaftReconfigurationWithGrpc.java b/ratis-test/src/test/java/org/apache/ratis/grpc/TestRaftReconfigurationWithGrpc.java
index 29f8bea..105eb11 100644
--- a/ratis-test/src/test/java/org/apache/ratis/grpc/TestRaftReconfigurationWithGrpc.java
+++ b/ratis-test/src/test/java/org/apache/ratis/grpc/TestRaftReconfigurationWithGrpc.java
@@ -22,15 +22,10 @@ import org.apache.ratis.grpc.server.GrpcServerProtocolService;
import org.apache.ratis.server.impl.RaftReconfigurationBaseTest;
import org.apache.ratis.util.LogUtils;
-import java.io.IOException;
-
-public class TestRaftReconfigurationWithGrpc extends RaftReconfigurationBaseTest {
+public class TestRaftReconfigurationWithGrpc
+ extends RaftReconfigurationBaseTest<MiniRaftClusterWithGrpc>
+ implements MiniRaftClusterWithGrpc.FactoryGet {
static {
LogUtils.setLogLevel(GrpcServerProtocolService.LOG, Level.DEBUG);
}
-
- @Override
- public MiniRaftClusterWithGrpc getCluster(int peerNum) {
- return MiniRaftClusterWithGrpc.FACTORY.newCluster(peerNum, prop);
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/68bb4c91/ratis-test/src/test/java/org/apache/ratis/netty/TestRaftReconfigurationWithNetty.java
----------------------------------------------------------------------
diff --git a/ratis-test/src/test/java/org/apache/ratis/netty/TestRaftReconfigurationWithNetty.java b/ratis-test/src/test/java/org/apache/ratis/netty/TestRaftReconfigurationWithNetty.java
index 15fa8e6..2997bb9 100644
--- a/ratis-test/src/test/java/org/apache/ratis/netty/TestRaftReconfigurationWithNetty.java
+++ b/ratis-test/src/test/java/org/apache/ratis/netty/TestRaftReconfigurationWithNetty.java
@@ -17,15 +17,9 @@
*/
package org.apache.ratis.netty;
-import java.io.IOException;
-
-import org.apache.ratis.MiniRaftCluster;
import org.apache.ratis.server.impl.RaftReconfigurationBaseTest;
public class TestRaftReconfigurationWithNetty
- extends RaftReconfigurationBaseTest {
- @Override
- public MiniRaftCluster getCluster(int peerNum) throws IOException {
- return MiniRaftClusterWithNetty.FACTORY.newCluster(peerNum, prop);
- }
+ extends RaftReconfigurationBaseTest<MiniRaftClusterWithNetty>
+ implements MiniRaftClusterWithNetty.FactoryGet {
}
http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/68bb4c91/ratis-test/src/test/java/org/apache/ratis/server/simulation/TestRaftReconfigurationWithSimulatedRpc.java
----------------------------------------------------------------------
diff --git a/ratis-test/src/test/java/org/apache/ratis/server/simulation/TestRaftReconfigurationWithSimulatedRpc.java b/ratis-test/src/test/java/org/apache/ratis/server/simulation/TestRaftReconfigurationWithSimulatedRpc.java
index b1bb26a..d31dcc5 100644
--- a/ratis-test/src/test/java/org/apache/ratis/server/simulation/TestRaftReconfigurationWithSimulatedRpc.java
+++ b/ratis-test/src/test/java/org/apache/ratis/server/simulation/TestRaftReconfigurationWithSimulatedRpc.java
@@ -17,15 +17,9 @@
*/
package org.apache.ratis.server.simulation;
-import java.io.IOException;
-
-import org.apache.ratis.MiniRaftCluster;
import org.apache.ratis.server.impl.RaftReconfigurationBaseTest;
public class TestRaftReconfigurationWithSimulatedRpc
- extends RaftReconfigurationBaseTest {
- @Override
- public MiniRaftCluster getCluster(int peerNum) throws IOException {
- return MiniRaftClusterWithSimulatedRpc.FACTORY.newCluster(peerNum, prop);
- }
+ extends RaftReconfigurationBaseTest<MiniRaftClusterWithSimulatedRpc>
+ implements MiniRaftClusterWithSimulatedRpc.FactoryGet {
}