[MDEV-11246] replicate-rewrite-db doesn't work on functions with STATEMENT binlog Created: 2016-11-07 Updated: 2022-02-22 Resolved: 2022-02-22 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Replication |
| Affects Version/s: | 10.1.18, 5.5, 10.0, 10.1, 10.2 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Anton Avramov | Assignee: | Sachin Setiya (Inactive) |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | upstream | ||
| Environment: |
ubuntu trusty |
||
| Description |
|
Create a master replication server with variable binlog_format=STATEMENT
Create a slave replication server with settings:
On the slave
Setup replication on the slave named 'repl_bug' On the master execute:
At this point there should be one table and one procedure in db mariadb_repl_bug on the master and m_bug_repl. Now on the master execute:
The replication on the slave will then stop with error:
If you create the database mariadb_repl_bug and the function than the error will change to duplicate key. In both cases this is incorrect behaviour. The slave should rewrite the db on calling the function also. |
| Comments |
| Comment by Elena Stepanova [ 2016-11-16 ] | |||||||
|
Reproducible on all of 5.5-10.2, and also on MySQL (tried 5.7, but probably all of them are affected). The problem here is that the function invocation is not written into the binary log as is, instead the server generates its own variation:
That is, it writes the function with a fully-qualified name. And then of course replicate-rewrite-db does not work, because it considers the statement to be a cross-database query (a degenerate case of cross-database, but anyway – the name is fully qualified, so no substitution happens). It's not quite obvious why it should be fully qualified, probably it just happened to be this way. Did you, by any chance, also file a bug at bugs.mysql.com, and if not, are you willing to do it? | |||||||
| Comment by Daniel Black [ 2018-01-01 ] | |||||||
|
fyi - can't find a bugs.mysql.com bug. | |||||||
| Comment by Sachin Setiya (Inactive) [ 2018-09-02 ] | |||||||
|
db name is added because of commit 3a05847abb for bug 19725
| |||||||
| Comment by Sachin Setiya (Inactive) [ 2018-09-02 ] | |||||||
|
So the only option is to threat this function as non cross database function. which is string manipulation , So idk what else can be done | |||||||
| Comment by Andrei Elkin [ 2022-02-22 ] | |||||||
|
Mariadb KB warns on the statement format limits
|