Hi, Andrei!

On Jan 10, Andrei Elkin wrote:
> revision-id: 9ea85a70a75 (mariadb-10.2.40-4-g9ea85a70a75)
> parent(s): 160d97a4aaa
> author: Andrei Elkin
> committer: Andrei Elkin
> timestamp: 2021-08-08 14:20:57 +0300
> message:
> 
> MDEV-24654 GTID event falsely marked transactional
> 
> GTID event can be falsely marked transactional in few cases including
> binary-logging on the slave side upon execution.
> In some execution branches bin-logging of non-transactional
> events can be done through transactional cache. E.g see comments
> in THD::binlog_write_table_map().

I saw that and still couldn't understand why bin-logging of
non-transactional events can be done through transactional cache.

> In order to not create the false 'trans' tag the fact of Xid event
> logging is checked to compute correct argument to Gtid_log_event
> ctor.

This is wrong. Transactions only end with a Xid event if all
participating engines support XA. Try to create an InnoDB+FederatedX
transaction (I just did) and it'll end with Query_log_event("COMMIT")

> diff --git a/sql/log.cc b/sql/log.cc
> index 1d9b4645421..7fef2e0d739 100644
> --- a/sql/log.cc
> +++ b/sql/log.cc
> @@ -8118,9 +8118,11 @@ 
> MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
>                                           uint64 commit_id)
>  {
>    binlog_cache_mngr *mngr= entry->cache_mngr;
> +  bool has_xid= entry->end_event->get_type_code() == XID_EVENT;
>    DBUG_ENTER("MYSQL_BIN_LOG::write_transaction_or_stmt");
>  
> -  if (write_gtid_event(entry->thd, false, entry->using_trx_cache, commit_id))
> +  if (write_gtid_event(entry->thd, false,
> +                       entry->using_trx_cache && has_xid, commit_id))
>      DBUG_RETURN(ER_ERROR_ON_WRITE);
>  
>    if (entry->using_stmt_cache && !mngr->stmt_cache.empty() &&
> 
Regards,
Sergei
VP of MariaDB Server Engineering
and secur...@mariadb.org

_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to     : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to