Class FollowerZooKeeperServer

  • All Implemented Interfaces:
    ServerStats.Provider, SessionTracker.SessionExpirer

    public class FollowerZooKeeperServer
    extends LearnerZooKeeperServer
    Just like the standard ZooKeeperServer. We just replace the request processors: FollowerRequestProcessor -> CommitProcessor -> FinalRequestProcessor A SyncRequestProcessor is also spawned off to log proposals from the leader.
    • Method Detail

      • getFollower

        public Follower getFollower()
      • logRequest

        public void logRequest​(Request request)
      • appendRequest

        public void appendRequest​(Request request)
                           throws IOException
        Append txn request to the transaction log directly without go through request processors.
        Throws:
        IOException
      • commit

        public void commit​(long zxid)
        When a COMMIT message is received, eventually this method is called, which matches up the zxid from the COMMIT with (hopefully) the head of the pendingTxns queue and hands it to the commitProcessor to commit.
        Parameters:
        zxid - - must correspond to the head of pendingTxns if it exists
      • sync

        public void sync()
      • getLearner

        public Learner getLearner()
        Description copied from class: LearnerZooKeeperServer
        Abstract method to return the learner associated with this server. Since the Learner may change under our feet (when QuorumPeer reassigns it) we can't simply take a reference here. Instead, we need the subclasses to implement this.
        Specified by:
        getLearner in class LearnerZooKeeperServer