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

MDEV-35326: Memory Leak in init_io_cache_ext upon SHUTDOWN

The problems were that:
1) resources was freed "asimetric" normal execution in send_eof,
 in case of error in destructor.
2) destructor was not called in case of SP for result objects.
(so if the last SP execution ended with error resorces was not
freeded on reinit before execution (cleanup() called before next
execution) and destructor also was not called due to lack of
delete call for the object)

Result cleanup() renamed to reset_for_next_ps_execution() to better
reflect function().

All result method revised and freeing resources made "symetric".

Destructor of result object called for SP.

Added skipped invalidation in case of error in insert.

Removed misleading naming of reset(thd) (could be mixed with
with reset()).
This commit is contained in:
Oleksandr Byelkin
2024-12-23 22:36:01 +01:00
parent f862fe8b2b
commit 0d35fe6e57
12 changed files with 162 additions and 69 deletions

View File

@ -2743,6 +2743,13 @@ void multi_update::abort_result_set()
(!thd->transaction->stmt.modified_non_trans_table && !updated)))
return;
/****************************************************************************
NOTE: if you change here be aware that almost the same code is in
multi_update::send_eof().
***************************************************************************/
/* Something already updated so we have to invalidate cache */
if (updated)
query_cache_invalidate3(thd, update_tables, 1);
@ -3072,6 +3079,13 @@ bool multi_update::send_eof()
killed_status= (local_error == 0) ? NOT_KILLED : thd->killed;
THD_STAGE_INFO(thd, stage_end);
/****************************************************************************
NOTE: if you change here be aware that almost the same code is in
multi_update::abort_result_set().
***************************************************************************/
/* We must invalidate the query cache before binlog writing and
ha_autocommit_... */