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

DELETE HISTORY may delete current data on system-versioned table

Details

    Description

      MDEV-25467 is (tentatively) a documentation bug for DELETE HISTORY on active rows to be documented.
      However, the test case in MDEV-25467, on a non-partitioned table, at least appears to be deterministic, it always acts as described – active rows get "deleted", i.e. moved to history.

      It is not the case for partitioned tables. The same test case as in MDEV-25467, but on a partitioned table, produces non-deterministic results:

      --source include/have_innodb.inc
      --source include/have_partition.inc
       
      SET SESSION TIME_ZONE= '+00:00';
       
      CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB WITH SYSTEM VERSIONING PARTITION BY KEY() PARTITIONS 2;
      INSERT INTO t1 VALUES (1),(2);
       
      SELECT pk, row_end FROM t1;
      DELETE HISTORY FROM t1 BEFORE SYSTEM_TIME '2039-01-01';
      SELECT pk FROM t1;
      SELECT pk FROM t1 FOR SYSTEM_TIME ALL;
      DROP TABLE t1;
      

      10.3 7588049374

      MariaDB [test]> DELETE HISTORY FROM t1 BEFORE SYSTEM_TIME '2039-01-01';
      Query OK, 2 rows affected (0.003 sec)
       
      MariaDB [test]> SELECT pk FROM t1;
      Empty set (0.000 sec)
       
      MariaDB [test]> SELECT pk FROM t1 FOR SYSTEM_TIME ALL;
      +----+
      | pk |
      +----+
      |  1 |
      |  2 |
      +----+
      2 rows in set (0.000 sec)
      

      10.3 7588049374

      MariaDB [test]> DELETE HISTORY FROM t1 BEFORE SYSTEM_TIME '2039-01-01';
      Query OK, 4 rows affected (0.002 sec)
       
      MariaDB [test]> SELECT pk FROM t1;
      Empty set (0.000 sec)
       
      MariaDB [test]> SELECT pk FROM t1 FOR SYSTEM_TIME ALL;
      Empty set (0.000 sec)
      

      That is, sometimes it moves active rows to history, and sometimes drops them completely. And sometimes, although much less often, it moves one row to history but drops another one completely:

      MariaDB [test]> DELETE HISTORY FROM t1 BEFORE SYSTEM_TIME '2039-01-01';
      Query OK, 3 rows affected (0.008 sec)
       
      MariaDB [test]> SELECT pk FROM t1;
      Empty set (0.000 sec)
       
      MariaDB [test]> SELECT pk FROM t1 FOR SYSTEM_TIME ALL;
      +----+
      | pk |
      +----+
      |  1 |
      +----+
      1 row in set (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            Assignee Aleksey Midenkov [ midenok ]
            elenst Elena Stepanova made changes -
            Summary DELETE HISTORY behavior fror active rows on partitioned table is non-deterministic DELETE HISTORY behavior for active rows on partitioned table is non-deterministic
            marko Marko Mäkelä made changes -
            midenok Aleksey Midenkov made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            midenok Aleksey Midenkov made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            midenok Aleksey Midenkov made changes -
            Summary DELETE HISTORY behavior for active rows on partitioned table is non-deterministic DELETE HISTORY may delete current data on partitioned table
            midenok Aleksey Midenkov made changes -
            Summary DELETE HISTORY may delete current data on partitioned table DELETE HISTORY may delete current data on system-versioned table
            midenok Aleksey Midenkov made changes -
            Assignee Aleksey Midenkov [ midenok ] Oleksandr Byelkin [ sanja ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            sanja Oleksandr Byelkin made changes -
            Assignee Oleksandr Byelkin [ sanja ] Aleksey Midenkov [ midenok ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            midenok Aleksey Midenkov made changes -
            Assignee Aleksey Midenkov [ midenok ] Oleksandr Byelkin [ sanja ]
            Status Stalled [ 10000 ] In Review [ 10002 ]
            sanja Oleksandr Byelkin made changes -
            Assignee Oleksandr Byelkin [ sanja ] Aleksey Midenkov [ midenok ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            midenok Aleksey Midenkov made changes -
            Fix Version/s 10.3.29 [ 25206 ]
            Fix Version/s 10.4.19 [ 25205 ]
            Fix Version/s 10.5.10 [ 25204 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 121208 ] MariaDB v4 [ 159172 ]

            People

              midenok Aleksey Midenkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.