]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: srv-state: properly restore the DRAIN state
authorWilly Tarreau <w@1wt.eu>
Thu, 3 Nov 2016 17:19:49 +0000 (18:19 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 7 Nov 2016 13:30:19 +0000 (14:30 +0100)
commit22cace2f4c3cbeca27c1941c647e7ae38ec8c0c0
treee37af7961d9a6b547d1fe83da20bf6588b4fe287
parente6d9c2105941b300131a9e26a84c0646f979747f
BUG/MEDIUM: srv-state: properly restore the DRAIN state

There were seveal reports about the DRAIN state not being properly
restored upon reload.

It happens that the condition in the code does exactly the opposite
of what the comment says, and the comment is right so the code is
wrong.

It's worth noting that the conditions are complex here due to the 2
available methods to set the drain state (CLI/agent, and config's
weight). To paraphrase the updated comment in the code, there are
two possible reasons for FDRAIN to have been present :
  - previous config weight was zero
  - "set server b/s drain" was sent to the CLI

In the first case, we simply want to drop this drain state if the new
weight is not zero anymore, meaning the administrator has intentionally
turned the weight back to a positive value to enable the server again
after an operation. In the second case, the drain state was forced on
the CLI regardless of the config's weight so we don't want a change to
the config weight to lose this status. What this means is :
  - if previous weight was 0 and new one is >0, drop the DRAIN state.
  - if the previous weight was >0, keep it.

This fix must be backported to 1.6.
src/server.c