karthikhw commented on a change in pull request #834: HBASE-23237 Negative sign
in requestsPerSecond
URL: https://github.com/apache/hbase/pull/834#discussion_r347523134
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
##########
@@ -709,13 +710,53 @@ synchronized public void run() {
long tempMobScanCellsSize = 0;
long tempBlockedRequestsCount = 0;
int regionCount = 0;
+
+ long tempReadRequestsCount = 0;
+ long tempWriteRequestsCount = 0;
+ long tempRequestsPerSecond = 0;
+ long currentReadRequestsCount = 0;
+ long currentWriteRequestsCount = 0;
+ long lastReadRequestsCount = 0;
+ long lastWriteRequestsCount = 0;
+ long readRequestsDelta = 0;
+ long writeRequestsDelta = 0;
+ long totalReadRequestsDelta = 0;
+ long totalWriteRequestsDelta = 0;
+ String encodedRegionName;
+ ArrayList<String> hregions = new ArrayList<String>();
for (HRegion r : regionServer.getOnlineRegionsLocalContext()) {
+ encodedRegionName = r.getRegionInfo().getEncodedName();
+ hregions.add(encodedRegionName);
+ currentReadRequestsCount = r.getReadRequestsCount();
+ currentWriteRequestsCount = r.getWriteRequestsCount();
+ if (requestsCountCache.containsKey(encodedRegionName)) {
+ lastReadRequestsCount =
requestsCountCache.get(encodedRegionName).get(0);
+ lastWriteRequestsCount =
requestsCountCache.get(encodedRegionName).get(1);
+ readRequestsDelta = currentReadRequestsCount -
lastReadRequestsCount;
+ writeRequestsDelta = currentWriteRequestsCount -
lastWriteRequestsCount;
+ totalReadRequestsDelta += readRequestsDelta;
+ totalWriteRequestsDelta += writeRequestsDelta;
+ tempRequestsPerSecond += readRequestsDelta + writeRequestsDelta;
Review comment:
I thought code readability perspective but you are right
tempRequestsPerSecond is not needed to compute inside the loop. Good cache
@guangxuCheng :)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services