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

CHECK TABLE does not recognize corruption after EXCHANGE WITHOUT VALIDATION on system-time partitioning

    XMLWordPrintable

Details

    Description

      For a table with partitioning by system time of the limit kind, when a history partition gets rows with the current system time (via EXCHANGE .. WITHOUT VALIDATION), CHECK TABLE does not recognize the problem, and thus REPAIR doesn't fix it, current rows stay in the history partition and remain invisible.

      --source include/have_partition.inc
       
      create or replace table t1 (a int) with system versioning
      partition by system_time limit 100 (p0 history, pn current);
      insert into t1 (a) values (1),(2);
       
      create or replace table t2 (a int) with system versioning;
      insert into t2 (a) values (3),(4);
       
      --error ER_ROW_DOES_NOT_MATCH_PARTITION
      alter table t1 exchange partition p0 with table t2;
      --error ER_ROW_DOES_NOT_MATCH_PARTITION
      alter table t1 exchange partition p0 with table t2 with validation;
      alter table t1 exchange partition p0 with table t2 without validation;
       
      check table t1 extended;
      repair table t1;
      alter table t1 repair partition p0;
       
      select a, row_start, row_end from t1;
      select a, row_start, row_end from t1 for system_time all;
       
      # Cleanup
      drop table t1, t2;
      

      11.4 5462b61b0c3ae59d3996018d7da34220460baf46

      alter table t1 exchange partition p0 with table t2 without validation;
      check table t1 extended;
      Table	Op	Msg_type	Msg_text
      test.t1	check	status	OK
      repair table t1;
      Table	Op	Msg_type	Msg_text
      test.t1	repair	status	OK
      alter table t1 repair partition p0;
      Table	Op	Msg_type	Msg_text
      test.t1	repair	status	OK
      select a, row_start, row_end from t1;
      a	row_start	row_end
      1	2023-12-27 02:54:10.844545	2038-01-19 05:14:07.999999
      2	2023-12-27 02:54:10.844545	2038-01-19 05:14:07.999999
      select a, row_start, row_end from t1 for system_time all;
      a	row_start	row_end
      3	2023-12-27 02:54:10.882805	2038-01-19 05:14:07.999999
      4	2023-12-27 02:54:10.882805	2038-01-19 05:14:07.999999
      1	2023-12-27 02:54:10.844545	2038-01-19 05:14:07.999999
      2	2023-12-27 02:54:10.844545	2038-01-19 05:14:07.999999
      

      alter table t1 rebuild partition p0 is not included in the above test case, as it causes the error on a non-debug build

      'alter table t1 rebuild partition p0' failed: ER_OPEN_AS_READONLY (1036): Table './test/t1.MYI' is read only
      

      and an assertion failure similar to MDEV-20498 on a debug build (but with MyISAM).
      I suppose anything can be expected since the table is already invalid, thus this report is not about errors which REBUILD produces, but about not being able to repair the table.

      Attachments

        Issue Links

          Activity

            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.