Revert "YARN-5567. Fix script exit code checking in 
NodeHealthScriptRunner#reportHealthStatus. (Yufei Gu via rchiang)"

This reverts commit 05ede003868871addc30162e9707c3dc14ed6b7a.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/cae33118
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/cae33118
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/cae33118

Branch: refs/heads/HDFS-10285
Commit: cae331186da266eea1b0a6fc2c82604907ab0153
Parents: 401db4f
Author: Allen Wittenauer <a...@apache.org>
Authored: Thu Sep 8 12:40:30 2016 -0700
Committer: Allen Wittenauer <a...@apache.org>
Committed: Thu Sep 8 12:40:30 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/util/NodeHealthScriptRunner.java   | 3 +--
 .../org/apache/hadoop/util/TestNodeHealthScriptRunner.java    | 7 -------
 2 files changed, 1 insertion(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/cae33118/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/NodeHealthScriptRunner.java
----------------------------------------------------------------------
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/NodeHealthScriptRunner.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/NodeHealthScriptRunner.java
index c3bef37..fc392c4 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/NodeHealthScriptRunner.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/NodeHealthScriptRunner.java
@@ -106,7 +106,6 @@ public class NodeHealthScriptRunner extends AbstractService 
{
         shexec.execute();
       } catch (ExitCodeException e) {
         // ignore the exit code of the script
-        exceptionStackTrace = StringUtils.stringifyException(e);
         status = HealthCheckerExitStatus.FAILED_WITH_EXIT_CODE;
         // On Windows, we will not hit the Stream closed IOException
         // thrown by stdout buffered reader for timeout event.
@@ -163,7 +162,7 @@ public class NodeHealthScriptRunner extends AbstractService 
{
         setHealthStatus(false, exceptionStackTrace);
         break;
       case FAILED_WITH_EXIT_CODE:
-        setHealthStatus(false, exceptionStackTrace);
+        setHealthStatus(true, "", now);
         break;
       case FAILED:
         setHealthStatus(false, shexec.getOutput());

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cae33118/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestNodeHealthScriptRunner.java
----------------------------------------------------------------------
diff --git 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestNodeHealthScriptRunner.java
 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestNodeHealthScriptRunner.java
index db61f5a..8fc64d1 100644
--- 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestNodeHealthScriptRunner.java
+++ 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestNodeHealthScriptRunner.java
@@ -91,7 +91,6 @@ public class TestNodeHealthScriptRunner {
   public void testNodeHealthScript() throws Exception {
     String errorScript = "echo ERROR\n echo \"Tracker not healthy\"";
     String normalScript = "echo \"I am all fine\"";
-    String failWithExitCodeScript = "echo \"Not healthy\"; exit -1";
     String timeOutScript =
       Shell.WINDOWS ? "@echo off\nping -n 4 127.0.0.1 >nul\necho \"I am fine\""
       : "sleep 4\necho \"I am fine\"";
@@ -125,12 +124,6 @@ public class TestNodeHealthScriptRunner {
         nodeHealthScriptRunner.isHealthy());
     Assert.assertEquals("", nodeHealthScriptRunner.getHealthReport());
 
-    // Script which fails with exit code.
-    writeNodeHealthScriptFile(failWithExitCodeScript, true);
-    timerTask.run();
-    Assert.assertFalse("Node health status reported healthy",
-        nodeHealthScriptRunner.isHealthy());
-
     // Timeout script.
     writeNodeHealthScriptFile(timeOutScript, true);
     timerTask.run();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to