private synchronized void checkRequest ( RequestInfo reqInfo ) throws IOException { // Invariant 25 from ZAB paper if ( reqInfo . getEpoch ( ) < lastPromisedEpoch . get ( ) ) { throw new IOException ( "IPC's epoch " + reqInfo . getEpoch ( ) + " is less than the last promised epoch " + lastPromisedEpoch . get ( ) ) ; } else if ( reqInfo . getEpoch ( ) > lastPromisedEpoch . get ( ) ) { // A newer client has arrived. Fence any previous writers by updating // the promise. updateLastPromisedEpoch ( reqInfo . getEpoch ( ) ) ; } // Ensure that the IPCs are arriving in-order as expected. if ( reqInfo . getIpcSerialNumber ( ) <= currentEpochIpcSerial ) { checkSync ( false , "IPC serial %s from client %s was not higher than prior highest " + "IPC serial %s" , reqInfo . getIpcSerialNumber ( ) , Server . getRemoteIp ( ) , currentEpochIpcSerial ) ; } currentEpochIpcSerial = reqInfo . getIpcSerialNumber ( ) ; if ( reqInfo . hasCommittedTxId ( ) ) { if ( reqInfo . getCommittedTxId ( ) < committedTxnId . get ( ) ) { throw new IllegalArgumentException ( "Client trying to move committed txid backward from " + committedTxnId . get ( ) + " to " + reqInfo . getCommittedTxId ( ) ) ; } // persist txid every second, as it is not needed for correctness boolean persist = ( now ( ) - lastPersistedCommittedTxId ) > 1000 ; if ( persist ) { lastPersistedCommittedTxId = now ( ) ; } committedTxnId . set ( reqInfo . getCommittedTxId ( ) , persist ) ; } }
Ensure that the given request is coming from the correct writer and in - order .