← Back to team overview

maria-developers team mailing list archive

Re: 4cbbc796dcc: MDEV-22420 DDL on temporary object is prohibited when XA is in prepare state

 

Hi, Andrei!

On Jun 15, Andrei Elkin wrote:
> revision-id: 4cbbc796dcc (mariadb-10.5.2-335-g4cbbc796dcc)
> parent(s): a74e724e061
> author: Andrei Elkin <andrei.elkin@xxxxxxxxxxx>
> committer: Andrei Elkin <andrei.elkin@xxxxxxxxxxx>
> timestamp: 2020-06-11 17:24:15 +0300
> message:
> 
> MDEV-22420 DDL on temporary object is prohibited when XA is in prepare state
> 
> The parser must reject DDL operations on temporary objects when
> they may modify or alter such object, including temporary tables and sequences.
> The rejection is regardless (has been already in place for bin-loggable DML:s)
> of the binlogging capability of the server or connection.
> 
> The patch implements the requirement. A binlog test is added.
> 
> diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
> index 86f81dd001a..6ac0cf96024 100644
> --- a/sql/sql_parse.cc
> +++ b/sql/sql_parse.cc
> @@ -4890,6 +4890,11 @@ mysql_execute_command(THD *thd)
>      }
>      else
>      {
> +      if (thd->transaction->xid_state.check_has_uncommitted_xa())
> +      {
> +        thd->transaction->xid_state.er_xaer_rmfail();
> +        goto error;
> +      }
>        status_var_decrement(thd->status_var.com_stat[lex->sql_command]);
>        status_var_increment(thd->status_var.com_drop_tmp_table);

Two comments.

1. Where is this checked for non-temporary tables? check_has_uncommitted_xa
is tested in open_tables(), and it's not called for DROP.
What about RENAME? What other operations are there that don't open a table?

2. check_has_uncommitted_xa() already does er_xaer_rmfail() internally,
you don't need to repeat it.

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