How to check region size in hbase via java code

Viewed 112

My HBase table is split into 10 different regions. I want to check via Java code if a region contains any data, or what is the size of each region.

I see HRegionLocation, HRegionInfo doesn't have such direct function to get the size of a region.

Has anyone come across such requirement?

1 Answers

This info is available from RegionMetrics.getStoreFileSize(), along with all other region stats in RegionMetrics.
You can go through a long chain of calls like this to get there: Connection > getAdmin() > getClusterMetrics() > getLiveServerMetrics() > getRegionMetrics().

Related