[MDEV-5704] replicate_ignore_db='mysql' does not work on mariaDB 5.5.35 Created: 2014-02-19 Updated: 2014-02-27 Due: 2014-03-19 Resolved: 2014-02-26 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.5.35 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Cristian Nicoara | Assignee: | Elena Stepanova |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Description |
|
My purpose is to ignore replication for the mysql database. I was trying to filter the replication for the mysql database in a master - slave configuration with mariaDB 5.5.35 , but I was not successful in the following configuration:
I tested this by creating a new user. However with the following configuration it works:
multitestrep is a test database created only for this purpose. My purpose is to ignore replication for the mysql database and the only solution I found is to set replicate_ignore_db='mysql,multitestrep'; I tested this many times and it can be reproduced each time. Regards. |
| Comments |
| Comment by Elena Stepanova [ 2014-02-19 ] |
|
Hi, Could you please describe your test in more detail? What is the exact statement that you use to create a user? Thanks |
| Comment by Cristian Nicoara [ 2014-02-20 ] |
|
Hello, – grant all privileges on database.* to user@'192.168.1.1' identified by 'password' require ssl; replicate_ignore_db = multitestrep |
| Comment by Elena Stepanova [ 2014-02-20 ] |
|
Hi Cristian, Account management statements (GRANT, CREATE USER and such) are written into the binary log as they are, not as updates to mysql.user table; so, they are replicated, regardless replicate_ignore_db. Thus, when the value does not work as you expect it to, it is actually the correct behavior. Thanks. |
| Comment by Cristian Nicoara [ 2014-02-26 ] |
|
Hello, we have this slave setting: Replicate_Ignore_DB: multitestrep,mysql but the following behavior is interesting : on master: – replication works and on slave we can see the new user created. but the following env on master: – in this case the replication does not work , I cannot find the new user replicated on slave . I believe that this behavior made me believe that this is a functional workaround ... but it is not . But, is there a way to prevent mysql database replication if binlog_format=MIXED ? To my knowledge if we go on binlog_format=ROW and Replicate_Ignore_DB=mysql , then it should work . Am I correct ? I am sorry if this is the wrong place to ask . Thank you . |
| Comment by Elena Stepanova [ 2014-02-26 ] |
Sorry, I wasn't accurate enough in my previous comment. Besides, the fact that you run your GRANT statements with different default databases changes things. The way replicate-ignore-db works is very much non-intuitive. Indeed, it differs dramatically for STATEMENT and ROW replication (MIXED is mostly STATEMENT unless it's forced into ROW mode); but in your case, you run GRANT statements, which are always replicated in STATEMENT mode, regardless the binlog format. So, to understand why you get what you get, you should look at how replicate-ignore-db works for STATEMENT-based replication. In your case, slave decides whether to replicate GRANT statement based on the default schema which was set on master when the statement was run. It does not take into account at all which tables get modified. For GRANT statements, it will work the same way with any binlog_format, so switching to ROW is not a solution. Another way is to explicitly issue SET SQL_LOG_BIN=0 before running GRANT (and SET SQL_LOG_BIN=1 afterwards); but it is not quite the same as skipping replication, it will cause the GRANT not being written into the master binary log at all. Unfortunately I'm afraid there is no better way to prevent the replication. |
| Comment by Elena Stepanova [ 2014-02-27 ] |
|
As a variant of the second solution, instead of setting SQL_LOG_BIN, you can use the pair{{skip_replication}} (on master) and replicate_events_marked_for_skip (on slave). In this case, you'll need to set the variable on the slave once and forever, while on master you'll have to set skip_replication every time before issuing the state of statements that you don't want to replicate, and revert it afterwards. It should prevent replication much like SQL_LOG_BIN would, the difference is that the statements will still be written to the binary logs, which in some cases can be desirable. See https://mariadb.com/kb/en/selectively-skipping-replication-of-binlog-events/ for more details. |
| Comment by Cristian Nicoara [ 2014-02-27 ] |
|
Thank you for you help , I used the second solution with skip_replication ... Regards. |
| Comment by Patryk Pomykalski [ 2014-02-27 ] |
|
We use "replicate-wild-ignore-table = mysql.%" and seems to work without problems. |
| Comment by Elena Stepanova [ 2014-02-27 ] |
|
How interesting, you are right.. And I'm not even sure it's supposed to, the documentation is not so clear about it, but it is surely convenient. |