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

Implement support for ALTER TABLE ... {DISCARD|IMPORT} PARTITION

Details

    Description

      MySQL 5.7 supports ALTER TABLE ... {DISCARD|IMPORT} PARTITION. The documentation explains how to use it here:

      https://dev.mysql.com/doc/refman/5.7/en/innodb-transportable-tablespace-examples.html
      UPDATE: The above page does not exist anymore, page
      https://dev.mysql.com/doc/refman/8.0/en/innodb-table-import.html explains it, too

      Should MariaDB also support that?

      Attachments

        Issue Links

          Activity

            GeoffMontee Geoff Montee (Inactive) created issue -

            What is the alternative to move partitioning if this is not implemented?
            Remove partitions in the source and then recreate them once it has been moved over?

            marostegui Manuel Arostegui added a comment - What is the alternative to move partitioning if this is not implemented? Remove partitions in the source and then recreate them once it has been moved over?

            marostegui,

            You can import/export partitions without this feature using a workaround, but it can be a little tedious. I wrote a blog post about how to do so here:

            http://www.geoffmontee.com/importing-innodb-partitions-in-mysql-5-6-and-mariadb-10-010-1/

            GeoffMontee Geoff Montee (Inactive) added a comment - marostegui , You can import/export partitions without this feature using a workaround, but it can be a little tedious. I wrote a blog post about how to do so here: http://www.geoffmontee.com/importing-innodb-partitions-in-mysql-5-6-and-mariadb-10-010-1/
            serg Sergei Golubchik made changes -
            Field Original Value New Value
            Fix Version/s 10.3 [ 22126 ]
            marostegui Manuel Arostegui added a comment - - edited

            Thanks for the link. I have tried it but I am getting lots of

            Column type mismatch
            

            The columns are obviously the same and forcing a rebuild doesn't help anyways.

            On varchar columns, and I am importing between exactly the same server versions 10.1.19
            So for the moment the only solution I have found is removing the partitions, doing the transfer and creating them again. Not ideal, but...

            marostegui Manuel Arostegui added a comment - - edited Thanks for the link. I have tried it but I am getting lots of Column type mismatch The columns are obviously the same and forcing a rebuild doesn't help anyways. On varchar columns, and I am importing between exactly the same server versions 10.1.19 So for the moment the only solution I have found is removing the partitions, doing the transfer and creating them again. Not ideal, but...

            marostegui,

            That's a pretty strange error to see if the columns really are exactly the same. Since these are varchar columns, do you know if the character encoding is the same on both servers?

            If you want help tracking down the problem, feel free to post on the maria-discuss mailing list.

            https://launchpad.net/~maria-discuss

            GeoffMontee Geoff Montee (Inactive) added a comment - marostegui , That's a pretty strange error to see if the columns really are exactly the same. Since these are varchar columns, do you know if the character encoding is the same on both servers? If you want help tracking down the problem, feel free to post on the maria-discuss mailing list. https://launchpad.net/~maria-discuss
            serg Sergei Golubchik made changes -
            Description MySQL 5.7 supports ALTER TABLE ... {DISCARD|IMPORT} PARTITION. The documentation explains how to use it here:

            https://dev.mysql.com/doc/refman/5.7/en/innodb-transportable-tablespace-examples.html

            Should MariaDB also support that?
            MySQL 5.7 supports {{ALTER TABLE ... \{DISCARD|IMPORT} PARTITION}}. The documentation explains how to use it here:

            https://dev.mysql.com/doc/refman/5.7/en/innodb-transportable-tablespace-examples.html

            Should MariaDB also support that?
            stever Steve Ruby added a comment -

            A slightly different take on this the change in MySQL 5.7 also allows not just ALTER TABLE <table> DISCARD PARTITION <partitions> TABLESPACE for specific partitions. But seems to fix DISCARD TABLESPACE applied to the whole table as well which returns an error in Mariadb (10.2.6). Can we get that fix/improvement as well?

            stever Steve Ruby added a comment - A slightly different take on this the change in MySQL 5.7 also allows not just ALTER TABLE <table> DISCARD PARTITION <partitions> TABLESPACE for specific partitions. But seems to fix DISCARD TABLESPACE applied to the whole table as well which returns an error in Mariadb (10.2.6). Can we get that fix/improvement as well?
            serg Sergei Golubchik made changes -
            Fix Version/s 10.3 [ 22126 ]
            GeoffMontee Geoff Montee (Inactive) made changes -
            GeoffMontee Geoff Montee (Inactive) made changes -
            GeoffMontee Geoff Montee (Inactive) made changes -

            Maybe we should split this into two tickets, one for DISCARD/IMPORT support for partitioned tables in general, and one for being able to DISCARD/IMPORT specific partitions only?

            hholzgra Hartmut Holzgraefe added a comment - Maybe we should split this into two tickets, one for DISCARD/IMPORT support for partitioned tables in general, and one for being able to DISCARD/IMPORT specific partitions only?
            ralf.gebhardt Ralf Gebhardt made changes -
            Epic/Theme Improvements_Partitioning
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 76670 ] MariaDB v4 [ 130515 ]
            julien.fritsch Julien Fritsch made changes -
            Assignee Ralf Gebhardt [ ralf.gebhardt@mariadb.com ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Description MySQL 5.7 supports {{ALTER TABLE ... \{DISCARD|IMPORT} PARTITION}}. The documentation explains how to use it here:

            https://dev.mysql.com/doc/refman/5.7/en/innodb-transportable-tablespace-examples.html

            Should MariaDB also support that?
            MySQL 5.7 supports {{ALTER TABLE ... \{DISCARD|IMPORT} PARTITION}}. The documentation explains how to use it here:

            https://dev.mysql.com/doc/refman/5.7/en/innodb-transportable-tablespace-examples.html
            UPDATE: The above page does not exist anymore, page
            https://dev.mysql.com/doc/refman/8.0/en/innodb-table-import.html explains it, too

            Should MariaDB also support that?
            ralf.gebhardt Ralf Gebhardt made changes -
            Assignee Ralf Gebhardt [ ralf.gebhardt@mariadb.com ] Marko Mäkelä [ marko ]

            I see that there is a feature

            ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t1p0;
            

            I do not know if it is a viable work-around, but I would think using this syntax, you could export or import partitions as individual tables.

            From the InnoDB point of view, each partition or subpartition that stores data is a normal table that uses a funny name.

            MDEV-26137 made the step ALTER TABLE…DISCARD TABLESPACE optional.

            marko Marko Mäkelä added a comment - I see that there is a feature ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t1p0; I do not know if it is a viable work-around, but I would think using this syntax, you could export or import partitions as individual tables. From the InnoDB point of view, each partition or subpartition that stores data is a normal table that uses a funny name. MDEV-26137 made the step ALTER TABLE…DISCARD TABLESPACE optional.
            marko Marko Mäkelä made changes -

            In MDEV-13626, I came across the MySQL 5.7 tests innodb.innodb-import-partition-rpl and innodb.innodb-import-partition. The latter was originally added in the implementation of MySQL WL#6867.

            marko Marko Mäkelä added a comment - In MDEV-13626 , I came across the MySQL 5.7 tests innodb.innodb-import-partition-rpl and innodb.innodb-import-partition . The latter was originally added in the implementation of MySQL WL#6867 .
            marko Marko Mäkelä made changes -
            julien.fritsch Julien Fritsch made changes -
            Issue Type Task [ 3 ] New Feature [ 2 ]
            alice Alice Sherepa made changes -
            mariadb-jira-automation Jira Automation (IT) made changes -
            Zendesk Related Tickets 201599 198878 115300
            Zendesk active tickets 201599

            People

              marko Marko Mäkelä
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              12 Vote for this issue
              Watchers:
              16 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.