mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-14 15:34:35 +00:00
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.
This commit is contained in:
parent
145325e59d
commit
04bf98149b
@ -11422,10 +11422,6 @@ track [<proxy>/]<server>
|
||||
enabled. If <proxy> 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
|
||||
|
@ -1694,10 +1694,6 @@ set weight <backend>/<server> <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
|
||||
|
29
src/server.c
29
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user