diff options
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r-- | sql/mysqld.cc | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3df75b3643d..81676b61b1f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -32,6 +32,7 @@ #include <nisam.h> #include <thr_alarm.h> #include <ft_global.h> +#include <assert.h> #ifndef DBUG_OFF #define ONE_THREAD @@ -322,7 +323,8 @@ ulong thd_startup_options=(OPTION_UPDATE_LOG | OPTION_AUTO_IS_NULL | uint protocol_version=PROTOCOL_VERSION; struct system_variables global_system_variables; struct system_variables max_system_variables; -ulong keybuff_size,table_cache_size, +ulonglong keybuff_size; +ulong table_cache_size, thread_stack, thread_stack_min,what_to_log= ~ (1L << (uint) COM_TIME), query_buff_size, @@ -451,7 +453,7 @@ pthread_attr_t connection_attrib; #include <process.h> #if !defined(EMBEDDED_LIBRARY) HANDLE hEventShutdown; -static char *event_name; +static char shutdown_event_name[40]; #include "nt_servc.h" static NTService Service; // Service object for WinNT #endif @@ -1019,6 +1021,7 @@ static void set_root(const char *path) sql_perror("chroot"); unireg_abort(1); } + my_setwd("/", MYF(0)); #endif } @@ -1391,7 +1394,7 @@ or misconfigured. This error can also be caused by malfunctioning hardware.\n", We will try our best to scrape up some info that will hopefully help diagnose\n\ the problem, but since we have already crashed, something is definitely wrong\n\ and this may fail.\n\n"); - fprintf(stderr, "key_buffer_size=%ld\n", keybuff_size); + fprintf(stderr, "key_buffer_size=%lu\n", (ulong) keybuff_size); fprintf(stderr, "read_buffer_size=%ld\n", global_system_variables.read_buff_size); fprintf(stderr, "sort_buffer_size=%ld\n", thd->variables.sortbuff_size); fprintf(stderr, "max_used_connections=%ld\n", max_used_connections); @@ -1399,8 +1402,9 @@ and this may fail.\n\n"); fprintf(stderr, "threads_connected=%d\n", thread_count); fprintf(stderr, "It is possible that mysqld could use up to \n\ key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = %ld K\n\ -bytes of memory\n", (keybuff_size + (global_system_variables.read_buff_size + - thd->variables.sortbuff_size) * +bytes of memory\n", ((ulong) keybuff_size + + (global_system_variables.read_buff_size + + thd->variables.sortbuff_size) * max_connections)/ 1024); fprintf(stderr, "Hope that's ok; if not, decrease some variables in the equation.\n\n"); @@ -2102,6 +2106,7 @@ int main(int argc, char **argv) (void) grant_init((THD*) 0); init_max_user_conn(); init_update_queries(); + DBUG_ASSERT(current_thd == 0); #ifdef HAVE_DLOPEN if (!opt_noacl) @@ -2110,6 +2115,7 @@ int main(int argc, char **argv) /* init_slave() must be called after the thread keys are created */ init_slave(); + DBUG_ASSERT(current_thd == 0); if (opt_bin_log && !server_id) { server_id= !master_host ? 1 : 2; @@ -2346,6 +2352,14 @@ bool default_service_handling(char **argv, int main(int argc, char **argv) { + + /* When several instances are running on the same machine, we + need to have an unique named hEventShudown through the + application PID e.g.: MySQLShutdown1890; MySQLShutdown2342 + */ + int2str((int) GetCurrentProcessId(),strmov(shutdown_event_name, + "MySQLShutdown"), 10); + if (Service.GetOS()) /* true NT family */ { char file_path[FN_REFLEN]; @@ -2360,10 +2374,9 @@ int main(int argc, char **argv) if (Service.IsService(argv[1])) { /* start an optional service */ - event_name= argv[1]; - load_default_groups[0]= argv[1]; + load_default_groups[0]= argv[1]; start_mode= 1; - Service.Init(event_name, mysql_service); + Service.Init(argv[1], mysql_service); return 0; } } @@ -2382,9 +2395,8 @@ int main(int argc, char **argv) use_opt_args=1; opt_argc=argc; opt_argv=argv; - event_name= argv[2]; start_mode= 1; - Service.Init(event_name, mysql_service); + Service.Init(argv[2], mysql_service); return 0; } } @@ -2404,7 +2416,6 @@ int main(int argc, char **argv) { /* start the default service */ start_mode= 1; - event_name= "MySqlShutdown"; Service.Init(MYSQL_SERVICENAME, mysql_service); return 0; } @@ -3764,8 +3775,9 @@ struct my_option my_long_options[] = IO_SIZE, 0}, {"key_buffer_size", OPT_KEY_BUFFER_SIZE, "The size of the buffer used for index blocks. 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.", - (gptr*) &keybuff_size, (gptr*) &keybuff_size, 0, GET_ULONG, REQUIRED_ARG, - KEY_CACHE_SIZE, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, IO_SIZE, 0}, + (gptr*) &keybuff_size, (gptr*) &keybuff_size, 0, GET_ULL, + REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD, + IO_SIZE, 0}, {"long_query_time", OPT_LONG_QUERY_TIME, "Log all queries that have taken more than long_query_time seconds to execute to file.", (gptr*) &global_system_variables.long_query_time, @@ -4268,6 +4280,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; 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; break; case 'L': strmake(language, argument, sizeof(language)-1); |