1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-31 18:24:25 +03:00

Added must_exit boolean flag to high_priority_service interface

This is needed to allow slave threads to exit processing loop
if requested by the DBMS.
This commit is contained in:
Teemu Ollakka
2018-07-06 16:18:59 +03:00
parent e876418ed3
commit 3ff322386c
3 changed files with 9 additions and 2 deletions

View File

@ -21,7 +21,8 @@ namespace wsrep
{
public:
high_priority_service(wsrep::server_state& server_state)
: server_state_(server_state) { }
: server_state_(server_state)
, must_exit_() { }
virtual ~high_priority_service() { }
int apply(const ws_handle& ws_handle, const ws_meta& ws_meta,
@ -79,8 +80,11 @@ namespace wsrep
virtual int log_dummy_write_set(const ws_handle&, const ws_meta&) = 0;
virtual bool is_replaying() const = 0;
bool must_exit() const { return must_exit_; }
protected:
wsrep::server_state& server_state_;
bool must_exit_;
};
class high_priority_switch

View File

@ -558,6 +558,8 @@ int wsrep::transaction::after_statement()
break;
}
case s_aborted:
// Raise a deadlock error if the transaction was BF aborted and
// rolled back by client outside of transaction hooks.
if (bf_aborted() && client_state_.current_error() == wsrep::e_success)
{
client_state_.override_error(wsrep::e_deadlock_error);

View File

@ -361,7 +361,7 @@ namespace
uint32_t flags,
const wsrep_buf_t* buf,
const wsrep_trx_meta_t* meta,
wsrep_bool_t* exit_loop __attribute__((unused)))
wsrep_bool_t* exit_loop)
{
wsrep::high_priority_service* high_priority_service(
reinterpret_cast<wsrep::high_priority_service*>(ctx));
@ -384,6 +384,7 @@ namespace
{
return WSREP_CB_FAILURE;
}
*exit_loop = high_priority_service->must_exit();
return WSREP_CB_SUCCESS;
}
catch (const wsrep::runtime_error& e)