Function wsrep_run_wsrep_commit() in wsrep_hton.cc overrides thd->transaction.xid_state.xid if it has MySQLXid prefix:
/* Override XID iff it was generated by mysql */
if (thd->transaction.xid_state.xid.get_my_xid())
{
wsrep_xid_init(&thd->transaction.xid_state.xid, &thd->wsrep_trx_meta.gtid.uuid, thd->wsrep_trx_meta.gtid.seqno);
}
If thd->transaction.xid_state.xid is not reset after previous commit for some reason and XID remain with WSREPXid prefix, it is not overridden here at commit time and old XID is used in InnoDB commit leading to assertion.
Overriding XID here also in case of WSREPXid prefix would avoid the crash. However, warning message or DBUG_ASSERT should be added somewhere to make sure that situations where thd->transaction.xid_state.xid reset is skipped between transactions are caught.
Managed to crash lp:codership-mysql/5.6 with grammar from http:// bazaar. launchpad. net/~teemu- ollakka/ randgen/ randgen_ gc/view/ head:/conf/ galera/ galera_ stress- 56.yy . LOAD DATA is not involved, but I suppose that the reason for the crash may be the same.
Function wsrep_run_ wsrep_commit( ) in wsrep_hton.cc overrides thd->transactio n.xid_state. xid if it has MySQLXid prefix:
/* Override XID iff it was generated by mysql */ on.xid_ state.xid. get_my_ xid()) xid_init( &thd->transacti on.xid_ state.xid,
&thd->wsrep_ trx_meta. gtid.uuid,
thd->wsrep_ trx_meta. gtid.seqno) ;
if (thd->transacti
{
wsrep_
}
If thd->transactio n.xid_state. xid is not reset after previous commit for some reason and XID remain with WSREPXid prefix, it is not overridden here at commit time and old XID is used in InnoDB commit leading to assertion.
Overriding XID here also in case of WSREPXid prefix would avoid the crash. However, warning message or DBUG_ASSERT should be added somewhere to make sure that situations where thd->transactio n.xid_state. xid reset is skipped between transactions are caught.