public Map < Long , Long > reconfigureOnFault ( Set < Long > hsIds , FaultMessage fm , Set < Long > unknownFaultedSites ) { boolean proceed = false ; do { Discard ignoreIt = mayIgnore ( hsIds , fm ) ; if ( Discard . DoNot == ignoreIt ) { m_inTrouble . put ( fm . failedSite , fm . witnessed || fm . decided ) ; m_recoveryLog . info ( "Agreement, Processing " + fm ) ; proceed = true ; } else { ignoreIt . log ( fm ) ; } if ( Discard . Unknown == ignoreIt ) { unknownFaultedSites . add ( fm . failedSite ) ; } fm = ( FaultMessage ) m_mailbox . recv ( justFailures ) ; } while ( fm != null ) ; if ( ! proceed ) { return ImmutableMap . of ( ) ; } m_inTroubleCount = m_inTrouble . size ( ) ; // we are here if failed site was not previously recorded // or it was previously recorded but it became witnessed from unwitnessed m_seeker . startSeekingFor ( Sets . difference ( hsIds , m_failedSites ) , m_inTrouble ) ; if ( m_recoveryLog . isDebugEnabled ( ) ) { m_recoveryLog . debug ( String . format ( "\n %s\n %s\n %s\n %s\n %s" , m_seeker . dumpAlive ( ) , m_seeker . dumpDead ( ) , m_seeker . dumpReported ( ) , m_seeker . dumpSurvivors ( ) , dumpInTrouble ( ) ) ) ; } discoverGlobalFaultData_send ( hsIds ) ; while ( discoverGlobalFaultData_rcv ( hsIds ) ) { Map < Long , Long > lastTxnIdByFailedSite = extractGlobalFaultData ( hsIds ) ; if ( lastTxnIdByFailedSite . isEmpty ( ) ) { return ImmutableMap . of ( ) ; } Set < Long > witnessed = Maps . filterValues ( m_inTrouble , equalTo ( Boolean . TRUE ) ) . keySet ( ) ; Set < Long > notClosed = Sets . difference ( witnessed , lastTxnIdByFailedSite . keySet ( ) ) ; if ( ! notClosed . isEmpty ( ) ) { m_recoveryLog . warn ( "Agreement, witnessed but not decided: [" + CoreUtils . hsIdCollectionToString ( notClosed ) + "] seeker: " + m_seeker ) ; } if ( ! notifyOnKill ( hsIds , lastTxnIdByFailedSite ) ) { continue ; } m_failedSites . addAll ( lastTxnIdByFailedSite . keySet ( ) ) ; m_failedSitesCount = m_failedSites . size ( ) ; m_recoveryLog . info ( "Agreement, Adding " + CoreUtils . hsIdCollectionToString ( lastTxnIdByFailedSite . keySet ( ) ) + " to failed sites history" ) ; clearInTrouble ( lastTxnIdByFailedSite . keySet ( ) ) ; m_seeker . clear ( ) ; return lastTxnIdByFailedSite ; } return ImmutableMap . of ( ) ; }
Process the fault message and if necessary start arbitration .