Hi Sven,
Thank you for the review.
On 01/19/2011 04:37 PM, Sven Sandberg wrote:
> Hi Alfranio,
>
> Thanks, this patch looks ok.
>
> One suggestion: AFAIU, commit_1nnodb only checks status variables. It
> would be good to have a test case in the binlog suite that explicitly
> checks that the statement is in the binlog. Could you add such a test?
>
> /Sven
I will do it.
Cheers.
>
> On 01/19/2011 12:29 PM, 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)
>> {
>>
>>
>>
>>
>>
>