[MDEV-11201] gtid_ignore_duplicates incorrectly ignores statements even when GTID replication is not enabled Created: 2016-11-01 Updated: 2017-04-10 Resolved: 2017-04-10 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Replication |
| Affects Version/s: | 10.0, 10.1, 10.2 |
| Fix Version/s: | 10.0.31 |
| Type: | Bug | Priority: | Major |
| Reporter: | Michaël de groot | Assignee: | Lixun Peng |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Hi! gtid_ignore_duplicates ignores statements even when GTID replication is not enabled. I can reproduce it and I can give you access to the VM's where I can reproduce it. It seams that duplicate STATEMENTS always get ignored and unique STATEMENTS only get ignored when the slave gets restarted. master config:
Slave config:
Steps to reproduce: 2. Create 10 test tables and insert data into them:
3. Put script.sh and start.sh
4. Run start.sh 5. While this is running, start this script to restart the slave every minute:
I am not sure if changing slave_parallel_threads has anything to do with it. I just realize it is still there after creating this report. 6. Observer the replication gets out of sync:
On master:
|
| Comments |
| Comment by Elena Stepanova [ 2016-11-01 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In the description, you refer to "duplicate statements" and "unique statements". What do you mean by that? Since it is in the context of gtid_ignore_duplicates, I would assume that you are talking about duplicate GTIDs. But even if the option is wrongly applied when GTID is not enabled, in the described scenario there should be no GTID duplicates. You have one master and one replication channel, where the duplicates come from? Please also specify the exact command that you use to "setup replication between two nodes". | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michaël de groot [ 2016-11-06 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
elenst, sorry for the late reply here. With duplicate statements I mean: With unique statements I mean: GTID is the funny thing about this. I do not use it and still gtid_ignore_duplicates has effect. So I'm not talking about duplicate ID's I set up replication by: CHANGE MASTER TO MASTER_HOST='machine', MASTER_USER='repl', MASTER_PASSWORD='repl'; I verified that master_use_gitd=no; the machines were all completely fresh. I did not verify if this occurs with GTID SBR as well. Let me know if you have any more questions! | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kristian Nielsen [ 2016-11-21 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It seems likely that something else is going on here. As Elena wrote there are no duplicate gtids here. But you are using MyISAM tables in a scary way: INSERT INTO t_myisam SELECT ... FROM t_myisam LIMIT 10000 I wonder if there is any guarantee that this will work correctly? The problem is if the locking is enough to ensure that the LIMIT will select the same number of rows? Probably not the same rows, though that should in principle not matter. It could also be a limitation/bug with parallel replication and MyISAM. Does the problem still occur if gtid_ignore_duplicates=off? Does it occur if using InnoDB tables? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michaël de groot [ 2016-11-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
knielsen, the problem does not occur if gtid_ignore_duplicates is off. I did not check if it also happened with InnoDB tables. elenst, could you try to reproduce it? I am off for customers the next 4 weeks. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2016-12-01 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
michaeldg, nice catch, it is very much reproducible. Even though, indeed, there are no duplicates of any kind, replication seems to misbehave badly when gtid_ignore_duplicates=1 and replication does not actually use GTID. That is:
Parallel replication is irrelevant. The basic scenario is:
knielsen, do you want to take it? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kristian Nielsen [ 2016-12-01 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ok, now I see it. So this is a race between the IO thread connect and the SQL In this case, the IO thread overwrites the slave gtid position with the gtid I wonder if the solution is to just disable --gtid-ignore-duplicates in http://lists.askmonty.org/pipermail/commits/2016-December/010145.html That patch fixes the problem from the test case. It seems kind of reasonable that --gtid-ignore-duplicates should only do
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2016-12-01 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
knielsen, do I understand correctly that with this patch the value of the variable will remain intact, it just will be ignored if GTIDs are not used for replication? Just clarifying because when I read "disable --gtid-ignore-duplicates in non-gtid mode" first, it sounded to me like the variable would be forcefully unset, which would be a wrong thing to do; but I don't see anything like that in the patch. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kristian Nielsen [ 2016-12-01 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
> do I understand correctly that with this patch the value of the variable Correct. Specifically, with the patch, if a slave-master connection has | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2016-12-01 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
knielsen, thanks. plinux, could you please review the patch? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michaël de groot [ 2016-12-02 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi everybody! Sorry to bother you but I think a little more investigation may be required. Does this occur due to GTID not being enabled? Can we guarantee that this does not occur if GTID is enabled? Thanks, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michaël de groot [ 2016-12-02 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
And thank you, elenst, for getting to the bottom of this, filtering out the complexity of what I submitted. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kristian Nielsen [ 2016-12-02 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This particular bug will not occur when GTID is enabled, because the
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michaël de groot [ 2016-12-02 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ah ok, excellent. Thank you knielsen! | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Lixun Peng [ 2017-04-09 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
knielsen I reviewed the patch here: http://lists.askmonty.org/pipermail/commits/2016-December/010145.html | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kristian Nielsen [ 2017-04-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Pushed to 10.0 |