]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] Add non-stick server option
authorSimon Horman <horms@verge.net.au>
Sat, 25 Jun 2011 00:39:49 +0000 (09:39 +0900)
committerWilly Tarreau <w@1wt.eu>
Sat, 25 Jun 2011 19:14:17 +0000 (21:14 +0200)
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
include/types/server.h
src/cfgparse.c
src/session.c

index 89d6dd7097b6c82d8e0567acb354c92dfba4e60c..398d59edc7802eeacc05207849f32d765541421b 100644 (file)
@@ -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
index 1a9d60d327d8c3e4908359f5ff1fc3a2d6a537cd..f82939951b2c825cce113d36a1c7eb6c44a879f3 100644 (file)
@@ -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. */
index 7b46df0bf26e186d4ce926607973cf7fca380c4b..145d21f6c0a98b6911b10eb23766adadd0dee67d 100644 (file)
@@ -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 ++;
index 56d0c8f8bf6b7376c9ad82b634fff71893c09575..ae720cf34a928e9092e305086b57b030b5771e17 100644 (file)
@@ -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 */