1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-28 20:02:00 +03:00

better error handling for NBO failures

when losing error voting:
- if NBO has failed locally (DBMS side), don't override original DBMS
  error so it gets reported to the client
- otherwise, report "query interrupted" instead of "error during commit"
This commit is contained in:
Leandro Pacheco
2019-09-17 11:06:36 -03:00
committed by Teemu Ollakka
parent b63e753aec
commit 3389b7ad3c
2 changed files with 29 additions and 16 deletions

View File

@ -571,12 +571,6 @@ int wsrep::client_state::begin_nbo_phase_one(
break;
}
if (ret && !toi_meta_.seqno().is_undefined())
{
wsrep::mutable_buffer err;
provider().leave_toi(id_, err);
}
debug_log_state("begin_nbo_phase_one: leave");
return ret;
}
@ -621,6 +615,7 @@ int wsrep::client_state::enter_nbo_mode(const wsrep::ws_meta& ws_meta)
int wsrep::client_state::begin_nbo_phase_two(
const wsrep::key_array& keys,
bool has_error,
std::chrono::time_point<wsrep::clock> wait_until)
{
debug_log_state("begin_nbo_phase_two: enter");
@ -651,19 +646,35 @@ int wsrep::client_state::begin_nbo_phase_two(
toi_meta_ = nbo_meta_;
toi_mode_ = m_local;
break;
default:
if (timed_out) {
override_error(e_timeout_error);
} else {
override_error(e_error_during_commit, status);
case wsrep::provider::error_provider_failed:
// If the thread has already errored on the DBMS side, we
// don't override the error so the original one can be reported.
if (!has_error)
{
override_error(e_interrupted_error, status);
}
// Failed to grab TOI for completing NBO in order. This means that
// the operation cannot be ended in total order, so we end the
// NBO mode and let the DBMS to deal with the error.
mode(lock, m_local);
nbo_meta_ = wsrep::ws_meta();
ret= 1;
break;
default:
if (timed_out)
{
override_error(e_timeout_error, status);
}
else
{
override_error(e_error_during_commit, status);
}
ret= 1;
break;
}
// Failed to grab TOI for completing NBO in order. This means that
// the operation cannot be ended in total order, so we end the
// NBO mode and let the DBMS to deal with the error.
if (ret)
{
mode(lock, m_local);
nbo_meta_ = wsrep::ws_meta();
}
debug_log_state("begin_nbo_phase_two: leave");