" regions(s) that are already in transition)");
// Iterate regions that were on this server and assign them
if (hris != null) {
for (Map.Entry<HRegionInfo, Result> e: hris.entrySet()) {
RegionState rit = this.services.getAssignmentManager().isRegionInTransition(e.getKey());
if (processDeadRegion(e.getKey(), e.getValue(),
this.services.getAssignmentManager(),
this.server.getCatalogTracker())) {
ServerName addressFromAM = this.services.getAssignmentManager()
.getRegionServerOfRegion(e.getKey());
if (rit != null && !rit.isClosing() && !rit.isPendingClose() && !rit.isSplitting()) {
// Skip regions that were in transition unless CLOSING or
// PENDING_CLOSE
LOG.info("Skip assigning region " + rit.toString());
} else if (addressFromAM != null
&& !addressFromAM.equals(this.serverName)) {
LOG.debug("Skip assigning region "
+ e.getKey().getRegionNameAsString()
+ " because it has been opened in "
+ addressFromAM.getServerName());
} else {
this.services.getAssignmentManager().assign(e.getKey(), true);
}
} else if (rit != null && (rit.isSplitting() || rit.isSplit())) {
// This will happen when the RS went down and the call back for the SPLIITING or SPLIT
// has not yet happened for node Deleted event. In that case if the region was actually split
// but the RS had gone down before completing the split process then will not try to
// assign the parent region again. In that case we should make the region offline and
// also delete the region from RIT.
HRegionInfo region = rit.getRegion();
AssignmentManager am = this.services.getAssignmentManager();
am.regionOffline(region);
}
// If the table was partially disabled and the RS went down, we should clear the RIT
// and remove the node for the region.
// The rit that we use may be stale in case the table was in DISABLING state
// but though we did assign we will not be clearing the znode in CLOSING state.
// Doing this will have no harm. See HBASE-5927
if (rit != null
&& (rit.isClosing() || rit.isPendingClose())
&& this.services.getAssignmentManager().getZKTable()
.isDisablingOrDisabledTable(rit.getRegion().getTableNameAsString())) {
HRegionInfo hri = rit.getRegion();
AssignmentManager am = this.services.getAssignmentManager();
am.deleteClosingOrClosedNode(hri);
am.regionOffline(hri);
}
}