HBASE-21785 master reports open regions as RITs and also messes up rit age metric

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
Sergey Shelukhin 2019-02-12 12:53:17 -08:00
parent 5049f460b8
commit 9ef6bc4323
3 changed files with 14 additions and 4 deletions

View File

@ -82,8 +82,8 @@ public class MetricsAssignmentManagerSourceImpl
}
@Override
public void setRITOldestAge(final long ritCount) {
ritOldestAgeGauge.set(ritCount);
public void setRITOldestAge(final long ritOldestAge) {
ritOldestAgeGauge.set(ritOldestAge);
}
@Override

View File

@ -1195,7 +1195,13 @@ public class AssignmentManager {
private void update(final Collection<RegionState> 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<String, RegionState>();

View File

@ -169,7 +169,11 @@ public class RegionStateNode implements Comparable<RegionStateNode> {
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) {