From 752cbab9a4c553871cab9e5fdb8968019617cc28 Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Fri, 27 Feb 2009 11:26:06 +0200 Subject: [PATCH 01/17] Fix for bug #40552: Race condition around default_directories in load_defaults() load_defaults(), my_search_option_files() and my_print_default_files() utilized a global variable containing a pointer to thread local memory. This could lead to race conditions when those functions were called with high concurrency. Fixed by changing the interface of the said functions to avoid the necessity for using a global variable. Since we cannot change load_defaults() prototype for API compatibility reasons, it was renamed my_load_defaults(). Now load_defaults() is a thread-unsafe wrapper around a thread-safe version, my_load_defaults(). --- include/my_sys.h | 7 +- mysys/default.c | 67 ++++++++++++++----- server-tools/instance-manager/instance_map.cc | 3 +- server-tools/instance-manager/options.cc | 4 +- server-tools/instance-manager/options.h | 3 + sql-common/client.c | 2 +- 6 files changed, 66 insertions(+), 20 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index 5335b65822f..180bfe0f07d 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -842,14 +842,17 @@ extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); extern int get_defaults_options(int argc, char **argv, char **defaults, char **extra_defaults, char **group_suffix); +extern int my_load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv, const char ***); extern int load_defaults(const char *conf_file, const char **groups, - int *argc, char ***argv); + int *argc, char ***argv); extern int modify_defaults_file(const char *file_location, const char *option, const char *option_value, const char *section_name, int remove_option); extern int my_search_option_files(const char *conf_file, int *argc, char ***argv, uint *args_used, - Process_option_func func, void *func_ctx); + Process_option_func func, void *func_ctx, + const char **default_directories); extern void free_defaults(char **argv); extern void my_print_default_files(const char *conf_file); extern void print_defaults(const char *conf_file, const char **groups); diff --git a/mysys/default.c b/mysys/default.c index 6b2b31d43ec..cdd9462c1d1 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -151,7 +151,7 @@ static char *remove_end_comment(char *ptr); int my_search_option_files(const char *conf_file, int *argc, char ***argv, uint *args_used, Process_option_func func, - void *func_ctx) + void *func_ctx, const char **default_directories) { const char **dirs, *forced_default_file, *forced_extra_defaults; int error= 0; @@ -359,9 +359,8 @@ int get_defaults_options(int argc, char **argv, return org_argc - argc; } - /* - Read options from configurations files + Wrapper around my_load_defaults() for interface compatibility. SYNOPSIS load_defaults() @@ -372,6 +371,35 @@ int get_defaults_options(int argc, char **argv, argc Pointer to argc of original program argv Pointer to argv of original program + NOTES + + This function is NOT thread-safe as it uses a global pointer internally. + See also notes for my_load_defaults(). + + RETURN + 0 ok + 1 The given conf_file didn't exists +*/ +int load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv) +{ + return my_load_defaults(conf_file, groups, argc, argv, &default_directories); +} + +/* + Read options from configurations files + + SYNOPSIS + my_load_defaults() + conf_file Basename for configuration file to search for. + If this is a path, then only this file is read. + groups Which [group] entrys to read. + Points to an null terminated array of pointers + argc Pointer to argc of original program + argv Pointer to argv of original program + default_directories Pointer to a location where a pointer to the list + of default directories will be stored + IMPLEMENTATION Read options from configuration files and put them BEFORE the arguments @@ -386,13 +414,18 @@ int get_defaults_options(int argc, char **argv, that was put in *argv RETURN - 0 ok - 1 The given conf_file didn't exists + - If successful, 0 is returned. If 'default_directories' is not NULL, + a pointer to the array of default directory paths is stored to a location + it points to. That stored value must be passed to my_search_option_files() + later. + + - 1 is returned if the given conf_file didn't exist. In this case, the + value pointed to by default_directories is undefined. */ -int load_defaults(const char *conf_file, const char **groups, - int *argc, char ***argv) +int my_load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv, const char ***default_directories) { DYNAMIC_ARRAY args; TYPELIB group; @@ -402,10 +435,11 @@ int load_defaults(const char *conf_file, const char **groups, MEM_ROOT alloc; char *ptr,**res; struct handle_option_ctx ctx; + const char **dirs; DBUG_ENTER("load_defaults"); init_alloc_root(&alloc,512,0); - if ((default_directories= init_default_directories(&alloc)) == NULL) + if ((dirs= init_default_directories(&alloc)) == NULL) goto err; /* Check if the user doesn't want any default option processing @@ -426,6 +460,8 @@ int load_defaults(const char *conf_file, const char **groups, (*argc)--; *argv=res; *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ + if (default_directories) + *default_directories= dirs; DBUG_RETURN(0); } @@ -444,7 +480,8 @@ int load_defaults(const char *conf_file, const char **groups, ctx.group= &group; error= my_search_option_files(conf_file, argc, argv, &args_used, - handle_default_option, (void *) &ctx); + handle_default_option, (void *) &ctx, + dirs); /* Here error contains <> 0 only if we have a fully specified conf_file or a forced default file @@ -490,6 +527,10 @@ int load_defaults(const char *conf_file, const char **groups, puts(""); exit(0); } + + if (error == 0 && default_directories) + *default_directories= dirs; + DBUG_RETURN(error); err: @@ -895,15 +936,11 @@ void my_print_default_files(const char *conf_file) fputs(conf_file,stdout); else { - /* - If default_directories is already initialized, use it. Otherwise, - use a private MEM_ROOT. - */ - const char **dirs = default_directories; + const char **dirs; MEM_ROOT alloc; init_alloc_root(&alloc,512,0); - if (!dirs && (dirs= init_default_directories(&alloc)) == NULL) + if ((dirs= init_default_directories(&alloc)) == NULL) { fputs("Internal error initializing default directories list", stdout); } diff --git a/server-tools/instance-manager/instance_map.cc b/server-tools/instance-manager/instance_map.cc index d7328d51cfe..b137370b50a 100644 --- a/server-tools/instance-manager/instance_map.cc +++ b/server-tools/instance-manager/instance_map.cc @@ -536,7 +536,8 @@ int Instance_map::load() */ if (my_search_option_files(Options::Main::config_file, &argc, (char ***) &argv, &args_used, - process_option, (void*) this)) + process_option, (void*) this, + Options::default_directories)) log_info("Falling back to compiled-in defaults."); return complete_initialization(); diff --git a/server-tools/instance-manager/options.cc b/server-tools/instance-manager/options.cc index 7eba3187dd9..6f084e7c63e 100644 --- a/server-tools/instance-manager/options.cc +++ b/server-tools/instance-manager/options.cc @@ -86,6 +86,7 @@ const char *Options::Main::bind_address= NULL; /* No default value */ uint Options::Main::monitoring_interval= DEFAULT_MONITORING_INTERVAL; uint Options::Main::port_number= DEFAULT_PORT; my_bool Options::Main::mysqld_safe_compatible= FALSE; +const char **Options::default_directories= NULL; /* Options::User_management */ @@ -439,7 +440,8 @@ int Options::load(int argc, char **argv) log_info("Loading config file '%s'...", (const char *) Main::config_file); - load_defaults(Main::config_file, default_groups, &argc, &saved_argv); + my_load_defaults(Main::config_file, default_groups, &argc, + &saved_argv, &default_directories); if ((handle_options(&argc, &saved_argv, my_long_options, get_one_option))) return ERR_INVALID_USAGE; diff --git a/server-tools/instance-manager/options.h b/server-tools/instance-manager/options.h index 0202ca271c9..5d4df51faae 100644 --- a/server-tools/instance-manager/options.h +++ b/server-tools/instance-manager/options.h @@ -91,6 +91,9 @@ struct Options #endif public: + /* Array of paths to be passed to my_search_option_files() later */ + static const char **default_directories; + static int load(int argc, char **argv); static void cleanup(); diff --git a/sql-common/client.c b/sql-common/client.c index 63c746a3f5a..91a47b6a6f8 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1021,7 +1021,7 @@ void mysql_read_default_options(struct st_mysql_options *options, argc=1; argv=argv_buff; argv_buff[0]= (char*) "client"; groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0; - load_defaults(filename, groups, &argc, &argv); + my_load_defaults(filename, groups, &argc, &argv, NULL); if (argc != 1) /* If some default option */ { char **option=argv; From f36a37af7be77672dcdbd4a9c6750a2880c1fb4a Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Fri, 6 Mar 2009 20:19:29 +0200 Subject: [PATCH 02/17] Bug #40559 assertion failed in check_binlog_magic The reason of the bug is in that the test makes a trick with relay log files and did not reset fully at the end. If mtr does not restart the test the new SQL thread tried to work with the old time session data. Fixed with deploying RESET slave at the clean-up. --- .../suite/binlog/r/binlog_auto_increment_bug33029.result | 1 + .../suite/binlog/t/binlog_auto_increment_bug33029.test | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result index 8df0568a755..8226469fcf7 100644 --- a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result +++ b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result @@ -38,4 +38,5 @@ DROP PROCEDURE IF EXISTS p2; DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; stop slave sql_thread; +reset slave; SET @@global.relay_log_purge= @old_relay_log_purge; diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test index f20cc33f820..5297767675c 100644 --- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test +++ b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test @@ -52,9 +52,10 @@ DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; enable_warnings; +stop slave sql_thread; +reset slave; +source include/wait_for_slave_sql_to_stop.inc; remove_file $MYSQLD_DATADIR/slave-relay-bin.000001; remove_file $MYSQLD_DATADIR/slave-relay-bin.index; -stop slave sql_thread; -source include/wait_for_slave_sql_to_stop.inc; SET @@global.relay_log_purge= @old_relay_log_purge; From 0693a99cfdb25370c4843e2062246b7a70257f7b Mon Sep 17 00:00:00 2001 From: Chad MILLER Date: Mon, 9 Mar 2009 16:56:46 -0400 Subject: [PATCH 03/17] Fix non-DBUG return. --- client/mysqldump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index ced34f16212..c1eb07d7f8e 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -3199,7 +3199,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables) DBUG_ENTER("dump_selected_tables"); if (init_dumping(db, init_dumping_tables)) - return 1; + DBUG_RETURN(1); init_alloc_root(&root, 8192, 0); if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *)))) From 0d9589a433a1473e91e446fb842f788e5e1ff2c3 Mon Sep 17 00:00:00 2001 From: Chad MILLER Date: Mon, 9 Mar 2009 16:58:47 -0400 Subject: [PATCH 04/17] Bug#42635: mysqldump includes views that were excluded using the \ --ignore-table option mysqldump would correctly omit temporary tables for views, but would incorrectly still emit all CREATE VIEW statements. Backport a fix from 5.1, where we capture the names we want to emit views for in one pass (the placeholder tables) and in the pass where we actually emit the views, we don't emit a view if it wasn't in that list. --- client/mysqldump.c | 24 ++++++++++++---- mysql-test/r/mysqldump.result | 54 +++++++++++++++++++++++++++++++++++ mysql-test/t/mysqldump.test | 14 +++++++++ 3 files changed, 87 insertions(+), 5 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index c1eb07d7f8e..dea1b0b3659 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2009 Sun Microsystems, Inc. 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 @@ -3103,6 +3103,11 @@ static my_bool dump_all_views_in_db(char *database) char *table; uint numrows; char table_buff[NAME_LEN*2+3]; + char hash_key[2*NAME_LEN+2]; /* "db.tablename" */ + char *afterdot; + + afterdot= strmov(hash_key, database); + *afterdot++= '.'; if (init_dumping(database, init_dumping_views)) return 1; @@ -3112,10 +3117,15 @@ static my_bool dump_all_views_in_db(char *database) { DYNAMIC_STRING query; init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024); - for (numrows= 0 ; (table= getTableName(1)); numrows++) + for (numrows= 0 ; (table= getTableName(1)); ) { - dynstr_append_checked(&query, quote_name(table, table_buff, 1)); - dynstr_append_checked(&query, " READ /*!32311 LOCAL */,"); + char *end= strmov(afterdot, table); + if (include_table((uchar*) hash_key,end - hash_key)) + { + numrows++; + dynstr_append_checked(&query, quote_name(table, table_buff, 1)); + dynstr_append_checked(&query, " READ /*!32311 LOCAL */,"); + } } if (numrows && mysql_real_query(mysql, query.str, query.length-1)) DB_error(mysql, "when using LOCK TABLES"); @@ -3129,7 +3139,11 @@ static my_bool dump_all_views_in_db(char *database) /* We shall continue here, if --force was given */ } while ((table= getTableName(0))) - get_view_structure(table, database); + { + char *end= strmov(afterdot, table); + if (include_table((uchar*) hash_key, end - hash_key)) + get_view_structure(table, database); + } if (opt_xml) { fputs("\n", md_result_file); diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 76e553dea42..831f953157e 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -3574,5 +3574,59 @@ DROP TABLE t1,t2; -- Dump completed on DATE SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT; # +# Bug #42635: mysqldump includes views that were excluded using +# the --ignore-table option +# +create database db42635; +use db42635; +create table t1 (id int); +create view db42635.v1 (c) as select * from db42635.t1; +create view db42635.v2 (c) as select * from db42635.t1; + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `t1` ( + `id` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `v2`; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 CREATE TABLE `v2` ( + `c` int(11) +) ENGINE=MyISAM */; +/*!50001 DROP TABLE `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v2` AS select `t1`.`id` AS `c` from `t1` */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +use test; +drop database db42635; +# # End of 5.0 tests # diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 5cd9c17e2ac..30a7da751e8 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1649,6 +1649,20 @@ DROP TABLE t1,t2; # We reset concurrent_inserts value to whatever it was at the start of the test SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT; +--echo # +--echo # Bug #42635: mysqldump includes views that were excluded using +--echo # the --ignore-table option +--echo # + +create database db42635; +use db42635; +create table t1 (id int); +create view db42635.v1 (c) as select * from db42635.t1; +create view db42635.v2 (c) as select * from db42635.t1; +--exec $MYSQL_DUMP --skip-comments --ignore-table=db42635.v1 db42635 +use test; +drop database db42635; + --echo # --echo # End of 5.0 tests From e58840fc85b9e60e3247882981a3f1381c50aa8c Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Wed, 11 Mar 2009 23:32:53 +0100 Subject: [PATCH 05/17] Bug#40657: assertion with out of range variables and traditional sql_mode normalize error-messages --- mysql-test/r/variables.result | 6 ++++++ mysql-test/t/variables.test | 5 +++++ sql/set_var.cc | 5 +++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 28b35c1461d..aeda5b59dab 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -1421,6 +1421,12 @@ SELECT @@global.expire_logs_days; @@global.expire_logs_days 99 SET GLOBAL expire_logs_days = @old_eld; +SET GLOBAL auto_increment_offset=-1; +Warnings: +Warning 1292 Truncated incorrect auto_increment_offset value: '-1' +SET GLOBAL auto_increment_offset=0; +Warnings: +Warning 1292 Truncated incorrect auto_increment_offset value: '0' select @@storage_engine; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def @@storage_engine 253 6 6 N 1 31 8 diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 95f4d6e97c5..43169b22b5e 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -1155,6 +1155,11 @@ SELECT @@global.expire_logs_days; # cleanup SET GLOBAL expire_logs_days = @old_eld; +# show that warning uses underscore (sysvar-name), not hyphens (option-name) +SET GLOBAL auto_increment_offset=-1; +SET GLOBAL auto_increment_offset=0; + + # # Bug#41030 Wrong meta data (incorrect fieldlen) diff --git a/sql/set_var.cc b/sql/set_var.cc index d6a9cbb19ee..84e628fbddf 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1520,9 +1520,10 @@ static bool get_unsigned(THD *thd, set_var *var, ulonglong user_max, var->save_result.ulonglong_value= getopt_ull_limit_value(var->save_result. ulonglong_value, - limits, &fixed); + limits, &fixed); - if ((warnings == 0) && throw_bounds_warning(thd, fixed, TRUE, limits->name, + if ((warnings == 0) && throw_bounds_warning(thd, fixed, TRUE, + var->var->name, (longlong) unadjusted)) return TRUE; } From 390afdd16ee2a4aef2271bdf6f3b412d7d562ce7 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 13 Mar 2009 12:51:25 +0400 Subject: [PATCH 06/17] Bug#42610 Dynamic plugin broken in 5.1.31 --added ability to obtain plugin variables from my.cnf on INSTALL PLUGIN stage --option 'ignore-builtin-innodb' disables all InnoDB builtin plugins (including I_S plugins) --- sql/mysql_priv.h | 3 +++ sql/mysqld.cc | 8 +++++++- sql/sql_plugin.cc | 35 +++++++++++++++++++++++------------ 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index a2fbddd667a..2c938fc96a2 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2047,6 +2047,9 @@ extern SHOW_COMP_OPTION have_geometry, have_rtree_keys; extern SHOW_COMP_OPTION have_crypt; extern SHOW_COMP_OPTION have_compress; +extern int orig_argc; +extern char **orig_argv; +extern const char *load_default_groups[]; #ifndef __WIN__ extern pthread_t signal_thread; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 921bcfcf68e..b88e6b641dd 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -648,6 +648,9 @@ static int defaults_argc; static char **defaults_argv; static char *opt_bin_logname; +int orig_argc; +char **orig_argv; + static my_socket unix_sock,ip_sock; struct rand_struct sql_rand; ///< used by sql_class.cc:THD::THD() @@ -2923,7 +2926,7 @@ pthread_handler_t handle_shutdown(void *arg) #endif #if !defined(EMBEDDED_LIBRARY) -static const char *load_default_groups[]= { +const char *load_default_groups[]= { #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE "mysql_cluster", #endif @@ -3221,6 +3224,8 @@ static int init_common_variables(const char *conf_file_name, int argc, SQLCOM_END + 8); #endif + orig_argc=argc; + orig_argv=argv; load_defaults(conf_file_name, groups, &argc, &argv); defaults_argv=argv; defaults_argc=argc; @@ -3886,6 +3891,7 @@ server."); if ((ho_error= handle_options(&defaults_argc, &tmp_argv, no_opts, mysqld_get_one_option))) unireg_abort(ho_error); + my_getopt_skip_unknown= TRUE; if (defaults_argc) { diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 60f205ec8e8..223ba6ef42e 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1139,8 +1139,9 @@ int plugin_init(int *argc, char **argv, int flags) for (plugin= *builtins; plugin->info; plugin++) { if (opt_ignore_builtin_innodb && - !my_strcasecmp(&my_charset_latin1, plugin->name, "InnoDB")) - continue; + !my_strnncoll(&my_charset_latin1, (const uchar*) plugin->name, + 6, (const uchar*) "InnoDB", 6)) + continue; /* by default, ndbcluster and federated are disabled */ def_enabled= my_strcasecmp(&my_charset_latin1, plugin->name, "NDBCLUSTER") != 0 && @@ -1633,8 +1634,8 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl { TABLE_LIST tables; TABLE *table; - int error, argc; - char *argv[2]; + int error, argc=orig_argc; + char **argv=orig_argv; struct st_plugin_int *tmp; DBUG_ENTER("mysql_install_plugin"); @@ -1650,21 +1651,31 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl pthread_mutex_lock(&LOCK_plugin); rw_wrlock(&LOCK_system_variables_hash); - /* handle_options() assumes arg0 (program name) always exists */ - argv[0]= const_cast(""); // without a cast gcc emits a warning - argv[1]= 0; - argc= 1; + + load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv); error= plugin_add(thd->mem_root, name, dl, &argc, argv, REPORT_TO_USER); + if (argv) + free_defaults(argv); rw_unlock(&LOCK_system_variables_hash); if (error || !(tmp= plugin_find_internal(name, MYSQL_ANY_PLUGIN))) goto err; - if (plugin_initialize(tmp)) + if (tmp->state == PLUGIN_IS_DISABLED) { - my_error(ER_CANT_INITIALIZE_UDF, MYF(0), name->str, - "Plugin initialization function failed."); - goto deinit; + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_CANT_INITIALIZE_UDF, ER(ER_CANT_INITIALIZE_UDF), + name->str, "Plugin is disabled"); + } + else + { + DBUG_ASSERT(tmp->state == PLUGIN_IS_UNINITIALIZED); + if (plugin_initialize(tmp)) + { + my_error(ER_CANT_INITIALIZE_UDF, MYF(0), name->str, + "Plugin initialization function failed."); + goto deinit; + } } /* From 327c3f3f193548673f970752b6fb986477288ea8 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 13 Mar 2009 11:16:32 +0200 Subject: [PATCH 07/17] addendum to bug #36540 : fix the funcs_1 test suite. --- mysql-test/suite/funcs_1/r/is_columns_mysql.result | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index 9d1f316a9bf..2f1f61c0525 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -48,7 +48,7 @@ NULL mysql event last_executed 10 NULL YES datetime NULL NULL NULL NULL NULL NUL NULL mysql event modified 9 0000-00-00 00:00:00 NO timestamp NULL NULL NULL NULL NULL NULL timestamp select,insert,update,references NULL mysql event name 2 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) PRI select,insert,update,references NULL mysql event on_completion 14 DROP NO enum 8 24 NULL NULL utf8 utf8_general_ci enum('DROP','PRESERVE') select,insert,update,references -NULL mysql event originator 17 NULL NO int NULL NULL 10 0 NULL NULL int(10) select,insert,update,references +NULL mysql event originator 17 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned select,insert,update,references NULL mysql event sql_mode 15 NO set 478 1434 NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') select,insert,update,references NULL mysql event starts 11 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select,insert,update,references NULL mysql event status 13 ENABLED NO enum 18 54 NULL NULL utf8 utf8_general_ci enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') select,insert,update,references @@ -60,7 +60,7 @@ NULL mysql func type 4 NULL NO enum 9 27 NULL NULL utf8 utf8_general_ci enum('fu NULL mysql general_log argument 6 NULL NO mediumtext 16777215 16777215 NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references NULL mysql general_log command_type 5 NULL NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references NULL mysql general_log event_time 1 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references -NULL mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references +NULL mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned select,insert,update,references NULL mysql general_log thread_id 3 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references NULL mysql general_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references NULL mysql help_category help_category_id 1 NULL NO smallint NULL NULL 5 0 NULL NULL smallint(5) unsigned PRI select,insert,update,references @@ -150,7 +150,7 @@ NULL mysql slow_log lock_time 4 NULL NO time NULL NULL NULL NULL NULL NULL time NULL mysql slow_log query_time 3 NULL NO time NULL NULL NULL NULL NULL NULL time select,insert,update,references NULL mysql slow_log rows_examined 6 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references NULL mysql slow_log rows_sent 5 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references -NULL mysql slow_log server_id 10 NULL NO int NULL NULL 10 0 NULL NULL int(11) select,insert,update,references +NULL mysql slow_log server_id 10 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned select,insert,update,references NULL mysql slow_log sql_text 11 NULL NO mediumtext 16777215 16777215 NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references NULL mysql slow_log start_time 1 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references NULL mysql slow_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references @@ -329,7 +329,7 @@ NULL mysql event ends datetime NULL NULL NULL NULL datetime 3.0000 mysql event on_completion enum 8 24 utf8 utf8_general_ci enum('DROP','PRESERVE') 3.0000 mysql event sql_mode set 478 1434 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') 3.0000 mysql event comment char 64 192 utf8 utf8_bin char(64) -NULL mysql event originator int NULL NULL NULL NULL int(10) +NULL mysql event originator int NULL NULL NULL NULL int(10) unsigned 1.0000 mysql event time_zone char 64 64 latin1 latin1_swedish_ci char(64) 3.0000 mysql event character_set_client char 32 96 utf8 utf8_bin char(32) 3.0000 mysql event collation_connection char 32 96 utf8 utf8_bin char(32) @@ -342,7 +342,7 @@ NULL mysql func ret tinyint NULL NULL NULL NULL tinyint(1) NULL mysql general_log event_time timestamp NULL NULL NULL NULL timestamp 1.0000 mysql general_log user_host mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext NULL mysql general_log thread_id int NULL NULL NULL NULL int(11) -NULL mysql general_log server_id int NULL NULL NULL NULL int(11) +NULL mysql general_log server_id int NULL NULL NULL NULL int(10) unsigned 3.0000 mysql general_log command_type varchar 64 192 utf8 utf8_general_ci varchar(64) 1.0000 mysql general_log argument mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext NULL mysql help_category help_category_id smallint NULL NULL NULL NULL smallint(5) unsigned @@ -434,7 +434,7 @@ NULL mysql slow_log rows_examined int NULL NULL NULL NULL int(11) 3.0000 mysql slow_log db varchar 512 1536 utf8 utf8_general_ci varchar(512) NULL mysql slow_log last_insert_id int NULL NULL NULL NULL int(11) NULL mysql slow_log insert_id int NULL NULL NULL NULL int(11) -NULL mysql slow_log server_id int NULL NULL NULL NULL int(11) +NULL mysql slow_log server_id int NULL NULL NULL NULL int(10) unsigned 1.0000 mysql slow_log sql_text mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext 3.0000 mysql tables_priv Host char 60 180 utf8 utf8_bin char(60) 3.0000 mysql tables_priv Db char 64 192 utf8 utf8_bin char(64) From 396ab324e201d10917732c5b3b0377a768b7b2c8 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 13 Mar 2009 14:25:50 +0400 Subject: [PATCH 08/17] compilation(embedded server) failure fix --- sql/mysqld.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b88e6b641dd..7fe498ae147 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2925,18 +2925,16 @@ pthread_handler_t handle_shutdown(void *arg) } #endif -#if !defined(EMBEDDED_LIBRARY) const char *load_default_groups[]= { #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE "mysql_cluster", #endif "mysqld","server", MYSQL_BASE_VERSION, 0, 0}; -#if defined(__WIN__) +#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) static const int load_default_groups_sz= sizeof(load_default_groups)/sizeof(load_default_groups[0]); #endif -#endif /*!EMBEDDED_LIBRARY*/ /** From c14a43cd40012a41096fafe519a304adbab7e766 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 13 Mar 2009 13:13:55 +0200 Subject: [PATCH 09/17] Bug #43614: make distcheck failure (ndb/Makefile is made, but not subdirs of ndb) There are some recursive targets that automake generates which reference DIST_SUBDIRS. It's critical, then, for such subdirs to exist even if they won't be built as part of SUBDIRS. During a VPATH build, it is the configure script which creates the subdirs (when it processes the AC_CONFIG_FILES() for each subdir's Makefile). If autoconf doesn't create a subdir's Makefile, then the recursive make will fail when it is unable to cd into that subdir. This isn't a problem in non-VPATH builds, because the subdirs are all present in the source tarball. So the problem only shows up during 'make distcheck', which does a VPATH build. The fix is to look, when configure is being created by autoconf, for any plugin subdirectories. These are the dynamic subdirectories which need to be handled specially. It's enough to tell autoconf to generate a Makefile for any Makefile.am found in the plugin directory - all plugin subdirectories using automake (i.e., listed in the plugin's DIST_SUBDIRS) will have a Makefile.am. This is done by calling 'find'. This means that 'find' must be in the PATH on the host that is running autoconf. 'find' is NOT needed when calling configure, so it is not an additional dependency for the user. Finally, ha_ndbcluster.m4 had called AC_CONFIG_FILES() on all those subdir Makefiles, but only when the plugin was actually being built. So it didn't work in the case that NDB was not being built. All of those Makefiles have to be removed from this static list, since the plugin machinery is now adding them automatically. autoconf fails if a file is duplicated in AC_CONFIG_FILES(). --- config/ac-macros/ha_ndbcluster.m4 | 40 ++++--------------------------- config/ac-macros/plugins.m4 | 17 +++++++++++-- 2 files changed, 20 insertions(+), 37 deletions(-) diff --git a/config/ac-macros/ha_ndbcluster.m4 b/config/ac-macros/ha_ndbcluster.m4 index 5ee136f2266..3718b64f688 100644 --- a/config/ac-macros/ha_ndbcluster.m4 +++ b/config/ac-macros/ha_ndbcluster.m4 @@ -330,41 +330,11 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ AC_SUBST([NDB_SIZEOF_LONG]) AC_SUBST([NDB_SIZEOF_LONG_LONG]) - AC_CONFIG_FILES(storage/ndb/include/Makefile dnl - storage/ndb/src/Makefile storage/ndb/src/common/Makefile dnl - storage/ndb/docs/Makefile dnl - storage/ndb/tools/Makefile dnl - storage/ndb/src/common/debugger/Makefile dnl - storage/ndb/src/common/debugger/signaldata/Makefile dnl - storage/ndb/src/common/portlib/Makefile dnl - storage/ndb/src/common/util/Makefile dnl - storage/ndb/src/common/logger/Makefile dnl - storage/ndb/src/common/transporter/Makefile dnl - storage/ndb/src/common/mgmcommon/Makefile dnl - storage/ndb/src/kernel/Makefile dnl - storage/ndb/src/kernel/error/Makefile dnl - storage/ndb/src/kernel/blocks/Makefile dnl - storage/ndb/src/kernel/blocks/dbdict/Makefile dnl - storage/ndb/src/kernel/blocks/dbdih/Makefile dnl - storage/ndb/src/kernel/blocks/dblqh/Makefile dnl - storage/ndb/src/kernel/blocks/dbtup/Makefile dnl - storage/ndb/src/kernel/blocks/backup/Makefile dnl - storage/ndb/src/kernel/vm/Makefile dnl - storage/ndb/src/mgmapi/Makefile dnl - storage/ndb/src/ndbapi/Makefile dnl - storage/ndb/src/mgmsrv/Makefile dnl - storage/ndb/src/mgmclient/Makefile dnl - storage/ndb/src/cw/Makefile dnl - storage/ndb/src/cw/cpcd/Makefile dnl - storage/ndb/test/Makefile dnl - storage/ndb/test/src/Makefile dnl - storage/ndb/test/ndbapi/Makefile dnl - storage/ndb/test/ndbapi/bank/Makefile dnl - storage/ndb/test/tools/Makefile dnl - storage/ndb/test/run-test/Makefile dnl - storage/ndb/include/ndb_version.h storage/ndb/include/ndb_global.h dnl - storage/ndb/include/ndb_types.h dnl - ) + AC_CONFIG_FILES([ + storage/ndb/include/ndb_version.h + storage/ndb/include/ndb_global.h + storage/ndb/include/ndb_types.h + ]) ]) AC_SUBST(TEST_NDBCLUSTER) diff --git a/config/ac-macros/plugins.m4 b/config/ac-macros/plugins.m4 index e1da6fd11f5..5d15afeda99 100644 --- a/config/ac-macros/plugins.m4 +++ b/config/ac-macros/plugins.m4 @@ -477,10 +477,23 @@ dnl Although this is "pretty", it breaks libmysqld build # Even if we don't build a plugin, we bundle its source into the dist # file. So its Makefile (and Makefiles for any subdirs) must be # generated for 'make dist' to work. - m4_syscmd(test -f "$6/configure") + m4_syscmd([test -f "]$6[/configure"]) ifelse(m4_sysval, 0, [AC_CONFIG_SUBDIRS($6)], - [AC_CONFIG_FILES($6/Makefile)] + [ + # autoconf doesn't provide an automatic way to configure DIST_SUBDIRS of + # a subdir; for our purposes, it's enough to just check for existing + # Makefile.am files and add them in here +dnl +dnl Warning, don't try to quote the m4_esyscmd() macro, it doesn't +dnl work. Quoting here is tricky. +dnl +dnl The $FIND or $SED variable can be set by the user when calling autoconf itself +dnl to if they need to pass a specific path. This is *NOT* used when calling +dnl running configure! +dnl + AC_CONFIG_FILES(m4_esyscmd([${FIND-find} "]$6[" -name Makefile.am -print | ${SED-sed} 's,\.am$,,'])) + ] ) ifelse( From 8a5a804530eb0ee9c935b2b581d62ead93ae2854 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 13 Mar 2009 15:51:25 +0200 Subject: [PATCH 10/17] Bug #22047 : Time in SHOW PROCESSLIST for SQL thread in replication seems to become negative THD::start_time has a dual meaning : it's either the time since the process entered a given state or is the transaction time returned by e.g. NOW(). This causes problems, as sometimes THD::start_time may be set to a value that is correct and needed when used as a base for NOW(), but these times may be arbitrary (SET @@timestamp) or non-local (coming from the master through the replication feed). If one such non-local time is set there's no way to return a correct value for e.g. SHOW PROCESSLIST or SELECT ... FROM INFORMATION_SCHEMA.PROCESSLIST. Fixed by making the Time column in SHOW PROCESSLIST SIGNED LONG instead of UNSIGNED LONG and doing the correct conversions. Note that no reliable test suite can be constructed, since it would require knowing the local time and can't be achieved by the means of the current test suite. --- sql/sql_show.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a3ccf770a3c..fee3d076436 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1338,7 +1338,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) field_list.push_back(field=new Item_empty_string("db",NAME_LEN)); field->maybe_null=1; field_list.push_back(new Item_empty_string("Command",16)); - field_list.push_back(new Item_return_int("Time",7, FIELD_TYPE_LONG)); + field_list.push_back(field= new Item_return_int("Time",7, FIELD_TYPE_LONG)); + field->unsigned_flag= 0; field_list.push_back(field=new Item_empty_string("State",30)); field->maybe_null=1; field_list.push_back(field=new Item_empty_string("Info",max_query_length)); @@ -1439,7 +1440,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) else protocol->store(command_name[thd_info->command], system_charset_info); if (thd_info->start_time) - protocol->store((uint32) (now - thd_info->start_time)); + protocol->store_long ((longlong) (now - thd_info->start_time)); else protocol->store_null(); protocol->store(thd_info->state_info, system_charset_info); From e54bad485d6a1f8cdc6625c47b81e3ef23f89c37 Mon Sep 17 00:00:00 2001 From: Patrick Crews Date: Sun, 15 Mar 2009 12:25:14 -0400 Subject: [PATCH 11/17] Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to 'grep' call. Revised patch incorporating cleaner test code brought up during review. Removed the use of grep and accomplished same actions via SQL / use of the server. Runs as before on *nix systems and now runs on Windows without Cygwin as well. --- mysql-test/include/ndb_backup.inc | 44 +++++++++++++++++++-------- mysql-test/r/ndb_restore.result | 6 ++-- mysql-test/r/ndb_restore_print.result | 18 +++++++---- 3 files changed, 48 insertions(+), 20 deletions(-) diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc index 3239030bb64..752155a8dbd 100644 --- a/mysql-test/include/ndb_backup.inc +++ b/mysql-test/include/ndb_backup.inc @@ -3,29 +3,49 @@ # in test cases and can be reused. # ###################################################### -# Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to -# 'grep' call -# This test is disabled on Windows via the next line until the above bug is -# resolved ---source include/not_windows.inc - --exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT -# there is no neat way to find the backupid, this is a hack to find it... +# To find the backupid, we must dump this data to a table, and SELECT +# what we want into an outfile. This could be accomplished with grep, but +# grep isn't Windows-portable ---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat +--disable_query_log +# create a table to help us out +--disable_warnings # leave this on until done with the entire process +# cleanup +DROP TABLE IF EXISTS helper1; +CREATE TABLE helper1(c1 VARCHAR(20)); +# dump raw data to file +let $ndb_backup_file1= $MYSQLTEST_VARDIR/ndb_backup_tmp.dat; +let $ndb_backup_file2= $MYSQLTEST_VARDIR/tmp.dat; +--error 0,1 +--remove_file $ndb_backup_file1 +--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 > $ndb_backup_file1 +# load the table from the raw data file +eval LOAD DATA INFILE '$ndb_backup_file1' INTO TABLE helper1; +--remove_file $ndb_backup_file1 +# output what we need +eval SELECT * FROM helper1 WHERE c1 LIKE '%520093696%' +INTO OUTFILE '$ndb_backup_file2'; +# cleanup +DROP TABLE helper1; +--enable_warnings +--enable_query_log -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +--replace_result $MYSQLTEST_VARDIR +eval LOAD DATA INFILE '$ndb_backup_file2' +INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +--remove_file $ndb_backup_file2 --replace_column 1 SELECT @the_backup_id:=backup_id FROM test.backup_info; - -let the_backup_id=`select @the_backup_id`; +let $the_backup_id=`SELECT @the_backup_id`; DROP TABLE test.backup_info; diff --git a/mysql-test/r/ndb_restore.result b/mysql-test/r/ndb_restore.result index c48333f6ea8..05a94b143f3 100644 --- a/mysql-test/r/ndb_restore.result +++ b/mysql-test/r/ndb_restore.result @@ -129,9 +129,11 @@ create table t7 engine=myisam as select * from t7_c; create table t8 engine=myisam as select * from t8_c; create table t9 engine=myisam as select * from t9_c; create table t10 engine=myisam as select * from t10_c; -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '/tmp.dat' +INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id diff --git a/mysql-test/r/ndb_restore_print.result b/mysql-test/r/ndb_restore_print.result index e05f8e43d1a..8b50303c2dc 100644 --- a/mysql-test/r/ndb_restore_print.result +++ b/mysql-test/r/ndb_restore_print.result @@ -227,9 +227,11 @@ hex(h3) NULL hex(i1) NULL hex(i2) NULL hex(i3) NULL -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '/tmp.dat' +INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id @@ -261,9 +263,11 @@ create table t4 (pk int key, a int) engine ndb; insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15); insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25); insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35); -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '/tmp.dat' +INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id @@ -305,9 +309,11 @@ create table t1 insert into t1 values(1, 8388607, 16777215); insert into t1 values(2, -8388608, 0); insert into t1 values(3, -1, 1); -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; DELETE FROM test.backup_info; -LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +LOAD DATA INFILE '/tmp.dat' +INTO TABLE test.backup_info FIELDS TERMINATED BY ','; SELECT @the_backup_id:=backup_id FROM test.backup_info; @the_backup_id:=backup_id From 0a050535936a7402bb17cda642505935f131d564 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Mon, 16 Mar 2009 09:02:10 +0400 Subject: [PATCH 12/17] Fix for bug #42957: no results from select where .. (col=col and col=col) or ... (false expression) Problem: optimizer didn't take into account a singular case when we eliminated all the predicates at the AND level of WHERE. That may lead to wrong results. Fix: replace (a=a AND a=a...) with TRUE if we eliminated all the predicates. --- mysql-test/r/select.result | 28 ++++++++++++++++++++++++++++ mysql-test/t/select.test | 16 ++++++++++++++++ sql/sql_select.cc | 9 ++++++++- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 621c11906cb..0771c7fb370 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4416,4 +4416,32 @@ date_nokey Warnings: Warning 1292 Incorrect date value: '10:41:7' for column 'date_nokey' at row 1 DROP TABLE A,C; +CREATE TABLE t1 (a INT NOT NULL, b INT); +INSERT INTO t1 VALUES (1, 1); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +Warnings: +Note 1003 select '1' AS `a`,'1' AS `b` from `test`.`t1` where 1 +SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; +a b +1 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +Warnings: +Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +Warnings: +Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +Warnings: +Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index ccdb53ec11f..8981ddbe2e4 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3769,4 +3769,20 @@ SELECT date_nokey FROM C DROP TABLE A,C; +# +# Bug #42957: no results from +# select where .. (col=col and col=col) or ... (false expression) +# +CREATE TABLE t1 (a INT NOT NULL, b INT); +INSERT INTO t1 VALUES (1, 1); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; +SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; +DROP TABLE t1; + +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index bea748562eb..3bf94bc828f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7625,7 +7625,7 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond, if (and_level) { /* - Retrieve all conjucts of this level detecting the equality + Retrieve all conjuncts of this level detecting the equality that are subject to substitution by multiple equality items and removing each such predicate from the conjunction after having found/created a multiple equality whose inference the predicate is. @@ -7641,6 +7641,13 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond, li.remove(); } + /* + Check if we eliminated all the predicates of the level, e.g. + (a=a AND b=b AND a=a) + */ + if (!(args->elements + cond_equal.current_level.elements + eq_list.elements)) + return new Item_int((longlong) 1,1); + List_iterator_fast it(cond_equal.current_level); while ((item_equal= it++)) { From 611a09f596c5944a7bc5e846fede3ce9ce69d66d Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Mon, 16 Mar 2009 16:11:45 +0100 Subject: [PATCH 13/17] Bug#36446: Attempt to set @@join_buffer_size to its minimum value produces spurious warning If a sys-var has a base and a block-size>1, and then a user-supplied value >= minimum ended up below minimum thanks to block-size alignment, we threw a warning. This meant for instance that when getting, then setting the minimum, we'd see a warning. This was needlessly confusing. (updated patch) --- mysql-test/r/variables.result | 7 +++++++ mysql-test/t/variables.test | 15 +++++++++++++++ mysys/my_getopt.c | 6 ++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 7c9a9145ad1..f27d0b9fdd5 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -27,6 +27,7 @@ set @my_slow_launch_time =@@global.slow_launch_time; set @my_storage_engine =@@global.storage_engine; set @my_thread_cache_size =@@global.thread_cache_size; set @my_max_allowed_packet =@@global.max_allowed_packet; +set @my_join_buffer_size =@@global.join_buffer_size; set @`test`=1; select @test, @`test`, @TEST, @`TEST`, @"teSt"; @test @`test` @TEST @`TEST` @"teSt" @@ -1018,6 +1019,11 @@ show variables like 'hostname'; Variable_name Value hostname # End of 5.0 tests +set join_buffer_size=1; +Warnings: +Warning 1292 Truncated incorrect join_buffer_size value: '1' +set @save_join_buffer_size=@@join_buffer_size; +set join_buffer_size=@save_join_buffer_size; set global binlog_cache_size =@my_binlog_cache_size; set global connect_timeout =@my_connect_timeout; set global delayed_insert_timeout =@my_delayed_insert_timeout; @@ -1048,6 +1054,7 @@ set global slow_launch_time =@my_slow_launch_time; set global storage_engine =@my_storage_engine; set global thread_cache_size =@my_thread_cache_size; set global max_allowed_packet =@my_max_allowed_packet; +set global join_buffer_size =@my_join_buffer_size; show global variables where Variable_name='table_definition_cache' or Variable_name='table_lock_wait_timeout'; Variable_name Value diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index e224d3b0244..6da20409639 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -36,6 +36,7 @@ set @my_slow_launch_time =@@global.slow_launch_time; set @my_storage_engine =@@global.storage_engine; set @my_thread_cache_size =@@global.thread_cache_size; set @my_max_allowed_packet =@@global.max_allowed_packet; +set @my_join_buffer_size =@@global.join_buffer_size; # case insensitivity tests (new in 5.0) set @`test`=1; select @test, @`test`, @TEST, @`TEST`, @"teSt"; @@ -780,6 +781,18 @@ show variables like 'hostname'; --echo End of 5.0 tests +# +# Bug#36446: Attempt to set @@join_buffer_size to its minimum value +# produces spurious warning +# + +# set to 1 so mysqld will correct to minimum (+ warn) +set join_buffer_size=1; +# save minimum +set @save_join_buffer_size=@@join_buffer_size; +# set minimum +set join_buffer_size=@save_join_buffer_size; + # This is at the very after the versioned tests, since it involves doing # cleanup # @@ -816,6 +829,8 @@ set global slow_launch_time =@my_slow_launch_time; set global storage_engine =@my_storage_engine; set global thread_cache_size =@my_thread_cache_size; set global max_allowed_packet =@my_max_allowed_packet; +set global join_buffer_size =@my_join_buffer_size; + # # Bug#28580 Repeatation of status variables # diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 48174a40c21..54410fc3d1e 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -846,7 +846,8 @@ longlong getopt_ll_limit_value(longlong num, const struct my_option *optp, if (num < optp->min_value) { num= optp->min_value; - adjusted= TRUE; + if (old < optp->min_value) + adjusted= TRUE; } if (fix) @@ -917,7 +918,8 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, if (num < (ulonglong) optp->min_value) { num= (ulonglong) optp->min_value; - adjusted= TRUE; + if (old < optp->min_value) + adjusted= TRUE; } if (fix) From c86055b3254167da463a5151713bb22be4a56806 Mon Sep 17 00:00:00 2001 From: Patrick Crews Date: Mon, 16 Mar 2009 17:36:14 -0400 Subject: [PATCH 14/17] Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to 'grep' call. Re-recording of .result files for additional tests that use this include file. --- .../suite/ndb/r/ndb_restore_partition.result | 15 +++++++++------ .../suite/ndb_team/r/ndb_dd_backuprestore.result | 15 +++++++++------ .../suite/parts/r/ndb_dd_backuprestore.result | 15 +++++++++------ mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result | 5 +++-- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/mysql-test/suite/ndb/r/ndb_restore_partition.result b/mysql-test/suite/ndb/r/ndb_restore_partition.result index 58a35437a2e..b984c76a91d 100644 --- a/mysql-test/suite/ndb/r/ndb_restore_partition.result +++ b/mysql-test/suite/ndb/r/ndb_restore_partition.result @@ -125,8 +125,9 @@ create table t6 engine=myisam as select * from t6_c; create table t7 engine=myisam as select * from t7_c; create table t8 engine=myisam as select * from t8_c; create table t9 engine=myisam as select * from t9_c; -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; select count(*) from t1; @@ -244,8 +245,9 @@ PARTITION BY LINEAR HASH (`relatta`) PARTITIONS 4; ALTER TABLE t7_c PARTITION BY LINEAR KEY (`dardtestard`); -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; select count(*) from t1; @@ -448,8 +450,9 @@ select * from t9_c) a; count(*) 3 drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; Create table test/def/t2_c failed: Translate frm error drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; diff --git a/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result b/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result index 102a96a15f4..12a65a433a3 100644 --- a/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result +++ b/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result @@ -27,8 +27,9 @@ pk1 c2 c3 hex(c4) 3 Sweden 498 1 4 Sweden 497 1 5 Sweden 496 1 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; ALTER TABLESPACE table_space1 @@ -91,8 +92,9 @@ LENGTH(data) SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2; LENGTH(data) 16384 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; @@ -317,8 +319,9 @@ pk1 c2 c3 hex(c4) 248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1 247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1 246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; diff --git a/mysql-test/suite/parts/r/ndb_dd_backuprestore.result b/mysql-test/suite/parts/r/ndb_dd_backuprestore.result index 102a96a15f4..12a65a433a3 100644 --- a/mysql-test/suite/parts/r/ndb_dd_backuprestore.result +++ b/mysql-test/suite/parts/r/ndb_dd_backuprestore.result @@ -27,8 +27,9 @@ pk1 c2 c3 hex(c4) 3 Sweden 498 1 4 Sweden 497 1 5 Sweden 496 1 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; ALTER TABLESPACE table_space1 @@ -91,8 +92,9 @@ LENGTH(data) SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2; LENGTH(data) 16384 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; @@ -317,8 +319,9 @@ pk1 c2 c3 hex(c4) 248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1 247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1 246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result index c788893e055..3ef5e2b7e53 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result @@ -25,8 +25,9 @@ hex(c2) hex(c3) c1 0 1 BCDEF 1 0 CD 0 0 DEFGHIJKL -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; UPDATE t1 SET c2=0 WHERE c3="row2"; SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; From 7178e47a3c92eaad13b3c0b6c8c8e3d0692fadbc Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Tue, 17 Mar 2009 11:04:15 +0400 Subject: [PATCH 15/17] Code clean-up. --- sql/sql_select.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3bf94bc828f..b86eb814eba 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7643,10 +7643,12 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond, /* Check if we eliminated all the predicates of the level, e.g. - (a=a AND b=b AND a=a) + (a=a AND b=b AND a=a). */ - if (!(args->elements + cond_equal.current_level.elements + eq_list.elements)) - return new Item_int((longlong) 1,1); + if (!args->elements && + !cond_equal.current_level.elements && + !eq_list.elements) + return new Item_int((longlong) 1, 1); List_iterator_fast it(cond_equal.current_level); while ((item_equal= it++)) From e9c874224b588d045d39d14811117207f5114f9a Mon Sep 17 00:00:00 2001 From: Horst Hunger Date: Tue, 17 Mar 2009 14:43:43 +0100 Subject: [PATCH 16/17] Fix for bug 39484 after review. I inserted the review results (also including the patches itself): "Release_lock("hello")" is now also successful when delivering NULL, replaced two sleeps by wait_condition. The last two "sleep 1" have not been replaced as all tried wait conditions leaded to nondeterministic results, especially to succeeding concurrent updates. To replace the sleeps there should be some time planned (or internal knowledge of the server may help). --- mysql-test/include/concurrent.inc | 53 +++++++++++++------ mysql-test/r/concurrent_innodb_safelog.result | 28 +++------- .../r/concurrent_innodb_unsafelog.result | 28 +++------- 3 files changed, 52 insertions(+), 57 deletions(-) diff --git a/mysql-test/include/concurrent.inc b/mysql-test/include/concurrent.inc index 3b34a5b1ede..fe670cef08e 100644 --- a/mysql-test/include/concurrent.inc +++ b/mysql-test/include/concurrent.inc @@ -11,6 +11,11 @@ # $engine_type storage engine to be tested # # Last update: +# 2009-02-13 HH "Release_lock("hello")" is now also successful when delivering NULL, +# replaced two sleeps by wait_condition. The last two "sleep 1" have not been +# replaced as all tried wait conditions leaded to nondeterministic results, especially +# to succeeding concurrent updates. To replace the sleeps there should be some time +# planned (or internal knowledge of the server may help). # 2006-08-02 ML test refactored # old name was t/innodb_concurrent.test # main code went into include/concurrent.inc @@ -21,7 +26,6 @@ # connection default; - # # Show prerequisites for this test. # @@ -50,8 +54,6 @@ GRANT USAGE ON test.* TO mysqltest@localhost; # # Preparatory cleanup. # -DO release_lock("hello"); -DO release_lock("hello2"); --disable_warnings drop table if exists t1; --enable_warnings @@ -86,13 +88,14 @@ drop table if exists t1; connection thread2; --echo ** Start transaction for thread 2 begin; - --echo ** Update will cause a table scan and a new ULL will + --echo ** Update will cause a table scan and a new ULL will --echo ** be created and blocked on the first row where tipo=11. send update t1 set eta=1+get_lock("hello",10)*0 where tipo=11; - sleep 1; --echo ** connection thread1 connection thread1; + let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock'; + --source include/wait_condition.inc --echo ** Start new transaction for thread 1 begin; --echo ** Update on t1 will cause a table scan which will be blocked because @@ -111,7 +114,9 @@ drop table if exists t1; } --echo ** Release user level name lock from thread 1. This will cause the ULL --echo ** on thread 2 to end its wait. - select release_lock("hello"); +# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following +# is also guaranteed for NULL. Replaced SELECT by DO (no result). + DO release_lock("hello"); --echo ** Table is now updated with a new eta on tipo=22 for thread 1. select * from t1; @@ -119,7 +124,9 @@ drop table if exists t1; connection thread2; --echo ** Release the lock and collect result from update on thread 2 reap; - select release_lock("hello"); +# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following +# is also guaranteed for NULL. Replaced SELECT by DO (no result). + DO release_lock("hello"); --echo ** Table should have eta updates where tipo=11 but updates made by --echo ** thread 1 shouldn't be visible yet. select * from t1; @@ -183,10 +190,11 @@ drop table t1; --echo ** This will cause a hang on the first row where tipo=1 until the --echo ** blocking ULL is released. send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1; - sleep 1; - --echo ** connection thread1 +--echo ** connection thread1 connection thread1; + let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock'; + --source include/wait_condition.inc --echo ** Start transaction on thread 1 begin; --echo ** Update on t1 will cause a table scan which will be blocked because @@ -204,7 +212,9 @@ drop table t1; update t1 set tipo=1 where tipo=2; } --echo ** Release ULL. This will release the next waiting ULL on thread 2. - select release_lock("hello"); +# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically)the success of the following +# is also guaranteed for NULL. Replaced SELECT by DO (no result). + DO release_lock("hello"); --echo ** The table should still be updated with updates for thread 1 only: select * from t1; @@ -212,7 +222,9 @@ drop table t1; connection thread2; --echo ** Release the lock and collect result from thread 2: reap; - select release_lock("hello"); +# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following +# is also guaranteed for NULL. Replaced SELECT by DO (no result). + DO release_lock("hello"); --echo ** Seen from thread 2 the table should have been updated on four --echo ** places. select * from t1; @@ -264,15 +276,18 @@ drop table t1; --echo ** Update will create a table scan which creates a ULL where a=2; --echo ** this will hang waiting on thread 1. send update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2; - sleep 1; --echo ** connection thread1 connection thread1; + let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock'; + --source include/wait_condition.inc --echo ** Insert new values to t1 from thread 1; this created an implicit --echo ** commit since there are no on-going transactions. insert into t1 values (1,1); --echo ** Release the ULL (thread 2 updates will finish). - select release_lock("hello2"); +# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following +# is also guaranteed for NULL. Replaced SELECT by DO (no result). + DO release_lock("hello2"); --echo ** ..but thread 1 will still see t1 as if nothing has happend: select * from t1; @@ -280,7 +295,9 @@ drop table t1; connection thread2; --echo ** Collect results from thread 2 and release the lock. reap; - select release_lock("hello2"); +# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following +# is also guaranteed for NULL. Replaced SELECT by DO (no result). + DO release_lock("hello2"); --echo ** The table should look like the original+updates for thread 2, --echo ** and consist of new rows: select * from t1; @@ -534,6 +551,9 @@ drop table t1; connection thread2; begin; send delete from t1 where tipo=2; +# The sleep has not been replaced as all tried wait conditions leaded to sporadically +# succeding update in the following thread. Also the used status variables '%lock%' and +# 'innodb_deleted_rows' and infos in processlist where not sucessful. sleep 1; --echo ** connection thread1 @@ -594,8 +614,11 @@ drop table t1; connection thread2; begin; send delete from t1 where tipo=2; +# The sleep has not been replaced as all tried wait conditions leaded to sporadically +# succeding update in the following thread. Also the used status variables '%lock%' and +# 'innodb_deleted_rows' and infos in processlist where not sucessful. sleep 1; - + --echo ** connection thread1 connection thread1; begin; diff --git a/mysql-test/r/concurrent_innodb_safelog.result b/mysql-test/r/concurrent_innodb_safelog.result index 92d274993d9..e6adaac1068 100644 --- a/mysql-test/r/concurrent_innodb_safelog.result +++ b/mysql-test/r/concurrent_innodb_safelog.result @@ -7,8 +7,6 @@ SELECT @@global.innodb_locks_unsafe_for_binlog; 0 # keep_locks == 1 GRANT USAGE ON test.* TO mysqltest@localhost; -DO release_lock("hello"); -DO release_lock("hello2"); drop table if exists t1; ** @@ -36,7 +34,7 @@ get_lock("hello",10) ** connection thread2 ** Start transaction for thread 2 begin; -** Update will cause a table scan and a new ULL will +** Update will cause a table scan and a new ULL will ** be created and blocked on the first row where tipo=11. update t1 set eta=1+get_lock("hello",10)*0 where tipo=11; ** connection thread1 @@ -51,9 +49,7 @@ update t1 set eta=2 where tipo=22; ERROR HY000: Lock wait timeout exceeded; try restarting transaction ** Release user level name lock from thread 1. This will cause the ULL ** on thread 2 to end its wait. -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** Table is now updated with a new eta on tipo=22 for thread 1. select * from t1; eta tipo c @@ -70,9 +66,7 @@ eta tipo c 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk ** connection thread2 ** Release the lock and collect result from update on thread 2 -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** Table should have eta updates where tipo=11 but updates made by ** thread 1 shouldn't be visible yet. select * from t1; @@ -194,9 +188,7 @@ begin; update t1 set tipo=1 where tipo=2; ERROR HY000: Lock wait timeout exceeded; try restarting transaction ** Release ULL. This will release the next waiting ULL on thread 2. -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** The table should still be updated with updates for thread 1 only: select * from t1; eta tipo c @@ -213,9 +205,7 @@ eta tipo c 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk ** connection thread2 ** Release the lock and collect result from thread 2: -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** Seen from thread 2 the table should have been updated on four ** places. select * from t1; @@ -319,9 +309,7 @@ update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2; ** commit since there are no on-going transactions. insert into t1 values (1,1); ** Release the ULL (thread 2 updates will finish). -select release_lock("hello2"); -release_lock("hello2") -1 +DO release_lock("hello2"); ** ..but thread 1 will still see t1 as if nothing has happend: select * from t1; a b @@ -332,9 +320,7 @@ a b 1 1 ** connection thread2 ** Collect results from thread 2 and release the lock. -select release_lock("hello2"); -release_lock("hello2") -1 +DO release_lock("hello2"); ** The table should look like the original+updates for thread 2, ** and consist of new rows: select * from t1; diff --git a/mysql-test/r/concurrent_innodb_unsafelog.result b/mysql-test/r/concurrent_innodb_unsafelog.result index 2a6c15d38c1..e9c53d4cfa0 100644 --- a/mysql-test/r/concurrent_innodb_unsafelog.result +++ b/mysql-test/r/concurrent_innodb_unsafelog.result @@ -7,8 +7,6 @@ SELECT @@global.innodb_locks_unsafe_for_binlog; 1 # keep_locks == 0 GRANT USAGE ON test.* TO mysqltest@localhost; -DO release_lock("hello"); -DO release_lock("hello2"); drop table if exists t1; ** @@ -36,7 +34,7 @@ get_lock("hello",10) ** connection thread2 ** Start transaction for thread 2 begin; -** Update will cause a table scan and a new ULL will +** Update will cause a table scan and a new ULL will ** be created and blocked on the first row where tipo=11. update t1 set eta=1+get_lock("hello",10)*0 where tipo=11; ** connection thread1 @@ -50,9 +48,7 @@ begin; update t1 set eta=2 where tipo=22; ** Release user level name lock from thread 1. This will cause the ULL ** on thread 2 to end its wait. -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** Table is now updated with a new eta on tipo=22 for thread 1. select * from t1; eta tipo c @@ -69,9 +65,7 @@ eta tipo c 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk ** connection thread2 ** Release the lock and collect result from update on thread 2 -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** Table should have eta updates where tipo=11 but updates made by ** thread 1 shouldn't be visible yet. select * from t1; @@ -192,9 +186,7 @@ begin; ** do not match the WHERE condition are released. update t1 set tipo=1 where tipo=2; ** Release ULL. This will release the next waiting ULL on thread 2. -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** The table should still be updated with updates for thread 1 only: select * from t1; eta tipo c @@ -211,9 +203,7 @@ eta tipo c 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk ** connection thread2 ** Release the lock and collect result from thread 2: -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** Seen from thread 2 the table should have been updated on four ** places. select * from t1; @@ -317,9 +307,7 @@ update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2; ** commit since there are no on-going transactions. insert into t1 values (1,1); ** Release the ULL (thread 2 updates will finish). -select release_lock("hello2"); -release_lock("hello2") -1 +DO release_lock("hello2"); ** ..but thread 1 will still see t1 as if nothing has happend: select * from t1; a b @@ -330,9 +318,7 @@ a b 1 1 ** connection thread2 ** Collect results from thread 2 and release the lock. -select release_lock("hello2"); -release_lock("hello2") -1 +DO release_lock("hello2"); ** The table should look like the original+updates for thread 2, ** and consist of new rows: select * from t1; From 6efe0c341d28df9df0c7083da3275a5876924ca3 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Tue, 17 Mar 2009 18:24:35 +0100 Subject: [PATCH 17/17] 36446: fix Windows warning --- mysys/my_getopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 54410fc3d1e..4b74cdbf266 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -918,7 +918,7 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, if (num < (ulonglong) optp->min_value) { num= (ulonglong) optp->min_value; - if (old < optp->min_value) + if (old < (ulonglong) optp->min_value) adjusted= TRUE; }