protected void triggerFailover ( ) throws IOException { clearDataStructures ( ) ; // stop sending PREPARE_FAILOVER command // we are performing failover now prepareFailover = false ; for ( DatanodeInfo node : namesystem . datanodeReport ( DatanodeReportType . LIVE ) ) { liveDatanodes . add ( node ) ; outStandingHeartbeats . add ( node ) ; } InjectionHandler . processEvent ( InjectionEvent . STANDBY_ENTER_SAFE_MODE ) ; safeModeState = SafeModeState . FAILOVER_IN_PROGRESS ; InjectionHandler . processEvent ( InjectionEvent . STANDBY_FAILOVER_INPROGRESS ) ; safeModeMonitor = new Daemon ( new SafeModeMonitor ( namesystem , this ) ) ; safeModeMonitor . start ( ) ; try { safeModeMonitor . join ( ) ; } catch ( InterruptedException ie ) { throw new IOException ( "triggerSafeMode() interruped()" ) ; } if ( safeModeState != SafeModeState . AFTER_FAILOVER ) { throw new IOException ( "safeModeState is : " + safeModeState + " which does not indicate a successfull exit of safemode" ) ; } }
Triggers failover processing for safe mode and blocks until we have left safe mode .