HBASE-25329 Dump ritsOverThreshold in logs (#2762) (#2761)

Signed-off-by: Bharath Vissapragada <bharathv@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
caroliney14 2021-01-20 04:51:52 -08:00 committed by GitHub
parent a6b0d5bef6
commit a8190124b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -40,7 +40,7 @@ public interface MetricsAssignmentManagerSource extends BaseSource {
/**
* Description
*/
String METRICS_DESCRIPTION = "Metrics about HBase master assingment manager.";
String METRICS_DESCRIPTION = "Metrics about HBase master assignment manager.";
String RIT_COUNT_NAME = "ritCount";
String RIT_COUNT_OVER_THRESHOLD_NAME = "ritCountOverThreshold";

View File

@ -3538,6 +3538,7 @@ public class AssignmentManager extends ZooKeeperListener {
int totalRITs = 0;
int totalRITsOverThreshold = 0;
long oldestRITTime = 0;
Map<String, RegionState> ritsOverThreshold = null;
int ritThreshold = this.server.getConfiguration().
getInt(HConstants.METRICS_RIT_STUCK_WARNING_THRESHOLD, 60000);
for (RegionState state: regionStates.getRegionsInTransition()) {
@ -3545,11 +3546,24 @@ public class AssignmentManager extends ZooKeeperListener {
long ritTime = currentTime - state.getStamp();
if (ritTime > ritThreshold) { // more than the threshold
totalRITsOverThreshold++;
if (ritsOverThreshold == null) {
ritsOverThreshold = new HashMap<>();
}
ritsOverThreshold.put(state.getRegion().getEncodedName(), state);
}
if (oldestRITTime < ritTime) {
oldestRITTime = ritTime;
}
}
if (LOG.isDebugEnabled() && ritsOverThreshold != null && !ritsOverThreshold.isEmpty()) {
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, RegionState> rit: ritsOverThreshold.entrySet()) {
sb.append(rit.getKey()).append(":")
.append(rit.getValue().getState().name()).append("\n");
}
sb.delete(sb.length()-1, sb.length());
LOG.debug("RITs over threshold: " + sb.toString());
}
if (this.metricsAssignmentManager != null) {
this.metricsAssignmentManager.updateRITOldestAge(oldestRITTime);
this.metricsAssignmentManager.updateRITCount(totalRITs);