diff options
author | Rainer Jung <rjung@apache.org> | 2010-08-22 11:47:29 +0200 |
---|---|---|
committer | Rainer Jung <rjung@apache.org> | 2010-08-22 11:47:29 +0200 |
commit | 8a73bd8002b3e37ab7679ea9aac695b4535471a6 (patch) | |
tree | 3f5956887bd1e7424871629ffa5c74c35140f811 | |
parent | Minor style nits. (diff) | |
download | apache2-8a73bd8002b3e37ab7679ea9aac695b4535471a6.tar.xz apache2-8a73bd8002b3e37ab7679ea9aac695b4535471a6.zip |
Change behaviour of worker sharing.
A proxy worker is shared, if its URL is a leading substring
of the URL of another worker defined later in the configuration.
Before this change this
- triggered the "worker ... already used by another worker" message
- resulted in a hard to understand configuration for this worker
- Attributes explicitely given in the later worker overwrote
attributes in the worker which was defined first
- General proxy attributes (e.g. ProxyTimeout ) overwrote
attributes in the worker which was defined first
New behaviour:
- Talk about "sharing" of workers and log both worker URLs
in the info log message instead of the "already used" message
- Do not overwrite attributes. If attributes were explicitely
given in the later worker, log a warning that those are ignored
because of sharing.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@987854 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | modules/proxy/mod_proxy.c | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index 938b20223d..d8d712def4 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -1395,21 +1395,30 @@ static const char * } else { proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, conf, r); + int reuse = 0; if (!worker) { const char *err = ap_proxy_add_worker(&worker, cmd->pool, conf, r); if (err) return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL); + PROXY_COPY_CONF_PARAMS(worker, conf); } else { + reuse = 1; ap_log_error(APLOG_MARK, APLOG_INFO, 0, cmd->server, - "worker %s already used by another worker", worker->name); + "Sharing worker '%s' instead of creating new worker '%s'", + worker->name, new->real); } - PROXY_COPY_CONF_PARAMS(worker, conf); for (i = 0; i < arr->nelts; i++) { - const char *err = set_worker_param(cmd->pool, worker, elts[i].key, - elts[i].val); - if (err) - return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL); + if (reuse) { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, + "Ignoring parameter '%s=%s' for worker '%s' because of worker sharing", + elts[i].key, elts[i].val, worker->name); + } else { + const char *err = set_worker_param(cmd->pool, worker, elts[i].key, + elts[i].val); + if (err) + return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL); + } } } return NULL; @@ -1756,6 +1765,7 @@ static const char *add_member(cmd_parms *cmd, void *dummy, const char *arg) apr_table_t *params = apr_table_make(cmd->pool, 5); const apr_array_header_t *arr; const apr_table_entry_t *elts; + int reuse = 0; int i; if (cmd->path) @@ -1796,19 +1806,27 @@ static const char *add_member(cmd_parms *cmd, void *dummy, const char *arg) const char *err; if ((err = ap_proxy_add_worker(&worker, cmd->pool, conf, name)) != NULL) return apr_pstrcat(cmd->temp_pool, "BalancerMember ", err, NULL); + PROXY_COPY_CONF_PARAMS(worker, conf); } else { + reuse = 1; ap_log_error(APLOG_MARK, APLOG_INFO, 0, cmd->server, - "worker %s already used by another worker", worker->name); + "Sharing worker '%s' instead of creating new worker '%s'", + worker->name, name); } - PROXY_COPY_CONF_PARAMS(worker, conf); arr = apr_table_elts(params); elts = (const apr_table_entry_t *)arr->elts; for (i = 0; i < arr->nelts; i++) { - const char *err = set_worker_param(cmd->pool, worker, elts[i].key, - elts[i].val); - if (err) - return apr_pstrcat(cmd->temp_pool, "BalancerMember ", err, NULL); + if (reuse) { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, + "Ignoring parameter '%s=%s' for worker '%s' because of worker sharing", + elts[i].key, elts[i].val, worker->name); + } else { + const char *err = set_worker_param(cmd->pool, worker, elts[i].key, + elts[i].val); + if (err) + return apr_pstrcat(cmd->temp_pool, "BalancerMember ", err, NULL); + } } /* Try to find the balancer */ balancer = ap_proxy_get_balancer(cmd->temp_pool, conf, path); |