JBoss Native SVN: r2168 - trunk/mod_cluster/native/mod_manager.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-01-15 05:39:14 -0500 (Thu, 15 Jan 2009)
New Revision: 2168
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
Improve the "status" page.
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-01-14 19:32:26 UTC (rev 2167)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-01-15 10:39:14 UTC (rev 2168)
@@ -27,6 +27,7 @@
#include "apr_strings.h"
#include "apr_lib.h"
+#include "apr_uuid.h"
#define CORE_PRIVATE
#include "httpd.h"
@@ -97,6 +98,8 @@
module AP_MODULE_DECLARE_DATA manager_module;
+static char balancer_nonce[APR_UUID_FORMATTED_LENGTH + 1];
+
typedef struct mod_manager_config
{
/* base name for the shared memory */
@@ -320,6 +323,7 @@
char *sessionid;
void *data;
const char *userdata_key = "mod_manager_init";
+ apr_uuid_t uuid;
mod_manager_config *mconf = ap_get_module_config(s->module_config, &manager_module);
apr_pool_userdata_get(&data, userdata_key, s->process->pool);
if (!data) {
@@ -385,6 +389,13 @@
if (balancerhandler == NULL) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, s, "can't find a ping/pong logic");
}
+
+ /*
+ * Retrieve a UUID and store the nonce.
+ */
+ apr_uuid_get(&uuid);
+ apr_uuid_format(balancer_nonce, &uuid);
+
return OK;
}
static char **process_buff(request_rec *r, char *buff)
@@ -1255,7 +1266,166 @@
return DECLINED;
}
+/*
+ * Process the parameter and display corresponding information.
+ */
+static void manager_info_contexts(request_rec *r, int node, int host)
+{
+ int size, i;
+ int *id;
+ /* Process the Contexts */
+ ap_rprintf(r, "<h3>Contexts:</h3>");
+ ap_rprintf(r, "<pre>");
+ size = get_max_size_context(contextstatsmem);
+ id = apr_palloc(r->pool, sizeof(int) * size);
+ size = get_ids_used_context(contextstatsmem, id);
+ for (i=0; i<size; i++) {
+ contextinfo_t *ou;
+ char *status;
+ get_context(contextstatsmem, &ou, id[i]);
+ if (ou->node != node && ou->vhost != host)
+ continue;
+ status = "REMOVED";
+ switch (ou->status) {
+ case ENABLED:
+ status = "ENABLED";
+ break;
+ case DISABLED:
+ status = "DISABLED";
+ break;
+ case STOPPED:
+ status = "STOPPED";
+ break;
+ }
+ ap_rprintf(r, "%s, Status: %s\n", ou->context, status);
+ }
+ ap_rprintf(r, "</pre>");
+}
+static void manager_info_hosts(request_rec *r, int node)
+{
+ int size, i;
+ int *id;
+ int vhost = 0;
+ /* Process the Vhosts */
+ size = get_max_size_host(hoststatsmem);
+ id = apr_palloc(r->pool, sizeof(int) * size);
+ size = get_ids_used_host(hoststatsmem, id);
+ for (i=0; i<size; i++) {
+ hostinfo_t *ou;
+ get_host(hoststatsmem, &ou, id[i]);
+ if (ou->node != node)
+ continue;
+ if (ou->vhost != vhost) {
+ if (vhost)
+ ap_rprintf(r, "</pre>");
+ ap_rprintf(r, "<h2> Virtual Host %d:</h2>", ou->vhost);
+ manager_info_contexts(r, ou->node, ou->vhost);
+ ap_rprintf(r, "<h3>Aliases:</h3>");
+ ap_rprintf(r, "<pre>");
+ vhost = ou->vhost;
+ }
+ ap_rprintf(r, "%s\n", ou->host);
+ }
+ ap_rprintf(r, "</pre>");
+
+}
+static int manager_info(request_rec *r)
+{
+ int size, i;
+ int *id;
+ apr_table_t *params = apr_table_make(r->pool, 10);
+ int access_status;
+ const char *name;
+
+ if (r->args) {
+ char *args = apr_pstrdup(r->pool, r->args);
+ char *tok, *val;
+ while (args && *args) {
+ if ((val = ap_strchr(args, '='))) {
+ *val++ = '\0';
+ if ((tok = ap_strchr(val, '&')))
+ *tok++ = '\0';
+ /*
+ * Special case: contexts contain path information
+ */
+ if ((access_status = ap_unescape_url(val)) != OK)
+ if (strcmp(args, "context") || (access_status != HTTP_NOT_FOUND))
+ return access_status;
+ apr_table_setn(params, args, val);
+ args = tok;
+ }
+ else
+ return HTTP_BAD_REQUEST;
+ }
+ }
+
+ /*
+ * Check that the supplied nonce matches this server's nonce;
+ * otherwise ignore all parameters, to prevent a CSRF attack.
+ */
+ if ((name = apr_table_get(params, "nonce")) == NULL
+ || strcmp(balancer_nonce, name) != 0) {
+ apr_table_clear(params);
+ }
+
+ /* process the parameters */
+ if (r->args) {
+ /* Process the Refresh parameter */
+ const char *val = apr_table_get(params, "Refresh");
+ if (val) {
+ long t = atol(val);
+ apr_table_set(r->headers_out, "Refresh", apr_ltoa(r->pool,t < 1 ? 10 : t));
+ }
+ }
+
+ ap_set_content_type(r, "text/html; charset=ISO-8859-1");
+ ap_rputs(DOCTYPE_HTML_3_2
+ "<html><head>\n<title>Mod_cluster Status</title>\n</head><body>\n",
+ r);
+ ap_rvputs(r, "<a href=\"", r->uri, "?nonce=", balancer_nonce,
+ "&refresh=10",
+ "\">Auto Refresh</a>", NULL);
+
+ ap_rputs("<pre>", r);
+ size = get_max_size_node(nodestatsmem);
+ id = apr_palloc(r->pool, sizeof(int) * size);
+ size = get_ids_used_node(nodestatsmem, id);
+ for (i=0; i<size; i++) {
+ nodeinfo_t *ou;
+ proxy_worker_stat *proxystat;
+ char *flushpackets;
+ get_node(nodestatsmem, &ou, id[i]);
+ ap_rprintf(r, "<h1> Node %s (%s://%s:%s):</h1>\n",
+ ou->mess.JVMRoute, ou->mess.Type, ou->mess.Host, ou->mess.Port);
+
+ ap_rprintf(r, "Balancer: %s,Domain: %s", ou->mess.balancer, ou->mess.Domain);
+
+ flushpackets = "Off";
+ switch (ou->mess.flushpackets) {
+ case flush_on:
+ flushpackets = "On";
+ break;
+ case flush_auto:
+ flushpackets = "Auto";
+ }
+ ap_rprintf(r, ",Flushpackets: %s,Flushwait: %d,Ping: %d,Smax: %d,Ttl: %d",
+ flushpackets, ou->mess.flushwait,
+ ou->mess.ping, ou->mess.smax, ou->mess.ttl);
+ proxystat = (proxy_worker_stat *) ou->stat;
+ ap_rprintf(r, ",Elected: %d,Read: %d,Transfered: %d,Connected: %d,Load: %d\n",
+ proxystat->elected, proxystat->read, proxystat->transferred,
+ proxystat->busy, proxystat->lbfactor);
+
+ /* Process the Vhosts */
+ manager_info_hosts(r, id[i]);
+ }
+
+
+ ap_rputs("</body></html>\n", r);
+ return OK;
+}
+
/* Process the requests from the ModClusterService */
static int manager_handler(request_rec *r)
{
@@ -1270,10 +1440,7 @@
/* Display the nodes information */
if (r->method_number != M_GET)
return DECLINED;
- process_info(r, NULL, NULL);
- /* refresh it every 10 seconds */
- apr_table_set(r->headers_out, "Refresh", "10");
- return OK;
+ return(manager_info(r));
}
if (strcmp(r->handler, "mod-cluster"))
15 years, 11 months
JBoss Native SVN: r2167 - trunk/mod_cluster/src/main/resources.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-01-14 14:32:26 -0500 (Wed, 14 Jan 2009)
New Revision: 2167
Modified:
trunk/mod_cluster/src/main/resources/mod-cluster-jboss-beans.xml
Log:
[MODCLUSTER-36] Add a system property for specifying the proxyList
Modified: trunk/mod_cluster/src/main/resources/mod-cluster-jboss-beans.xml
===================================================================
--- trunk/mod_cluster/src/main/resources/mod-cluster-jboss-beans.xml 2009-01-14 14:23:20 UTC (rev 2166)
+++ trunk/mod_cluster/src/main/resources/mod-cluster-jboss-beans.xml 2009-01-14 19:32:26 UTC (rev 2167)
@@ -21,7 +21,7 @@
<!-- Comma separated list of address:port listing the httpd servers
where mod_cluster is running. -->
- <!--property name="proxyList"></property-->
+ <property name="proxyList">${jboss.modcluster.proxyList}</property>
<!-- URL prefix to send with commands to mod_cluster. Default is no prefix. -->
<!--property name="proxyURL"></property-->
@@ -112,7 +112,7 @@
</constructor>
<!-- Comma separated list of address:port listing the httpd servers
where mod_cluster is running. -->
- <!--property name="proxyList"></property-->
+ <property name="proxyList">${jboss.modcluster.proxyList}</property>
<!-- URL prefix to send with commands to mod_cluster. Default is no prefix. -->
<!--property name="proxyURL"></property-->
15 years, 11 months
JBoss Native SVN: r2166 - in trunk/mod_cluster/native: mod_proxy_cluster and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-01-14 09:23:20 -0500 (Wed, 14 Jan 2009)
New Revision: 2166
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Add the missing part for the sessionid handling.
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-01-13 21:24:04 UTC (rev 2165)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-01-14 14:23:20 UTC (rev 2166)
@@ -53,7 +53,7 @@
#define DEFMAXCONTEXT 100
#define DEFMAXNODE 10
#define DEFMAXHOST 20
-#define DEFMAXSESSIONID 2048
+#define DEFMAXSESSIONID 512
#define MAXMESSSIZE 1024
/* Error messages */
@@ -1271,6 +1271,8 @@
if (r->method_number != M_GET)
return DECLINED;
process_info(r, NULL, NULL);
+ /* refresh it every 10 seconds */
+ apr_table_set(r->headers_out, "Refresh", "10");
return OK;
}
@@ -1538,6 +1540,7 @@
ap_register_provider(p, "manager" , "shared", "1", &host_storage);
ap_register_provider(p, "manager" , "shared", "2", &context_storage);
ap_register_provider(p, "manager" , "shared", "3", &balancer_storage);
+ ap_register_provider(p, "manager" , "shared", "4", &sessionid_storage);
}
/*
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-01-13 21:24:04 UTC (rev 2165)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-01-14 14:23:20 UTC (rev 2166)
@@ -46,6 +46,7 @@
#include "host.h"
#include "context.h"
#include "balancer.h"
+#include "sessionid.h"
struct proxy_cluster_helper {
int count_active; /* currently active request using the worker */
@@ -62,12 +63,14 @@
static struct host_storage_method *host_storage = NULL;
static struct context_storage_method *context_storage = NULL;
static struct balancer_storage_method *balancer_storage = NULL;
+static struct sessionid_storage_method *sessionid_storage = NULL;
static apr_thread_mutex_t *lock = NULL;
#define WAITFORREMOVE 10 /* seconds */
-#define TIMEINTERVAL apr_time_from_sec(1) /* recalcul the lbstatus based on number of request in the time interval */
+#define TIMEINTERVAL apr_time_from_sec(1) /* recalcul the lbstatus based on number of request in the time interval */
+#define TIMESESSIONID apr_time_from_sec(300) /* after 5 minutes the sessionid have probably timeout */
/* reslist constructor */
/* XXX: Should use the proxy_util one. */
@@ -627,6 +630,32 @@
}
}
+/*
+ * remove the sessionids that have timeout
+ */
+static void remove_timeout_sessionid(proxy_server_conf *conf, apr_pool_t *pool, server_rec *server)
+{
+ int *id, size, i;
+ apr_time_t now;
+ int notok = 0;
+
+ now = apr_time_now();
+
+ /* read the ident of the sessionid */
+ id = apr_pcalloc(pool, sizeof(int) * sessionid_storage->get_max_size_sessionid());
+ size = sessionid_storage->get_ids_used_sessionid(id);
+
+ /* update lbstatus if needed */
+ for (i=0; i<size; i++) {
+ sessionidinfo_t *ou;
+ sessionid_storage->read_sessionid(id[i], &ou);
+ if (ou->updatetime < (now - TIMESESSIONID)) {
+ /* Remove it */
+ sessionid_storage->remove_sessionid(ou);
+ }
+ }
+}
+
/* Retrieve the parameter with the given name
* Something like 'JSESSIONID=12345...N'
* XXX: Should use the mod_proxy_balancer ones.
@@ -695,7 +724,7 @@
* @param uri part of the URL to for the session parameter.
* @param sticky_used the string that was used to find the route
*/
-static char *get_route(request_rec *r, const char *stickyval, char *uri, char **sticky_used)
+static char *cluster_get_sessionid(request_rec *r, const char *stickyval, char *uri, char **sticky_used)
{
char *sticky, *sticky_path;
char *path;
@@ -727,7 +756,7 @@
static int hassession_byname(request_rec *r, char *balancer_name, proxy_server_conf *conf, proxy_balancer *balance)
{
proxy_balancer *balancer = balance;
- char *route;
+ char *sessionid;
char *uri = r->filename + 6;
char *sticky_used;
int i;
@@ -749,10 +778,10 @@
if (balancer->sticky == NULL)
return 0;
- route = get_route(r, balancer->sticky, uri, &sticky_used);
- if (route) {
+ sessionid = cluster_get_sessionid(r, balancer->sticky, uri, &sticky_used);
+ if (sessionid) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "mod_proxy_cluster: found route %s", route);
+ "mod_proxy_cluster: found sessionid %s", sessionid);
return 1;
}
return 0;
@@ -1311,6 +1340,8 @@
remove_removed_node(pool, s);
/* Calculate the lbstatus for each node */
update_workers_lbstatus(conf, pool, s);
+ /* Free sessionid slots */
+ remove_timeout_sessionid(conf, pool, s);
apr_pool_destroy(pool);
}
apr_thread_exit(thd, 0);
@@ -1376,6 +1407,12 @@
"proxy_cluster_post_config: Can't find mod_manager for balancers");
return !OK;
}
+ sessionid_storage = ap_lookup_provider("manager" , "shared", "4");
+ if (sessionid_storage == NULL) {
+ ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s,
+ "proxy_cluster_post_config: Can't find mod_manager for sessionids");
+ return !OK;
+ }
return OK;
}
@@ -1387,6 +1424,7 @@
{
proxy_balancer *balancer;
char *route = NULL;
+ char *sessionid = NULL;
char *sticky_used;
int i;
void *sconf = r->server->module_config;
@@ -1399,12 +1437,12 @@
if (balancer->sticky == NULL)
continue;
- route = get_route(r, balancer->sticky, r->uri, &sticky_used);
- if (route) {
+ sessionid = cluster_get_sessionid(r, balancer->sticky, r->uri, &sticky_used);
+ if (sessionid) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cluster: Found value %s for "
- "stickysession %s", route, balancer->sticky);
- if ((route = strchr(route, '.')) != NULL )
+ "stickysession %s", sessionid, balancer->sticky);
+ if ((route = strchr(sessionid, '.')) != NULL )
route++;
if (route && *route) {
nodeinfo_t *ou;
@@ -1415,8 +1453,12 @@
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cluster: Found balancer %s for %s", ou->mess.balancer, route);
/* here we have the route and domain for find_session_route ... */
- apr_table_setn(r->notes, "CLUSTER_ROUTE", route);
- apr_table_setn(r->notes, "CLUSTER_STICKY_USED", sticky_used);
+ apr_table_setn(r->notes, "session-sticky", sticky_used);
+ apr_table_setn(r->notes, "session-id", sessionid);
+ apr_table_setn(r->notes, "session-route", route);
+
+ apr_table_setn(r->subprocess_env, "BALANCER_SESSION_ROUTE", route);
+ apr_table_setn(r->subprocess_env, "BALANCER_SESSION_STICKY", sticky_used);
if (ou->mess.Domain[0] != '\0') {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cluster: Found domain %s for %s", ou->mess.Domain, route);
@@ -1562,14 +1604,14 @@
return NULL;
/* We already should have the route in the notes for the trans() */
- *route = apr_table_get(r->notes, "CLUSTER_ROUTE");
+ *route = apr_table_get(r->notes, "session-route");
if (*route && (**route)) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cluster: Using route %s", *route);
} else
return NULL;
- *sticky_used = apr_table_get(r->notes, "CLUSTER_STICKY_USED");
+ *sticky_used = apr_table_get(r->notes, "session-sticky");
if (domain)
*domain = apr_table_get(r->notes, "CLUSTER_DOMAIN");
@@ -1769,12 +1811,12 @@
*/
if (*balancer) {
/* Adjust the helper->count corresponding to the previous try */
- const char *domain = apr_table_get(r->subprocess_env, "BALANCER_WORKER_NAME");
+ const char *worker_name = apr_table_get(r->subprocess_env, "BALANCER_WORKER_NAME");
if (domain && *domain) {
int i;
runtime = (proxy_worker *)(*balancer)->workers->elts;
for (i = 0; i < (*balancer)->workers->nelts; i++, runtime++) {
- if (runtime->name && strcmp(domain, runtime->name) == 0) {
+ if (runtime->name && strcmp(worker_name, runtime->name) == 0) {
proxy_cluster_helper *helper;
helper = (proxy_cluster_helper *) (runtime)->opaque;
if (helper->count_active>0)
@@ -1876,8 +1918,8 @@
/*
* Failover to another domain. Remove sessionid information.
*/
- const char *domain = apr_table_get(r->notes, "session-domain-ok");
- if (!domain) {
+ const char *domain_ok = apr_table_get(r->notes, "session-domain-ok");
+ if (!domain_ok) {
remove_session_route(r, sticky);
}
}
@@ -1886,13 +1928,15 @@
(*worker)->s->busy++;
+ /*
+ * get_route_balancer already fills all of the notes and some subprocess_env
+ * but not all.
+ * Note that BALANCER_WORKER_NAME would have changed in case of failover.
+ */
/* Add balancer/worker info to env. */
- apr_table_setn(r->subprocess_env,
- "BALANCER_NAME", (*balancer)->name);
- apr_table_setn(r->subprocess_env,
- "BALANCER_WORKER_NAME", (*worker)->name);
- apr_table_setn(r->subprocess_env,
- "BALANCER_WORKER_ROUTE", (*worker)->s->route);
+ apr_table_setn(r->subprocess_env, "BALANCER_NAME", (*balancer)->name);
+ apr_table_setn(r->subprocess_env, "BALANCER_WORKER_NAME", (*worker)->name);
+ apr_table_setn(r->subprocess_env, "BALANCER_WORKER_ROUTE", (*worker)->s->route);
/* Rewrite the url from 'balancer://url'
* to the 'worker_scheme://worker_hostname[:worker_port]/url'
@@ -1900,17 +1944,7 @@
* real hostname of the elected worker.
*/
access_status = rewrite_url(r, *worker, url);
- /* Add the session route to request notes if present */
- if (route) {
- apr_table_setn(r->notes, "session-sticky", sticky);
- apr_table_setn(r->notes, "session-route", route);
- /* Add session info to env. */
- apr_table_setn(r->subprocess_env,
- "BALANCER_SESSION_STICKY", sticky);
- apr_table_setn(r->subprocess_env,
- "BALANCER_SESSION_ROUTE", route);
- }
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: CLUSTER (%s) worker (%s) rewritten to %s",
(*balancer)->name, (*worker)->name, *url);
@@ -1926,6 +1960,8 @@
apr_status_t rv;
proxy_cluster_helper *helper;
+ const char *sessionid;
+ const char *route;
if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
@@ -1948,7 +1984,15 @@
if (worker && worker->s->busy)
worker->s->busy--;
- /* XXX: Add information about sessions corresponding to a node */
+ /* Add information about sessions corresponding to a node */
+ sessionid = apr_table_get(r->notes, "session-id");
+ route = apr_table_get(r->notes, "session-route");
+ if (sessionid && route) {
+ sessionidinfo_t ou;
+ strncpy(ou.sessionid, sessionid, SESSIONIDSZ);
+ strncpy(ou.JVMRoute, route, JVMROUTESZ);
+ sessionid_storage->insert_update_sessionid(&ou);
+ }
return OK;
}
15 years, 11 months
JBoss Native SVN: r2165 - trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-01-13 16:24:04 -0500 (Tue, 13 Jan 2009)
New Revision: 2165
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/MCMPUtils.java
Log:
[MODCLUSTER-38] empty proxyList should be handled same as null
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/MCMPUtils.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/MCMPUtils.java 2009-01-13 15:56:52 UTC (rev 2164)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/MCMPUtils.java 2009-01-13 21:24:04 UTC (rev 2165)
@@ -386,7 +386,7 @@
public static List<AddressPort> parseProxies(String proxyList)
{
- if (proxyList == null) return Collections.emptyList();
+ if ((proxyList == null) || (proxyList.length() == 0)) return Collections.emptyList();
String[] tokens = proxyList.split(",");
15 years, 11 months
JBoss Native SVN: r2164 - in trunk/mod_cluster/native: mod_manager and 1 other directories.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-01-13 10:56:52 -0500 (Tue, 13 Jan 2009)
New Revision: 2164
Added:
trunk/mod_cluster/native/include/sessionid.h
trunk/mod_cluster/native/mod_manager/sessionid.c
Modified:
trunk/mod_cluster/native/include/mod_clustersize.h
trunk/mod_cluster/native/mod_manager/Makefile.in
trunk/mod_cluster/native/mod_manager/mod_manager.c
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Add logic to store sessionid in shared memory.
Modified: trunk/mod_cluster/native/include/mod_clustersize.h
===================================================================
--- trunk/mod_cluster/native/include/mod_clustersize.h 2009-01-12 19:03:09 UTC (rev 2163)
+++ trunk/mod_cluster/native/include/mod_clustersize.h 2009-01-13 15:56:52 UTC (rev 2164)
@@ -45,4 +45,7 @@
#define COOKNAMESZ 30
#define PATHNAMESZ 30
+/* For sessionid.h */
+#define SESSIONIDSZ 128
+
#endif /* MOD_CLUSTERSIZE_H */
Added: trunk/mod_cluster/native/include/sessionid.h
===================================================================
--- trunk/mod_cluster/native/include/sessionid.h (rev 0)
+++ trunk/mod_cluster/native/include/sessionid.h 2009-01-13 15:56:52 UTC (rev 2164)
@@ -0,0 +1,156 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2009 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+#ifndef SESSIONID_H
+#define SESSIONID_H
+
+/**
+ * @file sessionid.h
+ * @brief sessionid description Storage Module for Apache
+ *
+ * @defgroup MEM sessionids
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#define SESSIONIDEXE ".sessionid"
+
+#ifndef MEM_T
+typedef struct mem mem_t;
+#define MEM_T
+#endif
+
+#include "mod_clustersize.h"
+
+/* status of the sessionid as read/store in httpd. */
+struct sessionidinfo {
+ char sessionid[SESSIONIDSZ]; /* Sessionid value */
+ char JVMRoute[JVMROUTESZ]; /* corresponding node */
+
+ unsigned long updatetime; /* time of last received message */
+ int id; /* id in table */
+};
+typedef struct sessionidinfo sessionidinfo_t;
+
+
+/**
+ * Insert(alloc) and update a sessionid record in the shared table
+ * @param pointer to the shared table.
+ * @param sessionid sessionid to store in the shared table.
+ * @return APR_SUCCESS if all went well
+ *
+ */
+apr_status_t insert_update_sessionid(mem_t *s, sessionidinfo_t *sessionid);
+
+/**
+ * read a sessionid record from the shared table
+ * @param pointer to the shared table.
+ * @param sessionid sessionid to read from the shared table.
+ * @return address of the read sessionid or NULL if error.
+ */
+sessionidinfo_t * read_sessionid(mem_t *s, sessionidinfo_t *sessionid);
+
+/**
+ * get a sessionid record from the shared table
+ * @param pointer to the shared table.
+ * @param sessionid address of the sessionid read from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+apr_status_t get_sessionid(mem_t *s, sessionidinfo_t **sessionid, int ids);
+
+/**
+ * remove(free) a sessionid record from the shared table
+ * @param pointer to the shared table.
+ * @param sessionid sessionid to remove from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+apr_status_t remove_sessionid(mem_t *s, sessionidinfo_t *sessionid);
+
+/*
+ * get the ids for the used (not free) sessionids in the table
+ * @param pointer to the shared table.
+ * @param ids array of int to store the used id (must be big enough).
+ * @return number of sessionid existing or -1 if error.
+ */
+int get_ids_used_sessionid(mem_t *s, int *ids);
+
+/*
+ * get the size of the table (max size).
+ * @param pointer to the shared table.
+ * @return size of the existing table or -1 if error.
+ */
+int get_max_size_sessionid(mem_t *s);
+
+/**
+ * attach to the shared sessionid table
+ * @param name of an existing shared table.
+ * @param address to store the size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+mem_t * get_mem_sessionid(char *string, int *num, apr_pool_t *p, slotmem_storage_method *storage);
+/**
+ * create a shared sessionid table
+ * @param name to use to create the table.
+ * @param size of the shared table.
+ * @param persist tell if the slotmem element are persistent.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+mem_t * create_mem_sessionid(char *string, int *num, int persist, apr_pool_t *p, slotmem_storage_method *storage);
+
+/**
+ * provider for the mod_proxy_cluster or mod_jk modules.
+ */
+struct sessionid_storage_method {
+/**
+ * the sessionid corresponding to the ident
+ * @param ids ident of the sessionid to read.
+ * @param sessionid address of pointer to return the sessionid.
+ * @return APR_SUCCESS if all went well
+ */
+apr_status_t (* read_sessionid)(int ids, sessionidinfo_t **sessionid);
+/**
+ * read the list of ident of used sessionids.
+ * @param ids address to store the idents.
+ * @return APR_SUCCESS if all went well
+ */
+int (* get_ids_used_sessionid)(int *ids);
+/**
+ * read the max number of sessionids in the shared table
+ */
+int (*get_max_size_sessionid)();
+/*
+ * Remove the sessionid from shared memory (free the slotmem)
+ */
+apr_status_t (*remove_sessionid)(sessionidinfo_t *sessionid);
+/*
+ * Insert a new sessionid or update existing one.
+ */
+apr_status_t (*insert_update_sessionid)(sessionidinfo_t *sessionid);
+};
+#endif /*SESSIONID_H*/
Modified: trunk/mod_cluster/native/mod_manager/Makefile.in
===================================================================
--- trunk/mod_cluster/native/mod_manager/Makefile.in 2009-01-12 19:03:09 UTC (rev 2163)
+++ trunk/mod_cluster/native/mod_manager/Makefile.in 2009-01-13 15:56:52 UTC (rev 2164)
@@ -15,8 +15,8 @@
mod_manager.so: mod_manager.la
$(APACHE_BASE)/build/instdso.sh SH_LIBTOOL='$(LIBTOOL)' mod_manager.la `pwd`
-mod_manager.la: mod_manager.slo node.slo context.slo host.slo balancer.slo
- $(SH_LINK) -rpath $(libexecdir) -module -avoid-version mod_manager.lo node.lo context.lo host.lo balancer.lo
+mod_manager.la: mod_manager.slo node.slo context.slo host.slo balancer.slo sessionid.slo
+ $(SH_LINK) -rpath $(libexecdir) -module -avoid-version mod_manager.lo node.lo context.lo host.lo balancer.lo sessionid.lo
clean:
rm -f *.o *.lo *.slo *.so
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-01-12 19:03:09 UTC (rev 2163)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-01-13 15:56:52 UTC (rev 2164)
@@ -48,11 +48,13 @@
#include "host.h"
#include "context.h"
#include "balancer.h"
+#include "sessionid.h"
-#define DEFMAXCONTEXT 100
-#define DEFMAXNODE 10
-#define DEFMAXHOST 20
-#define MAXMESSSIZE 1024
+#define DEFMAXCONTEXT 100
+#define DEFMAXNODE 10
+#define DEFMAXHOST 20
+#define DEFMAXSESSIONID 2048
+#define MAXMESSSIZE 1024
/* Error messages */
#define TYPESYNTAX 1
@@ -88,6 +90,7 @@
mem_t *nodestatsmem = NULL;
mem_t *hoststatsmem = NULL;
mem_t *balancerstatsmem = NULL;
+mem_t *sessionidstatsmem = NULL;
slotmem_storage_method *storage = NULL;
balancer_method *balancerhandler = NULL;
@@ -104,6 +107,8 @@
int maxnode;
/* max munber of host supported */
int maxhost;
+ /* max munber of session supported */
+ int maxsessionid;
/* last time the node update logic was called */
apr_time_t last_updated;
@@ -132,7 +137,7 @@
{
return (remove_node(nodestatsmem, node));
}
-static apr_status_t loc_find_node(nodeinfo_t *node, char *route)
+static apr_status_t loc_find_node(nodeinfo_t **node, const char *route)
{
return (find_node(nodestatsmem, node, route));
}
@@ -262,6 +267,37 @@
loc_get_ids_used_balancer,
loc_get_max_size_balancer
};
+/*
+ * routines for the sessionid_storage_method
+ */
+static apr_status_t loc_read_sessionid(int ids, sessionidinfo_t **sessionid)
+{
+ return (get_sessionid(sessionidstatsmem, sessionid, ids));
+}
+static int loc_get_ids_used_sessionid(int *ids)
+{
+ return(get_ids_used_sessionid(sessionidstatsmem, ids));
+}
+static int loc_get_max_size_sessionid()
+{
+ return(get_max_size_sessionid(sessionidstatsmem));
+}
+static apr_status_t loc_remove_sessionid(sessionidinfo_t *sessionid)
+{
+ return (remove_sessionid(sessionidstatsmem, sessionid));
+}
+static apr_status_t loc_insert_update_sessionid(sessionidinfo_t *sessionid)
+{
+ return (insert_update_sessionid(sessionidstatsmem, sessionid));
+}
+static const struct sessionid_storage_method sessionid_storage =
+{
+ loc_read_sessionid,
+ loc_get_ids_used_sessionid,
+ loc_get_max_size_sessionid,
+ loc_remove_sessionid,
+ loc_insert_update_sessionid
+};
/* helper for the handling of the Alias: host1,... Context: context1,... */
struct cluster_host {
@@ -281,6 +317,7 @@
char *context;
char *host;
char *balancer;
+ char *sessionid;
void *data;
const char *userdata_key = "mod_manager_init";
mod_manager_config *mconf = ap_get_module_config(s->module_config, &manager_module);
@@ -296,11 +333,13 @@
context = apr_pstrcat(ptemp, mconf->basefilename, ".context", NULL);
host = apr_pstrcat(ptemp, mconf->basefilename, ".host", NULL);
balancer = apr_pstrcat(ptemp, mconf->basefilename, ".balancer", NULL);
+ sessionid = apr_pstrcat(ptemp, mconf->basefilename, ".sessionid", NULL);
} else {
node = ap_server_root_relative(ptemp, "logs/manager.node");
context = ap_server_root_relative(ptemp, "logs/manager.context");
host = ap_server_root_relative(ptemp, "logs/manager.host");
balancer = ap_server_root_relative(ptemp, "logs/manager.balancer");
+ sessionid = ap_server_root_relative(ptemp, "logs/manager.sessionid");
}
/* Get a provider to handle the shared memory */
@@ -334,6 +373,12 @@
return !OK;
}
+ sessionidstatsmem = create_mem_sessionid(sessionid, &mconf->maxhost, mconf->persistent, p, storage);
+ if (sessionidstatsmem == NULL) {
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, s, "create_mem_sessionid failed");
+ return !OK;
+ }
+
/* Get a provider to ping/pong logics */
balancerhandler = ap_lookup_provider("proxy_cluster", "balancer", "0");
@@ -1312,6 +1357,7 @@
char *context;
char *host;
char *balancer;
+ char *sessionid;
mod_manager_config *mconf = ap_get_module_config(s->module_config, &manager_module);
if (mconf->basefilename) {
@@ -1319,11 +1365,13 @@
context = apr_pstrcat(p, mconf->basefilename, ".context", NULL);
host = apr_pstrcat(p, mconf->basefilename, ".host", NULL);
balancer = apr_pstrcat(p, mconf->basefilename, ".balancer", NULL);
+ sessionid = apr_pstrcat(p, mconf->basefilename, ".sessionid", NULL);
} else {
node = ap_server_root_relative(p, "logs/manager.node");
context = ap_server_root_relative(p, "logs/manager.context");
host = ap_server_root_relative(p, "logs/manager.host");
balancer = ap_server_root_relative(p, "logs/manager.balancer");
+ sessionid = ap_server_root_relative(p, "logs/manager.sessionid");
}
nodestatsmem = get_mem_node(node, &mconf->maxnode, p, storage);
@@ -1349,6 +1397,12 @@
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, s, "get_mem_balancer failed");
return;
}
+
+ sessionidstatsmem = get_mem_sessionid(sessionid, &mconf->maxsessionid, p, storage);
+ if (sessionidstatsmem == NULL) {
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, s, "get_mem_sessionid failed");
+ return;
+ }
}
/*
@@ -1372,6 +1426,12 @@
mconf->maxhost = atoi(word);
return NULL;
}
+static const char *cmd_manager_maxsessionid(cmd_parms *cmd, void *mconfig, const char *word)
+{
+ mod_manager_config *mconf = ap_get_module_config(cmd->server->module_config, &manager_module);
+ mconf->maxsessionid = atoi(word);
+ return NULL;
+}
static const char *cmd_manager_memmanagerfile(cmd_parms *cmd, void *mconfig, const char *word)
{
mod_manager_config *mconf = ap_get_module_config(cmd->server->module_config, &manager_module);
@@ -1424,6 +1484,13 @@
"Maxhost - number max host (Alias in virtual hosts) supported by mod_cluster"
),
AP_INIT_TAKE1(
+ "Maxsessionid",
+ cmd_manager_maxsessionid,
+ NULL,
+ OR_ALL,
+ "Maxsessionid - number session (Used to track number of sessions per nodes) supported by mod_cluster"
+ ),
+ AP_INIT_TAKE1(
"MemManagerFile",
cmd_manager_memmanagerfile,
NULL,
@@ -1484,6 +1551,7 @@
mconf->maxcontext = DEFMAXCONTEXT;
mconf->maxnode = DEFMAXNODE;
mconf->maxhost = DEFMAXHOST;
+ mconf->maxsessionid = DEFMAXSESSIONID;
mconf->last_updated = 0;
mconf->persistent = 0;
return mconf;
@@ -1526,6 +1594,11 @@
else if (mconf1->maxhost != DEFMAXHOST)
mconf->maxhost = mconf1->maxhost;
+ if (mconf2->maxsessionid != DEFMAXSESSIONID)
+ mconf->maxsessionid = mconf2->maxsessionid;
+ else if (mconf1->maxsessionid != DEFMAXSESSIONID)
+ mconf->maxsessionid = mconf1->maxsessionid;
+
if (mconf2->persistent != 0)
mconf->persistent = mconf2->persistent;
else if (mconf1->persistent != 0)
Added: trunk/mod_cluster/native/mod_manager/sessionid.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/sessionid.c (rev 0)
+++ trunk/mod_cluster/native/mod_manager/sessionid.c 2009-01-13 15:56:52 UTC (rev 2164)
@@ -0,0 +1,226 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2009 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+/**
+ * @file sessionid.c
+ * @brief sessionid description Storage Module for Apache
+ *
+ * @defgroup MEM sessionids
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#include "apr.h"
+#include "apr_strings.h"
+#include "apr_pools.h"
+#include "apr_time.h"
+
+#include "slotmem.h"
+#include "sessionid.h"
+
+struct mem {
+ ap_slotmem_t *slotmem;
+ const slotmem_storage_method *storage;
+ int num;
+ apr_pool_t *p;
+};
+
+static mem_t * create_attach_mem_sessionid(char *string, int *num, int type, apr_pool_t *p, slotmem_storage_method *storage) {
+ mem_t *ptr;
+ const char *storename;
+ apr_status_t rv;
+
+ ptr = apr_pcalloc(p, sizeof(mem_t));
+ if (!ptr) {
+ return NULL;
+ }
+ ptr->storage = storage;
+ storename = apr_pstrcat(p, string, SESSIONIDEXE, NULL);
+ if (type)
+ rv = ptr->storage->ap_slotmem_create(&ptr->slotmem, storename, sizeof(sessionidinfo_t), *num, type, p);
+ else {
+ apr_size_t size = sizeof(sessionidinfo_t);
+ rv = ptr->storage->ap_slotmem_attach(&ptr->slotmem, storename, &size, num, p);
+ }
+ if (rv != APR_SUCCESS) {
+ return NULL;
+ }
+ ptr->num = *num;
+ ptr->p = p;
+ return ptr;
+}
+/**
+ * Insert(alloc) and update a sessionid record in the shared table
+ * @param pointer to the shared table.
+ * @param sessionid sessionid to store in the shared table.
+ * @return APR_SUCCESS if all went well
+ *
+ */
+static apr_status_t insert_update(void* mem, void **data, int id, apr_pool_t *pool)
+{
+ sessionidinfo_t *in = (sessionidinfo_t *)*data;
+ sessionidinfo_t *ou = (sessionidinfo_t *)mem;
+ if (strcmp(in->sessionid, ou->sessionid) == 0) {
+ memcpy(ou, in, sizeof(sessionidinfo_t));
+ ou->id = id;
+ ou->updatetime = apr_time_sec(apr_time_now());
+ *data = ou;
+ return APR_SUCCESS;
+ }
+ return APR_NOTFOUND;
+}
+apr_status_t insert_update_sessionid(mem_t *s, sessionidinfo_t *sessionid)
+{
+ apr_status_t rv;
+ sessionidinfo_t *ou;
+ int ident;
+
+ sessionid->id = 0;
+ rv = s->storage->ap_slotmem_do(s->slotmem, insert_update, &sessionid, s->p);
+ if (sessionid->id != 0 && rv == APR_SUCCESS) {
+ return APR_SUCCESS; /* updated */
+ }
+
+ /* we have to insert it */
+ rv = s->storage->ap_slotmem_alloc(s->slotmem, &ident, (void **) &ou);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+ memcpy(ou, sessionid, sizeof(sessionidinfo_t));
+ ou->id = ident;
+ ou->updatetime = apr_time_sec(apr_time_now());
+
+ return APR_SUCCESS;
+}
+
+/**
+ * read a sessionid record from the shared table
+ * @param pointer to the shared table.
+ * @param sessionid sessionid to read from the shared table.
+ * @return address of the read sessionid or NULL if error.
+ */
+static apr_status_t loc_read_sessionid(void* mem, void **data, int id, apr_pool_t *pool) {
+ sessionidinfo_t *in = (sessionidinfo_t *)*data;
+ sessionidinfo_t *ou = (sessionidinfo_t *)mem;
+
+ if (strcmp(in->sessionid, ou->sessionid) == 0) {
+ *data = ou;
+ return APR_SUCCESS;
+ }
+ return APR_NOTFOUND;
+}
+sessionidinfo_t * read_sessionid(mem_t *s, sessionidinfo_t *sessionid)
+{
+ apr_status_t rv;
+ sessionidinfo_t *ou = sessionid;
+
+ if (sessionid->id)
+ rv = s->storage->ap_slotmem_mem(s->slotmem, sessionid->id, (void **) &ou);
+ else {
+ rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_sessionid, &ou, s->p);
+ }
+ if (rv == APR_SUCCESS)
+ return ou;
+ return NULL;
+}
+/**
+ * get a sessionid record from the shared table
+ * @param pointer to the shared table.
+ * @param sessionid address where the sessionid is locate in the shared table.
+ * @param ids in the sessionid table.
+ * @return APR_SUCCESS if all went well
+ */
+apr_status_t get_sessionid(mem_t *s, sessionidinfo_t **sessionid, int ids)
+{
+ return(s->storage->ap_slotmem_mem(s->slotmem, ids, (void **) sessionid));
+}
+
+/**
+ * remove(free) a sessionid record from the shared table
+ * @param pointer to the shared table.
+ * @param sessionid sessionid to remove from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+apr_status_t remove_sessionid(mem_t *s, sessionidinfo_t *sessionid)
+{
+ apr_status_t rv;
+ sessionidinfo_t *ou = sessionid;
+ if (sessionid->id)
+ s->storage->ap_slotmem_free(s->slotmem, sessionid->id, sessionid);
+ else {
+ /* XXX: for the moment January 2007 ap_slotmem_free only uses ident to remove */
+ rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_sessionid, &ou, s->p);
+ if (rv == APR_SUCCESS)
+ rv = s->storage->ap_slotmem_free(s->slotmem, ou->id, sessionid);
+ }
+ return rv;
+}
+
+/*
+ * get the ids for the used (not free) sessionids in the table
+ * @param pointer to the shared table.
+ * @param ids array of int to store the used id (must be big enough).
+ * @return number of sessionid existing or -1 if error.
+ */
+int get_ids_used_sessionid(mem_t *s, int *ids)
+{
+ return (s->storage->ap_slotmem_get_used(s->slotmem, ids));
+}
+
+/*
+ * read the size of the table.
+ * @param pointer to the shared table.
+ * @return number of sessionid existing or -1 if error.
+ */
+int get_max_size_sessionid(mem_t *s)
+{
+ return (s->storage->ap_slotmem_get_max_size(s->slotmem));
+}
+
+/**
+ * attach to the shared sessionid table
+ * @param name of an existing shared table.
+ * @param address to store the size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+mem_t * get_mem_sessionid(char *string, int *num, apr_pool_t *p, slotmem_storage_method *storage)
+{
+ return(create_attach_mem_sessionid(string, num, 0, p, storage));
+}
+/**
+ * create a shared sessionid table
+ * @param name to use to create the table.
+ * @param size of the shared table.
+ * @param persist tell if the slotmem element are persistent.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+mem_t * create_mem_sessionid(char *string, int *num, int persist, apr_pool_t *p, slotmem_storage_method *storage)
+{
+ return(create_attach_mem_sessionid(string, num, CREATE_SLOTMEM|persist, p, storage));
+}
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-01-12 19:03:09 UTC (rev 2163)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-01-13 15:56:52 UTC (rev 2164)
@@ -1948,6 +1948,8 @@
if (worker && worker->s->busy)
worker->s->busy--;
+ /* XXX: Add information about sessions corresponding to a node */
+
return OK;
}
15 years, 11 months
JBoss Native SVN: r2163 - trunk/mod_cluster/native/mod_manager.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-01-12 14:03:09 -0500 (Mon, 12 Jan 2009)
New Revision: 2163
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
First basic part of MODCLUSTER-27.
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-01-12 08:46:43 UTC (rev 2162)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-01-12 19:03:09 UTC (rev 2163)
@@ -28,6 +28,7 @@
#include "apr_strings.h"
#include "apr_lib.h"
+#define CORE_PRIVATE
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
@@ -1168,6 +1169,17 @@
static int manager_trans(request_rec *r)
{
int ours = 0;
+ core_dir_config *conf =
+ (core_dir_config *)ap_get_module_config(r->per_dir_config,
+ &core_module);
+
+ if (conf && conf->handler && r->method_number == M_GET &&
+ strcmp(conf->handler, "mod_cluster-manager") == 0) {
+ r->handler = "mod_cluster-manager";
+ r->filename = apr_pstrdup(r->pool, r->uri);
+ return OK;
+ }
+
if (strcasecmp(r->method, "CONFIG") == 0)
ours = 1;
else if (strcasecmp(r->method, "ENABLE-APP") == 0)
@@ -1209,6 +1221,14 @@
apr_size_t bufsiz=MAXMESSSIZE;
apr_status_t status;
+ if (strcmp(r->handler, "mod_cluster-manager") == 0) {
+ /* Display the nodes information */
+ if (r->method_number != M_GET)
+ return DECLINED;
+ process_info(r, NULL, NULL);
+ return OK;
+ }
+
if (strcmp(r->handler, "mod-cluster"))
return DECLINED;
15 years, 11 months
JBoss Native SVN: r2162 - trunk/mod_cluster/native/mod_proxy_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-01-12 03:46:43 -0500 (Mon, 12 Jan 2009)
New Revision: 2162
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Prevent having mod_proxy_balancer and mod_proxy_cluster loaded.
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-12-31 19:33:07 UTC (rev 2161)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-01-12 08:46:43 UTC (rev 2162)
@@ -1343,6 +1343,15 @@
static int proxy_cluster_post_config(apr_pool_t *p, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{
+
+ /* Check that the mod_proxy_balancer.c is not loaded */
+ if (ap_find_linked_module("mod_proxy_balancer.c") != NULL) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
+ "Module mod_proxy_balancer is loaded"
+ " it must be removed in order for mod_proxy_cluster to function properly");
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
node_storage = ap_lookup_provider("manager" , "shared", "0");
if (node_storage == NULL) {
ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s,
15 years, 11 months