Hi Alfranio,
Nice Work. Please find my review comments below.
STATUS
------
Not approved.
REQUIRED CHANGES
----------------
RC1. Please, add some tests to the binlog suite showing the contents
of the binary log. Here is a suggestion to start with:
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/have_innodb.inc
CREATE TABLE t1 ... ;
CREATE TABLE t2 ... ;
INSERT INTO t1(c1, c2) VALUES ('a', 'b');
INSERT INTO t2(c1, c2) VALUES ('a', 'b');
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(c1, c2) VALUES ('a', 'b') ON DUPLICATE KEY UPDATE c1='a', c2='b';
-- source include/show_binlog_events.inc
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
INSERT INTO t2(c1, c2) VALUES ('a', 'b') ON DUPLICATE KEY UPDATE c1='a', c2='b';
-- source include/show_binlog_events.inc
REQUESTS
--------
n/a
SUGGESTIONS
-----------
n/a
DETAILS
-------
n/a
On 01/19/2011 11:29 AM, Alfranio Correia wrote:
> #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-19
> 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.
>
> 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-19 11:29:07 +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-19 11:29:07 +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.
>
> === 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-19 11:29:07 +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)
> {
>
>
>
>
>