You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by afine <gi...@git.apache.org> on 2017/12/13 01:11:47 UTC
[GitHub] zookeeper pull request #433: ZOOKEEPER-2953: Flaky Test: testNoLogBeforeLead...
GitHub user afine opened a pull request:
https://github.com/apache/zookeeper/pull/433
ZOOKEEPER-2953: Flaky Test: testNoLogBeforeLeaderEstablishment
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/afine/zookeeper ZOOKEEPER-2953_3.5
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zookeeper/pull/433.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #433
----
commit 36abecd0d4389b24e22852cccac50259b2abdb1a
Author: Abraham Fine <af...@apache.org>
Date: 2017-12-13T00:51:52Z
ZOOKEEPER-2953: Flaky Test: testNoLogBeforeLeaderEstablishment
----
---
[GitHub] zookeeper pull request #433: [WIP] ZOOKEEPER-2953: Flaky Test: testNoLogBefo...
Posted by afine <gi...@git.apache.org>.
GitHub user afine reopened a pull request:
https://github.com/apache/zookeeper/pull/433
[WIP] ZOOKEEPER-2953: Flaky Test: testNoLogBeforeLeaderEstablishment
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/afine/zookeeper ZOOKEEPER-2953_3.5
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zookeeper/pull/433.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #433
----
commit 36abecd0d4389b24e22852cccac50259b2abdb1a
Author: Abraham Fine <af...@apache.org>
Date: 2017-12-13T00:51:52Z
ZOOKEEPER-2953: Flaky Test: testNoLogBeforeLeaderEstablishment
commit 5e4da2dcf3067008a33ace787c3d78c0bdbee823
Author: Abraham Fine <af...@apache.org>
Date: 2017-12-13T08:20:56Z
fix whitespace
----
---
[GitHub] zookeeper pull request #433: ZOOKEEPER-2953: Flaky Test: testNoLogBeforeLead...
Posted by anmolnar <gi...@git.apache.org>.
Github user anmolnar commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/433#discussion_r157001258
--- Diff: src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java ---
@@ -335,6 +336,100 @@ public void testHighestZxidJoinLate() throws Exception {
output[0], 2);
}
+ /**
+ * This test validates that if a quorum member determines that it is leader without the support of the rest of the
+ * quorum (the other members do not believe it to be the leader) it will stop attempting to lead and become a follower.
+ *
+ * @throws IOException
+ * @throws InterruptedException
+ */
+ @Test
+ public void testElectionFraud() throws IOException, InterruptedException {
+ // capture QuorumPeer logging
+ Layout layout = Logger.getRootLogger().getAppender("CONSOLE").getLayout();
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ WriterAppender appender = new WriterAppender(layout, os);
+ appender.setThreshold(Level.INFO);
+ Logger qlogger = Logger.getLogger(QuorumPeer.class);
+ qlogger.addAppender(appender);
+
+ int numServers = 3;
--- End diff --
Please use the global field.
---
[GitHub] zookeeper pull request #433: [WIP] ZOOKEEPER-2953: Flaky Test: testNoLogBefo...
Posted by afine <gi...@git.apache.org>.
Github user afine closed the pull request at:
https://github.com/apache/zookeeper/pull/433
---
[GitHub] zookeeper pull request #433: ZOOKEEPER-2953: Flaky Test: testNoLogBeforeLead...
Posted by anmolnar <gi...@git.apache.org>.
Github user anmolnar commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/433#discussion_r157001279
--- Diff: src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java ---
@@ -335,6 +336,100 @@ public void testHighestZxidJoinLate() throws Exception {
output[0], 2);
}
+ /**
+ * This test validates that if a quorum member determines that it is leader without the support of the rest of the
+ * quorum (the other members do not believe it to be the leader) it will stop attempting to lead and become a follower.
+ *
+ * @throws IOException
+ * @throws InterruptedException
+ */
+ @Test
+ public void testElectionFraud() throws IOException, InterruptedException {
+ // capture QuorumPeer logging
+ Layout layout = Logger.getRootLogger().getAppender("CONSOLE").getLayout();
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ WriterAppender appender = new WriterAppender(layout, os);
+ appender.setThreshold(Level.INFO);
+ Logger qlogger = Logger.getLogger(QuorumPeer.class);
+ qlogger.addAppender(appender);
+
+ int numServers = 3;
+
+ // used for assertions later
+ boolean foundLeading = false;
+ boolean foundLooking = false;
+ boolean foundFollowing = false;
+
+ try {
+ // spin up a quorum, we use a small ticktime to make the test run faster
+ Servers servers = LaunchServers(numServers, 500);
--- End diff --
Here too.
---
[GitHub] zookeeper issue #433: ZOOKEEPER-2953: Flaky Test: testNoLogBeforeLeaderEstab...
Posted by phunt <gi...@git.apache.org>.
Github user phunt commented on the issue:
https://github.com/apache/zookeeper/pull/433
lgtm. +1 thanks @afine
please close this as it's not the default branch won't be closed automatically.
---
[GitHub] zookeeper pull request #433: ZOOKEEPER-2953: Flaky Test: testNoLogBeforeLead...
Posted by afine <gi...@git.apache.org>.
Github user afine commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/433#discussion_r157004909
--- Diff: src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java ---
@@ -335,6 +336,100 @@ public void testHighestZxidJoinLate() throws Exception {
output[0], 2);
}
+ /**
+ * This test validates that if a quorum member determines that it is leader without the support of the rest of the
+ * quorum (the other members do not believe it to be the leader) it will stop attempting to lead and become a follower.
+ *
+ * @throws IOException
+ * @throws InterruptedException
+ */
+ @Test
+ public void testElectionFraud() throws IOException, InterruptedException {
+ // capture QuorumPeer logging
+ Layout layout = Logger.getRootLogger().getAppender("CONSOLE").getLayout();
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ WriterAppender appender = new WriterAppender(layout, os);
+ appender.setThreshold(Level.INFO);
+ Logger qlogger = Logger.getLogger(QuorumPeer.class);
+ qlogger.addAppender(appender);
+
+ int numServers = 3;
+
+ // used for assertions later
+ boolean foundLeading = false;
+ boolean foundLooking = false;
+ boolean foundFollowing = false;
+
+ try {
+ // spin up a quorum, we use a small ticktime to make the test run faster
+ Servers servers = LaunchServers(numServers, 500);
--- End diff --
fixed
---
[GitHub] zookeeper pull request #433: ZOOKEEPER-2953: Flaky Test: testNoLogBeforeLead...
Posted by afine <gi...@git.apache.org>.
Github user afine commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/433#discussion_r157004899
--- Diff: src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java ---
@@ -335,6 +336,100 @@ public void testHighestZxidJoinLate() throws Exception {
output[0], 2);
}
+ /**
+ * This test validates that if a quorum member determines that it is leader without the support of the rest of the
+ * quorum (the other members do not believe it to be the leader) it will stop attempting to lead and become a follower.
+ *
+ * @throws IOException
+ * @throws InterruptedException
+ */
+ @Test
+ public void testElectionFraud() throws IOException, InterruptedException {
+ // capture QuorumPeer logging
+ Layout layout = Logger.getRootLogger().getAppender("CONSOLE").getLayout();
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ WriterAppender appender = new WriterAppender(layout, os);
+ appender.setThreshold(Level.INFO);
+ Logger qlogger = Logger.getLogger(QuorumPeer.class);
+ qlogger.addAppender(appender);
+
+ int numServers = 3;
--- End diff --
fixed
---
[GitHub] zookeeper pull request #433: ZOOKEEPER-2953: Flaky Test: testNoLogBeforeLead...
Posted by afine <gi...@git.apache.org>.
Github user afine closed the pull request at:
https://github.com/apache/zookeeper/pull/433
---