Skip to content

Commit

Permalink
0001803: Removing a node using engine.removeAndCleanupNode method on …
Browse files Browse the repository at this point in the history
…a master to master cluster does not send the remove to other nodes
  • Loading branch information
chenson42 committed Jul 11, 2014
1 parent ededc06 commit a5170c9
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,19 @@ protected void routeNodeTables(Set<String> nodeIds, Map<String, String> columnVa
NetworkedNode rootNetworkedNode, Node me, SimpleRouterContext routingContext,
DataMetaData dataMetaData, Set<Node> possibleTargetNodes, boolean initialLoad) {
String nodeIdInQuestion = columnValues.get("NODE_ID");
if (!(me.getNodeId().equals(nodeIdInQuestion) && dataMetaData.getData().getDataEventType() == DataEventType.DELETE))
{
if (dataMetaData.getData().getDataEventType() == DataEventType.DELETE) {
String createAtNodeId = columnValues.get("CREATED_AT_NODE_ID");
for (Node nodeThatMayBeRoutedTo : possibleTargetNodes) {
if (!Constants.DEPLOYMENT_TYPE_REST.equals(nodeThatMayBeRoutedTo
.getDeploymentType())
&& !nodeIdInQuestion.equals(nodeThatMayBeRoutedTo.getNodeId())
&& !nodeThatMayBeRoutedTo.getNodeId().equals(createAtNodeId)
&& (nodeThatMayBeRoutedTo.getCreatedAtNodeId() == null || !nodeThatMayBeRoutedTo
.getCreatedAtNodeId().equals(nodeIdInQuestion))) {
nodeIds.add(nodeThatMayBeRoutedTo.getNodeId());
}
}
} else {
List<NodeGroupLink> nodeGroupLinks = getNodeGroupLinksFromContext(routingContext);
for (Node nodeThatMayBeRoutedTo : possibleTargetNodes) {
if (!Constants.DEPLOYMENT_TYPE_REST.equals(nodeThatMayBeRoutedTo
Expand Down Expand Up @@ -256,15 +267,14 @@ && isLinked(nodeIdInQuestion, nodeThatMayBeRoutedTo, rootNetworkedNode, me,
}

/*
* Don't route insert events for a node to itself. they will be
* Don't route insert events for a node to itself. They will be
* loaded during registration. If we route them, then an old
* state can override the correct state
*
* Don't send deletes to a node. A node should be responsible
* for deleting itself.
*/
if (dataMetaData.getData().getDataEventType() == DataEventType.INSERT
|| dataMetaData.getData().getDataEventType() == DataEventType.DELETE) {
if (dataMetaData.getData().getDataEventType() == DataEventType.INSERT) {
nodeIds.remove(nodeIdInQuestion);
}
}
Expand Down Expand Up @@ -413,6 +423,7 @@ private boolean isLinked(String nodeIdInQuestion, Node nodeThatCouldBeRoutedTo,
} else {
return false;
}

} else {
return true;
}
Expand Down

0 comments on commit a5170c9

Please sign in to comment.