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

Cannot exchange partition with archive table

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Won't Fix
    • 10.0.4
    • N/A
    • OTHER
    • None

    Description

      The following test fails with error "ERROR HY000: Tables have different definitions":

      --source include/have_partition.inc
      --source include/have_archive.inc
       
      CREATE TABLE t1(a INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=ARCHIVE PARTITION BY HASH (a) PARTITIONS 4;
      CREATE TABLE t2 LIKE t1;
      ALTER TABLE t2 REMOVE PARTITIONING;
      ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
      DROP TABLE t1,t2;

      While performing exchange partition we call mysql_compare_tables()/ha_archive::check_if_incompatible_data(). In MariaDB this function always return COMPATIBLE_DATA_NO.

      Covered by the following tests: parts.partition_mgm_lc1_archive parts.partition_exchange_archive parts.partition_mgm_lc0_archive rpl.rpl_partition_archive. Enable them when this bug is fixed.

      Attachments

        Issue Links

          Activity

            It's easy to fix ha_archive::check_if_incompatible_data():

            enum_alter_inplace_result check_if_supported_inplace_alter(TABLE *, Alter_inplace_info *);

            { return HA_ALTER_INPLACE_NOT_SUPPORTED; }

            bool check_if_incompatible_data(HA_CREATE_INFO *, uint)

            { return COMPATIBLE_DATA_YES; }

            this will make mysql_compare_tables() to work, while still disabling frm-only ALTER TABLE.

            But ALTER TABLE .. EXCHANGE PARTITION still won't work — it's conceptually incompatible with Archive engine. ALTER TABLE .. EXCHANGE PARTITION essentially swap ARZ file of the specified partition and the ARZ file of the specified table. Without touching frm files. Because Archive stores a copy of the frm in the ARZ file, they go out of sync, and the next time the table is opened, Archive will notice it. Other engines that do frm shipping could, perhaps, update the stored frm copy on rename. But Archive keeps frm in the header of the ARZ file, it would need to re-compress the complete ARZ file to replace the stored frm image.

            serg Sergei Golubchik added a comment - It's easy to fix ha_archive::check_if_incompatible_data(): enum_alter_inplace_result check_if_supported_inplace_alter(TABLE *, Alter_inplace_info *); { return HA_ALTER_INPLACE_NOT_SUPPORTED; } bool check_if_incompatible_data(HA_CREATE_INFO *, uint) { return COMPATIBLE_DATA_YES; } this will make mysql_compare_tables() to work, while still disabling frm-only ALTER TABLE. But ALTER TABLE .. EXCHANGE PARTITION still won't work — it's conceptually incompatible with Archive engine. ALTER TABLE .. EXCHANGE PARTITION essentially swap ARZ file of the specified partition and the ARZ file of the specified table. Without touching frm files. Because Archive stores a copy of the frm in the ARZ file, they go out of sync, and the next time the table is opened, Archive will notice it. Other engines that do frm shipping could, perhaps, update the stored frm copy on rename. But Archive keeps frm in the header of the ARZ file, it would need to re-compress the complete ARZ file to replace the stored frm image.

            A possible "solution" is to disable archive discovery (store no frm image in the ARZ file) when a table is created as a partition. Additionally ha_archive::rename_table() needs to detect the case when a table is renamed into a partition and delete (or bzero or mark unusable) the internally stored frm image.

            serg Sergei Golubchik added a comment - A possible "solution" is to disable archive discovery (store no frm image in the ARZ file) when a table is created as a partition. Additionally ha_archive::rename_table() needs to detect the case when a table is renamed into a partition and delete (or bzero or mark unusable) the internally stored frm image.

            10.0 was EOLed in March 2019

            serg Sergei Golubchik added a comment - 10.0 was EOLed in March 2019

            People

              serg Sergei Golubchik
              svoj Sergey Vojtovich
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.