Skip to content

Commit 36e0655

Browse files
Caroline Zhoucaroliney14
authored andcommitted
HBASE-25329 Dump region hashes in logs for the regions that are stuck in transition for more than a configured amount of time
1 parent 8e45165 commit 36e0655

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public interface MetricsAssignmentManagerSource extends BaseSource {
4040
/**
4141
* Description
4242
*/
43-
String METRICS_DESCRIPTION = "Metrics about HBase master assingment manager.";
43+
String METRICS_DESCRIPTION = "Metrics about HBase master assignment manager.";
4444

4545
String RIT_COUNT_NAME = "ritCount";
4646
String RIT_COUNT_OVER_THRESHOLD_NAME = "ritCountOverThreshold";

hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3538,18 +3538,32 @@ public void updateRegionsInTransitionMetrics() {
35383538
int totalRITs = 0;
35393539
int totalRITsOverThreshold = 0;
35403540
long oldestRITTime = 0;
3541+
Map<String, RegionState> ritsOverThreshold = null;
35413542
int ritThreshold = this.server.getConfiguration().
35423543
getInt(HConstants.METRICS_RIT_STUCK_WARNING_THRESHOLD, 60000);
35433544
for (RegionState state: regionStates.getRegionsInTransition()) {
35443545
totalRITs++;
35453546
long ritTime = currentTime - state.getStamp();
35463547
if (ritTime > ritThreshold) { // more than the threshold
35473548
totalRITsOverThreshold++;
3549+
if (ritsOverThreshold == null) {
3550+
ritsOverThreshold = new HashMap<>();
3551+
}
3552+
ritsOverThreshold.put(state.getRegion().getEncodedName(), state);
35483553
}
35493554
if (oldestRITTime < ritTime) {
35503555
oldestRITTime = ritTime;
35513556
}
35523557
}
3558+
if (LOG.isDebugEnabled() && ritsOverThreshold != null && !ritsOverThreshold.isEmpty()) {
3559+
StringBuilder sb = new StringBuilder();
3560+
for (Map.Entry<String, RegionState> regionName: ritsOverThreshold.entrySet()) {
3561+
sb.append(regionName).append(":")
3562+
.append(ritsOverThreshold.get(regionName).getState().name()).append("\n");
3563+
}
3564+
sb.delete(sb.length()-1, sb.length());
3565+
LOG.debug("RITs over threshold: " + sb.toString());
3566+
}
35533567
if (this.metricsAssignmentManager != null) {
35543568
this.metricsAssignmentManager.updateRITOldestAge(oldestRITTime);
35553569
this.metricsAssignmentManager.updateRITCount(totalRITs);

0 commit comments

Comments
 (0)