Bug #12627 Insert statements inside functions are not replicated (RBR & SBR)
Submitted: 17 Aug 2005 17:26 Modified: 3 Oct 2005 12:10
Reporter: Jonathan Miller Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.0-wl1012 OS:Linux (Linux)
Assigned to: Guilhem Bichot CPU Architecture:Any

[17 Aug 2005 17:26] Jonathan Miller
Description:
Consider the following test:

+ create table test.t1 (a int, PRIMARY KEY(a));
+ create function test.f1(i int) returns int
+ begin
+ insert into test.t1 values(i);
+ return 0;
+ end//
+ select test.f1(1);
+ test.f1(1)
+ 0
+ select test.f1(2);
+ test.f1(2)
+ 0

************ Results Row Based *********************
Master:
+ select * from test.t1;
+ a
+ 1
+ 2
Slave:
+ select * from test.t1;
+ a

************ Results Statement Based *******************
Master:
+ select * from test.t1;
+ a
+ 1
+ 2
Slave:
+ select * from test.t1;
+ a

How to repeat:
See Above
[19 Aug 2005 15:24] Jonathan Miller
Another example from rpl_row_sp000.test:
+ CREATE FUNCTION fn1(x INT)
+ RETURNS INT
+ DETERMINISTIC
+ BEGIN
+ INSERT INTO mtest.t1 VALUES (x);
+ RETURN x+2;
+ END|
+ DELETE t1,t2 FROM mtest.t1, mtest.t2;
+ SELECT fn1(20);
+ fn1(20)
+ 22
+ INSERT INTO mtest.t2 VALUES (fn1(21));
+ SELECT * FROM mtest.t1;
+ a
+ 20
+ 21
+ SELECT * FROM mtest.t2;
+ a
+ 23
+ SELECT * FROM mtest.t1;
+ a
+ SELECT * FROM mtest.t2;
+ a
+ 23
[29 Sep 2005 13:50] Guilhem Bichot
rpl_sp_000 crashes RBR slave, due to some interaction between the new binlogging of function calls and the RBR code (i.e. it's a problem which comes from a merge of 5.0 into 5.0-wl1012). I'll try to fix that.
[3 Oct 2005 12:10] Guilhem Bichot
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html