From 07b77e862cd36a055a319458fef218eb58467599 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Tue, 17 Dec 2024 13:34:02 +0100 Subject: [PATCH] MDEV-35660 Assertion `trx->xid.is_null()' failed The assertion fails during wsrep recovery step, in function innobase_rollback_by_xid(). The transaction's xid is normally cleared as part of lookup by xid, unless the transaction has a wsrep specific xid. This is a regression from MDEV-24035 (commit ddd7d5d8e34c3edd) which removed the part clears xid before rollback for transaction with a wsrep specific xid. --- storage/innobase/handler/ha_innodb.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ffed80b1341..ee18adbf909 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3076,7 +3076,10 @@ static int innobase_rollback_by_xid(handlerton*, XID *xid) noexcept return XAER_RMFAIL; if (trx_t *trx= trx_get_trx_by_xid(xid)) { - ut_ad(trx->xid.is_null()); /* should have been cleared by the lookup */ + /* Lookup by xid clears the transaction xid. + For wsrep we clear it below. */ + ut_ad(trx->xid.is_null() || wsrep_is_wsrep_xid(&trx->xid)); + trx->xid.null(); trx_deregister_from_2pc(trx); THD* thd= trx->mysql_thd; dberr_t err= trx_rollback_for_mysql(trx);