diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java index 5512e906b67a..819445bd5861 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java @@ -117,8 +117,8 @@ public void setRITCountOverThreshold(final int ritCount) { } @Override - public void setRITOldestAge(final long ritCount) { - ritOldestAgeGauge.set(ritCount); + public void setRITOldestAge(final long ritOldestAge) { + ritOldestAgeGauge.set(ritOldestAge); } @Override diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java index a46f220f6db0..5e06e5a48205 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java @@ -1666,7 +1666,13 @@ protected void update(final AssignmentManager am) { private void update(final Collection regions, final long currentTime) { for (RegionState state : regions) { totalRITs++; - final long ritTime = currentTime - state.getStamp(); + final long ritStartedMs = state.getStamp(); + if (ritStartedMs == 0) { + // Don't output bogus values to metrics if they accidentally make it here. + LOG.warn("The RIT {} has no start time", state.getRegion()); + continue; + } + final long ritTime = currentTime - ritStartedMs; if (ritTime > ritThreshold) { if (ritsOverThreshold == null) { ritsOverThreshold = new HashMap(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java index 2c61d3d427b5..91c0222facd1 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java @@ -178,7 +178,11 @@ public boolean isSplit() { public long getLastUpdate() { TransitRegionStateProcedure proc = this.procedure; - return proc != null ? proc.getLastUpdate() : lastUpdate; + if (proc != null) { + long lastUpdate = proc.getLastUpdate(); + return lastUpdate != 0 ? lastUpdate : proc.getSubmittedTime(); + } + return lastUpdate; } public void setLastHost(final ServerName serverName) {