[BUG] checks: don't log backend down for all zero-weight servers

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)
This commit is contained in:
Willy Tarreau 2010-10-17 17:16:42 +02:00
parent 996a92c6dd
commit d64d225e52

View 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++;