ACCUMULO-1761 learn table directories from the !METADATA table scan
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/aa26200f Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/aa26200f Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/aa26200f Branch: refs/heads/master Commit: aa26200fa978fdb3554aab189c9cd6724775d7f1 Parents: 82a5bc2 Author: Eric Newton <eric.new...@gmail.com> Authored: Wed Nov 6 16:29:52 2013 -0500 Committer: Eric Newton <eric.new...@gmail.com> Committed: Wed Nov 6 16:30:51 2013 -0500 ---------------------------------------------------------------------- .../java/org/apache/accumulo/server/util/TableDiskUsage.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/aa26200f/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 b7019e6..6b80ccb 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,6 +43,7 @@ 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.core.util.StringUtil; import org.apache.accumulo.server.ServerConstants; import org.apache.accumulo.server.cli.ClientOpts; import org.apache.accumulo.server.fs.VolumeManager; @@ -147,6 +148,7 @@ public class TableDiskUsage { HashSet<String> tablesReferenced = new HashSet<String>(tableIds); HashSet<String> emptyTableIds = new HashSet<String>(); + HashSet<String> nameSpacesReferenced = new HashSet<String>(); for (String tableId : tableIds) { Scanner mdScanner = null; @@ -171,6 +173,10 @@ public class TableDiskUsage { if (!ref.equals(tableId)) { tablesReferenced.add(ref); } + if (file.contains(":") && parts.length > 3) { + List<String> base = Arrays.asList(Arrays.copyOf(parts, parts.length - 3)); + nameSpacesReferenced.add(StringUtil.join(base, "/")); + } } tdu.linkFileAndTable(tableId, uniqueName); @@ -178,7 +184,7 @@ public class TableDiskUsage { } for (String tableId : tablesReferenced) { - for (String tableDir : ServerConstants.getTablesDirs()) { + for (String tableDir : nameSpacesReferenced) { FileStatus[] files = fs.globStatus(new Path(tableDir + "/" + tableId + "/*/*")); if (files != null) { for (FileStatus fileStatus : files) {