You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cn...@apache.org on 2015/01/21 20:56:01 UTC
[1/2] hadoop git commit: HADOOP-10668. Addendum patch to fix
TestZKFailoverController. Contributed by Ming Ma.
Repository: hadoop
Updated Branches:
refs/heads/branch-2 5ec2b6caa -> 2a6977561
refs/heads/trunk db334bb86 -> 925c9fed3
HADOOP-10668. Addendum patch to fix TestZKFailoverController. Contributed by Ming Ma.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/925c9fed
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/925c9fed
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/925c9fed
Branch: refs/heads/trunk
Commit: 925c9fed3311ea1fd8f5ed1cb6b1c0abc5c90425
Parents: db334bb
Author: cnauroth <cn...@apache.org>
Authored: Wed Jan 21 11:52:48 2015 -0800
Committer: cnauroth <cn...@apache.org>
Committed: Wed Jan 21 11:52:48 2015 -0800
----------------------------------------------------------------------
.../test/java/org/apache/hadoop/ha/MiniZKFCCluster.java | 5 +++++
.../org/apache/hadoop/ha/TestZKFailoverController.java | 10 +++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/925c9fed/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/MiniZKFCCluster.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/MiniZKFCCluster.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/MiniZKFCCluster.java
index cab59a4..5aee611 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/MiniZKFCCluster.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/MiniZKFCCluster.java
@@ -155,6 +155,11 @@ public class MiniZKFCCluster {
/**
* Wait for the given HA service to enter the given HA state.
+ * This is based on the state of ZKFC, not the state of HA service.
+ * There could be difference between the two. For example,
+ * When the service becomes unhealthy, ZKFC will quit ZK election and
+ * transition to HAServiceState.INITIALIZING and remain in that state
+ * until the service becomes healthy.
*/
public void waitForHAState(int idx, HAServiceState state)
throws Exception {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/925c9fed/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestZKFailoverController.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestZKFailoverController.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestZKFailoverController.java
index 83a29dd..d8271c5 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestZKFailoverController.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestZKFailoverController.java
@@ -211,8 +211,8 @@ public class TestZKFailoverController extends ClientBaseWithFixes {
LOG.info("Faking svc0 unhealthy, should failover to svc1");
cluster.setHealthy(0, false);
- LOG.info("Waiting for svc0 to enter standby state");
- cluster.waitForHAState(0, HAServiceState.STANDBY);
+ LOG.info("Waiting for svc0 to enter initializing state");
+ cluster.waitForHAState(0, HAServiceState.INITIALIZING);
cluster.waitForHAState(1, HAServiceState.ACTIVE);
LOG.info("Allowing svc0 to be healthy again, making svc1 unreachable " +
@@ -332,7 +332,7 @@ public class TestZKFailoverController extends ClientBaseWithFixes {
Mockito.verify(svc1.proxy, Mockito.timeout(2000).atLeastOnce())
.transitionToActive(Mockito.<StateChangeRequestInfo>any());
- cluster.waitForHAState(0, HAServiceState.STANDBY);
+ cluster.waitForHAState(0, HAServiceState.INITIALIZING);
cluster.waitForHAState(1, HAServiceState.STANDBY);
LOG.info("Faking svc0 healthy again, should go back to svc0");
@@ -587,12 +587,12 @@ public class TestZKFailoverController extends ClientBaseWithFixes {
// Failover by bad health
cluster.setHealthy(0, false);
- cluster.waitForHAState(0, HAServiceState.STANDBY);
+ cluster.waitForHAState(0, HAServiceState.INITIALIZING);
cluster.waitForHAState(1, HAServiceState.ACTIVE);
cluster.setHealthy(1, true);
cluster.setHealthy(0, false);
cluster.waitForHAState(1, HAServiceState.ACTIVE);
- cluster.waitForHAState(0, HAServiceState.STANDBY);
+ cluster.waitForHAState(0, HAServiceState.INITIALIZING);
cluster.setHealthy(0, true);
cluster.waitForHealthState(0, State.SERVICE_HEALTHY);
[2/2] hadoop git commit: HADOOP-10668. Addendum patch to fix
TestZKFailoverController. Contributed by Ming Ma.
Posted by cn...@apache.org.
HADOOP-10668. Addendum patch to fix TestZKFailoverController. Contributed by Ming Ma.
(cherry picked from commit 925c9fed3311ea1fd8f5ed1cb6b1c0abc5c90425)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/2a697756
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2a697756
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2a697756
Branch: refs/heads/branch-2
Commit: 2a6977561018820f26e193212a512c5fbe1553d8
Parents: 5ec2b6c
Author: cnauroth <cn...@apache.org>
Authored: Wed Jan 21 11:52:48 2015 -0800
Committer: cnauroth <cn...@apache.org>
Committed: Wed Jan 21 11:53:02 2015 -0800
----------------------------------------------------------------------
.../test/java/org/apache/hadoop/ha/MiniZKFCCluster.java | 5 +++++
.../org/apache/hadoop/ha/TestZKFailoverController.java | 10 +++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a697756/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/MiniZKFCCluster.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/MiniZKFCCluster.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/MiniZKFCCluster.java
index cab59a4..5aee611 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/MiniZKFCCluster.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/MiniZKFCCluster.java
@@ -155,6 +155,11 @@ public class MiniZKFCCluster {
/**
* Wait for the given HA service to enter the given HA state.
+ * This is based on the state of ZKFC, not the state of HA service.
+ * There could be difference between the two. For example,
+ * When the service becomes unhealthy, ZKFC will quit ZK election and
+ * transition to HAServiceState.INITIALIZING and remain in that state
+ * until the service becomes healthy.
*/
public void waitForHAState(int idx, HAServiceState state)
throws Exception {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a697756/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestZKFailoverController.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestZKFailoverController.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestZKFailoverController.java
index 83a29dd..d8271c5 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestZKFailoverController.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestZKFailoverController.java
@@ -211,8 +211,8 @@ public class TestZKFailoverController extends ClientBaseWithFixes {
LOG.info("Faking svc0 unhealthy, should failover to svc1");
cluster.setHealthy(0, false);
- LOG.info("Waiting for svc0 to enter standby state");
- cluster.waitForHAState(0, HAServiceState.STANDBY);
+ LOG.info("Waiting for svc0 to enter initializing state");
+ cluster.waitForHAState(0, HAServiceState.INITIALIZING);
cluster.waitForHAState(1, HAServiceState.ACTIVE);
LOG.info("Allowing svc0 to be healthy again, making svc1 unreachable " +
@@ -332,7 +332,7 @@ public class TestZKFailoverController extends ClientBaseWithFixes {
Mockito.verify(svc1.proxy, Mockito.timeout(2000).atLeastOnce())
.transitionToActive(Mockito.<StateChangeRequestInfo>any());
- cluster.waitForHAState(0, HAServiceState.STANDBY);
+ cluster.waitForHAState(0, HAServiceState.INITIALIZING);
cluster.waitForHAState(1, HAServiceState.STANDBY);
LOG.info("Faking svc0 healthy again, should go back to svc0");
@@ -587,12 +587,12 @@ public class TestZKFailoverController extends ClientBaseWithFixes {
// Failover by bad health
cluster.setHealthy(0, false);
- cluster.waitForHAState(0, HAServiceState.STANDBY);
+ cluster.waitForHAState(0, HAServiceState.INITIALIZING);
cluster.waitForHAState(1, HAServiceState.ACTIVE);
cluster.setHealthy(1, true);
cluster.setHealthy(0, false);
cluster.waitForHAState(1, HAServiceState.ACTIVE);
- cluster.waitForHAState(0, HAServiceState.STANDBY);
+ cluster.waitForHAState(0, HAServiceState.INITIALIZING);
cluster.setHealthy(0, true);
cluster.waitForHealthState(0, State.SERVICE_HEALTHY);