mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-30 07:23:07 +03:00
* Return provider status from provider connect
* Call to get server status variables along with provider variables * Deal with intermediate non-prims
This commit is contained in:
@ -39,9 +39,10 @@ namespace wsrep
|
||||
, rollback_fragments_()
|
||||
{ }
|
||||
|
||||
int connect(const std::string&, const std::string&, const std::string&,
|
||||
bool)
|
||||
{ return 0; }
|
||||
enum wsrep::provider::status
|
||||
connect(const std::string&, const std::string&, const std::string&,
|
||||
bool)
|
||||
{ return wsrep::provider::success; }
|
||||
int disconnect() { return 0; }
|
||||
int capabilities() const { return 0; }
|
||||
int desync() { return 0; }
|
||||
|
@ -23,6 +23,7 @@ namespace wsrep
|
||||
enum wsrep::server_state::rollback_mode rollback_mode)
|
||||
: wsrep::server_state(mutex_, cond_, *this,
|
||||
name, id, "", "./", 1, rollback_mode)
|
||||
, sst_before_init_()
|
||||
, mutex_()
|
||||
, cond_()
|
||||
, provider_(*this)
|
||||
@ -63,11 +64,12 @@ namespace wsrep
|
||||
}
|
||||
void log_view(const wsrep::view&) { }
|
||||
|
||||
void on_connect() WSREP_OVERRIDE { }
|
||||
void wait_until_connected() WSREP_OVERRIDE { }
|
||||
void on_view(const wsrep::view&) WSREP_OVERRIDE { }
|
||||
void on_sync() WSREP_OVERRIDE { }
|
||||
bool sst_before_init() const WSREP_OVERRIDE { return false; }
|
||||
// void on_connect(const wsrep::gtid& ) WSREP_OVERRIDE { }
|
||||
// void wait_until_connected() WSREP_OVERRIDE { }
|
||||
// void on_view(const wsrep::view&) WSREP_OVERRIDE { }
|
||||
// void on_sync() WSREP_OVERRIDE { }
|
||||
bool sst_before_init() const WSREP_OVERRIDE
|
||||
{ return sst_before_init_; }
|
||||
std::string sst_request() WSREP_OVERRIDE { return ""; }
|
||||
int start_sst(const std::string&,
|
||||
const wsrep::gtid&,
|
||||
@ -78,6 +80,9 @@ namespace wsrep
|
||||
client_state.before_rollback();
|
||||
client_state.after_rollback();
|
||||
}
|
||||
|
||||
bool sst_before_init_;
|
||||
|
||||
private:
|
||||
wsrep::default_mutex mutex_;
|
||||
wsrep::default_condition_variable cond_;
|
||||
|
@ -30,6 +30,15 @@ namespace
|
||||
wsrep::ws_handle ws_handle;
|
||||
wsrep::ws_meta ws_meta;
|
||||
};
|
||||
|
||||
struct sst_first_server_fixture : applying_server_fixture
|
||||
{
|
||||
sst_first_server_fixture()
|
||||
: applying_server_fixture()
|
||||
{
|
||||
sc.sst_before_init_ = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Test on_apply() method for 1pc
|
||||
@ -140,3 +149,24 @@ BOOST_AUTO_TEST_CASE(server_state_state_strings)
|
||||
BOOST_REQUIRE(wsrep::to_string(
|
||||
static_cast<enum wsrep::server_state::state>(0xff)) == "unknown");
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(server_state_sst_first_boostrap,
|
||||
sst_first_server_fixture)
|
||||
{
|
||||
wsrep::id cluster_id("1");
|
||||
wsrep::gtid state_id(cluster_id, wsrep::seqno(0));
|
||||
std::vector<wsrep::view::member> members;
|
||||
members.push_back(wsrep::view::member(wsrep::id("1"), "name", ""));
|
||||
wsrep::view bootstrap_view(state_id,
|
||||
wsrep::seqno(1),
|
||||
wsrep::view::primary,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
members);
|
||||
BOOST_REQUIRE(sc.connect("cluster", "local", "0", false) == 0);
|
||||
sc.on_connect(wsrep::gtid(cluster_id, wsrep::seqno(0)));
|
||||
// @todo Blocks on state wait, need to figure out a way to avoid
|
||||
// that.
|
||||
// sc.on_view(bootstrap_view);
|
||||
}
|
||||
|
Reference in New Issue
Block a user