فهرست منبع

YARN-3375. NodeHealthScriptRunner.shouldRun() check is performing 3 times for starting NodeHealthScriptRunner (Devaraj K via wangda)

(cherry picked from commit 71f4de220c74bf2c90630bd0442979d92380d304)
Wangda Tan 10 سال پیش
والد
کامیت
4e77ee2f6f

+ 0 - 8
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/NodeHealthScriptRunner.java

@@ -214,11 +214,6 @@ public class NodeHealthScriptRunner extends AbstractService {
    */
   @Override
   protected void serviceStart() throws Exception {
-    // if health script path is not configured don't start the thread.
-    if (!shouldRun(nodeHealthScript)) {
-      LOG.info("Not starting node health monitor");
-      return;
-    }
     nodeHealthScriptScheduler = new Timer("NodeHealthMonitor-Timer", true);
     // Start the timer task immediately and
     // then periodically at interval time.
@@ -232,9 +227,6 @@ public class NodeHealthScriptRunner extends AbstractService {
    */
   @Override
   protected void serviceStop() {
-    if (!shouldRun(nodeHealthScript)) {
-      return;
-    }
     if (nodeHealthScriptScheduler != null) {
       nodeHealthScriptScheduler.cancel();
     }

+ 3 - 0
hadoop-yarn-project/CHANGES.txt

@@ -254,6 +254,9 @@ Release 2.8.0 - UNRELEASED
     YARN-3097. Logging of resource recovery on NM restart has redundancies
     (Eric Payne via jlowe)
 
+    YARN-3375. NodeHealthScriptRunner.shouldRun() check is performing 3 times for 
+    starting NodeHealthScriptRunner. (Devaraj K via wangda)
+
 Release 2.7.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 1 - 3
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeHealthCheckerService.java

@@ -21,7 +21,6 @@ package org.apache.hadoop.yarn.server.nodemanager;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.service.CompositeService;
 import org.apache.hadoop.util.NodeHealthScriptRunner;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
 
 /**
  * The class which provides functionality of checking the health of the node and
@@ -44,8 +43,7 @@ public class NodeHealthCheckerService extends CompositeService {
 
   @Override
   protected void serviceInit(Configuration conf) throws Exception {
-    if (NodeHealthScriptRunner.shouldRun(
-        conf.get(YarnConfiguration.NM_HEALTH_CHECK_SCRIPT_PATH))) {
+    if (nodeHealthScriptRunner != null) {
       addService(nodeHealthScriptRunner);
     }
     addService(dirsHandler);

+ 3 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java

@@ -210,7 +210,9 @@ public class NodeManager extends CompositeService
     String nodeHealthScript = 
         conf.get(YarnConfiguration.NM_HEALTH_CHECK_SCRIPT_PATH);
     if(!NodeHealthScriptRunner.shouldRun(nodeHealthScript)) {
-      LOG.info("Abey khali");
+      LOG.info("Node Manager health check script is not available "
+          + "or doesn't have execute permission, so not "
+          + "starting the node health script runner.");
       return null;
     }
     long nmCheckintervalTime = conf.getLong(