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

Order of setting query timestamp breaks partition rotation

    XMLWordPrintable

    Details

      Description

      These two cases lead to different results:

      1. Good: record 5 is rotated

      create or replace table t1 (i int) with system versioning
      partition by system_time interval 1 day
      (partition p0 history, partition pn current);
       
      set timestamp= unix_timestamp('2021-01-06 00:00:00');
      insert t1 values (6); delete from t1;
      set timestamp= unix_timestamp('2021-01-10 00:00:00');
      insert t1 values (5); delete from t1;
       
      alter table t1 add partition (partition p1 history);
      select *, row_end from t1 partition (p1);
      

      2. Bad: record 5 is not rotated

      create or replace table t1 (i int) with system versioning
      partition by system_time interval 1 day
      (partition p0 history, partition pn current);
       
      set timestamp= unix_timestamp('2021-01-10 00:00:00');
      insert t1 values (5); delete from t1;
      set timestamp= unix_timestamp('2021-01-06 00:00:00');
      insert t1 values (6); delete from t1;
       
      alter table t1 add partition (partition p1 history);
      select *, row_end from t1 partition (p1);
      

      While case 1. works correctly, case 2. leads to record 5 still be in p0. Note that case 2. produces no warning when record 6 is inserted.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              midenok Aleksey Midenkov
              Reporter:
              midenok Aleksey Midenkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: