static long readTransactionIdFile ( StorageDirectory sd ) throws IOException { File txidFile = getStorageFile ( sd , NameNodeFile . SEEN_TXID ) ; long txid = 0L ; if ( txidFile . exists ( ) && txidFile . canRead ( ) ) { BufferedReader br = new BufferedReader ( new FileReader ( txidFile ) ) ; try { txid = Long . valueOf ( br . readLine ( ) ) ; br . close ( ) ; br = null ; } finally { IOUtils . cleanup ( LOG , br ) ; } } return txid ; }
Determine the last transaction ID noted in this storage directory . This txid is stored in a special seen_txid file since it might not correspond to the latest image or edit log . For example an image - only directory will have this txid incremented when edits logs roll even though the edits logs are in a different directory .