Bladeren bron

HADOOP-4398. No need to truncate access time in INode. Also fixes NPE
in CreateEditsLog. (Raghu Angadi)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@705762 13f79535-47bb-0310-9956-ffa450edef68

Raghu Angadi 16 jaren geleden
bovenliggende
commit
a16f1dd18d
2 gewijzigde bestanden met toevoegingen van 6 en 9 verwijderingen
  1. 3 0
      CHANGES.txt
  2. 3 9
      src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java

+ 3 - 0
CHANGES.txt

@@ -979,6 +979,9 @@ Release 0.18.2 - Unreleased
 
     HADOOP-4292. Do not support append() for LocalFileSystem. (hairong)
 
+    HADOOP-4398. No need to truncate access time in INode. Also fixes NPE 
+    in CreateEditsLog. (Raghu Angadi) 
+
 Release 0.18.1 - 2008-09-17
 
   IMPROVEMENTS

+ 3 - 9
src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java

@@ -27,7 +27,6 @@ import org.apache.hadoop.fs.permission.*;
 import org.apache.hadoop.hdfs.protocol.Block;
 import org.apache.hadoop.hdfs.protocol.LocatedBlock;
 import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
-import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
 
 /**
  * We keep an in-memory representation of the file/block hierarchy.
@@ -38,7 +37,7 @@ public abstract class INode implements Comparable<byte[]> {
   protected byte[] name;
   protected INodeDirectory parent;
   protected long modificationTime;
-  protected int accessTime; // precise to the last hour
+  protected long accessTime;
 
   /** Simple wrapper for two counters : 
    *  nsCount (namespace consumed) and dsCount (diskspace consumed).
@@ -291,19 +290,14 @@ public abstract class INode implements Comparable<byte[]> {
    * @return access time
    */
   public long getAccessTime() {
-    return this.accessTime * FSNamesystem.getFSNamesystem().getAccessTimePrecision();
+    return accessTime;
   }
 
   /**
    * Set last access time of inode.
    */
   void setAccessTime(long atime) {
-    long precision = FSNamesystem.getFSNamesystem().getAccessTimePrecision();
-    if (precision == 0) {
-      this.accessTime = 0;
-    } else {
-      this.accessTime = (int)(atime/precision);
-    }
+    accessTime = atime;
   }
 
   /**