Author: jfrederic.clere(a)jboss.com
Date: 2009-01-27 16:13:18 -0500 (Tue, 27 Jan 2009)
New Revision: 2226
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
Fix the remove node logic: remove context and vhost too.
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-01-27 18:15:24 UTC (rev 2225)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-01-27 21:13:18 UTC (rev 2226)
@@ -52,7 +52,7 @@
#include "sessionid.h"
#define DEFMAXCONTEXT 100
-#define DEFMAXNODE 10
+#define DEFMAXNODE 20
#define DEFMAXHOST 20
#define DEFMAXSESSIONID 512
#define MAXMESSSIZE 1024
@@ -525,7 +525,44 @@
/* All other fields can be modified without causing problems */
return -1;
}
+/*
+ * Remove host and context belonging to the node
+ */
+static void remove_host_context(request_rec *r, int node)
+{
+ /* for read the hosts */
+ int i,j;
+ int size = get_max_size_host(hoststatsmem);
+ int *id = apr_palloc(r->pool, sizeof(int) * size);
+ int sizecontext = get_max_size_context(contextstatsmem);
+ int *idcontext = apr_palloc(r->pool, sizeof(int) * sizecontext);
+
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "remove_host_context processing node: %d", node);
+
+ size = get_ids_used_host(hoststatsmem, id);
+ for (i=0; i<size; i++) {
+ hostinfo_t *ou;
+ int sizecontext;
+ int *idcontext;
+
+ if (get_host(hoststatsmem, &ou, id[i]) != APR_SUCCESS)
+ continue;
+ if (ou->node == node)
+ remove_host(hoststatsmem, ou);
+ }
+
+ sizecontext = get_ids_used_context(contextstatsmem, idcontext);
+ for (i=0; i<sizecontext; i++) {
+ contextinfo_t *context;
+ if (get_context(contextstatsmem, &context, idcontext[i]) != APR_SUCCESS)
+ continue;
+ if (context->node == node)
+ remove_context(contextstatsmem, context);
+ }
+}
+
/*
* Process a CONFIG message
* Balancer: <Balancer name>
@@ -757,6 +794,7 @@
strcpy(node->mess.JVMRoute, "REMOVED");
node->mess.remove = 1;
insert_update_node(nodestatsmem, node, &id);
+ remove_host_context(r, node->mess.id);
*errtype = TYPEMEM;
return MNODERM;
}
Show replies by date