Author: jfrederic.clere(a)jboss.com
Date: 2008-10-01 10:46:13 -0400 (Wed, 01 Oct 2008)
New Revision: 1924
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
Accept to recreate the node after removal when it is still here and the same.
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-10-01 14:24:40 UTC (rev 1923)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-10-01 14:46:13 UTC (rev 1924)
@@ -432,7 +432,31 @@
remove_context(mem, &info);
return ret;
}
+/*
+ * Check that the node could be handle as is there were the same.
+ */
+static int is_same_node(nodeinfo_t *nodeinfo, nodeinfo_t *node) {
+ if (strcmp(nodeinfo->mess.balancer,node->mess.balancer))
+ return 0;
+ if (strcmp(nodeinfo->mess.Host, node->mess.Host))
+ return 0;
+ if (strcmp(nodeinfo->mess.Port,node->mess.Port))
+ return 0;
+ if (strcmp(nodeinfo->mess.Type, node->mess.Type))
+ return 0;
+ if (nodeinfo->mess.reversed != node->mess.reversed)
+ return 0;
+ /* Those means the reslist has to be changed */
+ if (nodeinfo->mess.smax != node->mess.smax)
+ return 0;
+ if (nodeinfo->mess.ttl != node->mess.ttl)
+ return 0;
+
+ /* All other fields can be modified without causing problems */
+ return -1;
+}
+
/*
* Process a CONFIG message
* Balancer: <Balancer name>
@@ -649,10 +673,13 @@
/* check for removed node */
node = read_node(nodestatsmem, &nodeinfo);
if (node != NULL && node->mess.remove) {
- /* Here we can't update it because the old one is still in */
- strcpy(node->mess.JVMRoute, "REMOVED");
- *errtype = TYPEMEM;
- return MNODERM;
+ /* If the node is removed and recreated unchanged that is ok: network problems
*/
+ if (! is_same_node(node, &nodeinfo)) {
+ /* Here we can't update it because the old one is still in */
+ strcpy(node->mess.JVMRoute, "REMOVED");
+ *errtype = TYPEMEM;
+ return MNODERM;
+ }
}
/* Insert or update node description */
Show replies by date