Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-12437

Import tablespace causes replication to stop

    XMLWordPrintable

Details

    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
      2017-03-29 11:34:10 140405862296320 [Note] InnoDB: Discarding tablespace of table "RAFAEL_SMALL_ECOH_BAK_X"."SETTING_T": Tablespace not found
      2017-03-29 11:38:19 140405862296320 [ERROR] Slave SQL: Error 'Table 'RAFAEL_SMALL_ECOH_BAK_X.SETTING_T' doesn't exist in engine' on query. Default database: 'RAFAEL_SMALL_ECOH_BAK_X'. Query: 'alter table SETTING_T import tablespace', Gtid 0-1-160400719, Internal MariaDB error code: 1932
      2017-03-29 11:38:19 140405862296320 [Warning] Slave: IO Read error: (2, No such file or directory) Error opening './RAFAEL_SMALL_ECOH_BAK_X/SETTING_T.cfg', will attempt to import without schema verification Error_code: 1810
      2017-03-29 11:38:19 140405862296320 [Warning] Slave: ALTER TABLE '"RAFAEL_SMALL_ECOH_BAK_X"."SETTING_T"' IMPORT TABLESPACE failed with error 44 : 'Tablespace not found' Error_code: 1816
      2017-03-29 11:38:19 140405862296320 [Warning] Slave: Table 'RAFAEL_SMALL_ECOH_BAK_X.SETTING_T' doesn't exist in engine Error_code: 1932
      2017-03-29 11:38:19 140405862296320 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'server1-bin.001326' position 472198041; GTID position '0-1-160400718'

      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

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              rgallastpsi Rafael Gallastegui
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.