From 5ef2c956a92958b7cc70f2c93deb522132a3f848 Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Thu, 5 Jul 2018 17:42:38 +0300 Subject: [PATCH] Added a separate call to notify the client thread about completion of background rollback. The separate call is necessary as all of the resources may not have been released before the execution reaches after_rollback() call and background rollbacker needs to notify the client thread after all is complete. --- include/wsrep/client_state.hpp | 12 ++++++++++++ src/transaction.cpp | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/wsrep/client_state.hpp b/include/wsrep/client_state.hpp index 01a74e2..c17262e 100644 --- a/include/wsrep/client_state.hpp +++ b/include/wsrep/client_state.hpp @@ -382,6 +382,18 @@ namespace wsrep state_ == s_quitting); return transaction_.after_rollback(); } + + /** + * This method should be called by the background rollbacker + * thread after the rollback is complete. This will allow + * the client to proceed with command execution. + */ + void sync_rollback_complete() + { + assert(state_ == s_idle && mode_ == m_replicating && + transaction_.state() == wsrep::transaction::s_aborted); + cond_.notify_all(); + } /** @} */ // diff --git a/src/transaction.cpp b/src/transaction.cpp index 984a3ba..09c2ed4 100644 --- a/src/transaction.cpp +++ b/src/transaction.cpp @@ -470,7 +470,6 @@ int wsrep::transaction::after_rollback() if (state() == s_aborting) { state(lock, s_aborted); - client_state_.cond_.notify_all(); } // Releasing the transaction from provider is postponed into