Skip to content

MDEV-30516 : Assertion `wsrep_cluster_address[0]' failed in void wsre… #510

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

Open
wants to merge 1 commit into
base: 10.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions mysql-test/suite/wsrep/r/wsrep_cluster_address_update.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Set sync point and change cluster address, it will block
#
connect con1, localhost, root;
SET DEBUG_SYNC = "wsrep_cluster_address_update SIGNAL update_reached WAIT_FOR continue";
SET GLOBAL wsrep_cluster_address='gcomm://';;
#
# Wait until sync point is reached
#
connect con_ctrl, localhost, root;
SET DEBUG_SYNC = "now WAIT_FOR update_reached";
#
# set !wsrep_cluster_address[0], that failed earlier
#
connect con2, localhost, root;
SET GLOBAL wsrep_cluster_address='';;
connection con_ctrl;
#
# Signal cluster address update to continue
#
SET DEBUG_SYNC = "now SIGNAL continue";
disconnect con1;
disconnect con2;
connect con1, localhost, root;
# restart
disconnect con_ctrl;
call mtr.add_suppression(".*mariadbd got signal.*");
call mtr.add_suppression("Attempting backtrace. Include this in the bug report.");
13 changes: 13 additions & 0 deletions mysql-test/suite/wsrep/t/wsrep_cluster_address_update.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Use default setting for mysqld processes
!include include/default_mysqld.cnf

[mysqld.1]
wsrep-on=ON
binlog-format=ROW
innodb-flush-log-at-trx-commit=1
wsrep-cluster-address=gcomm://
[email protected]_PROVIDER
innodb-autoinc-lock-mode=2
#[email protected]
#[email protected]
#[email protected]
41 changes: 41 additions & 0 deletions mysql-test/suite/wsrep/t/wsrep_cluster_address_update.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
--source include/have_wsrep.inc
--source include/have_innodb.inc
--source include/have_wsrep_provider.inc
--source include/have_debug_sync.inc

--echo #
--echo # Set sync point and change cluster address, it will block
--echo #
--connect con1, localhost, root
SET DEBUG_SYNC = "wsrep_cluster_address_update SIGNAL update_reached WAIT_FOR continue";
--send SET GLOBAL wsrep_cluster_address='gcomm://';

--echo #
--echo # Wait until sync point is reached
--echo #
--connect con_ctrl, localhost, root
SET DEBUG_SYNC = "now WAIT_FOR update_reached";

--echo #
--echo # set !wsrep_cluster_address[0], that failed earlier
--echo #
--connect con2, localhost, root
--send SET GLOBAL wsrep_cluster_address='';

--connection con_ctrl
--echo #
--echo # Signal cluster address update to continue
--echo #
--error 0,2013
SET DEBUG_SYNC = "now SIGNAL continue";
sleep 2;

--disconnect con1
--disconnect con2

--connect con1, localhost, root
--source include/restart_mysqld.inc

--disconnect con_ctrl
call mtr.add_suppression(".*mariadbd got signal.*");
call mtr.add_suppression("Attempting backtrace. Include this in the bug report.");
2 changes: 1 addition & 1 deletion sql/wsrep_mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ void wsrep_init_startup (bool sst_first)
*/
if (!wsrep_start_replication(wsrep_cluster_address)) unireg_abort(1);

wsrep_create_rollbacker();
wsrep_create_rollbacker(wsrep_cluster_address);
wsrep_create_appliers(1);

Wsrep_server_state& server_state= Wsrep_server_state::instance();
Expand Down
6 changes: 3 additions & 3 deletions sql/wsrep_thd.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2013-2023 Codership Oy <[email protected]>
/* Copyright (C) 2013-2025 Codership Oy <[email protected]>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -278,9 +278,9 @@ static void wsrep_rollback_process(THD *rollbacker,
DBUG_VOID_RETURN;
}

void wsrep_create_rollbacker()
void wsrep_create_rollbacker(const char* cluster_address)
{
DBUG_ASSERT(wsrep_cluster_address[0]);
DBUG_ASSERT(cluster_address[0]);
Wsrep_thd_args* args(new Wsrep_thd_args(wsrep_rollback_process,
WSREP_ROLLBACKER_THREAD,
pthread_self()));
Expand Down
4 changes: 2 additions & 2 deletions sql/wsrep_thd.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2013-2023 Codership Oy <[email protected]>
/* Copyright (C) 2013-2025 Codership Oy <[email protected]>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -85,7 +85,7 @@ class Wsrep_thd_queue
int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, void *, system_status_var *,
enum enum_var_type scope);
bool wsrep_create_appliers(long threads, bool mutex_protected=false);
void wsrep_create_rollbacker();
void wsrep_create_rollbacker(const char*);

bool wsrep_bf_abort(THD* bf_thd, THD* victim_thd);
/*
Expand Down
19 changes: 14 additions & 5 deletions sql/wsrep_var.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2008-2023 Codership Oy <http://www.codership.com>
/* Copyright 2008-2025 Codership Oy <http://www.codership.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -657,15 +657,24 @@ bool wsrep_cluster_address_update (sys_var *self, THD* thd, enum_var_type type)
char *tmp= my_strdup(PSI_INSTRUMENT_ME, wsrep_cluster_address, MYF(MY_WME));
WSREP_DEBUG("wsrep_cluster_address_update: %s", wsrep_cluster_address);
mysql_mutex_unlock(&LOCK_global_system_variables);

/* Here, wsrep_cluster_address can be changed */
DEBUG_SYNC(thd, "wsrep_cluster_address_update");
mysql_mutex_lock(&LOCK_wsrep_cluster_config);
wsrep_stop_replication(thd);
/*
Note that we can't lock LOCK_global_system_variables yet
because in below LOCK_wsrep_slave_threads is aquired
and correct mutexing order is LOCK_wsrep_slave_threads
and then LOCK_global_system_variables.

tmp passed below because wsrep_cluster_address could have
been changed meanwhile.
*/
if (*tmp && wsrep_start_replication(tmp))
{
wsrep_create_rollbacker();
WSREP_DEBUG("Cluster address update creating %ld applier threads running %lu",
wsrep_slave_threads, wsrep_running_applier_threads);
wsrep_create_rollbacker(tmp);
WSREP_INFO("Cluster address update to %s creating %ld applier threads running %lu",
tmp, wsrep_slave_threads, wsrep_running_applier_threads);
wsrep_create_appliers(wsrep_slave_threads);
}
mysql_mutex_unlock(&LOCK_wsrep_cluster_config);
Expand Down