From: kevin.lewis Date: February 2 2012 10:57pm Subject: bzr push into mysql-trunk branch (kevin.lewis:3818 to 3819) WL#6145 List-Archive: http://lists.mysql.com/commits/142736 Message-Id: <20120202225702.72A891DBDB21@dhcp-adc-twvpn-2-vpnpool-10-154-57-17.vpn.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3819 kevin.lewis@stripped 2012-02-02 WL#6145 - This patch moves to the storage engine the code that determines whether DATA DIRECTORY and INDEX DIRECTORY on a CREATE TABLE command is ignored. It affects Archive and MyISAM storage engines where these clauses are used, and it affects the Partition engine where these clauses are passed through to the lower engine. In the future, WL5980, InnoDB will also use these clauses. modified: mysql-test/r/partition_windows.result sql/log_event.cc sql/partition_info.cc sql/sql_parse.cc sql/sql_table.cc storage/archive/ha_archive.cc storage/myisam/ha_myisam.cc 3818 Ole John Aske 2012-02-01 Fix for bug#13528826 TEST_IF_CHEAPER_ORDERING(): CALCULATES INCORRECT 'SELECT_LIMIT An incorrect 'adjusted select_limit' was returned from test_if_cheaper_ordering() if no excplicit limit-clause was specified in the query. This fix detect when a limit-clause was not specified, and returns the full 'table_records' when no limit-clause was used. Furthermore, this fix caused the testcase for bug #12838420 to change beyond what was required as a testcase for that bug. Fixed that by forcing correct query plan for testcase by introducing 'USE INDEX' and 'STRAIGHT_JOIN'. @ mysql-test/include/icp_tests.inc Slightly changed syntax of testcase in order to force required query plan for this testcase. @ mysql-test/include/order_by.inc New testcase for this bug @ mysql-test/r/innodb_icp.result Result should report the full number of records in table wo/ any limit clause. Also slightly changed syntax of testcase in order to force required query plan for this testcase. @ mysql-test/r/innodb_icp_all.result Result should report the full number of records in table wo/ any limit clause. Also slightly changed syntax of testcase in order to force required query plan for this testcase. @ mysql-test/r/innodb_icp_none.result Result should report the full number of records in table wo/ any limit clause. Also slightly changed syntax of testcase in order to force required query plan for this testcase. @ mysql-test/r/join_cache_nojb.result Result should report the full number of records in table wo/ any limit clause. @ mysql-test/r/myisam_icp.result Slightly changed syntax of testcase in order to force required query plan for this testcase. @ mysql-test/r/myisam_icp_all.result Slightly changed syntax of testcase in order to force required query plan for this testcase. @ mysql-test/r/myisam_icp_none.result Slightly changed syntax of testcase in order to force required query plan for this testcase. @ mysql-test/r/order_by_all.result Accept result for new testcase @ mysql-test/r/order_by_icp_mrr.result Accept result for new testcase @ mysql-test/r/order_by_none.result Accept result for new testcase modified: mysql-test/include/icp_tests.inc mysql-test/include/order_by.inc mysql-test/r/innodb_icp.result mysql-test/r/innodb_icp_all.result mysql-test/r/innodb_icp_none.result mysql-test/r/join_cache_nojb.result mysql-test/r/myisam_icp.result mysql-test/r/myisam_icp_all.result mysql-test/r/myisam_icp_none.result mysql-test/r/order_by_all.result mysql-test/r/order_by_icp_mrr.result mysql-test/r/order_by_none.result sql/sql_select.cc === modified file 'mysql-test/r/partition_windows.result' --- a/mysql-test/r/partition_windows.result revid:ole.john.aske@stripped +++ b/mysql-test/r/partition_windows.result revid:kevin.lewis@stripped @@ -26,5 +26,9 @@ ALTER TABLE t1 ADD PARTITION (PARTITION Warnings: Warning 1618 option ignored Warning 1618 option ignored +Warning 1618 option ignored +Warning 1618 option ignored +Warning 1618 option ignored +Warning 1618 option ignored INSERT INTO t1 VALUES (NULL, "last", 4); DROP TABLE t1; === modified file 'sql/log_event.cc' --- a/sql/log_event.cc revid:ole.john.aske@stripped +++ b/sql/log_event.cc revid:kevin.lewis@stripped @@ -4316,11 +4316,11 @@ int Query_log_event::do_apply_event(Rela nothing to do. */ /* - We do not replicate IGNORE_DIR_IN_CREATE. That is, if the master is a - slave which runs with SQL_MODE=IGNORE_DIR_IN_CREATE, this should not + We do not replicate MODE_NO_DIR_IN_CREATE. That is, if the master is a + slave which runs with SQL_MODE=MODE_NO_DIR_IN_CREATE, this should not force us to ignore the dir too. Imagine you are a ring of machines, and one has a disk problem so that you temporarily need - IGNORE_DIR_IN_CREATE on this machine; you don't want it to propagate + MODE_NO_DIR_IN_CREATE on this machine; you don't want it to propagate elsewhere (you don't want all slaves to start ignoring the dirs). */ if (sql_mode_inited) === modified file 'sql/partition_info.cc' --- a/sql/partition_info.cc revid:ole.john.aske@stripped +++ b/sql/partition_info.cc revid:kevin.lewis@stripped @@ -1233,9 +1233,7 @@ end: */ static void warn_if_dir_in_part_elem(THD *thd, partition_element *part_elem) { -#ifdef HAVE_READLINK - if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)) -#endif + if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) { if (part_elem->data_file_name) push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, === modified file 'sql/sql_parse.cc' --- a/sql/sql_parse.cc revid:ole.john.aske@stripped +++ b/sql/sql_parse.cc revid:kevin.lewis@stripped @@ -2603,14 +2603,13 @@ case SQLCOM_PREPARE: /* Might have been updated in create_table_precheck */ create_info.alias= create_table->alias; -#ifdef HAVE_READLINK - /* Fix names if symlinked tables */ + /* Fix names if symlinked or relocated tables */ if (append_file_to_dir(thd, &create_info.data_file_name, create_table->table_name) || append_file_to_dir(thd, &create_info.index_file_name, create_table->table_name)) goto end_with_restore_list; -#endif + /* If no engine type was given, work out the default now rather than at parse-time. === modified file 'sql/sql_table.cc' --- a/sql/sql_table.cc revid:ole.john.aske@stripped +++ b/sql/sql_table.cc revid:kevin.lewis@stripped @@ -4431,7 +4431,6 @@ bool mysql_create_table_no_lock(THD *thd THD_STAGE_INFO(thd, stage_creating_table); -#ifdef HAVE_READLINK { size_t dirlen; char dirpath[FN_REFLEN]; @@ -4478,8 +4477,7 @@ bool mysql_create_table_no_lock(THD *thd } #endif /* WITH_PARTITION_STORAGE_ENGINE */ - if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)) -#endif /* HAVE_READLINK */ + if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) { if (create_info->data_file_name) push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, === modified file 'storage/archive/ha_archive.cc' --- a/storage/archive/ha_archive.cc revid:ole.john.aske@stripped +++ b/storage/archive/ha_archive.cc revid:kevin.lewis@stripped @@ -727,12 +727,12 @@ void ha_archive::frm_load(const char *na { if (!mysql_file_fstat(frm_file, &file_stat, MYF(MY_WME))) { - frm_ptr= (uchar *) my_malloc(sizeof(uchar) * file_stat.st_size, MYF(0)); + frm_ptr= (uchar *) my_malloc(sizeof(uchar) * (size_t) file_stat.st_size, MYF(0)); if (frm_ptr) { - if (my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0)) == + if (my_read(frm_file, frm_ptr, (size_t) file_stat.st_size, MYF(0)) == (size_t) file_stat.st_size) - azwrite_frm(dst, (char *) frm_ptr, file_stat.st_size); + azwrite_frm(dst, (char *) frm_ptr, (size_t) file_stat.st_size); my_free(frm_ptr); } } @@ -821,7 +821,10 @@ int ha_archive::create(const char *name, /* 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)); @@ -832,12 +835,29 @@ int ha_archive::create(const char *name, 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. === modified file 'storage/myisam/ha_myisam.cc' --- a/storage/myisam/ha_myisam.cc revid:ole.john.aske@stripped +++ b/storage/myisam/ha_myisam.cc revid:kevin.lewis@stripped @@ -1942,10 +1942,27 @@ int ha_myisam::create(const char *name, (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->options & HA_LEX_CREATE_TMP_TABLE) create_flags|= HA_CREATE_TMP_TABLE; if (ha_create_info->options & HA_CREATE_KEEP_FILES) No bundle (reason: useless for push emails).