[PATCH] [MINOR] Add non-stick server option

From: Simon Horman <horms#verge.net.au>
Date: Sat, 25 Jun 2011 09:39:49 +0900


Never add connections allocated to this sever to a stick-table. This may be used in conjunction with backup to ensure that stick-table persistence is disabled for backup servers.

---
 doc/configuration.txt  |    5 +++++
 include/types/server.h |    1 +
 src/cfgparse.c         |    4 ++++
 src/session.c          |    6 ++++++
 4 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/doc/configuration.txt b/doc/configuration.txt
index 89d6dd7..398d59e 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -6644,6 +6644,11 @@ minconn <minconn>
 
   Supported in default-server: Yes
 
+non-stick
+  Never add connections allocated to this sever to a stick-table.
+  This may be used in conjunction with backup to ensure that
+  stick-table persistence is disabled for backup servers.
+
 observe <mode>
   This option enables health adjusting based on observing communication with
   the server. By default this functionality is disabled and enabling it also
diff --git a/include/types/server.h b/include/types/server.h
index 1a9d60d..f829399 100644
--- a/include/types/server.h
+++ b/include/types/server.h
@@ -54,6 +54,7 @@

#define SRV_TPROXY_DYN 0x0400 /* bind to a dynamically computed non-local address */
#define SRV_TPROXY_MASK 0x0700 /* bind to a non-local address to reach this server */
#define SRV_SEND_PROXY 0x0800 /* this server talks the PROXY protocol */
+#define SRV_NON_STICK 0x1000 /* never add connections allocated to this server to a stick table */ /* function which act on servers need to return various errors */
#define SRV_STATUS_OK 0 /* everything is OK. */
diff --git a/src/cfgparse.c b/src/cfgparse.c index 7b46df0..145d21f 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -4139,6 +4139,10 @@ stats_error_parsing: newsrv->state |= SRV_BACKUP; cur_arg ++; } + else if (!defsrv && !strcmp(args[cur_arg], "non-stick")) { + newsrv->state |= SRV_NON_STICK; + cur_arg ++; + } else if (!defsrv && !strcmp(args[cur_arg], "send-proxy")) { newsrv->state |= SRV_SEND_PROXY; cur_arg ++; diff --git a/src/session.c b/src/session.c index 56d0c8f..ae720cf 100644 --- a/src/session.c +++ b/src/session.c @@ -1193,6 +1193,12 @@ static int process_store_rules(struct session *s, struct buffer *rep, int an_bit struct stksess *ts; void *ptr; + if (target_srv(&s->target) && target_srv(&s->target)->state & SRV_NON_STICK) { + stksess_free(s->store[i].table, s->store[i].ts); + s->store[i].ts = NULL; + continue; + } + ts = stktable_lookup(s->store[i].table, s->store[i].ts); if (ts) { /* the entry already existed, we can free ours */ -- 1.7.5.4
Received on 2011/06/25 02:39

This archive was generated by hypermail 2.2.0 : 2011/06/25 02:45 CEST