Skip to content
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

[MDEV-34009] Client-side implementation of instant failover mechanism #246

Open
wants to merge 3 commits into
base: 3.4
Choose a base branch
from

Conversation

dlenski
Copy link
Contributor

@dlenski dlenski commented Apr 29, 2024

This PR is a pared-down version of #245, which only introduces support for the the server-initiated instant failover mechanism and does not address any of the pre-existing TLS issues which were discovered or highlighted during its development.

Upstream developers chose a different approach (see MariaDB/server#1472 and #137) for MDEV-15935 ("connection redirection").

I maintain that a simple and obligatory server-directed failover mechanism will be a very useful feature for many users, so I'm reintroducing it here under the alternative name of "instant failover."


This is the client counterpart of MariaDB/server#3224, which provides an initial server-initiated mechanism for instantly redirecting new client connections to a failover server.

It modifies the Connector/C library, so that if the server responds to our initial connection with an error packet having
error number ER_INSTANT_FAILOVER, and an error string formatted as |Human-readable message|host[:port], the client will redirect its connection accordingly.

This redirection is performed in mthd_my_real_connect, which appears to be the most appropriate location given that it already contains code for retrying/repeating a new server connection.

If the server responds to our initial connection with an error packet having
error number `ER_INSTANT_FAILOVER`, and an error string formatted as
`|Human-readable message|host[:port]`, then redirect accordingly.

This redirection is performed in `mthd_my_real_connect`, which appears to be
the most appropriate location given that it already contains code for
retrying/repeating a new server connection.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
This adds a new boolean option, `follow-instant-failovers` (ENABLED by
default), to allow the client to disable server-initiated instant failover
and simply return an error message.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
Set the limit to 8 for now. This will prevent the client from getting stuck
in redirect loops.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
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.

1 participant