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

Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT

    XMLWordPrintable

    Details

      Description

      Syntax change

      Keyword AUTO_INCREMENT (or AUTO) enables partition auto-creation.

      create or replace table t1 (x int) with system versioning
      partition by system_time interval 1 hour auto_increment;
       
      create or replace table t1 (x int) with system versioning
      partition by system_time limit 1000 auto_increment;
      

      Or with explicit partitions:

      create or replace table t1 (x int) with system versioning
      partition by system_time interval 1 hour auto
      (partition p0 history, partition pn current);
      

      Description

      When there are VERS_MIN_EMPTY empty partitions left, auto-create N new
      empty partitions.

      This scheme must not allow partition
      overflow. I.e. VERS_MIN_EMPTY-fill time must not exceed N-creation
      time. This means that low values for INTERVAL and LIMIT must not be
      allowed for auto-creation. In case when overflow is detected there is
      no need to do anything special: a warning is issued and the user must
      run manual rebuild to redistribute records correctly. This is
      important because automatic creation of partition is fast, without
      forced rebuild by the reason of performance. Auto-creation is
      implemented by fast_alter_partition_table() call from the thread of
      the main DML command.

      Current revision implements hard-coded values of 1 for VERS_MIN_EMPTY
      and N. As well as auto-creation threshold VERS_MIN_INTERVAL = 1 hour,
      VERS_MIN_LIMIT = 1000.

      The name for newly added partition is chosen as "pX" where X is
      partition number and "p" is hard-coded name prefix. If this name is
      already occupied the X is incremented until the resulting name is free
      to use.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              midenok Aleksey Midenkov
              Reporter:
              umoser Ulrich Moser
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: