[ https://issues.apache.org/jira/browse/ZOOKEEPER-2080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15495429#comment-15495429 ]
Alexander Shraer commented on ZOOKEEPER-2080: --------------------------------------------- There is a lot of accesses to the config info from this function, and the synchronization may be needed to make sure all of them return a state which is consistent. getView returns the last committed config and getLastSeenQuorumVerifier returns the last proposed config. If we wouldn't be in a synchronized block, and the committed view changed (reconfig commits while we're in this function), it seems possible that sid moves from last proposed to last committed config and we will never try to connect to it. First, getLastSeenQuorumVerifier and getView shouldn't be accessed more than once (currently 4 and 3 times each). We can just store the result and use that. To remove the synchronized block completely you could create a synchronized function in QuorumPeer that returns a pair: last committed and last proposed view, and call that function once from connectOne. > ReconfigRecoveryTest fails intermittently > ----------------------------------------- > > Key: ZOOKEEPER-2080 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2080 > Project: ZooKeeper > Issue Type: Sub-task > Reporter: Ted Yu > Assignee: Michael Han > Fix For: 3.5.3, 3.6.0 > > Attachments: ZOOKEEPER-2080.patch, ZOOKEEPER-2080.patch, > ZOOKEEPER-2080.patch, ZOOKEEPER-2080.patch, ZOOKEEPER-2080.patch, > jacoco-ZOOKEEPER-2080.unzip-grows-to-70MB.7z, repro-20150816.log, > threaddump.log > > > I got the following test failure on MacBook with trunk code: > {code} > Testcase: testCurrentObserverIsParticipantInNewConfig took 93.628 sec > FAILED > waiting for server 2 being up > junit.framework.AssertionFailedError: waiting for server 2 being up > at > org.apache.zookeeper.server.quorum.ReconfigRecoveryTest.testCurrentObserverIsParticipantInNewConfig(ReconfigRecoveryTest.java:529) > at > org.apache.zookeeper.JUnit4ZKTestRunner$LoggedInvokeMethod.evaluate(JUnit4ZKTestRunner.java:52) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)