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

Auto-create of SYSTEM_TIME history partitions checks the partition limit without existing partitions and subpartitions

    XMLWordPrintable

Details

    Description

      partition_info::vers_set_hist_part() (sql/partition_info.cc) counts the history partitions to auto-create for INTERVAL ... AUTO and stops with

      if (*create_count == MAX_PARTITIONS - 2)
      {
        my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(ME_WARNING));
        my_error(ER_VERS_HIST_PART_FAILED, ...);
        return true;
      }

      The limit compares only the number of new partitions with MAX_PARTITIONS - 2. It ignores the partitions the table already has and the number of subpartitions, so the real total ((num_parts + create_count) * num_subparts) can be well over MAX_PARTITIONS while this check passes. The early error is then not given, and the limit is left to whatever checks the actual partition creation does.

      MDEV-25529 adds vers_calc_hist_parts(), which sizes the layout at ALTER time with the correct limit ((n + 1) * num_subparts > MAX_PARTITIONS). The two should use one shared counting helper so that sizing at ALTER and auto-creation at DML agree.

      Present in 10.11 and later (auto-create since 10.9).

      Found during review of MDEV-25529 (https://github.com/MariaDB/server/pull/5294); the code predates that change.

      Attachments

        Issue Links

          Activity

            People

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