← Back to team overview

maria-developers team mailing list archive

Re: 8c745467560: MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in

 

Hi, Rucha!

what happens in this bug?
Why does the server need to open_table() after my_ok()?

On Oct 21, Rucha Deodhar wrote:
> revision-id: 8c745467560 (mariadb-10.5.4-226-g8c745467560)
> parent(s): 308f8350c7b
> author: Rucha Deodhar <rucha.deodhar@xxxxxxxxxxx>
> committer: Rucha Deodhar <rucha.deodhar@xxxxxxxxxxx>
> timestamp: 2020-10-20 11:53:22 +0530
> message:
> 
> MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
> Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
> 
> Analysis: Assertion failure happens because we don't ignore kill query
> even if 'OK' is already sent.
> Fix: Check if we already sent 'OK'. If sent, ignore kill query.
>
> diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result
> index 197e52b35ca..204bfa5249c 100644
> --- a/mysql-test/main/alter_table.result
> +++ b/mysql-test/main/alter_table.result
> @@ -3322,5 +3322,23 @@ Note	1176	Key 'x' doesn't exist in table 't1'
>  unlock tables;
>  drop table t1;
>  #
> +# MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
> +# Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
> +#
> +set @max_session_mem_used_save= @@max_session_mem_used;
> +CREATE TABLE t1 (a INT);
> +SELECT * FROM t1;
> +a
> +ALTER TABLE x MODIFY xx INT;
> +ERROR 42S02: Table 'test.x' doesn't exist
> +SET SESSION max_session_mem_used= 8192;
> +LOCK TABLE t1 WRITE;
> +ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT;
> +Warnings:
> +Note	1054	Unknown column 'b' in 't1'
> +set SESSION max_session_mem_used = @max_session_mem_used_save;
> +UNLOCK TABLES;
> +DROP TABLE t1;
> +#
>  # End of 10.5 tests
>  #
> diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test
> index 6fe61a3222a..d09c4378339 100644
> --- a/mysql-test/main/alter_table.test
> +++ b/mysql-test/main/alter_table.test
> @@ -2529,6 +2529,27 @@ alter table t1 rename key if exists x to xx;
>  unlock tables;
>  drop table t1;
>  
> +--echo #
> +--echo # MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
> +--echo # Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
> +--echo #
> +
> +set @max_session_mem_used_save= @@max_session_mem_used;
> +
> +CREATE TABLE t1 (a INT);
> +SELECT * FROM t1;
> +
> +--error ER_NO_SUCH_TABLE
> +ALTER TABLE x MODIFY xx INT;
> +
> +SET SESSION max_session_mem_used= 8192;
> +LOCK TABLE t1 WRITE;
> +ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT;
> +
> +set SESSION max_session_mem_used = @max_session_mem_used_save;
> +UNLOCK TABLES;
> +DROP TABLE t1;
> +
>  --echo #
>  --echo # End of 10.5 tests
>  --echo #
> diff --git a/sql/sql_base.cc b/sql/sql_base.cc
> index e6d0ab13e75..e8d39917ba6 100644
> --- a/sql/sql_base.cc
> +++ b/sql/sql_base.cc
> @@ -1682,7 +1682,9 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
>  
>    if (!(flags & MYSQL_OPEN_IGNORE_KILLED) && thd->killed)
>    {
> -    thd->send_kill_message();
> +    /* If we already sent 'ok', we can ignore any kill query statements */
> +        if (! thd->get_stmt_da()->is_set())
> +          thd->send_kill_message();
>      DBUG_RETURN(TRUE);
>    }
> 
Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx