private void verifyMembershipInfo(Protocol protocol)
throws IOException,
DatabaseException,
ExitException {
NodeGroupInfo nodeGroup =
(Protocol.NodeGroupInfo)(protocol.read(namedChannel));
final RepGroupImpl group = repNode.getGroup();
RepNodeImpl node = group.getNode(nodeGroup.getNodeName());
try {
if (nodeGroup.getNodeId() != replicaNameIdPair.getId()) {
throw new ExitException
("The replica node ID sent during protocol negotiation: " +
replicaNameIdPair +
" differs from the one sent in the MembershipInfo " +
"request: " + nodeGroup.getNodeId());
}
if (node == null) {
/* Not currently a member. */
try {
repNode.getRepGroupDB().ensureMember(nodeGroup);
node =
repNode.getGroup().getMember(nodeGroup.getNodeName());
if (node == null) {
throw EnvironmentFailureException.unexpectedState
("Node: " + nodeGroup.getNameIdPair() +
" not found");
}
} catch (InsufficientReplicasException e) {
throw new ExitException(e);
} catch (InsufficientAcksException e) {
throw new ExitException(e);
} catch (NodeConflictException e) {
throw new ExitException(e);
}
} else if (node.isRemoved()) {
throw new ExitException
("Node: " + nodeGroup.getNameIdPair() +
" is no longer a member of the group." +
" It was explicitly removed.");
}
doGroupChecks(nodeGroup, group);