void recoverSegments ( SyncTask task ) throws IOException { // obtain the list of segments that are valid if ( ! prepareRecovery ( task ) ) { return ; } // iterate through all nodes for ( InetSocketAddress jn : journalNodes ) { if ( isLocalIpAddress ( jn . getAddress ( ) ) && jn . getPort ( ) == journalNode . getPort ( ) ) { // we do not need to talk to ourselves continue ; } try { // get manifest for log that we care about List < EditLogFile > remoteLogFiles = getManifest ( jn , task . journal , task . recoveryStartTxid ) ; // go through all remote segments for ( EditLogFile relf : remoteLogFiles ) { recoverSegment ( jn , relf , task ) ; } // if we are done, there is no need to iterate more if ( ! task . hasMissingValidSegments ( ) ) { LOG . info ( logMsg + "recovery finished." ) ; break ; } } catch ( Exception e ) { LOG . error ( logMsg + "error" , e ) ; continue ; } } }
Recovers a single segment