accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Turner <ke...@deenlo.com>
Subject Re: Tablet count per table [SEC=UNOFFICIAL]
Date Tue, 24 Jan 2017 16:48:14 GMT
There are two operations you can use in the public API to get these
counts.  The following code shows a sketch of what I am thinking,
however I have not tested it.

Connector conn = ....
long sum = 0;
for(String table : conn.tableOperations().tableIdMap().keys()){
   // the number of tablets in a table is the number of splits plus one
   sum += conn.tableOperations().listSplits(table, Integer.MAX_INT).size() + 1;
}

The nice thing about this approach is that it uses public API, so you
are not impacted by changes in the metadata table schema.  However, a
possible downside is that it reads all splits into memory.  So if a
tables splits would not fit into memory, thats not good.   The
scanning approaches suggested by others will not have this memory
problem, but you may have to change your code if the metadata schema
changes.

The Accumulo shell has analogues for listing tables and listing a tables splits.

[1]: http://accumulo.apache.org/1.8/apidocs/org/apache/accumulo/core/client/admin/TableOperations.html#locate%28java.lang.String,%20java.util.Collection%29

On Mon, Jan 23, 2017 at 11:30 PM, Dickson, Matt MR
<matt.dickson@defence.gov.au> wrote:
> UNOFFICIAL
>
> Is there a way to query to the metadata table to quickly get a list of the
> number of tablets for all tables in an Accumulo instance?
>
> I'd like to do this to integrate into existing monitoring tools rather than
> go to the Accumulo gui.
>
> Thanks in advance

Mime
View raw message