Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-3481

The problem of AcceptedEpoch

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.5.5
    • None
    • quorum
    • None

    Description

      If the leader has been elected when the voting participant joins the cluster, then it can only act as followers. When Leader.getEpochToPropose is called, it does not participate in the voting. However, if the AcceptedEpoch is larger than the leader, it will never work properly.The status is as follows:LOOKING -> FOLLOWING -> exception -> LOOKING.

      code as follows(Learner.registerWithLeader(int pktType)):

      if (newEpoch > self.getAcceptedEpoch()){
         wrappedEpochBytes.putInt((int)self.getCurrentEpoch());
         self.setAcceptedEpoch(newEpoch); 
      }else if (newEpoch == self.getAcceptedEpoch()){
         // since we have already acked an epoch equal to the leaders, we cannot ack 
         // again, but we still need to send our lastZxid to the leader so that we can 
         // sync with it if it does assume leadership of the epoch. 
         // the -1 indicates that this reply should not count as an ack for the new epoch 
         wrappedEpochBytes.putInt(-1); 
      }else{ 
         throw new IOException("Leaders epoch, " + newEpoch + " is less than accepted epoch, " + self.getAcceptedEpoch()); 
      }
      

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            18779116352 tom.long
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: