Commit 48a0a66f authored by Nirbhay Choubey's avatar Nirbhay Choubey

MDEV-10186: mysqld crash when runtime setting wsrep_cluster_address without wsrep_on=ON

On wsrep_cluster_address update, node restarts the replication
and attempts to connect to the new address. In this process it
makes a call to wsrep provider's connect API, which could lead
to segfault if wsrep provider is not loaded (wsrep_on=OFF).

Fixed by making sure that it proceeds only if a provider is
loaded.
parent 7f9fcfe0
#
# MDEV-10186: mysqld crash when runtime setting
# wsrep_cluster_address without wsrep_on=ON
#
SELECT @@wsrep_on;
@@wsrep_on
0
SELECT @@GLOBAL.wsrep_provider;
@@GLOBAL.wsrep_provider
/usr/lib/galera/libgalera_smm.so
SET @@GLOBAL.wsrep_cluster_address='gcomm://';
--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=0
--source include/have_wsrep_provider.inc
--source include/have_binlog_format_row.inc
--echo #
--echo # MDEV-10186: mysqld crash when runtime setting
--echo # wsrep_cluster_address without wsrep_on=ON
--echo #
SELECT @@wsrep_on;
SELECT @@GLOBAL.wsrep_provider;
SET @@GLOBAL.wsrep_cluster_address='gcomm://';
...@@ -881,6 +881,9 @@ bool wsrep_start_replication() ...@@ -881,6 +881,9 @@ bool wsrep_start_replication()
{ {
wsrep_status_t rcode; wsrep_status_t rcode;
/* wsrep provider must be loaded. */
DBUG_ASSERT(wsrep);
/* /*
if provider is trivial, don't even try to connect, if provider is trivial, don't even try to connect,
but resume local node operation but resume local node operation
......
...@@ -348,7 +348,16 @@ bool wsrep_cluster_address_check (sys_var *self, THD* thd, set_var* var) ...@@ -348,7 +348,16 @@ bool wsrep_cluster_address_check (sys_var *self, THD* thd, set_var* var)
bool wsrep_cluster_address_update (sys_var *self, THD* thd, enum_var_type type) bool wsrep_cluster_address_update (sys_var *self, THD* thd, enum_var_type type)
{ {
bool wsrep_on_saved= thd->variables.wsrep_on; bool wsrep_on_saved;
/* Do not proceed if wsrep provider is not loaded. */
if (!wsrep)
{
WSREP_INFO("wsrep provider is not loaded, can't re(start) replication.");
return false;
}
wsrep_on_saved= thd->variables.wsrep_on;
thd->variables.wsrep_on= false; thd->variables.wsrep_on= false;
/* stop replication is heavy operation, and includes closing all client /* stop replication is heavy operation, and includes closing all client
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment