From e55d2f2c0a3a851d1efba0c9d209770f67a8abd1 Mon Sep 17 00:00:00 2001 From: Hemant Dangi Date: Fri, 3 Jul 2026 16:39:24 +0530 Subject: [PATCH] MDEV-38843: WSREP: BF applier failed on a node causing complete Cluster lockup Issue: When an applier commit fails (e.g. commit order could not be entered because the node is leaving the primary component), the caller skipped after_apply() and left the transaction active. It is then carried to client_state::close(), which runs the local-only after_statement() and asserts client_state_.mode() == m_local in debug builds. Solution: On commit failure roll the applier transaction back and always call after_apply() so it is terminated on the error path, mirroring the apply-error branch. --- src/server_state.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/server_state.cpp b/src/server_state.cpp index 6045b42..975bb79 100644 --- a/src/server_state.cpp +++ b/src/server_state.cpp @@ -336,7 +336,14 @@ static int apply_write_set(wsrep::server_state& server_state, { assert(err.size() == 0); ret = high_priority_service.commit(ws_handle, ws_meta); - ret = ret || (high_priority_service.after_apply(), 0); + // Commit may fail if commit order could not be entered, e.g. + // the node left the primary component. Roll back the + // still-active applier transaction; after_apply() cleans up. + if (ret) + { + high_priority_service.rollback(ws_handle, ws_meta); + } + high_priority_service.after_apply(); } else {