[MDEV-34009] Client-side implementation of instant failover mechanism #246
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.