[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14067738#comment-14067738
 ] 

Hadoop QA commented on ZOOKEEPER-1972:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  
http://issues.apache.org/jira/secure/attachment/12656764/ZOOKEEPER-1972.patch.3
  against trunk revision 1611846.

    +1 @author.  The patch does not contain any @author tags.

    -1 tests included.  The patch doesn't appear to include any new or modified 
tests.
                        Please justify why no new tests are needed for this 
patch.
                        Also please list what manual steps were performed to 
verify this patch.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac 
compiler warnings.

    -1 findbugs.  The patch appears to introduce 83 new Findbugs (version 
2.0.3) warnings.

    +1 release audit.  The applied patch does not increase the total number of 
release audit warnings.

    -1 core tests.  The patch failed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/2206//testReport/
Findbugs warnings: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/2206//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/2206//console

This message is automatically generated.

> Fix invalid volatile long/int increment (++)
> --------------------------------------------
>
>                 Key: ZOOKEEPER-1972
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1972
>             Project: ZooKeeper
>          Issue Type: Sub-task
>    Affects Versions: 3.5.0
>            Reporter: Hongchao Deng
>            Assignee: Hongchao Deng
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1972.patch, ZOOKEEPER-1972.patch.2, 
> ZOOKEEPER-1972.patch.3
>
>
> The findbugs complains about incrementing a volatile variable in 
> [AuthFastLeaderElection|https://github.com/apache/zookeeper/blob/087abf83684167ae56864fe4c3be0079fa653266/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java#L737]
>  and 
> [FastLeaderElection|https://github.com/apache/zookeeper/blob/087abf83684167ae56864fe4c3be0079fa653266/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java]:
> {code}
> volatile long logicalclock; /* Election instance */
> ...
> logicalclock++;
> {code}
> Actually this is a bug. It should use AtomicLong here instead of volatile.
> Leader.java and 
> [QuorumPeer.java|https://github.com/apache/zookeeper/blob/087abf83684167ae56864fe4c3be0079fa653266/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java#L428]
>  and LearnerHandler.java:
> {code}
> volatile int tick;
> {code}
> I don't think it needs volatile here. The tick is incremented only in 
> [Leader.java|https://github.com/apache/zookeeper/blob/087abf83684167ae56864fe4c3be0079fa653266/src/java/main/org/apache/zookeeper/server/quorum/Leader.java#L590]:
> {code}
>   synchronized (this) {
>           ...
>                     if (!tickSkip) {
>                         self.tick++;
>                     }
>   }
> {code}
> and it's protected by the synchronized statement. I just remove volatile 
> keyword.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to