ramil@stripped wrote:
> Below is the list of changes that have just been committed into a local
> 5.1 repository of ram. When ram 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-07-27 23:31:02+05:00, ramil@stripped +3 -0
> Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores
> from mysqlbinlog out
>
> Mark connection_id() containing statements as unsafe for stmt-logging.
>
> mysql-test/r/mysqlbinlog.result@stripped, 2007-07-27 23:31:01+05:00, ramil@stripped +7
> -0
> Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores
> from mysqlbinlog out
> - test result.
>
> mysql-test/t/mysqlbinlog.test@stripped, 2007-07-27 23:31:01+05:00, ramil@stripped +21
> -0
> Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores
> from mysqlbinlog out
> - test case.
>
> sql/item_create.cc@stripped, 2007-07-27 23:31:01+05:00, ramil@stripped +1 -0
> Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores
> from mysqlbinlog out
> - mark connection_id() containing statements as unsafe for stmt-logging.
>
> diff -Nrup a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
> --- a/mysql-test/r/mysqlbinlog.result 2007-06-24 03:35:24 +05:00
> +++ b/mysql-test/r/mysqlbinlog.result 2007-07-27 23:31:01 +05:00
> @@ -321,4 +321,11 @@ DROP TABLE t1;
> # Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED
> End of 5.0 tests
> flush logs;
> +flush logs;
> +create table t1(a int);
> +insert into t1 values(connection_id());
> +flush logs;
> +drop table t1;
> +1
> +drop table t1;
> End of 5.1 tests
> diff -Nrup a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
> --- a/mysql-test/t/mysqlbinlog.test 2007-06-24 03:35:24 +05:00
> +++ b/mysql-test/t/mysqlbinlog.test 2007-07-27 23:31:01 +05:00
> @@ -229,4 +229,25 @@ flush logs;
> --exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000014 >/dev/null
> 2>/dev/null
> --exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000014
> >/dev/null 2>/dev/null
>
> +#
> +# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
> +#
> +flush logs;
> +create table t1(a int);
> +insert into t1 values(connection_id());
> +let $a= `select a from t1`;
> +flush logs;
> +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000015 >
> $MYSQLTEST_VARDIR/tmp/bug29928.sql
> +drop table t1;
> +connect (con1, localhost, root, , test);
>
> +connection con1;
> +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql
> +--remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql
> +let $b= `select a from t1`;
> +disconnect con1;
> +connection default;
> +let $c= `select $a=$b`;
> +--echo $c
> +drop table t1;
>
Add a test to check that you get an error for this when statement-based
replication is forced, i.e., something along these lines:
set sql_bin_log=statement;
error ER_BINLOG_LOGGING_IMPOSSIBLE;
insert into t1 values(connection_id());
> +
> --echo End of 5.1 tests
> diff -Nrup a/sql/item_create.cc b/sql/item_create.cc
> --- a/sql/item_create.cc 2007-07-17 01:59:16 +05:00
> +++ b/sql/item_create.cc 2007-07-27 23:31:01 +05:00
> @@ -2860,6 +2860,7 @@ Create_func_connection_id Create_func_co
> Item*
> Create_func_connection_id::create(THD *thd)
> {
> + thd->lex->set_stmt_unsafe();
> thd->lex->safe_to_cache_query= 0;
> return new (thd->mem_root) Item_func_connection_id();
> }
>
Looks good.
Just my few cents,
Mats Kindahl
--
Mats Kindahl
Lead Software Developer
Replication Team
MySQL AB, www.mysql.com