On 9/15/06, Brian Rectanus <[EMAIL PROTECTED]> wrote:
On 9/14/06, Ruediger Pluem <[EMAIL PROTECTED]> wrote:
>
>
> On 09/14/2006 09:50 PM, Ruediger Pluem wrote:
>
> >
> >
> > or even
> >
> > Header add Set-Cookie "MYCOOKIE=SOMEVALUE.%{BALANCER_WORKER_ROUTE}e;
path=/;" env=BALANCER_ROUTE_CHANGED
> > ProxyPass /test balancer://mycluster/test stickysession=MYCOOKIE
nofailover=On
>
> Ok I think it should be
>
> Header add Set-Cookie "MYCOOKIE=SOMEVALUE.%{BALANCER_WORKER_ROUTE}e; path=/;"
env=BALANCER_ROUTE_CHANGED
> ProxyPass /test balancer://mycluster/test stickysession=MYCOOKIE
>
> and the following patch should handle this (done only very quick tests):
>
> Index: modules/proxy/mod_proxy_balancer.c
> ===================================================================
> --- modules/proxy/mod_proxy_balancer.c»·(Revision 443474)
> +++ modules/proxy/mod_proxy_balancer.c»·(Arbeitskopie)
> @@ -267,6 +267,13 @@
> * Find the worker that has this route defined.
> */
> worker = find_route_worker(balancer, *route, r);
> + if (worker && strcmp(*route, worker->s->route)) {
> + /* Notice a change in the route */
> + apr_table_setn(r->subprocess_env, "BALANCER_ROUTE_CHANGED", "1");
> + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
> + "proxy: BALANCER: Route changed from %s to %s",
> + *route, worker->s->route);
> + }
> return worker;
> }
> else
> @@ -424,6 +431,10 @@
>
> return HTTP_SERVICE_UNAVAILABLE;
> }
> + if ((*balancer)->sticky && runtime) {
> + /* Notice a change in the route */
> + apr_table_setn(r->subprocess_env, "BALANCER_ROUTE_CHANGED", "1");
> + }
> *worker = runtime;
> }
>
>
> Regards
>
> Rüdiger
>
Regarding this:
http://mail-archives.apache.org/mod_mbox/httpd-dev/200606.mbox/[EMAIL PROTECTED]
I was actually hoping that this (below) would solve that, but I have
not had the time to look into it. I still think it is a step in the
right direction, though:
http://mail-archives.apache.org/mod_mbox/httpd-dev/200609.mbox/[EMAIL PROTECTED]
I am thinking that there is still not a way to check if
BALANCER_WORKER_ROUTE == BALANCER_SESSION_ROUTE at response time since
I think 'SetEnvIf response ...' will not resolve env vars it did not
set (at least that is what the docs hint at - have not tried).
So, this BALANCER_ROUTE_CHANGED patch is still needed. I have been
meaning to send it but you got to it first :) Will you commit that to
trunk?
Also, I would like my patches (now in trunk) and this additional
BALANCER_ROUTE_CHANGED patch to go into the next 2.2.x release if that
seems ok. Is this something you would do, or do you want me to put
togeather a 2.2.x patch?
Thanks,
-B
I removed my patch for this (I was using BALANCER_SESSION_REROUTED in
my working copy) and replaced it with yours to test it (liked it
better). Here is a patch for the docs as well...
Index: docs/manual/mod/mod_proxy_balancer.xml
===================================================================
--- docs/manual/mod/mod_proxy_balancer.xml (revision 446670)
+++ docs/manual/mod/mod_proxy_balancer.xml (working copy)
@@ -273,10 +273,10 @@
<section id="environment">
<title>Exported Environment Variables</title>
- <p>At present there are 5 environment variables exported:</p>
-
+ <p>At present there are 6 environment variables exported:</p>
+
+ <dl>
<!-- ============= BALANCER_SESSION_STICKY =============== -->
- <dl>
<dt><var><a name="balancer_session_sticky"
id="balancer_session_sticky">BALANCER_SESSION_STICKY</a></var></dt>
<dd>
<p>This is assigned the <var>stickysession</var> value used in the current
@@ -310,6 +310,16 @@
<p>This is assigned the <var>route</var> of the worker that will be
used for the current request.</p>
</dd>
+
+ <!-- ============= BALANCER_ROUTE_CHANGED ================= -->
+ <dt><var><a name="balancer_route_changed"
id="balancer_route_changed">BALANCER_ROUTE_CHANGED</a></var></dt>
+ <dd>
+ <p>This is set to 1 if the session route does not match the
+ worker route (BALANCER_SESSION_ROUTE != BALANCER_WORKER_ROUTE) or the
+ session does not yet have an established route. This can be used to
+ determine when/if the client needs to be sent an updated route
+ when sticky sessions are used.</p>
+ </dd>
</dl>
</section>