From: Bjorn Munch Date: May 24 2011 10:11am Subject: bzr push into mysql-5.5-mtr branch (bjorn.munch:3215 to 3217) List-Archive: http://lists.mysql.com/commits/137965 Message-Id: <201105241011.p4OABEUf003054@khepri15.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3217 Bjorn Munch 2011-05-24 [merge] merge from 5.5 main modified: include/my_getopt.h mysql-test/collections/default.experimental mysql-test/suite/binlog/t/disabled.def mysql-test/suite/federated/disabled.def mysql-test/suite/rpl/t/disabled.def mysql-test/suite/sys_vars/t/disabled.def mysql-test/t/disabled.def sql/derror.cc sql/events.cc sql/field.cc sql/ha_ndbcluster.cc sql/ha_ndbcluster_binlog.cc sql/ha_partition.cc sql/handler.cc sql/item_create.cc sql/item_func.cc sql/item_strfunc.cc sql/log.h sql/log_event.cc sql/rpl_rli.cc sql/set_var.cc sql/sp_head.cc sql/sql_acl.cc sql/sql_base.cc sql/sql_binlog.cc sql/sql_class.cc sql/sql_connect.cc sql/sql_insert.cc sql/sql_parse.cc sql/sql_partition.cc sql/sql_plugin.cc sql/sql_prepare.cc sql/sql_reload.cc sql/sql_repl.cc sql/sql_show.cc sql/sql_table.cc sql/sys_vars.cc sql/table.cc sql/unireg.cc storage/example/ha_example.cc storage/innobase/btr/btr0cur.c storage/innobase/buf/buf0buf.c storage/innobase/dict/dict0crea.c storage/innobase/dict/dict0load.c storage/innobase/fil/fil0fil.c storage/innobase/include/buf0buf.h storage/innobase/include/dict0load.h storage/innobase/include/page0page.h storage/innobase/include/page0page.ic storage/innobase/os/os0file.c storage/innobase/page/page0page.c storage/innobase/row/row0mysql.c storage/innobase/trx/trx0undo.c 3216 Bjorn Munch 2011-05-24 Bug#11831031: MTR SHOULD FIND TEST SUITES FROM FEATURE TREES OUTSIDE MYSQL-TEST Backported from trunk-mtr modified: mysql-test/lib/mtr_cases.pm 3215 Bjorn Munch 2011-05-20 [merge] merge from 5.5 main added: include/mysql/thread_pool_priv.h mysql-test/include/not_threadpool.inc mysql-test/r/implicit_char_to_num_conversion.result mysql-test/r/status_bug17954.result mysql-test/t/implicit_char_to_num_conversion.test mysql-test/t/status_bug17954.test modified: .bzrignore BUILD/build_mccge.sh CMakeLists.txt VERSION include/my_compiler.h include/my_sys.h include/mysql/plugin_audit.h.pp include/mysql/plugin_auth.h.pp include/mysql/plugin_ftparser.h.pp include/mysql/service_thd_wait.h libmysqld/lib_sql.cc mysql-test/collections/default.experimental mysql-test/include/have_archive_plugin.inc mysql-test/include/have_blackhole_plugin.inc mysql-test/include/plugin.defs mysql-test/r/func_time.result mysql-test/r/status.result mysql-test/suite/binlog/r/binlog_innodb_row.result mysql-test/suite/binlog/t/binlog_innodb_row.test mysql-test/suite/perfschema/t/no_threads.test mysql-test/suite/perfschema/t/one_thread_per_con.test mysql-test/suite/rpl/r/rpl_relayspace.result mysql-test/suite/rpl/t/rpl_relayspace.test mysql-test/suite/sys_vars/t/all_vars.test mysql-test/suite/sys_vars/t/slow_launch_time_func.test mysql-test/suite/sys_vars/t/thread_cache_size_func.test mysql-test/suite/sys_vars/t/wait_timeout_func.test mysql-test/t/func_time.test mysql-test/t/information_schema.test mysql-test/t/information_schema_db.test mysql-test/t/kill.test mysql-test/t/mysqlshow.test mysql-test/t/named_pipe.test mysql-test/t/no-threads.test mysql-test/t/shm.test mysql-test/t/status.test mysys/lf_alloc-pin.c mysys/my_sync.c packaging/WiX/ca/CMakeLists.txt packaging/WiX/create_msi.cmake.in packaging/WiX/custom_ui.wxs sql/debug_sync.cc sql/debug_sync.h sql/item_func.cc sql/item_timefunc.cc sql/log.cc sql/log.h sql/mdl.cc sql/mysqld.cc sql/mysqld.h sql/rpl_rli.cc sql/scheduler.cc sql/scheduler.h sql/sp_head.cc sql/sp_head.h sql/sql_acl.cc sql/sql_class.cc sql/sql_class.h sql/sql_connect.cc sql/sql_connect.h sql/sql_cursor.h sql/sql_prepare.cc sql/table.cc storage/innobase/srv/srv0srv.c unittest/mysys/lf-t.c === modified file 'include/my_getopt.h' --- a/include/my_getopt.h 2010-10-25 12:30:07 +0000 +++ b/include/my_getopt.h 2011-05-21 08:21:08 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2004 MySQL AB +/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _my_getopt_h #define _my_getopt_h @@ -86,7 +86,9 @@ struct my_option typedef my_bool (*my_get_one_option)(int, const struct my_option *, char *); -typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...); +typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...) + ATTRIBUTE_FORMAT_FPTR(printf, 2, 3); + /** Used to retrieve a reference to the object (variable) that holds the value for the given option. For example, if var_type is GET_UINT, the function === modified file 'mysql-test/collections/default.experimental' --- a/mysql-test/collections/default.experimental 2011-05-16 09:44:34 +0000 +++ b/mysql-test/collections/default.experimental 2011-05-23 11:33:41 +0000 @@ -6,22 +6,23 @@ binlog.binlog_bug23533 funcs_1.charset_collation_1 # depends on compile-time decisions -main.func_math @freebsd # Bug#43020 2010-05-04 alik main.func_math fails on FreeBSD in PB2 -main.gis-rtree @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server -main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically -main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible) -main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun -main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun -main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server -main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris +main.func_math @freebsd # Bug#11751977 2010-05-04 alik main.func_math fails on FreeBSD in PB2 +main.gis-rtree @freebsd # Bug#11749418 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server +main.lock_multi_bug38499 # Bug#11755645 2009-09-19 alik main.lock_multi_bug38499 times out sporadically +main.outfile_loaddata @solaris # Bug#11755168 2010-01-20 alik Test "outfile_loaddata" fails (reproducible) +main.signal_demo3 @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun +main.sp @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun +main.type_float @freebsd # Bug#11749418 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server +main.wait_timeout @solaris # Bug#11758972 2010-04-26 alik wait_timeout fails on OpenSolaris +rpl.rpl_innodb_bug28430 # Bug#11754425 +rpl.rpl_bug37426 # WL#5867: skozlov: test case moved from unused bugs suite rpl.rpl_heartbeat_basic # BUG#12403008 2011-04-27 sven fails sporadically -rpl.rpl_innodb_bug28430 # Bug#46029 rpl.rpl_show_slave_hosts # BUG#12416700 2011-05-02 sven fails sporadically -sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun -sys_vars.plugin_dir_basic # Bug#52223 2010-11-24 alik Test "plugin_dir_basic" does not support RPM build (test) directory structure -sys_vars.wait_timeout_func # Bug#41255 2010-04-26 alik wait_timeout_func fails +sys_vars.max_sp_recursion_depth_func @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun +sys_vars.plugin_dir_basic # Bug#11759877 2010-11-24 alik Test "plugin_dir_basic" does not support RPM build (test) directory structure +sys_vars.wait_timeout_func # Bug#11750645 2010-04-26 alik wait_timeout_func fails # BUG #59055 : All ndb tests should be removed from the repository # Leaving the sys_vars tests for now. sys_vars.all_vars.test fails on removing ndb tests @@ -30,6 +31,6 @@ sys_vars.have_ndbcluster_basic sys_vars.ndb_log_updated_only_basic sys_vars.rpl_init_slave_func # Bug#12535301 2011-05-09 andrei sys_vars.rpl_init_slave_func mismatches in daily-5.5 -main.gis-rtree # svoj: due to BUG#38965 -main.type_float # svoj: due to BUG#38965 -main.type_newdecimal # svoj: due to BUG#38965 +main.gis-rtree # svoj: due to BUG#11749418 +main.type_float # svoj: due to BUG#11749418 +main.type_newdecimal # svoj: due to BUG#11749418 === modified file 'mysql-test/lib/mtr_cases.pm' --- a/mysql-test/lib/mtr_cases.pm 2011-01-18 10:21:37 +0000 +++ b/mysql-test/lib/mtr_cases.pm 2011-05-24 08:54:34 +0000 @@ -287,9 +287,11 @@ sub collect_one_suite($) "mysql-test/suite", "mysql-test", # Look in storage engine specific suite dirs - "storage/*/mysql-test-suites" + "storage/*/mtr", + # Look in plugin specific suite dir + "plugin/$suite/tests", ], - [$suite]); + [$suite, "mtr"]); } mtr_verbose("suitedir: $suitedir"); } === modified file 'mysql-test/suite/binlog/t/disabled.def' --- a/mysql-test/suite/binlog/t/disabled.def 2011-03-24 14:39:45 +0000 +++ b/mysql-test/suite/binlog/t/disabled.def 2011-05-23 11:33:41 +0000 @@ -9,5 +9,5 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -binlog_truncate_innodb : BUG#57291 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed -binlog_spurious_ddl_errors : BUG#54195 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled +binlog_truncate_innodb : BUG#11764459 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed +binlog_spurious_ddl_errors : BUG#11761680 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled === modified file 'mysql-test/suite/federated/disabled.def' --- a/mysql-test/suite/federated/disabled.def 2007-12-12 17:19:24 +0000 +++ b/mysql-test/suite/federated/disabled.def 2011-05-23 11:33:41 +0000 @@ -9,4 +9,4 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -federated_transactions : Bug#29523 Transactions do not work +federated_transactions : Bug#11746899 Transactions do not work === modified file 'mysql-test/suite/rpl/t/disabled.def' --- a/mysql-test/suite/rpl/t/disabled.def 2011-02-15 12:01:52 +0000 +++ b/mysql-test/suite/rpl/t/disabled.def 2011-05-23 11:33:41 +0000 @@ -10,8 +10,8 @@ # ############################################################################## -rpl_row_create_table : Bug#51574 2010-02-27 andrei failed different way than earlier with bug#45576 -rpl_spec_variables : BUG#47661 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux -rpl_get_master_version_and_clock : Bug#59178 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock +rpl_row_create_table : Bug#11759274 2010-02-27 andrei failed different way than earlier with bug#45576 +rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux +rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock rpl_row_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out === modified file 'mysql-test/suite/sys_vars/t/disabled.def' --- a/mysql-test/suite/sys_vars/t/disabled.def 2009-12-22 09:35:56 +0000 +++ b/mysql-test/suite/sys_vars/t/disabled.def 2011-05-23 11:33:41 +0000 @@ -9,9 +9,9 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -query_cache_size_basic_32 : Bug#36747: Allocating a large query cache is not deterministic -query_cache_size_basic_64 : Bug#36747: Allocating a large query cache is not deterministic -transaction_prealloc_size_basic_32 : Bug#36747 -transaction_prealloc_size_basic_64 : Bug#36747 -#thread_cache_size_func : Bug#40575: 2008-11-07 joro main.thread_cache_size_func fails in pushbuild when run with pool of threads +query_cache_size_basic_32 : Bug#11748572: Allocating a large query cache is not deterministic +query_cache_size_basic_64 : Bug#11748572: Allocating a large query cache is not deterministic +transaction_prealloc_size_basic_32 : Bug#11748572 +transaction_prealloc_size_basic_64 : Bug#11748572 +#thread_cache_size_func : Bug#11750172: 2008-11-07 joro main.thread_cache_size_func fails in pushbuild when run with pool of threads === modified file 'mysql-test/t/disabled.def' --- a/mysql-test/t/disabled.def 2011-03-11 09:12:58 +0000 +++ b/mysql-test/t/disabled.def 2011-05-23 11:33:41 +0000 @@ -9,11 +9,11 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -lowercase_table3 : Bug#54845 2010-06-30 alik main.lowercase_table3 on Mac OSX +lowercase_table3 : Bug#11762269 2010-06-30 alik main.lowercase_table3 on Mac OSX query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically -log_tables-big : Bug#48646 2010-11-15 mattiasj report already exists -read_many_rows_innodb : Bug#37635 2010-11-15 mattiasj report already exists -sum_distinct-big : Bug#56927 2010-11-15 mattiasj was not tested -alter_table-big : Bug#37248 2010-11-15 mattiasj was not tested -create-big : Bug#37248 2010-11-15 mattiasj was not tested +log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists +read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists +sum_distinct-big : Bug#11764126 2010-11-15 mattiasj was not tested +alter_table-big : Bug#11748731 2010-11-15 mattiasj was not tested +create-big : Bug#11748731 2010-11-15 mattiasj was not tested archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc === modified file 'sql/derror.cc' --- a/sql/derror.cc 2010-09-02 18:37:04 +0000 +++ b/sql/derror.cc 2011-05-21 08:21:08 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2005 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,8 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file @@ -108,7 +107,6 @@ bool read_texts(const char *file_name, c char lang_path[FN_REFLEN]; uchar *buff; uchar head[32],*pos; - const char *errmsg; DBUG_ENTER("read_texts"); LINT_INIT(buff); @@ -185,18 +183,9 @@ Check that the above file is the right v DBUG_RETURN(0); err: - switch (funktpos) { - case 2: - errmsg= "Not enough memory for messagefile '%s'"; - break; - case 1: - errmsg= "Can't read from messagefile '%s'"; - break; - default: - errmsg= "Can't find messagefile '%s'"; - break; - } - sql_print_error(errmsg, name); + sql_print_error((funktpos == 2) ? "Not enough memory for messagefile '%s'" : + ((funktpos == 1) ? "Can't read from messagefile '%s'" : + "Can't find messagefile '%s'"), name); if (file != FERR) (void) mysql_file_close(file, MYF(MY_WME)); DBUG_RETURN(1); === modified file 'sql/events.cc' --- a/sql/events.cc 2010-11-11 17:11:05 +0000 +++ b/sql/events.cc 2011-05-21 08:21:08 +0000 @@ -1,4 +1,4 @@ -/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -445,7 +445,7 @@ Events::update_event(THD *thd, Event_par !sortcmp_lex_string(parse_data->name, *new_name, system_charset_info)) { - my_error(ER_EVENT_SAME_NAME, MYF(0), parse_data->name.str); + my_error(ER_EVENT_SAME_NAME, MYF(0)); DBUG_RETURN(TRUE); } === modified file 'sql/field.cc' --- a/sql/field.cc 2011-05-12 12:38:14 +0000 +++ b/sql/field.cc 2011-05-21 08:21:08 +0000 @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,8 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file @@ -9268,7 +9267,7 @@ bool Create_field::init(THD *thd, char * if (decimals >= NOT_FIXED_DEC) { my_error(ER_TOO_BIG_SCALE, MYF(0), decimals, fld_name, - NOT_FIXED_DEC-1); + static_cast(NOT_FIXED_DEC - 1)); DBUG_RETURN(TRUE); } @@ -9338,8 +9337,8 @@ bool Create_field::init(THD *thd, char * my_decimal_trim(&length, &decimals); if (length > DECIMAL_MAX_PRECISION) { - my_error(ER_TOO_BIG_PRECISION, MYF(0), length, fld_name, - DECIMAL_MAX_PRECISION); + my_error(ER_TOO_BIG_PRECISION, MYF(0), static_cast(length), + fld_name, static_cast(DECIMAL_MAX_PRECISION)); DBUG_RETURN(TRUE); } if (length < decimals) @@ -9563,7 +9562,7 @@ bool Create_field::init(THD *thd, char * if (length > MAX_BIT_FIELD_LENGTH) { my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), fld_name, - MAX_BIT_FIELD_LENGTH); + static_cast(MAX_BIT_FIELD_LENGTH)); DBUG_RETURN(TRUE); } pack_length= (length + 7) / 8; === modified file 'sql/ha_ndbcluster.cc' --- a/sql/ha_ndbcluster.cc 2010-11-11 17:11:05 +0000 +++ b/sql/ha_ndbcluster.cc 2011-05-21 08:21:08 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,8 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file @@ -8699,7 +8698,7 @@ NDB_SHARE *ndbcluster_get_share(const ch DBUG_PRINT("error", ("get_share: failed to alloc share")); if (!have_lock) mysql_mutex_unlock(&ndbcluster_mutex); - my_error(ER_OUTOFMEMORY, MYF(0), sizeof(*share)); + my_error(ER_OUTOFMEMORY, MYF(0), static_cast(sizeof(*share))); DBUG_RETURN(0); } } === modified file 'sql/ha_ndbcluster_binlog.cc' --- a/sql/ha_ndbcluster_binlog.cc 2010-09-20 14:17:32 +0000 +++ b/sql/ha_ndbcluster_binlog.cc 2011-05-21 08:21:08 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,8 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes @@ -1225,12 +1224,14 @@ ndbcluster_update_slock(THD *thd, } if (ndb_error) + { + char buf[1024]; + my_snprintf(buf, sizeof(buf), "Could not release lock on '%s.%s'", + db, table_name); push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_GET_ERRMSG, ER(ER_GET_ERRMSG), - ndb_error->code, - ndb_error->message, - "Could not release lock on '%s.%s'", - db, table_name); + ndb_error->code, ndb_error->message, buf); + } if (trans) ndb->closeTransaction(trans); ndb->setDatabaseName(save_db); === modified file 'sql/ha_partition.cc' --- a/sql/ha_partition.cc 2011-05-10 13:24:34 +0000 +++ b/sql/ha_partition.cc 2011-05-21 08:21:08 +0000 @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* This handler was developed by Mikael Ronstrom for version 5.1 of MySQL. @@ -1069,6 +1069,10 @@ static int handle_opt_part(THD *thd, HA_ static bool print_admin_msg(THD* thd, const char* msg_type, const char* db_name, const char* table_name, const char* op_name, const char *fmt, ...) + ATTRIBUTE_FORMAT(printf, 6, 7); +static bool print_admin_msg(THD* thd, const char* msg_type, + const char* db_name, const char* table_name, + const char* op_name, const char *fmt, ...) { va_list args; Protocol *protocol= thd->protocol; === modified file 'sql/handler.cc' --- a/sql/handler.cc 2011-04-20 17:53:08 +0000 +++ b/sql/handler.cc 2011-05-21 08:21:08 +0000 @@ -278,7 +278,7 @@ handler *get_ha_partition(partition_info } else { - my_error(ER_OUTOFMEMORY, MYF(0), sizeof(ha_partition)); + my_error(ER_OUTOFMEMORY, MYF(0), static_cast(sizeof(ha_partition))); } DBUG_RETURN(((handler*) partition)); } @@ -1638,7 +1638,8 @@ int ha_recover(HASH *commit_list) } if (!info.list) { - sql_print_error(ER(ER_OUTOFMEMORY), info.len*sizeof(XID)); + sql_print_error(ER(ER_OUTOFMEMORY), + static_cast(info.len*sizeof(XID))); DBUG_RETURN(1); } === modified file 'sql/item_create.cc' --- a/sql/item_create.cc 2010-11-26 10:44:39 +0000 +++ b/sql/item_create.cc 2011-05-21 08:21:08 +0000 @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file @@ -5215,8 +5215,8 @@ create_func_cast(THD *thd, Item *a, Cast decoded_size= strtoul(c_len, NULL, 10); if (errno != 0) { - my_error(ER_TOO_BIG_PRECISION, MYF(0), c_len, a->name, - DECIMAL_MAX_PRECISION); + my_error(ER_TOO_BIG_PRECISION, MYF(0), INT_MAX, a->name, + static_cast(DECIMAL_MAX_PRECISION)); return NULL; } len= decoded_size; @@ -5229,8 +5229,8 @@ create_func_cast(THD *thd, Item *a, Cast decoded_size= strtoul(c_dec, NULL, 10); if ((errno != 0) || (decoded_size > UINT_MAX)) { - my_error(ER_TOO_BIG_SCALE, MYF(0), c_dec, a->name, - DECIMAL_MAX_SCALE); + my_error(ER_TOO_BIG_SCALE, MYF(0), INT_MAX, a->name, + static_cast(DECIMAL_MAX_SCALE)); return NULL; } dec= decoded_size; @@ -5243,14 +5243,14 @@ create_func_cast(THD *thd, Item *a, Cast } if (len > DECIMAL_MAX_PRECISION) { - my_error(ER_TOO_BIG_PRECISION, MYF(0), len, a->name, - DECIMAL_MAX_PRECISION); + my_error(ER_TOO_BIG_PRECISION, MYF(0), static_cast(len), a->name, + static_cast(DECIMAL_MAX_PRECISION)); return 0; } if (dec > DECIMAL_MAX_SCALE) { my_error(ER_TOO_BIG_SCALE, MYF(0), dec, a->name, - DECIMAL_MAX_SCALE); + static_cast(DECIMAL_MAX_SCALE)); return 0; } res= new (thd->mem_root) Item_decimal_typecast(a, len, dec); === modified file 'sql/item_func.cc' --- a/sql/item_func.cc 2011-05-12 12:29:32 +0000 +++ b/sql/item_func.cc 2011-05-21 08:59:32 +0000 @@ -11,8 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file @@ -1096,7 +1095,7 @@ err: push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, ER(ER_WARN_DATA_OUT_OF_RANGE), - name, 1); + name, 1L); return dec; } @@ -3154,7 +3153,7 @@ udf_handler::fix_fields(THD *thd, Item_r if (!tmp_udf) { - my_error(ER_CANT_FIND_UDF, MYF(0), u_d->name.str, errno); + my_error(ER_CANT_FIND_UDF, MYF(0), u_d->name.str); DBUG_RETURN(TRUE); } u_d=tmp_udf; === modified file 'sql/item_strfunc.cc' --- a/sql/item_strfunc.cc 2011-05-06 11:39:40 +0000 +++ b/sql/item_strfunc.cc 2011-05-21 08:21:08 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,8 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file @@ -3702,7 +3701,8 @@ String *Item_func_uncompress::val_str(St push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_WARN, ER_TOO_BIG_FOR_UNCOMPRESS, ER(ER_TOO_BIG_FOR_UNCOMPRESS), - current_thd->variables.max_allowed_packet); + static_cast(current_thd->variables. + max_allowed_packet)); goto err; } if (buffer.realloc((uint32)new_size)) === modified file 'sql/log.h' --- a/sql/log.h 2011-04-15 13:46:11 +0000 +++ b/sql/log.h 2011-05-21 08:59:32 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef LOG_H #define LOG_H @@ -687,7 +687,7 @@ void sql_print_warning(const char *forma void sql_print_information(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2); typedef void (*sql_print_message_func)(const char *format, ...) - ATTRIBUTE_FORMAT(printf, 1, 2); + ATTRIBUTE_FORMAT_FPTR(printf, 1, 2); extern sql_print_message_func sql_print_message_handlers[]; int error_log_print(enum loglevel level, const char *format, === modified file 'sql/log_event.cc' --- a/sql/log_event.cc 2011-03-25 12:13:17 +0000 +++ b/sql/log_event.cc 2011-05-23 22:46:51 +0000 @@ -8441,6 +8441,7 @@ int Table_map_log_event::do_apply_event( m_field_metadata, m_field_metadata_size, m_null_bits, m_flags); table_list->m_tabledef_valid= TRUE; + table_list->m_conv_table= NULL; table_list->open_type= OT_BASE_ONLY; /* === modified file 'sql/rpl_rli.cc' --- a/sql/rpl_rli.cc 2011-04-15 13:46:11 +0000 +++ b/sql/rpl_rli.cc 2011-05-23 23:33:55 +0000 @@ -1258,6 +1258,16 @@ void Relay_log_info::clear_tables_to_loc tables_to_lock->m_tabledef.table_def::~table_def(); tables_to_lock->m_tabledef_valid= FALSE; } + + /* + If blob fields were used during conversion of field values + from the master table into the slave table, then we need to + free the memory used temporarily to store their values before + copying into the slave's table. + */ + if (tables_to_lock->m_conv_table) + free_blobs(tables_to_lock->m_conv_table); + tables_to_lock= static_cast(tables_to_lock->next_global); tables_to_lock_count--; === modified file 'sql/set_var.cc' --- a/sql/set_var.cc 2011-03-25 12:55:22 +0000 +++ b/sql/set_var.cc 2011-05-21 08:21:08 +0000 @@ -117,7 +117,8 @@ void sys_var_end() sys_var constructor @param chain variables are linked into chain for mysql_add_sys_var_chain() - @param name_arg the name of the variable. @sa my_option::name + @param name_arg the name of the variable. Must be 0-terminated and exist + for the liftime of the sys_var object. @sa my_option::name @param comment shown in mysqld --help, @sa my_option::comment @param flags_arg or'ed flag_enum values @param off offset of the global variable value from the @@ -164,8 +165,8 @@ sys_var::sys_var(sys_var_chain *chain, c */ DBUG_ASSERT(parse_flag == PARSE_NORMAL || getopt_id <= 0 || getopt_id >= 255); - name.str= name_arg; - name.length= strlen(name_arg); + name.str= name_arg; // ER_NO_DEFAULT relies on 0-termination of name_arg + name.length= strlen(name_arg); // and so does this. DBUG_ASSERT(name.length <= NAME_CHAR_LEN); bzero(&option, sizeof(option)); === modified file 'sql/sp_head.cc' --- a/sql/sp_head.cc 2011-04-15 13:46:11 +0000 +++ b/sql/sp_head.cc 2011-05-21 08:59:32 +0000 @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" @@ -1066,7 +1066,7 @@ void sp_head::recursion_level_error(THD if (m_type == TYPE_ENUM_PROCEDURE) { my_error(ER_SP_RECURSION_LIMIT, MYF(0), - thd->variables.max_sp_recursion_depth, + static_cast(thd->variables.max_sp_recursion_depth), m_name.str); } else === modified file 'sql/sql_acl.cc' --- a/sql/sql_acl.cc 2011-05-16 08:50:42 +0000 +++ b/sql/sql_acl.cc 2011-05-21 08:21:08 +0000 @@ -2275,13 +2275,12 @@ static int replace_user_table(THD *thd, */ else if (!password_len && !combo.plugin.length && no_auto_create) { - my_error(ER_PASSWORD_NO_MATCH, MYF(0), combo.user.str, combo.host.str); + my_error(ER_PASSWORD_NO_MATCH, MYF(0)); goto end; } else if (!can_create_user) { - my_error(ER_CANT_CREATE_USER_WITH_GRANT, MYF(0), - thd->security_ctx->user, thd->security_ctx->host_or_ip); + my_error(ER_CANT_CREATE_USER_WITH_GRANT, MYF(0)); goto end; } else if (combo.plugin.str[0]) @@ -2309,8 +2308,8 @@ static int replace_user_table(THD *thd, /* what == 'N' means revoke */ if (combo.plugin.length && what != 'N') { - my_error(ER_GRANT_PLUGIN_USER_EXISTS, MYF(0), combo.user.length, - combo.user.str); + my_error(ER_GRANT_PLUGIN_USER_EXISTS, MYF(0), + static_cast(combo.user.length), combo.user.str); goto end; } if (combo.password.str) // If password given @@ -8901,7 +8900,7 @@ err: if (mpvio->status == MPVIO_EXT::FAILURE) { inc_host_errors(mpvio->ip); - my_error(ER_HANDSHAKE_ERROR, MYF(0), mpvio->auth_info.host_or_ip); + my_error(ER_HANDSHAKE_ERROR, MYF(0)); } DBUG_RETURN(-1); } @@ -9487,7 +9486,7 @@ static int native_password_authenticate( } inc_host_errors(mpvio->ip); - my_error(ER_HANDSHAKE_ERROR, MYF(0), mpvio->auth_info.host_or_ip); + my_error(ER_HANDSHAKE_ERROR, MYF(0)); DBUG_RETURN(CR_ERROR); } @@ -9541,7 +9540,7 @@ static int old_password_authenticate(MYS } inc_host_errors(mpvio->ip); - my_error(ER_HANDSHAKE_ERROR, MYF(0), mpvio->auth_info.host_or_ip); + my_error(ER_HANDSHAKE_ERROR, MYF(0)); return CR_ERROR; } === modified file 'sql/sql_base.cc' --- a/sql/sql_base.cc 2011-05-06 08:27:04 +0000 +++ b/sql/sql_base.cc 2011-05-21 08:21:08 +0000 @@ -3854,7 +3854,7 @@ static bool auto_repair_table(THD *thd, { /* Give right error message */ thd->clear_error(); - my_error(ER_NOT_KEYFILE, MYF(0), share->table_name.str, my_errno); + my_error(ER_NOT_KEYFILE, MYF(0), share->table_name.str); sql_print_error("Couldn't repair table: %s.%s", share->db.str, share->table_name.str); if (entry->file) @@ -7921,7 +7921,7 @@ bool setup_tables(THD *thd, Name_resolut } if (tablenr > MAX_TABLES) { - my_error(ER_TOO_MANY_TABLES,MYF(0),MAX_TABLES); + my_error(ER_TOO_MANY_TABLES,MYF(0), static_cast(MAX_TABLES)); DBUG_RETURN(1); } for (table_list= tables; === modified file 'sql/sql_binlog.cc' --- a/sql/sql_binlog.cc 2010-11-28 10:06:02 +0000 +++ b/sql/sql_binlog.cc 2011-05-21 08:21:08 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2006 MySQL AB +/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -242,7 +242,7 @@ void mysql_client_binlog_statement(THD* TODO: Maybe a better error message since the BINLOG statement now contains several events. */ - my_error(ER_UNKNOWN_ERROR, MYF(0), "Error executing BINLOG statement"); + my_error(ER_UNKNOWN_ERROR, MYF(0)); goto end; } } === modified file 'sql/sql_class.cc' --- a/sql/sql_class.cc 2011-05-20 09:18:36 +0000 +++ b/sql/sql_class.cc 2011-05-21 09:29:10 +0000 @@ -11,7 +11,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + /***************************************************************************** ** @@ -2456,7 +2457,7 @@ bool select_export::send_data(List ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), "string", printable_buff, - item->name, row_count); + item->name, static_cast(row_count)); } else if (from_end_pos < res->ptr() + res->length()) { @@ -2465,7 +2466,7 @@ bool select_export::send_data(List */ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED), - item->full_name(), row_count); + item->full_name(), static_cast(row_count)); } cvt_str.length(bytes); res= &cvt_str; === modified file 'sql/sql_connect.cc' --- a/sql/sql_connect.cc 2011-05-12 12:29:32 +0000 +++ b/sql/sql_connect.cc 2011-05-21 08:59:32 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,8 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Functions to autenticate and handle reqests for a connection @@ -466,7 +465,7 @@ static int check_connection(THD *thd) if (vio_peer_addr(net->vio, ip, &thd->peer_port, NI_MAXHOST)) { - my_error(ER_BAD_HOST_ERROR, MYF(0), thd->main_security_ctx.host_or_ip); + my_error(ER_BAD_HOST_ERROR, MYF(0)); return 1; } if (!(thd->main_security_ctx.ip= my_strdup(ip,MYF(MY_WME)))) @@ -477,7 +476,7 @@ static int check_connection(THD *thd) if (ip_to_hostname(&net->vio->remote, thd->main_security_ctx.ip, &thd->main_security_ctx.host, &connect_errors)) { - my_error(ER_BAD_HOST_ERROR, MYF(0), ip); + my_error(ER_BAD_HOST_ERROR, MYF(0)); return 1; } === modified file 'sql/sql_insert.cc' --- a/sql/sql_insert.cc 2011-01-31 13:11:05 +0000 +++ b/sql/sql_insert.cc 2011-05-21 08:21:08 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,8 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Insert of records */ @@ -3889,7 +3888,7 @@ select_create::prepare(List &value if (table->s->fields < values.elements) { - my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1); + my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1L); DBUG_RETURN(-1); } === modified file 'sql/sql_parse.cc' --- a/sql/sql_parse.cc 2011-05-06 08:27:04 +0000 +++ b/sql/sql_parse.cc 2011-05-21 08:21:08 +0000 @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #define MYSQL_LEX 1 #include "my_global.h" @@ -3412,8 +3412,7 @@ end_with_restore_list: hostname_requires_resolving(user->host.str)) push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_HOSTNAME_WONT_WORK, - ER(ER_WARN_HOSTNAME_WONT_WORK), - user->host.str); + ER(ER_WARN_HOSTNAME_WONT_WORK)); // Are we trying to change a password of another user DBUG_ASSERT(user->host.str != 0); @@ -5305,7 +5304,7 @@ mysql_new_select(LEX *lex, bool move_dow lex->nest_level++; if (lex->nest_level > (int) MAX_SELECT_NESTING) { - my_error(ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT,MYF(0),MAX_SELECT_NESTING); + my_error(ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT, MYF(0)); DBUG_RETURN(1); } select_lex->nest_level= lex->nest_level; === modified file 'sql/sql_partition.cc' --- a/sql/sql_partition.cc 2011-05-06 08:53:42 +0000 +++ b/sql/sql_partition.cc 2011-05-21 08:21:08 +0000 @@ -7024,7 +7024,7 @@ void set_key_field_ptr(KEY *key_info, co void mem_alloc_error(size_t size) { - my_error(ER_OUTOFMEMORY, MYF(0), size); + my_error(ER_OUTOFMEMORY, MYF(0), static_cast(size)); } #ifdef WITH_PARTITION_STORAGE_ENGINE === modified file 'sql/sql_plugin.cc' --- a/sql/sql_plugin.cc 2010-12-02 07:16:26 +0000 +++ b/sql/sql_plugin.cc 2011-05-21 08:21:08 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB, 2009 Sun Microsystems, Inc. +/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "sql_priv.h" // SHOW_MY_BOOL #include "unireg.h" @@ -548,7 +548,8 @@ static st_plugin_dl *plugin_dl_add(const if (!cur) { free_plugin_mem(&plugin_dl); - report_error(report, ER_OUTOFMEMORY, plugin_dl.dl.length); + report_error(report, ER_OUTOFMEMORY, + static_cast(plugin_dl.dl.length)); DBUG_RETURN(0); } /* @@ -570,7 +571,8 @@ static st_plugin_dl *plugin_dl_add(const if (! (plugin_dl.dl.str= (char*) my_malloc(plugin_dl.dl.length, MYF(0)))) { free_plugin_mem(&plugin_dl); - report_error(report, ER_OUTOFMEMORY, plugin_dl.dl.length); + report_error(report, ER_OUTOFMEMORY, + static_cast(plugin_dl.dl.length)); DBUG_RETURN(0); } plugin_dl.dl.length= copy_and_convert(plugin_dl.dl.str, plugin_dl.dl.length, @@ -581,7 +583,8 @@ static st_plugin_dl *plugin_dl_add(const if (! (tmp= plugin_dl_insert_or_reuse(&plugin_dl))) { free_plugin_mem(&plugin_dl); - report_error(report, ER_OUTOFMEMORY, sizeof(struct st_plugin_dl)); + report_error(report, ER_OUTOFMEMORY, + static_cast(sizeof(struct st_plugin_dl))); DBUG_RETURN(0); } DBUG_RETURN(tmp); === modified file 'sql/sql_prepare.cc' --- a/sql/sql_prepare.cc 2011-04-20 13:15:47 +0000 +++ b/sql/sql_prepare.cc 2011-05-21 08:59:32 +0000 @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** @file @@ -1467,7 +1467,7 @@ static int mysql_test_select(Prepared_st if (!lex->result && !(lex->result= new (stmt->mem_root) select_send)) { - my_error(ER_OUTOFMEMORY, MYF(0), sizeof(select_send)); + my_error(ER_OUTOFMEMORY, MYF(0), static_cast(sizeof(select_send))); goto error; } @@ -2543,7 +2543,7 @@ void mysqld_stmt_execute(THD *thd, char if (!(stmt= find_prepared_statement(thd, stmt_id))) { char llbuf[22]; - my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf), + my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast(sizeof(llbuf)), llstr(stmt_id, llbuf), "mysqld_stmt_execute"); DBUG_VOID_RETURN; } @@ -2597,7 +2597,7 @@ void mysql_sql_stmt_execute(THD *thd) if (!(stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name))) { my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), - name->length, name->str, "EXECUTE"); + static_cast(name->length), name->str, "EXECUTE"); DBUG_VOID_RETURN; } @@ -2639,7 +2639,7 @@ void mysqld_stmt_fetch(THD *thd, char *p if (!(stmt= find_prepared_statement(thd, stmt_id))) { char llbuf[22]; - my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf), + my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast(sizeof(llbuf)), llstr(stmt_id, llbuf), "mysqld_stmt_fetch"); DBUG_VOID_RETURN; } @@ -2699,7 +2699,7 @@ void mysqld_stmt_reset(THD *thd, char *p if (!(stmt= find_prepared_statement(thd, stmt_id))) { char llbuf[22]; - my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf), + my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast(sizeof(llbuf)), llstr(stmt_id, llbuf), "mysqld_stmt_reset"); DBUG_VOID_RETURN; } @@ -2774,7 +2774,7 @@ void mysql_sql_stmt_close(THD *thd) if (! (stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name))) my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), - name->length, name->str, "DEALLOCATE PREPARE"); + static_cast(name->length), name->str, "DEALLOCATE PREPARE"); else if (stmt->is_in_use()) my_error(ER_PS_NO_RECURSION, MYF(0)); else === modified file 'sql/sql_reload.cc' --- a/sql/sql_reload.cc 2011-03-07 09:08:10 +0000 +++ b/sql/sql_reload.cc 2011-05-21 08:21:08 +0000 @@ -86,7 +86,7 @@ bool reload_acl_and_cache(THD *thd, unsi When an error is returned, my_message may have not been called and the client will hang waiting for a response. */ - my_error(ER_UNKNOWN_ERROR, MYF(0), "FLUSH PRIVILEGES failed"); + my_error(ER_UNKNOWN_ERROR, MYF(0)); } } === modified file 'sql/sql_repl.cc' --- a/sql/sql_repl.cc 2011-02-16 16:27:35 +0000 +++ b/sql/sql_repl.cc 2011-05-21 08:21:08 +0000 @@ -1490,7 +1490,7 @@ bool change_master(THD* thd, Master_info get_dynamic(&lex_mi->repl_ignore_server_ids, (uchar*) &s_id, i); if (s_id == ::server_id && replicate_same_server_id) { - my_error(ER_SLAVE_IGNORE_SERVER_IDS, MYF(0), s_id); + my_error(ER_SLAVE_IGNORE_SERVER_IDS, MYF(0), static_cast(s_id)); ret= TRUE; goto err; } === modified file 'sql/sql_show.cc' --- a/sql/sql_show.cc 2011-04-15 12:02:22 +0000 +++ b/sql/sql_show.cc 2011-05-21 09:29:10 +0000 @@ -2407,12 +2407,11 @@ bool schema_table_store_record(THD *thd, } -int make_table_list(THD *thd, SELECT_LEX *sel, - LEX_STRING *db_name, LEX_STRING *table_name) +static int make_table_list(THD *thd, SELECT_LEX *sel, + LEX_STRING *db_name, LEX_STRING *table_name) { Table_ident *table_ident; table_ident= new Table_ident(thd, *db_name, *table_name, 1); - sel->init_query(); if (!sel->add_table_to_list(thd, table_ident, 0, 0, TL_READ, MDL_SHARED_READ)) return 1; return 0; @@ -2982,91 +2981,190 @@ make_table_name_list(THD *thd, Listlex; - bool res; - LEX_STRING tmp_lex_string, tmp_lex_string1, *db_name, *table_name; - enum_sql_command save_sql_command= lex->sql_command; - TABLE_LIST *show_table_list= tables->schema_select_lex->table_list.first; - TABLE *table= tables->table; - int error= 1; - DBUG_ENTER("fill_schema_show"); + Query_arena i_s_arena(thd->mem_root, + Query_arena::STMT_CONVENTIONAL_EXECUTION), + backup_arena, *old_arena; + LEX *old_lex= thd->lex, temp_lex, *lex; + LEX_STRING db_name, table_name; + TABLE_LIST *table_list; + bool result= true; + + DBUG_ENTER("fill_schema_table_by_open"); + /* + When a view is opened its structures are allocated on a permanent + statement arena and linked into the LEX tree for the current statement + (this happens even in cases when view is handled through TEMPTABLE + algorithm). + + To prevent this process from unnecessary hogging of memory in the permanent + arena of our I_S query and to avoid damaging its LEX we use temporary + arena and LEX for table/view opening. + + Use temporary arena instead of statement permanent arena. Also make + it active arena and save original one for successive restoring. + */ + old_arena= thd->stmt_arena; + thd->stmt_arena= &i_s_arena; + thd->set_n_backup_active_arena(&i_s_arena, &backup_arena); + + /* Prepare temporary LEX. */ + thd->lex= lex= &temp_lex; + lex_start(thd); + + /* Disable constant subquery evaluation as we won't be locking tables. */ + lex->context_analysis_only= CONTEXT_ANALYSIS_ONLY_VIEW; + + /* + Some of process_table() functions rely on wildcard being passed from + old LEX (or at least being initialized). + */ + lex->wild= old_lex->wild; + + /* + Since make_table_list() might change database and table name passed + to it we create copies of orig_db_name and orig_table_name here. + These copies are used for make_table_list() while unaltered values + are passed to process_table() functions. + */ + if (!thd->make_lex_string(&db_name, orig_db_name->str, + orig_db_name->length, FALSE) || + !thd->make_lex_string(&table_name, orig_table_name->str, + orig_table_name->length, FALSE)) + goto end; - lex->all_selects_list= tables->schema_select_lex; /* - Restore thd->temporary_tables to be able to process - temporary tables(only for 'show index' & 'show columns'). - This should be changed when processing of temporary tables for - I_S tables will be done. + Create table list element for table to be open. Link it with the + temporary LEX. The latter is required to correctly open views and + produce table describing their structure. */ - thd->temporary_tables= open_tables_state_backup->temporary_tables; + if (make_table_list(thd, &lex->select_lex, &db_name, &table_name)) + goto end; + + table_list= lex->select_lex.table_list.first; + + if (is_show_fields_or_keys) + { + /* + Restore thd->temporary_tables to be able to process + temporary tables (only for 'show index' & 'show columns'). + This should be changed when processing of temporary tables for + I_S tables will be done. + */ + thd->temporary_tables= open_tables_state_backup->temporary_tables; + } + else + { + /* + Apply optimization flags for table opening which are relevant for + this I_S table. We can't do this for SHOW COLUMNS/KEYS because of + backward compatibility. + */ + table_list->i_s_requested_object= schema_table->i_s_requested_object; + } + /* Let us set fake sql_command so views won't try to merge themselves into main statement. If we don't do this, SELECT * from information_schema.xxxx will cause problems. - SQLCOM_SHOW_FIELDS is used because it satisfies 'only_view_structure()' + SQLCOM_SHOW_FIELDS is used because it satisfies + 'only_view_structure()'. */ lex->sql_command= SQLCOM_SHOW_FIELDS; - res= open_normal_and_derived_tables(thd, show_table_list, - (MYSQL_OPEN_IGNORE_FLUSH | - MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL | - (can_deadlock ? - MYSQL_OPEN_FAIL_ON_MDL_CONFLICT : 0))); - lex->sql_command= save_sql_command; + result= open_normal_and_derived_tables(thd, table_list, + (MYSQL_OPEN_IGNORE_FLUSH | + MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL | + (can_deadlock ? + MYSQL_OPEN_FAIL_ON_MDL_CONFLICT : 0))); + /* + Restore old value of sql_command back as it is being looked at in + process_table() function. + */ + lex->sql_command= old_lex->sql_command; DEBUG_SYNC(thd, "after_open_table_ignore_flush"); /* - get_all_tables() returns 1 on failure and 0 on success thus - return only these and not the result code of ::process_table() + XXX: show_table_list has a flag i_is_requested, + and when it's set, open_normal_and_derived_tables() + can return an error without setting an error message + in THD, which is a hack. This is why we have to + check for res, then for thd->is_error() and only then + for thd->main_da.sql_errno(). - We should use show_table_list->alias instead of - show_table_list->table_name because table_name - could be changed during opening of I_S tables. It's safe - to use alias because alias contains original table name - in this case(this part of code is used only for - 'show columns' & 'show statistics' commands). + Again we don't do this for SHOW COLUMNS/KEYS because + of backward compatibility. */ - table_name= thd->make_lex_string(&tmp_lex_string1, show_table_list->alias, - strlen(show_table_list->alias), FALSE); - if (!show_table_list->view) - db_name= thd->make_lex_string(&tmp_lex_string, show_table_list->db, - show_table_list->db_length, FALSE); - else - db_name= &show_table_list->view_db; - - - error= test(schema_table->process_table(thd, show_table_list, - table, res, db_name, - table_name)); - thd->temporary_tables= 0; - close_tables_for_reopen(thd, &show_table_list, - open_tables_state_backup->mdl_system_tables_svp); - DBUG_RETURN(error); + if (!is_show_fields_or_keys && result && thd->is_error() && + thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE) + { + /* + Hide error for a non-existing table. + For example, this error can occur when we use a where condition + with a db name and table, but the table does not exist. + */ + result= false; + thd->clear_error(); + } + else + { + result= schema_table->process_table(thd, table_list, + table, result, + orig_db_name, + orig_table_name); + } + + +end: + lex->unit.cleanup(); + + /* Restore original LEX value, statement's arena and THD arena values. */ + lex_end(thd->lex); + + if (i_s_arena.free_list) + i_s_arena.free_items(); + + /* + For safety reset list of open temporary tables before closing + all tables open within this Open_tables_state. + */ + thd->temporary_tables= NULL; + close_thread_tables(thd); + thd->mdl_context.rollback_to_savepoint(open_tables_state_backup->mdl_system_tables_svp); + + thd->lex= old_lex; + + thd->stmt_arena= old_arena; + thd->restore_active_arena(&i_s_arena, &backup_arena); + + DBUG_RETURN(result); } @@ -3477,10 +3575,8 @@ int get_all_tables(THD *thd, TABLE_LIST { LEX *lex= thd->lex; TABLE *table= tables->table; - SELECT_LEX *old_all_select_lex= lex->all_selects_list; SELECT_LEX *lsel= tables->schema_select_lex; ST_SCHEMA_TABLE *schema_table= tables->schema_table; - SELECT_LEX sel; LOOKUP_FIELD_VALUES lookup_field_vals; LEX_STRING *db_name, *table_name; bool with_i_schema; @@ -3488,11 +3584,8 @@ int get_all_tables(THD *thd, TABLE_LIST List db_names; List_iterator_fast it(db_names); COND *partial_cond= 0; - uint derived_tables= lex->derived_tables; int error= 1; Open_tables_backup open_tables_state_backup; - uint8 save_context_analysis_only= lex->context_analysis_only; - Query_tables_list query_tables_list_backup; #ifndef NO_EMBEDDED_ACCESS_CHECKS Security_context *sctx= thd->security_ctx; #endif @@ -3511,15 +3604,6 @@ int get_all_tables(THD *thd, TABLE_LIST */ can_deadlock= thd->mdl_context.has_locks(); - lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VIEW; - lex->reset_n_backup_query_tables_list(&query_tables_list_backup); - /* - Restore Query_tables_list::sql_command value, which was reset - above, as ST_SCHEMA_TABLE::process_table() functions often rely - that this value reflects which SHOW statement is executed. - */ - lex->sql_command= query_tables_list_backup.sql_command; - /* We should not introduce deadlocks even if we already have some tables open and locked, since we won't lock tables which we will @@ -3539,9 +3623,19 @@ int get_all_tables(THD *thd, TABLE_LIST */ if (lsel && lsel->table_list.first) { - error= fill_schema_show_cols_or_idxs(thd, tables, schema_table, - can_deadlock, - &open_tables_state_backup); + LEX_STRING db_name, table_name; + + db_name.str= lsel->table_list.first->db; + db_name.length= lsel->table_list.first->db_length; + + table_name.str= lsel->table_list.first->table_name; + table_name.length= lsel->table_list.first->table_name_length; + + error= fill_schema_table_by_open(thd, TRUE, + table, schema_table, + &db_name, &table_name, + &open_tables_state_backup, + can_deadlock); goto err; } @@ -3595,12 +3689,6 @@ int get_all_tables(THD *thd, TABLE_LIST it.rewind(); /* To get access to new elements in basis list */ while ((db_name= it++)) { - LEX_STRING orig_db_name; - - /* db_name can be changed in make_table_list() func */ - if (!thd->make_lex_string(&orig_db_name, db_name->str, - db_name->length, FALSE)) - goto err; #ifndef NO_EMBEDDED_ACCESS_CHECKS if (!(check_access(thd, SELECT_ACL, db_name->str, &thd->col_access, NULL, 0, 1) || @@ -3678,66 +3766,11 @@ int get_all_tables(THD *thd, TABLE_LIST continue; } - int res; - LEX_STRING tmp_lex_string; - /* - Set the parent lex of 'sel' because it is needed by - sel.init_query() which is called inside make_table_list. - */ - sel.parent_lex= lex; - if (make_table_list(thd, &sel, db_name, table_name)) - goto err; - TABLE_LIST *show_table_list= sel.table_list.first; - lex->all_selects_list= &sel; - lex->derived_tables= 0; - lex->sql_command= SQLCOM_SHOW_FIELDS; - show_table_list->i_s_requested_object= - schema_table->i_s_requested_object; - DEBUG_SYNC(thd, "before_open_in_get_all_tables"); - res= open_normal_and_derived_tables(thd, show_table_list, - (MYSQL_OPEN_IGNORE_FLUSH | - MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL | - (can_deadlock ? MYSQL_OPEN_FAIL_ON_MDL_CONFLICT : 0))); - lex->sql_command= query_tables_list_backup.sql_command; - /* - XXX: show_table_list has a flag i_is_requested, - and when it's set, open_normal_and_derived_tables() - can return an error without setting an error message - in THD, which is a hack. This is why we have to - check for res, then for thd->is_error() only then - for thd->stmt_da->sql_errno(). - */ - if (res && thd->is_error() && - thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE) - { - /* - Hide error for not existing table. - This error can occur for example when we use - where condition with db name and table name and this - table does not exist. - */ - res= 0; - thd->clear_error(); - } - else - { - /* - We should use show_table_list->alias instead of - show_table_list->table_name because table_name - could be changed during opening of I_S tables. It's safe - to use alias because alias contains original table name - in this case. - */ - thd->make_lex_string(&tmp_lex_string, show_table_list->alias, - strlen(show_table_list->alias), FALSE); - res= schema_table->process_table(thd, show_table_list, table, - res, &orig_db_name, - &tmp_lex_string); - close_tables_for_reopen(thd, &show_table_list, - open_tables_state_backup.mdl_system_tables_svp); - } - DBUG_ASSERT(!lex->query_tables_own_last); - if (res) + if (fill_schema_table_by_open(thd, FALSE, + table, schema_table, + db_name, table_name, + &open_tables_state_backup, + can_deadlock)) goto err; } } @@ -3753,10 +3786,7 @@ int get_all_tables(THD *thd, TABLE_LIST error= 0; err: thd->restore_backup_open_tables_state(&open_tables_state_backup); - lex->restore_backup_query_tables_list(&query_tables_list_backup); - lex->derived_tables= derived_tables; - lex->all_selects_list= old_all_select_lex; - lex->context_analysis_only= save_context_analysis_only; + DBUG_RETURN(error); } === modified file 'sql/sql_table.cc' --- a/sql/sql_table.cc 2011-05-06 08:27:04 +0000 +++ b/sql/sql_table.cc 2011-05-21 08:21:08 +0000 @@ -2618,7 +2618,8 @@ int prepare_create_field(Create_field *s MAX_FIELD_CHARLENGTH) { my_printf_error(ER_TOO_BIG_FIELDLENGTH, ER(ER_TOO_BIG_FIELDLENGTH), - MYF(0), sql_field->field_name, MAX_FIELD_CHARLENGTH); + MYF(0), sql_field->field_name, + static_cast(MAX_FIELD_CHARLENGTH)); DBUG_RETURN(1); } } @@ -3614,12 +3615,12 @@ mysql_prepare_create_table(THD *thd, HA_ (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) { my_error(ER_TOO_LONG_INDEX_COMMENT, MYF(0), - key_info->name, (uint) INDEX_COMMENT_MAXLEN); + key_info->name, static_cast(INDEX_COMMENT_MAXLEN)); DBUG_RETURN(-1); } char warn_buff[MYSQL_ERRMSG_SIZE]; my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_INDEX_COMMENT), - key_info->name, (uint) INDEX_COMMENT_MAXLEN); + key_info->name, static_cast(INDEX_COMMENT_MAXLEN)); /* do not push duplicate warnings */ if (!check_duplicate_warning(thd, warn_buff, strlen(warn_buff))) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, @@ -3747,7 +3748,8 @@ static bool prepare_blob_field(THD *thd, MODE_STRICT_ALL_TABLES))) { my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), sql_field->field_name, - MAX_FIELD_VARCHARLENGTH / sql_field->charset->mbmaxlen); + static_cast(MAX_FIELD_VARCHARLENGTH / + sql_field->charset->mbmaxlen)); DBUG_RETURN(1); } sql_field->sql_type= MYSQL_TYPE_BLOB; === modified file 'sql/sys_vars.cc' --- a/sql/sys_vars.cc 2011-03-25 12:55:22 +0000 +++ b/sql/sys_vars.cc 2011-05-21 08:21:08 +0000 @@ -695,7 +695,7 @@ static bool event_scheduler_update(sys_v : Events::stop(); mysql_mutex_lock(&LOCK_global_system_variables); if (ret) - my_error(ER_EVENT_SET_VAR_ERROR, MYF(0)); + my_error(ER_EVENT_SET_VAR_ERROR, MYF(0), 0); return ret; } @@ -2504,7 +2504,7 @@ static bool update_last_insert_id(THD *t { if (!var->value) { - my_error(ER_NO_DEFAULT, MYF(0), var->var->name); + my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str); return true; } thd->first_successful_insert_id_in_prev_stmt= @@ -2553,7 +2553,7 @@ static bool update_insert_id(THD *thd, s { if (!var->value) { - my_error(ER_NO_DEFAULT, MYF(0), var->var->name); + my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str); return true; } thd->force_one_auto_inc_interval(var->save_result.ulonglong_value); @@ -2576,7 +2576,7 @@ static bool update_rand_seed1(THD *thd, { if (!var->value) { - my_error(ER_NO_DEFAULT, MYF(0), var->var->name); + my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str); return true; } thd->rand.seed1= (ulong) var->save_result.ulonglong_value; @@ -2598,7 +2598,7 @@ static bool update_rand_seed2(THD *thd, { if (!var->value) { - my_error(ER_NO_DEFAULT, MYF(0), var->var->name); + my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str); return true; } thd->rand.seed2= (ulong) var->save_result.ulonglong_value; === modified file 'sql/table.cc' --- a/sql/table.cc 2011-04-15 13:46:11 +0000 +++ b/sql/table.cc 2011-05-23 23:33:55 +0000 @@ -2189,7 +2189,15 @@ void free_blobs(register TABLE *table) for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ; ptr != end ; ptr++) - ((Field_blob*) table->field[*ptr])->free(); + { + /* + Reduced TABLE objects which are used by row-based replication for + type conversion might have some fields missing. Skip freeing BLOB + buffers for such missing fields. + */ + if (table->field[*ptr]) + ((Field_blob*) table->field[*ptr])->free(); + } } @@ -2423,7 +2431,7 @@ void open_table_error(TABLE_SHARE *share default: /* Better wrong error than none */ case 4: strxmov(buff, share->normalized_path.str, reg_ext, NullS); - my_error(ER_NOT_FORM_FILE, errortype, buff, 0); + my_error(ER_NOT_FORM_FILE, errortype, buff); break; } DBUG_VOID_RETURN; @@ -3010,7 +3018,8 @@ Table_check_intact::check(TABLE *table, report_error(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE, ER(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE), table->alias, table_def->count, table->s->fields, - table->s->mysql_version, MYSQL_VERSION_ID); + static_cast(table->s->mysql_version), + MYSQL_VERSION_ID); DBUG_RETURN(TRUE); } else if (MYSQL_VERSION_ID == table->s->mysql_version) === modified file 'sql/unireg.cc' --- a/sql/unireg.cc 2011-03-04 08:41:29 +0000 +++ b/sql/unireg.cc 2011-05-21 08:21:08 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,8 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Functions to create a unireg form-file from a FIELD and a fieldname-fieldinfo @@ -230,13 +229,13 @@ bool mysql_create_frm(THD *thd, const ch (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) { my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0), - real_table_name, (uint) TABLE_COMMENT_MAXLEN); + real_table_name, static_cast(TABLE_COMMENT_MAXLEN)); my_free(screen_buff); DBUG_RETURN(1); } char warn_buff[MYSQL_ERRMSG_SIZE]; my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_TABLE_COMMENT), - real_table_name, (uint) TABLE_COMMENT_MAXLEN); + real_table_name, static_cast(TABLE_COMMENT_MAXLEN)); /* do not push duplicate warnings */ if (!check_duplicate_warning(current_thd, warn_buff, strlen(warn_buff))) push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, @@ -737,13 +736,14 @@ static bool pack_header(uchar *forminfo, if ((current_thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) { - my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0), - field->field_name, (uint) COLUMN_COMMENT_MAXLEN); + my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0), field->field_name, + static_cast(COLUMN_COMMENT_MAXLEN)); DBUG_RETURN(1); } char warn_buff[MYSQL_ERRMSG_SIZE]; my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_FIELD_COMMENT), - field->field_name, (uint) COLUMN_COMMENT_MAXLEN); + field->field_name, + static_cast(COLUMN_COMMENT_MAXLEN)); /* do not push duplicate warnings */ if (!check_duplicate_warning(current_thd, warn_buff, strlen(warn_buff))) push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, @@ -831,7 +831,7 @@ static bool pack_header(uchar *forminfo, if (reclength > (ulong) file->max_record_length()) { - my_error(ER_TOO_BIG_ROWSIZE, MYF(0), (uint) file->max_record_length()); + my_error(ER_TOO_BIG_ROWSIZE, MYF(0), static_cast(file->max_record_length())); DBUG_RETURN(1); } /* Hack to avoid bugs with small static rows in MySQL */ === modified file 'storage/example/ha_example.cc' --- a/storage/example/ha_example.cc 2010-10-06 14:34:28 +0000 +++ b/storage/example/ha_example.cc 2011-05-21 08:21:08 +0000 @@ -984,7 +984,7 @@ static int show_func_example(MYSQL_THD t var->type= SHOW_CHAR; var->value= buf; // it's of SHOW_VAR_FUNC_BUFF_SIZE bytes my_snprintf(buf, SHOW_VAR_FUNC_BUFF_SIZE, - "enum_var is %u, ulong_var is %lu, %.6b", // %b is MySQL extension + "enum_var is %lu, ulong_var is %lu, %.6b", // %b is MySQL extension srv_enum_var, srv_ulong_var, "really"); return 0; } === modified file 'storage/innobase/btr/btr0cur.c' --- a/storage/innobase/btr/btr0cur.c 2011-05-04 09:08:07 +0000 +++ b/storage/innobase/btr/btr0cur.c 2011-05-24 08:41:31 +0000 @@ -3264,9 +3264,14 @@ btr_estimate_n_rows_in_range_on_level( mtr_start(&mtr); - /* fetch the page */ - block = buf_page_get(space, zip_size, page_no, RW_S_LATCH, - &mtr); + /* Fetch the page. Because we are not holding the + index->lock, the tree may have changed and we may be + attempting to read a page that is no longer part of + the B-tree. We pass BUF_GET_POSSIBLY_FREED in order to + silence a debug assertion about this. */ + block = buf_page_get_gen(space, zip_size, page_no, RW_S_LATCH, + NULL, BUF_GET_POSSIBLY_FREED, + __FILE__, __LINE__, &mtr); page = buf_block_get_frame(block); @@ -3285,6 +3290,13 @@ btr_estimate_n_rows_in_range_on_level( goto inexact; } + /* It is possible but highly unlikely that the page was + originally written by an old version of InnoDB that did + not initialize FIL_PAGE_TYPE on other than B-tree pages. + For example, this could be an almost-empty BLOB page + that happens to contain the magic values in the fields + that we checked above. */ + n_pages_read++; if (page_no != slot1->page_no) { === modified file 'storage/innobase/buf/buf0buf.c' --- a/storage/innobase/buf/buf0buf.c 2011-04-15 13:46:11 +0000 +++ b/storage/innobase/buf/buf0buf.c 2011-05-24 08:41:31 +0000 @@ -2747,6 +2747,7 @@ buf_page_get_gen( case BUF_GET_IF_IN_POOL: case BUF_PEEK_IF_IN_POOL: case BUF_GET_IF_IN_POOL_OR_WATCH: + case BUF_GET_POSSIBLY_FREED: break; default: ut_error; @@ -3062,7 +3063,10 @@ wait_until_unfixed: #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ buf_block_buf_fix_inc(block, file, line); - +#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG + ut_a(mode == BUF_GET_POSSIBLY_FREED + || !block->page.file_page_was_freed); +#endif mutex_exit(&block->mutex); /* Check if this is the first access to the page */ @@ -3075,10 +3079,6 @@ wait_until_unfixed: buf_page_set_accessed_make_young(&block->page, access_time); } -#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG - ut_a(!block->page.file_page_was_freed); -#endif - #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG ut_a(++buf_dbg_counter % 5771 || buf_validate()); ut_a(block->page.buf_fix_count > 0); === modified file 'storage/innobase/dict/dict0crea.c' --- a/storage/innobase/dict/dict0crea.c 2010-11-03 09:25:14 +0000 +++ b/storage/innobase/dict/dict0crea.c 2011-05-09 08:12:26 +0000 @@ -659,9 +659,9 @@ dict_create_index_tree_step( /* printf("Created a new index tree in space %lu root page %lu\n", index->space, index->page_no); */ - page_rec_write_index_page_no(btr_pcur_get_rec(&pcur), - DICT_SYS_INDEXES_PAGE_NO_FIELD, - node->page_no, &mtr); + page_rec_write_field(btr_pcur_get_rec(&pcur), + DICT_SYS_INDEXES_PAGE_NO_FIELD, + node->page_no, &mtr); btr_pcur_close(&pcur); mtr_commit(&mtr); @@ -731,9 +731,8 @@ dict_drop_index_tree( root_page_no); */ btr_free_root(space, zip_size, root_page_no, mtr); - page_rec_write_index_page_no(rec, - DICT_SYS_INDEXES_PAGE_NO_FIELD, - FIL_NULL, mtr); + page_rec_write_field(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, + FIL_NULL, mtr); } /*******************************************************************//** @@ -836,8 +835,8 @@ create: in SYS_INDEXES, so that the database will not get into an inconsistent state in case it crashes between the mtr_commit() below and the following mtr_commit() call. */ - page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, - FIL_NULL, mtr); + page_rec_write_field(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, + FIL_NULL, mtr); /* We will need to commit the mini-transaction in order to avoid deadlocks in the btr_create() call, because otherwise we would === modified file 'storage/innobase/dict/dict0load.c' --- a/storage/innobase/dict/dict0load.c 2011-04-26 17:55:52 +0000 +++ b/storage/innobase/dict/dict0load.c 2011-05-04 10:47:30 +0000 @@ -429,7 +429,7 @@ dict_process_sys_fields_rec( mach_write_to_8(last_index_id, last_id); err_msg = dict_load_field_low(buf, NULL, sys_field, - pos, last_index_id, heap, rec); + pos, last_index_id, heap, rec, NULL, 0); *index_id = mach_read_from_8(buf); @@ -994,6 +994,9 @@ dict_load_columns( /** Error message for a delete-marked record in dict_load_field_low() */ static const char* dict_load_field_del = "delete-marked record in SYS_FIELDS"; +static const char* dict_load_field_too_big = "column prefix exceeds maximum" + " limit"; + /********************************************************************//** Loads an index field definition from a SYS_FIELDS record to dict_index_t. @@ -1015,7 +1018,12 @@ dict_load_field_low( byte* last_index_id, /*!< in: last index id */ mem_heap_t* heap, /*!< in/out: memory heap for temporary storage */ - const rec_t* rec) /*!< in: SYS_FIELDS record */ + const rec_t* rec, /*!< in: SYS_FIELDS record */ + char* addition_err_str,/*!< out: additional error message + that requires information to be + filled, or NULL */ + ulint err_str_len) /*!< in: length of addition_err_str + in bytes */ { const byte* field; ulint len; @@ -1095,6 +1103,19 @@ err_len: goto err_len; } + if (prefix_len >= DICT_MAX_INDEX_COL_LEN) { + if (addition_err_str) { + ut_snprintf(addition_err_str, err_str_len, + "index field '%s' has a prefix length" + " of %lu bytes", + mem_heap_strdupl( + heap, (const char*) field, len), + (ulong) prefix_len); + } + + return(dict_load_field_too_big); + } + if (index) { dict_mem_index_add_field( index, mem_heap_strdupl(heap, (const char*) field, len), @@ -1154,14 +1175,16 @@ dict_load_fields( btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr); for (i = 0; i < index->n_fields; i++) { - const char* err_msg; + const char* err_msg; + char addition_err_str[1024]; rec = btr_pcur_get_rec(&pcur); ut_a(btr_pcur_is_on_user_rec(&pcur)); err_msg = dict_load_field_low(buf, index, NULL, NULL, NULL, - heap, rec); + heap, rec, addition_err_str, + sizeof(addition_err_str)); if (err_msg == dict_load_field_del) { /* There could be delete marked records in @@ -1170,7 +1193,24 @@ dict_load_fields( goto next_rec; } else if (err_msg) { - fprintf(stderr, "InnoDB: %s\n", err_msg); + if (err_msg == dict_load_field_too_big) { + fprintf(stderr, "InnoDB: Error: load index" + " '%s' failed.\n" + "InnoDB: %s,\n" + "InnoDB: which exceeds the" + " maximum limit of %lu bytes.\n" + "InnoDB: Please use server that" + " supports long index prefix\n" + "InnoDB: or turn on" + " innodb_force_recovery to load" + " the table\n", + index->name, addition_err_str, + (ulong) (DICT_MAX_INDEX_COL_LEN - 1)); + + } else { + fprintf(stderr, "InnoDB: %s\n", err_msg); + } + error = DB_CORRUPTION; goto func_exit; } @@ -1446,7 +1486,26 @@ corrupted: of the database server */ dict_mem_index_free(index); } else { - dict_load_fields(index, heap); + error = dict_load_fields(index, heap); + + if (error != DB_SUCCESS) { + + fprintf(stderr, "InnoDB: Error: load index '%s'" + " for table '%s' failed\n", + index->name, table->name); + + /* If the force recovery flag is set, and + if the failed index is not the primary index, we + will continue and open other indexes */ + if (srv_force_recovery + && !dict_index_is_clust(index)) { + error = DB_SUCCESS; + goto next_rec; + } else { + goto func_exit; + } + } + error = dict_index_add_to_cache(table, index, index->page, FALSE); /* The data dictionary tables should never contain @@ -1771,9 +1830,18 @@ err_exit: } else { table->fk_max_recusive_level = 0; } - } else if (!srv_force_recovery) { - dict_table_remove_from_cache(table); - table = NULL; + } else { + dict_index_t* index; + + /* Make sure that at least the clustered index was loaded. + Otherwise refuse to load the table */ + index = dict_table_get_first_index(table); + + if (!srv_force_recovery || !index + || !dict_index_is_clust(index)) { + dict_table_remove_from_cache(table); + table = NULL; + } } #if 0 if (err != DB_SUCCESS && table != NULL) { === modified file 'storage/innobase/fil/fil0fil.c' --- a/storage/innobase/fil/fil0fil.c 2011-05-04 09:08:07 +0000 +++ b/storage/innobase/fil/fil0fil.c 2011-05-22 20:12:46 +0000 @@ -856,7 +856,8 @@ fil_node_close_file( ut_a(node->open); ut_a(node->n_pending == 0); ut_a(node->n_pending_flushes == 0); - ut_a(node->modification_counter == node->flush_counter); + ut_a(node->modification_counter == node->flush_counter + || srv_fast_shutdown == 2); ret = os_file_close(node->handle); ut_a(ret); === modified file 'storage/innobase/include/buf0buf.h' --- a/storage/innobase/include/buf0buf.h 2011-02-28 13:39:07 +0000 +++ b/storage/innobase/include/buf0buf.h 2011-05-24 08:41:31 +0000 @@ -53,6 +53,9 @@ Created 11/5/1995 Heikki Tuuri /*!< Get the page only if it's in the buffer pool, if not then set a watch on the page. */ +#define BUF_GET_POSSIBLY_FREED 16 + /*!< Like BUF_GET, but do not mind + if the file page has been freed. */ /* @} */ /** @name Modes for buf_page_get_known_nowait */ /* @{ */ === modified file 'storage/innobase/include/dict0load.h' --- a/storage/innobase/include/dict0load.h 2011-02-09 09:15:06 +0000 +++ b/storage/innobase/include/dict0load.h 2011-05-04 10:47:30 +0000 @@ -155,7 +155,12 @@ dict_load_field_low( byte* last_index_id, /*!< in: last index id */ mem_heap_t* heap, /*!< in/out: memory heap for temporary storage */ - const rec_t* rec); /*!< in: SYS_FIELDS record */ + const rec_t* rec, /*!< in: SYS_FIELDS record */ + char* addition_err_str,/*!< out: additional error message + that requires information to be + filled, or NULL */ + ulint err_str_len); /*!< in: length of addition_err_str + in bytes */ /********************************************************************//** Loads a table definition and also all its index definitions, and also the cluster definition if the table is a member in a cluster. Also loads === modified file 'storage/innobase/include/page0page.h' --- a/storage/innobase/include/page0page.h 2011-03-21 07:56:38 +0000 +++ b/storage/innobase/include/page0page.h 2011-05-09 08:12:26 +0000 @@ -619,17 +619,16 @@ page_rec_find_owner_rec( /*====================*/ rec_t* rec); /*!< in: the physical record */ /***********************************************************************//** -This is a low-level operation which is used in a database index creation -to update the page number of a created B-tree to a data dictionary -record. */ -UNIV_INTERN +Write a 32-bit field in a data dictionary record. */ +UNIV_INLINE void -page_rec_write_index_page_no( -/*=========================*/ - rec_t* rec, /*!< in: record to update */ +page_rec_write_field( +/*=================*/ + rec_t* rec, /*!< in/out: record to update */ ulint i, /*!< in: index of the field to update */ ulint page_no,/*!< in: value to write */ - mtr_t* mtr); /*!< in: mtr */ + mtr_t* mtr) /*!< in/out: mini-transaction */ + __attribute__((nonnull)); /************************************************************//** Returns the maximum combined size of records which can be inserted on top of record heap. === modified file 'storage/innobase/include/page0page.ic' --- a/storage/innobase/include/page0page.ic 2010-07-21 14:22:29 +0000 +++ b/storage/innobase/include/page0page.ic 2011-05-09 08:12:26 +0000 @@ -959,6 +959,27 @@ page_get_free_space_of_empty( - 2 * PAGE_DIR_SLOT_SIZE)); } +/***********************************************************************//** +Write a 32-bit field in a data dictionary record. */ +UNIV_INLINE +void +page_rec_write_field( +/*=================*/ + rec_t* rec, /*!< in/out: record to update */ + ulint i, /*!< in: index of the field to update */ + ulint val, /*!< in: value to write */ + mtr_t* mtr) /*!< in/out: mini-transaction */ +{ + byte* data; + ulint len; + + data = rec_get_nth_field_old(rec, i, &len); + + ut_ad(len == 4); + + mlog_write_ulint(data, val, MLOG_4BYTES, mtr); +} + /************************************************************//** Each user record on a page, and also the deleted user records in the heap takes its size plus the fraction of the dir cell size / === modified file 'storage/innobase/os/os0file.c' --- a/storage/innobase/os/os0file.c 2011-04-05 07:37:58 +0000 +++ b/storage/innobase/os/os0file.c 2011-05-04 07:09:48 +0000 @@ -4051,16 +4051,23 @@ os_aio_func( Windows async i/o, Windows does not allow us to use ordinary synchronous os_file_read etc. on the same file, therefore we have built a special mechanism for synchronous - wait in the Windows case. */ + wait in the Windows case. + Also note that the Performance Schema instrumentation has + been performed by current os_aio_func()'s wrapper function + pfs_os_aio_func(). So we would no longer need to call + Performance Schema instrumented os_file_read() and + os_file_write(). Instead, we should use os_file_read_func() + and os_file_write_func() */ if (type == OS_FILE_READ) { - return(os_file_read(file, buf, offset, + return(os_file_read_func(file, buf, offset, offset_high, n)); } ut_a(type == OS_FILE_WRITE); - return(os_file_write(name, file, buf, offset, offset_high, n)); + return(os_file_write_func(name, file, buf, offset, + offset_high, n)); } try_again: === modified file 'storage/innobase/page/page0page.c' --- a/storage/innobase/page/page0page.c 2011-03-21 07:56:38 +0000 +++ b/storage/innobase/page/page0page.c 2011-05-09 08:12:26 +0000 @@ -1253,28 +1253,6 @@ page_move_rec_list_start( return(TRUE); } - -/***********************************************************************//** -This is a low-level operation which is used in a database index creation -to update the page number of a created B-tree to a data dictionary record. */ -UNIV_INTERN -void -page_rec_write_index_page_no( -/*=========================*/ - rec_t* rec, /*!< in: record to update */ - ulint i, /*!< in: index of the field to update */ - ulint page_no,/*!< in: value to write */ - mtr_t* mtr) /*!< in: mtr */ -{ - byte* data; - ulint len; - - data = rec_get_nth_field_old(rec, i, &len); - - ut_ad(len == 4); - - mlog_write_ulint(data, page_no, MLOG_4BYTES, mtr); -} #endif /* !UNIV_HOTBACKUP */ /**************************************************************//** === modified file 'storage/innobase/row/row0mysql.c' --- a/storage/innobase/row/row0mysql.c 2011-05-04 09:08:07 +0000 +++ b/storage/innobase/row/row0mysql.c 2011-05-22 20:12:46 +0000 @@ -2941,7 +2941,7 @@ row_truncate_table_for_mysql( rec = btr_pcur_get_rec(&pcur); if (root_page_no != FIL_NULL) { - page_rec_write_index_page_no( + page_rec_write_field( rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, root_page_no, &mtr); /* We will need to commit and restart the === modified file 'storage/innobase/trx/trx0undo.c' --- a/storage/innobase/trx/trx0undo.c 2011-04-11 14:03:32 +0000 +++ b/storage/innobase/trx/trx0undo.c 2011-05-18 12:05:08 +0000 @@ -1985,8 +1985,6 @@ trx_undo_free_prepared( /*===================*/ trx_t* trx) /*!< in/out: PREPARED transaction */ { - mutex_enter(&trx->rseg->mutex); - ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS); if (trx->update_undo) { @@ -2001,6 +1999,5 @@ trx_undo_free_prepared( trx->insert_undo); trx_undo_mem_free(trx->insert_undo); } - mutex_exit(&trx->rseg->mutex); } #endif /* !UNIV_HOTBACKUP */ No bundle (reason: useless for push emails).