1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-32444 Data from orphaned XA transaction is lost after online alter

XA support for online alter was totally missing.

Tying on binlog_hton made this hardly visible: simply having binlog_commit
called from xa_commit made an impression that it will automagically work
for online alter, which turns out wrong: all binlog does is writes
"XA END" into trx cache and flushes it to a real binlog.

In comparison, online alter can't do the same, since online replication
happens in a single transaction.

Solution: make a dedicated XA support.
* Extend struct xid_t with a pointer to Online_alter_cache_list
* On prepare: move online alter cache from THD::ha_data to XID passed
* On XA commit/rollback: use the online alter cache stored in this XID.
  This makes us pass xid_cache_element->xid to xa_commit/xa_rollback
  instead of lex->xid
* Use manual memory management for online alter cache list, instead of
  mem_root allocation, since we don't have mem_root connected to the XA
  transaction.
This commit is contained in:
Nikita Malyavin
2023-10-11 12:37:24 +04:00
parent a569515a9d
commit 23f9e34256
8 changed files with 337 additions and 22 deletions

View File

@@ -1539,6 +1539,8 @@ void THD::cleanup(void)
else
trans_rollback(this);
DEBUG_SYNC(this, "THD_cleanup_after_trans_cleanup");
DBUG_ASSERT(open_tables == NULL);
DBUG_ASSERT(m_transaction_psi == NULL);