Bug #12815 | Replication breaks if one drops FUNCTION when it is pre-loaded by other thead | ||
---|---|---|---|
Submitted: | 25 Aug 2005 21:21 | Modified: | 12 Mar 2010 9:51 |
Reporter: | Sergey Petrunya | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S1 (Critical) |
Version: | 5.0.13 | OS: | Any |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[25 Aug 2005 21:21]
Sergey Petrunya
[17 Oct 2005 10:10]
Konstantin Osipov
Below is the test case that demonstrates the problem: source include/master-slave.inc # # Case 1. No locks are held for a stored function while it's executed # # master connection master; create table t1 (a int); create function f1() returns int return 1; lock table t1 write; # master1 connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); connection master1; send insert into t1 (a) values (f1()); # master2 connect (master2,127.0.0.1,root,,test,$MASTER_MYPORT,); connection master2; drop function f1; -- goes to binlog # Of course, if we do not recreate the function the slave will stop # at execution of the insert, create function f1() returns int return 2; # master connection master; unlock tables; # master1 connection master1; reap; # check results connection master; select * from t1; sync_slave_with_master; connection slave; select * from t1; This test produces the following .result: 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 function f1() returns int return 1; lock table t1 write; insert into t1 (a) values (f1()); drop function f1; create function f1() returns int return 2; unlock tables; select * from t1; a 1 select * from t1; a 2 drop table t1; drop function if exists f1; As one can easily see, the slave goes out of sync with master and inserts 2 into t1. If we don't recreate function f1, the slave will issue an error at insert and stop, which is a more disastrous manifestation of the problem.
[10 Mar 2006 16:25]
Konstantin Osipov
A fix for this bug requires support for object-level read/write locking for all metadata objects. This is a too big change to be implemented in 5.0. This bug should be fixed when a new data dictionary is implemented.
[27 Sep 2008 12:52]
Konstantin Osipov
This can be fixed now, with new metadata locking.
[22 Aug 2009 9:03]
Konstantin Osipov
Duplicate of Bug#30977
[12 Mar 2010 9:51]
Jon Olav Hauglid
Verified that this bug is now fixed in the current version of mysql-trunk (5.5.3-m3). Closing as a duplicate.