1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-33064: Sync trx->wsrep state from THD on trx start

InnoDB transactions may be reused after committed:
- when taken from the transaction pool
- during a DDL operation execution

In this case wsrep flag on trx object is cleared, which may cause wrong
execution logic afterwards (wsrep-related hooks are not run).

Make trx->wsrep flag initialize from THD object only once on InnoDB transaction
start and don't change it throughout the transaction's lifetime.
The flag is reset at commit time as before.

Unconditionally set wsrep=OFF for THD objects that represent InnoDB background
threads.

Make Wsrep_schema::store_view() operate in its own transaction.

Fix streaming replication transactions' fragments rollback to not switch
THD->wsrep value during transaction's execution
(use THD->wsrep_ignore_table as a workaround).

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
This commit is contained in:
Denis Protivensky
2023-12-25 13:59:07 +03:00
committed by Julius Goryavsky
parent d472391471
commit cfbd57dfb7
8 changed files with 140 additions and 33 deletions

View File

@ -7885,7 +7885,9 @@ int handler::ha_delete_row(const uchar *buf)
}
#ifdef WITH_WSREP
THD *thd= ha_thd();
if (WSREP_NNULL(thd))
/* For streaming replication, when removing fragments, don't call
wsrep_after_row() as that would initiate new streaming transaction */
if (WSREP_NNULL(thd) && !thd->wsrep_ignore_table)
{
/* for streaming replication, the following wsrep_after_row()
may replicate a fragment, so we have to declare potential PA