[
https://issues.apache.org/jira/browse/TRAFODION-2141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410750#comment-15410750
]
ASF GitHub Bot commented on TRAFODION-2141:
-------------------------------------------
Github user selvaganesang commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/641#discussion_r73793300
--- Diff: core/sql/src/main/java/org/trafodion/sql/TrafRegionStats.java ---
@@ -128,5 +155,90 @@ public TrafRegionStats (HTable table, Admin admin)
throws IOException {
}
}
+
+
+ public TrafRegionStats () throws IOException {
+ Configuration config = HBaseConfiguration.create();
+
+ hbAdmin = new HBaseAdmin(config);
+ }
+
+ public boolean Open () throws IOException {
+
+ clusterStatus = hbAdmin.getClusterStatus();
+ servers = clusterStatus.getServers();
+ iterServer = servers.iterator();
+
+ firstTime = true;
+
+ return true;
+ }
+
+ public boolean GetNextServer () throws IOException {
+
+ if (! iterServer.hasNext())
+ return false;
+
+ server = (ServerName)iterServer.next();
+ serverLoad = clusterStatus.getLoad(server);
+
+ return true;
+ }
+
+ public boolean GetNextRegion () throws IOException {
+
+ if ((firstTime) || (! iterRegion.hasNext())) {
+ firstTime = false;
+ if (! GetNextServer())
+ return false;
+ else
+ iterRegion =
serverLoad.getRegionsLoad().values().iterator();
+ }
+
+ RegionLoad regionLoad = (RegionLoad)iterRegion.next();
+
+ byte[] regionId = regionLoad.getName();
+
+ int numStores = regionLoad.getStores();
+ int numStoreFiles = regionLoad.getStorefiles();
+ Long storeUncompSizeBytes =
regionLoad.getStoreUncompressedSizeMB() * megaByte;
+ Long storeFileSizeBytes = regionLoad.getStorefileSizeMB() *
megaByte;
+ Long memStoreSizeBytes = regionLoad.getMemStoreSizeMB() * megaByte;
+
+ // this method is available in HBase 2.0.0
+ // Long lastMajorCompactionTs =
regionLoad.getLastMajorCompactionTs();
+
+ byte[][] regNameParts =
HRegionInfo.parseRegionName(regionLoad.getName());
+
+ currRegionSizeInfo = new SizeInfo();
+
+ currRegionSizeInfo.serverName = new String(server.toShortString());
+ currRegionSizeInfo.regionName = new String(regNameParts[2]);
+
+
+ currRegionSizeInfo.tableName = new String(regNameParts[0]);
+ currRegionSizeInfo.numStores = numStores;
+ currRegionSizeInfo.numStoreFiles = numStoreFiles;
+ currRegionSizeInfo.storeUncompSize = storeUncompSizeBytes;
+ currRegionSizeInfo.storeFileSize = storeFileSizeBytes;
+ currRegionSizeInfo.memStoreSize = memStoreSizeBytes;
+
+ currRegionSizeInfo.readRequestsCount =
regionLoad.getReadRequestsCount();
+ currRegionSizeInfo.writeRequestsCount =
regionLoad.getWriteRequestsCount();
+
+ return true;
+ }
+
+ public SizeInfo getCurrRegionSizeInfo() {
+ return currRegionSizeInfo;
+ }
+
+ public boolean Close () throws IOException {
+
--- End diff --
Connection.getAdmin is a light weight operation. There is no need to make
hbadmin as class member and then close it.
> Provide cluster view of region stats over all regions.
> ------------------------------------------------------
>
> Key: TRAFODION-2141
> URL: https://issues.apache.org/jira/browse/TRAFODION-2141
> Project: Apache Trafodion
> Issue Type: Improvement
> Reporter: Anoop Sharma
> Assignee: Anoop Sharma
> Priority: Minor
>
> Add support to return hbase stats over all regions and region
> servers by providing cluster view of returned stats.
> In addition, add a new column, region_server, to current region
> stats virtual table.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)