← Back to team overview

maria-developers team mailing list archive

Re: ae1f4e4d727: MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)

 

Hi, Rucha!

On Jul 22, Rucha Deodhar wrote:
> revision-id: ae1f4e4d727 (mariadb-10.5.11-1-gae1f4e4d727)
> parent(s): dc82effa5df
> author: Rucha Deodhar
> committer: Rucha Deodhar
> timestamp: 2021-06-21 20:24:43 +0530
> message:
> 
> MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
> Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
> 
> Analysis: KILL_QUERY is not ignored when local memory used exceeds maximum
> session memory. Hence the query proceeds, OK is sent and we end up
> reopening tables that are marked for reopen. During this, kill status is
> eventually checked and assertion failure happens during trying to send error
> message because OK has already been sent.
> Fix: If local memory used exceeds maximum session memory and query is killed
> before it has completed execution, return TRUE.

> diff --git a/sql/sql_table.cc b/sql/sql_table.cc
> index f58ce8f997d..0b722984fca 100644
> --- a/sql/sql_table.cc
> +++ b/sql/sql_table.cc
> @@ -6489,6 +6489,12 @@ handle_if_exists_options(THD *thd, TABLE *table, Alter_info *alter_info,
>                              ER_BAD_FIELD_ERROR,
>                              ER_THD(thd, ER_BAD_FIELD_ERROR),
>                              sql_field->change.str, table->s->table_name.str);
> +        /*
> +          if thread is killed (for example because local memory used execeeds
> +          maximum session memory used), return TRUE and do rollback (done later).
> +        */
> +        if (thd->killed)
> +          DBUG_RETURN(true);
>          it.remove();

Looks like a completely arbitrary place to put a check in.
What if the kill signal arrives later?

Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx