@@ -156,7 +156,9 @@ public boolean transitionHAState(final HAConfig.Event event, final HAConfig haCo
156156 if (result ) {
157157 final String message = String .format ("Transitioned host HA state from:%s to:%s due to event:%s for the host id:%d" ,
158158 currentHAState , nextState , event , haConfig .getResourceId ());
159- LOG .debug (message );
159+ if (LOG .isTraceEnabled ()) {
160+ LOG .trace (message );
161+ }
160162 if (nextState == HAConfig .HAState .Recovering || nextState == HAConfig .HAState .Fencing || nextState == HAConfig .HAState .Fenced ) {
161163 ActionEventUtils .onActionEvent (CallContext .current ().getCallingUserId (), CallContext .current ().getCallingAccountId (),
162164 Domain .ROOT_DOMAIN , EventTypes .EVENT_HA_STATE_TRANSITION , message );
@@ -475,7 +477,7 @@ public void onManagementNodeLeft(List<? extends ManagementServerHost> nodeList,
475477 public void onManagementNodeIsolated () {
476478 }
477479
478- private boolean processHAStateChange (final HAConfig haConfig , final boolean status ) {
480+ private boolean processHAStateChange (final HAConfig haConfig , final HAConfig . HAState newState , final boolean status ) {
479481 if (!status || !checkHAOwnership (haConfig )) {
480482 return false ;
481483 }
@@ -493,14 +495,14 @@ private boolean processHAStateChange(final HAConfig haConfig, final boolean stat
493495 final HAResourceCounter counter = getHACounter (haConfig .getResourceId (), haConfig .getResourceType ());
494496
495497 // Perform activity checks
496- if (haConfig . getState () == HAConfig .HAState .Checking ) {
498+ if (newState == HAConfig .HAState .Checking ) {
497499 final ActivityCheckTask job = ComponentContext .inject (new ActivityCheckTask (resource , haProvider , haConfig ,
498500 HAProviderConfig .ActivityCheckTimeout , activityCheckExecutor , counter .getSuspectTimeStamp ()));
499501 activityCheckExecutor .submit (job );
500502 }
501503
502504 // Attempt recovery
503- if (haConfig . getState () == HAConfig .HAState .Recovering ) {
505+ if (newState == HAConfig .HAState .Recovering ) {
504506 if (counter .getRecoveryCounter () >= (Long ) (haProvider .getConfigValue (HAProviderConfig .MaxRecoveryAttempts , resource ))) {
505507 return false ;
506508 }
@@ -511,7 +513,7 @@ private boolean processHAStateChange(final HAConfig haConfig, final boolean stat
511513 }
512514
513515 // Fencing
514- if (haConfig . getState () == HAConfig .HAState .Fencing ) {
516+ if (newState == HAConfig .HAState .Fencing ) {
515517 final FenceTask task = ComponentContext .inject (new FenceTask (resource , haProvider , haConfig ,
516518 HAProviderConfig .FenceTimeout , fenceExecutor ));
517519 final Future <Boolean > fenceFuture = fenceExecutor .submit (task );
@@ -528,15 +530,21 @@ public boolean preStateTransitionEvent(final HAConfig.HAState oldState, final HA
528530 if (LOG .isTraceEnabled ()) {
529531 LOG .trace ("HA state pre-transition:: new state=" + newState + ", old state=" + oldState + ", for resource id=" + haConfig .getResourceId () + ", status=" + status + ", ha config state=" + haConfig .getState ());
530532 }
531- return processHAStateChange (haConfig , status );
533+ if (status && haConfig .getState () != newState ) {
534+ LOG .warn ("HA state pre-transition:: HA state is not equal to transition state, HA state=" + haConfig .getState () + ", new state=" + newState );
535+ }
536+ return processHAStateChange (haConfig , newState , status );
532537 }
533538
534539 @ Override
535540 public boolean postStateTransitionEvent (final StateMachine2 .Transition <HAConfig .HAState , HAConfig .Event > transition , final HAConfig haConfig , final boolean status , final Object opaque ) {
536541 if (LOG .isTraceEnabled ()) {
537542 LOG .trace ("HA state post-transition:: new state=" + transition .getToState () + ", old state=" + transition .getCurrentState () + ", for resource id=" + haConfig .getResourceId () + ", status=" + status + ", ha config state=" + haConfig .getState ());
538543 }
539- return processHAStateChange (haConfig , status );
544+ if (status && haConfig .getState () != transition .getToState ()) {
545+ LOG .warn ("HA state post-transition:: HA state is not equal to transition state, HA state=" + haConfig .getState () + ", new state=" + transition .getToState ());
546+ }
547+ return processHAStateChange (haConfig , transition .getToState (), status );
540548 }
541549
542550 ///////////////////////////////////////////////////
@@ -697,5 +705,10 @@ protected void runInContext() {
697705 LOG .error ("Error trying to perform health checks in HA manager" , t );
698706 }
699707 }
708+
709+ @ Override
710+ public Long getDelay () {
711+ return null ;
712+ }
700713 }
701714}
0 commit comments