List:Commits« Previous MessageNext Message »
From:Sven Sandberg Date:November 7 2007 3:28pm
Subject:Re: bk commit into 5.1 tree (mats:1.2605) BUG#28086
View as plain text  
Hi,
Patch looks good, I have no comments.
OK to push.
/Sven

Mats Kindahl wrote:
> Below is the list of changes that have just been committed into a local
> 5.1 repository of mats. When mats 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-10-31 21:09:52+01:00, mats@stripped +3 -0
>   BUG#28086 (SBR of USER() becomes corrupted on slave):
>   
>   Marking statements containing USER() or CURRENT_USER() as unsafe, causing
>   them to switch to using row-based logging in MIXED mode and generate a
>   warning in STATEMENT mode.
> 
>   mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result@stripped, 2007-10-31
> 21:09:44+01:00, mats@stripped +68 -0
>     Result change.
> 
>   mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test@stripped, 2007-10-31
> 21:09:44+01:00, mats@stripped +36 -0
>     Adding test to check that USER() and CURRENT_USER() cause a switch
>     to row-based logging.
> 
>   sql/sql_yacc.yy@stripped, 2007-10-31 21:09:44+01:00, mats@stripped
> +2 -0
>     Setting statements containing USER() or CURRENT_USER() to be unsafe.
> 
> diff -Nrup a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result
> b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result
> --- a/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result	2007-07-04 22:06:25
> +02:00
> +++ b/mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result	2007-10-31 21:09:44
> +01:00
> @@ -405,6 +405,26 @@ CREATE TABLE t12 (data LONG);
>  LOCK TABLES t12 WRITE;
>  INSERT INTO t12 VALUES(UUID());
>  UNLOCK TABLES;
> +CREATE FUNCTION my_user()
> +RETURNS CHAR(64)
> +BEGIN
> +DECLARE user CHAR(64);
> +SELECT USER() INTO user;
> +RETURN user;
> +END $$
> +CREATE FUNCTION my_current_user()
> +RETURNS CHAR(64)
> +BEGIN
> +DECLARE user CHAR(64);
> +SELECT CURRENT_USER() INTO user;
> +RETURN user;
> +END $$
> +DROP TABLE IF EXISTS t13;
> +CREATE TABLE t13 (data CHAR(64));
> +INSERT INTO t13 VALUES (USER());
> +INSERT INTO t13 VALUES (my_user());
> +INSERT INTO t13 VALUES (CURRENT_USER());
> +INSERT INTO t13 VALUES (my_current_user());
>  show binlog events from <binlog_start>;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>  master-bin.000001	#	Query	#	#	drop database if exists mysqltest1
> @@ -709,6 +729,30 @@ master-bin.000001	#	Query	#	#	use `mysql
>  master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE TABLE t12 (data LONG)
>  master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t12)
>  master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost`
> FUNCTION my_user()
> +RETURNS CHAR(64)
> +BEGIN
> +DECLARE user CHAR(64);
> +SELECT USER() INTO user;
> +RETURN user;
> +END
> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost`
> FUNCTION my_current_user()
> +RETURNS CHAR(64)
> +BEGIN
> +DECLARE user CHAR(64);
> +SELECT CURRENT_USER() INTO user;
> +RETURN user;
> +END
> +master-bin.000001	#	Query	#	#	use `mysqltest1`; DROP TABLE IF EXISTS t13
> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE TABLE t13 (data CHAR(64))
> +master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t13)
> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> +master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t13)
> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> +master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t13)
> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> +master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t13)
> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>  show binlog events from <binlog_start>;
>  Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>  master-bin.000001	#	Query	#	#	drop database if exists mysqltest1
> @@ -1012,6 +1056,30 @@ master-bin.000001	#	Query	#	#	use `mysql
>  master-bin.000001	#	Query	#	#	use `mysqltest1`; DROP TABLE IF EXISTS t12
>  master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE TABLE t12 (data LONG)
>  master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t12)
> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost`
> FUNCTION my_user()
> +RETURNS CHAR(64)
> +BEGIN
> +DECLARE user CHAR(64);
> +SELECT USER() INTO user;
> +RETURN user;
> +END
> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost`
> FUNCTION my_current_user()
> +RETURNS CHAR(64)
> +BEGIN
> +DECLARE user CHAR(64);
> +SELECT CURRENT_USER() INTO user;
> +RETURN user;
> +END
> +master-bin.000001	#	Query	#	#	use `mysqltest1`; DROP TABLE IF EXISTS t13
> +master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE TABLE t13 (data CHAR(64))
> +master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t13)
> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> +master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t13)
> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> +master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t13)
> +master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
> +master-bin.000001	#	Table_map	#	#	table_id: # (mysqltest1.t13)
>  master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
>  drop database mysqltest1;
>  set global binlog_format =@my_binlog_format;
> diff -Nrup a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
> b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
> --- a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test	2007-06-27 14:27:24
> +02:00
> +++ b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test	2007-10-31 21:09:44
> +01:00
> @@ -518,6 +518,42 @@ CREATE TABLE t12 (data LONG);
>  LOCK TABLES t12 WRITE;
>  INSERT INTO t12 VALUES(UUID());
>  UNLOCK TABLES;
> +sync_slave_with_master;
> +
> +#
> +# BUG#28086: SBR of USER() becomes corrupted on slave
> +# 
> +
> +connection master;
> +
> +# Just to get something that is non-trivial, albeit still simple, we
> +# stuff the result of USER() and CURRENT_USER() into a variable.
> +--delimiter $$
> +CREATE FUNCTION my_user()
> +    RETURNS CHAR(64)
> +BEGIN
> +  DECLARE user CHAR(64);
> +  SELECT USER() INTO user;
> +  RETURN user;
> +END $$
> +--delimiter ;
> +
> +--delimiter $$
> +CREATE FUNCTION my_current_user()
> +    RETURNS CHAR(64)
> +BEGIN
> +  DECLARE user CHAR(64);
> +  SELECT CURRENT_USER() INTO user;
> +  RETURN user;
> +END $$
> +--delimiter ;
> +
> +DROP TABLE IF EXISTS t13;
> +CREATE TABLE t13 (data CHAR(64));
> +INSERT INTO t13 VALUES (USER());
> +INSERT INTO t13 VALUES (my_user());
> +INSERT INTO t13 VALUES (CURRENT_USER());
> +INSERT INTO t13 VALUES (my_current_user());
>  
>  source include/show_binlog_events.inc;
>  sync_slave_with_master;
> diff -Nrup a/sql/sql_yacc.yy b/sql/sql_yacc.yy
> --- a/sql/sql_yacc.yy	2007-10-30 09:01:56 +01:00
> +++ b/sql/sql_yacc.yy	2007-10-31 21:09:44 +01:00
> @@ -6745,6 +6745,7 @@ function_call_keyword:
>          | CURRENT_USER optional_braces
>            {
>              $$= new (YYTHD->mem_root)
> Item_func_current_user(Lex->current_context());
> +            Lex->set_stmt_unsafe();
>              Lex->safe_to_cache_query= 0;
>            }
>          | DATE_SYM '(' expr ')'
> @@ -6790,6 +6791,7 @@ function_call_keyword:
>          | USER '(' ')'
>            {
>              $$= new (YYTHD->mem_root) Item_func_user();
> +            Lex->set_stmt_unsafe();
>              Lex->safe_to_cache_query=0;
>            }
>          | YEAR_SYM '(' expr ')'
> 

-- 
Sven Sandberg, Software Engineer
MySQL AB, www.mysql.com
Thread
bk commit into 5.1 tree (mats:1.2605) BUG#28086Mats Kindahl31 Oct
  • Re: bk commit into 5.1 tree (mats:1.2605) BUG#28086Sven Sandberg7 Nov