HADOOP-10668. Addendum patch to fix TestZKFailoverController. Contributed by Ming Ma.
This commit is contained in:
parent
db334bb862
commit
925c9fed33
|
@ -155,6 +155,11 @@ public class MiniZKFCCluster {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait for the given HA service to enter the given HA state.
|
* 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)
|
public void waitForHAState(int idx, HAServiceState state)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
|
@ -211,8 +211,8 @@ public class TestZKFailoverController extends ClientBaseWithFixes {
|
||||||
LOG.info("Faking svc0 unhealthy, should failover to svc1");
|
LOG.info("Faking svc0 unhealthy, should failover to svc1");
|
||||||
cluster.setHealthy(0, false);
|
cluster.setHealthy(0, false);
|
||||||
|
|
||||||
LOG.info("Waiting for svc0 to enter standby state");
|
LOG.info("Waiting for svc0 to enter initializing state");
|
||||||
cluster.waitForHAState(0, HAServiceState.STANDBY);
|
cluster.waitForHAState(0, HAServiceState.INITIALIZING);
|
||||||
cluster.waitForHAState(1, HAServiceState.ACTIVE);
|
cluster.waitForHAState(1, HAServiceState.ACTIVE);
|
||||||
|
|
||||||
LOG.info("Allowing svc0 to be healthy again, making svc1 unreachable " +
|
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())
|
Mockito.verify(svc1.proxy, Mockito.timeout(2000).atLeastOnce())
|
||||||
.transitionToActive(Mockito.<StateChangeRequestInfo>any());
|
.transitionToActive(Mockito.<StateChangeRequestInfo>any());
|
||||||
|
|
||||||
cluster.waitForHAState(0, HAServiceState.STANDBY);
|
cluster.waitForHAState(0, HAServiceState.INITIALIZING);
|
||||||
cluster.waitForHAState(1, HAServiceState.STANDBY);
|
cluster.waitForHAState(1, HAServiceState.STANDBY);
|
||||||
|
|
||||||
LOG.info("Faking svc0 healthy again, should go back to svc0");
|
LOG.info("Faking svc0 healthy again, should go back to svc0");
|
||||||
|
@ -587,12 +587,12 @@ public class TestZKFailoverController extends ClientBaseWithFixes {
|
||||||
|
|
||||||
// Failover by bad health
|
// Failover by bad health
|
||||||
cluster.setHealthy(0, false);
|
cluster.setHealthy(0, false);
|
||||||
cluster.waitForHAState(0, HAServiceState.STANDBY);
|
cluster.waitForHAState(0, HAServiceState.INITIALIZING);
|
||||||
cluster.waitForHAState(1, HAServiceState.ACTIVE);
|
cluster.waitForHAState(1, HAServiceState.ACTIVE);
|
||||||
cluster.setHealthy(1, true);
|
cluster.setHealthy(1, true);
|
||||||
cluster.setHealthy(0, false);
|
cluster.setHealthy(0, false);
|
||||||
cluster.waitForHAState(1, HAServiceState.ACTIVE);
|
cluster.waitForHAState(1, HAServiceState.ACTIVE);
|
||||||
cluster.waitForHAState(0, HAServiceState.STANDBY);
|
cluster.waitForHAState(0, HAServiceState.INITIALIZING);
|
||||||
cluster.setHealthy(0, true);
|
cluster.setHealthy(0, true);
|
||||||
|
|
||||||
cluster.waitForHealthState(0, State.SERVICE_HEALTHY);
|
cluster.waitForHealthState(0, State.SERVICE_HEALTHY);
|
||||||
|
|
Loading…
Reference in New Issue