[MDEV-12437] Import tablespace causes replication to stop Created: 2017-04-03 Updated: 2017-12-11 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Replication, Storage Engine - InnoDB |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Rafael Gallastegui | Assignee: | Marko Mäkelä |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | upstream | ||
| Issue Links: |
|
||||||||
| Description |
|
I've been experimenting with ALTER TABLE X IMPORT TABLESPACE mostly on MariaDB servers w/o replication as preparation to test the same scenario in a master-slave replication scenario. Most of the tests have been going OK, but when I finally tried it in a master/slave configuration, I saw that the replication is broken, since the slave is trying to execute the IMPORT TABLESPACE statement and it doesn't have the .ibd or .cfg files available to execute the operation. I've been searching all over to see what is the proper way of dealing with the IMPORT TABLESPACE statement in a replication environment but I cannot find anything. The only thing I found is a sentence in a MySQL page where it says that IMPORT TABLESPACE needs to have the file per table setting in both the master and slave set (which I have). The errors I get in the slave server are like this ones: 2017-03-29 11:34:10 140405862296320 [ERROR] InnoDB: Trying to import a tablespace, but could not open the tablespace file ./RAFAEL_SMALL_ECOH_BAK_X/SETTING_T.ibd and at this point, the replication stops. How is this supposed to work? Are we supposed to execute the DISCARD TABLESPACE, wait until it has been replicated in the slave server and copy the .ibd and .cfg file to both servers and execute the IMPORT TABLESPACE? That sounds like a lot of work if you're importing many tables. Or should it have worked by just having the master send the table information to the slave and have the slave import the whole table from the master? Sounds to me that the last scenario is the one that should be the correct one, but it's not working. Thanks |
| Comments |
| Comment by Elena Stepanova [ 2017-04-03 ] |
|
I don't know any way to replicate IMPORT TABLESPACE other than actually copying the files. marko, do you? |
| Comment by Marko Mäkelä [ 2017-04-04 ] |
|
To my knowledge, the InnoDB tablespace import/export does not play well with replication. I do not know if/how anyone uses it with replication. |
| Comment by Rafael Gallastegui [ 2017-04-04 ] |
|
Makes sense. That's what I was assuming that it would happen (that something would be written in the binlog such that the data would be available for the slave servers). The IMPORT TABLESPACE manual page didn't have any limitations for replication. Maybe it needs it? The reason we're experimenting with this is because we want to copy a database from one system to another every month or so (it's a 50+GB database) and mysqldump seems to be very inefficient (well, not mysqldump itself, but injecting the output of mysqldump into a master/slave replication pair) to the point where the slave sometimes gets behind by more than 10000 seconds (at least). It eventually recovers, but seems like a very demanding on both servers and we were looking for a better way of doing that. |
| Comment by Marko Mäkelä [ 2017-04-08 ] |
|
There is a way to speed up the data loading: create secondary indexes after the clustered index has been loaded. In this way, the secondary indexes entries could be pre-sorted, and with MariaDB 10.2 (or MySQL 5.7) the bulk loading would be enabled. |
| Comment by Elena Stepanova [ 2017-10-17 ] |
|
Should we treat it as a feature request? |
| Comment by Marko Mäkelä [ 2017-11-12 ] |
|
Yes, this feels like a feature request to have replication-friendly IMPORT. Or maybe, a duplicate of |