1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-03 16:22:35 +03:00

Allow concurrent server_state disconnect operations.

Shutting down the provider may cause replication/appling failures, which
may further result to disconnect calls from failing operations.
Allow concurrent disconnect requests to deal with such a situations.
This commit is contained in:
Teemu Ollakka
2019-12-08 13:42:11 +02:00
parent 29e061116a
commit 90157ed1b0
2 changed files with 43 additions and 0 deletions

View File

@ -524,6 +524,15 @@ int wsrep::server_state::disconnect()
{
{
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
// In case of failure situations which are caused by provider
// being shut down some failing operation may also try to shut
// down the replication. Check the state here and
// return success if the provider disconnect is already in progress
// or has completed.
if (state(lock) == s_disconnecting || state(lock) == s_disconnected)
{
return 0;
}
state(lock, s_disconnecting);
interrupt_state_waiters(lock);
}