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

MDEV-33426: Aria temptables wrong thread-specific memory accounting in slave thread

Aria temporary tables account allocated memory as specific to the current
THD. But this fails for slave threads, where the temporary tables need to be
detached from any specific THD.

Introduce a new flag to mark temporary tables in replication as "global",
and use that inside Aria to not account memory allocations as thread
specific for such tables.

Based on original suggestion by Monty.

Reviewed-by: Monty <monty@mariadb.org>
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Kristian Nielsen
2024-02-11 11:57:42 +01:00
parent ae709b64e2
commit c73c6aea63
16 changed files with 110 additions and 30 deletions

View File

@ -1115,11 +1115,16 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share,
DBUG_RETURN(NULL); /* Out of memory */
}
uint flags= ha_open_options | (open_options & HA_OPEN_FOR_CREATE);
/*
In replication, temporary tables are not confined to a single
thread/THD.
*/
if (slave_thread)
flags|= HA_OPEN_GLOBAL_TMP_TABLE;
if (open_table_from_share(this, share, &alias,
(uint) HA_OPEN_KEYFILE,
EXTRA_RECORD,
(ha_open_options |
(open_options & HA_OPEN_FOR_CREATE)),
EXTRA_RECORD, flags,
table, false))
{
my_free(table);