From: Date: August 21 2007 4:44pm Subject: bk commit into 5.1 tree (gkodinov:1.2571) BUG#30244 List-Archive: http://lists.mysql.com/commits/32816 X-Bug: 30244 Message-Id: <200708211444.l7LEiRhn021628@magare.gmz> Below is the list of changes that have just been committed into a local 5.1 repository of kgeorge. When kgeorge does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-08-21 17:44:22+03:00, gkodinov@stripped +3 -0 Bug #30244: row_count/found_rows does not replicate well The functions ROW_COUNT/FOUND_ROWS are indeed not safe to be used in statement based replication. Added code to declare them as such and switch the statement they're in to row based logging for mixed mode. mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result@stripped, 2007-08-21 16:51:38+03:00, gkodinov@stripped +22 -0 BitKeeper file /home/kgeorge/mysql/work/B30244-5.1-opt/mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result@stripped, 2007-08-21 16:51:38+03:00, gkodinov@stripped +0 -0 mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test@stripped, 2007-08-21 16:51:38+03:00, gkodinov@stripped +35 -0 BitKeeper file /home/kgeorge/mysql/work/B30244-5.1-opt/mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test@stripped, 2007-08-21 16:51:38+03:00, gkodinov@stripped +0 -0 sql/item_create.cc@stripped, 2007-08-21 17:44:21+03:00, gkodinov@stripped +2 -0 Bug #30244: row_count/found_rows does not replicate well - add the functions to the set of "unsafe functions" for statement based replication diff -Nrup a/mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result b/mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result 2007-08-21 16:51:38 +03:00 @@ -0,0 +1,22 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT, b INT); +INSERT INTO t1 SELECT 1; +INSERT INTO t1 VALUES (2),(3),(4),(5),(6); +INSERT INTO t2 SELECT 1, ROW_COUNT(); +INSERT INTO t1 VALUES (2),(3),(4); +INSERT INTO t2 SELECT 1, ROW_COUNT(); +SELECT b FROM t2 ORDER BY a; +b +1 +3 +SELECT b FROM t2 ORDER BY a; +b +1 +3 +DROP TABLE t1, t2; diff -Nrup a/mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test b/mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test 2007-08-21 16:51:38 +03:00 @@ -0,0 +1,35 @@ +source include/master-slave.inc; +source include/have_binlog_format_mixed.inc; + +# +# Bug #30244: row_count/found_rows does not replicate well +# + +connection master; + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT, b INT); + +INSERT INTO t1 SELECT 1; + +connection master1; +INSERT INTO t1 VALUES (2),(3),(4),(5),(6); + +connection master; +INSERT INTO t2 SELECT 1, ROW_COUNT(); + +INSERT INTO t1 VALUES (2),(3),(4); +INSERT INTO t2 SELECT 1, ROW_COUNT(); + +#must return 1 and 3 +SELECT b FROM t2 ORDER BY a; + +sync_slave_with_master; + +#must return 1 and 3 +SELECT b FROM t2 ORDER BY a; + +connection master; +DROP TABLE t1, t2; +sync_slave_with_master; +connection master; diff -Nrup a/sql/item_create.cc b/sql/item_create.cc --- a/sql/item_create.cc 2007-08-02 13:26:44 +03:00 +++ b/sql/item_create.cc 2007-08-21 17:44:21 +03:00 @@ -3339,6 +3339,7 @@ Create_func_found_rows Create_func_found Item* Create_func_found_rows::create(THD *thd) { + thd->lex->set_stmt_unsafe(); thd->lex->safe_to_cache_query= 0; return new (thd->mem_root) Item_func_found_rows(); } @@ -4234,6 +4235,7 @@ Create_func_row_count Create_func_row_co Item* Create_func_row_count::create(THD *thd) { + thd->lex->set_stmt_unsafe(); thd->lex->safe_to_cache_query= 0; return new (thd->mem_root) Item_func_row_count(); }