From 55b96d27089ee809dd0a4c9b3e0e3adb5a731bd4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 28 Jun 2015 08:51:53 +0200 Subject: [PATCH] bump the VERSION to 10.1.6 and related changes fix two #if MYSQL_VERSION_ID > 100105 --- VERSION | 2 +- mysql-test/r/myisam-system.result | 6 +- .../federated/federated_bug_35333.result | 2 +- mysql-test/suite/innodb/r/innodb.result | 2 +- mysql-test/suite/innodb/r/innodb_mysql.result | 2 +- mysql-test/suite/innodb/t/innodb.test | 2 +- .../perfschema/r/dml_setup_objects.result | 2 +- .../suite/perfschema/r/setup_objects.result | 16 ++-- mysql-test/suite/rpl/r/rpl_EE_err.result | 2 +- sql/handler.cc | 73 ++----------------- sql/sql_show.cc | 23 ++++-- 11 files changed, 40 insertions(+), 92 deletions(-) diff --git a/VERSION b/VERSION index e5695b642a1..97f5590522e 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=1 -MYSQL_VERSION_PATCH=5 +MYSQL_VERSION_PATCH=6 MYSQL_VERSION_EXTRA= diff --git a/mysql-test/r/myisam-system.result b/mysql-test/r/myisam-system.result index af5de8f2749..e489f87948a 100644 --- a/mysql-test/r/myisam-system.result +++ b/mysql-test/r/myisam-system.result @@ -2,18 +2,18 @@ drop table if exists t1,t2; create table t1 (a int) engine=myisam; drop table if exists t1; Warnings: -Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") +Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") create table t1 (a int) engine=myisam; select * from t1; ERROR HY000: Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") drop table t1; Warnings: -Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") +Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") create table t1 (a int) engine=myisam; select * from t1; ERROR HY000: File './test/t1.MYD' not found (Errcode: 2 "No such file or directory") drop table t1; Warnings: -Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") +Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") drop table t1; ERROR 42S02: Unknown table 'test.t1' diff --git a/mysql-test/suite/federated/federated_bug_35333.result b/mysql-test/suite/federated/federated_bug_35333.result index 05e4bab8ec5..38a3a51ef28 100644 --- a/mysql-test/suite/federated/federated_bug_35333.result +++ b/mysql-test/suite/federated/federated_bug_35333.result @@ -29,7 +29,7 @@ Warnings: Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") DROP TABLE t1; Warnings: -Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") +Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") # # Cleanup # diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index f8020e080e6..34ed2ef3110 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -2484,7 +2484,7 @@ INSERT INTO t2 VALUES(1); DELETE FROM t1 WHERE id = 1; ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`)) DROP TABLE t1; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`)) SET FOREIGN_KEY_CHECKS=0; DROP TABLE t1; SET FOREIGN_KEY_CHECKS=1; diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index 793f407d5d8..61eec8d4155 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -634,7 +634,7 @@ ERROR 42S02: Table 'test.bug29807' doesn't exist in engine drop table t1; drop table bug29807; Warnings: -Warning 155 Table 'test.bug29807' doesn't exist in engine +Warning 1932 Table 'test.bug29807' doesn't exist in engine CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=InnoDB; switch to connection c1 diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index 47bbc90f955..bef13f5f418 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -1551,7 +1551,7 @@ INSERT INTO t2 VALUES(1); --error 1451 DELETE FROM t1 WHERE id = 1; ---error 1217 +--error 1451 DROP TABLE t1; SET FOREIGN_KEY_CHECKS=0; diff --git a/mysql-test/suite/perfschema/r/dml_setup_objects.result b/mysql-test/suite/perfschema/r/dml_setup_objects.result index 075114a9b5a..603c9ba6cc9 100644 --- a/mysql-test/suite/perfschema/r/dml_setup_objects.result +++ b/mysql-test/suite/perfschema/r/dml_setup_objects.result @@ -17,7 +17,7 @@ OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED insert into performance_schema.setup_objects set object_type='ILLEGAL', object_schema='FOO', object_name='BAR', enabled='YES', timed='YES'; -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails () +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails insert into performance_schema.setup_objects set object_type='TABLE', object_schema='FOO', object_name='BAR', enabled='YES', timed='YES'; diff --git a/mysql-test/suite/perfschema/r/setup_objects.result b/mysql-test/suite/perfschema/r/setup_objects.result index e623aeb8521..01744df940a 100644 --- a/mysql-test/suite/perfschema/r/setup_objects.result +++ b/mysql-test/suite/perfschema/r/setup_objects.result @@ -27,25 +27,25 @@ insert into performance_schema.setup_objects values ('TABLE', 'db4', '%', 'YES', 'NO'); insert into performance_schema.setup_objects values ('SOMETHING', 'bad1', 'bad1', 'YES', 'NO'); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails () +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails show warnings; Level Code Message Warning 1265 Data truncated for column 'OBJECT_TYPE' at row 1 -Error 1452 Cannot add or update a child row: a foreign key constraint fails () +Error 1452 Cannot add or update a child row: a foreign key constraint fails insert into performance_schema.setup_objects values ('TABLE', 'bad2', 'bad2', 'MAYBE', 'NO'); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails () +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails show warnings; Level Code Message Warning 1265 Data truncated for column 'ENABLED' at row 1 -Error 1452 Cannot add or update a child row: a foreign key constraint fails () +Error 1452 Cannot add or update a child row: a foreign key constraint fails insert into performance_schema.setup_objects values ('TABLE', 'bad3', 'bad3', 'YES', 'MAYBE NOT'); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails () +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails show warnings; Level Code Message Warning 1265 Data truncated for column 'TIMED' at row 1 -Error 1452 Cannot add or update a child row: a foreign key constraint fails () +Error 1452 Cannot add or update a child row: a foreign key constraint fails select * from performance_schema.setup_objects order by OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME; OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED @@ -64,10 +64,10 @@ set OBJECT_TYPE='SOMETHING' where OBJECT_SCHEMA='db1' and OBJECT_NAME='t1'; ERROR HY000: Invalid performance_schema usage. update performance_schema.setup_objects set ENABLED='MAYBE' where OBJECT_SCHEMA='db1' and OBJECT_NAME='t1'; -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails () +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails update performance_schema.setup_objects set TIMED='MAYBE NOT' where OBJECT_SCHEMA='db1' and OBJECT_NAME='t1'; -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails () +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails select * from performance_schema.setup_objects order by OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME; OBJECT_TYPE OBJECT_SCHEMA OBJECT_NAME ENABLED TIMED diff --git a/mysql-test/suite/rpl/r/rpl_EE_err.result b/mysql-test/suite/rpl/r/rpl_EE_err.result index f61ca063b77..1f605935005 100644 --- a/mysql-test/suite/rpl/r/rpl_EE_err.result +++ b/mysql-test/suite/rpl/r/rpl_EE_err.result @@ -4,5 +4,5 @@ create table t1 (a int) engine=myisam; flush tables; drop table if exists t1; Warnings: -Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") +Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") include/rpl_end.inc diff --git a/sql/handler.cc b/sql/handler.cc index d4d796b779d..879e7381d2d 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2296,41 +2296,6 @@ const char *get_canonical_filename(handler *file, const char *path, } -/** - An interceptor to hijack the text of the error message without - setting an error in the thread. We need the text to present it - in the form of a warning to the user. -*/ - -struct Ha_delete_table_error_handler: public Internal_error_handler -{ -public: - virtual bool handle_condition(THD *thd, - uint sql_errno, - const char* sqlstate, - Sql_condition::enum_warning_level level, - const char* msg, - Sql_condition ** cond_hdl); - char buff[MYSQL_ERRMSG_SIZE]; -}; - - -bool -Ha_delete_table_error_handler:: -handle_condition(THD *, - uint, - const char*, - Sql_condition::enum_warning_level, - const char* msg, - Sql_condition ** cond_hdl) -{ - *cond_hdl= NULL; - /* Grab the error message */ - strmake_buf(buff, msg); - return TRUE; -} - - /** delete a table in the engine @note @@ -2367,14 +2332,6 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path, if (!intercept || generate_warning) { - /* - Because file->print_error() use my_error() to generate the error message - we use an internal error handler to intercept it and store the text - in a temporary buffer. Later the message will be presented to user - as a warning. - */ - Ha_delete_table_error_handler ha_delete_table_error_handler; - /* Fill up strucutures that print_error may need */ dummy_share.path.str= (char*) path; dummy_share.path.length= strlen(path); @@ -2385,28 +2342,8 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path, dummy_share.table_name.length= strlen(alias); dummy_table.alias.set(alias, dummy_share.table_name.length, table_alias_charset); - file->change_table_ptr(&dummy_table, &dummy_share); - -#if MYSQL_VERSION_ID > 100105 - // XXX as an ugly 10.0-only hack we intercept HA_ERR_ROW_IS_REFERENCED, - // to report it under the old historical error number. -#error remove HA_ERR_ROW_IS_REFERENCED, use ME_JUST_WARNING instead of a handler -#endif - if (intercept || error == HA_ERR_ROW_IS_REFERENCED) - thd->push_internal_handler(&ha_delete_table_error_handler); - - file->print_error(error, 0); - - if (intercept || error == HA_ERR_ROW_IS_REFERENCED) - { - thd->pop_internal_handler(); - if (error == HA_ERR_ROW_IS_REFERENCED) - my_message(ER_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED), MYF(0)); - else - push_warning(thd, Sql_condition::WARN_LEVEL_WARN, error, - ha_delete_table_error_handler.buff); - } + file->print_error(error, MYF(intercept ? ME_JUST_WARNING : 0)); } if (intercept) error= 0; @@ -3528,14 +3465,18 @@ void handler::print_error(int error, myf errflag) { String str; get_error_message(error, &str); - my_error(ER_ROW_IS_REFERENCED_2, errflag, str.c_ptr_safe()); + my_printf_error(ER_ROW_IS_REFERENCED_2, + ER(str.length() ? ER_ROW_IS_REFERENCED_2 : ER_ROW_IS_REFERENCED), + errflag, str.c_ptr_safe()); DBUG_VOID_RETURN; } case HA_ERR_NO_REFERENCED_ROW: { String str; get_error_message(error, &str); - my_error(ER_NO_REFERENCED_ROW_2, errflag, str.c_ptr_safe()); + my_printf_error(ER_NO_REFERENCED_ROW_2, + ER(str.length() ? ER_NO_REFERENCED_ROW_2 : ER_NO_REFERENCED_ROW), + errflag, str.c_ptr_safe()); DBUG_VOID_RETURN; } case HA_ERR_TABLE_DEF_CHANGED: diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 4a396622862..b0773d27655 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -7913,13 +7913,21 @@ bool get_schema_tables_result(JOIN *join, TABLE_LIST *table_list= tab->table->pos_in_table_list; if (table_list->schema_table && thd->fill_information_schema_tables()) { -#if MYSQL_VERSION_ID > 100105 -#error I_S tables only need to be re-populated if make_cond_for_info_schema() will preserve outer fields - bool is_subselect= (&lex->unit != lex->current_select->master_unit() && - lex->current_select->master_unit()->item); -#else -#define is_subselect false -#endif + /* + Note, currently I_S tables are filled once per query. + This needs to be changed if if make_cond_for_info_schema() + will preserve outer fields (and thus I_S content will depend on + the outer subquery) - in this new case I_S tables will need to + be re-populated here. + + And in that case, get_all_tables() might be called O(N^2) times + (in self-join of TABLES, for example) and it will allocate + table names on THD::mem_root O(N^2) times. To fix it, get_all_tables + needs to be fixed to use a local memroot, that is reset or destroyed + between get_all_tables invocations. Or fixed not to allocate + table names on THD::memroot if these names don't satisfy lookup_field + */ + const bool is_subselect= false; /* A value of 0 indicates a dummy implementation */ if (table_list->schema_table->fill_table == 0) @@ -7959,7 +7967,6 @@ bool get_schema_tables_result(JOIN *join, } else table_list->table->file->stats.records= 0; - Item *cond= tab->select_cond; if (tab->cache_select && tab->cache_select->cond)