You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jf...@apache.org on 2006/08/03 21:31:13 UTC
svn commit: r428492 - in
/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy:
health_checker_util.c mod_proxy.h mod_proxy_balancer.c
mod_proxy_health_checker.h
Author: jfclere
Date: Thu Aug 3 12:31:12 2006
New Revision: 428492
URL: http://svn.apache.org/viewvc?rev=428492&view=rev
Log:
Move health in proxy_worker_stat otherwise testing it in
httpd is too complex.
Modified:
httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/health_checker_util.c
httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h
httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_balancer.c
httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.h
Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/health_checker_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/health_checker_util.c?rev=428492&r1=428491&r2=428492&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/health_checker_util.c (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/health_checker_util.c Thu Aug 3 12:31:12 2006
@@ -204,7 +204,7 @@
workerconf->keepalive_set = worker->keepalive_set;
workerconf->flush_packets = worker->flush_packets;
workerconf->flush_wait = worker->flush_wait;
- workerconf->health = 0;
+ workerconf->httpstatus.health = HEALTH_UNKNOWN;
workerconf->used = 1;
return APR_SUCCESS;
}
@@ -224,7 +224,7 @@
rv = checkstorage->ap_slotmem_mem(myscore, id, (void *) &workerconf);
if (rv != APR_SUCCESS)
return rv;
- *health = workerconf->health;
+ *health = workerconf->httpstatus.health;
return APR_SUCCESS;
}
/* set the health of the entry: for the health-checker */
@@ -238,7 +238,7 @@
rv = checkstorage->ap_slotmem_mem(myscore, id, (void *) &workerconf);
if (rv != APR_SUCCESS)
return rv;
- workerconf->health = value;
+ workerconf->httpstatus.health = value;
workerconf->time_checked = apr_time_now();
return APR_SUCCESS;
}
@@ -342,9 +342,9 @@
return APR_SUCCESS;
rv = test_backend(workerconf->scheme, workerconf->hostname, workerconf->port, pool);
if (rv != APR_SUCCESS)
- workerconf->health = HEALTH_NO;
+ workerconf->httpstatus.health = HEALTH_NO;
else
- workerconf->health = HEALTH_OK;
+ workerconf->httpstatus.health = HEALTH_OK;
workerconf->time_checked = apr_time_now();
return rv;
}
Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h?rev=428492&r1=428491&r2=428492&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h Thu Aug 3 12:31:12 2006
@@ -285,6 +285,7 @@
int retries; /* number of retries on this worker */
int lbstatus; /* Current lbstatus */
int lbfactor; /* dynamic lbfactor */
+ int health; /* result of the heathchecker */
apr_off_t transferred;/* Number of bytes transferred to remote */
apr_off_t read; /* Number of bytes read from remote */
apr_size_t elected; /* Number of times the worker was elected */
Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_balancer.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_balancer.c?rev=428492&r1=428491&r2=428492&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_balancer.c Thu Aug 3 12:31:12 2006
@@ -175,6 +175,17 @@
return NULL;
}
+static ap_proxy_close_worker(proxy_worker *worker, request_rec *r)
+{
+ /* XXX: Only prefork mpm's ??? */
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
+ "ap_proxy_close_worker: id %d name %s %d", worker->id, worker->name, worker->cp->conn);
+ if (worker->cp->conn) {
+ worker->cp->conn->close = 1;
+ worker->cp->conn->close_on_recycle = 1;
+ ap_proxy_release_connection("Any", worker->cp->conn, r->server);
+ }
+}
/* Find the worker that has the 'route' defined
*/
static proxy_worker *find_route_worker(proxy_balancer *balancer,
@@ -184,17 +195,13 @@
int checking_standby = 0;
int checked_standby = 0;
proxy_worker *worker;
- const health_worker_method *worker_storage;
- worker_storage = ap_lookup_provider(PROXY_CKMETHOD, "default", "0");
while (!checked_standby) {
worker = (proxy_worker *)balancer->workers->elts;
for (i = 0; i < balancer->workers->nelts; i++, worker++) {
- if (worker_storage) {
- int health;
- worker_storage->get_health(worker->id, &health);
- if (health != HEALTH_OK)
- continue;
+ if (worker->s->health == HEALTH_NO) {
+ ap_proxy_close_worker(worker, r);
+ continue;
}
if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) )
continue;
@@ -225,12 +232,11 @@
proxy_worker *rworker = NULL;
rworker = find_route_worker(balancer, worker->s->redirect, r);
/* Check if the redirect worker is usable */
- if (rworker && worker_storage) {
- int health;
- worker_storage->get_health(worker->id, &health);
- if (health != HEALTH_OK)
+ if (rworker)
+ if (rworker->s->health == HEALTH_NO) {
+ ap_proxy_close_worker(rworker, r);
continue;
- }
+ }
if (rworker && !PROXY_WORKER_IS_USABLE(rworker)) {
/*
* If the worker is in error state run
@@ -892,6 +898,10 @@
while (!mycandidate && !checked_standby) {
worker = (proxy_worker *)balancer->workers->elts;
for (i = 0; i < balancer->workers->nelts; i++, worker++) {
+ if (worker->s->health == HEALTH_NO) {
+ ap_proxy_close_worker(worker, r);
+ continue;
+ }
if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) )
continue;
/* If the worker is in error state run
@@ -959,6 +969,10 @@
while (!mycandidate && !checked_standby) {
worker = (proxy_worker *)balancer->workers->elts;
for (i = 0; i < balancer->workers->nelts; i++, worker++) {
+ if (worker->s->health == HEALTH_NO) {
+ ap_proxy_close_worker(worker, r);
+ continue;
+ }
if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) )
continue;
/* If the worker is in error state run
Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.h?rev=428492&r1=428491&r2=428492&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.h (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.h Thu Aug 3 12:31:12 2006
@@ -96,7 +96,6 @@
int is_address_reusable;
int flush_packets;
int flush_wait; /* poll wait time in microseconds if flush_auto */
- int health;
int used; /* 1 : valid entry 2 : remove 0 : free slot */
apr_time_t time_checked;
};