On Mon, Jan 25, 2016 at 12:35 AM, Willy Tarreau <[email protected]> wrote: > Hi Baptiste, > > On Sun, Jan 24, 2016 at 09:01:27PM +0100, Baptiste wrote: >> I commented this case in the code: >> >> /* apply drain mode if server is currently enabled */ >> if (!(srv->admin & SRV_ADMF_FMAINT) && (srv_admin_state & SRV_ADMF_FDRAIN)) { >> /* 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); >> } >> } >> >> srv_iweight, taken from the state file, must be 0 and iweight provided >> by the configuration must be greater than 0 to apply the FDRAIN mode. >> >> So I would say yes, we may not be applying the DRAIN state set up by >> the 'set server state drain' command. >> I have to dig into that one. > > But as I said, from what I remember, the main issue is that if the server > is put into drain mode from the agent or the CLI, there's no way from the > config to revert this for now. If later we support startup options to > ignore part of the state files, that may be useful, but for now the risk > is that someone doing a mistake doesn't know how to cancel it even by > restarting.
I said the same in a mail I just sent. That said, I may have found something in accurate. We'll discuss about it tomorrow in the office. > BTW, maybe we should provide this cmd line option, then it will be possible > to state that a service reload maintain the states and that a service > restart drops them. That would make sense I think. Well, from my point of view, it's the role of the init script to do this. I mean, it's really convenient to start up HAProxy with states recovered from a died process or an old container, etc... Baptiste

