diff options
-rw-r--r-- | Docs/manual.texi | 45 | ||||
-rw-r--r-- | sql/lex.h | 1 | ||||
-rw-r--r-- | sql/mysqld.cc | 53 | ||||
-rw-r--r-- | sql/sql_base.cc | 27 | ||||
-rw-r--r-- | support-files/my-huge.cnf.sh | 6 | ||||
-rw-r--r-- | support-files/my-large.cnf.sh | 6 | ||||
-rw-r--r-- | support-files/my-medium.cnf.sh | 6 | ||||
-rw-r--r-- | support-files/my-small.cnf.sh | 6 | ||||
-rwxr-xr-x | tests/fork_big.pl | 8 |
9 files changed, 98 insertions, 60 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 1f48a3a1b04..c96bf8bb79c 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -24063,15 +24063,15 @@ the configuration file. Below is an example of possible configuration parameters in my.cnf for Innobase: @example -innobase_data_home_dir = c:\ibdata\ +innobase_data_home_dir = /usr/local/mysql/var +innobase_log_group_home_dir = /usr/local/mysql/var +innobase_log_arch_dir = /usr/local/mysql/var innobase_data_file_path = ibdata1:25M;ibdata2:37M;ibdata3:100M;ibdata4:300M set-variable = innobase_mirrored_log_groups=1 -innobase_log_group_home_dir = c:\iblogs\ set-variable = innobase_log_files_in_group=3 set-variable = innobase_log_file_size=5M set-variable = innobase_log_buffer_size=8M innobase_flush_log_at_trx_commit=1 -innobase_log_arch_dir = c:\iblogs\ innobase_log_archive=0 set-variable = innobase_buffer_pool_size=16M set-variable = innobase_additional_mem_pool_size=2M @@ -28120,6 +28120,9 @@ If you compile with @code{--with-debug=full}, then you will loose 20 % for most queries, but some queries may take substantially longer (The @strong{MySQL} benchmarks ran 35 % slower) If you use @code{--with-debug}, then you will only loose 15 %. +By starting a @code{mysqld} version compiled with @code{--with-debug=full} +with @code{--skip-safemalloc} the end result should be close to when +configuring with @code{--with-debug}. @item On a Sun SPARCstation 20, SunPro C++ 4.2 is 5 % faster than @code{gcc} 2.95.2. @@ -30899,9 +30902,9 @@ The @code{mysqladmin status} command result has the following columns: @cindex open tables @item Open tables @tab Number of tables that are open now. @cindex memory use -@item Memory in use @tab Memory allocated directly by the mysqld code (only available when @strong{MySQL} is compiled with --with-debug). +@item Memory in use @tab Memory allocated directly by the mysqld code (only available when @strong{MySQL} is compiled with --with-debug=full). @cindex max memory used -@item Max memory used @tab Maximum memory allocated directly by the mysqld code (only available when @strong{MySQL} is compiled with --with-debug). +@item Max memory used @tab Maximum memory allocated directly by the mysqld code (only available when @strong{MySQL} is compiled with --with-debug=full). @end multitable If you do @code{myslqadmin shutdown} on a socket (in other words, on a @@ -34363,8 +34366,9 @@ Try @code{fork_test.pl} and @code{fork2_test.pl}. @item If you configure @strong{MySQL} for debugging, it will be much easier to gather information about possible errors if something goes wrong. -Reconfigure @strong{MySQL} with the @code{--with-debug} option to -@code{configure} and then recompile. @xref{Debugging server}. +Reconfigure @strong{MySQL} with the @code{--with-debug} option or +@code{--with-debug=full} to @code{configure} and then recompile. +@xref{Debugging server}. @item Configuring @strong{MySQL} for debugging causes a safe memory allocator to be @@ -42479,6 +42483,10 @@ not yet 100 % confident in this code. Fixed bug in @code{ALTER TABLE} and @code{LOAD DATA INFILE} that disabled key-sorting. These command should now be faster in most cases. @item +Fixed performance bug where reopened tables (tables that had been +waiting for @code{FLUSH} or @code{REPAIR}) would not use indexes for the +next query. +@item Fixed problem with @code{ALTER TABLE} to Innobase tables on Freebsd. @item Added @code{mysqld} variables @code{myisam_max_sort_file_size} and @@ -48049,7 +48057,7 @@ autoheader aclocal automake autoconf -./configure --with-debug --prefix='your installation directory' +./configure --with-debug=full --prefix='your installation directory' # The makefiles generated above need GNU make 3.75 or newer. # (called gmake below) @@ -48123,11 +48131,11 @@ problems that may be unique to your environment. If you have some very specific problem, you can always try to debug @strong{MySQL}. To do this you must configure @strong{MySQL} with the -option @code{--with-debug}. You can check whether or not -@strong{MySQL} was compiled with debugging by doing: @code{mysqld ---help}. If the @code{--debug} flag is listed with the options then you -have debugging enabled. @code{mysqladmin ver} also lists the -@code{mysqld} version as @code{mysql ... -debug} in this case. +@code{--with-debug} or the @code{--with-debug=full} option. You can check +whether or not @strong{MySQL} was compiled with debugging by doing: +@code{mysqld --help}. If the @code{--debug} flag is listed with the +options then you have debugging enabled. @code{mysqladmin ver} also +lists the @code{mysqld} version as @code{mysql ... -debug} in this case. If you are using gcc or egcs, the recommended configure line is: @@ -48139,10 +48147,13 @@ This will avoid problems with the @code{libstdc++} library and with C++ exceptions (many compilers have problems with C++ exceptions in threaded code) and compile a @strong{MySQL} version with support for all character sets. -If you suspect a memory overrun error, you can use @code{--with-debug=full}, -which will install a memory allocation checker. This is however quite slow -so this is not something one should do on a server in a heavy production -environment. +If you suspect a memory overrun error, you can configure @strong{MySQL} +with @code{--with-debug=full}, which will install a memory allocation +(@code{SAFEMALLOC}) checker. Running with @code{SAFEMALLOC} is however +quite slow, so if you get performance problems you should start +@code{mysqld} with the @code{--skip-safemalloc} option. This will +disable the memory overrun checks for each call to @code{malloc} and +@code{free}. If @code{mysqld} stops crashing when you compile it with @code{--with-debug}, you have probably found a compiler bug or a timing diff --git a/sql/lex.h b/sql/lex.h index 3b43922e21f..6c83cb34366 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -165,6 +165,7 @@ static SYMBOL symbols[] = { { "INFILE", SYM(INFILE),0,0}, { "INNER", SYM(INNER_SYM),0,0}, { "INNOBASE", SYM(INNOBASE_SYM),0,0}, + { "INNODB", SYM(INNOBASE_SYM),0,0}, { "INSERT", SYM(INSERT),0,0}, { "INSERT_ID", SYM(INSERT_ID),0,0}, { "INT", SYM(INT_SYM),0,0}, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 2ec016409c0..67e4bee934d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -271,6 +271,8 @@ ulong max_connections,max_insert_delayed_threads,max_used_connections, max_connect_errors, max_user_connections = 0; ulong thread_id=1L,current_pid; ulong slow_launch_threads = 0; +ulong myisam_max_sort_file_size, myisam_max_extra_sort_file_size; + char mysql_real_data_home[FN_REFLEN], mysql_data_home[2],language[LIBLEN],reg_ext[FN_EXTLEN], default_charset[LIBLEN],mysql_charsets_dir[FN_REFLEN], *charsets_list, @@ -584,7 +586,6 @@ static void __cdecl kill_server(int sig_ptr) my_thread_init(); // If this is a new thread #endif close_connections(); - sql_print_error(ER(ER_SHUTDOWN_COMPLETE),my_progname); if (sig != MYSQL_KILL_SIGNAL && sig != 0) unireg_abort(1); /* purecov: inspected */ else @@ -634,7 +635,7 @@ void unireg_abort(int exit_code) } -void clean_up(void) +void clean_up(bool print_message) { DBUG_PRINT("exit",("clean_up")); if (cleanup_done++) @@ -655,17 +656,19 @@ void clean_up(void) #ifdef USE_RAID end_raid(); #endif - x_free((gptr) my_errmsg[ERRMAPP]); /* Free messages */ free_defaults(defaults_argv); my_free(mysql_tmpdir,MYF(0)); x_free(opt_bin_logname); bitmap_free(&temp_pool); free_max_user_conn(); + end_slave(); #ifndef __WIN__ if (!opt_bootstrap) (void) my_delete(pidfile_name,MYF(0)); // This may not always exist #endif - end_slave(); + if (print_message) + sql_print_error(ER(ER_SHUTDOWN_COMPLETE),my_progname); + x_free((gptr) my_errmsg[ERRMAPP]); /* Free messages */ my_thread_end(); /* Tell main we are ready */ @@ -1214,6 +1217,7 @@ help in finding out why mysqld died.\n",sig); #if defined(HAVE_LINUXTHREADS) #ifdef __i386__ trace_stack(); + fflush(stderr); #endif /* __i386__ */ if (test_flags & TEST_CORE_ON_SIGNAL) write_core(sig); @@ -1245,11 +1249,7 @@ static void init_signals(void) sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL); if (!(test_flags & TEST_NO_STACKTRACE)) { -#ifdef HAVE_DARWIN_THREADS - sa.sa_handler=( void (*)() ) handle_segfault; -#else sa.sa_handler=handle_segfault; -#endif sigaction(SIGSEGV, &sa, NULL); #ifdef SIGBUS sigaction(SIGBUS, &sa, NULL); @@ -1698,6 +1698,10 @@ int main(int argc, char **argv) reset_floating_point_exceptions(); init_thr_lock(); + /* Fix varibles that are base 1024*1024 */ + myisam_max_temp_length= (my_off_t) min(((ulonglong) myisam_max_sort_file_size)*1024*1024, (ulonglong) MAX_FILE_SIZE); + myisam_max_extra_temp_length= (my_off_t) min(((ulonglong) myisam_max_extra_sort_file_size)*1024*1024, (ulonglong) MAX_FILE_SIZE); + /* Setup log files */ if (opt_log) open_log(&mysql_log, glob_hostname, opt_logname, ".log", LOG_NORMAL); @@ -2460,7 +2464,7 @@ enum options { OPT_GEMINI_SKIP, OPT_INNOBASE_SKIP, OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_GEMINI_FLUSH_LOG, OPT_GEMINI_RECOVER, - OPT_GEMINI_UNBUFFERED_IO + OPT_GEMINI_UNBUFFERED_IO, OPT_SKIP_SAFEMALLOC, }; static struct option long_options[] = { @@ -2583,6 +2587,7 @@ static struct option long_options[] = { {"skip-host-cache", no_argument, 0, (int) OPT_SKIP_HOST_CACHE}, {"skip-name-resolve", no_argument, 0, (int) OPT_SKIP_RESOLVE}, {"skip-new", no_argument, 0, (int) OPT_SKIP_NEW}, + {"skip-safemalloc", no_argument, 0, (int) OPT_SKIP_SAFEMALLOC}, {"skip-show-database", no_argument, 0, (int) OPT_SKIP_SHOW_DB}, {"skip-slave-start", no_argument, 0, (int) OPT_SKIP_SLAVE_START}, {"skip-networking", no_argument, 0, (int) OPT_SKIP_NETWORKING}, @@ -2705,6 +2710,11 @@ CHANGEABLE_VAR changeable_vars[] = { ~0L, 1, ~0L, 0, 1 }, { "myisam_sort_buffer_size", (long*) &myisam_sort_buffer_size, 8192*1024, 4, ~0L, 0, 1 }, + { "myisam_max_extra_sort_file_size", + (long*) &myisam_max_extra_sort_file_size, + (long) (MI_MAX_TEMP_LENGTH/(1024L*1024L)), 0, ~0L, 0, 1 }, + { "myisam_max_sort_file_size", (long*) &myisam_max_sort_file_size, + (long) (LONG_MAX/(1024L*1024L)), 0, ~0L, 0, 1 }, { "net_buffer_length", (long*) &net_buffer_length, 16384, 1024, 1024*1024L, MALLOC_OVERHEAD, 1024 }, { "net_retry_count", (long*) &mysqld_net_retry_count, @@ -2818,6 +2828,9 @@ struct show_var_st init_vars[]= { {"max_tmp_tables", (char*) &max_tmp_tables, SHOW_LONG}, {"max_write_lock_count", (char*) &max_write_lock_count, SHOW_LONG}, {"myisam_recover_options", (char*) &myisam_recover_options_str, SHOW_CHAR_PTR}, + {"myisam_max_extra_sort_file_size", (char*) &myisam_max_extra_sort_file_size, + SHOW_LONG}, + {"myisam_max_sort_file_size",(char*) &myisam_max_sort_file_size, SHOW_LONG}, {"myisam_sort_buffer_size", (char*) &myisam_sort_buffer_size, SHOW_LONG}, {"net_buffer_length", (char*) &net_buffer_length, SHOW_LONG}, {"net_read_timeout", (char*) &net_read_timeout, SHOW_LONG}, @@ -2950,6 +2963,10 @@ static void usage(void) #ifndef DBUG_OFF printf("\ -#, --debug[=...] Debug log. Default is '%s'\n",default_dbug_option); +#ifdef SAFEMALLOC + puts("\ + --skip-safemalloc Don't use the memory allocation checking"); +#endif #endif puts("\ --default-character-set=charset\n\ @@ -3042,7 +3059,7 @@ static void usage(void) #ifdef HAVE_GEMINI_DB puts("\ --gemini-recovery=mode Set Crash Recovery operating mode\n\ - (FULL, NONE, FORCE - default FULL) + (FULL, NONE, FORCE - default FULL)\n\ --gemini-flush-log-at-commit\n\ Every commit forces a write to the reovery log\n\ --gemini-unbuffered-io Use unbuffered i/o\n\ @@ -3051,13 +3068,13 @@ static void usage(void) #endif #ifdef HAVE_INNOBASE_DB puts("\ - --innobase_data_home_dir=dir The common part for innobase table spaces\n - --innobase_data_file_path=dir Path to individual files and their sizes\n - --innobase_flush_log_at_trx_commit[=#] + --innobase_data_home_dir=dir The common part for innobase table spaces\n\ + --innobase_data_file_path=dir Path to individual files and their sizes\n\ + --innobase_flush_log_at_trx_commit[=#]\n\ Set to 0 if you don't want to flush logs\n\ --innobase_log_arch_dir=dir Where full logs should be archived\n\ --innobase_log_archive[=#] Set to 1 if you want to have logs archived\n\ - --innobase_log_group_home_dir=dir Path to Innobase log files. + --innobase_log_group_home_dir=dir Path to Innobase log files.\n\ --skip-innobase Don't use innobase (will save memory)\n\ "); #endif /* HAVE_INNOBASE_DB */ @@ -3677,10 +3694,14 @@ static void get_options(int argc,char **argv) case OPT_MASTER_CONNECT_RETRY: master_connect_retry= atoi(optarg); break; - case (int) OPT_SAFE_SHOW_DB: + case OPT_SAFE_SHOW_DB: opt_safe_show_db=1; break; - + case OPT_SKIP_SAFEMALLOC: +#ifdef SAFEMALLOC + sf_malloc_quick=1; +#endif + break; default: fprintf(stderr,"%s: Unrecognized option: %c\n",my_progname,c); use_help(); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 04ed72aec92..38dfcbdaa7a 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -111,7 +111,8 @@ static void check_unused(void) #define check_unused() #endif -int list_open_tables(THD *thd,List<char> *tables, const char *db,const char *wild) +int list_open_tables(THD *thd,List<char> *tables, const char *db, + const char *wild) { int result = 0; uint col_access=thd->col_access; @@ -940,24 +941,28 @@ bool reopen_table(TABLE *table,bool locked) goto end; } - tmp.key_length=table->key_length; - tmp.in_use=table->in_use; - tmp.used_keys=tmp.keys_in_use; - tmp.reginfo.lock_type=table->reginfo.lock_type; - tmp.version=refresh_version; - tmp.next=table->next; - tmp.prev=table->prev; - - /* This list copies varibles set by open_table */ + /* This list copies variables set by open_table */ tmp.tablenr= table->tablenr; - tmp.tmp_table= table->tmp_table; tmp.used_fields= table->used_fields; tmp.const_table= table->const_table; tmp.outer_join= table->outer_join; tmp.null_row= table->null_row; + tmp.maybe_null= table->maybe_null; tmp.status= table->status; + tmp.keys_in_use_for_query=tmp.used_keys=tmp.keys_in_use; + + /* Get state */ + tmp.key_length= table->key_length; + tmp.in_use= table->in_use; + tmp.reginfo.lock_type=table->reginfo.lock_type; + tmp.version= refresh_version; + tmp.tmp_table= table->tmp_table; tmp.grant= table->grant; + /* Replace table in open list */ + tmp.next=table->next; + tmp.prev=table->prev; + if (table->file) VOID(closefrm(table)); // close file, free everything diff --git a/support-files/my-huge.cnf.sh b/support-files/my-huge.cnf.sh index a9d1dd4ccae..9baee043b15 100644 --- a/support-files/my-huge.cnf.sh +++ b/support-files/my-huge.cnf.sh @@ -47,9 +47,9 @@ server-id = 1 #set-variable = bdb_max_lock=100000 # Uncomment the following if you are using Innobase tables -#innobase_data_home_dir = @datadir@ -#innobase_log_group_home_dir = @datadir@ -#innobase_log_arch_dir = @datadir@ +#innobase_data_home_dir = @localstatedir@/ +#innobase_log_group_home_dir = @localstatedir@/ +#innobase_log_arch_dir = @localstatedir@/ #innobase_data_file_path = ibdata1:25M;ibdata2:37M;ibdata3:100M;ibdata4:300M #set-variable = innobase_mirrored_log_groups=1 #set-variable = innobase_log_files_in_group=3 diff --git a/support-files/my-large.cnf.sh b/support-files/my-large.cnf.sh index 59ca0f88bfb..e02e07d2a09 100644 --- a/support-files/my-large.cnf.sh +++ b/support-files/my-large.cnf.sh @@ -43,9 +43,9 @@ server-id = 1 #set-variable = bdb_max_lock=100000 # Uncomment the following if you are using Innobase tables -#innobase_data_home_dir = @datadir@ -#innobase_log_group_home_dir = @datadir@ -#innobase_log_arch_dir = @datadir@ +#innobase_data_home_dir = @localstatedir@/ +#innobase_log_group_home_dir = @localstatedir@/ +#innobase_log_arch_dir = @localstatedir@/ #innobase_data_file_path = ibdata1:25M;ibdata2:37M;ibdata3:100M;ibdata4:300M #set-variable = innobase_mirrored_log_groups=1 #set-variable = innobase_log_files_in_group=3 diff --git a/support-files/my-medium.cnf.sh b/support-files/my-medium.cnf.sh index 20edef7a87d..4f5cdc135d2 100644 --- a/support-files/my-medium.cnf.sh +++ b/support-files/my-medium.cnf.sh @@ -45,9 +45,9 @@ server-id = 1 #set-variable = bdb_max_lock=10000 # Uncomment the following if you are using Innobase tables -#innobase_data_home_dir = @datadir@ -#innobase_log_group_home_dir = @datadir@ -#innobase_log_arch_dir = @datadir@ +#innobase_data_home_dir = @localstatedir@/ +#innobase_log_group_home_dir = @localstatedir@/ +#innobase_log_arch_dir = @localstatedir@/ #innobase_data_file_path = ibdata1:25M;ibdata2:37M;ibdata3:100M;ibdata4:300M #set-variable = innobase_mirrored_log_groups=1 #set-variable = innobase_log_files_in_group=3 diff --git a/support-files/my-small.cnf.sh b/support-files/my-small.cnf.sh index 72684190652..6472d10155f 100644 --- a/support-files/my-small.cnf.sh +++ b/support-files/my-small.cnf.sh @@ -42,9 +42,9 @@ server-id = 1 #skip-bdb # Uncomment the following if you are using Innobase tables -#innobase_data_home_dir = @datadir@ -#innobase_log_group_home_dir = @datadir@ -#innobase_log_arch_dir = @datadir@ +#innobase_data_home_dir = @localstatedir@/ +#innobase_log_group_home_dir = @localstatedir@/ +#innobase_log_arch_dir = @localstatedir@/ #innobase_data_file_path = ibdata1:25M;ibdata2:37M;ibdata3:100M;ibdata4:300M #set-variable = innobase_mirrored_log_groups=1 #set-variable = innobase_log_files_in_group=3 diff --git a/tests/fork_big.pl b/tests/fork_big.pl index 1644fdc5fab..74941823c17 100755 --- a/tests/fork_big.pl +++ b/tests/fork_big.pl @@ -4,7 +4,7 @@ # # Tested a lot with: --threads=30 -$opt_loop_count=200000; # Change this to make test harder/easier +$opt_loop_count=500000; # Change this to make test harder/easier ##################### Standard benchmark inits ############################## @@ -308,7 +308,7 @@ sub test_check $type= "check"; for ($i=$j=0 ; !test_if_abort($dbh) ; $i++) { - sleep(60); + sleep(1000); $table=$testtables[$j]->[0]; $sth=$dbh->prepare("$type table $table") || die "Got error on prepare: $DBI::errstr\n"; $sth->execute || die $DBI::errstr; @@ -346,7 +346,7 @@ sub test_repair $type= "repair"; for ($i=0 ; !test_if_abort($dbh) ; $i++) { - sleep(95); + sleep(2000); $table=$testtables[0]->[0]; $sth=$dbh->prepare("$type table $table") || die "Got error on prepare: $DBI::errstr\n"; $sth->execute || die $DBI::errstr; @@ -382,7 +382,7 @@ sub test_flush $count=0; while (!test_if_abort($dbh)) { - sleep(60); + sleep(3000); $dbh->do("flush tables $tables") || die "Got error on flush $DBI::errstr\n"; $count++; |