Below is the list of changes that have just been committed into a local
5.0 repository of guilhem. When guilhem 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
1.2032 06/01/19 14:33:44 guilhem@stripped +7 -0
Fix for BUG#14769 "Function fails to replicate if fails half-way (slave stops)":
when a stored function is invoked in a non-binlogged caller (e.g. SELECT, DO), we binlog
the function
call as SELECT instead of as DO (see revision comment of sp_head.cc for more).
And: minor wording change in the help text, and making sure rpl000017 cleans up after
itself.
sql/sp_head.cc
1.196 06/01/19 14:33:39 guilhem@stripped +1 -1
When a stored function is invoked in a non-binlogged caller (e.g. SELECT, DO), we
binlog the function
call as SELECT instead of as DO. Indeed, if binlogged as DO (remember DO resets the
thread's error code to 0
at the very end of DO's execution)
- the binlog event still bears the true error code (because binlogging happens before
DO resets the error code)
- but the slave will always produce an error code of 0 (as it's DO), so will complain
that error on master
and error on slave don't match. Whether the caller on master was DO or SELECT, the
problem happens.
By binlogging the function call as SELECT, the slave will not reset its error code and
so will compare properly.
sql/mysqld.cc
1.532 06/01/19 14:33:39 guilhem@stripped +2 -2
in the help text, "function" -> "stored function" (a precision suggested by Paul
some time ago,
as the option does not apply to UDFs)
mysql-test/t/rpl_sp.test
1.11 06/01/19 14:33:39 guilhem@stripped +5 -8
Testing of BUG#14769: we verify that a "DO fn1()" and "SELECT fn1()" (where fn1 fails
in its middle)
do not cause the slave to stop anymore.
Additionally, we remove some wrong lines in the very end of the test.
mysql-test/t/rpl_sp-slave.opt
1.3 06/01/19 14:33:39 guilhem@stripped +1 -1
no need to skip 1062 as we fix bug#14769
mysql-test/t/rpl000017.test
1.14 06/01/19 14:33:39 guilhem@stripped +1 -0
removing this there-since-years user which the test leaves after it, which caused
problems already.
mysql-test/r/rpl_sp.result
1.15 06/01/19 14:33:39 guilhem@stripped +13 -8
result update
mysql-test/r/rpl000017.result
1.7 06/01/19 14:33:39 guilhem@stripped +1 -0
result update
# 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: guilhem
# Host: gbichot3.local
# Root: /home/mysql_src/mysql-5.0-van
--- 1.531/sql/mysqld.cc 2006-01-18 13:20:47 +01:00
+++ 1.532/sql/mysqld.cc 2006-01-19 14:33:39 +01:00
@@ -4909,8 +4909,8 @@
*/
{"log-bin-trust-function-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS,
"If equal to 0 (the default), then when --log-bin is used, creation of "
- "a function is allowed only to users having the SUPER privilege and only "
- "if this function may not break binary logging.",
+ "a stored function is allowed only to users having the SUPER privilege and"
+ " only if this function may not break binary logging.",
(gptr*) &trust_function_creators, (gptr*) &trust_function_creators, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-error", OPT_ERROR_LOG_FILE, "Error log file.",
--- 1.14/mysql-test/r/rpl_sp.result 2006-01-04 15:23:45 +01:00
+++ 1.15/mysql-test/r/rpl_sp.result 2006-01-19 14:33:39 +01:00
@@ -233,20 +233,25 @@
delete from t2;
alter table t2 add unique (a);
drop function fn1;
-create function fn1()
+create function fn1(x int)
returns int
begin
-insert into t2 values(20),(20);
+insert into t2 values(x),(x);
return 10;
end|
-select fn1();
+do fn1(100);
+Warnings:
+Error 1062 Duplicate entry '100' for key 1
+select fn1(20);
ERROR 23000: Duplicate entry '20' for key 1
select * from t2;
a
20
+100
select * from t2;
a
20
+100
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
delete from t1;
@@ -324,7 +329,7 @@
return x+2;
end
master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2
-master-bin.000001 # Query 1 # use `mysqltest1`; DO `fn1`(20)
+master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20)
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21))
master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1()
@@ -351,13 +356,14 @@
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2
master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a)
master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
-master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1()
+master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1(x int)
returns int
begin
-insert into t2 values(20),(20);
+insert into t2 values(x),(x);
return 10;
end
-master-bin.000001 # Query 1 # use `mysqltest1`; DO `fn1`()
+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`; 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)
@@ -402,4 +408,3 @@
a
1
drop table t1;
-reset master;
--- 1.2/mysql-test/t/rpl_sp-slave.opt 2005-11-10 17:50:43 +01:00
+++ 1.3/mysql-test/t/rpl_sp-slave.opt 2006-01-19 14:33:39 +01:00
@@ -1 +1 @@
---log_bin_trust_routine_creators=0 --slave-skip-errors=1062
+--log_bin_trust_routine_creators=0
--- 1.10/mysql-test/t/rpl_sp.test 2006-01-04 15:23:45 +01:00
+++ 1.11/mysql-test/t/rpl_sp.test 2006-01-19 14:33:39 +01:00
@@ -294,21 +294,19 @@
drop function fn1;
delimiter |;
-create function fn1()
+create function fn1(x int)
returns int
begin
- insert into t2 values(20),(20);
+ insert into t2 values(x),(x);
return 10;
end|
delimiter ;|
-# Because of BUG#14769 the following statement requires that we start
-# slave with --slave-skip-errors=1062. When that bug is fixed, that
-# option can be removed.
+do fn1(100);
--error 1062
-select fn1();
+select fn1(20);
select * from t2;
sync_slave_with_master;
@@ -398,10 +396,9 @@
drop view v1;
drop function f1;
sync_slave_with_master;
-connection slave;
select * from t1;
# cleanup
connection master;
drop table t1;
-reset master;
+sync_slave_with_master;
--- 1.195/sql/sp_head.cc 2006-01-16 15:37:22 +01:00
+++ 1.196/sql/sp_head.cc 2006-01-19 14:33:39 +01:00
@@ -1287,7 +1287,7 @@
char buf[256];
String bufstr(buf, sizeof(buf), &my_charset_bin);
bufstr.length(0);
- bufstr.append(STRING_WITH_LEN("DO "));
+ bufstr.append(STRING_WITH_LEN("SELECT "));
append_identifier(thd, &bufstr, m_name.str, m_name.length);
bufstr.append('(');
for (uint i=0; i < argcount; i++)
--- 1.6/mysql-test/r/rpl000017.result 2002-10-25 01:46:13 +02:00
+++ 1.7/mysql-test/r/rpl000017.result 2006-01-19 14:33:39 +01:00
@@ -9,3 +9,4 @@
n
24
drop table t1;
+drop user replicate@localhost, replicate@stripped;
--- 1.13/mysql-test/t/rpl000017.test 2005-07-28 15:12:35 +02:00
+++ 1.14/mysql-test/t/rpl000017.test 2006-01-19 14:33:39 +01:00
@@ -16,6 +16,7 @@
select * from t1;
connection master;
drop table t1;
+drop user replicate@localhost, replicate@stripped;
sync_slave_with_master;
# End of 4.1 tests
| Thread |
|---|
| • bk commit into 5.0 tree (guilhem:1.2032) BUG#14769 | guilhem | 19 Jan |