1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-22232: Fix CTAS replay & retry in case it gets BF-aborted

- Add selected tables as shared keys for CTAS certification
- Set proper security context on the replayer thread
- Disallow CTAS command retry

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
This commit is contained in:
Denis Protivensky
2023-10-27 12:26:08 +03:00
committed by Julius Goryavsky
parent 671f665455
commit e39c497c80
7 changed files with 156 additions and 31 deletions

View File

@ -11634,8 +11634,18 @@ bool Sql_cmd_create_table_like::execute(THD *thd)
Alter_info alter_info(lex->alter_info, thd->mem_root);
#ifdef WITH_WSREP
bool wsrep_ctas= false;
// If CREATE TABLE AS SELECT and wsrep_on
const bool wsrep_ctas= (select_lex->item_list.elements && WSREP(thd));
if (WSREP(thd) && (select_lex->item_list.elements ||
// Only CTAS may be applied not using TOI.
(wsrep_thd_is_applying(thd) && !wsrep_thd_is_toi(thd))))
{
wsrep_ctas= true;
// MDEV-22232: Disable CTAS retry by setting the retry counter to the
// threshold value.
thd->wsrep_retry_counter= thd->variables.wsrep_retry_autocommit;
}
// This will be used in THD::decide_logging_format if CTAS
Enable_wsrep_ctas_guard wsrep_ctas_guard(thd, wsrep_ctas);