Skip to content

fix(controller): don't lose the client disconnect when it fails - #575

Open
krangerich wants to merge 1 commit into
dragonflydb:mainfrom
krangerich:fix/reliable-client-disconnect-on-demotion
Open

fix(controller): don't lose the client disconnect when it fails#575
krangerich wants to merge 1 commit into
dragonflydb:mainfrom
krangerich:fix/reliable-client-disconnect-on-demotion

Conversation

@krangerich

Copy link
Copy Markdown

During a failover, the dragonfly operator sends a SLAVE OF <new master> to the old master, sets the label to role: replica and then trys to disconnect clients. But disconnecting clients isn't robust and might fail.

A timeout on CLIENT LIST left the old master's clients connected for good: the error was only logged, and the next reconcile finds a correctly configured replica, so replicaOf never runs for that pod again.

Mark the pod before demoting it and clear the mark once the disconnect went through. Disconnecting the clients is now retried by a reconciliation loop.
CLIENT LIST plus one kill per client becomes a single CLIENT KILL LADDR. CLIENT KILL LADDR was added in Dragonfly v1.14.0, together with the previously used CLIENT KILL.

Fixes #324
Related: #238

A timeout on CLIENT LIST left the old master's clients connected for good: the
error was only logged, and the next reconcile finds a correctly configured
replica, so replicaOf never runs for that pod again.

Mark the pod before demoting it and clear the mark once the disconnect went
through. CLIENT LIST plus one kill per client becomes a single CLIENT KILL LADDR.

Signed-off-by: Michael J. <7890659+krangerich@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drop connected clients when instance is no longer master

1 participant