"nanyi607rao" <nanyi607rao@gmail.com> writes:
I am little confused about binlog event of COMMIT statement, In most of time, a COMMIT statement corresponds a XID_event in the binlog, but sometimes is a Query_event. how that happened ?
The rule is: If we binlog a transaction (or autocommitted statement) involving InnoDB/XtraDB (or in general any storage engine supporting XA), then the COMMIT becomes an XID_event. This is used in case of crash, to do crash recovery to ensure that binlog and storage engines are consistent with each other. If we binlog a MyISAM update (or in general other statement or transaction not involving an XA-capable storage engine), then it is logged with a COMMIT Query_event at the end.
or can I do any operations to make a COMMIT statement correspond a Query_event certainly in the binlog.
There is an option innodb-support-xa which can be set to FALSE to make InnoDB/XtraDB not support XA. Maybe this will make COMMIT be logged as a query event and not an XID event, I have not tried myself. If you do this, be aware that in case of crash during, the binlog and the storage engine may become out of sync. - Kristian.