mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-30 07:23:07 +03:00
Protocol version and connected gtid
* Propagate server max protocol version to provider init options * Store gtid from connected call to make cluster id and the connect position available
This commit is contained in:
@ -212,10 +212,11 @@ namespace
|
||||
}
|
||||
|
||||
int wsrep::server_state::load_provider(const std::string& provider_spec,
|
||||
const std::string& provider_options)
|
||||
const std::string& provider_options)
|
||||
{
|
||||
wsrep::log_info() << "Loading provider " << provider_spec;
|
||||
provider_ = wsrep::provider::make_provider(*this, provider_spec, provider_options);
|
||||
provider_ = wsrep::provider::make_provider(
|
||||
*this, provider_spec, provider_options);
|
||||
return (provider_ ? 0 : 1);
|
||||
}
|
||||
|
||||
@ -418,10 +419,14 @@ wsrep::server_state::causal_read(int timeout) const
|
||||
return provider_->causal_read(timeout);
|
||||
}
|
||||
|
||||
void wsrep::server_state::on_connect()
|
||||
void wsrep::server_state::on_connect(const wsrep::gtid& gtid)
|
||||
{
|
||||
wsrep::log_info() << "Server " << name_ << " connected to cluster";
|
||||
wsrep::log_info() << "Server "
|
||||
<< name_
|
||||
<< " connected to cluster at position "
|
||||
<< gtid;
|
||||
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
||||
connected_gtid_ = gtid;
|
||||
state(lock, s_connected);
|
||||
}
|
||||
|
||||
@ -431,6 +436,7 @@ void wsrep::server_state::on_view(const wsrep::view& view)
|
||||
<< "================================================\nView:\n"
|
||||
<< " id: " << view.state_id() << "\n"
|
||||
<< " status: " << view.status() << "\n"
|
||||
<< " prococol_version: " << view.protocol_version() << "\n"
|
||||
<< " own_index: " << view.own_index() << "\n"
|
||||
<< " final: " << view.final() << "\n"
|
||||
<< " members";
|
||||
@ -445,6 +451,7 @@ void wsrep::server_state::on_view(const wsrep::view& view)
|
||||
if (view.status() == wsrep::view::primary)
|
||||
{
|
||||
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
||||
current_view_ = view;
|
||||
if (state_ == s_connected && view.members().size() == 1)
|
||||
{
|
||||
state(lock, s_joiner);
|
||||
@ -472,7 +479,6 @@ void wsrep::server_state::on_view(const wsrep::view& view)
|
||||
{
|
||||
state(lock, s_disconnected);
|
||||
}
|
||||
current_view_ = view;
|
||||
}
|
||||
server_service_.log_view(view);
|
||||
}
|
||||
|
@ -967,10 +967,11 @@ void wsrep::transaction::debug_log_state(
|
||||
const char* context) const
|
||||
{
|
||||
WSREP_TC_LOG_DEBUG(
|
||||
1, context
|
||||
0, context
|
||||
<< ": server: " << client_state_.server_state().name()
|
||||
<< " client: " << client_state_.id().get()
|
||||
<< " trx: " << int64_t(id_.get())
|
||||
<< " seqno: " << ws_meta_.seqno().get()
|
||||
<< " state: " << wsrep::to_string(state_)
|
||||
<< " error: "
|
||||
<< wsrep::to_string(client_state_.current_error()));
|
||||
|
@ -286,17 +286,15 @@ namespace
|
||||
|
||||
wsrep_cb_status_t connected_cb(
|
||||
void* app_ctx,
|
||||
const wsrep_view_info_t* view __attribute((unused)))
|
||||
const wsrep_view_info_t* view_info)
|
||||
{
|
||||
assert(app_ctx);
|
||||
wsrep::view view(view_from_native(*view_info));
|
||||
wsrep::server_state& server_state(
|
||||
*reinterpret_cast<wsrep::server_state*>(app_ctx));
|
||||
//
|
||||
// TODO: Fetch server id and group id from view infor
|
||||
//
|
||||
try
|
||||
{
|
||||
server_state.on_connect();
|
||||
server_state.on_connect(view.state_id());
|
||||
return WSREP_CB_SUCCESS;
|
||||
}
|
||||
catch (const wsrep::runtime_error& e)
|
||||
@ -475,7 +473,7 @@ wsrep::wsrep_provider_v26::wsrep_provider_v26(
|
||||
init_args.node_incoming = "";
|
||||
init_args.data_dir = server_state_.working_dir().c_str();
|
||||
init_args.options = provider_options.c_str();
|
||||
init_args.proto_ver = 1;
|
||||
init_args.proto_ver = server_state.max_protocol_version();
|
||||
init_args.state_id = 0;
|
||||
init_args.state = 0;
|
||||
init_args.logger_cb = &logger_cb;
|
||||
|
Reference in New Issue
Block a user