From 3b07ea039a5fc5f3dd36b50b4e2f91194b7cc829 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Fri, 1 Sep 2023 10:16:33 +0200 Subject: [PATCH] Failed to insert streaming client warning after replay Avoid streaming context cleanup in after_rollback() hook, if transaction is going to replay. Otherwise, streaming client is not stopped and is left in streaming client map, potentially causing "Failed to insert streaming client" warning if the transaction goes for retry. --- src/transaction.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/transaction.cpp b/src/transaction.cpp index 098e786..d6957c5 100644 --- a/src/transaction.cpp +++ b/src/transaction.cpp @@ -743,8 +743,7 @@ int wsrep::transaction::after_rollback() { wsrep::unique_lock lock(client_state_.mutex()); debug_log_state("after_rollback_enter"); - assert(state() == s_aborting || - state() == s_must_replay); + assert(state() == s_aborting || state() == s_must_replay); // Note that it would be technically more correct to // remove fragments after TOI BF abort in before_rollback(), @@ -755,16 +754,18 @@ int wsrep::transaction::after_rollback() if (is_streaming() && bf_aborted_in_total_order_) { remove_fragments_in_storage_service_scope(lock); - streaming_context_.cleanup(); - } - - if (is_streaming() && state() != s_must_replay) - { - streaming_context_.cleanup(); } if (state() == s_aborting) { + if (is_streaming()) + { + // We skip streaming context cleanup for replay because + // we want to remember if the transaction was streaming. + // See transaction::replay() + streaming_context_.cleanup(); + } + state(lock, s_aborted); } @@ -2081,9 +2082,10 @@ int wsrep::transaction::replay(wsrep::unique_lock& lock) break; } - WSREP_LOG_DEBUG(client_state_.debug_log_level(), - wsrep::log::debug_level_transaction, - "replay returned" << replay_ret); + WSREP_LOG_DEBUG( + client_state_.debug_log_level(), wsrep::log::debug_level_transaction, + "replay returned: " << replay_ret << " (" + << wsrep::provider::to_string(replay_ret) << ")"); return ret; }