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] Introduce server-initiated instant failover mechanism (and TLS fixes) #3224

Open
wants to merge 11 commits into
base: 11.5
Choose a base branch
from
Prev Previous commit
Next Next commit
Add --follow-instant-failovers option to MariaDB CLI
This option is ENABLED by default.

The `main.mysqld--help` MTR test is updated as well, to reflect the addition
of this option to the `mysqld --help` output.

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.
  • Loading branch information
dlenski committed Apr 26, 2024
commit 49b770e3f73fde79ddb443a2ca4817ab1f61cc0a
10 changes: 9 additions & 1 deletion client/mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
default_pager_set= 0, opt_sigint_ignore= 0,
auto_vertical_output= 0, show_query_cost= 0,
show_warnings= 0, executing_query= 0,
ignore_spaces= 0, opt_binhex= 0, opt_progress_reports;
ignore_spaces= 0, opt_binhex= 0, opt_progress_reports,
opt_follow_instant_failovers= 1;
static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error;
static my_bool column_types_flag;
static my_bool preserve_comments= 0;
Expand Down Expand Up @@ -1503,6 +1504,8 @@ static bool do_connect(MYSQL *mysql, const char *host, const char *user,
if (opt_secure_auth)
mysql_options(mysql, MYSQL_SECURE_AUTH, (char *) &opt_secure_auth);
SET_SSL_OPTS_WITH_CHECK(mysql);
mysql_options(mysql,MARIADB_OPT_FOLLOW_INSTANT_FAILOVERS,
(char*)&opt_follow_instant_failovers);
if (opt_protocol)
mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol);
if (opt_plugin_dir && *opt_plugin_dir)
Expand Down Expand Up @@ -1805,6 +1808,11 @@ static struct my_option my_long_options[] =
&opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include "sslopt-longopts.h"
{"follow-instant-failovers", 0,
"Follow instant failovers. Disable with "
"--disable-follow-instant-failovers. This option is enabled by default.",
&opt_follow_instant_failovers, &opt_follow_instant_failovers,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"table", 't', "Output in table format.", &output_tables,
&output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"tee", OPT_TEE,
Expand Down
16 changes: 16 additions & 0 deletions mysql-test/main/mysqld--help.result
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,20 @@ The following specify which files/extra groups are read (specified before remain
Set the replication role. One of: MASTER, SLAVE
--init-slave=name Command(s) that are executed by a slave server each time
the SQL thread starts
--instant-failover-mode=name
Instant failover mode. Possible modes are: OFF - No
instant failover, ON: Unconditionally redirect new
clients connecting over the network via the standard
server port to INSTANT_FAILOVER_TARGET (no redirection of
local socket-based connections, nor of connections to the
EXTRA_PORT), ALL: Unconditionally redirect all new
clients to INSTANT_FAILOVER_TARGET (even via local
socket-based connections and the EXTRA_PORT).
--instant-failover-target=name
Instant failover target. This should be a hostname, an IP
address, or a hostname or IP address followed by ':PORT'.
Instant failover will not be activated unless
INSTANT_FAILOVER_MODE is also set.
--interactive-timeout=#
The number of seconds the server waits for activity on an
interactive connection before closing it
Expand Down Expand Up @@ -1706,6 +1720,8 @@ init-connect
init-file (No default value)
init-rpl-role MASTER
init-slave
instant-failover-mode OFF
instant-failover-target (No default value)
interactive-timeout 28800
join-buffer-size 262144
join-buffer-space-limit 2097152
Expand Down