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:
committed by
Dave Gosselin
parent
6cff704e57
commit
d3c9a2ee21
@@ -34268,39 +34268,38 @@ static void MYSQL_DML_START(THD *thd)
|
||||
}
|
||||
|
||||
|
||||
static void MYSQL_DML_DONE(THD *thd, int rc)
|
||||
static void MYSQL_DML_GET_STAT(THD * thd, ha_rows &found, ha_rows &changed)
|
||||
{
|
||||
switch (thd->lex->sql_command) {
|
||||
|
||||
case SQLCOM_UPDATE:
|
||||
MYSQL_UPDATE_DONE(
|
||||
rc,
|
||||
(rc ? 0 :
|
||||
((multi_update*)(((Sql_cmd_dml*)(thd->lex->m_sql_cmd))->get_result()))
|
||||
->num_found()),
|
||||
(rc ? 0 :
|
||||
((multi_update*)(((Sql_cmd_dml*)(thd->lex->m_sql_cmd))->get_result()))
|
||||
->num_updated()));
|
||||
break;
|
||||
case SQLCOM_UPDATE_MULTI:
|
||||
MYSQL_MULTI_UPDATE_DONE(
|
||||
rc,
|
||||
(rc ? 0 :
|
||||
((multi_update*)(((Sql_cmd_dml*)(thd->lex->m_sql_cmd))->get_result()))
|
||||
->num_found()),
|
||||
(rc ? 0 :
|
||||
((multi_update*)(((Sql_cmd_dml*)(thd->lex->m_sql_cmd))->get_result()))
|
||||
->num_updated()));
|
||||
case SQLCOM_DELETE_MULTI:
|
||||
thd->lex->m_sql_cmd->get_dml_stat(found, changed);
|
||||
break;
|
||||
case SQLCOM_DELETE:
|
||||
MYSQL_DELETE_DONE(rc, (rc ? 0 : (ulong) (thd->get_row_count_func())));
|
||||
found= 0;
|
||||
changed= (thd->get_row_count_func());
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void MYSQL_DML_DONE(THD *thd, int rc, ha_rows found, ha_rows changed)
|
||||
{
|
||||
switch (thd->lex->sql_command) {
|
||||
case SQLCOM_UPDATE:
|
||||
MYSQL_UPDATE_DONE(rc, found, changed);
|
||||
break;
|
||||
case SQLCOM_UPDATE_MULTI:
|
||||
MYSQL_MULTI_UPDATE_DONE(rc, found, changed);
|
||||
break;
|
||||
case SQLCOM_DELETE:
|
||||
MYSQL_DELETE_DONE(rc, changed);
|
||||
break;
|
||||
case SQLCOM_DELETE_MULTI:
|
||||
MYSQL_MULTI_DELETE_DONE(
|
||||
rc,
|
||||
(rc ? 0 :
|
||||
((multi_delete*)(((Sql_cmd_dml*)(thd->lex->m_sql_cmd))->get_result()))
|
||||
->num_deleted()));
|
||||
MYSQL_MULTI_DELETE_DONE(rc, changed);
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
@@ -34389,6 +34388,7 @@ err:
|
||||
bool Sql_cmd_dml::execute(THD *thd)
|
||||
{
|
||||
lex = thd->lex;
|
||||
ha_rows found= 0, changed= 0;
|
||||
bool res;
|
||||
|
||||
SELECT_LEX_UNIT *unit = &lex->unit;
|
||||
@@ -34439,6 +34439,8 @@ bool Sql_cmd_dml::execute(THD *thd)
|
||||
|
||||
if (res)
|
||||
goto err;
|
||||
else
|
||||
MYSQL_DML_GET_STAT(thd, found, changed);
|
||||
|
||||
res= unit->cleanup();
|
||||
|
||||
@@ -34447,13 +34449,13 @@ bool Sql_cmd_dml::execute(THD *thd)
|
||||
|
||||
THD_STAGE_INFO(thd, stage_end);
|
||||
|
||||
MYSQL_DML_DONE(thd, res);
|
||||
MYSQL_DML_DONE(thd, 0, found, changed);
|
||||
|
||||
return res;
|
||||
|
||||
err:
|
||||
DBUG_ASSERT(thd->is_error() || thd->killed);
|
||||
MYSQL_DML_DONE(thd, 1);
|
||||
MYSQL_DML_DONE(thd, 1, 0, 0);
|
||||
THD_STAGE_INFO(thd, stage_end);
|
||||
(void)unit->cleanup();
|
||||
if (is_prepared())
|
||||
|
Reference in New Issue
Block a user