HRegion r = null;
synchronized (this.onlineRegions) {
r = this.onlineRegions.get(encodedRegionName);
}
if (r == null) return null;
ObjectMapper mapper = new ObjectMapper();
int stores = 0;
int storefiles = 0;
int storefileSizeMB = 0;
int memstoreSizeMB = (int) (r.memstoreSize.get() / 1024 / 1024);
int storefileIndexSizeMB = 0;
long totalCompactingKVs = 0;
long currentCompactedKVs = 0;
synchronized (r.stores) {
stores += r.stores.size();
for (Store store : r.stores.values()) {
storefiles += store.getStorefilesCount();
storefileSizeMB += (int) (store.getStorefilesSize() / 1024 / 1024);
storefileIndexSizeMB += (int) (store.getStorefilesIndexSize() / 1024 / 1024);
}
}
Map<String, Integer> map = new TreeMap<String, Integer>();
map.put("stores", stores);
map.put("storefiles", storefiles);
map.put("storefileSizeMB", storefileIndexSizeMB);
map.put("memstoreSizeMB", memstoreSizeMB);
StringWriter w = new StringWriter();
mapper.writeValue(w, map);
w.close();
return Bytes.toBytes(w.toString());
}