hello
I have another problem witch seems like a bug(Server version: 5.5.5-10.0.2-MariaDB-log MariaDB Server).
the problem is about the replication for the xa transactions when the master crashed and then restarted.
I know when we do a transaction, the queries will be stored in the binlog cache, after commit, flush the binlog cache into the binlog file, any normal un-committed transactions will be rollbacked when the server crashed then restarted, but the prepared xa transactions are not.
Prepared xa transactions can be recovered use the command 'xa recover',  then committed use 'xa commit xid', but the binlog cache is empty when the master restart, so if we do the 'xa commit xid', nothing to be recorded into the binlog files, the replication will be broken.
test:
master
mysql> create table t(id int auto_increment primary key, a int) engine=innodb;
mysql> xa start '111';
mysql> insert into t(a) values(1);
mysql> xa end '111';
mysql> xa prepare '111';
kill -9 master_pid
restart the master
mysql> xa recover;
+----------+--------------+--------------+------+
| formatID | gtrid_length | bqual_length | data |
+----------+--------------+--------------+------+
|        1 |            3 |            0 | 111  |
+----------+--------------+--------------+------+
mysql> xa commit '111';
mysql> select * from t;
Empty set (0.00 sec)  
why? I did the xa commit '111', but no result return, maybe another bug?
do the test continue
mysql> xa start '222';
mysql> insert into t(a) values(2);
mysql> xa end '222';
mysql> prepare '222';
mysql> xa commit '111';
mysql> select * from t;
+----+------+
| id | a    |
+----+------+
|  1 |    1 |
|  2 |    2 |
+----+------+
value(1,1) return at this time, why?
 
what's hanppen on the slave?
mysql> select * from t;
+----+------+
| id | a    |
+----+------+
|  2 |    2 |
+----+------+
the replication is broken now!!
 
by the way, when the xa transactions preapred, if the client exit, the transactions will be rollbacked in the THD::cleanup function, maybe the server rollback all the xa prepared transcations when restart is a good method?
2013-05-02

jhx1008 @netease