private PersistedRecoveryPaxosData getPersistedPaxosData ( long segmentTxId ) throws IOException { File f = journalStorage . getPaxosFile ( segmentTxId ) ; if ( ! f . exists ( ) ) { // Default instance has no fields filled in (they're optional) return null ; } InputStream in = new FileInputStream ( f ) ; try { PersistedRecoveryPaxosData ret = PersistedRecoveryPaxosData . parseDelimitedFrom ( in ) ; Preconditions . checkState ( ret != null && ret . getSegmentState ( ) . getStartTxId ( ) == segmentTxId , "Bad persisted data for segment %s: %s" , segmentTxId , ret ) ; return ret ; } finally { IOUtils . closeStream ( in ) ; } }
Retrieve the persisted data for recovering the given segment from disk .