Repository: helix Updated Branches: refs/heads/master f8fcd0b71 -> 1b268bafd
Add error->offline state transition callback in DistClusterControllerStateModel. Project: http://git-wip-us.apache.org/repos/asf/helix/repo Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/1b268baf Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/1b268baf Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/1b268baf Branch: refs/heads/master Commit: 1b268bafdf2fe8c8302bea9814220cd9c7c198bf Parents: 012e780 Author: Lei Xia <[email protected]> Authored: Tue Apr 3 13:46:05 2018 -0700 Committer: Lei Xia <[email protected]> Committed: Mon Apr 16 11:22:40 2018 -0700 ---------------------------------------------------------------------- .../helix/participant/DistClusterControllerStateModel.java | 9 ++++++++- .../participant/TestDistControllerStateModelFactory.java | 3 +-- 2 files changed, 9 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/helix/blob/1b268baf/helix-core/src/main/java/org/apache/helix/participant/DistClusterControllerStateModel.java ---------------------------------------------------------------------- diff --git a/helix-core/src/main/java/org/apache/helix/participant/DistClusterControllerStateModel.java b/helix-core/src/main/java/org/apache/helix/participant/DistClusterControllerStateModel.java index 540cd89..1195a24 100644 --- a/helix-core/src/main/java/org/apache/helix/participant/DistClusterControllerStateModel.java +++ b/helix-core/src/main/java/org/apache/helix/participant/DistClusterControllerStateModel.java @@ -48,7 +48,8 @@ public class DistClusterControllerStateModel extends StateModel { @Transition(to = "STANDBY", from = "OFFLINE") public void onBecomeStandbyFromOffline(Message message, NotificationContext context) { - logger.info("Becoming standby from offline"); + logger.info("Becoming standby from offline for " + message.getResourceName() + " and " + message + .getPartitionName()); } @Transition(to = "LEADER", from = "STANDBY") @@ -107,6 +108,12 @@ public class DistClusterControllerStateModel extends StateModel { logger.info("Becoming offline from dropped"); } + @Transition(to = "OFFLINE", from = "ERROR") + public void onBecomeOfflineFromError(Message message, NotificationContext context) { + logger.info("Becoming offline from error."); + reset(); + } + @Override public void rollbackOnError(Message message, NotificationContext context, StateTransitionError error) { http://git-wip-us.apache.org/repos/asf/helix/blob/1b268baf/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModelFactory.java ---------------------------------------------------------------------- diff --git a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModelFactory.java b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModelFactory.java index 509ac5b..b062bf3 100644 --- a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModelFactory.java +++ b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerStateModelFactory.java @@ -20,8 +20,7 @@ package org.apache.helix.participant; */ import org.apache.helix.ZkUnitTestBase; -import org.apache.helix.participant.DistClusterControllerStateModel; -import org.apache.helix.participant.DistClusterControllerStateModelFactory; + import org.testng.annotations.Test; public class TestDistControllerStateModelFactory {
