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 Details

    • getFollower

      public Follower getFollower()
    • setupRequestProcessors

      protected void setupRequestProcessors()
      Overrides:
      setupRequestProcessors in class ZooKeeperServer
    • logRequest

      public void logRequest(TxnHeader hdr, Record txn, TxnDigest digest)
    • 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()
    • getGlobalOutstandingLimit

      public int getGlobalOutstandingLimit()
      Overrides:
      getGlobalOutstandingLimit in class ZooKeeperServer
    • getState

      public String getState()
      Specified by:
      getState in interface ServerStats.Provider
      Overrides:
      getState in class ZooKeeperServer
    • 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
    • registerMetrics

      protected void registerMetrics()
      Overrides:
      registerMetrics in class QuorumZooKeeperServer
    • unregisterMetrics

      protected void unregisterMetrics()
      Overrides:
      unregisterMetrics in class QuorumZooKeeperServer