Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5.0
    • Fix Version/s: 3.5.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed
    • Release Note:
      Awesome! thanks Hongchao! Committed to trunk

      Description

      The findbugs complains about incrementing a volatile variable in AuthFastLeaderElection and FastLeaderElection:

      volatile long logicalclock; /* Election instance */
      ...
      logicalclock++;
      

      Actually this is a bug. It should use AtomicLong here instead of volatile.

      Leader.java and QuorumPeer.java and LearnerHandler.java:

      volatile int tick;
      

      I don't think it needs volatile here. The tick is incremented only in Leader.java:

        synchronized (this) {
                ...
                          if (!tickSkip) {
                              self.tick++;
                          }
        }
      

      and it's protected by the synchronized statement. I just remove volatile keyword.

        Attachments

        1. ZOOKEEPER-1972.patch
          13 kB
          Hongchao Deng
        2. ZOOKEEPER-1972.patch.2
          16 kB
          Hongchao Deng
        3. ZOOKEEPER-1972.patch.3
          16 kB
          Hongchao Deng
        4. ZOOKEEPER-1972.patch.4
          15 kB
          Patrick Hunt

          Activity

            People

            • Assignee:
              hdeng Hongchao Deng
              Reporter:
              hdeng Hongchao Deng
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: