From 3ff322386c55059f1d7a983aec7ae8865c2567d8 Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Fri, 6 Jul 2018 16:18:59 +0300 Subject: [PATCH] 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. --- include/wsrep/high_priority_service.hpp | 6 +++++- src/transaction.cpp | 2 ++ src/wsrep_provider_v26.cpp | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/wsrep/high_priority_service.hpp b/include/wsrep/high_priority_service.hpp index c8248c1..3af7dba 100644 --- a/include/wsrep/high_priority_service.hpp +++ b/include/wsrep/high_priority_service.hpp @@ -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 diff --git a/src/transaction.cpp b/src/transaction.cpp index 8abee55..5a244e0 100644 --- a/src/transaction.cpp +++ b/src/transaction.cpp @@ -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); diff --git a/src/wsrep_provider_v26.cpp b/src/wsrep_provider_v26.cpp index 366612e..f592f17 100644 --- a/src/wsrep_provider_v26.cpp +++ b/src/wsrep_provider_v26.cpp @@ -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(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)