Signed-off-by: Bharath Vissapragada <bharathv@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
parent
a6b0d5bef6
commit
a8190124b6
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue