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()
      • appendRequest

        public Request appendRequest​(TxnHeader hdr,
                                     Record txn,
                                     TxnDigest digest)
                              throws IOException
        Build a request for the txn and append it to the transaction log
        Parameters:
        hdr - the txn header
        txn - the txn
        digest - the digest of txn
        Returns:
        a request moving through a chain of RequestProcessors
        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