List:Commits« Previous MessageNext Message »
From:Alfranio Correia Date:January 21 2011 12:57pm
Subject:bzr commit into mysql-5.1 branch (alfranio.correia:3535) Bug#59338
View as plain text  
#At file:///home/acorreia/workspace.oracle/repository.mysql/bzrwork/bug-59338/mysql-5.1/ based on revid:georgi.kodinov@stripped

 3535 Alfranio Correia	2011-01-21
      BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR
      
      In SBR, if a statement does not fail, it is always written to the binary
      log, regardless if rows are changed or not. If there is a failure, a
      statement is only written to the binary log if a non-transactional (.e.g.
      MyIsam) engine is updated.
      
      INSERT ON DUPLICATE KEY UPDATE and INSERT IGNORE were not following the
      rule above and were not written to the binary log, if then engine was
      Innodb.
     @ mysql-test/extra/rpl_tests/rpl_insert_duplicate.test
        Added test case.
     @ mysql-test/extra/rpl_tests/rpl_insert_ignore.test
        Updated test case.
     @ mysql-test/include/commit.inc
        Updated test case as the calls to the binary log have changed
        for INSERT ON DUPLICATE and INSERT IGNORE.
     @ mysql-test/r/commit_1innodb.result
        Updated result file.
     @ mysql-test/suite/rpl/r/rpl_row_insert_duplicate.result
        Added a test case.
     @ mysql-test/suite/rpl/r/rpl_row_insert_ignore.result
        Added a test case.
     @ mysql-test/suite/rpl/r/rpl_stm_mixed_insert_duplicate.result
        Added a test case.
     @ mysql-test/suite/rpl/r/rpl_stm_mixed_insert_ignore.result
        Added a test case.
     @ mysql-test/suite/rpl/t/rpl_row_insert_duplicate.test
        Added a test case.
     @ mysql-test/suite/rpl/t/rpl_row_insert_ignore.test
        Added a test case.
     @ mysql-test/suite/rpl/t/rpl_stm_mixed_insert_duplicate.test
        Added a test case.
     @ mysql-test/suite/rpl/t/rpl_stm_mixed_insert_ignore.test
        Update the test case, in order to run it only in SBR and MIXED modes.
        Note that another test case was created for the ROW mode.

    added:
      mysql-test/extra/rpl_tests/rpl_insert_duplicate.test
      mysql-test/suite/rpl/r/rpl_row_insert_duplicate.result
      mysql-test/suite/rpl/r/rpl_row_insert_ignore.result
      mysql-test/suite/rpl/r/rpl_stm_mixed_insert_duplicate.result
      mysql-test/suite/rpl/t/rpl_row_insert_duplicate.test
      mysql-test/suite/rpl/t/rpl_row_insert_ignore.test
      mysql-test/suite/rpl/t/rpl_stm_mixed_insert_duplicate.test
    renamed:
      mysql-test/suite/rpl/r/rpl_insert_ignore.result => mysql-test/suite/rpl/r/rpl_stm_mixed_insert_ignore.result
      mysql-test/suite/rpl/t/rpl_insert_ignore.test => mysql-test/suite/rpl/t/rpl_stm_mixed_insert_ignore.test
    modified:
      mysql-test/extra/rpl_tests/rpl_insert_ignore.test
      mysql-test/include/commit.inc
      mysql-test/r/commit_1innodb.result
      sql/sql_insert.cc
      mysql-test/suite/rpl/r/rpl_stm_mixed_insert_ignore.result
      mysql-test/suite/rpl/t/rpl_stm_mixed_insert_ignore.test
=== added file 'mysql-test/extra/rpl_tests/rpl_insert_duplicate.test'
--- a/mysql-test/extra/rpl_tests/rpl_insert_duplicate.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_insert_duplicate.test	2011-01-21 12:57:03 +0000
@@ -0,0 +1,95 @@
+# BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR
+# In SBR, if a statement does not fail, it is always written to the binary log,
+# regardless if rows are changed or not. If there is a failure, a statement is
+# only written to the binary log if a non-transactional (.e.g. MyIsam) engine
+# is updated. INSERT ON DUPLICATE KEY UPDATE was not following the rule above
+# and was not written to the binary log, if then engine was Innodb.
+#
+# In this test case, we check if INSERT ON DUPLICATE KEY UPDATE that does not
+# change anything is still written to the binary log.
+
+# Now do for Innodb
+eval CREATE TABLE t1 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned
+) ENGINE=$engine_type;
+
+eval CREATE TABLE t2 (
+ a int unsigned, # to force INSERT SELECT to have a certain order
+ b int unsigned
+) ENGINE=$engine_type;
+
+
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 2);
+INSERT INTO t1 VALUES (NULL, 3);
+INSERT INTO t1 VALUES (NULL, 4);
+INSERT INTO t2 VALUES (1, 1);
+INSERT INTO t2 VALUES (2, 2);
+INSERT INTO t2 VALUES (3, 3);
+INSERT INTO t2 VALUES (4, 4);
+
+# An insert duplicate that does not update anything must be written to the binary
+# log in SBR and MIXED modes. We check this property by summing b before and after
+# the update on b and printing out the contents of the binary log. The sum should
+# be the same in both points and the statement should be in the binary log.
+let $expected_sum= `SELECT sum(b) from t1`;
+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 SELECT t2.a, t2.b FROM t2 ORDER BY t2.a ON DUPLICATE
+KEY UPDATE t1.b= t1.b;
+let $actual_sum= `SELECT sum(b) from t1`;
+if (`SELECT $expected_sum != $actual_sum`)
+{
+  -- source include/show_rpl_debug_info.inc
+  -- eval die Failed because Expected -- $expected_sum Actual -- $actual_sum 
+}
+-- source include/show_binlog_events.inc
+
+# Compare results
+SELECT * FROM t1 ORDER BY a;
+
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY a;
+
+# Now do the same for MyISAM
+connection master;
+drop table t1;
+eval CREATE TABLE t1 (
+ a int unsigned not null auto_increment primary key,
+ b int unsigned,
+ unique (b)
+) ENGINE=$engine_type2;
+
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+
+# An insert duplicate that does not update anything must be written to the binary
+# log in SBR and MIXED modes. We check this property by summing b before and after
+# the update on b and printing out the contents of the binary log. The sum should
+# be the same in both points and the statement should be in the binary log.
+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 SELECT t2.a, t2.b FROM t2 ORDER BY t2.a ON DUPLICATE
+KEY UPDATE t1.b= t1.b;
+let $expected_sum= 10;
+let $actual_sum= `SELECT sum(b) from t1`;
+if (`SELECT $expected_sum != $actual_sum`)
+{
+  -- source include/show_rpl_debug_info.inc
+  -- eval die Failed because Expected -- $expected_sum Actual -- $actual_sum 
+}
+-- source include/show_binlog_events.inc
+
+# Compare results
+SELECT * FROM t1 ORDER BY a;
+
+sync_slave_with_master;
+SELECT * FROM t1 ORDER BY a;
+
+#Clean up
+connection master;
+drop table t1, t2;
+sync_slave_with_master;

=== modified file 'mysql-test/extra/rpl_tests/rpl_insert_ignore.test'
--- a/mysql-test/extra/rpl_tests/rpl_insert_ignore.test	2007-06-18 13:36:10 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_insert_ignore.test	2011-01-21 12:57:03 +0000
@@ -31,7 +31,16 @@ INSERT INTO t2 VALUES (4, 3);
 INSERT INTO t2 VALUES (5, 4);
 INSERT INTO t2 VALUES (6, 6);
 
+let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1);
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
 INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+let $expected_rows= 6;
+let $actual_rows= `SELECT count(*) from t1`;
+if (`SELECT $expected_rows != $actual_rows`)
+{
+  -- source include/show_rpl_debug_info.inc
+  -- eval die Failed because Expected -- $expected_rows Actual -- $actual_rows 
+}
 
 # Compare results
 
@@ -40,8 +49,23 @@ SELECT * FROM t1 ORDER BY a;
 sync_slave_with_master;
 SELECT * FROM t1 ORDER BY a;
 
-# Now do the same for MyISAM
+connection master;
+# BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR
+# An insert ignore that does not update anything must be written to the binary log in SBR
+# and MIXED modes. We check this property by counting occurrence in t1 before and after
+# the insert and printing out the contents of the binary log. The count should be the same
+#in both points and the statement should be in the binary log.
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+-- source include/show_binlog_events.inc
+let $actual_rows= `SELECT count(*) from t1`;
+if (`SELECT $expected_rows != $actual_rows`)
+{
+  -- source include/show_rpl_debug_info.inc
+  -- eval die Failed because Expected -- $expected_rows Actual -- $actual_rows 
+}
+
 
+# Now do the same for MyISAM
 connection master;
 drop table t1;
 eval CREATE TABLE t1 (
@@ -55,7 +79,15 @@ INSERT INTO t1 VALUES (2, 2);
 INSERT INTO t1 VALUES (3, 3);
 INSERT INTO t1 VALUES (4, 4);
 
+let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1);
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
 INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+let $actual_rows= `SELECT count(*) from t1`;
+if (`SELECT $expected_rows != $actual_rows`)
+{
+  -- source include/show_rpl_debug_info.inc
+  -- eval die Failed because Expected -- $expected_rows Actual -- $actual_rows 
+}
 
 SELECT * FROM t1 ORDER BY a;
 
@@ -63,6 +95,20 @@ sync_slave_with_master;
 SELECT * FROM t1 ORDER BY a;
 
 connection master;
+# BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR
+# An insert ignore that does not update anything must be written to the binary log in SBR
+# and MIXED modes. We check this property by counting occurrence in t1 before and after
+# the insert and printing out the contents of the binary log. The count should be the same
+#in both points and the statement should be in the binary log.
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+-- source include/show_binlog_events.inc
+let $actual_rows= `SELECT count(*) from t1`;
+if (`SELECT $expected_rows != $actual_rows`)
+{
+  -- source include/show_rpl_debug_info.inc
+  -- eval die Failed because Expected -- $expected_rows Actual -- $actual_rows 
+}
+
 drop table t1, t2;
 sync_slave_with_master;
 

=== modified file 'mysql-test/include/commit.inc'
--- a/mysql-test/include/commit.inc	2010-07-20 17:36:15 +0000
+++ b/mysql-test/include/commit.inc	2011-01-21 12:57:03 +0000
@@ -502,16 +502,16 @@ call p_verify_status_increment(2, 2, 2,
 --echo # 12. Read-write statement: IODKU, change 0 rows. 
 --echo #
 insert t1 set a=2 on duplicate key update a=2;
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(2, 2, 1, 0);
 commit;
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(2, 2, 1, 0);
 
 --echo # 13. Read-write statement: INSERT IGNORE, change 0 rows. 
 --echo #
 insert ignore t1 set a=2;
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(2, 2, 1, 0);
 commit;
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(2, 2, 1, 0);
 
 --echo # 14. Read-write statement: INSERT IGNORE, change 1 row. 
 --echo #

=== modified file 'mysql-test/r/commit_1innodb.result'
--- a/mysql-test/r/commit_1innodb.result	2010-07-20 17:36:15 +0000
+++ b/mysql-test/r/commit_1innodb.result	2011-01-21 12:57:03 +0000
@@ -518,21 +518,21 @@ SUCCESS
 # 12. Read-write statement: IODKU, change 0 rows. 
 #
 insert t1 set a=2 on duplicate key update a=2;
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(2, 2, 1, 0);
 SUCCESS
 
 commit;
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(2, 2, 1, 0);
 SUCCESS
 
 # 13. Read-write statement: INSERT IGNORE, change 0 rows. 
 #
 insert ignore t1 set a=2;
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(2, 2, 1, 0);
 SUCCESS
 
 commit;
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(2, 2, 1, 0);
 SUCCESS
 
 # 14. Read-write statement: INSERT IGNORE, change 1 row. 

=== added file 'mysql-test/suite/rpl/r/rpl_row_insert_duplicate.result'
--- a/mysql-test/suite/rpl/r/rpl_row_insert_duplicate.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_insert_duplicate.result	2011-01-21 12:57:03 +0000
@@ -0,0 +1,62 @@
+include/master-slave.inc
+[connection master]
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=innodb;
+CREATE TABLE t2 (
+a int unsigned, # to force INSERT SELECT to have a certain order
+b int unsigned
+) ENGINE=innodb;
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 2);
+INSERT INTO t1 VALUES (NULL, 3);
+INSERT INTO t1 VALUES (NULL, 4);
+INSERT INTO t2 VALUES (1, 1);
+INSERT INTO t2 VALUES (2, 2);
+INSERT INTO t2 VALUES (3, 3);
+INSERT INTO t2 VALUES (4, 4);
+INSERT INTO t1 SELECT t2.a, t2.b FROM t2 ORDER BY t2.a ON DUPLICATE
+KEY UPDATE t1.b= t1.b;
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+SELECT * FROM t1 ORDER BY a;
+a	b
+1	1
+2	2
+3	3
+4	4
+SELECT * FROM t1 ORDER BY a;
+a	b
+1	1
+2	2
+3	3
+4	4
+drop table t1;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+unique (b)
+) ENGINE=myisam;
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT INTO t1 SELECT t2.a, t2.b FROM t2 ORDER BY t2.a ON DUPLICATE
+KEY UPDATE t1.b= t1.b;
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+SELECT * FROM t1 ORDER BY a;
+a	b
+1	1
+2	2
+3	3
+4	4
+SELECT * FROM t1 ORDER BY a;
+a	b
+1	1
+2	2
+3	3
+4	4
+drop table t1, t2;
+include/rpl_end.inc

=== added file 'mysql-test/suite/rpl/r/rpl_row_insert_ignore.result'
--- a/mysql-test/suite/rpl/r/rpl_row_insert_ignore.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_insert_ignore.result	2011-01-21 12:57:03 +0000
@@ -0,0 +1,81 @@
+include/master-slave.inc
+[connection master]
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+unique (b)
+) ENGINE=innodb;
+CREATE TABLE t2 (
+a int unsigned, # to force INSERT SELECT to have a certain order
+b int unsigned
+) ENGINE=innodb;
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 2);
+INSERT INTO t1 VALUES (NULL, 3);
+INSERT INTO t1 VALUES (NULL, 4);
+INSERT INTO t2 VALUES (1, 1);
+INSERT INTO t2 VALUES (2, 2);
+INSERT INTO t2 VALUES (3, 5);
+INSERT INTO t2 VALUES (4, 3);
+INSERT INTO t2 VALUES (5, 4);
+INSERT INTO t2 VALUES (6, 6);
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+SELECT * FROM t1 ORDER BY a;
+a	b
+1	1
+2	2
+3	3
+4	4
+5	5
+6	6
+SELECT * FROM t1 ORDER BY a;
+a	b
+1	1
+2	2
+3	3
+4	4
+5	5
+6	6
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+show binlog events in 'master-bin.000001' from <binlog_start>;
+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 */
+drop table t1;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+unique (b)
+) ENGINE=myisam;
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+SELECT * FROM t1 ORDER BY a;
+a	b
+1	1
+2	2
+3	3
+4	4
+5	5
+6	6
+SELECT * FROM t1 ORDER BY a;
+a	b
+1	1
+2	2
+3	3
+4	4
+5	5
+6	6
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+show binlog events in 'master-bin.000001' from <binlog_start>;
+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	#	Query	#	#	COMMIT
+drop table t1, t2;
+include/rpl_end.inc

=== added file 'mysql-test/suite/rpl/r/rpl_stm_mixed_insert_duplicate.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_mixed_insert_duplicate.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_mixed_insert_duplicate.result	2011-01-21 12:57:03 +0000
@@ -0,0 +1,68 @@
+include/master-slave.inc
+[connection master]
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=innodb;
+CREATE TABLE t2 (
+a int unsigned, # to force INSERT SELECT to have a certain order
+b int unsigned
+) ENGINE=innodb;
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 2);
+INSERT INTO t1 VALUES (NULL, 3);
+INSERT INTO t1 VALUES (NULL, 4);
+INSERT INTO t2 VALUES (1, 1);
+INSERT INTO t2 VALUES (2, 2);
+INSERT INTO t2 VALUES (3, 3);
+INSERT INTO t2 VALUES (4, 4);
+INSERT INTO t1 SELECT t2.a, t2.b FROM t2 ORDER BY t2.a ON DUPLICATE
+KEY UPDATE t1.b= t1.b;
+show binlog events in 'master-bin.000001' from <binlog_start>;
+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 SELECT t2.a, t2.b FROM t2 ORDER BY t2.a ON DUPLICATE
+KEY UPDATE t1.b= t1.b
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+SELECT * FROM t1 ORDER BY a;
+a	b
+1	1
+2	2
+3	3
+4	4
+SELECT * FROM t1 ORDER BY a;
+a	b
+1	1
+2	2
+3	3
+4	4
+drop table t1;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+unique (b)
+) ENGINE=myisam;
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT INTO t1 SELECT t2.a, t2.b FROM t2 ORDER BY t2.a ON DUPLICATE
+KEY UPDATE t1.b= t1.b;
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 SELECT t2.a, t2.b FROM t2 ORDER BY t2.a ON DUPLICATE
+KEY UPDATE t1.b= t1.b
+SELECT * FROM t1 ORDER BY a;
+a	b
+1	1
+2	2
+3	3
+4	4
+SELECT * FROM t1 ORDER BY a;
+a	b
+1	1
+2	2
+3	3
+4	4
+drop table t1, t2;
+include/rpl_end.inc

=== renamed file 'mysql-test/suite/rpl/r/rpl_insert_ignore.result' => 'mysql-test/suite/rpl/r/rpl_stm_mixed_insert_ignore.result'
--- a/mysql-test/suite/rpl/r/rpl_insert_ignore.result	2010-12-19 17:07:28 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_mixed_insert_ignore.result	2011-01-21 12:57:03 +0000
@@ -36,6 +36,17 @@ a	b
 4	4
 5	5
 6	6
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Intvar	#	#	INSERT_ID=5
+master-bin.000001	#	Query	#	#	use `test`; INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Intvar	#	#	INSERT_ID=8
+master-bin.000001	#	Query	#	#	use `test`; INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 drop table t1;
 CREATE TABLE t1 (
 a int unsigned not null auto_increment primary key,
@@ -63,5 +74,12 @@ a	b
 4	4
 5	5
 6	6
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=5
+master-bin.000001	#	Query	#	#	use `test`; INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a
+master-bin.000001	#	Intvar	#	#	INSERT_ID=7
+master-bin.000001	#	Query	#	#	use `test`; INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a
 drop table t1, t2;
 include/rpl_end.inc

=== added file 'mysql-test/suite/rpl/t/rpl_row_insert_duplicate.test'
--- a/mysql-test/suite/rpl/t/rpl_row_insert_duplicate.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_insert_duplicate.test	2011-01-21 12:57:03 +0000
@@ -0,0 +1,10 @@
+#########################################
+# Wrapper for rpl_insert_duplicate.test #
+#########################################
+-- source include/master-slave.inc
+-- source include/have_innodb.inc
+-- source include/have_binlog_format_row.inc
+let $engine_type=innodb;
+let $engine_type2=myisam;
+-- source extra/rpl_tests/rpl_insert_duplicate.test
+--source include/rpl_end.inc

=== added file 'mysql-test/suite/rpl/t/rpl_row_insert_ignore.test'
--- a/mysql-test/suite/rpl/t/rpl_row_insert_ignore.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_insert_ignore.test	2011-01-21 12:57:03 +0000
@@ -0,0 +1,11 @@
+#####################################
+# Wrapper for rpl_insert_ignore.test#
+#####################################
+-- source include/not_ndb_default.inc
+-- source include/have_innodb.inc
+-- source include/master-slave.inc
+-- source include/have_binlog_format_row.inc
+let $engine_type=innodb;
+let $engine_type2=myisam;
+-- source extra/rpl_tests/rpl_insert_ignore.test
+--source include/rpl_end.inc

=== added file 'mysql-test/suite/rpl/t/rpl_stm_mixed_insert_duplicate.test'
--- a/mysql-test/suite/rpl/t/rpl_stm_mixed_insert_duplicate.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_mixed_insert_duplicate.test	2011-01-21 12:57:03 +0000
@@ -0,0 +1,10 @@
+#########################################
+# Wrapper for rpl_insert_duplicate.test #
+#########################################
+-- source include/master-slave.inc
+-- source include/have_innodb.inc
+-- source include/have_binlog_format_mixed_or_statement.inc
+let $engine_type=innodb;
+let $engine_type2=myisam;
+-- source extra/rpl_tests/rpl_insert_duplicate.test
+--source include/rpl_end.inc

=== renamed file 'mysql-test/suite/rpl/t/rpl_insert_ignore.test' => 'mysql-test/suite/rpl/t/rpl_stm_mixed_insert_ignore.test'
--- a/mysql-test/suite/rpl/t/rpl_insert_ignore.test	2010-12-19 17:07:28 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_mixed_insert_ignore.test	2011-01-21 12:57:03 +0000
@@ -4,6 +4,7 @@
 -- source include/not_ndb_default.inc
 -- source include/have_innodb.inc
 -- source include/master-slave.inc
+-- source include/have_binlog_format_mixed_or_statement.inc
 let $engine_type=innodb;
 let $engine_type2=myisam;
 -- source extra/rpl_tests/rpl_insert_ignore.test

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2010-10-07 08:13:11 +0000
+++ b/sql/sql_insert.cc	2011-01-21 12:57:03 +0000
@@ -881,7 +881,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
       */
       query_cache_invalidate3(thd, table_list, 1);
     }
-    if ((changed && error <= 0) ||
+    if (error <= 0 ||
         thd->transaction.stmt.modified_non_trans_table ||
         was_insert_delayed)
     {


Attachment: [text/bzr-bundle] bzr/alfranio.correia@oracle.com-20110121125703-8wco4cfdpnggl75m.bundle
Thread
bzr commit into mysql-5.1 branch (alfranio.correia:3535) Bug#59338Alfranio Correia21 Jan
  • Re: bzr commit into mysql-5.1 branch (alfranio.correia:3535) Bug#59338Sven Sandberg24 Jan
    • Re: bzr commit into mysql-5.1 branch (alfranio.correia:3535) Bug#59338Luís Soares27 Jan
      • Re: bzr commit into mysql-5.1 branch (alfranio.correia:3535) Bug#59338Sven Sandberg27 Jan
        • Re: bzr commit into mysql-5.1 branch (alfranio.correia:3535) Bug#59338Luís Soares27 Jan