From: Willy Tarreau Date: Thu, 13 Apr 2017 13:09:26 +0000 (+0200) Subject: BUG/MEDIUM: servers: unbreak server weight propagation X-Git-Tag: v1.8-dev2~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04bf98149bacb4764ae9263fa30ab91dc7c595bc;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: servers: unbreak server weight propagation This reverts commit 266b1a8 ("MEDIUM: server: Inherit CLI weight changes and agent-check weight responses") from Michal Idzikowski, which is still broken. It stops propagating weights at the first error encountered, leaving servers in a random state depending on what LB algorithms are used on other servers tracking the one experiencing the weight change. It's unsure what the best way to address this is, but we cannot leave the servers in an inconsistent state between farms. For example : backend site1 mode http balance uri hash-type consistent server s1 127.0.0.1:8001 weight 10 track servers/s1 backend site2 mode http balance uri server s1 127.0.0.1:8001 weight 10 track servers/s1 backend site3 mode http balance uri hash-type consistent server s1 127.0.0.1:8001 weight 10 track servers/s1 backend servers server s1 127.0.0.1:8001 weight 10 check inter 1s The weight change is applied on "servers/s1". It tries to propagate to the servers tracking it, which are site1/s1, site2/s1 and site3/s1. Let's say that "weight 50%" is requested. The servers are linked in reverse-order, so the change is applied to "servers/s1", then to "site3/s1", then to "site2/s1" and this one fails and rejects the change. The change is aborted and never propagated to "site1/s1", which keeps the server in a different state from "site3/s1". At the very least, in case of error, the changes should probably be unrolled. Also the error reported on the CLI (when changing from the CLI) simply says : Backend is using a static LB algorithm and only accepts weights '0%' and '100%'. Without more indications what the faulty backend is. Let's revert this change for now, as initially feared it will definitely cause more harm than good and at least needs to be revisited. It was never backported to any stable branch so no backport is needed. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 2914581674..05f07019f9 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -11422,10 +11422,6 @@ track [/] enabled. If is omitted the current one is used. If disable-on-404 is used, it has to be enabled on both proxies. - Note: - Relative weight changes are propagated to all tracking servers. Each - tracking server will have its weight recalculated separately. - tlsv10 This option may be used as "server" setting to reset any "no-tlsv10" setting which would have been inherited from "default-server" directive as diff --git a/doc/management.txt b/doc/management.txt index d4b7b68502..1d34f84365 100644 --- a/doc/management.txt +++ b/doc/management.txt @@ -1694,10 +1694,6 @@ set weight / [%] "admin". Both the backend and the server may be specified either by their name or by their numeric ID, prefixed with a sharp ('#'). - Note: - Relative weight changes are propagated to all tracking servers. Each - tracking server will have its weight recalculated separately. - show cli sockets List CLI sockets. The output format is composed of 3 fields separated by spaces. The first field is the socket address, it can be a unix socket, a diff --git a/src/server.c b/src/server.c index 721de33bc5..b5d889005e 100644 --- a/src/server.c +++ b/src/server.c @@ -47,9 +47,6 @@ static void srv_update_state(struct server *srv, int version, char **params); static int srv_apply_lastaddr(struct server *srv, int *err_code); -const char *server_propagate_weight_change_request(struct server *sv, - const char *weight_str); - /* List head of all known server keywords */ static struct srv_kw_list srv_keywords = { .list = LIST_HEAD_INIT(srv_keywords.list) @@ -1448,8 +1445,6 @@ const char *server_parse_weight_change_request(struct server *sv, struct proxy *px; long int w; char *end; - const char *msg; - int relative = 0; px = sv->proxy; @@ -1471,8 +1466,6 @@ const char *server_parse_weight_change_request(struct server *sv, w = sv->iweight * w / 100; if (w > 256) w = 256; - - relative = 1; } else if (w < 0 || w > 256) return "Absolute weight can only be between 0 and 256 inclusive.\n"; @@ -1485,28 +1478,6 @@ const char *server_parse_weight_change_request(struct server *sv, sv->uweight = w; server_recalc_eweight(sv); - if (relative) { - msg = server_propagate_weight_change_request(sv, weight_str); - if (msg != NULL) { - return msg; - } - } - - return NULL; -} - -const char *server_propagate_weight_change_request(struct server *sv, - const char *weight_str) -{ - struct server *tracker; - const char *msg; - - for (tracker = sv->trackers; tracker; tracker = tracker->tracknext) { - msg = server_parse_weight_change_request(tracker, weight_str); - if (msg) - return msg; - } - return NULL; }