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

MDEV-35510 ASAN build crashes during bootstrap

Avoid ASAN failure by collecting statistics from Result objects
before cleaning them up.  In related single-table cases, statistics
are maintained directly by the single-table update and delete
functions.
This commit is contained in:
Dave Gosselin
2025-02-03 10:42:16 -05:00
committed by Dave Gosselin
parent 6cff704e57
commit d3c9a2ee21
6 changed files with 64 additions and 30 deletions

View File

@@ -328,7 +328,6 @@ bool Sql_cmd_delete::delete_from_single_table(THD *thd)
SQL_SELECT *select= 0;
SORT_INFO *file_sort= 0;
READ_RECORD info;
ha_rows deleted= 0;
bool reverse= FALSE;
bool binlog_is_row;
killed_state killed_status= NOT_KILLED;
@@ -427,6 +426,7 @@ bool Sql_cmd_delete::delete_from_single_table(THD *thd)
has_triggers= table->triggers && table->triggers->has_delete_triggers();
transactional_table= table->file->has_transactions_and_rollback();
deleted= 0;
if (!returning && !using_limit && const_cond_result &&
(!thd->is_current_stmt_binlog_format_row() && !has_triggers)
@@ -975,7 +975,7 @@ cleanup:
result->send_eof();
else
my_ok(thd, deleted);
DBUG_PRINT("info",("%ld records deleted",(long) deleted));
DBUG_PRINT("info", ("%ld records deleted", (long) deleted));
}
delete file_sort;
free_underlaid_joins(thd, select_lex);
@@ -1861,6 +1861,9 @@ bool Sql_cmd_delete::execute_inner(THD *thd)
if (result)
{
/* In single table case, this->deleted set by delete_from_single_table */
if (res && multitable)
deleted= ((multi_delete*)get_result())->num_deleted();
res= false;
delete result;
}