mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-30 07:23:07 +03:00
codership/wsrep-lib#34 Changed flow of control in sst_received()
Instead of handling error case at the beginning, execute the middle of method body in case of success, leaving only single call to provider().sst_received() at the end.
This commit is contained in:
@ -528,19 +528,11 @@ void wsrep::server_state::sst_received(wsrep::client_service& cs,
|
|||||||
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
wsrep::unique_lock<wsrep::mutex> lock(mutex_);
|
||||||
assert(state_ == s_joiner || state_ == s_initialized);
|
assert(state_ == s_joiner || state_ == s_initialized);
|
||||||
|
|
||||||
// Deal with error case first. If the SST failed, the system
|
// Run initialization only if the SST was successful.
|
||||||
// may be in unrecoverable state. There is no point of doing
|
// In case of SST failure the system is in undefined state
|
||||||
// anything else then notifying the provider about failure
|
// may not be recoverable.
|
||||||
// and returning control back to caller.
|
if (error == 0)
|
||||||
if (error)
|
|
||||||
{
|
{
|
||||||
if (provider().sst_received(gtid, error))
|
|
||||||
{
|
|
||||||
throw wsrep::runtime_error("wsrep::sst_received() failed");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (server_service_.sst_before_init())
|
if (server_service_.sst_before_init())
|
||||||
{
|
{
|
||||||
if (init_initialized_ == false)
|
if (init_initialized_ == false)
|
||||||
@ -583,6 +575,7 @@ void wsrep::server_state::sst_received(wsrep::client_service& cs,
|
|||||||
|
|
||||||
current_view_ = v;
|
current_view_ = v;
|
||||||
server_service_.log_view(NULL /* this view is stored already */, v);
|
server_service_.log_view(NULL /* this view is stored already */, v);
|
||||||
|
}
|
||||||
|
|
||||||
if (provider().sst_received(gtid, error))
|
if (provider().sst_received(gtid, error))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user