]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] checks: don't log backend down for all zero-weight servers
authorWilly Tarreau <w@1wt.eu>
Sun, 17 Oct 2010 15:16:42 +0000 (17:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 30 Oct 2010 17:04:34 +0000 (19:04 +0200)
In a down backend, when a zero-weight server is lost, a new
"backend down" message was emitted and the down transition of that
backend was wrongly increased. This change ensures that we don't
count that transition again.

This patch should be backported to 1.3.
(cherry picked from commit 60efc5f745b5fa70d811f977727592e47e32a281)

src/checks.c

index cd4dd30d9103197063b0f9a637364a2eba36e87a..4132f5e576fb1d86b554b7b6642dfe15e60aae2e 100644 (file)
@@ -373,6 +373,7 @@ void set_server_down(struct server *s)
 
        if (s->health == s->rise || s->tracked) {
                int srv_was_paused = s->state & SRV_GOINGDOWN;
+               int prev_srv_count = s->proxy->srv_bck + s->proxy->srv_act;
 
                s->last_change = now.tv_sec;
                s->state &= ~(SRV_RUNNING | SRV_GOINGDOWN);
@@ -407,7 +408,7 @@ void set_server_down(struct server *s)
                else
                        send_log(s->proxy, LOG_ALERT, "%s.\n", trash);
 
-               if (s->proxy->srv_bck == 0 && s->proxy->srv_act == 0)
+               if (prev_srv_count && s->proxy->srv_bck == 0 && s->proxy->srv_act == 0)
                        set_backend_down(s->proxy);
 
                s->counters.down_trans++;