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
This commit is contained in:
Jan Lindström 2019-09-11 13:13:37 +03:00
parent 5c5452a5a0
commit 9bacc9d0c1
2 changed files with 8 additions and 0 deletions

View file

@ -1879,6 +1879,7 @@ extern "C" void unireg_abort(int exit_code)
#ifdef WITH_WSREP
if (WSREP_ON &&
Wsrep_server_state::is_inited() &&
Wsrep_server_state::instance().state() != wsrep::server_state::s_disconnected)
{
/*
@ -5108,6 +5109,7 @@ static int init_server_components()
#ifdef WITH_WSREP
if (wsrep_init_server()) unireg_abort(1);
if (WSREP_ON && !wsrep_recovery && !opt_abort)
{
if (opt_bootstrap) // bootsrap option given - disable wsrep functionality

View file

@ -35,11 +35,17 @@ public:
const wsrep::gtid& initial_position,
int max_protocol_version);
static void destroy();
static Wsrep_server_state& instance()
{
return *m_instance;
}
static bool is_inited()
{
return (m_instance != NULL);
}
static wsrep::provider& get_provider()
{
return instance().provider();