Skip to content

Haproxy keeps sending queries to non-ready nodes on shutdown #2074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wonko opened this issue May 9, 2025 · 0 comments
Open

Haproxy keeps sending queries to non-ready nodes on shutdown #2074

wonko opened this issue May 9, 2025 · 0 comments
Labels

Comments

@wonko
Copy link

wonko commented May 9, 2025

Report

Haproxy has a checkscript which is run every 10 seconds, and basically checks for non-maintenance mode, and a state of "4" (joined/synced). There is a situation where, with bigger databases, the following happens:

  • node is initiating shutdown
  • wsrep is leaving the cluster
  • haproxy is still sending queries to the cluster
  • response is "wsrep has not yet prepared the node for application use"

More about the problem

Query response is "WSRep has not yet prepared the node for application use" when kubernetes reschedules a DB node in the cluster (due to node cycling).

Steps to reproduce

Create a big enough database so the shutdown might take a couple of seconds.

Set up a loop which will do a query on a new connection. When this is running, force pxc pods to terminate cleanly.

You will hit this response.

Versions

  1. Kubernetes 1.31
  2. Operator 1.17.0
  3. Database 1.17.0

Anything else?

The solution seems reasonably simple: the haproxy check script is run every 10 seconds, and has a "fall" of "2", so it means that it will take 20 seconds at max before a haproxy node has marked a node as unavailable.

I assume that issuing a "maintenance mode", and then wait for at least 20 seconds before starting the shutdown, should fix this.

@wonko wonko added the bug label May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant