You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sh...@apache.org on 2009/02/08 22:23:48 UTC

svn commit: r742171 - in /hadoop/core/trunk: CHANGES.txt src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogOutputStream.java src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java

Author: shv
Date: Sun Feb  8 21:23:48 2009
New Revision: 742171

URL: http://svn.apache.org/viewvc?rev=742171&view=rev
Log:
HADOOP-5193. Correct calculation of edits modification time. Contributed by Konstantin Shvachko.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogOutputStream.java
    hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=742171&r1=742170&r2=742171&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Sun Feb  8 21:23:48 2009
@@ -774,6 +774,8 @@
     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

Modified: hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogOutputStream.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogOutputStream.java?rev=742171&r1=742170&r2=742171&view=diff
==============================================================================
--- hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogOutputStream.java (original)
+++ hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogOutputStream.java Sun Feb  8 21:23:48 2009
@@ -93,15 +93,11 @@
 
   /**
    * 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()}
    */
   long getTotalSyncTime() {

Modified: hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java?rev=742171&r1=742170&r2=742171&view=diff
==============================================================================
--- hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java (original)
+++ hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java Sun Feb  8 21:23:48 2009
@@ -216,14 +216,6 @@
       // 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 @@
    * 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.