diff options
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r-- | sql/mysqld.cc | 2330 |
1 files changed, 366 insertions, 1964 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 26e208d23a7..36b261a1a70 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -28,8 +28,9 @@ #include "events.h" #include "probes_mysql.h" #include "debug_sync.h" - +#include "keycaches.h" #include "../storage/myisam/ha_myisam.h" +#include "set_var.h" #include "rpl_injector.h" @@ -39,15 +40,6 @@ #include <sys/prctl.h> #endif -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE -#if defined(NOT_ENOUGH_TESTED) \ - && defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000 -#define OPT_NDB_SHM_DEFAULT 1 -#else -#define OPT_NDB_SHM_DEFAULT 0 -#endif -#endif - #include <thr_alarm.h> #include <ft_global.h> #include <errmsg.h> @@ -56,18 +48,6 @@ #define mysqld_charset &my_charset_latin1 -#ifdef HAVE_purify -#define IF_PURIFY(A,B) (A) -#else -#define IF_PURIFY(A,B) (B) -#endif - -#if SIZEOF_CHARP == 4 -#define MAX_MEM_TABLE_SIZE ~(ulong) 0 -#else -#define MAX_MEM_TABLE_SIZE ~(ulonglong) 0 -#endif - /* stack traces are only supported on linux intel */ #if defined(__linux__) && defined(__i386__) && defined(USE_PSTACK) #define HAVE_STACK_TRACE_ON_SEGV @@ -278,85 +258,6 @@ extern "C" sig_handler handle_segfault(int sig); /* Constants */ const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"}; -/* - WARNING: When adding new SQL modes don't forget to update the - tables definitions that stores it's value. - (ie: mysql.event, mysql.proc) -*/ -static const char *sql_mode_names[]= -{ - "REAL_AS_FLOAT", "PIPES_AS_CONCAT", "ANSI_QUOTES", "IGNORE_SPACE", - "?", "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", "ALLOW_INVALID_DATES", - "ERROR_FOR_DIVISION_BY_ZERO", - "TRADITIONAL", "NO_AUTO_CREATE_USER", "HIGH_NOT_PRECEDENCE", - "NO_ENGINE_SUBSTITUTION", - "PAD_CHAR_TO_FULL_LENGTH", - NullS -}; - -static const unsigned int sql_mode_names_len[]= -{ - /*REAL_AS_FLOAT*/ 13, - /*PIPES_AS_CONCAT*/ 15, - /*ANSI_QUOTES*/ 11, - /*IGNORE_SPACE*/ 12, - /*?*/ 1, - /*ONLY_FULL_GROUP_BY*/ 18, - /*NO_UNSIGNED_SUBTRACTION*/ 23, - /*NO_DIR_IN_CREATE*/ 16, - /*POSTGRESQL*/ 10, - /*ORACLE*/ 6, - /*MSSQL*/ 5, - /*DB2*/ 3, - /*MAXDB*/ 5, - /*NO_KEY_OPTIONS*/ 14, - /*NO_TABLE_OPTIONS*/ 16, - /*NO_FIELD_OPTIONS*/ 16, - /*MYSQL323*/ 8, - /*MYSQL40*/ 7, - /*ANSI*/ 4, - /*NO_AUTO_VALUE_ON_ZERO*/ 21, - /*NO_BACKSLASH_ESCAPES*/ 20, - /*STRICT_TRANS_TABLES*/ 19, - /*STRICT_ALL_TABLES*/ 17, - /*NO_ZERO_IN_DATE*/ 15, - /*NO_ZERO_DATE*/ 12, - /*ALLOW_INVALID_DATES*/ 19, - /*ERROR_FOR_DIVISION_BY_ZERO*/ 26, - /*TRADITIONAL*/ 11, - /*NO_AUTO_CREATE_USER*/ 19, - /*HIGH_NOT_PRECEDENCE*/ 19, - /*NO_ENGINE_SUBSTITUTION*/ 22, - /*PAD_CHAR_TO_FULL_LENGTH*/ 23 -}; - -TYPELIB sql_mode_typelib= { array_elements(sql_mode_names)-1,"", - sql_mode_names, - (unsigned int *)sql_mode_names_len }; - -static const char *optimizer_switch_names[]= -{ - "index_merge","index_merge_union","index_merge_sort_union", - "index_merge_intersection", "default", NullS -}; -/* Corresponding defines are named OPTIMIZER_SWITCH_XXX */ -static const unsigned int optimizer_switch_names_len[]= -{ - sizeof("index_merge") - 1, - sizeof("index_merge_union") - 1, - sizeof("index_merge_sort_union") - 1, - sizeof("index_merge_intersection") - 1, - sizeof("default") - 1 -}; -TYPELIB optimizer_switch_typelib= { array_elements(optimizer_switch_names)-1,"", - optimizer_switch_names, - (unsigned int *)optimizer_switch_names_len }; static const char *tc_heuristic_recover_names[]= { @@ -368,26 +269,8 @@ static TYPELIB tc_heuristic_recover_typelib= tc_heuristic_recover_names, NULL }; -static const char *thread_handling_names[]= -{ "one-thread-per-connection", "no-threads", -#if HAVE_POOL_OF_THREADS == 1 - "pool-of-threads", -#endif - NullS}; - -TYPELIB thread_handling_typelib= -{ - array_elements(thread_handling_names) - 1, "", - thread_handling_names, NULL -}; - const char *first_keyword= "first", *binary_keyword= "BINARY"; const char *my_localhost= "localhost", *delayed_user= "DELAYED"; -#if SIZEOF_OFF_T > 4 && defined(BIG_TABLES) -#define GET_HA_ROWS GET_ULL -#else -#define GET_HA_ROWS GET_ULONG -#endif bool opt_large_files= sizeof(my_off_t) > 4; @@ -418,26 +301,22 @@ static bool volatile ready_to_exit; static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0; static my_bool opt_short_log_format= 0; static uint kill_cached_threads, wake_thread; -static ulong killed_threads, thread_created; +static ulong killed_threads; static ulong max_used_connections; static volatile ulong cached_thread_count= 0; -static const char *sql_mode_str= "OFF"; -/* Text representation for OPTIMIZER_SWITCH_DEFAULT */ -static const char *optimizer_switch_str="index_merge=on,index_merge_union=on," - "index_merge_sort_union=on," - "index_merge_intersection=on"; -static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr; -static char *opt_init_slave, *lc_messages_dir_ptr, *opt_init_connect; +static char *mysqld_user, *mysqld_chroot; static char *default_character_set_name; static char *character_set_filesystem_name; static char *lc_messages; static char *lc_time_names_name; static char *my_bind_addr_str; -static char *default_collation_name; -static char *default_storage_engine_str; +static char *default_collation_name; +char *default_storage_engine; static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME; static I_List<THD> thread_cache; -static double long_query_time; +static bool binlog_format_used= false; + +LEX_STRING opt_init_connect, opt_init_slave; static pthread_cond_t COND_thread_cache, COND_flush_thread_cache; @@ -445,7 +324,7 @@ static pthread_cond_t COND_thread_cache, COND_flush_thread_cache; bool opt_update_log, opt_bin_log, opt_ignore_builtin_innodb= 0; my_bool opt_log, opt_slow_log; -ulong log_output_options; +ulonglong log_output_options; my_bool opt_log_queries_not_using_indexes= 0; bool opt_error_log= IF_WIN(1,0); bool opt_disable_networking=0, opt_skip_show_db=0; @@ -487,6 +366,13 @@ my_bool opt_local_infile, opt_slave_compressed_protocol; my_bool opt_safe_user_create = 0, opt_no_mix_types = 0; my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0; my_bool opt_log_slave_updates= 0; +char *opt_slave_skip_errors; + +/** + compatibility option: + - index usage hints (USE INDEX without a FOR clause) behave as in 5.0 +*/ +my_bool old_mode; /* Legacy global handlerton. These will be removed (please do not add more). @@ -495,38 +381,18 @@ handlerton *heap_hton; handlerton *myisam_hton; handlerton *partition_hton; -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE -const char *opt_ndbcluster_connectstring= 0; -const char *opt_ndb_connectstring= 0; -char opt_ndb_constrbuf[1024]= {0}; -unsigned opt_ndb_constrbuf_len= 0; -my_bool opt_ndb_shm, opt_ndb_optimized_node_selection; -ulong opt_ndb_cache_check_time; -const char *opt_ndb_mgmd; -ulong opt_ndb_nodeid; -ulong ndb_extra_logging; -#ifdef HAVE_NDB_BINLOG -ulong ndb_report_thresh_binlog_epoch_slip; -ulong ndb_report_thresh_binlog_mem_usage; -#endif - -extern const char *ndb_distribution_names[]; -extern TYPELIB ndb_distribution_typelib; -extern const char *opt_ndb_distribution; -extern enum ndb_distribution opt_ndb_distribution_id; -#endif -my_bool opt_readonly, use_temp_pool, relay_log_purge; +my_bool opt_readonly= 0, use_temp_pool, relay_log_purge; my_bool relay_log_recovery; my_bool opt_sync_frm, opt_allow_suspicious_udfs; my_bool opt_secure_auth= 0; -char* opt_secure_file_priv= 0; +char* opt_secure_file_priv; my_bool opt_log_slow_admin_statements= 0; my_bool opt_log_slow_slave_statements= 0; my_bool lower_case_file_system= 0; my_bool opt_large_pages= 0; my_bool opt_super_large_pages= 0; my_bool opt_myisam_use_mmap= 0; -uint opt_large_page_size= 0; +uint opt_large_page_size= 0; #if defined(ENABLED_DEBUG_SYNC) uint opt_debug_sync_timeout= 0; #endif /* defined(ENABLED_DEBUG_SYNC) */ @@ -545,27 +411,25 @@ const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS}; TYPELIB binlog_format_typelib= { array_elements(binlog_format_names) - 1, "", binlog_format_names, NULL }; -ulong opt_binlog_format_id= (ulong) BINLOG_FORMAT_UNSPEC; -const char *opt_binlog_format= binlog_format_names[opt_binlog_format_id]; #ifdef HAVE_INITGROUPS static bool calling_initgroups= FALSE; /**< Used in SIGSEGV handler. */ #endif uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options; uint mysqld_port_timeout; -uint delay_key_write_options, protocol_version; +uint delay_key_write_options; +uint protocol_version; uint lower_case_table_names; uint tc_heuristic_recover= 0; uint volatile thread_count; int32 thread_running; -ulonglong thd_startup_options; +ulong thread_created; ulong back_log, connect_timeout, concurrency, server_id; ulong table_cache_size, table_def_size; ulong what_to_log; ulong query_buff_size, slow_launch_time, slave_open_temp_tables; ulong open_files_limit, max_binlog_size, max_relay_log_size; ulong slave_net_timeout, slave_trans_retries; -ulong slave_exec_mode_options; -const char *slave_exec_mode_str= "STRICT"; +uint slave_exec_mode_options; ulong thread_cache_size=0, thread_pool_size= 0; ulong binlog_cache_size=0; ulonglong max_binlog_cache_size=0; @@ -581,7 +445,6 @@ ulong delayed_insert_errors,flush_time; ulong specialflag=0; ulong binlog_cache_use= 0, binlog_cache_disk_use= 0; ulong max_connections, max_connect_errors; -uint max_user_connections= 0; /** Limit of the total number of prepared statements in the server. Is necessary to protect the server against out-of-memory attacks. @@ -604,7 +467,6 @@ uint sync_binlog_period= 0, sync_relaylog_period= 0, sync_relayloginfo_period= 0, sync_masterinfo_period= 0; ulong expire_logs_days = 0; ulong rpl_recovery_rank=0; -const char *log_output_str= "FILE"; const double log_10[] = { 1e000, 1e001, 1e002, 1e003, 1e004, 1e005, 1e006, 1e007, 1e008, 1e009, @@ -649,25 +511,26 @@ char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN]; char mysql_real_data_home[FN_REFLEN], lc_messages_dir[FN_REFLEN], reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN], - *opt_init_file, *opt_tc_log_file, - def_ft_boolean_syntax[sizeof(ft_boolean_syntax)]; + *opt_init_file, *opt_tc_log_file; +char *lc_messages_dir_ptr, *log_error_file_ptr; char err_shared_dir[FN_REFLEN]; char mysql_unpacked_real_data_home[FN_REFLEN]; int mysql_unpacked_real_data_home_len; +uint mysql_real_data_home_len, mysql_data_home_len= 1; uint reg_ext_length; const key_map key_map_empty(0); key_map key_map_full(0); // Will be initialized later -const char *opt_date_time_formats[3]; +DATE_TIME_FORMAT global_date_format, global_datetime_format, global_time_format; +Time_zone *default_tz; -uint mysql_data_home_len; -char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home; +char *mysql_data_home= const_cast<char*>("."); +const char *mysql_real_data_home_ptr= mysql_real_data_home; char server_version[SERVER_VERSION_LENGTH]; char *mysqld_unix_port, *opt_mysql_tmpdir; -const char *myisam_recover_options_str="OFF"; -const char *myisam_stats_method_str="nulls_unequal"; +uint thread_handling; -/** name of reference on left espression in rewritten IN subquery */ +/** name of reference on left expression in rewritten IN subquery */ const char *in_left_expr_name= "<left expr>"; /** name of additional condition */ const char *in_additional_cond= "<IN COND>"; @@ -687,7 +550,6 @@ int bootstrap_error; FILE *stderror_file=0; I_List<THD> threads; -I_List<NAMED_LIST> key_caches; Rpl_filter* rpl_filter; Rpl_filter* binlog_filter; @@ -765,10 +627,9 @@ static my_bool opt_do_pstack; #endif /* HAVE_STACK_TRACE_ON_SEGV */ static my_bool opt_bootstrap, opt_myisam_log; static int cleanup_done; -static ulong opt_specialflag, opt_myisam_block_size; +static ulong opt_specialflag; static char *opt_update_logname, *opt_binlog_index_name; -static char *opt_tc_heuristic_recover; -static char *mysql_home_ptr, *pidfile_name_ptr; +char *mysql_home_ptr, *pidfile_name_ptr; static int defaults_argc; static char **defaults_argv; static char *opt_bin_logname; @@ -829,7 +690,6 @@ int allow_severity = LOG_INFO; int deny_severity = LOG_WARNING; #endif #ifdef HAVE_QUERY_CACHE -static ulong query_cache_limit= 0; ulong query_cache_min_res_unit= QUERY_CACHE_MIN_RESULT_DATA_SIZE; Query_cache query_cache; #endif @@ -841,8 +701,10 @@ HANDLE smem_event_connect_request= 0; scheduler_functions thread_scheduler; -#define SSL_VARS_NOT_STATIC -#include "sslopt-vars.h" +my_bool opt_use_ssl = 0; +char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL, + *opt_ssl_cipher= NULL, *opt_ssl_key= NULL; + #ifdef HAVE_OPENSSL #include <openssl/crypto.h> #ifndef HAVE_YASSL @@ -892,9 +754,6 @@ pthread_handler_t handle_connections_namedpipes(void *arg); pthread_handler_t handle_connections_shared_memory(void *arg); #endif pthread_handler_t handle_slave(void *arg); -static ulong find_bit_type(const char *x, TYPELIB *bit_lib); -static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib, - const char *option, int *error); static void clean_up(bool print_message); static int test_if_case_insensitive(const char *dir_name); @@ -1369,7 +1228,6 @@ void clean_up(bool print_message) item_user_lock_free(); lex_free(); /* Free some memory */ item_create_cleanup(); - set_var_free(); if (!opt_noacl) { #ifdef HAVE_DLOPEN @@ -1385,30 +1243,15 @@ void clean_up(bool print_message) xid_cache_free(); table_def_free(); mdl_destroy(); - delete_elements(&key_caches, (void (*)(const char*, uchar*)) free_key_cache); + key_caches.delete_elements((void (*)(const char*, uchar*)) free_key_cache); multi_keycache_free(); free_status_vars(); end_thr_alarm(1); /* Free allocated memory */ my_free_open_file_info(); - my_free((char*) global_system_variables.date_format, - MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) global_system_variables.time_format, - MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) global_system_variables.datetime_format, - MYF(MY_ALLOW_ZERO_PTR)); if (defaults_argv) free_defaults(defaults_argv); - my_free(sys_init_connect.value, MYF(MY_ALLOW_ZERO_PTR)); - my_free(sys_init_slave.value, MYF(MY_ALLOW_ZERO_PTR)); - my_free(sys_var_general_log_path.value, MYF(MY_ALLOW_ZERO_PTR)); - my_free(sys_var_slow_log_path.value, MYF(MY_ALLOW_ZERO_PTR)); free_tmpdir(&mysql_tmpdir_list); -#ifdef HAVE_REPLICATION - my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR)); -#endif x_free(opt_bin_logname); - x_free(opt_relay_logname); - x_free(opt_secure_file_priv); bitmap_free(&temp_pool); free_max_user_conn(); #ifdef HAVE_REPLICATION @@ -1432,7 +1275,7 @@ void clean_up(bool print_message) if (!opt_bootstrap) (void) my_delete(pidfile_name,MYF(0)); // This may not always exist #endif - if (print_message && /*errmesg &&*/ server_start_time) + if (print_message && my_default_lc_messages && server_start_time) sql_print_information(ER_DEFAULT(ER_SHUTDOWN_COMPLETE),my_progname); cleanup_errmsgs(); thread_scheduler.end(); @@ -1448,6 +1291,7 @@ void clean_up(bool print_message) /* do the broadcast inside the lock to ensure that my_end() is not called */ (void) pthread_cond_broadcast(&COND_thread_count); (void) pthread_mutex_unlock(&LOCK_thread_count); + sys_var_end(); /* The following lines may never be executed as the main thread may have @@ -1527,7 +1371,6 @@ static void clean_up_mutexes() (void) pthread_cond_destroy(&COND_flush_thread_cache); (void) pthread_cond_destroy(&COND_manager); } - #endif /*EMBEDDED_LIBRARY*/ @@ -3055,10 +2898,6 @@ sizeof(load_default_groups)/sizeof(load_default_groups[0]); @param format_type What kind of format should be supported @param var_ptr Pointer to variable that should be updated - @note - The default value is taken from either opt_date_time_formats[] or - the ISO format (ANSI SQL) - @retval 0 ok @retval @@ -3066,27 +2905,21 @@ sizeof(load_default_groups)/sizeof(load_default_groups[0]); */ static bool init_global_datetime_format(timestamp_type format_type, - DATE_TIME_FORMAT **var_ptr) + DATE_TIME_FORMAT *format) { - /* Get command line option */ - const char *str= opt_date_time_formats[format_type]; + /* + Get command line option + format->format.str is already set by my_getopt + */ + format->format.length= strlen(format->format.str); - if (!str) // No specified format + if (parse_date_time_format(format_type, format)) { - str= get_date_time_format_str(&known_date_time_formats[ISO_FORMAT], - format_type); - /* - Set the "command line" option to point to the generated string so - that we can set global formats back to default - */ - opt_date_time_formats[format_type]= str; + fprintf(stderr, "Wrong date/time format specifier: %s\n", + format->format.str); + return true; } - if (!(*var_ptr= date_time_format_make(format_type, str, strlen(str)))) - { - fprintf(stderr, "Wrong date/time format specifier: %s\n", str); - return 1; - } - return 0; + return false; } SHOW_VAR com_status_vars[]= { @@ -3239,10 +3072,22 @@ SHOW_VAR com_status_vars[]= { {NullS, NullS, SHOW_LONG} }; +/** + Create the name of the default general log file + + @param[IN] buff Location for building new string. + @param[IN] log_ext The extension for the file (e.g .log) + @returns Pointer to a new string containing the name +*/ +static inline char *make_default_log_name(char *buff,const char* log_ext) +{ + return make_log_name(buff, default_logfile_name, log_ext); +} + static int init_common_variables(const char *conf_file_name, int argc, char **argv, const char **groups) { - char buff[FN_REFLEN], *s; + char buff[FN_REFLEN]; umask(((~my_umask) & 0666)); my_decimal_set_zero(&decimal_zero); // set decimal_zero constant; tzset(); // Set tzname @@ -3484,12 +3329,6 @@ static int init_common_variables(const char *conf_file_name, int argc, if (item_create_init()) return 1; item_init(); - if (set_var_init()) - return 1; -#ifdef HAVE_REPLICATION - if (init_replication_sys_vars()) - return 1; -#endif mysys_uses_curses=0; #ifdef USE_REGEX my_regex_init(&my_charset_latin1); @@ -3544,8 +3383,7 @@ static int init_common_variables(const char *conf_file_name, int argc, global_system_variables.collation_database= default_charset_info; global_system_variables.collation_connection= default_charset_info; global_system_variables.character_set_results= default_charset_info; - global_system_variables.character_set_client= default_charset_info; - + global_system_variables.character_set_client= default_charset_info; if (!(character_set_filesystem= get_charset_by_csname(character_set_filesystem_name, MY_CS_PRIMARY, MYF(MY_WME)))) @@ -3559,20 +3397,6 @@ static int init_common_variables(const char *conf_file_name, int argc, return 1; } global_system_variables.lc_time_names= my_default_lc_time_names; - - sys_init_connect.value_length= 0; - if ((sys_init_connect.value= opt_init_connect)) - sys_init_connect.value_length= strlen(opt_init_connect); - else - sys_init_connect.value=my_strdup("",MYF(0)); - sys_init_connect.is_os_charset= TRUE; - - sys_init_slave.value_length= 0; - if ((sys_init_slave.value= opt_init_slave)) - sys_init_slave.value_length= strlen(opt_init_slave); - else - sys_init_slave.value=my_strdup("",MYF(0)); - sys_init_slave.is_os_charset= TRUE; /* check log options and issue warnings if needed */ if (opt_log && opt_logname && !(log_output_options & LOG_FILE) && @@ -3587,13 +3411,17 @@ static int init_common_variables(const char *conf_file_name, int argc, "--log-slow-queries option, log tables are used. " "To enable logging to files use the --log-output=file option."); - s= opt_logname ? opt_logname : make_default_log_name(buff, ".log"); - sys_var_general_log_path.value= my_strdup(s, MYF(0)); - sys_var_general_log_path.value_length= strlen(s); +#define FIX_LOG_VAR(VAR, ALT) \ + if (!VAR || !*VAR) \ + { \ + x_free(VAR); /* it could be an allocated empty string "" */ \ + VAR= my_strdup(ALT, MYF(0)); \ + } - s= opt_slow_logname ? opt_slow_logname : make_default_log_name(buff, "-slow.log"); - sys_var_slow_log_path.value= my_strdup(s, MYF(0)); - sys_var_slow_log_path.value_length= strlen(s); + FIX_LOG_VAR(opt_logname, + make_default_log_name(buff, ".log")); + FIX_LOG_VAR(opt_slow_logname, + make_default_log_name(buff, "-slow.log")); #if defined(ENABLED_DEBUG_SYNC) /* Initialize the debug sync facility. See debug_sync.cc. */ @@ -3856,7 +3684,7 @@ static void end_ssl() static int init_server_components() { - FILE* reopen; + FILE *reopen; DBUG_ENTER("init_server_components"); /* We need to call each of these following functions to ensure that @@ -3866,7 +3694,6 @@ static int init_server_components() if (table_def_init() | hostname_cache_init()) unireg_abort(1); - query_cache_result_size_limit(query_cache_limit); query_cache_set_min_res_unit(query_cache_min_res_unit); query_cache_init(); query_cache_resize(query_cache_size); @@ -3893,7 +3720,7 @@ static int init_server_components() fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err", MY_UNPACK_FILENAME | MY_SAFE_PATH); if (!log_error_file[0]) - opt_error_log= 1; // Too long file name + opt_error_log= 0; // Too long file name else { #ifndef EMBEDDED_LIBRARY @@ -3984,27 +3811,9 @@ with --log-bin instead."); sql_print_warning("You need to use --log-bin to make " "--log-slave-updates work."); } - if (!opt_bin_log) - { - if (opt_binlog_format_id != BINLOG_FORMAT_UNSPEC) - { - sql_print_warning("You need to use --log-bin to make " - "--binlog-format work."); - - global_system_variables.binlog_format= opt_binlog_format_id; - } - else - { - global_system_variables.binlog_format= BINLOG_FORMAT_STMT; - } - } - else - if (opt_binlog_format_id == BINLOG_FORMAT_UNSPEC) - global_system_variables.binlog_format= BINLOG_FORMAT_STMT; - else - { - DBUG_ASSERT(global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC); - } + if (!opt_bin_log && binlog_format_used) + sql_print_warning("You need to use --log-bin to make " + "--binlog-format work."); /* Check that we have not let the format to unspecified at this point */ DBUG_ASSERT((uint)global_system_variables.binlog_format <= @@ -4086,19 +3895,21 @@ a file name for --log-bin-index option", opt_binlog_index_name); if (ha_init_errors()) DBUG_RETURN(1); - { - if (plugin_init(&defaults_argc, defaults_argv, - (opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) | - (opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0))) - { - sql_print_error("Failed to initialize plugins."); - unireg_abort(1); - } - plugins_are_initialized= TRUE; /* Don't separate from init function */ + if (plugin_init(&defaults_argc, defaults_argv, + (opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) | + (opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0))) + { + sql_print_error("Failed to initialize plugins."); + unireg_abort(1); } + plugins_are_initialized= TRUE; /* Don't separate from init function */ - if (opt_help) - unireg_abort(0); + have_csv= plugin_status(STRING_WITH_LEN("csv"), + MYSQL_STORAGE_ENGINE_PLUGIN); + have_ndbcluster= plugin_status(STRING_WITH_LEN("ndbcluster"), + MYSQL_STORAGE_ENGINE_PLUGIN); + have_partitioning= plugin_status(STRING_WITH_LEN("partition"), + MYSQL_STORAGE_ENGINE_PLUGIN); /* we do want to exit if there are any other unknown options */ if (defaults_argc > 1) @@ -4131,6 +3942,9 @@ a file name for --log-bin-index option", opt_binlog_index_name); } } + if (opt_help) + unireg_abort(0); + /* if the errmsg.sys is not loaded, terminate to maintain behaviour */ if (!DEFAULT_ERRMSGS[0][0]) unireg_abort(1); @@ -4182,42 +3996,37 @@ a file name for --log-bin-index option", opt_binlog_index_name); #endif /* - Check that the default storage engine is actually available. + Set the default storage engine */ - if (default_storage_engine_str) + LEX_STRING name= { default_storage_engine, strlen(default_storage_engine) }; + plugin_ref plugin; + handlerton *hton; + if ((plugin= ha_resolve_by_name(0, &name))) + hton= plugin_data(plugin, handlerton*); + else { - LEX_STRING name= { default_storage_engine_str, - strlen(default_storage_engine_str) }; - plugin_ref plugin; - handlerton *hton; - - if ((plugin= ha_resolve_by_name(0, &name))) - hton= plugin_data(plugin, handlerton*); - else + sql_print_error("Unknown/unsupported storage engine: %s", + default_storage_engine); + unireg_abort(1); + } + if (!ha_storage_engine_is_enabled(hton)) + { + if (!opt_bootstrap) { - sql_print_error("Unknown/unsupported table type: %s", - default_storage_engine_str); + sql_print_error("Default storage engine (%s) is not available", + default_storage_engine); unireg_abort(1); } - if (!ha_storage_engine_is_enabled(hton)) - { - if (!opt_bootstrap) - { - sql_print_error("Default storage engine (%s) is not available", - default_storage_engine_str); - unireg_abort(1); - } - DBUG_ASSERT(global_system_variables.table_plugin); - } - else - { - /* - Need to unlock as global_system_variables.table_plugin - was acquired during plugin_init() - */ - plugin_unlock(0, global_system_variables.table_plugin); - global_system_variables.table_plugin= plugin; - } + DBUG_ASSERT(global_system_variables.table_plugin); + } + else + { + /* + Need to unlock as global_system_variables.table_plugin + was acquired during plugin_init() + */ + plugin_unlock(0, global_system_variables.table_plugin); + global_system_variables.table_plugin= plugin; } tc_log= (total_ha_2pc > 1 ? (opt_bin_log ? @@ -4517,10 +4326,6 @@ int main(int argc, char **argv) check_data_home(mysql_real_data_home); if (my_setwd(mysql_real_data_home,MYF(MY_WME)) && !opt_help) unireg_abort(1); /* purecov: inspected */ - mysql_data_home= mysql_data_home_buff; - mysql_data_home[0]=FN_CURLIB; // all paths are relative from here - mysql_data_home[1]=0; - mysql_data_home_len= 2; if ((user_info= check_user(mysqld_user))) { @@ -4588,6 +4393,7 @@ int main(int argc, char **argv) unlink(mysqld_unix_port); exit(1); } + if (!opt_noacl) (void) grant_init(); @@ -4626,7 +4432,7 @@ int main(int argc, char **argv) bootstrap(stdin); unireg_abort(bootstrap_error ? 1 : 0); } - if (opt_init_file) + if (opt_init_file && *opt_init_file) { if (read_init_file(opt_init_file)) unireg_abort(1); @@ -5682,179 +5488,13 @@ error: Handle start options ******************************************************************************/ -enum options_mysqld -{ - OPT_ISAM_LOG=256, OPT_SKIP_NEW, - OPT_SKIP_GRANT, OPT_SKIP_LOCK, - OPT_ENABLE_LOCK, OPT_USE_LOCKING, - OPT_SOCKET, OPT_UPDATE_LOG, - OPT_BIN_LOG, OPT_SKIP_RESOLVE, - OPT_SKIP_NETWORKING, OPT_BIN_LOG_INDEX, - OPT_BIND_ADDRESS, OPT_PID_FILE, - OPT_SKIP_PRIOR, OPT_BIG_TABLES, - OPT_STANDALONE, OPT_ONE_THREAD, - OPT_CONSOLE, OPT_LOW_PRIORITY_UPDATES, - OPT_SKIP_HOST_CACHE, OPT_SHORT_LOG_FORMAT, - OPT_FLUSH, OPT_SAFE, - OPT_BOOTSTRAP, OPT_SKIP_SHOW_DB, - OPT_STORAGE_ENGINE, OPT_INIT_FILE, - OPT_DELAY_KEY_WRITE_ALL, OPT_SLOW_QUERY_LOG, - OPT_DELAY_KEY_WRITE, OPT_CHARSETS_DIR, - OPT_MASTER_INFO_FILE, - OPT_MASTER_RETRY_COUNT, OPT_LOG_TC, OPT_LOG_TC_SIZE, - OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB, - OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES, - OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB, - OPT_BINLOG_FORMAT, -#ifndef DBUG_OFF - OPT_BINLOG_SHOW_XID, -#endif - OPT_BINLOG_ROWS_EVENT_MAX_SIZE, - OPT_WANT_CORE, OPT_CONCURRENT_INSERT, - OPT_MEMLOCK, OPT_MYISAM_RECOVER, - OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID, - OPT_SKIP_SLAVE_START, OPT_SAFE_SHOW_DB, - OPT_SAFEMALLOC_MEM_LIMIT, OPT_REPLICATE_DO_TABLE, - OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE, - OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID, - OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER, - OPT_ABORT_SLAVE_EVENT_COUNT, - OPT_LOG_BIN_TRUST_FUNCTION_CREATORS, - OPT_ENGINE_CONDITION_PUSHDOWN, OPT_NDB_CONNECTSTRING, - OPT_NDB_USE_EXACT_COUNT, OPT_NDB_USE_TRANSACTIONS, - OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ, - OPT_NDB_SHM, OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_CACHE_CHECK_TIME, - OPT_NDB_MGMD, OPT_NDB_NODEID, - OPT_NDB_DISTRIBUTION, - OPT_NDB_INDEX_STAT_ENABLE, - OPT_NDB_EXTRA_LOGGING, - OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP, - OPT_NDB_REPORT_THRESH_BINLOG_MEM_USAGE, - OPT_NDB_USE_COPYING_ALTER_TABLE, - OPT_SKIP_SAFEMALLOC, - OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE, - OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, - OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL, - OPT_SAFE_USER_CREATE, OPT_SQL_MODE, - OPT_HAVE_NAMED_PIPE, - OPT_DO_PSTACK, OPT_EVENT_SCHEDULER, OPT_REPORT_HOST, - OPT_REPORT_USER, OPT_REPORT_PASSWORD, OPT_REPORT_PORT, - OPT_SHOW_SLAVE_AUTH_INFO, - OPT_SLAVE_LOAD_TMPDIR, OPT_NO_MIX_TYPE, - OPT_RPL_RECOVERY_RANK,OPT_INIT_RPL_ROLE, - OPT_RELAY_LOG, OPT_RELAY_LOG_INDEX, OPT_RELAY_LOG_INFO_FILE, - OPT_SLAVE_SKIP_ERRORS, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE, - OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, - OPT_SSL_CAPATH, OPT_SSL_CIPHER, - OPT_BACK_LOG, OPT_BINLOG_CACHE_SIZE, - OPT_CONNECT_TIMEOUT, OPT_DELAYED_INSERT_TIMEOUT, - OPT_DELAYED_INSERT_LIMIT, OPT_DELAYED_QUEUE_SIZE, - OPT_FLUSH_TIME, OPT_FT_MIN_WORD_LEN, OPT_FT_BOOLEAN_SYNTAX, - OPT_FT_MAX_WORD_LEN, OPT_FT_QUERY_EXPANSION_LIMIT, OPT_FT_STOPWORD_FILE, - OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE, - OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_BLOCK_SIZE, - OPT_KEY_CACHE_DIVISION_LIMIT, OPT_KEY_CACHE_AGE_THRESHOLD, - OPT_LONG_QUERY_TIME, - OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET, - OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE, - OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS, - OPT_MAX_DELAYED_THREADS, OPT_MAX_HEP_TABLE_SIZE, - OPT_MAX_JOIN_SIZE, OPT_MAX_PREPARED_STMT_COUNT, - OPT_MAX_RELAY_LOG_SIZE, OPT_MAX_SORT_LENGTH, - OPT_MAX_SEEKS_FOR_KEY, OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS, - OPT_MAX_LENGTH_FOR_SORT_DATA, - OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE, - OPT_MAX_ERROR_COUNT, OPT_MULTI_RANGE_COUNT, OPT_MYISAM_DATA_POINTER_SIZE, - OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, - OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE, - OPT_MYISAM_USE_MMAP, OPT_MYISAM_REPAIR_THREADS, - OPT_MYISAM_MMAP_SIZE, - OPT_MYISAM_STATS_METHOD, - OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT, - OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT, - OPT_OPEN_FILES_LIMIT, - OPT_PRELOAD_BUFFER_SIZE, - OPT_QUERY_CACHE_LIMIT, OPT_QUERY_CACHE_MIN_RES_UNIT, OPT_QUERY_CACHE_SIZE, - OPT_QUERY_CACHE_TYPE, OPT_QUERY_CACHE_WLOCK_INVALIDATE, OPT_RECORD_BUFFER, - OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT, OPT_RELAY_LOG_SPACE_LIMIT, - OPT_RELAY_LOG_PURGE, - OPT_RELAY_LOG_RECOVERY, - OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME, - OPT_SLAVE_TRANS_RETRIES, OPT_READONLY, OPT_DEBUGGING, - OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE, - OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE, - OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK, - OPT_WAIT_TIMEOUT, - OPT_ERROR_LOG_FILE, - OPT_DEFAULT_WEEK_FORMAT, - OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS, - OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE, - OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE, - OPT_SYNC_FRM, OPT_SYNC_BINLOG, - OPT_SYNC_REPLICATION, - OPT_SYNC_REPLICATION_SLAVE_ID, - OPT_SYNC_REPLICATION_TIMEOUT, - OPT_ENABLE_SHARED_MEMORY, - OPT_SHARED_MEMORY_BASE_NAME, - OPT_OLD_PASSWORDS, - OPT_OLD_ALTER_TABLE, - OPT_EXPIRE_LOGS_DAYS, - OPT_GROUP_CONCAT_MAX_LEN, - OPT_DEFAULT_COLLATION, - OPT_CHARACTER_SET_CLIENT_HANDSHAKE, - OPT_CHARACTER_SET_FILESYSTEM, - OPT_LC_ERROR_MESSAGES, - OPT_LC_TIME_NAMES, - OPT_INIT_CONNECT, - OPT_INIT_SLAVE, - OPT_SECURE_AUTH, - OPT_DATE_FORMAT, - OPT_TIME_FORMAT, - OPT_DATETIME_FORMAT, - OPT_LOG_QUERIES_NOT_USING_INDEXES, - OPT_DEFAULT_TIME_ZONE, - OPT_SYSDATE_IS_NOW, - OPT_OPTIMIZER_SEARCH_DEPTH, - OPT_OPTIMIZER_PRUNE_LEVEL, - OPT_OPTIMIZER_SWITCH, - OPT_UPDATABLE_VIEWS_WITH_LIMIT, - OPT_SP_AUTOMATIC_PRIVILEGES, - OPT_MAX_SP_RECURSION_DEPTH, - OPT_AUTO_INCREMENT, OPT_AUTO_INCREMENT_OFFSET, - OPT_ENABLE_LARGE_PAGES, - OPT_ENABLE_SUPER_LARGE_PAGES, - OPT_TIMED_MUTEXES, - OPT_OLD_STYLE_USER_LIMITS, - OPT_LOG_SLOW_ADMIN_STATEMENTS, - OPT_TABLE_LOCK_WAIT_TIMEOUT, - OPT_PLUGIN_LOAD, - OPT_PLUGIN_DIR, - OPT_LOG_OUTPUT, - OPT_PORT_OPEN_TIMEOUT, - OPT_PROFILING, - OPT_KEEP_FILES_ON_CREATE, - OPT_GENERAL_LOG, - OPT_SLOW_LOG, - OPT_THREAD_HANDLING, - OPT_INNODB_ROLLBACK_ON_TIMEOUT, - OPT_SECURE_FILE_PRIV, - OPT_MIN_EXAMINED_ROW_LIMIT, - OPT_LOG_SLOW_SLAVE_STATEMENTS, -#if defined(ENABLED_DEBUG_SYNC) - OPT_DEBUG_SYNC_TIMEOUT, -#endif /* defined(ENABLED_DEBUG_SYNC) */ - OPT_OLD_MODE, - OPT_SLAVE_EXEC_MODE, - OPT_GENERAL_LOG_FILE, - OPT_SLOW_QUERY_LOG_FILE, - OPT_IGNORE_BUILTIN_INNODB, - OPT_SYNC_RELAY_LOG, - OPT_SYNC_RELAY_LOG_INFO, - OPT_SYNC_MASTER_INFO -}; - +DYNAMIC_ARRAY all_options; -#define LONG_TIMEOUT ((ulong) 3600L*24L*365L) +/** + System variables are automatically command-line options (few + exceptions are documented in sys_var.h), so don't need + to be listed here. +*/ struct my_option my_long_options[] = { @@ -5862,12 +5502,12 @@ struct my_option my_long_options[] = (uchar**) &opt_help, (uchar**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_REPLICATION - {"abort-slave-event-count", OPT_ABORT_SLAVE_EVENT_COUNT, + {"abort-slave-event-count", 0, "Option used by mysql-test for debugging and testing of replication.", (uchar**) &abort_slave_event_count, (uchar**) &abort_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ - {"allow-suspicious-udfs", OPT_ALLOW_SUSPICIOUS_UDFS, + {"allow-suspicious-udfs", 0, "Allows use of UDFs consisting of only one symbol xxx() " "without corresponding xxx_init() or xxx_deinit(). That also means " "that one can load any function from any library, for example exit() " @@ -5876,51 +5516,16 @@ struct my_option my_long_options[] = 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode will also set transaction isolation level 'serializable'.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-increment-increment", OPT_AUTO_INCREMENT, - "Auto-increment columns are incremented by this", - (uchar**) &global_system_variables.auto_increment_increment, - (uchar**) &max_system_variables.auto_increment_increment, 0, GET_ULONG, - OPT_ARG, 1, 1, 65535, 0, 1, 0 }, - {"auto-increment-offset", OPT_AUTO_INCREMENT_OFFSET, - "Offset added to Auto-increment columns. Used when auto-increment-increment != 1", - (uchar**) &global_system_variables.auto_increment_offset, - (uchar**) &max_system_variables.auto_increment_offset, 0, GET_ULONG, OPT_ARG, - 1, 1, 65535, 0, 1, 0 }, - {"automatic-sp-privileges", OPT_SP_AUTOMATIC_PRIVILEGES, - "Creating and dropping stored procedures alters ACLs. Disable with --skip-automatic-sp-privileges.", - (uchar**) &sp_automatic_privileges, (uchar**) &sp_automatic_privileges, - 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"basedir", 'b', - "Path to installation directory. All paths are usually resolved relative to this.", - (uchar**) &mysql_home_ptr, (uchar**) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, - {"big-tables", OPT_BIG_TABLES, - "Allow big result sets by saving all temporary sets on file (Solves most 'table full' errors).", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.", (uchar**) &my_bind_addr_str, (uchar**) &my_bind_addr_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"binlog_format", OPT_BINLOG_FORMAT, - "Does not have any effect without '--log-bin'. " - "Tell the master the form of binary logging to use: either 'row' for " - "row-based binary logging, or 'statement' for statement-based binary " - "logging, or 'mixed'. 'mixed' is statement-based binary logging except " - "for those statements where only row-based is correct: those which " - "involve user-defined functions (i.e. UDFs) or the UUID() function; for " - "those, row-based binary logging is automatically used. " -#ifdef HAVE_NDB_BINLOG - "If ndbcluster is enabled and binlog_format is `mixed', the format switches" - " to 'row' and back implicitly per each query accessing a NDB table." -#endif - ,(uchar**) &opt_binlog_format, (uchar**) &opt_binlog_format, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"binlog-do-db", OPT_BINLOG_DO_DB, "Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"binlog-ignore-db", OPT_BINLOG_IGNORE_DB, "Tells the master that updates to the given database should not be logged tothe binary log.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"binlog-row-event-max-size", OPT_BINLOG_ROWS_EVENT_MAX_SIZE, + {"binlog-row-event-max-size", 0, "The maximum size of a row-based binary log event in bytes. Rows will be " "grouped into events smaller than this size if possible. " "The value has to be a multiple of 256.", @@ -5935,12 +5540,12 @@ struct my_option my_long_options[] = {"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE, + {"character-set-client-handshake", 0, "Don't ignore client side character set value sent during handshake.", (uchar**) &opt_character_set_client_handshake, (uchar**) &opt_character_set_client_handshake, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"character-set-filesystem", OPT_CHARACTER_SET_FILESYSTEM, + {"character-set-filesystem", 0, "Set the filesystem character set.", (uchar**) &character_set_filesystem_name, (uchar**) &character_set_filesystem_name, @@ -5948,229 +5553,114 @@ struct my_option my_long_options[] = {"character-set-server", 'C', "Set the default character set.", (uchar**) &default_character_set_name, (uchar**) &default_character_set_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"character-sets-dir", OPT_CHARSETS_DIR, - "Directory where character sets are.", (uchar**) &charsets_dir, - (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"chroot", 'r', "Chroot mysqld daemon during startup.", (uchar**) &mysqld_chroot, (uchar**) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"collation-server", OPT_DEFAULT_COLLATION, "Set the default collation.", + {"collation-server", 0, "Set the default collation.", (uchar**) &default_collation_name, (uchar**) &default_collation_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"completion-type", OPT_COMPLETION_TYPE, "Default completion type.", - (uchar**) &global_system_variables.completion_type, - (uchar**) &max_system_variables.completion_type, 0, GET_ULONG, - REQUIRED_ARG, 0, 0, 2, 0, 1, 0}, - {"concurrent-insert", OPT_CONCURRENT_INSERT, - "Use concurrent insert with MyISAM. Disable with --concurrent-insert=0", - (uchar**) &myisam_concurrent_insert, (uchar**) &myisam_concurrent_insert, - 0, GET_ULONG, OPT_ARG, 1, 0, 2, 0, 0, 0}, {"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows.", (uchar**) &opt_console, (uchar**) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"datadir", 'h', "Path to the database root.", (uchar**) &mysql_data_home, - (uchar**) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#ifndef DBUG_OFF - {"debug", '#', "Debug log.", (uchar**) &default_dbug_option, - (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"default-character-set", 'C', "Set the default character set (deprecated option, use --character-set-server instead).", (uchar**) &default_character_set_name, (uchar**) &default_character_set_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation (deprecated option, use --collation-server instead).", + {"default-collation", 0, "Set the default collation (deprecated option, use --collation-server instead).", (uchar**) &default_collation_name, (uchar**) &default_collation_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"default-storage-engine", OPT_STORAGE_ENGINE, - "Set the default storage engine (table type) for tables.", - (uchar**)&default_storage_engine_str, (uchar**)&default_storage_engine_str, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default-time-zone", OPT_DEFAULT_TIME_ZONE, "Set the default time zone.", + {"default-storage-engine", 0, "The default storage engine for new tables", + (uchar**) &default_storage_engine, 0, 0, GET_STR, REQUIRED_ARG, + (longlong)"MyISAM", 0, 0, 0, 0, 0 }, + {"default-time-zone", 0, "Set the default time zone.", (uchar**) &default_tz_name, (uchar**) &default_tz_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE.", - 0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL, "Don't flush key buffers between writes for any MyISAM table (Deprecated option, use --delay-key-write=all instead).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_OPENSSL - {"des-key-file", OPT_DES_KEY_FILE, + {"des-key-file", 0, "Load keys for des_encrypt() and des_encrypt from given file.", (uchar**) &des_key_file, (uchar**) &des_key_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_OPENSSL */ #ifdef HAVE_REPLICATION - {"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT, + {"disconnect-slave-event-count", 0, "Option used by mysql-test for debugging and testing of replication.", (uchar**) &disconnect_slave_event_count, (uchar**) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ - {"enable-locking", OPT_ENABLE_LOCK, + {"enable-locking", 0, "Deprecated option, use --external-locking instead.", (uchar**) &opt_external_locking, (uchar**) &opt_external_locking, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef _WIN32 - {"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (NT).", - (uchar**) &opt_enable_named_pipe, (uchar**) &opt_enable_named_pipe, 0, GET_BOOL, - NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif #ifdef HAVE_STACK_TRACE_ON_SEGV - {"enable-pstack", OPT_DO_PSTACK, "Print a symbolic stack trace on failure.", + {"enable-pstack", 0, "Print a symbolic stack trace on failure.", (uchar**) &opt_do_pstack, (uchar**) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_STACK_TRACE_ON_SEGV */ - {"engine-condition-pushdown", - OPT_ENGINE_CONDITION_PUSHDOWN, - "Push supported query conditions to the storage engine.", - (uchar**) &global_system_variables.engine_condition_pushdown, - (uchar**) &global_system_variables.engine_condition_pushdown, - 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, /* See how it's handled in get_one_option() */ - {"event-scheduler", OPT_EVENT_SCHEDULER, "Enable/disable the event scheduler.", - NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"exit-info", 'T', "Used for debugging; Use at your own risk!", 0, 0, 0, GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"external-locking", OPT_USE_LOCKING, "Use system (external) locking (disabled by default). With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running. Disable with --skip-external-locking.", + {"external-locking", 0, "Use system (external) locking (disabled by default). With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running. Disable with --skip-external-locking.", (uchar**) &opt_external_locking, (uchar**) &opt_external_locking, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"flush", OPT_FLUSH, "Flush tables to disk between SQL commands.", 0, 0, 0, - GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, /* We must always support the next option to make scripts like mysqltest easier to do */ - {"gdb", OPT_DEBUGGING, + {"gdb", 0, "Set up signals usable for debugging", (uchar**) &opt_debugging, (uchar**) &opt_debugging, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"general_log", OPT_GENERAL_LOG, - "Enable|disable general log", (uchar**) &opt_log, - (uchar**) &opt_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_LARGE_PAGE_OPTION - {"large-pages", OPT_ENABLE_LARGE_PAGES, "Enable support for large pages. \ -Disable with --skip-large-pages.", - (uchar**) &opt_large_pages, (uchar**) &opt_large_pages, 0, GET_BOOL, - NO_ARG, 0, 0, 1, 0, 1, 0}, - {"super-large-pages", OPT_ENABLE_SUPER_LARGE_PAGES, - "Enable support for super large pages. \ -Disable with --skip-super-large-pages.", + {"super-large-pages", 0, "Enable support for super large pages.", (uchar**) &opt_super_large_pages, (uchar**) &opt_super_large_pages, 0, - GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, + GET_BOOL, OPT_ARG, 0, 0, 1, 0, 1, 0}, #endif - {"ignore-builtin-innodb", OPT_IGNORE_BUILTIN_INNODB , - "Disable initialization of builtin InnoDB plugin", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"init-connect", OPT_INIT_CONNECT, "Command(s) that are executed for each new connection", - (uchar**) &opt_init_connect, (uchar**) &opt_init_connect, 0, GET_STR_ALLOC, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#ifndef DISABLE_GRANT_OPTIONS - {"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup.", - (uchar**) &opt_init_file, (uchar**) &opt_init_file, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, -#endif - {"init-rpl-role", OPT_INIT_RPL_ROLE, "Set the replication role.", 0, 0, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed by a slave server \ -each time the SQL thread starts.", - (uchar**) &opt_init_slave, (uchar**) &opt_init_slave, 0, GET_STR_ALLOC, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"language", 'L', "Client error messages in given language. May be given as a full path. " "Deprecated. Use --lc-messages-dir instead.", (uchar**) &lc_messages_dir_ptr, (uchar**) &lc_messages_dir_ptr, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"lc-messages-dir", 'L', - "Directory where error messages are.", (uchar**) &lc_messages_dir_ptr, - (uchar**) &lc_messages_dir_ptr, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"lc-messages", OPT_LC_ERROR_MESSAGES, + {"lc-messages", 0, "Set the language used for the error messages.", (uchar**) &lc_messages, (uchar**) &lc_messages, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"lc-time-names", OPT_LC_TIME_NAMES, + {"lc-time-names", 0, "Set the language used for the month names and the days of the week.", (uchar**) &lc_time_names_name, (uchar**) &lc_time_names_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"local-infile", OPT_LOCAL_INFILE, - "Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0).", - (uchar**) &opt_local_infile, - (uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, - 1, 0, 0, 0, 0, 0}, {"log", 'l', "Log connections and queries to file (deprecated option, use " - "--general_log/--general_log_file instead).", (uchar**) &opt_logname, - (uchar**) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"general_log_file", OPT_GENERAL_LOG_FILE, - "Log connections and queries to given file.", (uchar**) &opt_logname, - (uchar**) &opt_logname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "--general-log/--general-log-file instead).", (uchar**) &opt_logname, + (uchar**) &opt_logname, 0, GET_STR_ALLOC, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-bin", OPT_BIN_LOG, "Log update queries in binary format. Optional (but strongly recommended " "to avoid replication problems if server's hostname changes) argument " "should be the chosen location for the binary log files.", (uchar**) &opt_bin_logname, (uchar**) &opt_bin_logname, 0, GET_STR_ALLOC, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"log-bin-index", OPT_BIN_LOG_INDEX, + {"log-bin-index", 0, "File that holds the names for last binary log files.", (uchar**) &opt_binlog_index_name, (uchar**) &opt_binlog_index_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#ifndef TO_BE_REMOVED_IN_5_1_OR_6_0 - /* - In 5.0.6 we introduced the below option, then in 5.0.16 we renamed it to - log-bin-trust-function-creators but kept also the old name for - compatibility; the behaviour was also changed to apply only to functions - (and triggers). In a future release this old name could be removed. - */ - {"log-bin-trust-routine-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS, - "(deprecated) Use log-bin-trust-function-creators.", - (uchar**) &trust_function_creators, (uchar**) &trust_function_creators, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif - /* - This option starts with "log-bin" to emphasize that it is specific of - binary logging. - */ - {"log-bin-trust-function-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS, - "If equal to 0 (the default), then when --log-bin is used, creation of " - "a stored function (or trigger) is allowed only to users having the SUPER privilege " - "and only if this stored function (trigger) may not break binary logging." - "Note that if ALL connections to this server ALWAYS use row-based binary " - "logging, the security issues do not exist and the binary logging cannot " - "break, so you can safely set this to 1." - ,(uchar**) &trust_function_creators, (uchar**) &trust_function_creators, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"log-error", OPT_ERROR_LOG_FILE, "Error log file.", - (uchar**) &log_error_file_ptr, (uchar**) &log_error_file_ptr, 0, GET_STR, - OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.", (uchar**) &myisam_log_filename, (uchar**) &myisam_log_filename, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-long-format", '0', "Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef WITH_CSV_STORAGE_ENGINE - {"log-output", OPT_LOG_OUTPUT, - "Syntax: log-output[=value[,value...]], where \"value\" could be TABLE, " - "FILE or NONE.", - (uchar**) &log_output_str, (uchar**) &log_output_str, 0, - GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, -#endif - {"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES, - "Log queries that are executed without benefit of any index to the slow log if it is open.", - (uchar**) &opt_log_queries_not_using_indexes, (uchar**) &opt_log_queries_not_using_indexes, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"log-short-format", OPT_SHORT_LOG_FORMAT, + {"log-short-format", 0, "Don't log extra information to update and slow-query logs.", (uchar**) &opt_short_log_format, (uchar**) &opt_short_log_format, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"log-slave-updates", OPT_LOG_SLAVE_UPDATES, - "Tells the slave to log the updates from the slave thread to the binary log. You will need to turn it on if you plan to daisy-chain the slaves.", - (uchar**) &opt_log_slave_updates, (uchar**) &opt_log_slave_updates, 0, GET_BOOL, - NO_ARG, 0, 0, 0, 0, 0, 0}, - {"log-slow-admin-statements", OPT_LOG_SLOW_ADMIN_STATEMENTS, + {"log-slow-admin-statements", 0, "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open.", (uchar**) &opt_log_slow_admin_statements, (uchar**) &opt_log_slow_admin_statements, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"log-slow-slave-statements", OPT_LOG_SLOW_SLAVE_STATEMENTS, + {"log-slow-slave-statements", 0, "Log slow statements executed by slave thread to the slow log if it is open.", (uchar**) &opt_log_slow_slave_statements, (uchar**) &opt_log_slow_slave_statements, @@ -6180,19 +5670,15 @@ each time the SQL thread starts.", "mysql.slow_log or hostname-slow.log if --log-output=file is used. " "Must be enabled to activate other slow log options. " "Deprecated option, use --slow-query-log/--slow-query-log-file instead.", - (uchar**) &opt_slow_logname, (uchar**) &opt_slow_logname, 0, GET_STR, OPT_ARG, + (uchar**) &opt_slow_logname, (uchar**) &opt_slow_logname, 0, GET_STR_ALLOC, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"slow-query-log-file", OPT_SLOW_QUERY_LOG_FILE, - "Log slow queries to given log file. Defaults logging to hostname-slow.log. Must be enabled to activate other slow log options.", - (uchar**) &opt_slow_logname, (uchar**) &opt_slow_logname, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"log-tc", OPT_LOG_TC, + {"log-tc", 0, "Path to transaction coordinator log (used for transactions that affect " "more than one storage engine, when binary log is disabled)", (uchar**) &opt_tc_log_file, (uchar**) &opt_tc_log_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_MMAP - {"log-tc-size", OPT_LOG_TC_SIZE, "Size of transaction coordinator log.", + {"log-tc-size", 0, "Size of transaction coordinator log.", (uchar**) &opt_tc_log_size, (uchar**) &opt_tc_log_size, 0, GET_ULONG, REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ULONG_MAX, 0, TC_LOG_PAGE_SIZE, 0}, @@ -6202,199 +5688,37 @@ each time the SQL thread starts.", log and this option justs turns on --log-bin instead.", (uchar**) &opt_update_logname, (uchar**) &opt_update_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"log-warnings", 'W', "Log some not critical warnings to the log file.", - (uchar**) &global_system_variables.log_warnings, - (uchar**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0, - 0, 0, 0}, - {"low-priority-updates", OPT_LOW_PRIORITY_UPDATES, - "INSERT/DELETE/UPDATE has lower priority than selects.", - (uchar**) &global_system_variables.low_priority_updates, - (uchar**) &max_system_variables.low_priority_updates, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"master-info-file", OPT_MASTER_INFO_FILE, + {"master-info-file", 0, "The location and name of the file that remembers the master and where the I/O replication \ thread is in the master's binlogs.", (uchar**) &master_info_file, (uchar**) &master_info_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"master-retry-count", OPT_MASTER_RETRY_COUNT, + {"master-retry-count", 0, "The number of tries the slave will make to connect to the master before giving up.", (uchar**) &master_retry_count, (uchar**) &master_retry_count, 0, GET_ULONG, REQUIRED_ARG, 3600*24, 0, 0, 0, 0, 0}, #ifdef HAVE_REPLICATION - {"max-binlog-dump-events", OPT_MAX_BINLOG_DUMP_EVENTS, + {"init-rpl-role", 0, "Set the replication role.", + (uchar**)&rpl_status, (uchar**)&rpl_status, &rpl_role_typelib, + GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"max-binlog-dump-events", 0, "Option used by mysql-test for debugging and testing of replication.", (uchar**) &max_binlog_dump_events, (uchar**) &max_binlog_dump_events, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ - {"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (uchar**) &locked_in_memory, + {"memlock", 0, "Lock mysqld in memory.", (uchar**) &locked_in_memory, (uchar**) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"myisam-recover", OPT_MYISAM_RECOVER, - "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.", - (uchar**) &myisam_recover_options_str, (uchar**) &myisam_recover_options_str, 0, - GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE - {"ndb-connectstring", OPT_NDB_CONNECTSTRING, - "Connect string for ndbcluster.", - (uchar**) &opt_ndb_connectstring, - (uchar**) &opt_ndb_connectstring, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"ndb-mgmd-host", OPT_NDB_MGMD, - "Set host and port for ndb_mgmd. Syntax: hostname[:port]", - (uchar**) &opt_ndb_mgmd, - (uchar**) &opt_ndb_mgmd, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"ndb-nodeid", OPT_NDB_NODEID, - "Nodeid for this mysqlserver in the cluster.", - (uchar**) &opt_ndb_nodeid, - (uchar**) &opt_ndb_nodeid, - 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"ndb-autoincrement-prefetch-sz", OPT_NDB_AUTOINCREMENT_PREFETCH_SZ, - "Specify number of autoincrement values that are prefetched.", - (uchar**) &global_system_variables.ndb_autoincrement_prefetch_sz, - (uchar**) &max_system_variables.ndb_autoincrement_prefetch_sz, - 0, GET_ULONG, REQUIRED_ARG, 1, 1, 256, 0, 0, 0}, - {"ndb-force-send", OPT_NDB_FORCE_SEND, - "Force send of buffers to ndb immediately without waiting for " - "other threads.", - (uchar**) &global_system_variables.ndb_force_send, - (uchar**) &global_system_variables.ndb_force_send, - 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, - {"ndb_force_send", OPT_NDB_FORCE_SEND, - "same as --ndb-force-send.", - (uchar**) &global_system_variables.ndb_force_send, - (uchar**) &global_system_variables.ndb_force_send, - 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, - {"ndb-extra-logging", OPT_NDB_EXTRA_LOGGING, - "Turn on more logging in the error log.", - (uchar**) &ndb_extra_logging, - (uchar**) &ndb_extra_logging, - 0, GET_INT, OPT_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_NDB_BINLOG - {"ndb-report-thresh-binlog-epoch-slip", OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP, - "Threshold on number of epochs to be behind before reporting binlog status. " - "E.g. 3 means that if the difference between what epoch has been received " - "from the storage nodes and what has been applied to the binlog is 3 or more, " - "a status message will be sent to the cluster log.", - (uchar**) &ndb_report_thresh_binlog_epoch_slip, - (uchar**) &ndb_report_thresh_binlog_epoch_slip, - 0, GET_ULONG, REQUIRED_ARG, 3, 0, 256, 0, 0, 0}, - {"ndb-report-thresh-binlog-mem-usage", OPT_NDB_REPORT_THRESH_BINLOG_MEM_USAGE, - "Threshold on percentage of free memory before reporting binlog status. E.g. " - "10 means that if amount of available memory for receiving binlog data from " - "the storage nodes goes below 10%, " - "a status message will be sent to the cluster log.", - (uchar**) &ndb_report_thresh_binlog_mem_usage, - (uchar**) &ndb_report_thresh_binlog_mem_usage, - 0, GET_ULONG, REQUIRED_ARG, 10, 0, 100, 0, 0, 0}, -#endif - {"ndb-use-exact-count", OPT_NDB_USE_EXACT_COUNT, - "Use exact records count during query planning and for fast " - "select count(*), disable for faster queries.", - (uchar**) &global_system_variables.ndb_use_exact_count, - (uchar**) &global_system_variables.ndb_use_exact_count, - 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, - {"ndb_use_exact_count", OPT_NDB_USE_EXACT_COUNT, - "same as --ndb-use-exact-count.", - (uchar**) &global_system_variables.ndb_use_exact_count, - (uchar**) &global_system_variables.ndb_use_exact_count, - 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, - {"ndb-use-transactions", OPT_NDB_USE_TRANSACTIONS, - "Use transactions for large inserts, if enabled then large " - "inserts will be split into several smaller transactions", - (uchar**) &global_system_variables.ndb_use_transactions, - (uchar**) &global_system_variables.ndb_use_transactions, - 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, - {"ndb_use_transactions", OPT_NDB_USE_TRANSACTIONS, - "same as --ndb-use-transactions.", - (uchar**) &global_system_variables.ndb_use_transactions, - (uchar**) &global_system_variables.ndb_use_transactions, - 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, - {"ndb-shm", OPT_NDB_SHM, - "Use shared memory connections when available.", - (uchar**) &opt_ndb_shm, - (uchar**) &opt_ndb_shm, - 0, GET_BOOL, OPT_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0}, - {"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION, - "Select nodes for transactions in a more optimal way.", - (uchar**) &opt_ndb_optimized_node_selection, - (uchar**) &opt_ndb_optimized_node_selection, - 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, - { "ndb-cache-check-time", OPT_NDB_CACHE_CHECK_TIME, - "A dedicated thread is created to, at the given millisecons interval, invalidate the query cache if another MySQL server in the cluster has changed the data in the database.", - (uchar**) &opt_ndb_cache_check_time, (uchar**) &opt_ndb_cache_check_time, 0, GET_ULONG, REQUIRED_ARG, - 0, 0, LONG_TIMEOUT, 0, 1, 0}, - {"ndb-index-stat-enable", OPT_NDB_INDEX_STAT_ENABLE, - "Use ndb index statistics in query optimization.", - (uchar**) &global_system_variables.ndb_index_stat_enable, - (uchar**) &max_system_variables.ndb_index_stat_enable, - 0, GET_BOOL, OPT_ARG, 0, 0, 1, 0, 0, 0}, -#endif - {"ndb-use-copying-alter-table", - OPT_NDB_USE_COPYING_ALTER_TABLE, - "Force ndbcluster to always copy tables at alter table (should only be used if on-line alter table fails).", - (uchar**) &global_system_variables.ndb_use_copying_alter_table, - (uchar**) &global_system_variables.ndb_use_copying_alter_table, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"new", 'n', "Use very new possible 'unsafe' functions.", - (uchar**) &global_system_variables.new_mode, - (uchar**) &max_system_variables.new_mode, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef NOT_YET - {"no-mix-table-types", OPT_NO_MIX_TYPE, "Don't allow commands with uses two different table types.", - (uchar**) &opt_no_mix_types, (uchar**) &opt_no_mix_types, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, -#endif - {"old-alter-table", OPT_OLD_ALTER_TABLE, - "Use old, non-optimized alter table.", - (uchar**) &global_system_variables.old_alter_table, - (uchar**) &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, - {"old-passwords", OPT_OLD_PASSWORDS, "Use old password encryption method (needed for 4.0 and older clients).", - (uchar**) &global_system_variables.old_passwords, - (uchar**) &max_system_variables.old_passwords, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, {"one-thread", OPT_ONE_THREAD, "(deprecated): Only use one thread (for debugging under Linux). Use thread-handling=no-threads instead", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"old-style-user-limits", OPT_OLD_STYLE_USER_LIMITS, + {"old-style-user-limits", 0, "Enable old-style user limits (before 5.0.3 user resources were counted per each user+host vs. per account)", (uchar**) &opt_old_style_user_limits, (uchar**) &opt_old_style_user_limits, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld.", - (uchar**) &pidfile_name_ptr, (uchar**) &pidfile_name_ptr, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"port", 'P', "Port number to use for connection or 0 for default to, in " - "order of preference, my.cnf, $MYSQL_TCP_PORT, " -#if MYSQL_PORT_DEFAULT == 0 - "/etc/services, " -#endif - "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", - (uchar**) &mysqld_port, - (uchar**) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"port-open-timeout", OPT_PORT_OPEN_TIMEOUT, + {"port-open-timeout", 0, "Maximum time in seconds to wait for the port to become free. " "(Default: no wait)", (uchar**) &mysqld_port_timeout, (uchar**) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#if defined(ENABLED_PROFILING) - {"profiling_history_size", OPT_PROFILING, "Limit of query profiling memory", - (uchar**) &global_system_variables.profiling_history_size, - (uchar**) &max_system_variables.profiling_history_size, - 0, GET_ULONG, REQUIRED_ARG, 15, 0, 100, 0, 0, 0}, -#endif - {"relay-log", OPT_RELAY_LOG, - "The location and name to use for relay logs.", - (uchar**) &opt_relay_logname, (uchar**) &opt_relay_logname, 0, - GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"relay-log-index", OPT_RELAY_LOG_INDEX, - "The location and name to use for the file that keeps a list of the last \ -relay logs.", - (uchar**) &opt_relaylog_index_name, (uchar**) &opt_relaylog_index_name, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE, - "The location and name of the file that remembers where the SQL replication \ -thread is in the relay logs.", - (uchar**) &relay_log_info_file, (uchar**) &relay_log_info_file, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"replicate-do-db", OPT_REPLICATE_DO_DB, "Tells the slave thread to restrict replication to the specified database. To specify more than one database, use the directive multiple times, once for each database. Note that this will only work if you do not use cross-database queries such as UPDATE some_db.some_table SET foo='bar' while having selected a different or no database. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-do-table=db_name.%.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -6411,7 +5735,7 @@ thread is in the relay logs.", "Updates to a database with a different name than the original. Example: replicate-rewrite-db=master_db_name->slave_db_name.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_REPLICATION - {"replicate-same-server-id", OPT_REPLICATE_SAME_SERVER_ID, + {"replicate-same-server-id", 0, "In replication, if set to 1, do not skip events having our server id. \ Default value is 0 (to break infinite loops in circular replication). \ Can't be set to 1 if --log-slave-updates is used.", @@ -6425,67 +5749,34 @@ Can't be set to 1 if --log-slave-updates is used.", {"replicate-wild-ignore-table", OPT_REPLICATE_WILD_IGNORE_TABLE, "Tells the slave thread to not replicate to the tables that match the given wildcard pattern. To specify more than one table to ignore, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-ignore-table=foo%.bar% will not do updates to tables in databases that start with foo and whose table names start with bar.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - // In replication, we may need to tell the other servers how to connect - {"report-host", OPT_REPORT_HOST, - "Hostname or IP of the slave to be reported to to the master during slave registration. Will appear in the output of SHOW SLAVE HOSTS. Leave unset if you do not want the slave to register itself with the master. Note that it is not sufficient for the master to simply read the IP of the slave off the socket once the slave connects. Due to NAT and other routing issues, that IP may not be valid for connecting to the slave from the master or other hosts.", - (uchar**) &report_host, (uchar**) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0, - 0, 0, 0, 0}, - {"report-password", OPT_REPORT_PASSWORD, "Undocumented.", - (uchar**) &report_password, (uchar**) &report_password, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"report-port", OPT_REPORT_PORT, - "Port for connecting to slave reported to the master during slave registration. Set it only if the slave is listening on a non-default port or if you have a special tunnel from the master or other clients to the slave. If not sure, leave this option unset.", - (uchar**) &report_port, (uchar**) &report_port, 0, GET_UINT, REQUIRED_ARG, - MYSQL_PORT, 0, 0, 0, 0, 0}, - {"report-user", OPT_REPORT_USER, "Undocumented.", (uchar**) &report_user, - (uchar**) &report_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"rpl-recovery-rank", OPT_RPL_RECOVERY_RANK, "Undocumented.", - (uchar**) &rpl_recovery_rank, (uchar**) &rpl_recovery_rank, 0, GET_ULONG, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifndef TO_BE_DELETED - {"safe-show-database", OPT_SAFE_SHOW_DB, + {"safe-show-database", 0, "Deprecated option; use GRANT SHOW DATABASES instead...", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"safe-user-create", OPT_SAFE_USER_CREATE, + {"safe-user-create", 0, "Don't allow new user creation by the user who has no write privileges to the mysql.user table.", (uchar**) &opt_safe_user_create, (uchar**) &opt_safe_user_create, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT, - "Simulate memory shortage when compiled with the --with-debug=full option.", - 0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"secure-auth", OPT_SECURE_AUTH, "Disallow authentication for accounts that have old (pre-4.1) passwords.", - (uchar**) &opt_secure_auth, (uchar**) &opt_secure_auth, 0, GET_BOOL, NO_ARG, - my_bool(0), 0, 0, 0, 0, 0}, - {"secure-file-priv", OPT_SECURE_FILE_PRIV, - "Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory", - (uchar**) &opt_secure_file_priv, (uchar**) &opt_secure_file_priv, 0, - GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"server-id", OPT_SERVER_ID, - "Uniquely identifies the server instance in the community of replication partners.", - (uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, UINT_MAX32, - 0, 0, 0}, +#if !defined(DBUG_OFF) && defined(SAFEMALLOC) + {"safemalloc", 0, "Enable the memory allocation checking.", + (uchar**) &sf_malloc_quick, (uchar**) &sf_malloc_quick, 0, + GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"safemalloc-mem-limit", 0, "Simulate memory shortage.", + (uchar**)&sf_malloc_mem_limit, (uchar**)&sf_malloc_mem_limit, 0, GET_UINT, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, +#endif {"set-variable", 'O', "Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_SMEM - {"shared-memory", OPT_ENABLE_SHARED_MEMORY, - "Enable the shared memory.",(uchar**) &opt_enable_shared_memory, (uchar**) &opt_enable_shared_memory, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif -#ifdef HAVE_SMEM - {"shared-memory-base-name",OPT_SHARED_MEMORY_BASE_NAME, - "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif - {"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO, + {"show-slave-auth-info", 0, "Show user and password in SHOW SLAVE HOSTS on this master", (uchar**) &opt_show_slave_auth_info, (uchar**) &opt_show_slave_auth_info, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifndef DISABLE_GRANT_OPTIONS - {"skip-grant-tables", OPT_SKIP_GRANT, + {"skip-grant-tables", 0, "Start without grant tables. This gives all users FULL ACCESS to all tables!", (uchar**) &opt_noacl, (uchar**) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -6498,22 +5789,9 @@ Can't be set to 1 if --log-slave-updates is used.", {"skip-name-resolve", OPT_SKIP_RESOLVE, "Don't resolve hostnames. All hostnames are IP's or 'localhost'.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"skip-networking", OPT_SKIP_NETWORKING, - "Don't allow connection with TCP/IP.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, - 0, 0, 0}, {"skip-new", OPT_SKIP_NEW, "Don't use new, possible wrong routines.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifndef DBUG_OFF -#ifdef SAFEMALLOC - {"skip-safemalloc", OPT_SKIP_SAFEMALLOC, - "Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG, - 0, 0, 0, 0, 0, 0}, -#endif -#endif - {"skip-show-database", OPT_SKIP_SHOW_DB, - "Don't allow 'SHOW DATABASE' commands.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, - 0, 0, 0, 0}, - {"skip-slave-start", OPT_SKIP_SLAVE_START, + {"skip-slave-start", 0, "If set, slave is not autostarted.", (uchar**) &opt_skip_slave_start, (uchar**) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-stack-trace", OPT_SKIP_STACK_TRACE, @@ -6526,44 +5804,24 @@ Can't be set to 1 if --log-slave-updates is used.", "because it has no effect; the implied behavior is already the default.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_REPLICATION - {"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, - "The location where the slave should put its temporary files when \ -replicating a LOAD DATA INFILE command.", - (uchar**) &slave_load_tmpdir, (uchar**) &slave_load_tmpdir, 0, GET_STR_ALLOC, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS, - "Tells the slave thread to continue replication when a query event returns an error from the provided list.", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"slave-exec-mode", OPT_SLAVE_EXEC_MODE, - "Modes for how replication events should be executed. Legal values are STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode, replication will not stop for operations that are idempotent. In STRICT mode, replication will stop on any unexpected difference between the master and the slave.", - (uchar**) &slave_exec_mode_str, (uchar**) &slave_exec_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif - {"slow-query-log", OPT_SLOW_LOG, - "Enable|disable slow query log", (uchar**) &opt_slow_log, - (uchar**) &opt_slow_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"socket", OPT_SOCKET, "Socket file to use for connection.", - (uchar**) &mysqld_unix_port, (uchar**) &mysqld_unix_port, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_REPLICATION - {"sporadic-binlog-dump-fail", OPT_SPORADIC_BINLOG_DUMP_FAIL, + {"sporadic-binlog-dump-fail", 0, "Option used by mysql-test for debugging and testing of replication.", (uchar**) &opt_sporadic_binlog_dump_fail, (uchar**) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ - {"sql-bin-update-same", OPT_SQL_BIN_UPDATE_SAME, - "The update log is deprecated since version 5.0, is replaced by the binary \ -log and this option does nothing anymore.", + {"sql-bin-update-same", 0, + "The update log is deprecated since version 5.0, is replaced by the " + "binary log and this option does nothing anymore.", 0, 0, 0, GET_DISABLED, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"sql-mode", OPT_SQL_MODE, - "Syntax: sql-mode=option[,option[,option...]] where option can be one of: REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, ONLY_FULL_GROUP_BY, NO_UNSIGNED_SUBTRACTION.", - (uchar**) &sql_mode_str, (uchar**) &sql_mode_str, 0, GET_STR, REQUIRED_ARG, 0, - 0, 0, 0, 0, 0}, #ifdef HAVE_OPENSSL -#include "sslopt-longopts.h" + {"ssl", 0, + "Enable SSL for connection (automatically enabled with other flags).", + (uchar **) &opt_use_ssl, (uchar **) &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 0, 0, 0, + 0, 0, 0}, #endif #ifdef __WIN__ - {"standalone", OPT_STANDALONE, + {"standalone", 0, "Dummy option to start as a standalone program (NT).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif @@ -6575,14 +5833,14 @@ log and this option does nothing anymore.", option if compiled with valgrind support. */ IF_PURIFY(0,1), 0, 0, 0, 0, 0}, - {"sysdate-is-now", OPT_SYSDATE_IS_NOW, + {"sysdate-is-now", 0, "Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. Since 5.0, SYSDATE() returns a `dynamic' value different for different invocations, even within the same statement.", (uchar**) &global_system_variables.sysdate_is_now, 0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, - {"tc-heuristic-recover", OPT_TC_HEURISTIC_RECOVER, + {"tc-heuristic-recover", 0, "Decision to use in heuristic recover process. Possible values are COMMIT or ROLLBACK.", - (uchar**) &opt_tc_heuristic_recover, (uchar**) &opt_tc_heuristic_recover, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + (uchar**) &tc_heuristic_recover, (uchar**) &tc_heuristic_recover, + &tc_heuristic_recover_typelib, GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #if defined(ENABLED_DEBUG_SYNC) {"debug-sync-timeout", OPT_DEBUG_SYNC_TIMEOUT, "Enable the debug sync facility " @@ -6591,7 +5849,7 @@ log and this option does nothing anymore.", (uchar**) &opt_debug_sync_timeout, 0, 0, GET_UINT, OPT_ARG, 0, 0, UINT_MAX, 0, 0, 0}, #endif /* defined(ENABLED_DEBUG_SYNC) */ - {"temp-pool", OPT_TEMP_POOL, + {"temp-pool", 0, #if (ENABLE_TEMP_POOL) "Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.", #else @@ -6599,24 +5857,11 @@ log and this option does nothing anymore.", #endif (uchar**) &use_temp_pool, (uchar**) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - - {"timed_mutexes", OPT_TIMED_MUTEXES, - "Specify whether to time mutexes (only InnoDB mutexes are currently supported)", - (uchar**) &timed_mutexes, (uchar**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0, - 0, 0, 0, 0, 0}, - {"tmpdir", 't', - "Path for temporary files. Several paths may be specified, separated by a " -#if defined(__WIN__) || defined(__NETWARE__) - "semicolon (;)" -#else - "colon (:)" -#endif - ", in this case they are used in a round-robin fashion.", - (uchar**) &opt_mysql_tmpdir, - (uchar**) &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"transaction-isolation", OPT_TX_ISOLATION, - "Default transaction isolation level.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, - 0, 0, 0, 0, 0}, + {"transaction-isolation", 0, + "Default transaction isolation level.", + (uchar**)&global_system_variables.tx_isolation, + (uchar**)&global_system_variables.tx_isolation, &tx_isolation_typelib, + GET_ENUM, REQUIRED_ARG, ISO_REPEATABLE_READ, 0, 0, 0, 0, 0}, {"use-symbolic-links", 's', "Enable symbolic link support. Deprecated option; use --symbolic-links instead.", (uchar**) &my_use_symdir, (uchar**) &my_use_symdir, 0, GET_BOOL, NO_ARG, IF_PURIFY(0,1), 0, 0, 0, 0, 0}, @@ -6631,556 +5876,19 @@ log and this option does nothing anymore.", (uchar**) &global_system_variables.log_warnings, (uchar**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, ULONG_MAX, 0, 0, 0}, - { "back_log", OPT_BACK_LOG, - "The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.", - (uchar**) &back_log, (uchar**) &back_log, 0, GET_ULONG, - REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 }, - {"binlog_cache_size", OPT_BINLOG_CACHE_SIZE, - "The size of the cache to hold the SQL statements for the binary log during a transaction. If you often use big, multi-statement transactions you can increase this to get more performance.", - (uchar**) &binlog_cache_size, (uchar**) &binlog_cache_size, 0, GET_ULONG, - REQUIRED_ARG, 32*1024L, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0}, - {"bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE, - "Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread!", - (uchar**) &global_system_variables.bulk_insert_buff_size, - (uchar**) &max_system_variables.bulk_insert_buff_size, - 0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, ULONG_MAX, 0, 1, 0}, - {"connect_timeout", OPT_CONNECT_TIMEOUT, - "The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake'.", - (uchar**) &connect_timeout, (uchar**) &connect_timeout, - 0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 }, - { "date_format", OPT_DATE_FORMAT, - "The DATE format (For future).", - (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE], - (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE], - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - { "datetime_format", OPT_DATETIME_FORMAT, - "The DATETIME/TIMESTAMP format (for future).", - (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME], - (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME], - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - { "default_week_format", OPT_DEFAULT_WEEK_FORMAT, - "The default week format used by WEEK() functions.", - (uchar**) &global_system_variables.default_week_format, - (uchar**) &max_system_variables.default_week_format, - 0, GET_ULONG, REQUIRED_ARG, 0, 0, 7L, 0, 1, 0}, - {"delayed_insert_limit", OPT_DELAYED_INSERT_LIMIT, - "After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing.", - (uchar**) &delayed_insert_limit, (uchar**) &delayed_insert_limit, 0, GET_ULONG, - REQUIRED_ARG, DELAYED_LIMIT, 1, ULONG_MAX, 0, 1, 0}, - {"delayed_insert_timeout", OPT_DELAYED_INSERT_TIMEOUT, - "How long a INSERT DELAYED thread should wait for INSERT statements before terminating.", - (uchar**) &delayed_insert_timeout, (uchar**) &delayed_insert_timeout, 0, - GET_ULONG, REQUIRED_ARG, DELAYED_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, - { "delayed_queue_size", OPT_DELAYED_QUEUE_SIZE, - "What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again.", - (uchar**) &delayed_queue_size, (uchar**) &delayed_queue_size, 0, GET_ULONG, - REQUIRED_ARG, DELAYED_QUEUE_SIZE, 1, ULONG_MAX, 0, 1, 0}, - {"div_precision_increment", OPT_DIV_PRECINCREMENT, - "Precision of the result of '/' operator will be increased on that value.", - (uchar**) &global_system_variables.div_precincrement, - (uchar**) &max_system_variables.div_precincrement, 0, GET_ULONG, - REQUIRED_ARG, 4, 0, DECIMAL_MAX_SCALE, 0, 0, 0}, - {"expire_logs_days", OPT_EXPIRE_LOGS_DAYS, - "If non-zero, binary logs will be purged after expire_logs_days " - "days; possible purges happen at startup and at binary log rotation.", - (uchar**) &expire_logs_days, - (uchar**) &expire_logs_days, 0, GET_ULONG, - REQUIRED_ARG, 0, 0, 99, 0, 1, 0}, - { "flush_time", OPT_FLUSH_TIME, - "A dedicated thread is created to flush all tables at the given interval.", - (uchar**) &flush_time, (uchar**) &flush_time, 0, GET_ULONG, REQUIRED_ARG, - FLUSH_TIME, 0, LONG_TIMEOUT, 0, 1, 0}, - { "ft_boolean_syntax", OPT_FT_BOOLEAN_SYNTAX, - "List of operators for MATCH ... AGAINST ( ... IN BOOLEAN MODE)", - 0, 0, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, - "The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.", - (uchar**) &ft_max_word_len, (uchar**) &ft_max_word_len, 0, GET_ULONG, - REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, HA_FT_MAXCHARLEN, 0, 1, 0}, - { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, - "The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.", - (uchar**) &ft_min_word_len, (uchar**) &ft_min_word_len, 0, GET_ULONG, - REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN, 0, 1, 0}, - { "ft_query_expansion_limit", OPT_FT_QUERY_EXPANSION_LIMIT, - "Number of best matches to use for query expansion", - (uchar**) &ft_query_expansion_limit, (uchar**) &ft_query_expansion_limit, 0, GET_ULONG, - REQUIRED_ARG, 20, 0, 1000, 0, 1, 0}, - { "ft_stopword_file", OPT_FT_STOPWORD_FILE, - "Use stopwords from this file instead of built-in list.", - (uchar**) &ft_stopword_file, (uchar**) &ft_stopword_file, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - { "group_concat_max_len", OPT_GROUP_CONCAT_MAX_LEN, - "The maximum length of the result of function group_concat.", - (uchar**) &global_system_variables.group_concat_max_len, - (uchar**) &max_system_variables.group_concat_max_len, 0, GET_ULONG, - REQUIRED_ARG, 1024, 4, ULONG_MAX, 0, 1, 0}, - {"interactive_timeout", OPT_INTERACTIVE_TIMEOUT, - "The number of seconds the server waits for activity on an interactive connection before closing it.", - (uchar**) &global_system_variables.net_interactive_timeout, - (uchar**) &max_system_variables.net_interactive_timeout, 0, - GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, - {"join_buffer_size", OPT_JOIN_BUFF_SIZE, - "The size of the buffer that is used for full joins.", - (uchar**) &global_system_variables.join_buff_size, - (uchar**) &max_system_variables.join_buff_size, 0, GET_ULONG, - REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ULONG_MAX, - MALLOC_OVERHEAD, IO_SIZE, 0}, - {"keep_files_on_create", OPT_KEEP_FILES_ON_CREATE, - "Don't overwrite stale .MYD and .MYI even if no directory is specified.", - (uchar**) &global_system_variables.keep_files_on_create, - (uchar**) &max_system_variables.keep_files_on_create, - 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"key_buffer_size", OPT_KEY_BUFFER_SIZE, - "The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.", - (uchar**) &dflt_key_cache_var.param_buff_size, - (uchar**) 0, - 0, (GET_ULL | GET_ASK_ADDR), - REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, SIZE_T_MAX, MALLOC_OVERHEAD, - IO_SIZE, 0}, - {"key_cache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD, - "This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache", - (uchar**) &dflt_key_cache_var.param_age_threshold, - (uchar**) 0, - 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, - 300, 100, ULONG_MAX, 0, 100, 0}, - {"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, - "The default size of key cache blocks", - (uchar**) &dflt_key_cache_var.param_block_size, - (uchar**) 0, - 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, - KEY_CACHE_BLOCK_SIZE, 512, 1024 * 16, 0, 512, 0}, - {"key_cache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT, - "The minimum percentage of warm blocks in key cache", - (uchar**) &dflt_key_cache_var.param_division_limit, - (uchar**) 0, - 0, (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100, - 1, 100, 0, 1, 0}, - {"long_query_time", OPT_LONG_QUERY_TIME, - "Log all queries that have taken more than long_query_time seconds to execute to file. " - "The argument will be treated as a decimal value with microsecond precission.", - (uchar**) &long_query_time, (uchar**) &long_query_time, 0, GET_DOUBLE, - REQUIRED_ARG, 10, 0, LONG_TIMEOUT, 0, 0, 0}, - {"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES, - "If set to 1 table names are stored in lowercase on disk and table names will be case-insensitive. Should be set to 2 if you are using a case insensitive file system", - (uchar**) &lower_case_table_names, - (uchar**) &lower_case_table_names, 0, GET_UINT, OPT_ARG, -#ifdef FN_NO_CASE_SENCE - 1 -#else - 0 -#endif - , 0, 2, 0, 1, 0}, - {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, - "Max packetlength to send/receive from to server.", - (uchar**) &global_system_variables.max_allowed_packet, - (uchar**) &max_system_variables.max_allowed_packet, 0, GET_ULONG, - REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, - {"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE, - "Can be used to restrict the total size used to cache a multi-transaction query.", - (uchar**) &max_binlog_cache_size, (uchar**) &max_binlog_cache_size, 0, - GET_ULL, REQUIRED_ARG, ULONG_MAX, IO_SIZE, ULONGLONG_MAX, 0, IO_SIZE, 0}, - {"max_binlog_size", OPT_MAX_BINLOG_SIZE, - "Binary log will be rotated automatically when the size exceeds this \ -value. Will also apply to relay logs if max_relay_log_size is 0. \ -The minimum value for this variable is 4096.", - (uchar**) &max_binlog_size, (uchar**) &max_binlog_size, 0, GET_ULONG, - REQUIRED_ARG, 1024*1024L*1024L, IO_SIZE, 1024*1024L*1024L, 0, IO_SIZE, 0}, - {"max_connect_errors", OPT_MAX_CONNECT_ERRORS, - "If there is more than this number of interrupted connections from a host this host will be blocked from further connections.", - (uchar**) &max_connect_errors, (uchar**) &max_connect_errors, 0, GET_ULONG, - REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ULONG_MAX, 0, 1, 0}, - // Default max_connections of 151 is larger than Apache's default max - // children, to avoid "too many connections" error in a common setup - {"max_connections", OPT_MAX_CONNECTIONS, - "The number of simultaneous clients allowed.", (uchar**) &max_connections, - (uchar**) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1, - 0}, - {"max_delayed_threads", OPT_MAX_DELAYED_THREADS, - "Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero, which means INSERT DELAYED is not used.", - (uchar**) &global_system_variables.max_insert_delayed_threads, - (uchar**) &max_system_variables.max_insert_delayed_threads, - 0, GET_ULONG, REQUIRED_ARG, 20, 0, 16384, 0, 1, 0}, - {"max_error_count", OPT_MAX_ERROR_COUNT, - "Max number of errors/warnings to store for a statement.", - (uchar**) &global_system_variables.max_error_count, - (uchar**) &max_system_variables.max_error_count, - 0, GET_ULONG, REQUIRED_ARG, DEFAULT_ERROR_COUNT, 0, 65535, 0, 1, 0}, - {"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE, - "Don't allow creation of heap tables bigger than this.", - (uchar**) &global_system_variables.max_heap_table_size, - (uchar**) &max_system_variables.max_heap_table_size, 0, GET_ULL, - REQUIRED_ARG, 16*1024*1024L, 16384, MAX_MEM_TABLE_SIZE, - MALLOC_OVERHEAD, 1024, 0}, - {"max_join_size", OPT_MAX_JOIN_SIZE, - "Joins that are probably going to read more than max_join_size records return an error.", - (uchar**) &global_system_variables.max_join_size, - (uchar**) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG, - HA_POS_ERROR, 1, HA_POS_ERROR, 0, 1, 0}, - {"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA, - "Max number of bytes in sorted records.", - (uchar**) &global_system_variables.max_length_for_sort_data, - (uchar**) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG, - REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0}, - {"max_prepared_stmt_count", OPT_MAX_PREPARED_STMT_COUNT, - "Maximum number of prepared statements in the server.", - (uchar**) &max_prepared_stmt_count, (uchar**) &max_prepared_stmt_count, - 0, GET_ULONG, REQUIRED_ARG, 16382, 0, 1*1024*1024, 0, 1, 0}, - {"max_relay_log_size", OPT_MAX_RELAY_LOG_SIZE, - "If non-zero: relay log will be rotated automatically when the size exceeds this value; if zero (the default): when the size exceeds max_binlog_size. 0 excepted, the minimum value for this variable is 4096.", - (uchar**) &max_relay_log_size, (uchar**) &max_relay_log_size, 0, GET_ULONG, - REQUIRED_ARG, 0L, 0L, 1024*1024L*1024L, 0, IO_SIZE, 0}, - { "max_seeks_for_key", OPT_MAX_SEEKS_FOR_KEY, - "Limit assumed max number of seeks when looking up rows based on a key", - (uchar**) &global_system_variables.max_seeks_for_key, - (uchar**) &max_system_variables.max_seeks_for_key, 0, GET_ULONG, - REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0 }, - {"max_sort_length", OPT_MAX_SORT_LENGTH, - "The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).", - (uchar**) &global_system_variables.max_sort_length, - (uchar**) &max_system_variables.max_sort_length, 0, GET_ULONG, - REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0}, - {"max_sp_recursion_depth", OPT_MAX_SP_RECURSION_DEPTH, - "Maximum stored procedure recursion depth. (discussed with docs).", - (uchar**) &global_system_variables.max_sp_recursion_depth, - (uchar**) &max_system_variables.max_sp_recursion_depth, 0, GET_ULONG, - OPT_ARG, 0, 0, 255, 0, 1, 0 }, - {"max_tmp_tables", OPT_MAX_TMP_TABLES, - "Maximum number of temporary tables a client can keep open at a time.", - (uchar**) &global_system_variables.max_tmp_tables, - (uchar**) &max_system_variables.max_tmp_tables, 0, GET_ULONG, - REQUIRED_ARG, 32, 1, ULONG_MAX, 0, 1, 0}, - {"max_user_connections", OPT_MAX_USER_CONNECTIONS, - "The maximum number of active connections for a single user (0 = no limit).", - (uchar**) &max_user_connections, (uchar**) &max_user_connections, 0, GET_UINT, - REQUIRED_ARG, 0, 0, UINT_MAX, 0, 1, 0}, - {"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT, - "After this many write locks, allow some read locks to run in between.", - (uchar**) &max_write_lock_count, (uchar**) &max_write_lock_count, 0, GET_ULONG, - REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0}, - {"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT, - "Don't write queries to slow log that examine fewer than min_examined_row_limit rows.", - (uchar**) &global_system_variables.min_examined_row_limit, - (uchar**) &max_system_variables.min_examined_row_limit, 0, GET_ULONG, - REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1L, 0}, - {"multi_range_count", OPT_MULTI_RANGE_COUNT, - "Number of key ranges to request at once.", - (uchar**) &global_system_variables.multi_range_count, - (uchar**) &max_system_variables.multi_range_count, 0, - GET_ULONG, REQUIRED_ARG, 256, 1, ULONG_MAX, 0, 1, 0}, - {"myisam_block_size", OPT_MYISAM_BLOCK_SIZE, - "Block size to be used for MyISAM index pages.", - (uchar**) &opt_myisam_block_size, - (uchar**) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG, - MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH, - 0, MI_MIN_KEY_BLOCK_LENGTH, 0}, - {"myisam_data_pointer_size", OPT_MYISAM_DATA_POINTER_SIZE, - "Default pointer size to be used for MyISAM tables.", - (uchar**) &myisam_data_pointer_size, - (uchar**) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG, - 6, 2, 7, 0, 1, 0}, - {"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, - "Deprecated option", - (uchar**) &global_system_variables.myisam_max_extra_sort_file_size, - (uchar**) &max_system_variables.myisam_max_extra_sort_file_size, - 0, GET_ULL, REQUIRED_ARG, (ulonglong) MI_MAX_TEMP_LENGTH, - 0, (ulonglong) MAX_FILE_SIZE, 0, 1, 0}, - {"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE, - "Don't use the fast sort index method to created index if the temporary file would get bigger than this.", - (uchar**) &global_system_variables.myisam_max_sort_file_size, - (uchar**) &max_system_variables.myisam_max_sort_file_size, 0, - GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE, - 0, 1024*1024, 0}, - {"myisam_mmap_size", OPT_MYISAM_MMAP_SIZE, - "Can be used to restrict the total memory used for memory mmaping of myisam files", - (uchar**) &myisam_mmap_size, (uchar**) &myisam_mmap_size, 0, - GET_ULL, REQUIRED_ARG, SIZE_T_MAX, MEMMAP_EXTRA_MARGIN, SIZE_T_MAX, 0, 1, 0}, - {"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS, - "Number of threads to use when repairing MyISAM tables. The value of 1 disables parallel repair.", - (uchar**) &global_system_variables.myisam_repair_threads, - (uchar**) &max_system_variables.myisam_repair_threads, 0, - GET_ULONG, REQUIRED_ARG, 1, 1, ULONG_MAX, 0, 1, 0}, - {"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE, - "The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.", - (uchar**) &global_system_variables.myisam_sort_buff_size, - (uchar**) &max_system_variables.myisam_sort_buff_size, 0, - GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0}, - {"myisam_use_mmap", OPT_MYISAM_USE_MMAP, - "Use memory mapping for reading and writing MyISAM tables", - (uchar**) &opt_myisam_use_mmap, - (uchar**) &opt_myisam_use_mmap, 0, GET_BOOL, NO_ARG, 0, - 0, 0, 0, 0, 0}, - {"myisam_stats_method", OPT_MYISAM_STATS_METHOD, - "Specifies how MyISAM index statistics collection code should threat NULLs. " - "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), " - "\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".", - (uchar**) &myisam_stats_method_str, (uchar**) &myisam_stats_method_str, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"net_buffer_length", OPT_NET_BUFFER_LENGTH, - "Buffer length for TCP/IP and socket communication.", - (uchar**) &global_system_variables.net_buffer_length, - (uchar**) &max_system_variables.net_buffer_length, 0, GET_ULONG, - REQUIRED_ARG, 16384, 1024, 1024*1024L, 0, 1024, 0}, - {"net_read_timeout", OPT_NET_READ_TIMEOUT, - "Number of seconds to wait for more data from a connection before aborting the read.", - (uchar**) &global_system_variables.net_read_timeout, - (uchar**) &max_system_variables.net_read_timeout, 0, GET_ULONG, - REQUIRED_ARG, NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, - {"net_retry_count", OPT_NET_RETRY_COUNT, - "If a read on a communication port is interrupted, retry this many times before giving up.", - (uchar**) &global_system_variables.net_retry_count, - (uchar**) &max_system_variables.net_retry_count,0, - GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, ULONG_MAX, 0, 1, 0}, - {"net_write_timeout", OPT_NET_WRITE_TIMEOUT, - "Number of seconds to wait for a block to be written to a connection before aborting the write.", - (uchar**) &global_system_variables.net_write_timeout, - (uchar**) &max_system_variables.net_write_timeout, 0, GET_ULONG, - REQUIRED_ARG, NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, - { "old", OPT_OLD_MODE, "Use compatible behavior.", - (uchar**) &global_system_variables.old_mode, - (uchar**) &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, - {"open_files_limit", OPT_OPEN_FILES_LIMIT, - "If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of files.", - (uchar**) &open_files_limit, (uchar**) &open_files_limit, 0, GET_ULONG, - REQUIRED_ARG, 0, 0, OS_FILE_LIMIT, 0, 1, 0}, - {"optimizer_prune_level", OPT_OPTIMIZER_PRUNE_LEVEL, - "Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows.", - (uchar**) &global_system_variables.optimizer_prune_level, - (uchar**) &max_system_variables.optimizer_prune_level, - 0, GET_ULONG, OPT_ARG, 1, 0, 1, 0, 1, 0}, - {"optimizer_search_depth", OPT_OPTIMIZER_SEARCH_DEPTH, - "Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Smaller values than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value; if set to MAX_TABLES+2, the optimizer will switch to the original find_best (used for testing/comparison).", - (uchar**) &global_system_variables.optimizer_search_depth, - (uchar**) &max_system_variables.optimizer_search_depth, - 0, GET_ULONG, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0}, - {"optimizer_switch", OPT_OPTIMIZER_SWITCH, - "optimizer_switch=option=val[,option=val...], where option={index_merge, " - "index_merge_union, index_merge_sort_union, index_merge_intersection} and " - "val={on, off, default}.", - (uchar**) &optimizer_switch_str, (uchar**) &optimizer_switch_str, 0, GET_STR, REQUIRED_ARG, - /*OPTIMIZER_SWITCH_DEFAULT*/0, - 0, 0, 0, 0, 0}, - {"plugin_dir", OPT_PLUGIN_DIR, - "Directory for plugins.", - (uchar**) &opt_plugin_dir_ptr, (uchar**) &opt_plugin_dir_ptr, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"plugin-load", OPT_PLUGIN_LOAD, + {"plugin-load", 0, "Optional semicolon-separated list of plugins to load, where each plugin is " "identified as name=library, where name is the plugin name and library " "is the plugin library in plugin_dir.", (uchar**) &opt_plugin_load, (uchar**) &opt_plugin_load, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE, - "The size of the buffer that is allocated when preloading indexes", - (uchar**) &global_system_variables.preload_buff_size, - (uchar**) &max_system_variables.preload_buff_size, 0, GET_ULONG, - REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0}, - {"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE, - "Allocation block size for query parsing and execution", - (uchar**) &global_system_variables.query_alloc_block_size, - (uchar**) &max_system_variables.query_alloc_block_size, 0, GET_ULONG, - REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0}, -#ifdef HAVE_QUERY_CACHE - {"query_cache_limit", OPT_QUERY_CACHE_LIMIT, - "Don't cache results that are bigger than this.", - (uchar**) &query_cache_limit, (uchar**) &query_cache_limit, 0, GET_ULONG, - REQUIRED_ARG, 1024*1024L, 0, ULONG_MAX, 0, 1, 0}, - {"query_cache_min_res_unit", OPT_QUERY_CACHE_MIN_RES_UNIT, - "minimal size of unit in wich space for results is allocated (last unit will be trimed after writing all result data.", - (uchar**) &query_cache_min_res_unit, (uchar**) &query_cache_min_res_unit, - 0, GET_ULONG, REQUIRED_ARG, QUERY_CACHE_MIN_RESULT_DATA_SIZE, - 0, ULONG_MAX, 0, 1, 0}, -#endif /*HAVE_QUERY_CACHE*/ - {"query_cache_size", OPT_QUERY_CACHE_SIZE, - "The memory allocated to store results from old queries.", - (uchar**) &query_cache_size, (uchar**) &query_cache_size, 0, GET_ULONG, - REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1024, 0}, -#ifdef HAVE_QUERY_CACHE - {"query_cache_type", OPT_QUERY_CACHE_TYPE, - "0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results except SELECT SQL_NO_CACHE ... queries. 2 = DEMAND = Cache only SELECT SQL_CACHE ... queries.", - (uchar**) &global_system_variables.query_cache_type, - (uchar**) &max_system_variables.query_cache_type, - 0, GET_ULONG, REQUIRED_ARG, 1, 0, 2, 0, 1, 0}, - {"query_cache_wlock_invalidate", OPT_QUERY_CACHE_WLOCK_INVALIDATE, - "Invalidate queries in query cache on LOCK for write", - (uchar**) &global_system_variables.query_cache_wlock_invalidate, - (uchar**) &max_system_variables.query_cache_wlock_invalidate, - 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, -#endif /*HAVE_QUERY_CACHE*/ - {"query_prealloc_size", OPT_QUERY_PREALLOC_SIZE, - "Persistent buffer for query parsing and execution", - (uchar**) &global_system_variables.query_prealloc_size, - (uchar**) &max_system_variables.query_prealloc_size, 0, GET_ULONG, - REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, QUERY_ALLOC_PREALLOC_SIZE, - ULONG_MAX, 0, 1024, 0}, - {"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE, - "Allocation block size for storing ranges during optimization", - (uchar**) &global_system_variables.range_alloc_block_size, - (uchar**) &max_system_variables.range_alloc_block_size, 0, GET_ULONG, - REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, RANGE_ALLOC_BLOCK_SIZE, ULONG_MAX, - 0, 1024, 0}, - {"read_buffer_size", OPT_RECORD_BUFFER, - "Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value.", + {"record_buffer", 0, "Deprecated; use --read-buffer-size instead.", (uchar**) &global_system_variables.read_buff_size, (uchar**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, - 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT_MAX32, MALLOC_OVERHEAD, IO_SIZE, - 0}, - {"read_only", OPT_READONLY, - "Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the SUPER privilege", - (uchar**) &opt_readonly, - (uchar**) &opt_readonly, - 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, - {"read_rnd_buffer_size", OPT_RECORD_RND_BUFFER, - "When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks. If not set, then it's set to the value of record_buffer.", - (uchar**) &global_system_variables.read_rnd_buff_size, - (uchar**) &max_system_variables.read_rnd_buff_size, 0, - GET_ULONG, REQUIRED_ARG, 256*1024L, IO_SIZE*2+MALLOC_OVERHEAD, - INT_MAX32, MALLOC_OVERHEAD, IO_SIZE, 0}, - {"record_buffer", OPT_RECORD_BUFFER, - "Alias for read_buffer_size", - (uchar**) &global_system_variables.read_buff_size, - (uchar**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, - 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT_MAX32, MALLOC_OVERHEAD, IO_SIZE, 0}, -#ifdef HAVE_REPLICATION - {"relay_log_purge", OPT_RELAY_LOG_PURGE, - "0 = do not purge relay logs. 1 = purge them as soon as they are no more needed.", - (uchar**) &relay_log_purge, - (uchar**) &relay_log_purge, 0, GET_BOOL, NO_ARG, - 1, 0, 1, 0, 1, 0}, - {"relay_log_recovery", OPT_RELAY_LOG_RECOVERY, - "Enables automatic relay log recovery right after the database startup, " - "which means that the IO Thread starts re-fetching from the master " - "right after the last transaction processed.", - (uchar**) &relay_log_recovery, - (uchar**) &relay_log_recovery, 0, GET_BOOL, NO_ARG, - 0, 0, 1, 0, 1, 0}, - {"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT, - "Maximum space to use for all relay logs.", - (uchar**) &relay_log_space_limit, - (uchar**) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L, - (longlong) ULONG_MAX, 0, 1, 0}, - {"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL, - "Use compression on master/slave protocol.", - (uchar**) &opt_slave_compressed_protocol, - (uchar**) &opt_slave_compressed_protocol, - 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, - {"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT, - "Number of seconds to wait for more data from a master/slave connection before aborting the read.", - (uchar**) &slave_net_timeout, (uchar**) &slave_net_timeout, 0, - GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, - {"slave_transaction_retries", OPT_SLAVE_TRANS_RETRIES, - "Number of times the slave SQL thread will retry a transaction in case " - "it failed with a deadlock or elapsed lock wait timeout, " - "before giving up and stopping.", - (uchar**) &slave_trans_retries, (uchar**) &slave_trans_retries, 0, - GET_ULONG, REQUIRED_ARG, 10L, 0L, (longlong) ULONG_MAX, 0, 1, 0}, -#endif /* HAVE_REPLICATION */ - {"slow_launch_time", OPT_SLOW_LAUNCH_TIME, - "If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.", - (uchar**) &slow_launch_time, (uchar**) &slow_launch_time, 0, GET_ULONG, - REQUIRED_ARG, 2L, 0L, LONG_TIMEOUT, 0, 1, 0}, - {"sort_buffer_size", OPT_SORT_BUFFER, - "Each thread that needs to do a sort allocates a buffer of this size.", - (uchar**) &global_system_variables.sortbuff_size, - (uchar**) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG, - MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ~0L, MALLOC_OVERHEAD, - 1, 0}, - {"sync-binlog", OPT_SYNC_BINLOG, - "Synchronously flush binary log to disk after every #th event. " - "Use 0 (default) to disable synchronous flushing.", - (uchar**) &sync_binlog_period, (uchar**) &sync_binlog_period, 0, GET_UINT, - REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0}, - {"sync-relay-log", OPT_SYNC_RELAY_LOG, - "Synchronously flush relay log to disk after every #th event. " - "Use 0 (default) to disable synchronous flushing.", - (uchar**) &sync_relaylog_period, (uchar**) &sync_relaylog_period, 0, GET_UINT, - REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0}, - {"sync-relay-log-info", OPT_SYNC_RELAY_LOG_INFO, - "Synchronously flush relay log info to disk after #th transaction. " - "Use 0 (default) to disable synchronous flushing.", - (uchar**) &sync_relayloginfo_period, (uchar**) &sync_relayloginfo_period, 0, GET_UINT, - REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0}, - {"sync-master-info", OPT_SYNC_MASTER_INFO, - "Synchronously flush master info to disk after every #th event. " - "Use 0 (default) to disable synchronous flushing.", - (uchar**) &sync_masterinfo_period, (uchar**) &sync_masterinfo_period, 0, GET_UINT, - REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0}, - {"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.", - (uchar**) &opt_sync_frm, (uchar**) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0, - 0, 0, 0, 0}, - {"table_cache", OPT_TABLE_OPEN_CACHE, - "Deprecated; use --table_open_cache instead.", + 128*1024L, IO_SIZE*2, INT_MAX32, 0, IO_SIZE, 0}, + {"table_cache", 0, "Deprecated; use --table-open-cache instead.", (uchar**) &table_cache_size, (uchar**) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0}, - {"table_definition_cache", OPT_TABLE_DEF_CACHE, - "The number of cached table definitions.", - (uchar**) &table_def_size, (uchar**) &table_def_size, - 0, GET_ULONG, REQUIRED_ARG, TABLE_DEF_CACHE_DEFAULT, TABLE_DEF_CACHE_MIN, - 512*1024L, 0, 1, 0}, - {"table_open_cache", OPT_TABLE_OPEN_CACHE, - "The number of cached open tables.", - (uchar**) &table_cache_size, (uchar**) &table_cache_size, 0, GET_ULONG, - REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0}, - {"table_lock_wait_timeout", OPT_TABLE_LOCK_WAIT_TIMEOUT, - "Timeout in seconds to wait for a table level lock before returning an " - "error. Used only if the connection has active cursors.", - (uchar**) &table_lock_wait_timeout, (uchar**) &table_lock_wait_timeout, - 0, GET_ULONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0}, - {"thread_cache_size", OPT_THREAD_CACHE_SIZE, - "How many threads we should keep in a cache for reuse.", - (uchar**) &thread_cache_size, (uchar**) &thread_cache_size, 0, GET_ULONG, - REQUIRED_ARG, 0, 0, 16384, 0, 1, 0}, - {"thread_concurrency", OPT_THREAD_CONCURRENCY, - "Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.", - (uchar**) &concurrency, (uchar**) &concurrency, 0, GET_ULONG, REQUIRED_ARG, - DEFAULT_CONCURRENCY, 1, 512, 0, 1, 0}, -#if HAVE_POOL_OF_THREADS == 1 - {"thread_pool_size", OPT_THREAD_CACHE_SIZE, - "How many threads we should create to handle query requests in case of 'thread_handling=pool-of-threads'", - (uchar**) &thread_pool_size, (uchar**) &thread_pool_size, 0, GET_ULONG, - REQUIRED_ARG, 20, 1, 16384, 0, 1, 0}, -#endif - {"thread_stack", OPT_THREAD_STACK, - "The stack size for each thread.", (uchar**) &my_thread_stack_size, - (uchar**) &my_thread_stack_size, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK, - 1024L*128L, ULONG_MAX, 0, 1024, 0}, - { "time_format", OPT_TIME_FORMAT, - "The TIME format (for future).", - (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME], - (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME], - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"tmp_table_size", OPT_TMP_TABLE_SIZE, - "If an internal in-memory temporary table exceeds this size, MySQL will" - " automatically convert it to an on-disk MyISAM table.", - (uchar**) &global_system_variables.tmp_table_size, - (uchar**) &max_system_variables.tmp_table_size, 0, GET_ULL, - REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0}, - {"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE, - "Allocation block size for transactions to be stored in binary log", - (uchar**) &global_system_variables.trans_alloc_block_size, - (uchar**) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG, - REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0}, - {"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE, - "Persistent buffer for transactions to be stored in binary log", - (uchar**) &global_system_variables.trans_prealloc_size, - (uchar**) &max_system_variables.trans_prealloc_size, 0, GET_ULONG, - REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ULONG_MAX, 0, 1024, 0}, - {"thread_handling", OPT_THREAD_HANDLING, - "Define threads usage for handling queries: " - "one-thread-per-connection or no-threads", 0, 0, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"updatable_views_with_limit", OPT_UPDATABLE_VIEWS_WITH_LIMIT, - "1 = YES = Don't issue an error message (warning only) if a VIEW without presence of a key of the underlying table is used in queries with a LIMIT clause for updating. 0 = NO = Prohibit update of a VIEW, which does not contain a key of the underlying table and the query uses a LIMIT clause (usually get from GUI tools).", - (uchar**) &global_system_variables.updatable_views_with_limit, - (uchar**) &max_system_variables.updatable_views_with_limit, - 0, GET_ULONG, REQUIRED_ARG, 1, 0, 1, 0, 1, 0}, - {"wait_timeout", OPT_WAIT_TIMEOUT, - "The number of seconds the server waits for activity on a connection before closing it.", - (uchar**) &global_system_variables.net_wait_timeout, - (uchar**) &max_system_variables.net_wait_timeout, 0, GET_ULONG, - REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT), - 0, 1, 0}, {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -7709,6 +6417,12 @@ SHOW_VAR status_vars[]= { {NullS, NullS, SHOW_LONG} }; +static bool all_options_add_terminator() +{ + my_option empty_element= {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}; + return insert_dynamic(&all_options, (uchar *)&empty_element); +} + #ifndef EMBEDDED_LIBRARY static void print_version(void) { @@ -7718,8 +6432,52 @@ static void print_version(void) server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT); } +/** Compares two options' names, treats - and _ the same */ +static int option_cmp(my_option *a, my_option *b) +{ + const char *sa= a->name; + const char *sb= b->name; + for (; *sa || *sb; sa++, sb++) + { + if (*sa < *sb) + { + if (*sa == '-' && *sb == '_') + continue; + else + return -1; + } + if (*sa > *sb) + { + if (*sa == '_' && *sb == '-') + continue; + else + return 1; + } + } + DBUG_ASSERT(a->name == b->name); + return 0; +} + +static void print_help() +{ + MEM_ROOT mem_root; + init_alloc_root(&mem_root, 4096, 4096); + + pop_dynamic(&all_options); + add_plugin_options(&all_options, &mem_root); + sort_dynamic(&all_options, (qsort_cmp) option_cmp); + all_options_add_terminator(); + + my_print_help((my_option*) all_options.buffer); + my_print_variables((my_option*) all_options.buffer); + + free_root(&mem_root, MYF(0)); + delete_dynamic(&all_options); +} + static void usage(void) { + DBUG_ENTER("usage"); if (!(default_charset_info= get_charset_by_csname(default_character_set_name, MY_CS_PRIMARY, MYF(MY_WME)))) @@ -7729,7 +6487,7 @@ static void usage(void) print_version(); puts("\ Copyright (C) 2000-2008 MySQL AB, by Monty and others\n\ -Copyright (C) 2008 Sun Microsystems, Inc.\n\ +Copyright (C) 2008,2009 Sun Microsystems, Inc.\n\ This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ and you are welcome to modify and redistribute it under the GPL license\n\n\ Starts the MySQL database server\n"); @@ -7757,7 +6515,7 @@ Starts the MySQL database server\n"); set_ports(); /* Print out all the options including plugin supplied options */ - my_print_help_inc_plugins(my_long_options, sizeof(my_long_options)/sizeof(my_option)); + print_help(); if (! plugins_are_initialized) { @@ -7770,15 +6528,12 @@ because execution stopped before plugins were initialized."); To see what values a running MySQL server is using, type\n\ 'mysqladmin variables' instead of 'mysqld --verbose --help'."); } + DBUG_VOID_RETURN; } #endif /*!EMBEDDED_LIBRARY*/ - /** - Initialize all MySQL global variables to default values. - - We don't need to set numeric variables refered to in my_long_options - as these are initialized by my_getopt. + Initialize MySQL global variables to default values. @note The reason to set a lot of global variables to zero is to allow one to @@ -7786,27 +6541,24 @@ To see what values a running MySQL server is using, type\n\ It's also needed on some exotic platforms where global variables are not set to 0 when a program starts. - We don't need to set numeric variables refered to in my_long_options + We don't need to set variables refered to in my_long_options as these are initialized by my_getopt. */ static int mysql_init_variables(void) { - int error; /* Things reset to zero */ opt_skip_slave_start= opt_reckless_slave = 0; mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0; myisam_test_invalid_symlink= test_if_data_home_dir; opt_log= opt_slow_log= 0; opt_update_log= 0; - log_output_options= find_bit_type(log_output_str, &log_output_typelib); opt_bin_log= 0; opt_disable_networking= opt_skip_show_db=0; opt_ignore_builtin_innodb= 0; opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname= 0; opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name ! opt_secure_auth= 0; - opt_secure_file_priv= 0; opt_bootstrap= opt_myisam_log= 0; mqh_used= 0; segfaulted= kill_in_progress= 0; @@ -7847,25 +6599,12 @@ static int mysql_init_variables(void) table_alias_charset= &my_charset_bin; character_set_filesystem= &my_charset_bin; - opt_date_time_formats[0]= opt_date_time_formats[1]= opt_date_time_formats[2]= 0; - - /* Things with default values that are not zero */ - delay_key_write_options= (uint) DELAY_KEY_WRITE_ON; - slave_exec_mode_options= 0; - slave_exec_mode_options= (uint) - find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL, - &error); - if (error) - return 1; opt_specialflag= SPECIAL_ENGLISH; unix_sock= ip_sock= INVALID_SOCKET; mysql_home_ptr= mysql_home; pidfile_name_ptr= pidfile_name; log_error_file_ptr= log_error_file; lc_messages_dir_ptr= lc_messages_dir; - mysql_data_home= mysql_real_data_home; - thd_startup_options= (OPTION_BIN_LOG | - OPTION_QUOTE_SHOW_CREATE | OPTION_SQL_NOTES); protocol_version= PROTOCOL_VERSION; what_to_log= ~ (1L << (uint) COM_TIME); refresh_version= 1L; /* Increments on each reload */ @@ -7873,8 +6612,6 @@ static int mysql_init_variables(void) my_atomic_rwlock_init(&global_query_id_lock); my_atomic_rwlock_init(&thread_running_lock); strmov(server_version, MYSQL_SERVER_VERSION); - myisam_recover_options_str= sql_mode_str= "OFF"; - myisam_stats_method_str= "nulls_unequal"; threads.empty(); thread_cache.empty(); key_caches.empty(); @@ -7888,12 +6625,9 @@ static int mysql_init_variables(void) multi_keycache_init(); /* Set directory paths */ - strmake(mysql_real_data_home, get_relative_path(MYSQL_DATADIR), - sizeof(mysql_real_data_home)-1); - mysql_data_home_buff[0]=FN_CURLIB; // all paths are relative from here - mysql_data_home_buff[1]=0; - mysql_data_home_len= 2; - + mysql_real_data_home_len= + strmake(mysql_real_data_home, get_relative_path(MYSQL_DATADIR), + sizeof(mysql_real_data_home)-1) - mysql_real_data_home; /* Replication parameters */ master_info_file= (char*) "master.info", relay_log_info_file= (char*) "relay-log.info"; @@ -7904,28 +6638,10 @@ static int mysql_init_variables(void) charsets_dir= 0; default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME; default_collation_name= compiled_default_collation_name; - sys_charset_system.value= (char*) system_charset_info->csname; character_set_filesystem_name= (char*) "binary"; lc_messages= (char*) "en_US"; lc_time_names_name= (char*) "en_US"; - /* Set default values for some option variables */ - default_storage_engine_str= (char*) "MyISAM"; - global_system_variables.table_plugin= NULL; - global_system_variables.tx_isolation= ISO_REPEATABLE_READ; - global_system_variables.select_limit= (ulonglong) HA_POS_ERROR; - max_system_variables.select_limit= (ulonglong) HA_POS_ERROR; - global_system_variables.max_join_size= (ulonglong) HA_POS_ERROR; - max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR; - global_system_variables.old_passwords= 0; - global_system_variables.old_alter_table= 0; - global_system_variables.binlog_format= BINLOG_FORMAT_UNSPEC; - /* - Default behavior for 4.1 and 5.0 is to treat NULL values as unequal - when collecting index statistics for MyISAM tables. - */ - global_system_variables.myisam_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL; - global_system_variables.optimizer_switch= OPTIMIZER_SWITCH_DEFAULT; /* Variables that depends on compile options */ #ifndef DBUG_OFF default_dbug_option=IF_WIN("d:t:i:O,\\mysqld.trace", @@ -7937,12 +6653,7 @@ static int mysql_init_variables(void) #else have_profiling = SHOW_OPTION_NO; #endif - global_system_variables.ndb_index_stat_enable=FALSE; - max_system_variables.ndb_index_stat_enable=TRUE; - global_system_variables.ndb_index_stat_cache_entries=32; - max_system_variables.ndb_index_stat_cache_entries=~0L; - global_system_variables.ndb_index_stat_update_freq=20; - max_system_variables.ndb_index_stat_update_freq=~0L; + #ifdef HAVE_OPENSSL have_ssl=SHOW_OPTION_YES; #else @@ -8023,14 +6734,11 @@ static int mysql_init_variables(void) return 0; } - my_bool mysqld_get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { - int error; - switch(optid) { case '#': #ifndef DBUG_OFF @@ -8039,7 +6747,7 @@ mysqld_get_one_option(int optid, opt_endinfo=1; /* unireg: memory allocation */ break; case 'a': - global_system_variables.sql_mode= fix_sql_mode(MODE_ANSI); + global_system_variables.sql_mode= MODE_ANSI; global_system_variables.tx_isolation= ISO_SERIALIZABLE; break; case 'b': @@ -8056,8 +6764,7 @@ mysqld_get_one_option(int optid, case 'h': strmake(mysql_real_data_home,argument, sizeof(mysql_real_data_home)-1); /* Correct pointer set by my_getopt (for embedded library) */ - mysql_data_home= mysql_real_data_home; - mysql_data_home_len= strlen(mysql_data_home); + mysql_real_data_home_ptr= mysql_real_data_home; break; case 'u': if (!mysqld_user || !strcmp(mysqld_user, argument)) @@ -8067,22 +6774,10 @@ mysqld_get_one_option(int optid, break; case 'L': strmake(lc_messages_dir, argument, sizeof(lc_messages_dir)-1); + lc_messages_dir_ptr= lc_messages_dir; break; -#ifdef HAVE_REPLICATION - case OPT_SLAVE_SKIP_ERRORS: - init_slave_skip_errors(argument); - break; - case OPT_SLAVE_EXEC_MODE: - slave_exec_mode_options= (uint) - find_bit_type_or_exit(argument, &slave_exec_mode_typelib, "", &error); - if (error) - return 1; - break; -#endif - case OPT_SAFEMALLOC_MEM_LIMIT: -#if !defined(DBUG_OFF) && defined(SAFEMALLOC) - sf_malloc_mem_limit = atoi(argument); -#endif + case OPT_BINLOG_FORMAT: + binlog_format_used= true; break; #include <sslopt-case.h> #ifndef EMBEDDED_LIBRARY @@ -8102,12 +6797,6 @@ mysqld_get_one_option(int optid, test_flags= argument ? (uint) atoi(argument) : 0; opt_endinfo=1; break; - case (int) OPT_BIG_TABLES: - thd_startup_options|=OPTION_BIG_TABLES; - break; - case (int) OPT_IGNORE_BUILTIN_INNODB: - opt_ignore_builtin_innodb= 1; - break; case (int) OPT_ISAM_LOG: opt_myisam_log=1; break; @@ -8117,17 +6806,7 @@ mysqld_get_one_option(int optid, case (int) OPT_BIN_LOG: opt_bin_log= test(argument != disabled_my_option); break; - case (int) OPT_ERROR_LOG_FILE: - opt_error_log= 1; - break; #ifdef HAVE_REPLICATION - case (int) OPT_INIT_RPL_ROLE: - { - int role; - role= find_type_or_exit(argument, &rpl_role_typelib, opt->name); - rpl_status = (role == 1) ? RPL_AUTH_MASTER : RPL_IDLE_SLAVE; - break; - } case (int)OPT_REPLICATE_IGNORE_DB: { rpl_filter->add_ignore_db(argument); @@ -8174,13 +6853,6 @@ mysqld_get_one_option(int optid, binlog_filter->add_ignore_db(argument); break; } - case OPT_BINLOG_FORMAT: - { - int id; - id= find_type_or_exit(argument, &binlog_format_typelib, opt->name); - global_system_variables.binlog_format= opt_binlog_format_id= id - 1; - break; - } case (int)OPT_BINLOG_DO_DB: { binlog_filter->add_do_db(argument); @@ -8227,38 +6899,11 @@ mysqld_get_one_option(int optid, WARN_DEPRECATED(NULL, 7, 0, "--log-slow-queries", "'--slow-query-log'/'--slow-query-log-file'"); opt_slow_log= 1; break; -#ifdef WITH_CSV_STORAGE_ENGINE - case OPT_LOG_OUTPUT: - { - if (!argument || !argument[0]) - { - log_output_options= LOG_FILE; - log_output_str= log_output_typelib.type_names[1]; - } - else - { - log_output_str= argument; - log_output_options= - find_bit_type_or_exit(argument, &log_output_typelib, opt->name, &error); - if (error) - return 1; - } - break; - } -#endif - case OPT_EVENT_SCHEDULER: -#ifndef HAVE_EVENT_SCHEDULER - sql_perror("Event scheduler is not supported in embedded build."); -#else - if (Events::set_opt_event_scheduler(argument)) - return 1; -#endif - break; case (int) OPT_SKIP_NEW: opt_specialflag|= SPECIAL_NO_NEW_FUNC; - delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; + delay_key_write_options= DELAY_KEY_WRITE_NONE; myisam_concurrent_insert=0; - myisam_recover_options= HA_RECOVER_NONE; + myisam_recover_options= HA_RECOVER_OFF; sp_automatic_privileges=0; my_use_symdir=0; ha_open_options&= ~(HA_OPEN_ABORT_IF_CRASHED | HA_OPEN_DELAY_KEY_WRITE); @@ -8268,7 +6913,7 @@ mysqld_get_one_option(int optid, break; case (int) OPT_SAFE: opt_specialflag|= SPECIAL_SAFE_MODE; - delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; + delay_key_write_options= DELAY_KEY_WRITE_NONE; myisam_recover_options= HA_RECOVER_DEFAULT; ha_open_options&= ~(HA_OPEN_DELAY_KEY_WRITE); break; @@ -8287,18 +6932,6 @@ mysqld_get_one_option(int optid, case (int) OPT_SKIP_RESOLVE: opt_specialflag|=SPECIAL_NO_RESOLVE; break; - case (int) OPT_SKIP_NETWORKING: -#if defined(__NETWARE__) - sql_perror("Can't start server: skip-networking option is currently not supported on NetWare"); - return 1; -#endif - opt_disable_networking=1; - mysqld_port=0; - break; - case (int) OPT_SKIP_SHOW_DB: - opt_skip_show_db=1; - opt_specialflag|=SPECIAL_SKIP_SHOW_DB; - break; case (int) OPT_WANT_CORE: test_flags |= TEST_CORE_ON_SIGNAL; break; @@ -8330,25 +6963,10 @@ mysqld_get_one_option(int optid, freeaddrinfo(res_lst); } break; - case (int) OPT_PID_FILE: - strmake(pidfile_name, argument, sizeof(pidfile_name)-1); - break; -#ifdef __WIN__ - case (int) OPT_STANDALONE: /* Dummy option for NT */ - break; -#endif case OPT_CONSOLE: if (opt_console) opt_error_log= 0; // Force logs to stdout break; - case (int) OPT_FLUSH: - myisam_flush=1; - flush_time=0; // No auto flush - break; - case OPT_LOW_PRIORITY_UPDATES: - thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY; - global_system_variables.low_priority_updates=1; - break; case OPT_BOOTSTRAP: opt_noacl=opt_bootstrap=1; break; @@ -8357,188 +6975,14 @@ mysqld_get_one_option(int optid, break; case OPT_DELAY_KEY_WRITE_ALL: if (argument != disabled_my_option) - argument= (char*) "ALL"; - /* Fall through */ - case OPT_DELAY_KEY_WRITE: - if (argument == disabled_my_option) - delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; - else if (! argument) - delay_key_write_options= (uint) DELAY_KEY_WRITE_ON; - else - { - int type; - type= find_type_or_exit(argument, &delay_key_write_typelib, opt->name); - delay_key_write_options= (uint) type-1; - } - break; - case OPT_CHARSETS_DIR: - strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir)-1); - charsets_dir = mysql_charsets_dir; - break; - case OPT_TX_ISOLATION: - { - int type; - type= find_type_or_exit(argument, &tx_isolation_typelib, opt->name); - global_system_variables.tx_isolation= (type-1); - break; - } -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE - case OPT_NDB_MGMD: - case OPT_NDB_NODEID: - { - int len= my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len, - sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len, - "%s%s%s",opt_ndb_constrbuf_len > 0 ? ",":"", - optid == OPT_NDB_NODEID ? "nodeid=" : "", - argument); - opt_ndb_constrbuf_len+= len; - } - /* fall through to add the connectstring to the end - * and set opt_ndbcluster_connectstring - */ - case OPT_NDB_CONNECTSTRING: - if (opt_ndb_connectstring && opt_ndb_connectstring[0]) - my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len, - sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len, - "%s%s", opt_ndb_constrbuf_len > 0 ? ",":"", - opt_ndb_connectstring); - else - opt_ndb_constrbuf[opt_ndb_constrbuf_len]= 0; - opt_ndbcluster_connectstring= opt_ndb_constrbuf; - break; - case OPT_NDB_DISTRIBUTION: - int id; - id= find_type_or_exit(argument, &ndb_distribution_typelib, opt->name); - opt_ndb_distribution_id= (enum ndb_distribution)(id-1); - break; - case OPT_NDB_EXTRA_LOGGING: - if (!argument) - ndb_extra_logging++; - else if (argument == disabled_my_option) - ndb_extra_logging= 0L; - else - ndb_extra_logging= atoi(argument); - break; -#endif - case OPT_MYISAM_RECOVER: - { - if (!argument) - { - myisam_recover_options= HA_RECOVER_DEFAULT; - myisam_recover_options_str= myisam_recover_typelib.type_names[0]; - } - else if (!argument[0]) - { - myisam_recover_options= HA_RECOVER_NONE; - myisam_recover_options_str= "OFF"; - } + delay_key_write_options= DELAY_KEY_WRITE_ALL; else - { - myisam_recover_options_str=argument; - myisam_recover_options= - find_bit_type_or_exit(argument, &myisam_recover_typelib, opt->name, - &error); - if (error) - return 1; - } - ha_open_options|=HA_OPEN_ABORT_IF_CRASHED; - break; - } - case OPT_CONCURRENT_INSERT: - /* The following code is mainly here to emulate old behavior */ - if (!argument) /* --concurrent-insert */ - myisam_concurrent_insert= 1; - else if (argument == disabled_my_option) - myisam_concurrent_insert= 0; /* --skip-concurrent-insert */ - break; - case OPT_TC_HEURISTIC_RECOVER: - tc_heuristic_recover= find_type_or_exit(argument, - &tc_heuristic_recover_typelib, - opt->name); - break; - case OPT_MYISAM_STATS_METHOD: - { - ulong method_conv; - int method; - LINT_INIT(method_conv); - - myisam_stats_method_str= argument; - method= find_type_or_exit(argument, &myisam_stats_method_typelib, - opt->name); - switch (method-1) { - case 2: - method_conv= MI_STATS_METHOD_IGNORE_NULLS; - break; - case 1: - method_conv= MI_STATS_METHOD_NULLS_EQUAL; - break; - case 0: - default: - method_conv= MI_STATS_METHOD_NULLS_NOT_EQUAL; - break; - } - global_system_variables.myisam_stats_method= method_conv; + delay_key_write_options= DELAY_KEY_WRITE_NONE; break; - } - case OPT_SQL_MODE: - { - sql_mode_str= argument; - global_system_variables.sql_mode= - find_bit_type_or_exit(argument, &sql_mode_typelib, opt->name, &error); - if (error) - return 1; - global_system_variables.sql_mode= fix_sql_mode(global_system_variables. - sql_mode); - break; - } - case OPT_OPTIMIZER_SWITCH: - { - bool not_used; - char *error= 0; - uint error_len= 0; - optimizer_switch_str= argument; - global_system_variables.optimizer_switch= - (ulong)find_set_from_flags(&optimizer_switch_typelib, - optimizer_switch_typelib.count, - global_system_variables.optimizer_switch, - global_system_variables.optimizer_switch, - argument, strlen(argument), NULL, - &error, &error_len, ¬_used); - if (error) - { - char buf[512]; - char *cbuf= buf; - cbuf += my_snprintf(buf, 512, "Error in parsing optimizer_switch setting near %*s\n", error_len, error); - sql_perror(buf); - return 1; - } - break; - } case OPT_ONE_THREAD: - global_system_variables.thread_handling= - SCHEDULER_ONE_THREAD_PER_CONNECTION; - break; - case OPT_THREAD_HANDLING: - { - global_system_variables.thread_handling= - find_type_or_exit(argument, &thread_handling_typelib, opt->name)-1; - break; - } - case OPT_FT_BOOLEAN_SYNTAX: - if (ft_boolean_check_syntax_string((uchar*) argument)) - { - sql_print_error("Invalid ft-boolean-syntax string: %s\n", argument); - return 1; - } - strmake(ft_boolean_syntax, argument, sizeof(ft_boolean_syntax)-1); - break; - case OPT_SKIP_SAFEMALLOC: -#ifdef SAFEMALLOC - sf_malloc_quick=1; -#endif + thread_handling= SCHEDULER_ONE_THREAD_PER_CONNECTION; break; case OPT_LOWER_CASE_TABLE_NAMES: - lower_case_table_names= argument ? atoi(argument) : 1; lower_case_table_names_used= 1; break; #if defined(ENABLED_DEBUG_SYNC) @@ -8630,24 +7074,92 @@ static int get_options(int *argc,char **argv) int ho_error; my_getopt_register_get_addr(mysql_getopt_value); - strmake(def_ft_boolean_syntax, ft_boolean_syntax, - sizeof(ft_boolean_syntax)-1); my_getopt_error_reporter= option_error_reporter; + /* prepare all_options array */ + my_init_dynamic_array(&all_options, sizeof(my_option), + array_elements(my_long_options), array_elements(my_long_options)/4); + for (my_option *opt= my_long_options; + opt < my_long_options + array_elements(my_long_options) - 1; + opt++) + insert_dynamic(&all_options, (uchar*) opt); + sys_var_init(&all_options); + all_options_add_terminator(); + /* Skip unknown options so that they may be processed later by plugins */ my_getopt_skip_unknown= TRUE; - if ((ho_error= handle_options(argc, &argv, my_long_options, + if ((ho_error= handle_options(argc, &argv, (my_option*)(all_options.buffer), mysqld_get_one_option))) return ho_error; + + if (!opt_help) + delete_dynamic(&all_options); + (*argc)++; /* add back one for the progname handle_options removes */ /* no need to do this for argv as we are discarding it. */ + /* + Options have been parsed. Now some of them need additional special + handling, like custom value checking, checking of incompatibilites + between options, setting of multiple variables, etc. + Do them here. + */ + if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes || opt_log_slow_slave_statements) && !opt_slow_log) sql_print_warning("options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set"); + if (log_error_file_ptr != disabled_my_option) + opt_error_log= 1; + else + log_error_file_ptr= const_cast<char*>(""); + + opt_init_connect.length=strlen(opt_init_connect.str); + opt_init_slave.length=strlen(opt_init_slave.str); + + if (global_system_variables.low_priority_updates) + thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY; + + if (ft_boolean_check_syntax_string((uchar*) ft_boolean_syntax)) + { + sql_print_error("Invalid ft-boolean-syntax string: %s\n", + ft_boolean_syntax); + return 1; + } + + if (opt_disable_networking) + { +#if defined(__NETWARE__) + sql_print_error("Can't start server: skip-networking option is currently not supported on NetWare"); + return 1; +#endif + mysqld_port= 0; + } + if (opt_skip_show_db) + opt_specialflag|= SPECIAL_SKIP_SHOW_DB; + + if (myisam_flush) + flush_time= 0; + +#ifdef HAVE_REPLICATION + if (opt_slave_skip_errors) + init_slave_skip_errors(opt_slave_skip_errors); +#endif + + if (global_system_variables.max_join_size == HA_POS_ERROR) + global_system_variables.option_bits|= OPTION_BIG_SELECTS; + else + global_system_variables.option_bits&= ~OPTION_BIG_SELECTS; + + if (global_system_variables.option_bits & OPTION_AUTOCOMMIT) + global_system_variables.option_bits&= ~OPTION_NOT_AUTOCOMMIT; + else + global_system_variables.option_bits|= OPTION_NOT_AUTOCOMMIT; + + global_system_variables.sql_mode= + expand_sql_mode(global_system_variables.sql_mode); #if defined(HAVE_BROKEN_REALPATH) my_use_symdir=0; my_disable_symlinks=1; @@ -8666,15 +7178,13 @@ static int get_options(int *argc,char **argv) test_flags&= ~TEST_CORE_ON_SIGNAL; } /* Set global MyISAM variables from delay_key_write_options */ - fix_delay_key_write((THD*) 0, OPT_GLOBAL); - /* Set global slave_exec_mode from its option */ - fix_slave_exec_mode(OPT_GLOBAL); + fix_delay_key_write(0, 0, OPT_GLOBAL); #ifndef EMBEDDED_LIBRARY if (mysqld_chroot) set_root(mysqld_chroot); #else - global_system_variables.thread_handling = SCHEDULER_NO_THREADS; + thread_handling = SCHEDULER_NO_THREADS; max_allowed_packet= global_system_variables.max_allowed_packet; net_buffer_length= global_system_variables.net_buffer_length; #endif @@ -8687,34 +7197,27 @@ static int get_options(int *argc,char **argv) */ my_disable_locking= myisam_single_user= test(opt_external_locking == 0); my_default_record_cache_size=global_system_variables.read_buff_size; - myisam_max_temp_length= - (my_off_t) global_system_variables.myisam_max_sort_file_size; - /* Set global variables based on startup options */ - myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size); - - /* long_query_time is in microseconds */ - global_system_variables.long_query_time= max_system_variables.long_query_time= - (longlong) (long_query_time * 1000000.0); + global_system_variables.long_query_time= (ulonglong) + (global_system_variables.long_query_time_double * 1e6); if (opt_short_log_format) opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT; if (init_global_datetime_format(MYSQL_TIMESTAMP_DATE, - &global_system_variables.date_format) || + &global_date_format) || init_global_datetime_format(MYSQL_TIMESTAMP_TIME, - &global_system_variables.time_format) || + &global_time_format) || init_global_datetime_format(MYSQL_TIMESTAMP_DATETIME, - &global_system_variables.datetime_format)) + &global_datetime_format)) return 1; #ifdef EMBEDDED_LIBRARY one_thread_scheduler(&thread_scheduler); #else - if (global_system_variables.thread_handling <= - SCHEDULER_ONE_THREAD_PER_CONNECTION) + if (thread_handling <= SCHEDULER_ONE_THREAD_PER_CONNECTION) one_thread_per_connection_scheduler(&thread_scheduler); - else if (global_system_variables.thread_handling == SCHEDULER_NO_THREADS) + else if (thread_handling == SCHEDULER_NO_THREADS) one_thread_scheduler(&thread_scheduler); else pool_of_threads_scheduler(&thread_scheduler); /* purecov: tested */ @@ -8800,7 +7303,7 @@ static int fix_paths(void) convert_dirname(mysql_real_data_home,mysql_real_data_home,NullS); (void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir (void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home); - (void) my_load_path(pidfile_name,pidfile_name,mysql_real_data_home); + (void) my_load_path(pidfile_name, pidfile_name_ptr, mysql_real_data_home); (void) my_load_path(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr : get_relative_path(PLUGINDIR), mysql_home); opt_plugin_dir_ptr= opt_plugin_dir; @@ -8820,23 +7323,22 @@ static int fix_paths(void) (void) my_load_path(lc_messages_dir, lc_messages_dir, buff); /* If --character-sets-dir isn't given, use shared library dir */ - if (charsets_dir != mysql_charsets_dir) - { + if (charsets_dir) + strmake(mysql_charsets_dir, charsets_dir, sizeof(mysql_charsets_dir)-1); + else strxnmov(mysql_charsets_dir, sizeof(mysql_charsets_dir)-1, buff, CHARSET_DIR, NullS); - } (void) my_load_path(mysql_charsets_dir, mysql_charsets_dir, buff); convert_dirname(mysql_charsets_dir, mysql_charsets_dir, NullS); charsets_dir=mysql_charsets_dir; if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) return 1; + if (!opt_mysql_tmpdir) + opt_mysql_tmpdir= mysql_tmpdir; #ifdef HAVE_REPLICATION if (!slave_load_tmpdir) - { - if (!(slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE)))) - return 1; - } + slave_load_tmpdir= mysql_tmpdir; #endif /* HAVE_REPLICATION */ /* Convert the secure-file-priv option to system format, allowing @@ -8845,106 +7347,12 @@ static int fix_paths(void) if (opt_secure_file_priv) { convert_dirname(buff, opt_secure_file_priv, NullS); - my_free(opt_secure_file_priv, MYF(0)); + x_free(opt_secure_file_priv); opt_secure_file_priv= my_strdup(buff, MYF(MY_FAE)); } return 0; } - -static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib, - const char *option, int *error) -{ - ulong result; - const char **ptr; - - *error= 0; - if ((result= find_bit_type(x, bit_lib)) == ~(ulong) 0) - { - char *buff= (char *) my_alloca(2048); - char *cbuf; - ptr= bit_lib->type_names; - cbuf= buff + ((!*x) ? - my_snprintf(buff, 2048, "No option given to %s\n", option) : - my_snprintf(buff, 2048, "Wrong option to %s. Option(s) given: %s\n", - option, x)); - cbuf+= my_snprintf(cbuf, 2048 - (cbuf-buff), "Alternatives are: '%s'", *ptr); - while (*++ptr) - cbuf+= my_snprintf(cbuf, 2048 - (cbuf-buff), ",'%s'", *ptr); - my_snprintf(cbuf, 2048 - (cbuf-buff), "\n"); - sql_perror(buff); - *error= 1; - my_afree(buff); - return 0; - } - - return result; -} - - -/** - @return - a bitfield from a string of substrings separated by ',' - or - ~(ulong) 0 on error. -*/ - -static ulong find_bit_type(const char *x, TYPELIB *bit_lib) -{ - bool found_end; - int found_count; - const char *end,*i,*j; - const char **array, *pos; - ulong found,found_int,bit; - DBUG_ENTER("find_bit_type"); - DBUG_PRINT("enter",("x: '%s'",x)); - - found=0; - found_end= 0; - pos=(char *) x; - while (*pos == ' ') pos++; - found_end= *pos == 0; - while (!found_end) - { - if (!*(end=strcend(pos,','))) /* Let end point at fieldend */ - { - while (end > pos && end[-1] == ' ') - end--; /* Skip end-space */ - found_end=1; - } - found_int=0; found_count=0; - for (array=bit_lib->type_names, bit=1 ; (i= *array++) ; bit<<=1) - { - j=pos; - while (j != end) - { - if (my_toupper(mysqld_charset,*i++) != - my_toupper(mysqld_charset,*j++)) - goto skip; - } - found_int=bit; - if (! *i) - { - found_count=1; - break; - } - else if (j != pos) // Half field found - { - found_count++; // Could be one of two values - } -skip: ; - } - if (found_count != 1) - DBUG_RETURN(~(ulong) 0); // No unique value - found|=found_int; - pos=end+1; - } - - DBUG_PRINT("exit",("bit-field: %ld",(ulong) found)); - DBUG_RETURN(found); -} /* find_bit_type */ - - /** Check if file system used for databases is case insensitive. @@ -9047,11 +7455,6 @@ void refresh_status(THD *thd) This section should go away soon *****************************************************************************/ -#ifndef WITH_NDBCLUSTER_STORAGE_ENGINE -ulong ndb_cache_check_time; -ulong ndb_extra_logging; -#endif - /***************************************************************************** Instantiate templates *****************************************************************************/ @@ -9062,7 +7465,6 @@ template class I_List<THD>; template class I_List_iterator<THD>; template class I_List<i_string>; template class I_List<i_string_pair>; -template class I_List<NAMED_LIST>; template class I_List<Statement>; template class I_List_iterator<Statement>; #endif |