Просмотр исходного кода

HADOOP-1192. Fix an integer overflow bug in FSShell's 'dus' command and a performance problem with HDFS's implementation of it. Contributed by Hairong.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@525229 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 лет назад
Родитель
Сommit
89488b922a

+ 4 - 0
CHANGES.txt

@@ -105,6 +105,10 @@ Release 0.12.3 (not yet released)
  5. HADOOP-1191.  Fix map tasks to wait until sort progress thread has
  5. HADOOP-1191.  Fix map tasks to wait until sort progress thread has
     stopped before reporting the task done.  (Devaraj Das via cutting)
     stopped before reporting the task done.  (Devaraj Das via cutting)
 
 
+ 6. HADOOP-1192.  Fix an integer overflow bug in FSShell's 'dus'
+    command and a performance problem in HDFS's implementation of it.
+    (Hairong Kuang via cutting)
+
 
 
 Release 0.12.2 - 2007-23-17
 Release 0.12.2 - 2007-23-17
 
 

+ 5 - 0
src/java/org/apache/hadoop/dfs/DistributedFileSystem.java

@@ -361,6 +361,11 @@ public class DistributedFileSystem extends ChecksumFileSystem {
       super( new RawDistributedFileSystem(namenode, conf) );
       super( new RawDistributedFileSystem(namenode, conf) );
     }
     }
 
 
+    @Override
+    public long getContentLength(Path f) throws IOException {
+      return fs.getContentLength(f);
+    }
+
     /** Return the total raw capacity of the filesystem, disregarding
     /** Return the total raw capacity of the filesystem, disregarding
      * replication .*/
      * replication .*/
     public long getRawCapacity() throws IOException{
     public long getRawCapacity() throws IOException{

+ 1 - 1
src/java/org/apache/hadoop/fs/FsShell.java

@@ -375,7 +375,7 @@ public class FsShell extends ToolBase {
       for(int i=0; i<paths.length; i++) {
       for(int i=0; i<paths.length; i++) {
         Path items[] = fs.listPaths( paths[i] );
         Path items[] = fs.listPaths( paths[i] );
         if (items != null) {
         if (items != null) {
-          int totalSize=0;
+          long totalSize=0;
           for(int j=0; j<items.length; j++) {
           for(int j=0; j<items.length; j++) {
             totalSize += fs.getContentLength(items[j]);
             totalSize += fs.getContentLength(items[j]);
           }
           }