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

History modification inserts records into a wrong partition without warning

    XMLWordPrintable

Details

    Description

      If a record is inserted into a versioned partitioned table with row end outside existing history partitions, no warning is produced, and the record is inserted into the last history partition. If the table is auto-partitioned, no partition is created.

      When the same operation is performed via timestamp modification, a warning is thrown, or auto-partitions are created.

      --source include/have_partition.inc
       
      create table t (a int) with system versioning
      partition by system_time interval 1 day
      starts timestamp'2022-09-30 00:00:00' auto partitions 3;
       
      set system_versioning_insert_history=on;
      insert into t (a,row_start,row_end) values (1,'2022-09-30','2022-10-10');
       
      show create table t;
      select * from t partition (p1);
       
      # Cleanup
      drop table t;
      

      bb-10.11-MDEV-16546 2b1d324294

      insert into t (a,row_start,row_end) values (1,'2022-09-30','2022-10-10');
      show create table t;
      Table	Create Table
      t	CREATE TABLE `t` (
        `a` int(11) DEFAULT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
       PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'2022-09-30 00:00:00' AUTO
      PARTITIONS 3
      select * from t partition (p1);
      a
      1
      

      With timestamp modification instead of insert_history:

      --source include/have_partition.inc
       
      create table t (a int) with system versioning
      partition by system_time interval 1 day
      starts timestamp'2022-09-30 00:00:00' auto partitions 3;
       
      set @@timestamp= unix_timestamp('2022-09-30');
      insert into t values (1);
      set @@timestamp= unix_timestamp('2022-10-10');
      delete from t;
       
      show create table t;
      select * from t partition (p1);
      select * from t partition (p10);
       
      # Cleanup
      drop table t;
      

      show create table t;
      Table	Create Table
      t	CREATE TABLE `t` (
        `a` int(11) DEFAULT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
       PARTITION BY SYSTEM_TIME INTERVAL 1 DAY STARTS TIMESTAMP'2022-09-30 00:00:00' AUTO
      PARTITIONS 12
      select * from t partition (p1);
      a
      select * from t partition (p10);
      a
      1
      

      For "doesn't produce/produces a warning" part, the test cases can be adjusted by removing AUTO clause from the table description.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.