It looks like I can get the middle key like so:
RegionServerServices rss = null;
final List<Region> onlineRegions = rss.getOnlineRegions(tableName);
for (Region region : onlineRegions) {
final List<Store> stores = region.getStores();
for (Store store : stores) {
final long storeSize = store.getSize();
final byte[] splitPoint = store.getSplitPoint();
}
}
}
}
However, there is no way for me to get an HRegion
or a Region
or a RegionServerService
on the client side.
Disclaimer: I am not sure how safe this approach is, since it may put a read-lock on the hfile. I am going to try to use it on snapshots so I'll be ok.
Also you may wish to :
excuse the formatting....
try (Connection connection =
ConnectionFactory.createConnection(hbaseConfig);
Admin admin = connection.getAdmin();) {
final List<HRegionInfo> regionInfoList = admin.getTableRegions(tableName);
HRegionInfo regionInfo = regionInfoList.get(0);
final HRegion region = HRegion.openHRegion(hbaseConfig,
FileSystem.get(hbaseConfig),
new Path("/hbase"),
regionInfo,
table.getTableDescriptor(),
null,
null,
null);
List<Store> stores = region.getStores();
stores.get(0).getSplitPoint();
}