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

Warning on full history partition is delayed until next DML statement

Details

    Description

      Reproduce

      create or replace table t1 (x int) with system versioning partition by system_time limit 1;
      insert into t1 values (0), (1), (2), (3);
      delete from t1;
      

      Result

      No warning printed.

      Expected

      +---------+------+----------------------------------------------------------------------------------------------------------+
      | Level   | Code | Message                                                                                                  |
      +---------+------+----------------------------------------------------------------------------------------------------------+
      | Warning | 4114 | Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of LIMIT, need more HISTORY partitions |
      +---------+------+----------------------------------------------------------------------------------------------------------+
      

      Variation

      This variation displays warning on second DELETE:

      create or replace table t1 (x int) with system versioning partition by system_time limit 1;
      insert into t1 values (0), (1), (2), (3);
      delete from t1 where x < 3;
      delete from t1;
      

      Additional problem: LIMIT allows on more extra record unexpectedly

      Reproduce

      -- source include/have_partition.inc
      -- source include/have_sequence.inc
       
      create table t1 (x int) engine=myisam  with system versioning
      partition by system_time limit 100 (
        partition p0 history,
        partition p1 history,
        partition pn current);
       
      insert into t1 select seq from seq_0_to_200;
       
      delete from t1 where x <= 99;
      show warnings;
      delete from t1 where x <= 100;
      show warnings;
      delete from t1;
      show warnings;
      select count(*) from t1 partition (p0);
      select count(*) from t1 partition (p1);
      drop table t1;
      

      Result

      Partition p0 is filled with 101 records. No warning printed.

      delete from t1 where x <= 99;
      show warnings;
      Level   Code    Message
      delete from t1 where x <= 100;
      show warnings;
      Level   Code    Message
      delete from t1;
      show warnings;
      Level   Code    Message
      select count(*) from t1 partition (p0);
      count(*)
      101
      select count(*) from t1 partition (p1);
      count(*)
      100
      

      Expected

      Partition p0 is filled is filled with 100 records. Warning is printed when p1 is filled with 101 records.

      delete from t1 where x <= 99;
      show warnings;
      Level   Code    Message
      delete from t1 where x <= 100;
      show warnings;
      Level   Code    Message
      delete from t1;
      show warnings;
      Level   Code    Message
      Warning 4114    Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
      select count(*) from t1 partition (p0);
      count(*)
      100
      select count(*) from t1 partition (p1);
      count(*)
      101
      

      Attachments

        Issue Links

          Activity

            midenok Aleksey Midenkov created issue -
            midenok Aleksey Midenkov made changes -
            Field Original Value New Value
            midenok Aleksey Midenkov made changes -
            midenok Aleksey Midenkov made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 98264 ] MariaDB v4 [ 141407 ]
            midenok Aleksey Midenkov made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            midenok Aleksey Midenkov made changes -
            Priority Minor [ 4 ] Major [ 3 ]
            midenok Aleksey Midenkov made changes -
            Description h3. Reproduce
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1;
            {code}
            h3. Result
            No warning printed.
            h3. Expected
            {code}
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Level | Code | Message |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Warning | 4114 | Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of LIMIT, need more HISTORY partitions |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            {code}
            h3. Variation
            This variation displays warning on second DELETE:
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1 where x < 3;
            delete from t1;
            {code}
            h3. Reproduce
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1;
            {code}
            h3. Result
            No warning printed.
            h3. Expected
            {code}
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Level | Code | Message |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Warning | 4114 | Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of LIMIT, need more HISTORY partitions |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            {code}
            h3. Variation
            This variation displays warning on second DELETE:
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1 where x < 3;
            delete from t1;
            {code}

            h2. Additional problem: LIMIT allows on more extra record unexpectedly.
            h3. Reproduce
            {code:sql}
            -- source include/have_partition.inc
            -- source include/have_sequence.inc

            create table t1 (x int) engine=myisam with system versioning
            partition by system_time limit 100 (
              partition p0 history,
              partition p1 history,
              partition pn current);

            insert into t1 select seq from seq_0_to_200;

            delete from t1 where x <= 99;
            show warnings;
            delete from t1 where x <= 100;
            show warnings;
            delete from t1;
            show warnings;
            select count(*) from t1 partition (p0);
            select count(*) from t1 partition (p1);
            drop table t1;
            {code}
            h3. Expected
            {code:sql}
            delete from t1 where x <= 99;
            show warnings;
            Level Code Message
            delete from t1 where x <= 100;
            show warnings;
            Level Code Message
            delete from t1;
            show warnings;
            Level Code Message
            Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
            select count(*) from t1 partition (p0);
            count(*)
            100
            select count(*) from t1 partition (p1);
            count(*)
            101
            {code}
            midenok Aleksey Midenkov made changes -
            Description h3. Reproduce
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1;
            {code}
            h3. Result
            No warning printed.
            h3. Expected
            {code}
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Level | Code | Message |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Warning | 4114 | Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of LIMIT, need more HISTORY partitions |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            {code}
            h3. Variation
            This variation displays warning on second DELETE:
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1 where x < 3;
            delete from t1;
            {code}

            h2. Additional problem: LIMIT allows on more extra record unexpectedly.
            h3. Reproduce
            {code:sql}
            -- source include/have_partition.inc
            -- source include/have_sequence.inc

            create table t1 (x int) engine=myisam with system versioning
            partition by system_time limit 100 (
              partition p0 history,
              partition p1 history,
              partition pn current);

            insert into t1 select seq from seq_0_to_200;

            delete from t1 where x <= 99;
            show warnings;
            delete from t1 where x <= 100;
            show warnings;
            delete from t1;
            show warnings;
            select count(*) from t1 partition (p0);
            select count(*) from t1 partition (p1);
            drop table t1;
            {code}
            h3. Expected
            {code:sql}
            delete from t1 where x <= 99;
            show warnings;
            Level Code Message
            delete from t1 where x <= 100;
            show warnings;
            Level Code Message
            delete from t1;
            show warnings;
            Level Code Message
            Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
            select count(*) from t1 partition (p0);
            count(*)
            100
            select count(*) from t1 partition (p1);
            count(*)
            101
            {code}
            h3. Reproduce
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1;
            {code}
            h3. Result
            No warning printed.
            h3. Expected
            {code}
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Level | Code | Message |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Warning | 4114 | Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of LIMIT, need more HISTORY partitions |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            {code}
            h3. Variation
            This variation displays warning on second DELETE:
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1 where x < 3;
            delete from t1;
            {code}

            h2. Additional problem: LIMIT allows on more extra record unexpectedly.
            h3. Reproduce
            {code:sql}
            -- source include/have_partition.inc
            -- source include/have_sequence.inc

            create table t1 (x int) engine=myisam with system versioning
            partition by system_time limit 100 (
              partition p0 history,
              partition p1 history,
              partition pn current);

            insert into t1 select seq from seq_0_to_200;

            delete from t1 where x <= 99;
            show warnings;
            delete from t1 where x <= 100;
            show warnings;
            delete from t1;
            show warnings;
            select count(*) from t1 partition (p0);
            select count(*) from t1 partition (p1);
            drop table t1;
            {code}
            h3. Result
            {code:sql}
            delete from t1 where x <= 99;
            show warnings;
            Level Code Message
            delete from t1 where x <= 100;
            show warnings;
            Level Code Message
            delete from t1;
            show warnings;
            Level Code Message
            select count(*) from t1 partition (p0);
            count(*)
            101
            select count(*) from t1 partition (p1);
            count(*)
            100
            {code}
            h3. Expected
            {code:sql}
            delete from t1 where x <= 99;
            show warnings;
            Level Code Message
            delete from t1 where x <= 100;
            show warnings;
            Level Code Message
            delete from t1;
            show warnings;
            Level Code Message
            Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
            select count(*) from t1 partition (p0);
            count(*)
            100
            select count(*) from t1 partition (p1);
            count(*)
            101
            {code}
            midenok Aleksey Midenkov made changes -
            Description h3. Reproduce
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1;
            {code}
            h3. Result
            No warning printed.
            h3. Expected
            {code}
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Level | Code | Message |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Warning | 4114 | Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of LIMIT, need more HISTORY partitions |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            {code}
            h3. Variation
            This variation displays warning on second DELETE:
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1 where x < 3;
            delete from t1;
            {code}

            h2. Additional problem: LIMIT allows on more extra record unexpectedly.
            h3. Reproduce
            {code:sql}
            -- source include/have_partition.inc
            -- source include/have_sequence.inc

            create table t1 (x int) engine=myisam with system versioning
            partition by system_time limit 100 (
              partition p0 history,
              partition p1 history,
              partition pn current);

            insert into t1 select seq from seq_0_to_200;

            delete from t1 where x <= 99;
            show warnings;
            delete from t1 where x <= 100;
            show warnings;
            delete from t1;
            show warnings;
            select count(*) from t1 partition (p0);
            select count(*) from t1 partition (p1);
            drop table t1;
            {code}
            h3. Result
            {code:sql}
            delete from t1 where x <= 99;
            show warnings;
            Level Code Message
            delete from t1 where x <= 100;
            show warnings;
            Level Code Message
            delete from t1;
            show warnings;
            Level Code Message
            select count(*) from t1 partition (p0);
            count(*)
            101
            select count(*) from t1 partition (p1);
            count(*)
            100
            {code}
            h3. Expected
            {code:sql}
            delete from t1 where x <= 99;
            show warnings;
            Level Code Message
            delete from t1 where x <= 100;
            show warnings;
            Level Code Message
            delete from t1;
            show warnings;
            Level Code Message
            Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
            select count(*) from t1 partition (p0);
            count(*)
            100
            select count(*) from t1 partition (p1);
            count(*)
            101
            {code}
            h3. Reproduce
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1;
            {code}
            h3. Result
            No warning printed.
            h3. Expected
            {code}
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Level | Code | Message |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Warning | 4114 | Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of LIMIT, need more HISTORY partitions |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            {code}
            h3. Variation
            This variation displays warning on second DELETE:
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1 where x < 3;
            delete from t1;
            {code}

            h2. Additional problem: LIMIT allows on more extra record unexpectedly
            h3. Reproduce
            {code:sql}
            -- source include/have_partition.inc
            -- source include/have_sequence.inc

            create table t1 (x int) engine=myisam with system versioning
            partition by system_time limit 100 (
              partition p0 history,
              partition p1 history,
              partition pn current);

            insert into t1 select seq from seq_0_to_200;

            delete from t1 where x <= 99;
            show warnings;
            delete from t1 where x <= 100;
            show warnings;
            delete from t1;
            show warnings;
            select count(*) from t1 partition (p0);
            select count(*) from t1 partition (p1);
            drop table t1;
            {code}
            h3. Result
            {code:sql}
            delete from t1 where x <= 99;
            show warnings;
            Level Code Message
            delete from t1 where x <= 100;
            show warnings;
            Level Code Message
            delete from t1;
            show warnings;
            Level Code Message
            select count(*) from t1 partition (p0);
            count(*)
            101
            select count(*) from t1 partition (p1);
            count(*)
            100
            {code}
            h3. Expected
            {code:sql}
            delete from t1 where x <= 99;
            show warnings;
            Level Code Message
            delete from t1 where x <= 100;
            show warnings;
            Level Code Message
            delete from t1;
            show warnings;
            Level Code Message
            Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
            select count(*) from t1 partition (p0);
            count(*)
            100
            select count(*) from t1 partition (p1);
            count(*)
            101
            {code}
            midenok Aleksey Midenkov made changes -
            Description h3. Reproduce
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1;
            {code}
            h3. Result
            No warning printed.
            h3. Expected
            {code}
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Level | Code | Message |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Warning | 4114 | Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of LIMIT, need more HISTORY partitions |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            {code}
            h3. Variation
            This variation displays warning on second DELETE:
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1 where x < 3;
            delete from t1;
            {code}

            h2. Additional problem: LIMIT allows on more extra record unexpectedly
            h3. Reproduce
            {code:sql}
            -- source include/have_partition.inc
            -- source include/have_sequence.inc

            create table t1 (x int) engine=myisam with system versioning
            partition by system_time limit 100 (
              partition p0 history,
              partition p1 history,
              partition pn current);

            insert into t1 select seq from seq_0_to_200;

            delete from t1 where x <= 99;
            show warnings;
            delete from t1 where x <= 100;
            show warnings;
            delete from t1;
            show warnings;
            select count(*) from t1 partition (p0);
            select count(*) from t1 partition (p1);
            drop table t1;
            {code}
            h3. Result
            {code:sql}
            delete from t1 where x <= 99;
            show warnings;
            Level Code Message
            delete from t1 where x <= 100;
            show warnings;
            Level Code Message
            delete from t1;
            show warnings;
            Level Code Message
            select count(*) from t1 partition (p0);
            count(*)
            101
            select count(*) from t1 partition (p1);
            count(*)
            100
            {code}
            h3. Expected
            {code:sql}
            delete from t1 where x <= 99;
            show warnings;
            Level Code Message
            delete from t1 where x <= 100;
            show warnings;
            Level Code Message
            delete from t1;
            show warnings;
            Level Code Message
            Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
            select count(*) from t1 partition (p0);
            count(*)
            100
            select count(*) from t1 partition (p1);
            count(*)
            101
            {code}
            h3. Reproduce
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1;
            {code}
            h3. Result
            No warning printed.
            h3. Expected
            {code}
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Level | Code | Message |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            | Warning | 4114 | Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of LIMIT, need more HISTORY partitions |
            +---------+------+----------------------------------------------------------------------------------------------------------+
            {code}
            h3. Variation
            This variation displays warning on second DELETE:
            {code:sql}
            create or replace table t1 (x int) with system versioning partition by system_time limit 1;
            insert into t1 values (0), (1), (2), (3);
            delete from t1 where x < 3;
            delete from t1;
            {code}

            h2. Additional problem: LIMIT allows on more extra record unexpectedly
            h3. Reproduce
            {code:sql}
            -- source include/have_partition.inc
            -- source include/have_sequence.inc

            create table t1 (x int) engine=myisam with system versioning
            partition by system_time limit 100 (
              partition p0 history,
              partition p1 history,
              partition pn current);

            insert into t1 select seq from seq_0_to_200;

            delete from t1 where x <= 99;
            show warnings;
            delete from t1 where x <= 100;
            show warnings;
            delete from t1;
            show warnings;
            select count(*) from t1 partition (p0);
            select count(*) from t1 partition (p1);
            drop table t1;
            {code}

            h3. Result
            Partition p0 is filled with 101 records. No warning printed.
            {code:sql}
            delete from t1 where x <= 99;
            show warnings;
            Level Code Message
            delete from t1 where x <= 100;
            show warnings;
            Level Code Message
            delete from t1;
            show warnings;
            Level Code Message
            select count(*) from t1 partition (p0);
            count(*)
            101
            select count(*) from t1 partition (p1);
            count(*)
            100
            {code}

            h3. Expected
            Partition p0 is filled is filled with 100 records. Warning is printed when p1 is filled with 101 records.
            {code:sql}
            delete from t1 where x <= 99;
            show warnings;
            Level Code Message
            delete from t1 where x <= 100;
            show warnings;
            Level Code Message
            delete from t1;
            show warnings;
            Level Code Message
            Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
            select count(*) from t1 partition (p0);
            count(*)
            100
            select count(*) from t1 partition (p1);
            count(*)
            101
            {code}
            midenok Aleksey Midenkov made changes -
            Assignee Aleksey Midenkov [ midenok ] Nikita Malyavin [ nikitamalyavin ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            midenok Aleksey Midenkov made changes -
            midenok Aleksey Midenkov made changes -
            nikitamalyavin Nikita Malyavin made changes -
            Assignee Nikita Malyavin [ nikitamalyavin ] Aleksey Midenkov [ midenok ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            midenok Aleksey Midenkov made changes -
            Fix Version/s 10.3.35 [ 27512 ]
            Fix Version/s 10.4.25 [ 27510 ]
            Fix Version/s 10.5.16 [ 27508 ]
            Fix Version/s 10.6.8 [ 27506 ]
            Fix Version/s 10.7.4 [ 27504 ]
            Fix Version/s 10.8.3 [ 27502 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]

            People

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