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

CONVERT PARTITION: move out partition into a table

Details

    Description

      Moving a table out from a partitioned table is new quite cumbersome:
      ('archive' is here a partitioned table and 'p1' is a normal table)

      CREATE TABLE tp1 LIKE archive;
      ALTER TABLE tp1 REMOVE PARTITIONING;
      ALTER TABLE archive EXCHANGE PARTITION p1 WITH TABLE tp1;
      ALTER TABLE archive DROP PARTITION p1;

      Instead one should be able to do:

      ALTER TABLE archive CONVERT PARTITION p1 TO TABLE tp1;

      The operation crash safety must be protected by DDL logging.

      Attachments

        Issue Links

          Activity

            Should tp1 be locked under lock tables?

            LOCK TABLES t1 WRITE;
            ALTER TABLE t1 EXPORT PARTITION p1 AS TABLE tp1;
            SELECT * from tp1;
            Table 'tp1' was not locked with LOCK TABLES

            I think this is a good idea to lock tp1 as well otherwise there is no guarantee of data consistency between t1 and tp1.

            midenok Aleksey Midenkov added a comment - Should tp1 be locked under lock tables? LOCK TABLES t1 WRITE; ALTER TABLE t1 EXPORT PARTITION p1 AS TABLE tp1; SELECT * from tp1; Table 'tp1' was not locked with LOCK TABLES I think this is a good idea to lock tp1 as well otherwise there is no guarantee of data consistency between t1 and tp1.
            midenok Aleksey Midenkov added a comment - Please review bb-10.7-midenok-MDEV-22166

            818407474d6 is mostly ok. a couple of minor comments.

            I presume logging changes are reviewed and ok'ed by Monty

            serg Sergei Golubchik added a comment - 818407474d6 is mostly ok. a couple of minor comments. I presume logging changes are reviewed and ok'ed by Monty

            People

              midenok Aleksey Midenkov
              monty Michael Widenius
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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