Pre-MDEV-742 InnoDB fixes
1. Refactored innobase_close_connection(). Transaction must've already been rolled back by this time. We should expect only transactions in the PREPARED state when MDEV-742 is done. 2. Added missing put_pins() to trx_disconnect_prepared(). Missing put_pins() wasn't a problem because trx_disconnect_prepared() is a dead code. But it will get revived in the main MDEV-742 patch. 3. Fixed missing reset of trx->mysql_log_file_name when RW transaction didn't emit any log records (zero-modification RW). The problem was detected by ASAN when disconnected XA transaction was trying to make use of inherited mysql_log_file_name pointing into binlog data of detached THD. This missing reset also had user-visible side effect, when trx_sys_print_mysql_binlog_offset() would report binlog position not of the most recently committed transaction. One of possible scenarios that is expected to misbehave is as following: thr1> CREATE TABLE t1(a INT) ENGINE=InnoDB; thr1> INSERT INTO t1 VALUES(1); thr1> BEGIN; thr1> UPDATE t1 SET a=1 thr1> COMMIT; -- zero-modification, misses to reset mysql_log_file_name thr2> BEGIN; thr2> INSERT INTO t1 VALUES(2); thr2> COMMIT; thr1> BEGIN; thr1> do-some-real-changes; thr1> ROLLBACK; -- will store binlog pos from previous COMMIT in thr1? In this case it means if binlog is replayed from position reported by trx_sys_print_mysql_binlog_offset(), t1 will end up with two records containing '2'. Part of MDEV-742 - XA PREPAREd transaction survive disconnect/server restart
Showing
Please register or sign in to comment