Skip to content

Commit

Permalink
HBASE-28652 Backport HBASE-21785 master reports open regions as RITs …
Browse files Browse the repository at this point in the history
…and also messes up rit age metric (#5978)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Andrew Purtell <apurtell@apache.org>
Co-authored-by: Sergey Shelukhin <sershe@apache.org>
  • Loading branch information
szucsvillo and sershe-apache authored Jun 11, 2024
1 parent 5bcd60c commit e865c85
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,13 @@ protected void update(final AssignmentManager am) {
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>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e865c85

Please sign in to comment.