Class SyncRequestProcessor

  • All Implemented Interfaces:
    Runnable, RequestProcessor

    public class SyncRequestProcessor
    extends ZooKeeperCriticalThread
    implements RequestProcessor
    This RequestProcessor logs requests to disk. It batches the requests to do the io efficiently. The request is not passed to the next RequestProcessor until its log has been synced to disk. SyncRequestProcessor is used in 3 different cases 1. Leader - Sync request to disk and forward it to AckRequestProcessor which send ack back to itself. 2. Follower - Sync request to disk and forward request to SendAckRequestProcessor which send the packets to leader. SendAckRequestProcessor is flushable which allow us to force push packets to leader. 3. Observer - Sync committed request to disk (received as INFORM packet). It never send ack back to the leader, so the nextProcessor will be null. This change the semantic of txnlog on the observer since it only contains committed txns.
    • Method Detail

      • setSnapCount

        public static void setSnapCount​(int count)
        used by tests to check for changing snapcounts
        Parameters:
        count -
      • getSnapCount

        public static int getSnapCount()
        used by tests to get the snapcount
        Returns:
        the snapcount
      • setSnapSizeInBytes

        public static void setSnapSizeInBytes​(long size)
        used by tests to check for changing snapcounts
        Parameters:
        size -
      • run

        public void run()
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread