The way we do it is here is by reading the jmx metrics (in java via
javax.management.remote) that the region server outputs instead of
querying directly the region server. What you are doing is kinda
hacky.

J-D

On Sat, Sep 22, 2012 at 7:58 AM, Ioakim Perros <[email protected]> wrote:
> Hi,
>
> I would like to programmatically major compact a table's regions, but I
> would like to check if major compaction ended (i.e.: compaction queue size
> goes to zero).
>
> I tried to do it through the following code but it failed throwing a null
> pointer exc.
>
> HBaseAdmin admin = new HBaseAdmin(config);
> admin.majorCompact("myTable");
> admin.close();
> HRegionServer hr = new HRegionServer(config);
> try {
>        if ( ! (hr.getMetrics().compactionQueueSize.get()==0)  ){
>             System.out.println( hr.getMetrics().compactionQueueSize.get() );
>             Thread.sleep(1000);
>       }
> } catch(InterruptedException ex) {
>        Thread.currentThread().interrupt();
> }
>
> Does anyone know how to correctly check this?
>
> Thanks in advance,
> IP

Reply via email to