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

Historical row with row_end = 2038-01-19 03:14:07.999999 is stored in the CURRENT partition of a SYSTEM_TIME partitioned table

    XMLWordPrintable

Details

    Description

      row_end equal to 2038-01-19 03:14:07.999999 is also the pre-11.5 marker for current rows, so is_max() takes a real history row for a current one. The row goes to the current partition instead of a history partition. Queries return the right rows and CHECK TABLE is OK; the row is just in the wrong partition. Code that looks for history with is_max() (for example ALTER ... INTERVAL ... AUTO from MDEV-25529) does not see it.

      Not reproducible on 10.11 and 11.4: set timestamp truncates the fractional part there (warning 1292), so row_end never equals the marker.

      --source include/have_innodb.inc
      --source include/have_partition.inc
      create table t1 (a int) engine=innodb with system versioning
        partition by system_time interval 1 year starts '2037-01-01 00:00:00'
        (partition p0 history, partition p1 history, partition pn current);
      set timestamp=unix_timestamp('2037-06-01 00:00:00');
      insert into t1 values (1);
      set timestamp=2147483647.999999;
      delete from t1;
      --echo # BUG if the row is in pn
      select partition_name, table_rows from information_schema.partitions where table_name='t1';
      drop table t1;
       
      --echo # control: one microsecond earlier goes to p1
      create table t1 (a int) engine=innodb with system versioning
        partition by system_time interval 1 year starts '2037-01-01 00:00:00'
        (partition p0 history, partition p1 history, partition pn current);
      set timestamp=unix_timestamp('2037-06-01 00:00:00');
      insert into t1 values (1);
      set timestamp=2147483647.999998;
      delete from t1;
      select partition_name, table_rows from information_schema.partitions where table_name='t1';
      drop table t1;

      11.8.10-MariaDB-asan-debug source revision: 118b60144d9a02ba7c035e882388b3965ef39d3c
      # BUG if the row is in pn
      select partition_name, table_rows from information_schema.partitions where table_name='t1';
      partition_name	table_rows
      p0	0
      p1	0
      pn	1
      # control: one microsecond earlier goes to p1
      select partition_name, table_rows from information_schema.partitions where table_name='t1';
      partition_name	table_rows
      p0	0
      p1	1
      pn	0

      Attachments

        Issue Links

          Activity

            People

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