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

Enable DBMS initialization from applying codepath

In general the provider might not guarantee that after joining
to replication group, the first applied event is view event.

Made init_initialized_ atomic and check it also from applying
codepath. If the DBMS is not yet initialized when applying the
first event, change state to initializing and wait for DBMS
initialization completion.

Notes:
- Allow connected -> initializing state change.
- Handle bootstrap_view in mock_connect to make server state synced
  for tests.
This commit is contained in:
Teemu Ollakka
2021-06-11 12:54:23 +03:00
parent 6fd1fdf690
commit 313d7d2437
4 changed files with 49 additions and 2 deletions

View File

@ -485,6 +485,22 @@ BOOST_FIXTURE_TEST_CASE(
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_disconnected);
}
BOOST_FIXTURE_TEST_CASE(
server_state_sst_first_init_on_apply,
sst_first_server_fixture)
{
connect_in_view(second_view);
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_connected);
sst_received_action();
char buf[1] = { 1 };
BOOST_REQUIRE(ss.on_apply(hps, ws_handle, ws_meta,
wsrep::const_buffer(buf, 1)) == 0);
const wsrep::transaction& txc(cc.transaction());
BOOST_REQUIRE(txc.state() == wsrep::transaction::s_committed);
BOOST_REQUIRE(ss.state() == wsrep::server_state::s_joined);
}
///////////////////////////////////////////////////////////////////////////////
// Test cases for init first //
///////////////////////////////////////////////////////////////////////////////