redispatch never worked for hash based alghoritms, as the code
(BE_LB_LKUP_CHTREE -> chash_get_next_server()) would only have been
called for BE_LB_KIND_RR, which doesn't make sense. Fix this by also
going down this code path when the BE_LB_KIND is BE_LB_KIND_HI.

Reported by Oskar Stenman on discourse:
https://discourse.haproxy.org/t/balance-uri-consistent-hashing-redispatch-3-not-redispatching/3344

Can be backported to 1.6.
---
 src/backend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend.c b/src/backend.c
index bc38c57..a402a86 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -637,7 +637,7 @@ int assign_server(struct stream *s)
 
                case BE_LB_LKUP_CHTREE:
                case BE_LB_LKUP_MAP:
-                       if ((s->be->lbprm.algo & BE_LB_KIND) == BE_LB_KIND_RR) {
+                       if ((s->be->lbprm.algo & BE_LB_KIND) == BE_LB_KIND_RR 
|| (s->be->lbprm.algo & BE_LB_KIND) == BE_LB_KIND_HI) {
                                if ((s->be->lbprm.algo & BE_LB_PARM) == 
BE_LB_RR_RANDOM)
                                        srv = get_server_rnd(s);
                                else if (s->be->lbprm.algo & BE_LB_LKUP_CHTREE)
-- 
2.7.4

Reply via email to