← Back to team overview

maria-developers team mailing list archive

Re: 70c5ab5658d: Move XID_STATE::rm_error to XID_cache_element

 

Hi, Sergey!

On Apr 24, Sergey Vojtovich wrote:
> revision-id: 70c5ab5658d (mariadb-10.4.4-29-g70c5ab5658d)
> parent(s): c5b1799435b
> author: Sergey Vojtovich <svoj@xxxxxxxxxxx>
> committer: Sergey Vojtovich <svoj@xxxxxxxxxxx>
> timestamp: 2019-04-20 14:45:16 +0400
> message:
> 
> Move XID_STATE::rm_error to XID_cache_element

It's somewhat confusing. What if it's an internal 2PC and some engine's
rollback returns an error? The error won't be stored in
xid_state.rm_error anymore.

Basically, you're changing the semantics of rm_error from "an error
that happened during rollback" to "an error that happened during
rollback or an external XA transaction".

Mention this change explicitly in the commit comment, please.

> Also removed redundant xid reset from THD::init_for_queries(). Must've
> been done already either by THD::transaction constructor or by
> THD::cleanup().
> 
> Part of MDEV-7974 - backport fix for mysql bug#12161 (XA and binlog)
> 
> diff --git a/sql/sql_class.h b/sql/sql_class.h
> index c68628be65d..e7584a0d825 100644
> --- a/sql/sql_class.h
> +++ b/sql/sql_class.h
> @@ -2606,13 +2606,8 @@ class THD: public THD_count, /* this must be first */
>        DBUG_ENTER("thd::cleanup");

rename to "THD::st_transaction::cleanup" please

>        changed_tables= 0;
>        savepoints= 0;
> -      /*
> -        If rm_error is raised, it means that this piece of a distributed
> -        transaction has failed and must be rolled back. But the user must
> -        rollback it explicitly, so don't start a new distributed XA until
> -        then.
> -      */
> -      if (!xid_state.rm_error)
> +      /* xid_cache_delete() resets xid of explicitly started XA transaction */
> +      if (!xid_state.is_explicit_XA())
>          xid_state.xid.null();
>        free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
>        DBUG_VOID_RETURN;

Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx