Skip to content

MDEV-40915 Table options (PAGE_COMPRESSED, ENCRYPTED) are ignored by ALTER TABLE on partitioned tables - #5621

Merged
Thirunarayanan merged 1 commit into
12.3from
MDEV-40915
Sep 1, 2026
Merged

MDEV-40915 Table options (PAGE_COMPRESSED, ENCRYPTED) are ignored by ALTER TABLE on partitioned tables#5621
Thirunarayanan merged 1 commit into
12.3from
MDEV-40915

Conversation

@Thirunarayanan

Copy link
Copy Markdown
Member

Problem:

ha_partition::check_if_supported_inplace_alter() sourced the per-partition engine options from m_part_info, which describes the table as it is now. The engine compares
create_info->option_struct against handler::option_struct (old options), both are pointing to source table.
It leads to make the engine believe that there is no change in table structure and allows to proceed PAGE_COMPRESSED=1 with INSTANT algorithm.

Fix:

Take the new options from altered_table->part_info, which was opened from the new .frm with the new table-level options already merged into every partition_element by parse_engine_part_options().

Do the same in prepare_inplace_alter_table(), so that both phases agree and a per-partition option override reaches the rebuilt table.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes partitioned ALTER TABLE operations so storage engines receive updated per-partition options.

Changes:

  • Sources options from the altered table definition.
  • Propagates options during prepare.
  • Adds PAGE_COMPRESSED regression coverage.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
sql/ha_partition.cc Uses new per-partition options during ALTER phases.
mysql-test/suite/parts/t/partition_alter_innodb.test Adds regression test.
mysql-test/suite/parts/r/partition_alter_innodb.result Records expected output.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread sql/ha_partition.cc Outdated
Comment on lines +44 to +45
ALTER TABLE t1 PAGE_COMPRESSED=1;
SHOW CREATE TABLE t1;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed it

…ALTER TABLE on partitioned tables

Problem:
=========
ha_partition::check_if_supported_inplace_alter() sourced the
per-partition engine options from m_part_info, which describes
the table as it is now. The engine compares
create_info->option_struct against handler::option_struct
(old options), both are pointing to source table.
It leads to make the engine believe that there is no change
in table structure and allows to proceed PAGE_COMPRESSED=1
with INSTANT algorithm.

Fix:
====
Take the new options from altered_table->part_info, which was opened
from the new .frm with the new table-level options already merged
into every partition_element by parse_engine_part_options().

Do the same in prepare_inplace_alter_table(), so that both phases
agree and a per-partition option override reaches the rebuilt table.
@Thirunarayanan
Thirunarayanan merged commit e19ed7e into 12.3 Sep 1, 2026
16 of 19 checks passed
@Thirunarayanan
Thirunarayanan deleted the MDEV-40915 branch September 1, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants