Commit beb1e230 authored by Teemu Ollakka's avatar Teemu Ollakka

MDEV-30419 Fix unhandled exception thrown from wsrep-lib

Updated wsrep-lib to version in which server_state
wait_until_state() and sst_received() were changed to report
errors via return codes instead of throwing exceptions. Added
error handling accordingly.

Tested manually that failure in sst_received() which was
caused by server misconfiguration (unknown configuration variable
in server configuration) does not cause crash due to uncaught
exception.
parent 9924466b
...@@ -915,13 +915,19 @@ void wsrep_init_startup (bool sst_first) ...@@ -915,13 +915,19 @@ void wsrep_init_startup (bool sst_first)
With mysqldump SST (!sst_first) wait until the server reaches With mysqldump SST (!sst_first) wait until the server reaches
joiner state and procedd to accepting connections. joiner state and procedd to accepting connections.
*/ */
int err= 0;
if (sst_first) if (sst_first)
{ {
server_state.wait_until_state(Wsrep_server_state::s_initializing); err= server_state.wait_until_state(Wsrep_server_state::s_initializing);
} }
else else
{ {
server_state.wait_until_state(Wsrep_server_state::s_joiner); err= server_state.wait_until_state(Wsrep_server_state::s_joiner);
}
if (err)
{
WSREP_ERROR("Wsrep startup was interrupted");
unireg_abort(1);
} }
} }
...@@ -1016,7 +1022,11 @@ void wsrep_stop_replication(THD *thd) ...@@ -1016,7 +1022,11 @@ void wsrep_stop_replication(THD *thd)
{ {
WSREP_DEBUG("Disconnect provider"); WSREP_DEBUG("Disconnect provider");
Wsrep_server_state::instance().disconnect(); Wsrep_server_state::instance().disconnect();
Wsrep_server_state::instance().wait_until_state(Wsrep_server_state::s_disconnected); if (Wsrep_server_state::instance().wait_until_state(
Wsrep_server_state::s_disconnected))
{
WSREP_WARN("Wsrep interrupted while waiting for disconnected state");
}
} }
/* my connection, should not terminate with wsrep_close_client_connection(), /* my connection, should not terminate with wsrep_close_client_connection(),
...@@ -1038,7 +1048,11 @@ void wsrep_shutdown_replication() ...@@ -1038,7 +1048,11 @@ void wsrep_shutdown_replication()
{ {
WSREP_DEBUG("Disconnect provider"); WSREP_DEBUG("Disconnect provider");
Wsrep_server_state::instance().disconnect(); Wsrep_server_state::instance().disconnect();
Wsrep_server_state::instance().wait_until_state(Wsrep_server_state::s_disconnected); if (Wsrep_server_state::instance().wait_until_state(
Wsrep_server_state::s_disconnected))
{
WSREP_WARN("Wsrep interrupted while waiting for disconnected state");
}
} }
wsrep_close_client_connections(TRUE); wsrep_close_client_connections(TRUE);
......
...@@ -336,10 +336,15 @@ static bool wsrep_sst_complete (THD* thd, ...@@ -336,10 +336,15 @@ static bool wsrep_sst_complete (THD* thd,
if ((state == Wsrep_server_state::s_joiner || if ((state == Wsrep_server_state::s_joiner ||
state == Wsrep_server_state::s_initialized)) state == Wsrep_server_state::s_initialized))
{ {
Wsrep_server_state::instance().sst_received(client_service, if (Wsrep_server_state::instance().sst_received(client_service, rcode))
rcode); {
failed= true;
}
else
{
WSREP_INFO("SST succeeded for position %s", start_pos_buf); WSREP_INFO("SST succeeded for position %s", start_pos_buf);
} }
}
else else
{ {
WSREP_ERROR("SST failed for position %s initialized %d server_state %s", WSREP_ERROR("SST failed for position %s initialized %d server_state %s",
......
Subproject commit f8ff2cfdd4c6424ffd96fc53bcc0f2e1d9ffe137 Subproject commit 275a0af8c5b92f0ee33cfe9e23f3db5f59b56e9d
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