You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2013/11/06 23:25:57 UTC
[5/8] git commit: Revert "ACCUMULO-1761 use file size information
from !METADATA instead of asking the namenode,
avoids using ServerConstants.getTablesDirs()"
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/master
Commit: 82a5bc25984e2ea6c35842883863931b61e85d77
Parents: f8df8da
Author: Eric Newton <er...@gmail.com>
Authored: Wed Nov 6 16:17:55 2013 -0500
Committer: Eric Newton <er...@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());
+ }
}
}
}