Skip to content

Commit 9bacc9d

Browse files
committed
MDEV-20505: Server crash on startup beacuse of bad wsrep configuration
Problem was that if user used bad wsrep configuration we call unireg_abort and in wsrep case there is check to wsrep_server_state that might not yet be initialized. Fixed by checking that wsrep_server_state is initialized before checking it's state. Changes to be committed: modified: sql/mysqld.cc modified: sql/wsrep_server_state.h
1 parent 5c5452a commit 9bacc9d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

sql/mysqld.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,6 +1879,7 @@ extern "C" void unireg_abort(int exit_code)
18791879

18801880
#ifdef WITH_WSREP
18811881
if (WSREP_ON &&
1882+
Wsrep_server_state::is_inited() &&
18821883
Wsrep_server_state::instance().state() != wsrep::server_state::s_disconnected)
18831884
{
18841885
/*
@@ -5108,6 +5109,7 @@ static int init_server_components()
51085109

51095110
#ifdef WITH_WSREP
51105111
if (wsrep_init_server()) unireg_abort(1);
5112+
51115113
if (WSREP_ON && !wsrep_recovery && !opt_abort)
51125114
{
51135115
if (opt_bootstrap) // bootsrap option given - disable wsrep functionality

sql/wsrep_server_state.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,17 @@ class Wsrep_server_state : public wsrep::server_state
3535
const wsrep::gtid& initial_position,
3636
int max_protocol_version);
3737
static void destroy();
38+
3839
static Wsrep_server_state& instance()
3940
{
4041
return *m_instance;
4142
}
4243

44+
static bool is_inited()
45+
{
46+
return (m_instance != NULL);
47+
}
48+
4349
static wsrep::provider& get_provider()
4450
{
4551
return instance().provider();

0 commit comments

Comments
 (0)