[MINOR] Add non-stick server option

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.
This commit is contained in:
Simon Horman 2011-06-25 09:39:49 +09:00 committed by Willy Tarreau
parent de072bd8ff
commit fa46168c8f
4 changed files with 16 additions and 0 deletions

View File

@ -6644,6 +6644,11 @@ minconn <minconn>
Supported in default-server: Yes 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> observe <mode>
This option enables health adjusting based on observing communication with This option enables health adjusting based on observing communication with
the server. By default this functionality is disabled and enabling it also the server. By default this functionality is disabled and enabling it also

View File

@ -54,6 +54,7 @@
#define SRV_TPROXY_DYN 0x0400 /* bind to a dynamically computed non-local address */ #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_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_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 */ /* function which act on servers need to return various errors */
#define SRV_STATUS_OK 0 /* everything is OK. */ #define SRV_STATUS_OK 0 /* everything is OK. */

View File

@ -4139,6 +4139,10 @@ stats_error_parsing:
newsrv->state |= SRV_BACKUP; newsrv->state |= SRV_BACKUP;
cur_arg ++; 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")) { else if (!defsrv && !strcmp(args[cur_arg], "send-proxy")) {
newsrv->state |= SRV_SEND_PROXY; newsrv->state |= SRV_SEND_PROXY;
cur_arg ++; cur_arg ++;

View File

@ -1193,6 +1193,12 @@ static int process_store_rules(struct session *s, struct buffer *rep, int an_bit
struct stksess *ts; struct stksess *ts;
void *ptr; 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); ts = stktable_lookup(s->store[i].table, s->store[i].ts);
if (ts) { if (ts) {
/* the entry already existed, we can free ours */ /* the entry already existed, we can free ours */