diff options
25 files changed, 596 insertions, 35 deletions
diff --git a/BUILD/compile-pentium-valgrind-max b/BUILD/compile-pentium-valgrind-max new file mode 100755 index 00000000000..016b698a970 --- /dev/null +++ b/BUILD/compile-pentium-valgrind-max @@ -0,0 +1,13 @@ +#! /bin/sh + +path=`dirname $0` +. "$path/SETUP.sh" + +extra_flags="$pentium_cflags $debug_cflags -DHAVE_purify" +c_warnings="$c_warnings $debug_extra_warnings" +cxx_warnings="$cxx_warnings $debug_extra_warnings" +extra_configs="$pentium_configs $debug_configs" + +extra_configs="$extra_configs --with-berkeley-db --with-innodb --with-embedded-server --with-openssl" + +. "$path/FINISH.sh" diff --git a/Docs/manual.texi b/Docs/manual.texi index 87933ddff06..bdd12993b62 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -50815,6 +50815,8 @@ each individual 4.0.x release. @appendixsubsec Changes in release 4.0.5 @itemize @item +Read @code{--des-key-file} relative to database directory. +@item Small code improvement in multi-table updates @item Fixed a newly introduced bug that caused @code{ORDER BY ... LIMIT #} diff --git a/acinclude.m4 b/acinclude.m4 index b91c6905538..99f6f26bab6 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1186,5 +1186,142 @@ dnl --------------------------------------------------------------------------- dnl END OF MYSQL_CHECK_INNODB SECTION dnl --------------------------------------------------------------------------- +dnl By default, many hosts won't let programs access large files; +dnl one must use special compiler options to get large-file access to work. +dnl For more details about this brain damage please see: +dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html + +dnl Written by Paul Eggert <eggert@twinsun.com>. + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME) +AC_DEFUN(AC_SYS_LARGEFILE_FLAGS, + [AC_CACHE_CHECK([for $1 value to request large file support], + ac_cv_sys_largefile_$1, + [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2 + then + ac_cv_sys_largefile_$1=`cat conftest.1` + else + ac_cv_sys_largefile_$1=no + ifelse($1, CFLAGS, + [case "$host_os" in + # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1. +changequote(, )dnl + hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) +changequote([, ])dnl + if test "$GCC" = yes; then + ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ + fi + ;; + # IRIX 6.2 and later require cc -n32. +changequote(, )dnl + irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*) +changequote([, ])dnl + if test "$GCC" != yes; then + ac_cv_sys_largefile_CFLAGS=-n32 + fi + esac + if test "$ac_cv_sys_largefile_CFLAGS" != no; then + ac_save_CC="$CC" + CC="$CC $ac_cv_sys_largefile_CFLAGS" + AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no) + CC="$ac_save_CC" + fi]) + fi + rm -f conftest*])]) + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL) +AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND, + [case $2 in + no) ;; + ?*) + case "[$]$1" in + '') $1=$2 ;; + *) $1=[$]$1' '$2 ;; + esac ;; + esac]) + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT) +AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE, + [AC_CACHE_CHECK([for $1], $2, + [$2=no +changequote(, )dnl + for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do + case "$ac_flag" in + -D$1) + $2=1 ;; + -D$1=*) + $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;; + esac + done + $4 +changequote([, ])dnl + ]) + if test "[$]$2" != no; then + AC_DEFINE_UNQUOTED([$1], [$]$2, [$3]) + fi]) + +AC_DEFUN(MYSQL_SYS_LARGEFILE, + [AC_REQUIRE([AC_CANONICAL_HOST]) + AC_ARG_ENABLE(largefile, + [ --disable-largefile Omit support for large files]) + if test "$enable_largefile" != no; then + AC_CHECK_TOOL(GETCONF, getconf) + AC_SYS_LARGEFILE_FLAGS(CFLAGS) + AC_SYS_LARGEFILE_FLAGS(LDFLAGS) + AC_SYS_LARGEFILE_FLAGS(LIBS) + + for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do + case "$ac_flag" in + no) ;; + -D_FILE_OFFSET_BITS=*) ;; + -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;; + -D_LARGE_FILES | -D_LARGE_FILES=*) ;; + -D?* | -I?*) + AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;; + *) + AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;; + esac + done + AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS") + AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS") + + AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, + ac_cv_sys_file_offset_bits, + [Number of bits in a file offset, on hosts where this is settable.], + [case "$host_os" in + # HP-UX 10.20 and later + hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) + ac_cv_sys_file_offset_bits=64 ;; + # We can't declare _FILE_OFFSET_BITS here as this will cause + # compile errors as AC_PROG_CC adds include files in confdefs.h + # We solve this (until autoconf is fixed) by instead declaring it + # as define instead + solaris2.[8,9]) + CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64" + CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=64" + ac_cv_sys_file_offset_bits=no ;; + esac]) + AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, + ac_cv_sys_largefile_source, + [Define to make fseeko etc. visible, on some hosts.], + [case "$host_os" in + # HP-UX 10.20 and later + hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) + ac_cv_sys_largefile_source=1 ;; + esac]) + AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, + ac_cv_sys_large_files, + [Define for large files, on AIX-style hosts.], + [case "$host_os" in + # AIX 4.2 and later + aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*) + ac_cv_sys_large_files=1 ;; + esac]) + fi + ]) + dnl --------------------------------------------------------------------------- diff --git a/configure.in b/configure.in index 093b5aa8344..15adb09191e 100644 --- a/configure.in +++ b/configure.in @@ -671,7 +671,7 @@ else AC_MSG_RESULT([no]) fi -AC_SYS_LARGEFILE +MYSQL_SYS_LARGEFILE # Types that must be checked AFTER large file support is checked AC_TYPE_SIZE_T diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index f50223c789f..94f30e5061b 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -507,13 +507,13 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups) exit(1); } opt_noacl = 1; // No permissions - if (acl_init(opt_noacl)) + if (acl_init((THD*) 0,opt_noacl)) { mysql_server_end(); return 1; } if (!opt_noacl) - (void) grant_init(); + (void) grant_init((THD*) 0); init_max_user_conn(); init_update_queries(); diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 8b5ec5191b0..50e0c8c34f4 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -56,6 +56,7 @@ sleep_until_file_deleted () sleep $SLEEP_TIME_AFTER_RESTART return fi + sleep 1 loop=`expr $loop - 1` done } @@ -309,6 +310,17 @@ while test $# -gt 0; do DO_DDD=1 USE_RUNNING_SERVER="" ;; + --valgrind) + VALGRIND="valgrind --alignment=8 --leak-check=yes" + EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc" + EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc" + SLEEP_TIME_AFTER_RESTART=120 + SLEEP_TIME_FOR_DELETE=120 + ;; + --valgrind-options=*) + TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"` + VALGRIND="$VALGRIND $TMP" + ;; --skip-*) EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $1" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $1" @@ -377,7 +389,7 @@ DASH72=`$ECHO '----------------------------------------------------------------- # on source dist, we pick up freshly build executables # on binary, use what is installed if [ x$SOURCE_DIST = x1 ] ; then - MYSQLD="$BASEDIR/sql/mysqld" + MYSQLD="$VALGRIND $BASEDIR/sql/mysqld" if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest" elif [ -f "$BASEDIR/client/.libs/mysqltest" ] ; then @@ -400,9 +412,9 @@ if [ x$SOURCE_DIST = x1 ] ; then else if test -x "$BASEDIR/libexec/mysqld" then - MYSQLD="$BASEDIR/libexec/mysqld" + MYSQLD="$VALGRIND $BASEDIR/libexec/mysqld" else - MYSQLD="$BASEDIR/bin/mysqld" + MYSQLD="$VALGRIND $BASEDIR/bin/mysqld" fi MYSQL_TEST="$BASEDIR/bin/mysqltest" MYSQLADMIN="$BASEDIR/bin/mysqladmin" @@ -701,7 +713,7 @@ manager_launch() ident=$1 shift if [ $USE_MANAGER = 0 ] ; then - $@ >$CUR_MYERR 2>&1 & + $@ >> $CUR_MYERR 2>&1 & sleep 2 #hack return fi @@ -1047,6 +1059,8 @@ run_testcase () slave_init_script=$TESTDIR/$tname-slave.sh slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt echo $tname > $CURRENT_TEST + echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR + echo "CURRENT_TEST: $tname" >> $MASTER_MYERR SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0` if [ $USE_MANAGER = 1 ] ; then many_slaves=`$EXPR \( $tname : rpl_failsafe \) != 0` diff --git a/mysys/Makefile.am b/mysys/Makefile.am index c59d15d59f5..98f9e13c778 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -100,7 +100,7 @@ test_io_cache: mf_iocache.c $(LIBRARIES) test_dir: test_dir.c $(LIBRARIES) $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_dir.c $(LDADD) $(LIBS) -test_charset$(EXEEXT): test_charset.c $(LIBRARIES) +test_charset: test_charset.c $(LIBRARIES) $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS) testhash: testhash.c $(LIBRARIES) diff --git a/sql-bench/Results/ATIS-mysql-Linux_2.4.4_SMP_alpha b/sql-bench/Results/ATIS-mysql-Linux_2.4.4_SMP_alpha new file mode 100644 index 00000000000..e0192d49a3d --- /dev/null +++ b/sql-bench/Results/ATIS-mysql-Linux_2.4.4_SMP_alpha @@ -0,0 +1,20 @@ +Testing server 'MySQL 4.0.5 beta' at 2002-10-23 12:35:44 + +ATIS table test + +Creating tables +Time for create_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Inserting data +Time to insert (9768): 3 wallclock secs ( 0.52 usr 0.31 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Retrieving data +Time for select_simple_join (500): 1 wallclock secs ( 0.60 usr 0.29 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_join (100): 2 wallclock secs ( 0.44 usr 0.27 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_key_prefix_join (100): 10 wallclock secs ( 3.58 usr 2.30 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_distinct (800): 10 wallclock secs ( 1.60 usr 0.81 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_group (2800): 11 wallclock secs ( 1.44 usr 0.52 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Removing tables +Time to drop_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Total time: 37 wallclock secs ( 8.20 usr 4.50 sys + 0.00 cusr 0.00 csys = 0.00 CPU) diff --git a/sql-bench/Results/RUN-mysql-Linux_2.4.4_SMP_alpha b/sql-bench/Results/RUN-mysql-Linux_2.4.4_SMP_alpha new file mode 100644 index 00000000000..ba144b8d226 --- /dev/null +++ b/sql-bench/Results/RUN-mysql-Linux_2.4.4_SMP_alpha @@ -0,0 +1,109 @@ +Benchmark DBD suite: 2.14 +Date of test: 2002-10-23 12:35:44 +Running tests on: Linux 2.4.4-SMP alpha +Arguments: +Comments: Alpha DS20 2x500 MHz, 2G memory, key_buffer=16M, query_cache=16M; cxx 6.3 + ccc 6.2.9 +Limits from: +Server version: MySQL 4.0.5 beta +Optimization: None +Hardware: + +ATIS: Total time: 37 wallclock secs ( 8.20 usr 4.50 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +alter-table: Total time: 277 wallclock secs ( 0.33 usr 0.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +big-tables: Total time: 39 wallclock secs ( 8.71 usr 8.56 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +connect: Total time: 209 wallclock secs (62.48 usr 49.95 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +create: Total time: 288 wallclock secs (10.88 usr 3.48 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +insert: Total time: 2381 wallclock secs (693.26 usr 241.11 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +select: Total time: 1298 wallclock secs (66.92 usr 20.96 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +transactions: Test skipped because the database doesn't support transactions +wisconsin: Total time: 17 wallclock secs ( 3.66 usr 2.13 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +All 9 test executed successfully + +Totals per operation: +Operation seconds usr sys cpu tests +alter_table_add 154.00 0.18 0.06 0.00 992 +alter_table_drop 116.00 0.07 0.03 0.00 496 +connect 14.00 8.17 2.02 0.00 10000 +connect+select_1_row 17.00 8.80 2.79 0.00 10000 +connect+select_simple 16.00 8.86 2.57 0.00 10000 +count 50.00 0.04 0.00 0.00 100 +count_distinct 32.00 0.44 0.07 0.00 1000 +count_distinct_2 32.00 0.44 0.08 0.00 1000 +count_distinct_big 54.00 7.37 4.25 0.00 120 +count_distinct_group 50.00 1.14 0.52 0.00 1000 +count_distinct_group_on_key 38.00 0.48 0.12 0.00 1000 +count_distinct_group_on_key_parts 50.00 1.15 0.47 0.00 1000 +count_distinct_key_prefix 28.00 0.44 0.09 0.00 1000 +count_group_on_key_parts 37.00 1.02 0.48 0.00 1000 +count_on_key 453.00 16.74 3.59 0.00 50100 +create+drop 15.00 2.92 0.95 0.00 10000 +create_MANY_tables 238.00 1.84 0.51 0.00 10000 +create_index 4.00 0.00 0.00 0.00 8 +create_key+drop 19.00 4.55 0.94 0.00 10000 +create_table 0.00 0.00 0.00 0.00 31 +delete_all_many_keys 47.00 0.02 0.01 0.00 1 +delete_big 0.00 0.00 0.00 0.00 1 +delete_big_many_keys 47.00 0.02 0.01 0.00 128 +delete_key 4.00 0.88 0.55 0.00 10000 +delete_range 9.00 0.00 0.00 0.00 12 +drop_index 3.00 0.00 0.00 0.00 8 +drop_table 0.00 0.00 0.00 0.00 28 +drop_table_when_MANY_tables 10.00 0.67 0.44 0.00 10000 +insert 134.00 28.43 15.57 0.00 350768 +insert_duplicates 30.00 4.71 5.50 0.00 100000 +insert_key 98.00 13.49 3.80 0.00 100000 +insert_many_fields 14.00 0.32 0.11 0.00 2000 +insert_select_1_key 6.00 0.00 0.00 0.00 1 +insert_select_2_keys 8.00 0.00 0.00 0.00 1 +min_max 23.00 0.02 0.00 0.00 60 +min_max_on_key 188.00 27.44 5.93 0.00 85000 +multiple_value_insert 7.00 1.88 0.05 0.00 100000 +order_by_big 40.00 17.31 12.40 0.00 10 +order_by_big_key 31.00 18.84 12.61 0.00 10 +order_by_big_key2 30.00 17.35 12.38 0.00 10 +order_by_big_key_desc 32.00 19.23 12.70 0.00 10 +order_by_big_key_diff 36.00 17.33 12.44 0.00 10 +order_by_big_key_prefix 30.00 17.36 12.49 0.00 10 +order_by_key2_diff 5.00 1.67 1.04 0.00 500 +order_by_key_prefix 2.00 0.92 0.56 0.00 500 +order_by_range 5.00 0.97 0.55 0.00 500 +outer_join 67.00 0.00 0.00 0.00 10 +outer_join_found 63.00 0.01 0.00 0.00 10 +outer_join_not_found 40.00 0.01 0.00 0.00 500 +outer_join_on_key 40.00 0.01 0.00 0.00 10 +select_1_row 27.00 5.70 6.78 0.00 100000 +select_1_row_cache 22.00 3.16 5.87 0.00 100000 +select_2_rows 30.00 5.96 7.15 0.00 100000 +select_big 31.00 18.08 12.50 0.00 80 +select_big_str 20.00 8.04 6.08 0.00 10000 +select_cache 89.00 3.03 0.74 0.00 10000 +select_cache2 91.00 3.53 0.76 0.00 10000 +select_column+column 30.00 5.07 5.64 0.00 100000 +select_diff_key 163.00 0.27 0.04 0.00 500 +select_distinct 10.00 1.60 0.81 0.00 800 +select_group 106.00 1.49 0.53 0.00 2911 +select_group_when_MANY_tables 6.00 0.90 0.65 0.00 10000 +select_join 2.00 0.44 0.27 0.00 100 +select_key 142.00 77.87 17.06 0.00 200000 +select_key2 142.00 74.50 19.30 0.00 200000 +select_key2_return_key 133.00 73.16 13.81 0.00 200000 +select_key2_return_prim 132.00 70.56 13.25 0.00 200000 +select_key_prefix 141.00 73.88 18.25 0.00 200000 +select_key_prefix_join 10.00 3.58 2.30 0.00 100 +select_key_return_key 146.00 82.66 16.24 0.00 200000 +select_many_fields 25.00 8.38 8.45 0.00 2000 +select_range 242.00 8.57 4.60 0.00 410 +select_range_key2 19.00 6.12 1.72 0.00 25010 +select_range_prefix 18.00 6.28 1.70 0.00 25010 +select_simple 18.00 5.08 5.46 0.00 100000 +select_simple_cache 15.00 3.64 5.58 0.00 100000 +select_simple_join 1.00 0.60 0.29 0.00 500 +update_big 22.00 0.00 0.00 0.00 10 +update_of_key 25.00 4.24 1.90 0.00 50000 +update_of_key_big 18.00 0.04 0.03 0.00 501 +update_of_primary_key_many_keys 20.00 0.03 0.01 0.00 256 +update_with_key 116.00 21.90 14.15 0.00 300000 +update_with_key_prefix 36.00 11.11 4.60 0.00 100000 +wisc_benchmark 4.00 1.66 0.73 0.00 114 +TOTALS 4518.00 844.67 325.93 0.00 3227247 diff --git a/sql-bench/Results/alter-table-mysql-Linux_2.4.4_SMP_alpha b/sql-bench/Results/alter-table-mysql-Linux_2.4.4_SMP_alpha new file mode 100644 index 00000000000..1d58effc1a5 --- /dev/null +++ b/sql-bench/Results/alter-table-mysql-Linux_2.4.4_SMP_alpha @@ -0,0 +1,16 @@ +Testing server 'MySQL 4.0.5 beta' at 2002-10-23 12:36:21 + +Testing of ALTER TABLE +Testing with 1000 columns and 1000 rows in 20 steps +Insert data into the table +Time for insert (1000) 0 wallclock secs ( 0.06 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Time for alter_table_add (992): 154 wallclock secs ( 0.18 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Time for create_index (8): 4 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Time for drop_index (8): 3 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Time for alter_table_drop (496): 116 wallclock secs ( 0.07 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Total time: 277 wallclock secs ( 0.33 usr 0.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU) diff --git a/sql-bench/Results/big-tables-mysql-Linux_2.4.4_SMP_alpha b/sql-bench/Results/big-tables-mysql-Linux_2.4.4_SMP_alpha new file mode 100644 index 00000000000..97f66029696 --- /dev/null +++ b/sql-bench/Results/big-tables-mysql-Linux_2.4.4_SMP_alpha @@ -0,0 +1,19 @@ +Testing server 'MySQL 4.0.5 beta' at 2002-10-23 12:40:58 + +Testing of some unusual tables +All tests are done 1000 times with 1000 fields + +Testing table with 1000 fields +Testing select * from table with 1 record +Time to select_many_fields(1000): 11 wallclock secs ( 4.59 usr 4.21 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing select all_fields from table with 1 record +Time to select_many_fields(1000): 14 wallclock secs ( 3.79 usr 4.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing insert VALUES() +Time to insert_many_fields(1000): 5 wallclock secs ( 0.29 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing insert (all_fields) VALUES() +Time to insert_many_fields(1000): 9 wallclock secs ( 0.03 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Total time: 39 wallclock secs ( 8.71 usr 8.56 sys + 0.00 cusr 0.00 csys = 0.00 CPU) diff --git a/sql-bench/Results/connect-mysql-Linux_2.4.4_SMP_alpha b/sql-bench/Results/connect-mysql-Linux_2.4.4_SMP_alpha new file mode 100644 index 00000000000..a787d311a54 --- /dev/null +++ b/sql-bench/Results/connect-mysql-Linux_2.4.4_SMP_alpha @@ -0,0 +1,35 @@ +Testing server 'MySQL 4.0.5 beta' at 2002-10-23 12:41:37 + +Testing the speed of connecting to the server and sending of data +Connect tests are done 10000 times and other tests 100000 times + +Testing connection/disconnect +Time to connect (10000): 14 wallclock secs ( 8.17 usr 2.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Test connect/simple select/disconnect +Time for connect+select_simple (10000): 16 wallclock secs ( 8.86 usr 2.57 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Test simple select +Time for select_simple (100000): 18 wallclock secs ( 5.08 usr 5.46 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Test simple select +Time for select_simple_cache (100000): 15 wallclock secs ( 3.64 usr 5.58 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing connect/select 1 row from table/disconnect +Time to connect+select_1_row (10000): 17 wallclock secs ( 8.80 usr 2.79 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing select 1 row from table +Time to select_1_row (100000): 27 wallclock secs ( 5.70 usr 6.78 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Time to select_1_row_cache (100000): 22 wallclock secs ( 3.16 usr 5.87 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing select 2 rows from table +Time to select_2_rows (100000): 30 wallclock secs ( 5.96 usr 7.15 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Test select with aritmetic (+) +Time for select_column+column (100000): 30 wallclock secs ( 5.07 usr 5.64 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing retrieval of big records (65000 bytes) +Time to select_big_str (10000): 20 wallclock secs ( 8.04 usr 6.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Total time: 209 wallclock secs (62.48 usr 49.95 sys + 0.00 cusr 0.00 csys = 0.00 CPU) diff --git a/sql-bench/Results/create-mysql-Linux_2.4.4_SMP_alpha b/sql-bench/Results/create-mysql-Linux_2.4.4_SMP_alpha new file mode 100644 index 00000000000..c6b2eaf9f23 --- /dev/null +++ b/sql-bench/Results/create-mysql-Linux_2.4.4_SMP_alpha @@ -0,0 +1,18 @@ +Testing server 'MySQL 4.0.5 beta' at 2002-10-23 12:45:06 + +Testing the speed of creating and droping tables +Testing with 10000 tables and 10000 loop count + +Testing create of tables +Time for create_MANY_tables (10000): 238 wallclock secs ( 1.84 usr 0.51 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Accessing tables +Time to select_group_when_MANY_tables (10000): 6 wallclock secs ( 0.90 usr 0.65 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing drop +Time for drop_table_when_MANY_tables (10000): 10 wallclock secs ( 0.67 usr 0.44 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing create+drop +Time for create+drop (10000): 15 wallclock secs ( 2.92 usr 0.95 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for create_key+drop (10000): 19 wallclock secs ( 4.55 usr 0.94 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Total time: 288 wallclock secs (10.88 usr 3.48 sys + 0.00 cusr 0.00 csys = 0.00 CPU) diff --git a/sql-bench/Results/insert-mysql-Linux_2.4.4_SMP_alpha b/sql-bench/Results/insert-mysql-Linux_2.4.4_SMP_alpha new file mode 100644 index 00000000000..0cdf5cbede8 --- /dev/null +++ b/sql-bench/Results/insert-mysql-Linux_2.4.4_SMP_alpha @@ -0,0 +1,106 @@ +Testing server 'MySQL 4.0.5 beta' at 2002-10-23 12:49:54 + +Testing the speed of inserting data into 1 table and do some selects on it. +The tests are done with a table that has 100000 rows. + +Generating random keys +Creating tables +Inserting 100000 rows in order +Inserting 100000 rows in reverse order +Inserting 100000 rows in random order +Time for insert (300000): 114 wallclock secs (25.11 usr 13.48 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing insert of duplicates +Time for insert_duplicates (100000): 30 wallclock secs ( 4.71 usr 5.50 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Retrieving data from the table +Time for select_big (10:3000000): 31 wallclock secs (17.94 usr 12.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for order_by_big_key (10:3000000): 31 wallclock secs (18.84 usr 12.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for order_by_big_key_desc (10:3000000): 32 wallclock secs (19.23 usr 12.70 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for order_by_big_key_prefix (10:3000000): 30 wallclock secs (17.36 usr 12.49 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for order_by_big_key2 (10:3000000): 30 wallclock secs (17.35 usr 12.38 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for order_by_big_key_diff (10:3000000): 36 wallclock secs (17.33 usr 12.44 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for order_by_big (10:3000000): 40 wallclock secs (17.31 usr 12.40 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for order_by_range (500:125750): 5 wallclock secs ( 0.97 usr 0.55 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for order_by_key_prefix (500:125750): 2 wallclock secs ( 0.92 usr 0.56 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for order_by_key2_diff (500:250500): 5 wallclock secs ( 1.67 usr 1.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_diff_key (500:1000): 163 wallclock secs ( 0.27 usr 0.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_range_prefix (5010:42084): 10 wallclock secs ( 2.63 usr 0.75 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_range_key2 (5010:42084): 10 wallclock secs ( 2.64 usr 0.76 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_key_prefix (200000): 141 wallclock secs (73.88 usr 18.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_key (200000): 142 wallclock secs (77.87 usr 17.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_key_return_key (200000): 146 wallclock secs (82.66 usr 16.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_key2 (200000): 142 wallclock secs (74.50 usr 19.30 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_key2_return_key (200000): 133 wallclock secs (73.16 usr 13.81 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_key2_return_prim (200000): 132 wallclock secs (70.56 usr 13.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Test of compares with simple ranges +Time for select_range_prefix (20000:43500): 8 wallclock secs ( 3.65 usr 0.95 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_range_key2 (20000:43500): 9 wallclock secs ( 3.48 usr 0.96 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_group (111): 95 wallclock secs ( 0.05 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for min_max_on_key (15000): 10 wallclock secs ( 5.77 usr 1.18 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for min_max (60): 23 wallclock secs ( 0.02 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for count_on_key (100): 41 wallclock secs ( 0.04 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for count (100): 50 wallclock secs ( 0.04 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for count_distinct_big (20): 39 wallclock secs ( 0.01 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing update of keys with functions +Time for update_of_key (50000): 25 wallclock secs ( 4.24 usr 1.90 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for update_of_key_big (501): 18 wallclock secs ( 0.04 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing update with key +Time for update_with_key (300000): 116 wallclock secs (21.90 usr 14.15 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for update_with_key_prefix (100000): 36 wallclock secs (11.11 usr 4.60 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing update of all rows +Time for update_big (10): 22 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing left outer join +Time for outer_join_on_key (10:10): 40 wallclock secs ( 0.01 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for outer_join (10:10): 67 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for outer_join_found (10:10): 63 wallclock secs ( 0.01 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for outer_join_not_found (500:10): 40 wallclock secs ( 0.01 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing SELECT ... WHERE id in (10 values) +Time for select_in (500:5000) 0 wallclock secs ( 0.22 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Time for select_join_in (500:5000) 1 wallclock secs ( 0.23 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing SELECT ... WHERE id in (100 values) +Time for select_in (500:50000) 4 wallclock secs ( 0.56 usr 0.26 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Time for select_join_in (500:50000) 2 wallclock secs ( 0.57 usr 0.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing SELECT ... WHERE id in (1000 values) +Time for select_in (500:500000) 32 wallclock secs ( 3.96 usr 2.13 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Time for select_join_in (500:500000) 17 wallclock secs ( 4.02 usr 2.07 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + + +Testing INSERT INTO ... SELECT +Time for insert_select_1_key (1): 6 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for insert_select_2_keys (1): 8 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for drop table(2): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing delete +Time for delete_key (10000): 4 wallclock secs ( 0.88 usr 0.55 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for delete_range (12): 9 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Insert into table with 16 keys and with a primary key with 16 parts +Time for insert_key (100000): 98 wallclock secs (13.49 usr 3.80 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing update of keys +Time for update_of_primary_key_many_keys (256): 20 wallclock secs ( 0.03 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Deleting rows from the table +Time for delete_big_many_keys (128): 47 wallclock secs ( 0.02 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Deleting everything from table +Time for delete_all_many_keys (1): 47 wallclock secs ( 0.02 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Inserting 100000 rows with multiple values +Time for multiple_value_insert (100000): 7 wallclock secs ( 1.88 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Time for drop table(1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Total time: 2381 wallclock secs (693.26 usr 241.11 sys + 0.00 cusr 0.00 csys = 0.00 CPU) diff --git a/sql-bench/Results/select-mysql-Linux_2.4.4_SMP_alpha b/sql-bench/Results/select-mysql-Linux_2.4.4_SMP_alpha new file mode 100644 index 00000000000..939f130f92e --- /dev/null +++ b/sql-bench/Results/select-mysql-Linux_2.4.4_SMP_alpha @@ -0,0 +1,30 @@ +Testing server 'MySQL 4.0.5 beta' at 2002-10-23 13:29:36 + +Testing the speed of selecting on keys that consist of many parts +The test-table has 10000 rows and the test is done with 500 ranges. + +Creating table +Inserting 10000 rows +Time to insert (10000): 4 wallclock secs ( 0.81 usr 0.38 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Test if the database has a query cache +Time for select_cache (10000): 89 wallclock secs ( 3.03 usr 0.74 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Time for select_cache2 (10000): 91 wallclock secs ( 3.53 usr 0.76 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Testing big selects on the table +Time for select_big (70:17207): 0 wallclock secs ( 0.14 usr 0.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for select_range (410:1057904): 242 wallclock secs ( 8.57 usr 4.60 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for min_max_on_key (70000): 178 wallclock secs (21.67 usr 4.75 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for count_on_key (50000): 412 wallclock secs (16.70 usr 3.58 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Time for count_group_on_key_parts (1000:100000): 37 wallclock secs ( 1.02 usr 0.48 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Testing count(distinct) on the table +Time for count_distinct_key_prefix (1000:1000): 28 wallclock secs ( 0.44 usr 0.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for count_distinct (1000:1000): 32 wallclock secs ( 0.44 usr 0.07 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for count_distinct_2 (1000:1000): 32 wallclock secs ( 0.44 usr 0.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for count_distinct_group_on_key (1000:6000): 38 wallclock secs ( 0.48 usr 0.12 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for count_distinct_group_on_key_parts (1000:100000): 50 wallclock secs ( 1.15 usr 0.47 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for count_distinct_group (1000:100000): 50 wallclock secs ( 1.14 usr 0.52 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time for count_distinct_big (100:1000000): 15 wallclock secs ( 7.36 usr 4.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Total time: 1298 wallclock secs (66.92 usr 20.96 sys + 0.00 cusr 0.00 csys = 0.00 CPU) diff --git a/sql-bench/Results/transactions-mysql-Linux_2.4.4_SMP_alpha b/sql-bench/Results/transactions-mysql-Linux_2.4.4_SMP_alpha new file mode 100644 index 00000000000..47f81534c1e --- /dev/null +++ b/sql-bench/Results/transactions-mysql-Linux_2.4.4_SMP_alpha @@ -0,0 +1,3 @@ +Testing server 'MySQL 4.0.5 beta' at 2002-10-23 13:51:14 + +Test skipped because the database doesn't support transactions diff --git a/sql-bench/Results/wisconsin-mysql-Linux_2.4.4_SMP_alpha b/sql-bench/Results/wisconsin-mysql-Linux_2.4.4_SMP_alpha new file mode 100644 index 00000000000..445246a27c7 --- /dev/null +++ b/sql-bench/Results/wisconsin-mysql-Linux_2.4.4_SMP_alpha @@ -0,0 +1,14 @@ +Testing server 'MySQL 4.0.5 beta' at 2002-10-23 13:51:14 + +Wisconsin benchmark test + +Time for create_table (3): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Inserting data +Time to insert (31000): 13 wallclock secs ( 1.99 usr 1.40 sys + 0.00 cusr 0.00 csys = 0.00 CPU) +Time to delete_big (1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Running the actual benchmark +Time for wisc_benchmark (114): 4 wallclock secs ( 1.66 usr 0.73 sys + 0.00 cusr 0.00 csys = 0.00 CPU) + +Total time: 17 wallclock secs ( 3.66 usr 2.13 sys + 0.00 cusr 0.00 csys = 0.00 CPU) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f3aef7f1622..1bb1ff1de74 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -858,6 +858,9 @@ void clean_up(bool print_message) bitmap_free(&temp_pool); free_max_user_conn(); end_slave_list(); +#ifdef USE_REGEX + regex_end(); +#endif #if !defined(__WIN__) && !defined(EMBEDDED_LIBRARY) if (!opt_bootstrap) @@ -1894,8 +1897,6 @@ int main(int argc, char **argv) if (!ssl_acceptor_fd) opt_use_ssl = 0; } - if (des_key_file) - load_des_key_file(des_key_file); #endif /* HAVE_OPENSSL */ #ifdef HAVE_LIBWRAP @@ -1968,6 +1969,10 @@ int main(int argc, char **argv) reset_floating_point_exceptions(); init_thr_lock(); init_slave_list(); +#ifdef HAVE_OPENSSL + if (des_key_file) + load_des_key_file(des_key_file); +#endif /* HAVE_OPENSSL */ /* Setup log files */ if (opt_log) @@ -2032,7 +2037,7 @@ int main(int argc, char **argv) exit(1); } start_signal_handler(); // Creates pidfile - if (acl_init(opt_noacl)) + if (acl_init((THD*) 0, opt_noacl)) { abort_loop=1; select_thread_in_use=0; @@ -2044,7 +2049,7 @@ int main(int argc, char **argv) exit(1); } if (!opt_noacl) - (void) grant_init(); + (void) grant_init((THD*) 0); init_max_user_conn(); init_update_queries(); diff --git a/sql/slave.cc b/sql/slave.cc index 824191078fc..dc1464dcca1 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1450,7 +1450,7 @@ bool flush_master_info(MASTER_INFO* mi) DBUG_PRINT("enter",("master_pos: %ld", (long) mi->master_log_pos)); my_b_seek(file, 0L); - my_b_printf(file, "%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n", + my_b_printf(file, "%s\n%s\n%s\n%s\n%s\n%d\n%d\n", mi->master_log_name, llstr(mi->master_log_pos, lbuf), mi->host, mi->user, mi->password, mi->port, mi->connect_retry diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 867163be90d..3875e51a75a 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -119,6 +119,7 @@ static bool compare_hostname(const acl_host_and_ip *host, const char *hostname, SYNOPSIS acl_init() + thd Thread handler dont_read_acl_tables Set to 1 if run with --skip-grant RETURN VALUES @@ -127,9 +128,9 @@ static bool compare_hostname(const acl_host_and_ip *host, const char *hostname, */ -my_bool acl_init(bool dont_read_acl_tables) +my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) { - THD *thd, *org_thd; + THD *thd; TABLE_LIST tables[3]; TABLE *table; READ_RECORD read_record_info; @@ -147,7 +148,6 @@ my_bool acl_init(bool dont_read_acl_tables) /* To be able to run this from boot, we allocate a temporary THD */ - org_thd=current_thd; // Save for restore if (!(thd=new THD)) DBUG_RETURN(1); /* purecov: inspected */ thd->store_globals(); @@ -339,6 +339,11 @@ end: delete thd; if (org_thd) org_thd->store_globals(); /* purecov: inspected */ + else + { + /* Remember that we don't have a THD */ + my_pthread_setspecific_ptr(THR_THD, 0); + } DBUG_RETURN(return_val); } @@ -385,7 +390,7 @@ void acl_reload(THD *thd) delete_dynamic(&acl_wild_hosts); hash_free(&acl_check_hosts); - if (acl_init(0)) + if (acl_init(thd, 0)) { // Error. Revert to old list acl_free(); /* purecov: inspected */ acl_hosts=old_acl_hosts; @@ -2268,9 +2273,9 @@ void grant_free(void) /* Init grant array if possible */ -my_bool grant_init(void) +my_bool grant_init(THD *org_thd) { - THD *thd, *org_thd; + THD *thd; TABLE_LIST tables[2]; MYSQL_LOCK *lock; my_bool return_val= 1; @@ -2286,7 +2291,6 @@ my_bool grant_init(void) if (!initialized) DBUG_RETURN(0); /* purecov: tested */ - org_thd=current_thd; if (!(thd=new THD)) DBUG_RETURN(1); /* purecov: deadcode */ thd->store_globals(); @@ -2344,13 +2348,18 @@ end: delete thd; if (org_thd) org_thd->store_globals(); + else + { + /* Remember that we don't have a THD */ + my_pthread_setspecific_ptr(THR_THD, 0); + } DBUG_RETURN(return_val); } /* Reload grant array if possible */ -void grant_reload(void) +void grant_reload(THD *thd) { HASH old_hash_tables;bool old_grant_option; MEM_ROOT old_mem; @@ -2364,7 +2373,7 @@ void grant_reload(void) old_grant_option = grant_option; old_mem = memex; - if (grant_init()) + if (grant_init(thd)) { // Error. Revert to old hash grant_free(); /* purecov: deadcode */ hash_tables=old_hash_tables; /* purecov: deadcode */ diff --git a/sql/sql_acl.h b/sql/sql_acl.h index 326a55ddd0c..6925b6b406c 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -81,7 +81,7 @@ /* prototypes */ -my_bool acl_init(bool dont_read_acl_tables); +my_bool acl_init(THD *thd, bool dont_read_acl_tables); void acl_reload(THD *thd); void acl_free(bool end=0); ulong acl_get(const char *host, const char *ip, const char *bin_ip, @@ -98,9 +98,9 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list, int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list, List <LEX_COLUMN> &column_list, ulong rights, bool revoke); -my_bool grant_init(void); +my_bool grant_init(THD *thd); void grant_free(void); -void grant_reload(void); +void grant_reload(THD *thd); bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables, uint show_command=0, bool dont_print_error=0); bool check_grant_column (THD *thd,TABLE *table, const char *name, uint length, diff --git a/sql/sql_base.cc b/sql/sql_base.cc index d58bc64e975..fa967d645ef 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1513,11 +1513,13 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, TABLE *tmp_table; DBUG_ENTER("open_temporary_table"); - // the extra size in my_malloc() is for table_cache_key - // 4 bytes for master thread id if we are in the slave - // 1 byte to terminate db - // 1 byte to terminate table_name - // total of 6 extra bytes in my_malloc in addition to table/db stuff + /* + The extra size in my_malloc() is for table_cache_key + 4 bytes for master thread id if we are in the slave + 1 byte to terminate db + 1 byte to terminate table_name + total of 6 extra bytes in my_malloc in addition to table/db stuff + */ if (!(tmp_table=(TABLE*) my_malloc(sizeof(*tmp_table)+(uint) strlen(db)+ (uint) strlen(table_name)+6, MYF(MY_WME)))) @@ -1529,6 +1531,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, ha_open_options, tmp_table)) { + my_free((char*) tmp_table,MYF(0)); DBUG_RETURN(0); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 693de0dccb7..e0c3492458b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3350,7 +3350,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) if (options & REFRESH_GRANT) { acl_reload(thd); - grant_reload(); + grant_reload(thd); if (mqh_used) reset_mqh(thd,(LEX_USER *) NULL,true); } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index bca7b79c132..865b30cdb39 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1910,16 +1910,24 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, #ifdef HAVE_BERKELEY_DB if (old_db_type == DB_TYPE_BERKELEY_DB) { - (void) berkeley_flush_logs(); /* For the alter table to be properly flushed to the logs, we have to open the new table. If not, we get a problem on server shutdown. */ - if (!open_tables(thd, table_list)) // Should always succeed + char path[FN_REFLEN]; + (void) sprintf(path,"%s/%s/%s",mysql_data_home,new_db,table_name); + fn_format(path,path,"","",4); + table=open_temporary_table(thd, path, new_db, tmp_name,0); + if (table) { - close_thread_table(thd, &table_list->table); + intern_close_table(table); + my_free((char*) table, MYF(0)); } + else + sql_print_error("Warning: Could not open BDB table %s.%s after rename\n", + new_db,table_name); + (void) berkeley_flush_logs(); } #endif table_list->table=0; // For query cache diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 5367bc897b3..730b04e4863 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -667,7 +667,7 @@ change: { LEX *lex = Lex; lex->sql_command = SQLCOM_CHANGE_MASTER; - memset(&lex->mi, 0, sizeof(lex->mi)); + bzero((char*) &lex->mi, sizeof(lex->mi)); } master_defs; master_defs: |