diff options
-rw-r--r-- | mysql-test/r/symlink.result | 12 | ||||
-rw-r--r-- | mysql-test/t/symlink.test | 25 | ||||
-rw-r--r-- | storage/myisam/ha_myisam.cc | 15 |
3 files changed, 50 insertions, 2 deletions
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index 803b43dec87..63fc37300b2 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -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; diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index e17ea07ca3c..cf95d4cb938 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -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 +# diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 82bcbdb12a9..3a9bf45e22f 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -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; |