]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: option prefer-last-server must be ignored in some case
authorOlivier Doucet <webmaster@ajeux.com>
Mon, 2 Jan 2017 10:48:57 +0000 (11:48 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 2 Jan 2017 13:26:22 +0000 (14:26 +0100)
when using "option prefer-last-server", we may not always stay on
the same backend if option balance told us otherwise.
For example, backend may change in the following cases:
balance hdr()
balance rdp-cookie
balance source
balance uri
balance url_param

[wt: backport this to 1.7 and 1.6]

src/backend.c

index 3acb1daeb775c7c41ac68cb329b3ca1649b57c2b..bf70ee18b11db30bcb3c83cef9e6c2fbfd07bb9e 100644 (file)
@@ -563,12 +563,14 @@ int assign_server(struct stream *s)
            objt_server(conn->target) && __objt_server(conn->target)->proxy == s->be &&
            ((s->txn && s->txn->flags & TX_PREFER_LAST) ||
             ((s->be->options & PR_O_PREF_LAST) &&
+              (s->be->lbprm.algo & BE_LB_KIND) != BE_LB_KIND_HI &&
              (!s->be->max_ka_queue ||
               server_has_room(__objt_server(conn->target)) ||
               (__objt_server(conn->target)->nbpend + 1) < s->be->max_ka_queue))) &&
            srv_is_usable(__objt_server(conn->target))) {
                /* This stream was relying on a server in a previous request
-                * and the proxy has "option prefer-last-server" set, so
+                * and the proxy has "option prefer-last-server" set
+                * and balance algorithm dont tell us to do otherwise, so
                 * let's try to reuse the same server.
                 */
                srv = __objt_server(conn->target);