summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-09-16 00:21:22 +0200
committerSergei Golubchik <serg@mariadb.org>2017-09-18 10:40:26 +0200
commit1fce3680899e601440be21b4c9840826e0318656 (patch)
tree653ba77eb51e35a80a991d76a6d0c77093d5aa13 /storage/myisam
parent7e56e9ea774a8f7e6e2f0327e8f16d1c3c0f5be9 (diff)
downloadmariadb-git-1fce3680899e601440be21b4c9840826e0318656.tar.gz
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
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/ha_myisam.cc15
1 files changed, 13 insertions, 2 deletions
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;