[MDEV-6451] "Error 'Table 't1' already exists' on query" with slave_ddl_exec_mode=IDEMPOTENT Created: 2014-07-17 Updated: 2015-06-14 Resolved: 2014-07-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.12 |
| Fix Version/s: | 10.0.13 |
| Type: | Bug | Priority: | Major |
| Reporter: | Kolbe Kegel (Inactive) | Assignee: | Michael Widenius |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Description |
|
Hi! I set up a simple replication topology with 3 hosts, all running MariaDB 10.0.12.
node1 and node2 are in active master-master with each other. node3 is set up in one-way multi-source from node1 and node2. Replication is set up using old-style binlog positions (GTIDs are not used for replication). I execute a CREATE TABLE statement on node1, which is replicated to node2 as expected and logged to its binary log due to log-slave-updates. node3 receives this CREATE TABLE event from both streams. node3 is running with gtid_ignore_duplicates=OFF, so it tries executing the CREATE TABLE event both times. I expect this. However, I am surprised to see this:
If I do START ALL SLAVES on node3, the CREATE TABLE statement executes without any errors. I then see two copies of this event in the node3's binary log (node3 has log-slave-updates enabled). Apparently, if I execute subsequent CREATE TABLE statements on node1 or node2, they are executed twice on the slaves without any intervention. So, it seems that the first CREATE TABLE fails but subsequent create tables execute using slave_ddl_exec_mode=IDEMPOTENT behavior? |
| Comments |
| Comment by Elena Stepanova [ 2014-07-18 ] | |||||||||||||||||||||||||||||||||||||||||||
|
I could reproduce it manually reliably, but when it's put in MTR, it turns out to be weirdly sporadic. I need to look more at it. | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2014-07-21 ] | |||||||||||||||||||||||||||||||||||||||||||
|
So, when the scenario is run manually, the problem is sporadic too. I wasn't able to produce a deterministic test case because I cannot trigger sync points inside slave SQL threads, and running regular CREATE OR REPLACE statements doesn't seem to cause the same problem since it's processed differently. Below is a crude MTR test case to reproduce the problem (not to be included into the suite!).
| |||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Widenius [ 2014-07-30 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Hi! I was not able to repeat the problem. I was trying to test this in 10.0, but noticed that the required test.cnf file was missing. I created the following file mysql-test/suite/rpl/t/skr.cnf !include suite/rpl/my.cnf [mysqld.1] [mysqld.2] [mysqld.3] [ENV] When I run the test case as: mysql-test-run rpl.skr This crashed in rpl_end with: However, I don't have any problems with create table failing (as far as I can see) | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2014-07-30 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Here is my cnf file:
For me, the test also fails like this:
And the error logs shows this:
| |||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Widenius [ 2014-07-30 ] | |||||||||||||||||||||||||||||||||||||||||||
|
The race condition was in lock_table_names() which failed if we tried to do a create table withing the replication thread if the table was in use. Fixed by propagating the REPLACE flag to lock_table_names(). | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Widenius [ 2014-07-30 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Pushed into 10.0 tree | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Dr Eberhard W Lisse [ 2015-06-13 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Hi I am encountering the same issue but with a VIEW. Master is Server version: 10.0.13-MariaDB-log Homebrew Slave is Server version: 10.0.19-MariaDB-1~precise-log mariadb.org binary distribution Jun 13 16:54:49 whktest mysqld: 150613 16:54:49 [Warning] Slave: Table The statement causing this is CREATE ALGORITHM = UNDEFINED Stepping over the statement does not work. greetings, el | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-06-14 ] | |||||||||||||||||||||||||||||||||||||||||||
By "the same issue" do you mean that you also have two masters executing the statement, and observe the error despite slave_ddl_exec_mode=IDEMPOTENT? This bug report was about a very specific situation. The conflict was expected to happen in the given setup, but it was supposed to be suppressed by the slave configuration. If you mean the same – that you indeed create a duplicate view, but don't expect it to cause a problem due to IDEMPOTENT mode, then I think the expectation is not valid, according to the variable description it does not affect views. If you just mean that you are getting the error when you think there should be no conflict, we will need much more information to find out why it might be happening, and it's not related to this bug report. Please create another JIRA issue, attach your binary logs (or their fragments around this view creation, the wider the better), cnf files and error logs. |