Description:
When binlog is the Transaction Coordinator and sql_log_bin is set as false for some reasons, the prepared transaction will be rollbacked after restarting.
I think that the state of such a prepared transaction is "TRX_UNDO_PREPARED" instead of "TRX_UNDO_PREPARED_IN_TC" because trx_set_prepared_in_tc is not called. And also, the "XA PREPARE" event is not written. So recovery will rollback such a transaction.
How to repeat:
file mysql-test/demo_test-master.opt
--log-bin=binlog
file mysql-test/demo_test.test
create table t1 (id int);
set sql_log_bin = 0;
xa start '1';
insert into t1 values (1);
xa end '1';
xa prepare '1';
xa recover;
--let $reocver = query_get_value(xa recover, formatID, 1)
--let $assert_text= The prepare state should not be lost after XA PREPARE succeeds
--let $assert_cond= "$reocver" = 1
--source include/assert.inc
--source include/kill_and_restart_mysqld.inc
xa recover;
--let $reocver = query_get_value(xa recover, formatID, 1)
--let $assert_text= The prepare state should not be lost after XA PREPARE succeeds
--let $assert_cond= "$reocver" = 1
--source include/assert.inc