hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kih...@apache.org
Subject svn commit: r1503397 - in /hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java
Date Mon, 15 Jul 2013 18:25:18 GMT
Author: kihwal
Date: Mon Jul 15 18:25:18 2013
New Revision: 1503397

URL: http://svn.apache.org/r1503397
Log:
HDFS-4984. Incorrect Quota counting in INodeFile. Contributed by Jing Zhao.

Modified:
    hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
    hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java

Modified: hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1503397&r1=1503396&r2=1503397&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Mon Jul
15 18:25:18 2013
@@ -11,6 +11,7 @@ Release 0.23.10 - UNRELEASED
   OPTIMIZATIONS
 
   BUG FIXES
+    HDFS-4984. Incorrect Quota counting in INodeFile. (jing9 via kihwal)
 
 Release 0.23.9 - 2013-07-08
 

Modified: hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java?rev=1503397&r1=1503396&r2=1503397&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java
Mon Jul 15 18:25:18 2013
@@ -208,8 +208,9 @@ public class INodeFile extends INode {
   
   long diskspaceConsumed(Block[] blkArr) {
     long size = 0;
-    if(blkArr == null) 
+    if(blkArr == null || blocks.length == 0) { 
       return 0;
+    }
     
     for (Block blk : blkArr) {
       if (blk != null) {
@@ -219,9 +220,10 @@ public class INodeFile extends INode {
     /* If the last block is being written to, use prefferedBlockSize
      * rather than the actual block size.
      */
-    if (blkArr.length > 0 && blkArr[blkArr.length-1] != null && 
-        isUnderConstruction()) {
-      size += getPreferredBlockSize() - blkArr[blkArr.length-1].getNumBytes();
+    final int last = blkArr.length - 1;
+    if (blkArr.length > 0 && blkArr[last] != null && 
+        blkArr[last] instanceof BlockInfoUnderConstruction) {
+      size += getPreferredBlockSize() - blkArr[last].getNumBytes();
     }
     return size * getReplication();
   }



Mime
View raw message