Author: jfrederic.clere(a)jboss.com
Date: 2009-03-06 11:22:37 -0500 (Fri, 06 Mar 2009)
New Revision: 2340
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Add #if HAVE_CLUSTER_EX_DEBUG to reduce the calls to ap_log_error().
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-06 11:08:46 UTC
(rev 2339)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-06 16:22:37 UTC
(rev 2340)
@@ -53,6 +53,9 @@
#include <unistd.h>
#endif
+/* define HAVE_CLUSTER_EX_DEBUG to have extented debug in mod_cluster */
+#define HAVE_CLUSTER_EX_DEBUG 0
+
struct proxy_cluster_helper {
int count_active; /* currently active request using the worker */
#if AP_MODULE_MAGIC_AT_LEAST(20051115,4)
@@ -733,8 +736,10 @@
sessionid = cluster_get_sessionid(r, balancer->sticky, uri, &sticky_used);
if (sessionid) {
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"mod_proxy_cluster: found sessionid %s", sessionid);
+#endif
return 1;
}
return 0;
@@ -764,8 +769,10 @@
sizevhost = host_storage->get_max_size_host();
vhosts = apr_palloc(r->pool, sizeof(int)*sizevhost);
sizevhost = host_storage->get_ids_used_host(vhosts);
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"get_balancer_by_node testing node %s for %s",
node->mess.JVMRoute, r->uri);
+#endif
for (i=0; i<sizevhost; i++) {
hostinfo_t *vhost;
host_storage->read_host(vhosts[i], &vhost);
@@ -777,16 +784,20 @@
int sizecontext = context_storage->get_max_size_context();
int *contexts = apr_palloc(r->pool, sizeof(int)*sizecontext);
sizecontext = context_storage->get_ids_used_context(contexts);
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"get_balancer_by_node testing host %s",
vhost->host);
+#endif
for (j=0; j<sizecontext; j++) {
contextinfo_t *context;
int len;
context_storage->read_context(contexts[j], &context);
if (context->vhost != vhost->vhost || (context->node !=
node->mess.id))
continue;
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"get_balancer_by_node testing context %s",
context->context);
+#endif
/* check for /context[/] in the URL */
len = strlen(context->context);
@@ -868,8 +879,10 @@
static int isnode_domain_ok(request_rec *r, nodeinfo_t *node,
const char *domain)
{
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"isnode_domain_ok: domain %s:%s", domain,
node->mess.Domain);
+#endif
if (domain == NULL)
return 1; /* OK no domain in the corresponding to the SESSIONID */
if (strcmp(node->mess.Domain, domain) == 0)
@@ -894,9 +907,11 @@
int checked_standby = 0;
int checked_domain = 1;
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: Entering byrequests for CLUSTER (%s)",
balancer->name);
+#endif
/* create workers for new nodes */
update_workers_node(conf, r->pool, r->server);
@@ -1339,19 +1354,25 @@
sessionid = cluster_get_sessionid(r, balancer->sticky, r->uri,
&sticky_used);
if (sessionid) {
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cluster: Found value %s for "
"stickysession %s", sessionid, balancer->sticky);
+#endif
if ((route = strchr(sessionid, '.')) != NULL )
route++;
if (route && *route) {
nodeinfo_t *ou;
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cluster: Found route %s", route);
+#endif
if (node_storage->find_node(&ou, route) == APR_SUCCESS) {
if (strlen(balancer->name)>10 &&
!strcmp(&balancer->name[10], ou->mess.balancer)) {
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cluster: Found balancer %s for %s",
ou->mess.balancer, route);
+#endif
/* here we have the route and domain for find_session_route ...
*/
apr_table_setn(r->notes, "session-sticky",
sticky_used);
apr_table_setn(r->notes, "session-id", sessionid);
@@ -1360,8 +1381,10 @@
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') {
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cluster: Found domain %s for %s",
ou->mess.Domain, route);
+#endif
apr_table_setn(r->notes, "CLUSTER_DOMAIN",
ou->mess.Domain);
}
return &balancer->name[10];
@@ -1385,9 +1408,11 @@
proxy_server_conf *conf = (proxy_server_conf *)
ap_get_module_config(sconf, &proxy_module);
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, r->server,
"proxy_cluster_trans for %d %s %s uri: %s args: %s unparsed_uri:
%s",
r->proxyreq, r->filename, r->handler, r->uri, r->args,
r->unparsed_uri);
+#endif
balancer = get_route_balancer(r, conf);
if (!balancer) {
@@ -1402,9 +1427,11 @@
r->filename = apr_pstrcat(r->pool, "proxy:cluster://", balancer,
r->unparsed_uri, NULL);
r->handler = "proxy-server";
r->proxyreq = PROXYREQ_REVERSE;
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, r->server,
"proxy_cluster_trans using %s uri: %s",
balancer, r->filename);
+#endif
return OK; /* Mod_proxy will process it */
}
@@ -1854,9 +1881,11 @@
*/
access_status = rewrite_url(r, *worker, url);
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: CLUSTER (%s) worker (%s) rewritten to %s",
(*balancer)->name, (*worker)->name, *url);
+#endif
return access_status;
}
@@ -1890,8 +1919,10 @@
"proxy: CLUSTER: (%s). Unlock failed for post_request",
balancer->name);
}
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy_cluster_post_request for (%s)", balancer->name);
+#endif
if (worker && worker->s->busy)
worker->s->busy--;