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

ALTER add default history partitions makes table inaccessible

    XMLWordPrintable

Details

    Description

      Reproduce

      --source include/have_partition.inc
      --source include/have_innodb.inc
       
      set default_storage_engine=innodb;
      create or replace table t1 (x int) with system versioning partition by system_time;
      alter table t1 add partition partitions 1;
      alter table t1 add partition partitions 1;
      alter table t1 add partition partitions 1;
      show create table t1;
       
      drop tables t1;
      

      Result

      mysqltest: At line 8: query 'alter table t1 add partition partitions 1' failed: 1932: Table 'test.t1' doesn't exist in engine
      

      Notes

      ADD default history partitions generates wrong partition name,
      f.ex. p2 instead of p1. Gap in sequence of partition names leads to
      ha_partition::open_read_partitions() fail on inexistent name.

      Manual fixing such broken table requires:

      1. create empty table by any name (t_new) with correct number of partitions;
      2. stop the server;
      3. rename data files (.myd, .myi or .ibd) of broken table to t_new fixing the partition sequence (#p2 to #p1, #p3 to #p2);
      4. start the server;
      5. drop the broken table;
      6. rename t_new to correct table name.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              midenok Aleksey Midenkov
              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.