Commit 5377242f authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-14026 ALTER TABLE ... DELAY_KEY_WRITE=1 creates table copy for...

MDEV-14026 ALTER TABLE ... DELAY_KEY_WRITE=1 creates table copy for partitioned MyISAM table with DATA DIRECTORY/INDEX DIRECTORY options

set data_file_name and index_file_name in HA_CREATE_INFO
before calling check_if_incompatible_data()
parent 6d8b1bd6
......@@ -26,9 +26,5 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data
Warnings:
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
INSERT INTO t1 VALUES (NULL, "last", 4);
DROP TABLE t1;
......@@ -42,3 +42,16 @@ PARTITION p3 VALUES IN (4,5,6)
);
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
DROP TABLE t1;
create table t1 ( c1 int, c2 int, c3 varchar(100)) delay_key_write=1
partition by key(c1) (
partition p01 data directory = 'MYSQL_TMP_DIR'
index directory = 'MYSQL_TMP_DIR',
partition p02 data directory = 'MYSQL_TMP_DIR'
index directory = 'MYSQL_TMP_DIR');
insert into t1 values (1, 1, repeat('a', 100));
insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1;
insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1;
insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1;
alter online table t1 delay_key_write=0;
alter online table t1 delay_key_write=1;
drop table t1;
--source include/have_partition.inc
--let $engine=MyISAM
--source inc/part_alter_values.inc
#
# MDEV-14026 ALTER TABLE ... DELAY_KEY_WRITE=1 creates table copy for partitioned MyISAM table with DATA DIRECTORY/INDEX DIRECTORY options
#
replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR;
eval create table t1 ( c1 int, c2 int, c3 varchar(100)) delay_key_write=1
partition by key(c1) (
partition p01 data directory = '$MYSQL_TMP_DIR'
index directory = '$MYSQL_TMP_DIR',
partition p02 data directory = '$MYSQL_TMP_DIR'
index directory = '$MYSQL_TMP_DIR');
insert into t1 values (1, 1, repeat('a', 100));
insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1;
insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1;
insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1;
alter online table t1 delay_key_write=0;
alter online table t1 delay_key_write=1;
drop table t1;
......@@ -8133,20 +8133,36 @@ uint ha_partition::alter_table_flags(uint flags)
bool ha_partition::check_if_incompatible_data(HA_CREATE_INFO *create_info,
uint table_changes)
{
handler **file;
bool ret= COMPATIBLE_DATA_YES;
/*
The check for any partitioning related changes have already been done
in mysql_alter_table (by fix_partition_func), so it is only up to
the underlying handlers.
*/
for (file= m_file; *file; file++)
if ((ret= (*file)->check_if_incompatible_data(create_info,
table_changes)) !=
COMPATIBLE_DATA_YES)
break;
return ret;
List_iterator<partition_element> part_it(m_part_info->partitions);
HA_CREATE_INFO dummy_info= *create_info;
uint i=0;
while (partition_element *part_elem= part_it++)
{
if (m_is_sub_partitioned)
{
List_iterator<partition_element> subpart_it(part_elem->subpartitions);
while (partition_element *sub_elem= subpart_it++)
{
dummy_info.data_file_name= sub_elem->data_file_name;
dummy_info.index_file_name= sub_elem->index_file_name;
if (m_file[i++]->check_if_incompatible_data(&dummy_info, table_changes))
return COMPATIBLE_DATA_NO;
}
}
else
{
dummy_info.data_file_name= part_elem->data_file_name;
dummy_info.index_file_name= part_elem->index_file_name;
if (m_file[i++]->check_if_incompatible_data(&dummy_info, table_changes))
return COMPATIBLE_DATA_NO;
}
}
return COMPATIBLE_DATA_YES;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment