[MDEV-27605] ALTER .. ADD PARTITION uses wrong partition-level option values Created: 2022-01-25 Updated: 2022-03-01 Resolved: 2022-03-01 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Partitioning |
| Affects Version/s: | 10.8 |
| Fix Version/s: | 10.8.3 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Nayuta Yanagisawa (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
When a partition with partition-level options is added by ALTER, it shows the correct definition in SHOW CREATE, but the actual values get inherited from the previous partition. The test will be using PAGE_COMPRESSED as an example. I have no information whether the problem affects other options. Since I don't have the flag decoder handy, let's create a dictionary first.
So, these are the expected flag values.
So far so good. Now let's create the same structure but in steps.
Not so good. When the "compressed-level-3" partition is added, the previous "compressed" partition is recalculated/rebuilt to use its correct flag, but the new one is added with a wrong one – again, with the one from the previous partition. SHOW CREATE TABLE shows the intended values though.
|
| Comments |
| Comment by Nayuta Yanagisawa (Inactive) [ 2022-01-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
I confirmed the issue. Thank you very much for your detailed description. elenst | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2022-01-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
From the viewpoint of Spider, this is a serious bug because this could result in data corruption. Thus, I raised the priority. | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2022-01-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
parse_engine_part_options() gets partition options from TABLE_SHARE. In the case of ALTER TABLEs, TABLE_SHARE seems to hold the partition information which is based on the table schema before ALTERs. This seems to be (at least part of) the cause of the bug. | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2022-01-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
The complete part_info, which represents the partition structure after ALTER, is built by prep_alter_part_table() and is set to thd->work_part_info. So, we need to parse thd->work_part_info after the call of the function. | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2022-01-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
It seems to be good to call parse_engine_part_options() in partition_info::fix_parser_data() according to the comments on the function.
| |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2022-01-26 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
An important point that I was not really aware of is that partition options are only used for storage engines. So, we need to parse the options only when storage engines can access to the options. | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2022-01-26 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
holyfoot please review: https://github.com/MariaDB/server/commit/001f54effdb535d468e4a7062e97e155c0915c09 | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexey Botchkov [ 2022-03-01 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
ok to push |