瀏覽代碼

commit c4f785cfc285c89e5612f446ef324ad3706a4090
Author: Konstantin Boudnik <cos@goodenter-lm.local>
Date: Mon Feb 22 18:30:47 2010 -0800

from


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1077178 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 年之前
父節點
當前提交
0171facb80

+ 17 - 4
src/test/system/java/org/apache/hadoop/test/system/process/HadoopDaemonRemoteCluster.java

@@ -31,6 +31,10 @@ import org.apache.hadoop.util.Shell.ShellCommandExecutor;
  */
 public class HadoopDaemonRemoteCluster implements ClusterProcessManager {
 
+  private final static String CONF_HADOOP_MASTERSFILE_NAME="test.system.hdrc.masters.file";
+  private final static String MASTERS_FILE = System.getProperty(CONF_HADOOP_MASTERSFILE_NAME, "masters");
+  private final static String SLAVES_FILE = "slaves";
+
   private static final Log LOG = LogFactory
       .getLog(HadoopDaemonRemoteCluster.class.getName());
 
@@ -173,8 +177,8 @@ public class HadoopDaemonRemoteCluster implements ClusterProcessManager {
   }
 
   private void populateDaemons(String confLocation) throws IOException {
-    File mastersFile = new File(confLocation, "masters");
-    File slavesFile = new File(confLocation, "slaves");
+    File mastersFile = new File(confLocation, MASTERS_FILE);
+    File slavesFile = new File(confLocation, SLAVES_FILE);
     BufferedReader reader = null;
     try {
       reader = new BufferedReader(new FileReader(mastersFile));
@@ -182,12 +186,16 @@ public class HadoopDaemonRemoteCluster implements ClusterProcessManager {
       masterHost = reader.readLine();
       if (masterHost != null && !masterHost.trim().isEmpty()) {
         master = new ScriptDaemon(masterCommand, masterHost);
+      } else {
+        LOG.error(confLocation + System.getProperty("file.separator", "/") +
+            MASTERS_FILE + " has no content");
       }
     } finally {
       try {
         reader.close();
       } catch (Exception e) {
-        LOG.error("Can't read masters file from " + confLocation);
+        LOG.error("Can't read masters file from " + confLocation +
+            System.getProperty("file.separator", "/") + MASTERS_FILE);
       }
 
     }
@@ -198,11 +206,16 @@ public class HadoopDaemonRemoteCluster implements ClusterProcessManager {
         RemoteProcess slave = new ScriptDaemon(slaveCommand, slaveHost);
         slaves.put(slaveHost, slave);
       }
+      if (slaves.size() == 0) {
+        LOG.error(confLocation + System.getProperty("file.separator", "/") +
+            SLAVES_FILE + " has no content");
+      }
     } finally {
       try {
         reader.close();
       } catch (Exception e) {
-        LOG.error("Can't read slaves file from " + confLocation);
+        LOG.error("Can't read slaves file from " + confLocation +
+            System.getProperty("file.separator", "/") + SLAVES_FILE);
       }
     }
   }