Hi Nenad, Baptiste,
@Nenad, thanks for your investigation.
@Baptiste, would it be possible to preserve the drain state? So the
manual change on stats page isn't undone by reloading.
Op 15-6-2016 om 3:02 schreef Nenad Merdanovic:
Hello Pieter,
On 6/14/2016 6:37 PM, PiBa-NL wrote:
Hi list,
While trying out how to use load-server-state-from-file i noticed that
'drain' state set through the stats page is not restored after loading
the state back.
I'm using haproxy 1.6.4 / 1.7-dev2 . I realize these are not the latest
(1.6.5 has dns resolver issues), but am wondering is it 'by design' or
should the administrative state be restored by this as well?
This is still present in HEAD and the "offending" part of code is:
/* The SRV_ADMF_FDRAIN flag is inherited when srv->iweight is 0
* (srv->iweight is the weight set up in configuration)
* so we don't want to apply it when srv_iweight is 0 and
* srv->iweight is greater than 0. Purpose is to give the
* chance to the admin to re-enable this server from configuration
* file by setting a new weight > 0.
*/
if ((srv_iweight == 0) && (srv->iweight > 0)) {
srv_adm_set_drain(srv);
}
This doesn't set the state to DRAIN as srv_iweight is not 0. Now,
looking at the comment and the code, they don't really match IMO, but
I've CCed Baptiste to check this as he developed this part.
That being said, I don't agree with this approach in general, as I think
the state file should be authoritative in all cases and we shouldn't
care if the weight was changed in the configuration. Same thing happens
with applying the weight a little further in the code.
Regards,
Nenad