[MDEV-22153] ALTER add default history partitions makes table inaccessible Created: 2020-04-05  Updated: 2020-04-27  Resolved: 2020-04-06

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Partitioning, Versioned Tables
Affects Version/s: 10.5
Fix Version/s: 10.5.3

Type: Bug Priority: Critical
Reporter: Aleksey Midenkov Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-25347 DML events for auto-partitioned table... Closed
Problem/Incident
is caused by MDEV-19903 Setup default partitions for system v... Closed
Relates
relates to MDEV-22155 ALTER add default history partitions ... Closed
relates to MDEV-22207 Drop default history partitions rende... Closed

 Description   

Reproduce

--source include/have_partition.inc
--source include/have_innodb.inc
 
set default_storage_engine=innodb;
create or replace table t1 (x int) with system versioning partition by system_time;
alter table t1 add partition partitions 1;
alter table t1 add partition partitions 1;
alter table t1 add partition partitions 1;
show create table t1;
 
drop tables t1;

Result

mysqltest: At line 8: query 'alter table t1 add partition partitions 1' failed: 1932: Table 'test.t1' doesn't exist in engine

Notes

ADD default history partitions generates wrong partition name,
f.ex. p2 instead of p1. Gap in sequence of partition names leads to
ha_partition::open_read_partitions() fail on inexistent name.

Manual fixing such broken table requires:

1. create empty table by any name (t_new) with correct number of partitions;
2. stop the server;
3. rename data files (.myd, .myi or .ibd) of broken table to t_new fixing the partition sequence (#p2 to #p1, #p3 to #p2);
4. start the server;
5. drop the broken table;
6. rename t_new to correct table name.


Generated at Thu Feb 08 09:12:36 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.