Hello,
Thanks for the feedback on how to fix our replication slave crash.
I hacked the mariadb 5.5.23 and ended up with the attached patch.
Rich Prohaska

On Fri, Jun 8, 2012 at 1:37 PM, Michael Widenius <monty@askmonty.org> wrote:

Hi!

>>>>> "Zardosht" == Zardosht Kasheff <zardosht@gmail.com> writes:

Zardosht> Hello all,
Zardosht> We see this on Maria 5.2 and Maria 5.5 as well. Does the following fix work?

Zardosht> -Zardosht


<cut>
Zardosht> We are running MySQL 5.5.21 with both InnoDB and TokuDB as XA storage
Zardosht> engines.  When one runs a transaction that inserts into an InnoDB
Zardosht> table and a TokuDB table, the commit crashes the replication slave at
Zardosht> log.cc line 6602 because cache_mngr == NULL.  We found a pattern in
Zardosht> various log functions in log.cc that calls binlog_setup_trx_data to
Zardosht> initialize the txn state.

Zardosht> This change fixes our immediate problem.

Zardosht> $ diff log.cc.orig log.cc
Zardosht> 6595a6596,6597
>>   if (thd_get_ha_data(thd, binlog_hton) == NULL)
>>     thd->binlog_setup_trx_data();

Zardosht> Is this a correct fix?  If so, are there other places that need a
Zardosht> similar change?

I would just add a call to

if (thd->binlog_setup_trx_data())
 DBUG_RETURN(1);

Just before calling:

binlog_cache_mngr *cache_mngr=
   (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);

There is no need to test for value of thd_get_ha_data(thd,binlog_hton)
as the function thd->binlog_setup_trx_data() already does that.

There is a couple of other functions that also calls
thd_get_ha_data(thd, binlog_hton) and uses this without checking if
the value returned is == NULL . You probably want to add the same code
in these functions.

Regards,
Monty