if (egis != null) {
EntityGroupStates entityGroupStates = assignmentManager
.getEntityGroupStates();
List<EntityGroupInfo> toAssignEntityGroups = new ArrayList<EntityGroupInfo>();
for (Map.Entry<EntityGroupInfo, Result> e : egis.entrySet()) {
EntityGroupInfo egi = e.getKey();
EntityGroupState egit = entityGroupStates
.getEntityGroupTransitionState(egi);
if (processDeadEntityGroup(egi, e.getValue(), assignmentManager,
server)) {
ServerName addressFromAM = entityGroupStates
.getFServerOfEntityGroup(egi);
if (addressFromAM != null && !addressFromAM.equals(this.serverName)) {
// If this entityGroup is in transition on the dead server, it
// must be
// opening or pending_open, which is covered by
// AM#processServerShutdown
LOG.debug("Skip assigning entityGroup "
+ egi.getEntityGroupNameAsString()
+ " because it has been opened in "
+ addressFromAM.getServerName());
continue;
}
if (egit != null) {
if (!egit.isOnServer(serverName) || egit.isClosed()
|| egit.isOpened() || egit.isSplit()) {
// Skip entityGroups that are in transition on other server,
// or in state closed/opened/split
LOG.info("Skip assigning entityGroup " + egit);
continue;
}
try {
// clean zk node
LOG.info("Reassigning entityGroup with eg = " + egit
+ " and deleting zk node if exists");
ZKAssign.deleteNodeFailSilent(server.getZooKeeper(), egi);
} catch (KeeperException ke) {
this.server.abort(
"Unexpected ZK exception deleting unassigned node " + egi,
ke);
return;
}
}
toAssignEntityGroups.add(egi);
} else if (egit != null) {
if (egit.isSplitting() || egit.isSplit()) {
// This will happen when the FServer went down and the call back
// for
// the SPLIITING or SPLIT
// has not yet happened for node Deleted event. In that case if
// the EntityGroup was actually
// split
// but the FServer had gone down before completing the split
// process
// then will not try to
// assign the parent EntityGroup again. In that case we should
// make the
// EntityGroup offline and
// also delete the EntityGroup from EGIT.
assignmentManager.entityGroupOffline(egi);
} else if ((egit.isClosing() || egit.isPendingClose())
&& assignmentManager.getZKTable().isDisablingOrDisabledTable(
egi.getTableNameAsString())) {
// If the table was partially disabled and the FServer went down,
// we
// should clear the EGIT
// and remove the node for the EntityGroup.
// The egit that we use may be stale in case the table was in