[MDEV-22166] CONVERT PARTITION: move out partition into a table Created: 2020-04-06  Updated: 2023-11-23  Resolved: 2021-10-26

Status: Closed
Project: MariaDB Server
Component/s: Partitioning
Fix Version/s: 10.7.1

Type: Task Priority: Critical
Reporter: Michael Widenius Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: Preview_10.7

Issue Links:
Blocks
is blocked by MDEV-17567 Atomic DDL Closed
PartOf
is part of MDEV-22162 Make partitions more flexible to use Open
Problem/Incident
causes MDEV-26767 Server crashes when rename table and ... Closed
Relates
relates to MDEV-17567 Atomic DDL Closed
relates to MDEV-22165 CONVERT TABLE: move in partition from... Closed
relates to MDEV-31013 CONVERT PARTITION is not documented i... Closed
relates to MDEV-22164 WITHOUT VALIDATION for EXCHANGE PARTI... Closed
relates to MDEV-27180 Fully atomic partitioning DDL operations Stalled
relates to MDEV-31014 Database privileges are insufficient ... Closed

 Description   

Moving a table out from a partitioned table is new quite cumbersome:
('archive' is here a partitioned table and 'p1' is a normal table)

CREATE TABLE tp1 LIKE archive;
ALTER TABLE tp1 REMOVE PARTITIONING;
ALTER TABLE archive EXCHANGE PARTITION p1 WITH TABLE tp1;
ALTER TABLE archive DROP PARTITION p1;

Instead one should be able to do:

ALTER TABLE archive CONVERT PARTITION p1 TO TABLE tp1;

The operation crash safety must be protected by DDL logging.



 Comments   
Comment by Aleksey Midenkov [ 2021-08-06 ]

Should tp1 be locked under lock tables?

LOCK TABLES t1 WRITE;
ALTER TABLE t1 EXPORT PARTITION p1 AS TABLE tp1;
SELECT * from tp1;
Table 'tp1' was not locked with LOCK TABLES

I think this is a good idea to lock tp1 as well otherwise there is no guarantee of data consistency between t1 and tp1.

Comment by Aleksey Midenkov [ 2021-08-17 ]

Please review

bb-10.7-midenok-MDEV-22166

Comment by Sergei Golubchik [ 2021-09-10 ]

818407474d6 is mostly ok. a couple of minor comments.

I presume logging changes are reviewed and ok'ed by Monty

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