diff --git a/include/wsrep/client_state.hpp b/include/wsrep/client_state.hpp index b502cbd..138bf5f 100644 --- a/include/wsrep/client_state.hpp +++ b/include/wsrep/client_state.hpp @@ -633,7 +633,7 @@ namespace wsrep void xa_detach() { assert(mode_ == m_local); - assert(state_ == s_none || state_ == s_exec); + assert(state_ == s_none || state_ == s_exec || state_ == s_quitting); transaction_.xa_detach(); } diff --git a/src/transaction.cpp b/src/transaction.cpp index 5b30b88..764b183 100644 --- a/src/transaction.cpp +++ b/src/transaction.cpp @@ -1193,11 +1193,15 @@ int wsrep::transaction::commit_or_rollback_by_xid(const wsrep::xid& xid, void wsrep::transaction::xa_detach() { debug_log_state("xa_detach enter"); - assert(state() == s_prepared); - wsrep::server_state& server_state(client_state_.server_state()); - server_state.convert_streaming_client_to_applier(&client_state_); - client_service_.store_globals(); - client_service_.cleanup_transaction(); + assert(state() == s_prepared || + client_state_.state() == wsrep::client_state::s_quitting); + if (state() == s_prepared) + { + wsrep::server_state& server_state(client_state_.server_state()); + server_state.convert_streaming_client_to_applier(&client_state_); + client_service_.store_globals(); + client_service_.cleanup_transaction(); + } wsrep::unique_lock lock(client_state_.mutex_); streaming_context_.cleanup(); state(lock, s_aborting);