#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-07
BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR
In SBR, if a statement does not fail, it 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 engine is updated.
INSERT ON DUPLICATE KEY UPDATE was not following the rule above and was not being written
to the binary log, if then engine was Innodb.
modified:
mysql-test/include/commit.inc
mysql-test/r/commit_1innodb.result
sql/sql_insert.cc
=== 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-07 13:48:13 +0000
@@ -502,9 +502,9 @@ 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 #
=== 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-07 13:48:13 +0000
@@ -518,11 +518,11 @@ 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.
=== 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-07 13:48:13 +0000
@@ -881,7 +881,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
*/
query_cache_invalidate3(thd, table_list, 1);
}
- if ((changed && error <= 0) ||
+ if ((error <= 0 &&
+ (changed || (duplic == DUP_UPDATE))) ||
thd->transaction.stmt.modified_non_trans_table ||
was_insert_delayed)
{
Attachment: [text/bzr-bundle] bzr/alfranio.correia@oracle.com-20110107134813-uohvps69ag7frn1q.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (alfranio.correia:3535) Bug#59338 | Alfranio Correia | 7 Jan |