metaHRIs.remove(rs.getRegion());
}
}
for (Map.Entry<HRegionInfo, Result> e : metaHRIs.entrySet()) {
RegionState rit = services.getAssignmentManager().getRegionsInTransition().get(
e.getKey().getEncodedName());
AssignmentManager assignmentManager = this.services.getAssignmentManager();
if (processDeadRegion(e.getKey(), e.getValue(), assignmentManager,
this.server.getCatalogTracker())) {
ServerName addressFromAM = assignmentManager.getRegionServerOfRegion(e.getKey());
if (rit != null && !rit.isClosing() && !rit.isPendingClose() && !rit.isSplitting()
&& !ritsGoingToServer.contains(e.getKey())) {
// 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());
ritsGoingToServer.remove(e.getKey());
} else {
if (rit != null) {
// clean zk node
try {
LOG.info("Reassigning region with rs =" + rit + " and deleting zk node if exists");
ZKAssign.deleteNodeFailSilent(services.getZooKeeper(), e.getKey());
} catch (KeeperException ke) {
this.server.abort("Unexpected ZK exception deleting unassigned node " + e.getKey(),
ke);
return null;
}
}
toAssign.add(e.getKey());
}
} 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 = assignmentManager;
am.regionOffline(region);
ritsGoingToServer.remove(region);
}
// If the table was partially disabled and the RS went down, we should clear the RIT