hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r753116 - in /hadoop/core/branches/branch-0.19: ./ CHANGES.txt src/mapred/org/apache/hadoop/mapred/JobHistory.java
Date Fri, 13 Mar 2009 05:07:55 GMT
Author: ddas
Date: Fri Mar 13 05:07:54 2009
New Revision: 753116

URL: http://svn.apache.org/viewvc?rev=753116&view=rev
Log:
Merge -r 753111:753113 from trunk onto 0.19 branch. Fixes HADOOP-5449.

Modified:
    hadoop/core/branches/branch-0.19/   (props changed)
    hadoop/core/branches/branch-0.19/CHANGES.txt   (contents, props changed)
    hadoop/core/branches/branch-0.19/src/mapred/org/apache/hadoop/mapred/JobHistory.java

Propchange: hadoop/core/branches/branch-0.19/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Mar 13 05:07:54 2009
@@ -1 +1 @@
-/hadoop/core/trunk:697306,698176,699056,699098,699415,699424,699444,699490,699517,700163,700628,700923,701273,701398,703923,704203,704261,704701,704703,704707,704712,704732,704748,704989,705391,705420,705430,705762,706350,706707,706719,706796,706802,707258,707262,708623,708641,708710,709040,709303,712881,713888,720602,723013,723460,723831,723918,724883,727117,727212,727217,727228,727869,732572,732777,733887,734870,736426,738697,740077,741703,741762,743745,743892,745180,746902-746903,752073,752609,752836
+/hadoop/core/trunk:697306,698176,699056,699098,699415,699424,699444,699490,699517,700163,700628,700923,701273,701398,703923,704203,704261,704701,704703,704707,704712,704732,704748,704989,705391,705420,705430,705762,706350,706707,706719,706796,706802,707258,707262,708623,708641,708710,709040,709303,712881,713888,720602,723013,723460,723831,723918,724883,727117,727212,727217,727228,727869,732572,732777,733887,734870,736426,738697,740077,741703,741762,743745,743892,745180,746902-746903,752073,752609,752836,753112-753113

Modified: hadoop/core/branches/branch-0.19/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/CHANGES.txt?rev=753116&r1=753115&r2=753116&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.19/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.19/CHANGES.txt Fri Mar 13 05:07:54 2009
@@ -70,6 +70,9 @@
     (Amareshwari Sriramadasu via ddas)
 
     HADOOP-5446. Restore TaskTracker metrics. (cdouglas)
+
+    HADOOP-5449. Fixes the history cleaner thread. 
+    (Amareshwari Sriramadasu via ddas)
  
 Release 0.19.1 - 2009-02-23
 

Propchange: hadoop/core/branches/branch-0.19/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Mar 13 05:07:54 2009
@@ -1,3 +1,3 @@
 /hadoop/core/branches/branch-0.18/CHANGES.txt:727226
 /hadoop/core/branches/branch-0.20/CHANGES.txt:752591
-/hadoop/core/trunk/CHANGES.txt:697306,698176,699056,699098,699415,699424,699444,699490,699517,700163,700628,700923,701273,701398,703923,704203,704261,704701,704703,704707,704712,704732,704748,704989,705391,705420,705430,705762,706350,706707,706719,706796,706802,707258,707262,708623,708641,708710,708723,709040,709303,711717,712881,713888,720602,723013,723460,723831,723918,724883,727117,727212,727217,727228,727869,732572,732777,733887,734870,735082,736426,738697,740077,741703,741762,743296,743745,743892,745180,746902-746903,752073,752590,752609,752836
+/hadoop/core/trunk/CHANGES.txt:697306,698176,699056,699098,699415,699424,699444,699490,699517,700163,700628,700923,701273,701398,703923,704203,704261,704701,704703,704707,704712,704732,704748,704989,705391,705420,705430,705762,706350,706707,706719,706796,706802,707258,707262,708623,708641,708710,708723,709040,709303,711717,712881,713888,720602,723013,723460,723831,723918,724883,727117,727212,727217,727228,727869,732572,732777,733887,734870,735082,736426,738697,740077,741703,741762,743296,743745,743892,745180,746902-746903,752073,752590,752609,752836,753112-753113

Modified: hadoop/core/branches/branch-0.19/src/mapred/org/apache/hadoop/mapred/JobHistory.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/src/mapred/org/apache/hadoop/mapred/JobHistory.java?rev=753116&r1=753115&r2=753116&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.19/src/mapred/org/apache/hadoop/mapred/JobHistory.java (original)
+++ hadoop/core/branches/branch-0.19/src/mapred/org/apache/hadoop/mapred/JobHistory.java Fri
Mar 13 05:07:54 2009
@@ -95,6 +95,7 @@
   private static final String SECONDARY_FILE_SUFFIX = ".recover";
   private static long jobHistoryBlockSize = 0;
   private static String jobtrackerHostname;
+  private static JobConf jtConf;
   /**
    * Record types are identifiers for each line of log in history files. 
    * A record type appears as the first token in a single line of log. 
@@ -160,6 +161,7 @@
       jobHistoryBlockSize = 
         conf.getLong("mapred.jobtracker.job.history.block.size", 
                      3 * 1024 * 1024);
+      jtConf = conf;
     } catch(IOException e) {
         LOG.error("Failed to initialize JobHistory log file", e); 
         disableHistory = true;
@@ -1655,7 +1657,7 @@
     static final long THIRTY_DAYS_IN_MS = 30 * ONE_DAY_IN_MS;
     private long now; 
     private static boolean isRunning = false; 
-    private static long lastRan; 
+    private static long lastRan = 0; 
 
     /**
      * Cleans up history data. 
@@ -1666,26 +1668,34 @@
       }
       now = System.currentTimeMillis();
       // clean history only once a day at max
-      if (lastRan ==0 || (now - lastRan) < ONE_DAY_IN_MS){
+      if (lastRan != 0 && (now - lastRan) < ONE_DAY_IN_MS) {
         return; 
       }
       lastRan = now;  
       isRunning = true; 
-      File[] oldFiles = new File(LOG_DIR).listFiles(new FileFilter(){
-          public boolean accept(File file){
-            // delete if older than 30 days
-            if (now - file.lastModified() > THIRTY_DAYS_IN_MS){
-              return true; 
+      try {
+        Path logDir = new Path(LOG_DIR);
+        FileSystem fs = logDir.getFileSystem(jtConf);
+        FileStatus[] historyFiles = fs.listStatus(logDir);
+        // delete if older than 30 days
+        if (historyFiles != null) {
+          for (FileStatus f : historyFiles) {
+            if (now - f.getModificationTime() > THIRTY_DAYS_IN_MS) {
+              fs.delete(f.getPath(), true); 
+              LOG.info("Deleting old history file : " + f.getPath());
             }
-            return false; 
           }
-        });
-      for(File f : oldFiles){
-        f.delete(); 
-        LOG.info("Deleting old history file : " + f.getName());
+        }
+      } catch (IOException ie) {
+        LOG.info("Error cleaning up history directory" + 
+                 StringUtils.stringifyException(ie));
       }
       isRunning = false; 
     }
+    
+    static long getLastRan() {
+      return lastRan;
+    }
   }
 
   /**



Mime
View raw message