Commit 1fce3680 authored by Sergei Golubchik's avatar Sergei Golubchik

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

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

correct detection of changes in DATA/INDEX DIRECTORY
parent 7e56e9ea
......@@ -227,3 +227,15 @@ DROP DATABASE x;
CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM
DATA DIRECTORY "MYSQLTEST_VARDIR/tmp";
DROP TABLE test.t1;
use test;
create table t1(c1 int, c2 int, c3 varchar(100)) engine=MyISAM data directory='MYSQL_TMP_DIR' index directory = 'MYSQL_TMP_DIR';
insert t1 values (1,2,3), (2,3,4), (3,4,5), (4,5,6), (5,6,7), (6,7,8), (7,8,9);
alter online table t1 delay_key_write=1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 DATA DIRECTORY='MYSQL_TMP_DIR/' INDEX DIRECTORY='MYSQL_TMP_DIR/'
drop table t1;
......@@ -316,3 +316,28 @@ eval CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM
DATA DIRECTORY "$MYSQLTEST_VARDIR/tmp";
DROP TABLE test.t1;
use test;
#
# End of 5.5 tests
#
#
# End of 10.0 tests
#
#
# MDEV-13636 ALTER TABLE ... DELAY_KEY_WRITE=1 creates table copy for 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)) engine=MyISAM data directory='$MYSQL_TMP_DIR' index directory = '$MYSQL_TMP_DIR';
insert t1 values (1,2,3), (2,3,4), (3,4,5), (4,5,6), (5,6,7), (6,7,8), (7,8,9);
alter online table t1 delay_key_write=1;
replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR;
show create table t1;
drop table t1;
#
# End of 10.1 tests
#
......@@ -2261,6 +2261,17 @@ ha_myisam::check_if_supported_inplace_alter(TABLE *new_table,
}
static bool directories_differ(const char *d1, const char *d2)
{
if (!d1 && !d2)
return false;
if (!d1 || !d2)
return true;
size_t l1= dirname_length(d1), l2= dirname_length(d2);
return l1 != l2 || strncmp(d1, d2, l1);
}
bool ha_myisam::check_if_incompatible_data(HA_CREATE_INFO *create_info,
uint table_changes)
{
......@@ -2268,8 +2279,8 @@ bool ha_myisam::check_if_incompatible_data(HA_CREATE_INFO *create_info,
if ((create_info->used_fields & HA_CREATE_USED_AUTO &&
create_info->auto_increment_value != stats.auto_increment_value) ||
create_info->data_file_name != data_file_name ||
create_info->index_file_name != index_file_name ||
directories_differ(create_info->data_file_name, data_file_name) ||
directories_differ(create_info->index_file_name, index_file_name) ||
table_changes == IS_EQUAL_NO ||
table_changes & IS_EQUAL_PACK_LENGTH) // Not implemented yet
return COMPATIBLE_DATA_NO;
......
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