private void completeHalfDoneAcceptRecovery ( PersistedRecoveryPaxosData paxosData ) throws IOException { if ( paxosData == null ) { return ; } long segmentId = paxosData . getSegmentState ( ) . getStartTxId ( ) ; long epoch = paxosData . getAcceptedInEpoch ( ) ; File tmp = journalStorage . getSyncLogTemporaryFile ( segmentId , epoch ) ; if ( tmp . exists ( ) ) { File dst = journalStorage . getInProgressEditLog ( segmentId ) ; LOG . info ( "Rolling forward previously half-completed synchronization: " + tmp + " -> " + dst ) ; FileUtil . replaceFile ( tmp , dst ) ; } }
In the case the node crashes in between downloading a log segment and persisting the associated paxos recovery data the log segment will be left in its temporary location on disk . Given the paxos data we can check if this was indeed the case and &quot ; roll forward&quot ; the atomic operation .