Package org.apache.accumulo.server.util
Class TableDiskUsage
java.lang.Object
org.apache.accumulo.server.util.TableDiskUsage
This utility class will scan the Accumulo Metadata table to compute the disk usage for a table or
table(s) by using the size value stored in columns that contain the column family
MetadataSchema.TabletsSection.DataFileColumnFamily
.
This class will also track shared files to computed shared usage across all tables that are
provided as part of the Set of tables when getting disk usage.
Because the metadata table is used for computing usage and not the actual files in HDFS the
results will be an estimate. Older entries may exist with no file metadata (resulting in size 0)
and other actions in the cluster can impact the estimated size such as flushes, tablet splits,
compactions, etc.
For more accurate information a compaction should first be run on all files for the set of tables
being computed.-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildSharedUsageMap
(TableDiskUsage tdu, ClientContext clientContext, Set<TableId> emptyTableIds) getDiskUsage
(Set<TableId> tableIds, AccumuloClient client) Compute the estimated disk usage for the given set of tables by scanning the Metadata table for file sizes.static void
static void
printDiskUsage
(Collection<String> tableNames, AccumuloClient client, boolean humanReadable) static void
printDiskUsage
(Collection<String> tableNames, AccumuloClient client, TableDiskUsage.Printer printer, boolean humanReadable)
-
Constructor Details
-
TableDiskUsage
public TableDiskUsage()
-
-
Method Details
-
printDiskUsage
public static void printDiskUsage(Collection<String> tableNames, AccumuloClient client, boolean humanReadable) throws TableNotFoundException, IOException - Throws:
TableNotFoundException
IOException
-
getDiskUsage
public static Map<SortedSet<String>,Long> getDiskUsage(Set<TableId> tableIds, AccumuloClient client) throws TableNotFoundException Compute the estimated disk usage for the given set of tables by scanning the Metadata table for file sizes. Optionally computes shared usage across tables.- Parameters:
tableIds
- set of tables to compute an estimated disk usage forclient
- accumulo client used to scan- Returns:
- the computed estimated usage results
- Throws:
TableNotFoundException
- if the table(s) do not exist
-
printDiskUsage
public static void printDiskUsage(Collection<String> tableNames, AccumuloClient client, TableDiskUsage.Printer printer, boolean humanReadable) throws TableNotFoundException, IOException - Throws:
TableNotFoundException
IOException
-
main
- Throws:
Exception
-