[MDEV-5077] Cannot exchange partition with archive table Created: 2013-09-27  Updated: 2022-09-12  Resolved: 2022-09-12

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.0.4
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Sergey Vojtovich Assignee: Sergei Golubchik
Resolution: Won't Fix Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-4864 Merge tests for EXCHANGE PARTITION fe... Closed

 Description   

The following test fails with error "ERROR HY000: Tables have different definitions":

--source include/have_partition.inc
--source include/have_archive.inc
 
CREATE TABLE t1(a INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=ARCHIVE PARTITION BY HASH (a) PARTITIONS 4;
CREATE TABLE t2 LIKE t1;
ALTER TABLE t2 REMOVE PARTITIONING;
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
DROP TABLE t1,t2;

While performing exchange partition we call mysql_compare_tables()/ha_archive::check_if_incompatible_data(). In MariaDB this function always return COMPATIBLE_DATA_NO.

Covered by the following tests: parts.partition_mgm_lc1_archive parts.partition_exchange_archive parts.partition_mgm_lc0_archive rpl.rpl_partition_archive. Enable them when this bug is fixed.



 Comments   
Comment by Sergei Golubchik [ 2013-12-14 ]

It's easy to fix ha_archive::check_if_incompatible_data():

enum_alter_inplace_result check_if_supported_inplace_alter(TABLE *, Alter_inplace_info *);

{ return HA_ALTER_INPLACE_NOT_SUPPORTED; }

bool check_if_incompatible_data(HA_CREATE_INFO *, uint)

{ return COMPATIBLE_DATA_YES; }

this will make mysql_compare_tables() to work, while still disabling frm-only ALTER TABLE.

But ALTER TABLE .. EXCHANGE PARTITION still won't work — it's conceptually incompatible with Archive engine. ALTER TABLE .. EXCHANGE PARTITION essentially swap ARZ file of the specified partition and the ARZ file of the specified table. Without touching frm files. Because Archive stores a copy of the frm in the ARZ file, they go out of sync, and the next time the table is opened, Archive will notice it. Other engines that do frm shipping could, perhaps, update the stored frm copy on rename. But Archive keeps frm in the header of the ARZ file, it would need to re-compress the complete ARZ file to replace the stored frm image.

Comment by Sergei Golubchik [ 2014-01-14 ]

A possible "solution" is to disable archive discovery (store no frm image in the ARZ file) when a table is created as a partition. Additionally ha_archive::rename_table() needs to detect the case when a table is renamed into a partition and delete (or bzero or mark unusable) the internally stored frm image.

Comment by Sergei Golubchik [ 2022-09-12 ]

10.0 was EOLed in March 2019

Generated at Thu Feb 08 07:01:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.