hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r469683 - in /lucene/hadoop/trunk: ./ bin/ src/java/org/apache/hadoop/dfs/ src/java/org/apache/hadoop/mapred/
Date Tue, 31 Oct 2006 22:29:52 GMT
Author: cutting
Date: Tue Oct 31 14:29:51 2006
New Revision: 469683

URL: http://svn.apache.org/viewvc?view=rev&rev=469683
Log:
HADOOP-553.  Change main() routines in datanode and namenode to log exceptions rather than
letting the JVM print them to standard error.  Also change the hadoop-daemon.sh script to
rotate standard i/o log files.  Contributed by Raghu Angadi.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/bin/hadoop-daemon.sh
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=469683&r1=469682&r2=469683
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Tue Oct 31 14:29:51 2006
@@ -100,6 +100,11 @@
 27. HADOOP-651.  Fix DFSCk to correctly pass parameters to the servlet
     on the namenode.  (Milind Bhandarkar via cutting)
 
+28. HADOOP-553.  Change main() routines of DataNode and NameNode to
+    log exceptions rather than letting the JVM print them to standard
+    error.  Also, change the hadoop-daemon.sh script to rotate
+    standard i/o log files.  (Raghu Angadi via cutting)
+
 
 Release 0.7.2 - 2006-10-18
 

Modified: lucene/hadoop/trunk/bin/hadoop-daemon.sh
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/bin/hadoop-daemon.sh?view=diff&rev=469683&r1=469682&r2=469683
==============================================================================
--- lucene/hadoop/trunk/bin/hadoop-daemon.sh (original)
+++ lucene/hadoop/trunk/bin/hadoop-daemon.sh Tue Oct 31 14:29:51 2006
@@ -31,6 +31,23 @@
 command=$1
 shift
 
+hadoop_rotate_log ()
+{
+    log=$1;
+    num=5;
+    if [ -n "$2" ]; then
+	num=$2
+    fi
+    if [ -f "$log" ]; then # rotate logs
+	while [ $num -gt 1 ]; do
+	    prev=`expr $num - 1`
+	    [ -f "$log.$prev" ] && mv "$log.$prev" "$log.$num"
+	    num=$prev
+	done
+	mv "$log" "$log.$num";
+    fi
+}
+
 if [ -f "${HADOOP_CONF_DIR}/hadoop-env.sh" ]; then
   . "${HADOOP_CONF_DIR}/hadoop-env.sh"
 fi
@@ -76,6 +93,7 @@
       rsync -a -e ssh --delete --exclude=.svn $HADOOP_MASTER/ "$HADOOP_HOME"
     fi
 
+    hadoop_rotate_log $log
     echo starting $command, logging to $log
     nohup nice -n $HADOOP_NICENESS "$HADOOP_HOME"/bin/hadoop --config $HADOOP_CONF_DIR $command
"$@" > "$log" 2>&1 < /dev/null &
     echo $! > $pid

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java?view=diff&rev=469683&r1=469682&r2=469683
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java Tue Oct 31 14:29:51 2006
@@ -1105,8 +1105,13 @@
     /**
      */
     public static void main(String args[]) throws IOException {
+      try {
         Configuration conf = new Configuration();
         runAndWait(conf);
+      } catch ( Throwable e ) {
+        LOG.error( StringUtils.stringifyException( e ) );
+        System.exit(-1);
+      }
     }
 
 }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java?view=diff&rev=469683&r1=469682&r2=469683
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java Tue Oct 31 14:29:51 2006
@@ -23,6 +23,7 @@
 import org.apache.hadoop.io.*;
 import org.apache.hadoop.ipc.*;
 import org.apache.hadoop.conf.*;
+import org.apache.hadoop.util.StringUtils;
 
 import java.io.*;
 
@@ -568,6 +569,7 @@
     /**
      */
     public static void main(String argv[]) throws Exception {
+      try {
         Configuration conf = new Configuration();
 
         if (argv.length == 1 && argv[0].equals("-format")) {
@@ -591,5 +593,10 @@
         
         NameNode namenode = new NameNode(conf);
         namenode.join();
+        
+      } catch ( Throwable e ) {
+        LOG.error( StringUtils.stringifyException( e ) );
+        System.exit(-1);
+      }
     }
 }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java?view=diff&rev=469683&r1=469682&r2=469683
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java Tue Oct 31 14:29:51
2006
@@ -1230,12 +1230,17 @@
      * JobTracker should be run as part of the DFS Namenode process.
      */
     public static void main(String argv[]) throws IOException, InterruptedException {
-        if (argv.length != 0) {
-          System.out.println("usage: JobTracker");
-          System.exit(-1);
-        }
-
+      if (argv.length != 0) {
+        System.out.println("usage: JobTracker");
+        System.exit(-1);
+      }
+      
+      try {
         Configuration conf=new Configuration();
         startTracker(conf);
+      } catch ( Throwable e ) {
+        LOG.error( StringUtils.stringifyException( e ) );
+        System.exit(-1);
+      }
     }
 }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java?view=diff&rev=469683&r1=469682&r2=469683
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java Tue Oct 31 14:29:51
2006
@@ -1367,10 +1367,10 @@
           ReflectionUtils.setContentionTracing
               (conf.getBoolean("tasktracker.contention.tracking", false));
           new TaskTracker(conf).run();
-        } catch (IOException e) {
-            LOG.warn( "Can not start task tracker because "+
-                      StringUtils.stringifyException(e));
-            System.exit(-1);
+        } catch ( Throwable e ) {
+          LOG.error( "Can not start task tracker because "+
+                     StringUtils.stringifyException(e) );
+          System.exit(-1);
         }
     }
     



Mime
View raw message