1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-06 20:56:43 +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

@ -615,3 +615,37 @@ BOOST_FIXTURE_TEST_CASE(
ss.resume_and_resync();
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_synced);
}
/////////////////////////////////////////////////////////////////////////////
// Disconnect //
/////////////////////////////////////////////////////////////////////////////
BOOST_FIXTURE_TEST_CASE(
server_state_disconnect,
sst_first_server_fixture)
{
bootstrap();
ss.disconnect();
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_disconnecting);
final_view();
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_disconnected);
}
// This test case verifies that the disconnect can be initiated
// concurrently by several callers. This may happen in failure situations
// where provider shutdown causes cascading failures and the failing operations
// try to disconnect the provider.
BOOST_FIXTURE_TEST_CASE(
server_state_disconnect_twice,
sst_first_server_fixture)
{
bootstrap();
ss.disconnect();
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_disconnecting);
ss.disconnect();
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_disconnecting);
final_view();
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_disconnected);
ss.disconnect();
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_disconnected);
}