← Back to team overview

maria-developers team mailing list archive

Re: 9ea85a70a75: MDEV-24654 GTID event falsely marked transactional

 

Hi, Andrei!

On Jan 11, Andrei Elkin wrote:
> Howdy, Sergei!
> 
> To the question of the usage of trX cache by non-trX let me answer
> broadly to mention @@binlog_direct_non_transactional_update = false
> leads to aggregation of mixed, say innodb + myisam, events in trx
> cache.

That's different. The bug summary is "GTID event falsely marked
transactional", meaning, the group of events is not transactional and
it's falsely marked as transactional. If you have an innodb/myisam mix,
it is correctly marked transactional.

You need to have only non-transactional events in the transactional
cache. And I'm trying to understand how can that happen.

> I may need to process deeper the referred comments though.
> 
> Next to the commit's idea, it actually covers your concern. I wonder
> on the 'Wrong' conclusion. There is no intent to xidify anything
> extra. Th commit assumes xid eVent is created, before Gtid one,
> accordingly. And that fact is propagated to Gtid ctor.

Your commit, if I'm not mistaken, assumes that "last event is Xid if and
only if the cache contains a transaction".

Which is incorrect, a transaction does not necesarily have to end with a
Xid event.

/Sergei

> On Mon, 10 Jan 2022, 20:56 Sergei Golubchik, <serg@xxxxxxxxxxx> wrote:
> 
> > 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 thr-ough 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 security@xxxxxxxxxxx
> >
Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx


Follow ups

References