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( diff --git a/include/my_sys.h b/include/my_sys.h index 8fda6178f6b..01804cd089f 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -843,14 +843,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/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result index 9ada5dc0784..08d8059f61b 100644 --- a/mysql-test/r/key_cache.result +++ b/mysql-test/r/key_cache.result @@ -276,8 +276,6 @@ Variable_name Value Key_blocks_unused KEY_BLOCKS_UNUSED set global keycache2.key_buffer_size=0; set global keycache3.key_buffer_size=100; -Warnings: -Warning 1292 Truncated incorrect key_buffer_size value: '100' set global keycache3.key_buffer_size=0; create table t1 (mytext text, FULLTEXT (mytext)); insert t1 values ('aaabbb'); 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/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; 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) 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/mysys/default.c b/mysys/default.c index c7e1e513e1e..a6995dbbd24 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -152,7 +152,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; 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..7fe498ae147 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() @@ -2922,18 +2925,16 @@ 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 "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*/ /** @@ -3221,6 +3222,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 +3889,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..1465b6d2d30 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; + + my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, NULL); 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; + } } /* 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++)) {