List:Commits« Previous MessageNext Message »
From:Tatjana A Nuernberg Date:November 15 2006 1:27am
Subject:bk commit into 5.1 tree (tnurnberg:1.2376) BUG#16456
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tnurnberg. When tnurnberg 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, 2006-11-15 01:27:39+01:00, tnurnberg@stripped +7 -0
  Bug#16456 "RBR: rpl_sp.test expects query to fail, but passes in RBR"
  
  calling (rather than defining) non-deterministic SP in SBR (as opposed
  to RBR or mixed) will throw an error now.
  
  require mixed mode for tests now. SBR will now fail when calling
  non-deter SPs and SFs (as it should), and RBR already failed by virtue of
  giving different results for "show binlog" than the results-file has.
  also test for 16456 now. lastly make amends because one of the tests
  fails with a new error # now as code was added to sql_trigger.cc while
  test was disabled.

  mysql-test/mysql-test-run.pl@stripped, 2006-11-15 01:27:36+01:00, tnurnberg@stripped +5 -1
    Bug#16456 "RBR: rpl_sp.test expects query to fail, but passes in RBR"
    
    mtr falsely assumed that default rep mode is stmt i/o mixed?

  mysql-test/r/func_time.result@stripped, 2006-11-15 01:27:36+01:00, tnurnberg@stripped +1 -1
    Bug#16456 "RBR: rpl_sp.test expects query to fail, but passes in RBR"
    
    rpl_sp.test was disabled for a while; update results where wording has
    changed and add results for #16456

  mysql-test/r/rpl_sp.result@stripped, 2006-11-15 01:27:36+01:00, tnurnberg@stripped +26 -6
    Bug#16456 "RBR: rpl_sp.test expects query to fail, but passes in RBR"
    
    rpl_sp.test was disabled for a while; update results where wording has
    changed and add results for #16456
    ---
    Bug#16456 "RBR: rpl_sp.test expects query to fail, but passes in RBR"
    
    calling (rather than defining) non-deterministic SP or SF in SBR
    (as opposed to RBR or mixed) will throw an error now.

  mysql-test/t/disabled.def@stripped, 2006-11-15 01:27:36+01:00, tnurnberg@stripped +0 -1
    Bug#16456 "RBR: rpl_sp.test expects query to fail, but passes in RBR"
    
    re-enable rpl_sp.test

  mysql-test/t/rpl_sp.test@stripped, 2006-11-15 01:27:36+01:00, tnurnberg@stripped +32 -1
    Bug#16456 "RBR: rpl_sp.test expects query to fail, but passes in RBR"
    
    require mixed mode for tests now. SBR will now fail when calling
    non-deter SPs (as it should), and RBR already failed by virtue of
    giving different results for "show binlog" than the results-file has.
    also test for 16456 now. lastly make amends because one of the tests
    fails with a new error # now as code was added to sql_trigger.cc while
    test was disabled.
    ---
    Bug#16456 "RBR: rpl_sp.test expects query to fail, but passes in RBR"
    
    calling (rather than defining) non-deterministic SP or SF in SBR
    (as opposed to RBR or mixed) will throw an error now.

  sql/item_func.cc@stripped, 2006-11-15 01:27:36+01:00, tnurnberg@stripped +12 -0
    Bug#16456 "RBR: rpl_sp.test expects query to fail, but passes in RBR"
    
    calling (rather than defining) non-deterministic SF in SBR
    (as opposed to RBR or mixed) will throw an error now.

  sql/sql_parse.cc@stripped, 2006-11-15 01:27:36+01:00, tnurnberg@stripped +12 -0
    Bug#16456 "RBR: rpl_sp.test expects query to fail, but passes in RBR"
    
    calling (rather than defining) non-deterministic SP in SBR (as opposed
    to RBR or mixed) will throw an error now.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	tnurnberg
# Host:	salvation.intern.azundris.com
# Root:	/home/tnurnberg/work/mysql-5.1-maint-16456

--- 1.322/sql/item_func.cc	2006-10-06 16:29:04 +02:00
+++ 1.323/sql/item_func.cc	2006-11-15 01:27:36 +01:00
@@ -4975,6 +4975,18 @@ Item_func_sp::execute_impl(THD *thd, Fie
     goto error;
 
   /*
+    Throw an error if a non-deterministic function is called while
+    statement-based replication (SBR) is active.
+  */
+  if (!m_sp->m_chistics->detistic &&
+      (mysql_bin_log.is_open() &&
+       thd->variables.binlog_format == BINLOG_FORMAT_STMT))
+  {
+    my_error(ER_BINLOG_ROW_RBR_TO_SBR, MYF(0));
+    goto error;
+  }
+
+  /*
     Disable the binlogging if this is not a SELECT statement. If this is a
     SELECT, leave binlogging on, so execute_function() code writes the
     function call into binlog.

--- 1.586/sql/sql_parse.cc	2006-10-11 22:49:58 +02:00
+++ 1.587/sql/sql_parse.cc	2006-11-15 01:27:36 +01:00
@@ -4546,6 +4546,18 @@ end_with_restore_list:
             goto error;
         }
 
+        /*
+          Throw an error if a non-deterministic procedure is called while
+          statement-based replication (SBR) is active.
+         */
+        if (!sp->m_chistics->detistic &&
+            (mysql_bin_log.is_open() &&
+             thd->variables.binlog_format == BINLOG_FORMAT_STMT))
+        {
+          my_error(ER_BINLOG_ROW_RBR_TO_SBR, MYF(0));
+          goto error;
+        }
+
 	my_bool nsok= thd->net.no_send_ok;
 	thd->net.no_send_ok= TRUE;
 	if (sp->m_flags & sp_head::MULTI_RESULTS)

--- 1.21/mysql-test/r/rpl_sp.result	2006-08-12 17:32:43 +02:00
+++ 1.22/mysql-test/r/rpl_sp.result	2006-11-15 01:27:36 +01:00
@@ -104,10 +104,10 @@ begin
 insert into t2 values(20),(20);
 end|
 call foo4();
-ERROR 23000: Duplicate entry '20' for key 1
+ERROR 23000: Duplicate entry '20' for key 'a'
 show warnings;
 Level	Code	Message
-Error	1062	Duplicate entry '20' for key 1
+Error	1062	Duplicate entry '20' for key 'a'
 select * from t2;
 a
 20
@@ -124,6 +124,9 @@ select * from mysql.proc where name="foo
 db	name	type	specific_name	language	sql_data_access	is_deterministic	security_type	param_list	returns	body	definer	created	modified	sql_mode	comment
 select * from mysql.proc where name="foo4" and db='mysqltest1';
 db	name	type	specific_name	language	sql_data_access	is_deterministic	security_type	param_list	returns	body	definer	created	modified	sql_mode	comment
+set binlog_format=STATEMENT;
+call foo();
+ERROR HY000: Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events
 drop procedure foo;
 drop procedure foo2;
 drop procedure foo3;
@@ -181,7 +184,7 @@ end|
 ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
 set global log_bin_trust_routine_creators=1;
 Warnings:
-Warning	1287	'log_bin_trust_routine_creators' is deprecated; use 'log_bin_trust_function_creators' instead
+Warning	1541	The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
 set global log_bin_trust_function_creators=0;
 set global log_bin_trust_function_creators=1;
 set global log_bin_trust_function_creators=1;
@@ -241,9 +244,9 @@ return 10;
 end|
 do fn1(100);
 Warnings:
-Error	1062	Duplicate entry '100' for key 1
+Error	1062	Duplicate entry '100' for key 'a'
 select fn1(20);
-ERROR 23000: Duplicate entry '20' for key 1
+ERROR 23000: Duplicate entry '20' for key 'a'
 select * from t2;
 a
 20
@@ -252,8 +255,17 @@ select * from t2;
 a
 20
 100
+set binlog_format=STATEMENT;
+create function fn16456()
+returns int
+begin
+return unix_timestamp();
+end|
+select fn16456();
+ERROR HY000: Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events
+drop function fn16456;
 create trigger trg before insert on t1 for each row set new.a= 10;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: TRIGGER command denied to user 'zedjzlcsjhd'@'localhost' for table 't1'
 delete from t1;
 create trigger trg before insert on t1 for each row set new.a= 10;
 insert into t1 values (1);
@@ -364,6 +376,12 @@ return 10;
 end
 master-bin.000001	#	Query	1	#	use `mysqltest1`; SELECT `fn1`(100)
 master-bin.000001	#	Query	1	#	use `mysqltest1`; SELECT `fn1`(20)
+master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn16456()
+returns int
+begin
+return unix_timestamp();
+end
+master-bin.000001	#	Query	1	#	use `mysqltest1`; drop function fn16456
 master-bin.000001	#	Query	1	#	use `mysqltest1`; delete from t1
 master-bin.000001	#	Query	1	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
 master-bin.000001	#	Query	1	#	use `mysqltest1`; insert into t1 values (1)
@@ -465,3 +483,5 @@ RETURN 0
 DROP PROCEDURE p1;
 DROP FUNCTION f1;
 drop table t1;
+End of 5.0 tests
+End of 5.1 tests

--- 1.19/mysql-test/t/rpl_sp.test	2006-08-12 19:06:42 +02:00
+++ 1.20/mysql-test/t/rpl_sp.test	2006-11-15 01:27:36 +01:00
@@ -8,6 +8,7 @@
 # still accepted (this test also checks that the new name is
 # accepted). The old name could be removed in 5.1 or 6.0.
 
+source include/have_binlog_format_mixed.inc;
 source include/master-slave.inc;
 
 # we need a db != test, where we don't have automatic grants
@@ -172,6 +173,15 @@ select * from mysql.proc where name="foo
 sync_slave_with_master;
 select * from mysql.proc where name="foo4" and db='mysqltest1';
 
+# fail if non-deterministic SP is called in SBR, bug#16456
+let $oblf=`select @@SESSION.BINLOG_FORMAT`;
+set binlog_format=STATEMENT;
+--error ER_BINLOG_ROW_RBR_TO_SBR
+call foo();
+--disable_query_log
+eval set binlog_format=$oblf;
+--enable_query_log
+
 # ********************** PART 2 : FUNCTIONS ***************
 
 connection master;
@@ -316,10 +326,31 @@ sync_slave_with_master;
 # check that this failed-in-the-middle replicated right:
 select * from t2;
 
+# fail if non-deterministic SF is called in SBR, bug#16456
+connection master;
+let $oblf=`select @@SESSION.BINLOG_FORMAT`;
+set binlog_format=STATEMENT;
+delimiter |;
+create function fn16456()
+       returns int
+begin
+       return unix_timestamp();
+end|
+delimiter ;|
+--error ER_BINLOG_ROW_RBR_TO_SBR
+select fn16456();
+--disable_query_log
+eval set binlog_format=$oblf;
+--enable_query_log
+drop function fn16456;
+
+
 # ********************** PART 3 : TRIGGERS ***************
 
 connection con1;
---error 1227
+# now fails due to missing trigger grant (err 1142 i/o 1227) due to new
+# check in sql_trigger.cc (v1.44) by anozdrin on 2006/02/01  --azundris
+--error ER_TABLEACCESS_DENIED_ERROR
 create trigger trg before insert on t1 for each row set new.a= 10;
 
 connection master;

--- 1.198/mysql-test/mysql-test-run.pl	2006-10-12 16:18:10 +02:00
+++ 1.199/mysql-test/mysql-test-run.pl	2006-11-15 01:27:36 +01:00
@@ -709,12 +709,16 @@ sub command_line_setup () {
   # Find out type of logging that are being used
   # --------------------------------------------------------------------------
   # NOTE if the default binlog format is changed, this has to be changed
-  $used_binlog_format= "stmt";
+  $used_binlog_format= "mixed";
   foreach my $arg ( @opt_extra_mysqld_opt )
   {
     if ( defined mtr_match_substring($arg,"binlog-format=row"))
     {
       $used_binlog_format= "row";
+    }
+    elsif ( defined mtr_match_substring($arg,"binlog-format=statement"))
+    {
+      $used_binlog_format= "stmt";
     }
   }
   mtr_report("Using binlog format '$used_binlog_format'");

--- 1.208/mysql-test/t/disabled.def	2006-10-11 00:36:33 +02:00
+++ 1.209/mysql-test/t/disabled.def	2006-11-15 01:27:36 +01:00
@@ -23,7 +23,6 @@ rpl_ndb_ddl              : BUG#18946 res
 rpl_ndb_innodb2ndb       : Bug #19710  Cluster replication to partition table fails on DELETE FROM statement
 rpl_ndb_myisam2ndb       : Bug #19710  Cluster replication to partition table fails on DELETE FROM statement
 rpl_row_blob_innodb      : BUG#18980 2006-04-10 kent    Test fails randomly
-rpl_sp                   : BUG#16456 2006-02-16 jmiller
 rpl_multi_engine         : BUG#22583 2006-09-23 lars
 
 # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open

--- 1.82/mysql-test/r/func_time.result	2006-10-12 10:36:10 +02:00
+++ 1.83/mysql-test/r/func_time.result	2006-11-15 01:27:36 +01:00
@@ -981,7 +981,7 @@ CREATE TABLE t1(f1 TIME);
 INSERT INTO t1 VALUES('916:00:00 a');
 Warnings:
 Warning	1265	Data truncated for column 'f1' at row 1
-Warning	1264	Out of range value adjusted for column 'f1' at row 1
+Warning	1264	Out of range value for column 'f1' at row 1
 SELECT * FROM t1;
 f1
 838:59:59
Thread
bk commit into 5.1 tree (tnurnberg:1.2376) BUG#16456Tatjana A Nuernberg15 Nov