Hi, Nikita, On Aug 07, Nikita Malyavin wrote:
revision-id: 63c93f89af9 (mariadb-11.0.1-192-g63c93f89af9) parent(s): a75ba4caa51 author: Nikita Malyavin committer: Nikita Malyavin timestamp: 2023-08-05 20:17:41 +0400 message:
MDEV-31804 Assertion `thd->m_transaction_psi == __null' fails ... index 1c8d56cafd1..66b2b1ee4cc 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1459,7 +1459,7 @@ void trans_register_ha(THD *thd, bool all, handlerton *ht_arg, ulonglong trxid) Do not register transactions in which binary log is the only participating transactional storage engine. */ - if (thd->m_transaction_psi == NULL && ht_arg->db_type != DB_TYPE_BINLOG) + if (thd->m_transaction_psi == NULL && ht_arg != binlog_hton)
it would've been better to fix it in 10.4, but if it doesn't show before online alter then ok
{ thd->m_transaction_psi= MYSQL_START_TRANSACTION(&thd->m_transaction_state, thd->get_xid(), trxid, thd->tx_isolation, thd->tx_read_only, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 88302096272..944807ea422 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -65,6 +65,7 @@ #include "rpl_rli.h" #include "log.h" #include "sql_debug.h" +#include "mysql/psi/mysql_transaction.h"
#ifdef _WIN32 #include <io.h> @@ -11653,6 +11654,9 @@ bool mysql_trans_commit_alter_copy_data(THD *thd)
DEBUG_SYNC(thd, "alter_table_copy_trans_commit");
+ MYSQL_COMMIT_TRANSACTION(thd->m_transaction_psi); + thd->m_transaction_psi= NULL;
I don't understand it. ha_enable_transaction() commits the transaction it calls ha_commit_trans(). And ha_commit_trans() does the above psi manipulations. Why do you need to do that explicitly? Also, as a cleanup, I suspect, you can remove explicit commit that follows ha_enable_transaction() in mysql_trans_commit_alter_copy_data(). Seems to be redundant.
if (ha_enable_transaction(thd, TRUE)) DBUG_RETURN(TRUE);
Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org