accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [2/2] git commit: Revert "ACCUMULO-1761 use file size information from !METADATA instead of asking the namenode, avoids using ServerConstants.getTablesDirs()"
Date Wed, 06 Nov 2013 21:30:32 GMT
Revert "ACCUMULO-1761 use file size information from !METADATA instead of asking the namenode,
avoids using ServerConstants.getTablesDirs()"

This reverts commit dcb559165b587eca9e5bf0b64df8031c748d3f37.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/82a5bc25
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/82a5bc25
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/82a5bc25

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 82a5bc25984e2ea6c35842883863931b61e85d77
Parents: f8df8da
Author: Eric Newton <eric.newton@gmail.com>
Authored: Wed Nov 6 16:17:55 2013 -0500
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Wed Nov 6 16:30:51 2013 -0500

----------------------------------------------------------------------
 .../accumulo/server/util/TableDiskUsage.java    | 26 +++++++++++++-------
 1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/82a5bc25/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
b/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
index 2d87a43..b7019e6 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
@@ -43,9 +43,12 @@ import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.util.NumUtil;
+import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.cli.ClientOpts;
 import org.apache.accumulo.server.fs.VolumeManager;
 import org.apache.accumulo.server.fs.VolumeManagerImpl;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
 
@@ -155,13 +158,11 @@ public class TableDiskUsage {
       mdScanner.fetchColumnFamily(DataFileColumnFamily.NAME);
       mdScanner.setRange(new KeyExtent(new Text(tableId), null, null).toMetadataRange());
       
-      Iterator<Entry<Key,Value>> mdIter = mdScanner.iterator();
-      if (!mdIter.hasNext()) {
+      if (!mdScanner.iterator().hasNext()) {
         emptyTableIds.add(tableId);
       }
       
-      while (mdIter.hasNext()) {
-        Entry<Key,Value> entry = mdIter.next();
+      for (Entry<Key,Value> entry : mdScanner) {
         String file = entry.getKey().getColumnQualifier().toString();
         String parts[] = file.split("/");
         String uniqueName = parts[parts.length - 1];
@@ -173,11 +174,18 @@ public class TableDiskUsage {
         }
         
         tdu.linkFileAndTable(tableId, uniqueName);
-        String sizeKeys = entry.getValue().toString();
-        parts = sizeKeys.split(",");
-        // defensive: all file entries should have a size
-        if (parts.length == 2) {
-          tdu.addFileSize(uniqueName, Long.parseLong(parts[0]));
+      }
+    }
+    
+    for (String tableId : tablesReferenced) {
+      for (String tableDir : ServerConstants.getTablesDirs()) {
+        FileStatus[] files = fs.globStatus(new Path(tableDir + "/" + tableId + "/*/*"));
+        if (files != null) {
+          for (FileStatus fileStatus : files) {
+            // Assumes that all filenames are unique
+            String name = fileStatus.getPath().getName();
+            tdu.addFileSize(name, fileStatus.getLen());
+          }
         }
       }
     }


Mime
View raw message