Forráskód Böngészése

HADOOP-5193. Correct calculation of edits modification time. Contributed by Konstantin Shvachko.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@742171 13f79535-47bb-0310-9956-ffa450edef68
Konstantin Shvachko 16 éve
szülő
commit
75114737a2

+ 2 - 0
CHANGES.txt

@@ -774,6 +774,8 @@ Release 0.19.1 - Unreleased
     HADOOP-5161. Accepted sockets do not get placed in
     DataXceiverServer#childSockets. (hairong)
 
+    HADOOP-5193. Correct calculation of edits modification time. (shv)
+
 Release 0.19.0 - 2008-11-18
 
   INCOMPATIBLE CHANGES

+ 1 - 5
src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogOutputStream.java

@@ -93,14 +93,10 @@ abstract class EditLogOutputStream extends OutputStream {
 
   /**
    * Return the size of the current edits log.
+   * Length is used to check when it is large enough to start a checkpoint.
    */
   abstract long length() throws IOException;
 
-  /**
-   * Returns the time the edits log stream was last modified. 
-   */
-  abstract long lastModified();
-
   /**
    * Return total time spent in {@link #flushAndSync()}
    */

+ 4 - 9
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java

@@ -216,14 +216,6 @@ public class FSEditLog {
       // file size + size of both buffers
       return fc.size() + bufReady.size() + bufCurrent.size();
     }
-    
-    /**
-     * Returns the time the edits log file was last modified. 
-     */
-    @Override
-    long lastModified() {
-      return file.lastModified();
-    }
 
     // allocate a big chunk of data
     private void preallocate() throws IOException {
@@ -1215,7 +1207,10 @@ public class FSEditLog {
    * Returns the timestamp of the edit log
    */
   synchronized long getFsEditTime() {
-    return editStreams.get(0).lastModified();
+    Iterator<StorageDirectory> it = fsimage.dirIterator(NameNodeDirType.EDITS);
+    if(it.hasNext())
+      return getEditFile(it.next()).lastModified();
+    return 0;
   }
 
   // sets the initial capacity of the flush buffer.