QuorumTest.testNoLogBeforeLeaderEstablishment has several problems
------------------------------------------------------------------
Key: ZOOKEEPER-1360
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1360
Project: ZooKeeper
Issue Type: Bug
Affects Versions: 3.4.2
Reporter: Henry Robinson
Assignee: Henry Robinson
Fix For: 3.5.0
After the apparently valid fix to ZOOKEEPER-1294,
testNoLogBeforeLeaderEstablishment is failing for me about one time in four.
While I'll investigate whether the patch is 1294 is ultimately to blame,
reading the test brought to light a number of issues that appear to be bugs or
in need of improvement:
* As part of QuorumTest, an ensemble is already established by the fixture
setup code, but apparently unused by the test which uses QuorumUtil.
* The test reads QuorumPeer.leader and QuorumPeer.follower without
synchronization, which means that writes to those fields may not be published
when we come to read them.
* The return value of sem.tryAcquire is never checked.
* The progress of the test is based on ad-hoc timings (25 * 500ms sleeps) and
inscrutable numbers of iterations through the main loop (e.g. the semaphore
blocking the final asserts is released only after the 20000th of 50000
callbacks)
* The test as a whole takes ~30s to run
The first three are easy to fix (as part of fixing the second, I intend to hide
all members of QuorumPeer behind getters and setters), the fourth and fifth
need a slightly deeper understanding of what the test is trying to achieve.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira