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.
This commit is contained in:
Teemu Ollakka 2023-01-16 17:45:06 +02:00
parent 9924466b3b
commit beb1e230dd
3 changed files with 27 additions and 8 deletions

View file

@ -915,13 +915,19 @@ void wsrep_init_startup (bool sst_first)
With mysqldump SST (!sst_first) wait until the server reaches
joiner state and procedd to accepting connections.
*/
int err= 0;
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
{
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)
{
WSREP_DEBUG("Disconnect provider");
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(),
@ -1038,7 +1048,11 @@ void wsrep_shutdown_replication()
{
WSREP_DEBUG("Disconnect provider");
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);

View file

@ -336,10 +336,15 @@ static bool wsrep_sst_complete (THD* thd,
if ((state == Wsrep_server_state::s_joiner ||
state == Wsrep_server_state::s_initialized))
{
Wsrep_server_state::instance().sst_received(client_service,
rcode);
if (Wsrep_server_state::instance().sst_received(client_service, rcode))
{
failed= true;
}
else
{
WSREP_INFO("SST succeeded for position %s", start_pos_buf);
}
}
else
{
WSREP_ERROR("SST failed for position %s initialized %d server_state %s",

@ -1 +1 @@
Subproject commit f8ff2cfdd4c6424ffd96fc53bcc0f2e1d9ffe137
Subproject commit 275a0af8c5b92f0ee33cfe9e23f3db5f59b56e9d