mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-12 17:42:52 +02:00
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.