From a1ae8f9ba86bf3967b0b55439c306ff611913345 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Apr 2014 09:03:53 +0200 Subject: [PATCH] MDEV-6067: Partitioned table DML sometimes binlogged without XID event Add test case. --- .../suite/parts/r/partition_mdev6067.result | 38 +++++++++++++++++++ .../suite/parts/t/partition_mdev6067.test | 32 ++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 mysql-test/suite/parts/r/partition_mdev6067.result create mode 100644 mysql-test/suite/parts/t/partition_mdev6067.test diff --git a/mysql-test/suite/parts/r/partition_mdev6067.result b/mysql-test/suite/parts/r/partition_mdev6067.result new file mode 100644 index 00000000000..7b123d7c17c --- /dev/null +++ b/mysql-test/suite/parts/r/partition_mdev6067.result @@ -0,0 +1,38 @@ +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB +PARTITION BY KEY (a) PARTITIONS 2; +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,2), (3,8); +INSERT INTO t1 VALUES (4,16); +show binlog events in 'master-bin.000001' from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2,2), (3,8) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4,16) +master-bin.000001 # Xid # # COMMIT /* XID */ +DROP TABLE t1; +SET binlog_format='row'; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB +PARTITION BY KEY (a) PARTITIONS 2; +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,2), (3,8); +INSERT INTO t1 VALUES (4,16); +show binlog events in 'master-bin.000001' from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/partition_mdev6067.test b/mysql-test/suite/parts/t/partition_mdev6067.test new file mode 100644 index 00000000000..7d64de2e8a7 --- /dev/null +++ b/mysql-test/suite/parts/t/partition_mdev6067.test @@ -0,0 +1,32 @@ +--source include/have_innodb.inc +--source include/have_partition.inc +--source include/have_binlog_format_statement.inc + +# Test binlogging of some transactions on a partitioned InnoDB table. +# The bug was seen as one of the inserts being logged with a COMMIT query +# event instead of the correct XID event. + +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB + PARTITION BY KEY (a) PARTITIONS 2; +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1) +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,2), (3,8); +INSERT INTO t1 VALUES (4,16); + +--source include/show_binlog_events.inc + +# Same thing in row mode. +DROP TABLE t1; +SET binlog_format='row'; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB + PARTITION BY KEY (a) PARTITIONS 2; +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1) +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,2), (3,8); +INSERT INTO t1 VALUES (4,16); + +--source include/show_binlog_events.inc + +DROP TABLE t1;