virajjasani commented on a change in pull request #2762: URL: https://github.com/apache/hbase/pull/2762#discussion_r556369037
########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java ########## @@ -3538,18 +3538,31 @@ public void updateRegionsInTransitionMetrics() { int totalRITs = 0; int totalRITsOverThreshold = 0; long oldestRITTime = 0; + HashMap<String, RegionState> ritsOverThreshold = null; int ritThreshold = this.server.getConfiguration(). getInt(HConstants.METRICS_RIT_STUCK_WARNING_THRESHOLD, 60000); for (RegionState state: regionStates.getRegionsInTransition()) { totalRITs++; long ritTime = currentTime - state.getStamp(); if (ritTime > ritThreshold) { // more than the threshold totalRITsOverThreshold++; + if (ritsOverThreshold == null) { + ritsOverThreshold = new HashMap<String, RegionState>(); + } + ritsOverThreshold.put(state.getRegion().getEncodedName(), state); } if (oldestRITTime < ritTime) { oldestRITTime = ritTime; } } + if (LOG.isDebugEnabled() && ritsOverThreshold != null && !ritsOverThreshold.isEmpty()) { + StringBuilder sb = new StringBuilder(); + for (String regionName: ritsOverThreshold.keySet()) { + sb.append(regionName + ":" + ritsOverThreshold.get(regionName).getState().name() + "\n"); + } + sb.delete(sb.length()-2, sb.length()); Review comment: Do we want to remove last appended new line char? If so, start index should be `sb.length()-1` right? ########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java ########## @@ -3538,18 +3538,31 @@ public void updateRegionsInTransitionMetrics() { int totalRITs = 0; int totalRITsOverThreshold = 0; long oldestRITTime = 0; + HashMap<String, RegionState> ritsOverThreshold = null; int ritThreshold = this.server.getConfiguration(). getInt(HConstants.METRICS_RIT_STUCK_WARNING_THRESHOLD, 60000); for (RegionState state: regionStates.getRegionsInTransition()) { totalRITs++; long ritTime = currentTime - state.getStamp(); if (ritTime > ritThreshold) { // more than the threshold totalRITsOverThreshold++; + if (ritsOverThreshold == null) { + ritsOverThreshold = new HashMap<String, RegionState>(); + } + ritsOverThreshold.put(state.getRegion().getEncodedName(), state); } if (oldestRITTime < ritTime) { oldestRITTime = ritTime; } } + if (LOG.isDebugEnabled() && ritsOverThreshold != null && !ritsOverThreshold.isEmpty()) { + StringBuilder sb = new StringBuilder(); + for (String regionName: ritsOverThreshold.keySet()) { + sb.append(regionName + ":" + ritsOverThreshold.get(regionName).getState().name() + "\n"); Review comment: nit: use chain of append() to cover String concatenation? ``` sb.append(regionName).append(":") .append(ritsOverThreshold.get(regionName).getState().name()).append("\n"); ``` ########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java ########## @@ -3538,18 +3538,31 @@ public void updateRegionsInTransitionMetrics() { int totalRITs = 0; int totalRITsOverThreshold = 0; long oldestRITTime = 0; + HashMap<String, RegionState> ritsOverThreshold = null; int ritThreshold = this.server.getConfiguration(). getInt(HConstants.METRICS_RIT_STUCK_WARNING_THRESHOLD, 60000); for (RegionState state: regionStates.getRegionsInTransition()) { totalRITs++; long ritTime = currentTime - state.getStamp(); if (ritTime > ritThreshold) { // more than the threshold totalRITsOverThreshold++; + if (ritsOverThreshold == null) { + ritsOverThreshold = new HashMap<String, RegionState>(); Review comment: nit: `new HashMap<>()` ---------------------------------------------------------------- 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: us...@infra.apache.org