diff options
author | Andrei Elkin <aelkin@mysql.com> | 2008-12-02 19:32:07 +0200 |
---|---|---|
committer | Andrei Elkin <aelkin@mysql.com> | 2008-12-02 19:32:07 +0200 |
commit | 40889f9ea6643620509f6978316a40d209b92b18 (patch) | |
tree | b683cc87cc1675f4a2ca9044490d895be9255e2a /mysql-test | |
parent | 9e91c8d6c2bd94b87ae53a9be828f2b78d29cc83 (diff) | |
download | mariadb-git-40889f9ea6643620509f6978316a40d209b92b18.tar.gz |
Bug #40221 Replication failure on RBR + UPDATE the primary key
A transaction could result in having an extra event after a query that
errored e.g because of a dup key. Such a query is rolled back in
innodb, as specified, but has not been in binlog.
It appeares that the binlog engine did not always register for a query
(statement) because the previous query had not reset at its statement
commit time. Because of that fact there was no roll-back to the
trx_data->before_stmt_pos position and a the pending event of the
errorred query could become flushed to the binlog file.
Fixed with deploying the reset of trx_data->before_stmt_pos at the end
of the query processing.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/suite/binlog/r/binlog_innodb_row.result | 22 | ||||
-rw-r--r-- | mysql-test/suite/binlog/t/binlog_innodb_row.test | 26 |
2 files changed, 48 insertions, 0 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_innodb_row.result b/mysql-test/suite/binlog/r/binlog_innodb_row.result new file mode 100644 index 00000000000..47ddcbd00f6 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_innodb_row.result @@ -0,0 +1,22 @@ +CREATE TABLE t1 (pk int auto_increment primary key) ENGINE=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`pk`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +reset master; +begin; +insert into t1 values (1),(2); +*** the following UPDATE query wont generate any updates for the binlog *** +update t1 set pk = 3 where pk < 3; +ERROR 23000: Duplicate entry '3' for key 'PRIMARY' +commit; +*** Results of the test: the binlog must have only Write_rows events not any Update_rows *** +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; 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/binlog/t/binlog_innodb_row.test b/mysql-test/suite/binlog/t/binlog_innodb_row.test new file mode 100644 index 00000000000..7f42f5b95cb --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_innodb_row.test @@ -0,0 +1,26 @@ +# +# Tests of innodb/binlog with the row binlog format +# +source include/have_innodb.inc; +source include/have_log_bin.inc; +source include/have_binlog_format_row.inc; + +# +# Bug #40221 Replication failure on RBR + UPDATE the primary key +# + +CREATE TABLE t1 (pk int auto_increment primary key) ENGINE=innodb; +show create table t1; +reset master; + +begin; +insert into t1 values (1),(2); +--echo *** the following UPDATE query wont generate any updates for the binlog *** +--error ER_DUP_ENTRY +update t1 set pk = 3 where pk < 3; +commit; + +--echo *** Results of the test: the binlog must have only Write_rows events not any Update_rows *** +source include/show_binlog_events.inc; + +drop table t1; |