mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-20 01:03:16 +03:00
Extracted duplicate logic into return_from_donor_state
The condition to skip changing to `s_joined` for all codepaths which return from donor state. Extracted the logic into separate method. Commented start_sst_action in mock_server_service.
This commit is contained in:
@ -674,13 +674,7 @@ int wsrep::server_state::start_sst(const std::string& sst_request,
|
||||
{
|
||||
lock.lock();
|
||||
wsrep::log_warning() << "SST preparation failed";
|
||||
// v26 API does not have JOINED event, so in anticipation of SYNCED
|
||||
// we must do it here. Do not modify the state if donor lost the
|
||||
// donor state e.g. due to cluster partitioning.
|
||||
if (state(lock) == s_donor)
|
||||
{
|
||||
state(lock, s_joined);
|
||||
}
|
||||
return_from_donor_state(lock);
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
@ -694,13 +688,8 @@ void wsrep::server_state::sst_sent(const wsrep::gtid& gtid, int error)
|
||||
wsrep::log_info() << "SST sending failed: " << error;
|
||||
|
||||
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
||||
// v26 API does not have JOINED event, so in anticipation of SYNCED
|
||||
// we must do it here. Do not modify the state if donor lost the
|
||||
// donor state e.g. due to cluster partitioning.
|
||||
if (state(lock) == s_donor)
|
||||
{
|
||||
state(lock, s_joined);
|
||||
}
|
||||
|
||||
return_from_donor_state(lock);
|
||||
|
||||
lock.unlock();
|
||||
enum provider::status const retval(provider().sst_sent(gtid, error));
|
||||
@ -1650,3 +1639,16 @@ wsrep::server_state::send_pending_rollback_events()
|
||||
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
||||
return send_pending_rollback_events(lock);
|
||||
}
|
||||
|
||||
void wsrep::server_state::return_from_donor_state(
|
||||
wsrep::unique_lock<wsrep::mutex>& lock)
|
||||
{
|
||||
assert(lock.owns_lock());
|
||||
// v26 API does not have JOINED event, so in anticipation of SYNCED
|
||||
// we must do it here. Do not modify the state if donor lost the
|
||||
// donor state e.g. due to cluster partitioning.
|
||||
if (state(lock) == s_donor)
|
||||
{
|
||||
state(lock, s_joined);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user