trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From selvaganesang <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #641: [JIRA TRAFODION-2141] Cluster view of...
Date Sat, 06 Aug 2016 23:04:47 GMT
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.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message