From 39e6083e35459c9c8b22d37aaa2b74545884c7b0 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Sun, 23 Mar 2014 17:00:29 +0200 Subject: MDEV-5818: MySQL WL#6145: Separate the dependence of DATA DIRECTORY from symbolic links Copied relevant test cases and code from the MySQL 5.6 tree Testing of my_use_symdir moved to engines. mysql-test/r/partition_windows.result: Updated result file mysql-test/suite/archive/archive_no_symlink-master.opt: Testing of symlinks with archive mysql-test/suite/archive/archive_no_symlink.result: Testing of symlinks with archive mysql-test/suite/archive/archive_no_symlink.test: Testing of symlinks with archive mysql-test/suite/archive/archive_symlink.result: Testing of symlinks with archive mysql-test/suite/archive/archive_symlink.test: Testing of symlinks with archive sql/log_event.cc: Updated comment sql/partition_info.cc: Don't test my_use_symdir here sql/sql_parse.cc: Updated comment sql/sql_table.cc: Don't test my_use_symdir here sql/table.cc: Added more DBUG_PRINT storage/archive/ha_archive.cc: Give warnings for index_file_name and if we can't use data directory storage/myisam/ha_myisam.cc: Give warnings if we can't use data directory or index directory --- storage/archive/ha_archive.cc | 31 +++++++++++++++++++++++++------ storage/myisam/ha_myisam.cc | 21 +++++++++++++++++++-- 2 files changed, 44 insertions(+), 8 deletions(-) (limited to 'storage') diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index b30f1339510..fe6b611d1c6 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -104,7 +104,6 @@ >5.1.15 - v.3 */ - /* The file extension */ #define ARZ ".ARZ" // The data file #define ARN ".ARN" // Files used during an optimize call @@ -171,14 +170,14 @@ static void init_archive_psi_keys(void) const char* category= "archive"; int count; - if (PSI_server == NULL) + if (!PSI_server) return; - + count= array_elements(all_archive_mutexes); - PSI_server->register_mutex(category, all_archive_mutexes, count); + mysql_mutex_register(category, all_archive_mutexes, count); count= array_elements(all_archive_files); - PSI_server->register_file(category, all_archive_files, count); + mysql_file_register(category, all_archive_files, count); } #endif /* HAVE_PSI_INTERFACE */ @@ -765,7 +764,10 @@ int ha_archive::create(const char *name, TABLE *table_arg, /* We reuse name_buff since it is available. */ - if (create_info->data_file_name && create_info->data_file_name[0] != '#') +#ifdef HAVE_READLINK + if (my_use_symdir && + create_info->data_file_name && + create_info->data_file_name[0] != '#') { DBUG_PRINT("ha_archive", ("archive will create stream file %s", create_info->data_file_name)); @@ -776,12 +778,29 @@ int ha_archive::create(const char *name, TABLE *table_arg, MY_REPLACE_EXT | MY_UNPACK_FILENAME); } else +#endif /* HAVE_READLINK */ { + if (create_info->data_file_name) + { + push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN, + WARN_OPTION_IGNORED, + ER_DEFAULT(WARN_OPTION_IGNORED), + "DATA DIRECTORY"); + } fn_format(name_buff, name, "", ARZ, MY_REPLACE_EXT | MY_UNPACK_FILENAME); linkname[0]= 0; } + /* Archive engine never uses INDEX DIRECTORY. */ + if (create_info->index_file_name) + { + push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN, + WARN_OPTION_IGNORED, + ER_DEFAULT(WARN_OPTION_IGNORED), + "INDEX DIRECTORY"); + } + /* There is a chance that the file was "discovered". In this case just use whatever file is there. diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 18f0c3b7f60..c997f03463a 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -2006,10 +2006,27 @@ int ha_myisam::create(const char *name, register TABLE *table_arg, (ulonglong) 0); create_info.data_file_length= ((ulonglong) share->max_rows * share->avg_row_length); - create_info.data_file_name= ha_create_info->data_file_name; - create_info.index_file_name= ha_create_info->index_file_name; create_info.language= share->table_charset->number; +#ifdef HAVE_READLINK + if (my_use_symdir) + { + create_info.data_file_name= ha_create_info->data_file_name; + create_info.index_file_name= ha_create_info->index_file_name; + } + else +#endif /* HAVE_READLINK */ + { + if (ha_create_info->data_file_name) + push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN, + WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED), + "DATA DIRECTORY"); + if (ha_create_info->index_file_name) + push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN, + WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED), + "INDEX DIRECTORY"); + } + if (ha_create_info->tmp_table()) create_flags|= HA_CREATE_TMP_TABLE | HA_CREATE_DELAY_KEY_WRITE; if (ha_create_info->options & HA_CREATE_KEEP_FILES) -- cgit v1.2.1