From 7fc1f2f5cf4312d72aeffb1a9cef497d00c60adb Mon Sep 17 00:00:00 2001 From: cnauroth Date: Mon, 19 Jan 2015 11:28:30 -0800 Subject: [PATCH] HADOOP-10668. TestZKFailoverControllerStress#testExpireBackAndForth occasionally fails. Contributed by Ming Ma. --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/ha/ZKFailoverController.java | 4 +++- .../src/test/java/org/apache/hadoop/ha/MiniZKFCCluster.java | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index d9e6180bc1..9e1bf59cf4 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -722,6 +722,9 @@ Release 2.7.0 - UNRELEASED HADOOP-10542 Potential null pointer dereference in Jets3tFileSystemStore retrieveBlock(). (Ted Yu via stevel) + HADOOP-10668. TestZKFailoverControllerStress#testExpireBackAndForth + occasionally fails. (Ming Ma via cnauroth) + Release 2.6.0 - 2014-11-18 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java index 46c485b1d9..f58c3f4de9 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java @@ -153,7 +153,9 @@ protected abstract void checkRpcAdminAccess() public HAServiceTarget getLocalTarget() { return localTarget; } - + + HAServiceState getServiceState() { return serviceState; } + public int run(final String[] args) throws Exception { if (!localTarget.isAutoFailoverEnabled()) { LOG.fatal("Automatic failover is not enabled for " + localTarget + "." + 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 1db792453a..cab59a48af 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 @@ -158,8 +158,8 @@ public void setUnreachable(int idx, boolean unreachable) { */ public void waitForHAState(int idx, HAServiceState state) throws Exception { - DummyHAService svc = getService(idx); - while (svc.state != state) { + DummyZKFC svc = getZkfc(idx); + while (svc.getServiceState() != state) { ctx.checkException(); Thread.sleep(50); }