Index: docs/manual/mod/mod_proxy.xml =================================================================== --- docs/manual/mod/mod_proxy.xml (revision 1167187) +++ docs/manual/mod/mod_proxy.xml (working copy) @@ -922,8 +922,9 @@ - Single letter value defining the initial status of this worker: 'D' is disabled, 'S' is stopped, 'I' is ignore-errors, - 'H' is hot-standby and 'E' is in an error state. Status - can be set (which is the default) by prepending with '+' or + 'H' is hot-standby, 'N' is drain to only accept requests with + sticky session routes, and 'E' is in an error state. Status + can be set (which is the default) by prepending with '+' or cleared by prepending with '-'. Thus, a setting of 'S-E' sets this worker to Stopped and clears the in-error flag. Index: modules/proxy/mod_proxy.c =================================================================== --- modules/proxy/mod_proxy.c (revision 1167187) +++ modules/proxy/mod_proxy.c (working copy) @@ -238,6 +238,12 @@ else worker->status &= ~PROXY_WORKER_IGNORE_ERRORS; } + else if (*v == 'N' || *v == 'n') { + if (mode) + worker->status |= PROXY_WORKER_DRAIN; + else + worker->status &= ~PROXY_WORKER_DRAIN; + } else { return "Unknown status parameter option"; } Index: modules/proxy/mod_proxy.h =================================================================== --- modules/proxy/mod_proxy.h (revision 1167187) +++ modules/proxy/mod_proxy.h (working copy) @@ -268,6 +268,7 @@ /* worker status flags */ #define PROXY_WORKER_INITIALIZED 0x0001 #define PROXY_WORKER_IGNORE_ERRORS 0x0002 +#define PROXY_WORKER_DRAIN 0x0004 #define PROXY_WORKER_IN_SHUTDOWN 0x0010 #define PROXY_WORKER_DISABLED 0x0020 #define PROXY_WORKER_STOPPED 0x0040 @@ -288,6 +289,8 @@ ( !( (f)->s->status & PROXY_WORKER_NOT_USABLE_BITMAP) ) && \ PROXY_WORKER_IS_INITIALIZED(f) ) +#define PROXY_WORKER_IS_DRAINING(f) ( (f)->s->status & PROXY_WORKER_DRAIN ) + /* default worker retry timeout in seconds */ #define PROXY_WORKER_DEFAULT_RETRY 60 #define PROXY_WORKER_MAX_ROUTE_SIZ 63 Index: modules/proxy/mod_proxy_balancer.c =================================================================== --- modules/proxy/mod_proxy_balancer.c (revision 1167187) +++ modules/proxy/mod_proxy_balancer.c (working copy) @@ -776,6 +776,12 @@ else if (!strcasecmp(val, "Enable")) wsel->s->status &= ~PROXY_WORKER_DISABLED; } + if ((val = apr_table_get(params, "dr"))) { + if (!strcasecmp(val, "Disable")) + wsel->s->status &= ~PROXY_WORKER_DRAIN; + else if (!strcasecmp(val, "Enable")) + wsel->s->status |= PROXY_WORKER_DRAIN; + } if ((val = apr_table_get(params, "ls"))) { int ival = atoi(val); if (ival >= 0 && ival <= 99) { @@ -873,6 +879,8 @@ ap_rputs("Stop ", r); if (worker->s->status & PROXY_WORKER_HOT_STANDBY) ap_rputs("Stby ", r); + if (worker->s->status & PROXY_WORKER_DRAIN) + ap_rputs("Drn ", r); if (PROXY_WORKER_IS_USABLE(worker)) ap_rputs("Ok", r); if (!PROXY_WORKER_IS_INITIALIZED(worker)) @@ -914,6 +922,13 @@ if (!(wsel->s->status & PROXY_WORKER_DISABLED)) ap_rputs(" checked", r); ap_rputs(">\n", r); + ap_rputs("Drain:Disabled: s->status & PROXY_WORKER_DRAIN)) + ap_rputs(" checked", r); + ap_rputs("> | Enabled: s->status & PROXY_WORKER_DRAIN) + ap_rputs(" checked", r); + ap_rputs(">\n", r); ap_rputs("\n", r); ap_rvputs(r, "\npool, wsel->name), "\">\n", NULL); @@ -1025,7 +1040,8 @@ } if (worker->s->lbset != cur_lbset) continue; - if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) ) + if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) || + (PROXY_WORKER_IS_DRAINING(worker)) ) continue; /* If the worker is in error state run * retry on that worker. It will be marked as @@ -1107,7 +1123,8 @@ } if (worker->s->lbset != cur_lbset) continue; - if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) ) + if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) || + (PROXY_WORKER_IS_DRAINING(worker)) ) continue; /* If the worker is in error state run * retry on that worker. It will be marked as @@ -1178,7 +1195,8 @@ if (worker->s->lbset != cur_lbset) continue; - if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) ) + if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) || + (PROXY_WORKER_IS_DRAINING(worker)) ) continue; /* If the worker is in error state run