diff options
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r-- | sql/mysqld.cc | 105 |
1 files changed, 77 insertions, 28 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 862f9effc68..88b923244e7 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -227,6 +227,12 @@ extern "C" int gethostname(char *name, int namelen); extern "C" sig_handler handle_segfault(int sig); +#if defined(__linux__) +#define ENABLE_TEMP_POOL 1 +#else +#define ENABLE_TEMP_POOL 0 +#endif + /* Constants */ const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"}; @@ -372,7 +378,7 @@ static pthread_cond_t COND_thread_cache, COND_flush_thread_cache; /* Global variables */ -bool opt_update_log, opt_bin_log; +bool opt_update_log, opt_bin_log, opt_ignore_builtin_innodb= 0; my_bool opt_log, opt_slow_log; ulong log_output_options; my_bool opt_log_queries_not_using_indexes= 0; @@ -786,16 +792,6 @@ static void close_connections(void) kill_cached_threads++; flush_thread_cache(); - /* kill flush thread */ - (void) pthread_mutex_lock(&LOCK_manager); - if (manager_thread_in_use) - { - DBUG_PRINT("quit", ("killing manager thread: 0x%lx", - (ulong)manager_thread)); - (void) pthread_cond_signal(&COND_manager); - } - (void) pthread_mutex_unlock(&LOCK_manager); - /* kill connection thread */ #if !defined(__WIN__) && !defined(__NETWARE__) DBUG_PRINT("quit", ("waiting for select thread: 0x%lx", @@ -1198,6 +1194,7 @@ void clean_up(bool print_message) if (cleanup_done++) return; /* purecov: inspected */ + stop_handle_manager(); release_ddl_log(); /* @@ -3409,8 +3406,13 @@ static int init_common_variables(const char *conf_file_name, int argc, sys_var_slow_log_path.value= my_strdup(s, MYF(0)); sys_var_slow_log_path.value_length= strlen(s); +#if (ENABLE_TEMP_POOL) if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1)) return 1; +#else + use_temp_pool= 0; +#endif + if (my_database_names_init()) return 1; @@ -4043,17 +4045,6 @@ server."); #ifndef EMBEDDED_LIBRARY -static void create_maintenance_thread() -{ - if (flush_time && flush_time != ~(ulong) 0L) - { - pthread_t hThread; - if (pthread_create(&hThread,&connection_attrib,handle_manager,0)) - sql_print_warning("Can't create thread to manage maintenance"); - } -} - - static void create_shutdown_thread() { #ifdef __WIN__ @@ -4143,6 +4134,44 @@ void decrement_handler_count() #ifndef EMBEDDED_LIBRARY +#ifndef DBUG_OFF +/* + Debugging helper function to keep the locale database + (see sql_locale.cc) and max_month_name_length and + max_day_name_length variable values in consistent state. +*/ +static void test_lc_time_sz() +{ + DBUG_ENTER("test_lc_time_sz"); + for (MY_LOCALE **loc= my_locales; *loc; loc++) + { + uint max_month_len= 0; + uint max_day_len = 0; + for (const char **month= (*loc)->month_names->type_names; *month; month++) + { + set_if_bigger(max_month_len, + my_numchars_mb(&my_charset_utf8_general_ci, + *month, *month + strlen(*month))); + } + for (const char **day= (*loc)->day_names->type_names; *day; day++) + { + set_if_bigger(max_day_len, + my_numchars_mb(&my_charset_utf8_general_ci, + *day, *day + strlen(*day))); + } + if ((*loc)->max_month_name_length != max_month_len || + (*loc)->max_day_name_length != max_day_len) + { + DBUG_PRINT("Wrong max day name(or month name) length for locale:", + ("%s", (*loc)->name)); + DBUG_ASSERT(0); + } + } + DBUG_VOID_RETURN; +} +#endif//DBUG_OFF + + #ifdef __WIN__ int win_main(int argc, char **argv) #else @@ -4243,6 +4272,10 @@ int main(int argc, char **argv) openlog(libwrapName, LOG_PID, LOG_AUTH); #endif +#ifndef DBUG_OFF + test_lc_time_sz(); +#endif + /* We have enough space for fiddling with the argv, continue */ @@ -4368,7 +4401,7 @@ we force server id to 2, but this MySQL server will not act as a slave."); execute_ddl_log_recovery(); create_shutdown_thread(); - create_maintenance_thread(); + start_handle_manager(); if (Events::init(opt_noacl)) unireg_abort(1); @@ -5557,7 +5590,8 @@ enum options_mysqld OPT_OLD_MODE, OPT_SLAVE_EXEC_MODE, OPT_GENERAL_LOG_FILE, - OPT_SLOW_QUERY_LOG_FILE + OPT_SLOW_QUERY_LOG_FILE, + OPT_IGNORE_BUILTIN_INNODB }; @@ -5763,6 +5797,9 @@ Disable with --skip-large-pages.", (uchar**) &opt_large_pages, (uchar**) &opt_large_pages, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 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}, @@ -6322,9 +6359,14 @@ log and this option does nothing anymore.", (uchar**) &opt_tc_heuristic_recover, (uchar**) &opt_tc_heuristic_recover, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"temp-pool", OPT_TEMP_POOL, +#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 + "This option is ignored on this OS.", +#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, @@ -6578,7 +6620,7 @@ The minimum value for this variable is 4096.", {"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, 1, UINT_MAX, 0, 1, 0}, + 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, @@ -6876,13 +6918,15 @@ The minimum value for this variable is 4096.", {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -static int show_question(THD *thd, SHOW_VAR *var, char *buff) + +static int show_queries(THD *thd, SHOW_VAR *var, char *buff) { var->type= SHOW_LONGLONG; var->value= (char *)&thd->query_id; return 0; } + static int show_net_compression(THD *thd, SHOW_VAR *var, char *buff) { var->type= SHOW_MY_BOOL; @@ -7298,7 +7342,8 @@ SHOW_VAR status_vars[]= { {"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_NOFLUSH}, {"Qcache_total_blocks", (char*) &query_cache.total_blocks, SHOW_LONG_NOFLUSH}, #endif /*HAVE_QUERY_CACHE*/ - {"Questions", (char*) &show_question, SHOW_FUNC}, + {"Queries", (char*) &show_queries, SHOW_FUNC}, + {"Questions", (char*) offsetof(STATUS_VAR, questions), SHOW_LONG_STATUS}, #ifdef HAVE_REPLICATION {"Rpl_status", (char*) &show_rpl_status, SHOW_FUNC}, #endif @@ -7456,6 +7501,7 @@ static int mysql_init_variables(void) 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; @@ -7753,6 +7799,9 @@ mysqld_get_one_option(int optid, 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; |