From ec0f506a820a7ed2831877b5885a6d55c7debe7b Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Tue, 22 Jan 2002 15:59:32 +0000 Subject: Framework to simplify memory leak tracing --- include/hash.h | 5 +++-- include/my_sys.h | 14 ++++++++++++-- mysys/array.c | 8 ++++---- mysys/hash.c | 6 +++--- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/include/hash.h b/include/hash.h index c98b0851645..2f6a424fb3c 100644 --- a/include/hash.h +++ b/include/hash.h @@ -44,9 +44,10 @@ typedef struct st_hash { uint (*calc_hashnr)(const byte *key,uint length); } HASH; -my_bool hash_init(HASH *hash,uint default_array_elements, uint key_offset, +#define hash_init(A,B,C,D,E,F,G) _hash_init(A,B,C,D,E,F,G CALLER_INFO) +my_bool _hash_init(HASH *hash,uint default_array_elements, uint key_offset, uint key_length, hash_get_key get_key, - void (*free_element)(void*), uint flags); + void (*free_element)(void*), uint flags CALLER_INFO_PROTO); void hash_free(HASH *tree); byte *hash_element(HASH *hash,uint idx); gptr hash_search(HASH *info,const byte *key,uint length); diff --git a/include/my_sys.h b/include/my_sys.h index 5b45f6a91e5..ffb3ea83b49 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -115,6 +115,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #ifdef SAFEMALLOC #define my_malloc(SZ,FLAG) _mymalloc( SZ, __FILE__, __LINE__, FLAG ) +#define my_malloc_ci(SZ,FLAG) _mymalloc( SZ, sFile, uLine, FLAG ) #define my_realloc(PTR,SZ,FLAG) _myrealloc( PTR, SZ, __FILE__, __LINE__, FLAG ) #define my_checkmalloc() _sanity( __FILE__, __LINE__ ) #define my_free(PTR,FLAG) _myfree( PTR, __FILE__, __LINE__,FLAG) @@ -124,6 +125,9 @@ extern int NEAR my_errno; /* Last error in mysys */ #define NORMAL_SAFEMALLOC sf_malloc_quick=0 extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick; extern ulonglong safemalloc_mem_limit; +#define CALLER_INFO_PROTO , const char *sFile, uint uLine +#define CALLER_INFO , __FILE__, __LINE__ +#define ORIG_CALLER_INFO , sFile, uLine #else #define my_checkmalloc() (0) #undef TERMINATE @@ -131,11 +135,15 @@ extern ulonglong safemalloc_mem_limit; #define QUICK_SAFEMALLOC #define NORMAL_SAFEMALLOC extern gptr my_malloc(uint Size,myf MyFlags); +#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG ) extern gptr my_realloc(gptr oldpoint,uint Size,myf MyFlags); extern void my_no_flags_free(gptr ptr); extern gptr my_memdup(const byte *from,uint length,myf MyFlags); extern my_string my_strdup(const char *from,myf MyFlags); #define my_free(PTR,FG) my_no_flags_free(PTR) +#define CALLER_INFO_PROTO /* nothing */ +#define CALLER_INFO /* nothing */ +#define ORIG_CALLER_INFO /* nothing */ #endif #ifdef HAVE_ALLOCA #define my_alloca(SZ) alloca((size_t) (SZ)) @@ -541,8 +549,10 @@ extern my_bool real_open_cached_file(IO_CACHE *cache); extern void close_cached_file(IO_CACHE *cache); File create_temp_file(char *to, const char *dir, const char *pfx, int mode, myf MyFlags); -extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, - uint init_alloc,uint alloc_increment); +#define init_dynamic_array(A,B,C,D) _init_dynamic_array(A,B,C,D CALLER_INFO) +#define init_dynamic_array_ci(A,B,C,D) _init_dynamic_array(A,B,C,D ORIG_CALLER_INFO) +extern my_bool _init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, + uint init_alloc,uint alloc_increment CALLER_INFO_PROTO); extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element); extern byte *alloc_dynamic(DYNAMIC_ARRAY *array); extern byte *pop_dynamic(DYNAMIC_ARRAY*); diff --git a/mysys/array.c b/mysys/array.c index 17e5ded322b..85dfdaa09d8 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -29,12 +29,12 @@ even if space allocation failed */ -my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, - uint init_alloc, uint alloc_increment) +my_bool _init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, + uint init_alloc, uint alloc_increment CALLER_INFO_PROTO) { DBUG_ENTER("init_dynamic_array"); if (!alloc_increment) - { + { alloc_increment=max((8192-MALLOC_OVERHEAD)/element_size,16); if (init_alloc > 8 && alloc_increment > init_alloc * 2) alloc_increment=init_alloc*2; @@ -46,7 +46,7 @@ my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, array->max_element=init_alloc; array->alloc_increment=alloc_increment; array->size_of_element=element_size; - if (!(array->buffer=(char*) my_malloc(element_size*init_alloc,MYF(MY_WME)))) + if (!(array->buffer=(char*) my_malloc_ci(element_size*init_alloc,MYF(MY_WME)))) { array->max_element=0; DBUG_RETURN(TRUE); diff --git a/mysys/hash.c b/mysys/hash.c index e37bea3846c..727df46758c 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -37,15 +37,15 @@ static uint calc_hashnr_caseup(const byte *key,uint length); static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length); -my_bool hash_init(HASH *hash,uint size,uint key_offset,uint key_length, +my_bool _hash_init(HASH *hash,uint size,uint key_offset,uint key_length, hash_get_key get_key, - void (*free_element)(void*),uint flags) + void (*free_element)(void*),uint flags CALLER_INFO_PROTO) { DBUG_ENTER("hash_init"); DBUG_PRINT("enter",("hash: %lx size: %d",hash,size)); hash->records=0; - if (init_dynamic_array(&hash->array,sizeof(HASH_LINK),size,0)) + if (init_dynamic_array_ci(&hash->array,sizeof(HASH_LINK),size,0)) { hash->free=0; /* Allow call to hash_free */ DBUG_RETURN(TRUE); -- cgit v1.2.1 From 78dca2de82de57d6c5333c7da4524d8bf4057aa1 Mon Sep 17 00:00:00 2001 From: "jani@hynda.mysql.fi" <> Date: Fri, 15 Feb 2002 02:34:48 +0200 Subject: Fixed too bugs in MySQL client 'mysql', interactive command 'tee'. --- BitKeeper/etc/logging_ok | 1 + client/mysql.cc | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 03e5543a92f..0116fac8efd 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -12,3 +12,4 @@ paul@central.snake.net sasha@mysql.sashanet.com serg@serg.mysql.com heikki@hundin.mysql.fi +jani@hynda.mysql.fi diff --git a/client/mysql.cc b/client/mysql.cc index cfe6d823cac..ab8740dbe3c 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -34,7 +34,7 @@ #include "my_readline.h" #include -const char *VER="11.16"; +const char *VER="11.17"; /* Don't try to make a nice table if the data is too big */ #define MAX_COLUMN_LENGTH 1024 @@ -1776,10 +1776,17 @@ com_tee(String *buffer, char *line __attribute__((unused))) { while (isspace(*param)) param++; - end=strmake(file_name, param, sizeof(file_name)-1); + end= strend(param); while (end > file_name && (isspace(end[-1]) || iscntrl(end[-1]))) end--; - end[0]=0; + end[0]= 0; + if ((*(end - 1) == '"' && *param == '"') || + (*(end - 1) == '\'' && *param == '\'')) + { + *--end= 0; + param++; + } + strmake(file_name, param, sizeof(file_name) - 1); strmov(outfile, file_name); } if (!strlen(outfile)) @@ -1787,11 +1794,10 @@ com_tee(String *buffer, char *line __attribute__((unused))) printf("No outfile specified!\n"); return 0; } - if (!opt_outfile) - { - init_tee(); - opt_outfile=1; - } + if (opt_outfile) + end_tee(); + init_tee(); + opt_outfile= 1; tee_fprintf(stdout, "Logging to file '%s'\n", outfile); return 0; } -- cgit v1.2.1 From 4ebd3f9aaf220d4f89c311c5e9ef030de4480692 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Fri, 15 Feb 2002 10:39:12 +0200 Subject: dict0dict.c: If the string foreign was succeeded by a non-space character, that confused the foreign key syntax parser --- innobase/dict/dict0dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 56bdf83aa4d..657ce2d6809 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -1983,7 +1983,7 @@ loop: ptr = dict_accept(ptr, "FOREIGN", &success); if (!isspace(*ptr)) { - return(DB_CANNOT_ADD_CONSTRAINT); + goto loop; } ptr = dict_accept(ptr, "KEY", &success); -- cgit v1.2.1 From 21cf70e9e07e60d57049ebd89cd610021b8e62bb Mon Sep 17 00:00:00 2001 From: "sasha@mysql.sashanet.com" <> Date: Fri, 15 Feb 2002 14:02:48 -0700 Subject: updates for the new build --- Docs/linuxthreads.txt | 15 +++++++++++++++ configure.in | 41 +++++++++++++++++++++++++++++++++++++++-- mysql-test/mysql-test-run.sh | 19 ++++++++++++++----- 3 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 Docs/linuxthreads.txt diff --git a/Docs/linuxthreads.txt b/Docs/linuxthreads.txt new file mode 100644 index 00000000000..0989f8d3718 --- /dev/null +++ b/Docs/linuxthreads.txt @@ -0,0 +1,15 @@ +Notes on compiling glibc for the standard MySQL binary: + + - make sure you have gcc 2.95 and gmake 3.79 or newer + - wget ftp://ftp.gnu.org/pub/gnu/glibc/glibc-2.2.5.tar.gz + - wget ftp://ftp.gnu.org/pub/gnu/glibc/glibc-linuxthreads-2.2.5.tar.gz + - tar zxvf glibc-2.2.5.tar.gz ; cd glibc-2.2.5 ; + tar zxvf ../glibc-linuxthreads-2.2.5.tar.gz + - in linuxthreads/internals.h change STACK_SIZE to (128*1024) + - in linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h change + PTHREAD_THREADS_MAX to 4096 + - ./configure --prefix=/usr/local/mysql-glibc --enable-static-nss --disable-shared --enable-add-ons=linuxthreads + - make + - possible problems - if compiler is not properly installed, one can get + "cpp: too many input" files error - easiest way to solve - SUSE RPM for gcc + 2.95 diff --git a/configure.in b/configure.in index f11e2354dfd..fc63e3f4082 100644 --- a/configure.in +++ b/configure.in @@ -426,6 +426,7 @@ fi NOINST_LDFLAGS= + AC_ARG_WITH(other-libc, [ --with-other-libc=/path/to/other/libc/dir Link against libc and other standard libraries installed in the specified non-standard location overriding default. Originally added to be able to link against glibc 2.2 without making the user upgrade the standard libc installation ], [ @@ -439,8 +440,27 @@ AC_ARG_WITH(other-libc, #There seems to be a feature in gcc that treats system and libc headers #leniently when they violatate ANSI C++ standard, but it is strict otherwise #since gcc cannot now recognize that our headers are libc, we work around -#by telling it to be permissive - LDFLAGS="$LDFLAGS -static -L$other_libc_lib " +#by telling it to be permissive + static_nss= + if test -f "$other_libc_lib/libnss_files.a" + then + # libc has been compiled with --enable-static-nss + # we need special flags, but we will have to add those later + STATIC_NSS_FLAGS="-Wl,--start-group -lc -lnss_files -lnss_dns -lresolv \ + -Wl,--end-group" + static_nss=1 + else + # this is a dirty hack. We if we detect static nss glibc in the special + # location, we do not re-direct the linker to get libraries from there + # during check. The reason is that if we did, we would have to find a + # way to append the special static nss flags to LIBS every time we do + # any check - this is definitely feasible, but not worthwhile the risk + # of breaking other things. So for our purposes it would be sufficient + # to assume that whoever is using static NSS knows what he is doing and + # has sensible libraries in the regular location + LDFLAGS="$LDFLAGS -static -L$other_libc_lib " + fi + with_mysqld_ldflags="-all-static" with_client_ldflags="-all-static" NOINST_LDFLAGS="-all-static" @@ -2023,6 +2043,12 @@ then linked_client_targets="$linked_client_targets linked_libmysql_r_sources" AC_DEFINE(THREAD_SAFE_CLIENT) fi + +if test "$static_nss" = "1" +then + CLIENT_LIBS="$CLIENT_LIBS $STATIC_NSS_FLAGS" +fi + AC_SUBST(CLIENT_LIBS) AC_SUBST(sql_client_dirs) AC_SUBST(linked_client_targets) @@ -2166,6 +2192,17 @@ then LIBS="$MT_LD_ADD $LIBS" fi fi + +#IMPORTANT - do not modify LIBS past this line - this hack is the only way +# I know to add the static NSS magic if we have static NSS libraries with +# glibc - Sasha + +if test "$static_nss" = "1" +then + LDFLAGS="$LDFLAGS -static -L$other_libc_lib " + LIBS="$LIBS $STATIC_NSS_FLAGS" +fi + AC_SUBST(sql_server_dirs) AC_SUBST(thread_dirs) AC_SUBST(server_scripts) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 09cdab9664b..d06f17d14e3 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -124,6 +124,7 @@ MASTER_MYPORT=9306 SLAVE_RUNNING=0 SLAVE_MYPORT=9307 NO_SLAVE=0 +USER_TEST= EXTRA_MASTER_OPT="" EXTRA_MYSQL_TEST_OPT="" @@ -174,6 +175,9 @@ while test $# -gt 0; do EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" SLEEP_TIME=`$ECHO "$1" | $SED -e "s;--sleep=;;"` ;; + --user-test=*) + USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"` + ;; --mysqld=*) TMP=`$ECHO "$1" | $SED -e "s;--mysqld=;;"` EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $TMP" @@ -905,11 +909,16 @@ then if [ x$RECORD = x1 ]; then $ECHO "Will not run in record mode without a specific test case." else - for tf in $TESTDIR/*.$TESTSUFFIX - do - run_testcase $tf - done - $RM -f $TIMEFILE # Remove for full test + if [ -z "$USER_TEST" ] + then + for tf in $TESTDIR/*.$TESTSUFFIX + do + run_testcase $tf + done + $RM -f $TIMEFILE # Remove for full test + else + $USER_TEST + fi fi else tname=`$BASENAME $1 .test` -- cgit v1.2.1 From bcd8cd137239923c8eb7f356cd4f4073a223aa81 Mon Sep 17 00:00:00 2001 From: "sasha@mysql.sashanet.com" <> Date: Sat, 16 Feb 2002 11:32:06 -0700 Subject: updated build scripts for new Linux build --- Build-tools/Do-all-build-steps | 2 +- Build-tools/Do-compile | 6 +++++- Build-tools/Do-linux-build | 18 ++++++++++++++++++ Build-tools/Do-rpm | 16 +++++++++++++++- strings/Makefile.am | 3 ++- support-files/mysql.spec.sh | 23 +++++++++++++++++++---- 6 files changed, 60 insertions(+), 8 deletions(-) create mode 100755 Build-tools/Do-linux-build diff --git a/Build-tools/Do-all-build-steps b/Build-tools/Do-all-build-steps index c236fe20f99..eb14b7105cd 100755 --- a/Build-tools/Do-all-build-steps +++ b/Build-tools/Do-all-build-steps @@ -72,7 +72,7 @@ gmake -j 2 time gmake -j 2 distcheck \ EXTRA_CONF_ARGS="--with-unix-socket-path=/var/tmp/mysql.sock --with-low-memory $EXTRA_CONFIG" -sh $BD/Build-tools/Do-rpm +sh $BD/Build-tools/Do-rpm $* rm -f $TMP_SCRIPT END diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index e0e7fb51933..4fc0becab71 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -7,7 +7,7 @@ $opt_tmp=$opt_version_suffix=""; $opt_help=$opt_Information=$opt_delete=$opt_debug=$opt_stage=$opt_rsh_mail=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_no_mysqltest=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=0; $opt_innodb=$opt_bdb=0; -GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix=s") || usage(); +GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix=s", "with-other-libc=s) || usage(); usage() if ($opt_help || $opt_Information); usage() if (!$opt_distribution); @@ -147,6 +147,10 @@ if ($opt_stage <= 1) { $opt_config_options.=" --with-client-ldflags=-all-static"; } + if ($opt_with_other_libc) + { + $opt_with_other_libc = "--with-other-libc=$opt_with_other_libc"; + } if (!$opt_enable_shared) { $opt_config_options.= " --disable-shared"; # Default for binary versions diff --git a/Build-tools/Do-linux-build b/Build-tools/Do-linux-build new file mode 100755 index 00000000000..e5b0a49fe75 --- /dev/null +++ b/Build-tools/Do-linux-build @@ -0,0 +1,18 @@ +#! /bin/sh + +set -e -x +OTHER_LIBC_DIR=/usr/local/mysql-glibc + +BUILD/compile-pentium-max --with-other-libc=$OTHER_LIBC_DIR \ + --with-comment="Official MySQL Binary" \ + --prefix=/usr/local/mysql --with-extra-charset=complex \ + --enable-thread-safe-client --enable-local-infile \ + --with-server-suffix=-max +scripts/make_binary_distribution +make dist +Build-tools/Do-rpm --local +BUILD/compile-pentium --with-other-libc=$OTHER_LIBC_DIR \ + --with-comment="Official MySQL Binary" \ + --prefix=/usr/local/mysql --with-extra-charset=complex \ + --enable-thread-safe-client --enable-local-infile +scripts/make_binary_distribution diff --git a/Build-tools/Do-rpm b/Build-tools/Do-rpm index 046ba93a1dd..815eda86009 100755 --- a/Build-tools/Do-rpm +++ b/Build-tools/Do-rpm @@ -38,7 +38,21 @@ owner=my # Hard path!! bpath=`/bin/pwd` -rpmdir="/usr/src/redhat" + +for d in /usr/src/redhat /usr/src/packages ; do +if test -d "$d" +then + rpmdir=$d +fi +done + +if test -z "$rpmdir" +then + echo "Could not find suitable rpmdir on this system" + exit 1 +fi + + logdir="$bpath/Logs" ###### Perl STUFF ##### diff --git a/strings/Makefile.am b/strings/Makefile.am index 6bf21d630f3..4c42f1ccb96 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -51,7 +51,8 @@ EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c \ strmake.c strnmov.c strmov.c strnlen.c \ bmove_upp-sparc.s strappend-sparc.s strend-sparc.s \ strinstr-sparc.s strmake-sparc.s strmov-sparc.s \ - strnmov-sparc.s strstr-sparc.s strxmov-sparc.s + strnmov-sparc.s strstr-sparc.s strxmov-sparc.s \ + t_ctype.h OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ __math.h time.h __time.h unistd.h __unistd.h types.h \ diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index fcc09aa8302..0a34817fa3b 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -186,26 +186,36 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-/bin:/usr/bin}\" \ # Use the build root for temporary storage of the shared libraries. +OTHER_LIBC_DIR=/usr/local/mysql-glibc RBR=$RPM_BUILD_ROOT MBD=$RPM_BUILD_DIR/mysql-%{mysql_version} if test -z "$RBR" -o "$RBR" = "/" then - echo "RPM_BUILD_ROOT has stupid value" + echo "RPM_BUILD_ROOT has insecure value" exit 1 fi rm -rf $RBR mkdir -p $RBR -# Build the shared libraries and mysqld-max +# We need to build shared libraries separate from mysqld-max because we +# are using --with-other-libc -BuildMySQL "--enable-shared --enable-thread-safe-client --with-berkeley-db --with-innodb --with-mysqld-ldflags='-all-static' --with-server-suffix='-Max'" +BuildMySQL "--disable-shared --with-other-libc=$OTHER_LIBC_DIR --with-berkeley-db --with-innodb --with-mysqld-ldflags='-all-static' --with-server-suffix='-Max'" # Save everything for debug # tar cf $RBR/all.tar . -# Save shared libraries and mysqld-max +# Save mysqld-max mv sql/mysqld sql/mysqld-max nm --numeric-sort sql/mysqld-max > sql/mysqld-max.sym + +# Save manual to avoid rebuilding +mv Docs/manual.ps Docs/manual.ps.save +make distclean +mv Docs/manual.ps.save Docs/manual.ps + +#now build and save shared libraries +BuildMySQL "--enable-shared --enable-thread-safe-client --without-server " (cd libmysql/.libs; tar cf $RBR/shared-libs.tar *.so*) (cd libmysql_r/.libs; tar rf $RBR/shared-libs.tar *.so*) @@ -220,6 +230,7 @@ automake BuildMySQL "--disable-shared" \ "--with-mysqld-ldflags='-all-static'" \ "--with-client-ldflags='-all-static'" \ + "--with-other-libc=$OTHER_LIBC_DIR" \ "--without-berkeley-db --without-innodb" nm --numeric-sort sql/mysqld > sql/mysqld.sym @@ -416,6 +427,10 @@ fi %changelog +* Fri Feb 15 2002 Sasha + +- changed build to use --with-other-libc + * Fri Apr 13 2001 Monty - Added mysqld-max to the distribution -- cgit v1.2.1 From b0658731631a30b4c3f8123571f28df5cb780546 Mon Sep 17 00:00:00 2001 From: "sasha@mysql.sashanet.com" <> Date: Sat, 16 Feb 2002 13:52:15 -0700 Subject: RPM clean-up --- support-files/mysql.spec.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 0a34817fa3b..81ee0c52eea 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -74,6 +74,7 @@ Group: Applications/Databases Summary(pt_BR): MySQL - Cliente Group(pt_BR): Aplicações/Banco_de_Dados Obsoletes: mysql-client +Provides: mysql-client %description client This package contains the standard MySQL clients. @@ -90,6 +91,7 @@ Summary: MySQL - Benchmarks and test system Group: Applications/Databases Summary(pt_BR): MySQL - Medições de desempenho Group(pt_BR): Aplicações/Banco_de_Dados +Provides: mysql-bench Obsoletes: mysql-bench %description bench @@ -107,6 +109,7 @@ Summary: MySQL - Development header files and libraries Group: Applications/Databases Summary(pt_BR): MySQL - Medições de desempenho Group(pt_BR): Aplicações/Banco_de_Dados +Provides: mysql-devel Obsoletes: mysql-devel %description devel @@ -132,6 +135,7 @@ languages and applications need to dynamically load and use MySQL. Release: %{release} Summary: MySQL - server with Berkeley DB and Innodb support Group: Applications/Databases +Provides: mysql-Max Obsoletes: mysql-Max %description Max @@ -410,7 +414,7 @@ fi %files devel %attr(755, root, root) /usr/bin/comp_err %attr(755, root, root) /usr/include/mysql/ -%attr(755, root, root) /usr/lib/mysql/ +%attr(755, root, root) /usr/lib/mysql/*.a %attr(755, root, root) /usr/bin/mysql_config %files shared -- cgit v1.2.1 From 2cef9ef99d2664079fb80a0399c6081ad832dd08 Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Wed, 20 Feb 2002 13:06:54 +0000 Subject: memory leak with broken tables fixed --- Docs/manual.texi | 10 +++++++++- sql/sql_base.cc | 1 + sql/table.cc | 1 - 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index a93d5b2194b..9620f206d73 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46833,6 +46833,7 @@ users use this code as the rest of the code and because of this we are not yet 100% confident in this code. @menu +* News-3.23.50:: Changes in release 3.23.50 * News-3.23.49:: Changes in release 3.23.49 * News-3.23.48:: Changes in release 3.23.48 * News-3.23.47:: Changes in release 3.23.47 @@ -46886,7 +46887,14 @@ not yet 100% confident in this code. * News-3.23.0:: Changes in release 3.23.0 @end menu -@node News-3.23.49, News-3.23.48, News-3.23.x, News-3.23.x +@node News-3.23.50, News-3.23.49, News-3.23.x, News-3.23.x +@appendixsubsec Changes in release 3.23.50 +@itemize @bullet +@item +Memory leak (16 bytes per every @strong{broken} table) closed. +@end itemize + +@node News-3.23.49, News-3.23.48, News-3.23.50, News-3.23.x @appendixsubsec Changes in release 3.23.49 @itemize @bullet @item diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 656758623bc..1c281163b5a 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -277,6 +277,7 @@ void intern_close_table(TABLE *table) free_io_cache(table); if (table->file) VOID(closefrm(table)); // close file + hash_free(&table->name_hash); } diff --git a/sql/table.cc b/sql/table.cc index 1ab6c50add9..ce7d185a7a1 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -600,7 +600,6 @@ int closefrm(register TABLE *table) } delete table->file; table->file=0; /* For easyer errorchecking */ - hash_free(&table->name_hash); free_root(&table->mem_root,MYF(0)); DBUG_RETURN(error); } -- cgit v1.2.1 From fce63b0044fe200936ccc3a3bcf0198def5cc2b9 Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Wed, 20 Feb 2002 23:00:32 +0000 Subject: wording changed --- Docs/manual.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 9620f206d73..bbf2f93a90d 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46891,7 +46891,7 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.50 @itemize @bullet @item -Memory leak (16 bytes per every @strong{broken} table) closed. +Memory leak (16 bytes per every @strong{corrupted} table) closed. @end itemize @node News-3.23.49, News-3.23.48, News-3.23.50, News-3.23.x -- cgit v1.2.1 From a4a150454ea706fa811cfddb3c25259f2fe3fe2b Mon Sep 17 00:00:00 2001 From: "miguel@light.local" <> Date: Wed, 20 Feb 2002 23:20:15 -0300 Subject: Changes for to control the tables and log clean up. --- sql/mysqld.cc | 78 ++++++++++++++++++++++++++++++++++----------------------- sql/nt_servc.cc | 4 +-- 2 files changed, 48 insertions(+), 34 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 09c05a6463f..b3c67fd5126 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -469,15 +469,28 @@ static void close_connections(void) } } #ifdef __NT__ - if ( hPipe != INVALID_HANDLE_VALUE ) +if ( hPipe != INVALID_HANDLE_VALUE ) +{ + HANDLE temp; + DBUG_PRINT( "quit", ("Closing named pipes") ); + + /* Create connection to the handle named pipe handler to break the loop */ + if ((temp = CreateFile(szPipeName, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + 0, + NULL )) != INVALID_HANDLE_VALUE) { - HANDLE hTempPipe = &hPipe; - DBUG_PRINT( "quit", ("Closing named pipes") ); - hPipe = INVALID_HANDLE_VALUE; - CancelIo( hTempPipe ); - DisconnectNamedPipe( hTempPipe ); - CloseHandle( hTempPipe ); + WaitNamedPipe(szPipeName, 1000); + DWORD dwMode = PIPE_READMODE_BYTE | PIPE_WAIT; + SetNamedPipeHandleState(temp, &dwMode, NULL, NULL); + CancelIo(temp); + DisconnectNamedPipe(temp); + CloseHandle(temp); } + } #endif #ifdef HAVE_SYS_UN_H if (unix_sock != INVALID_SOCKET) @@ -1857,6 +1870,14 @@ The server will not act as a slave."); if (opt_slow_log) open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log", LOG_NORMAL); +#ifdef __WIN__ +#define MYSQL_ERR_FILE "mysql.err" + if (!opt_console) + { + freopen(MYSQL_ERR_FILE,"a+",stdout); + freopen(MYSQL_ERR_FILE,"a+",stderr); + } +#endif if (ha_init()) { sql_print_error("Can't init databases"); @@ -1882,13 +1903,8 @@ The server will not act as a slave."); ft_init_stopwords(ft_precompiled_stopwords); /* SerG */ #ifdef __WIN__ -#define MYSQL_ERR_FILE "mysql.err" if (!opt_console) - { - freopen(MYSQL_ERR_FILE,"a+",stdout); - freopen(MYSQL_ERR_FILE,"a+",stderr); - FreeConsole(); // Remove window - } + FreeConsole(); // Remove window #endif /* @@ -1986,7 +2002,7 @@ The server will not act as a slave."); #ifdef __NT__ if (hPipe == INVALID_HANDLE_VALUE && !have_tcpip) { - sql_print_error("TCP/IP must be installed on Win98 platforms"); + sql_print_error("TCP/IP or Named Pipes should be installed on NT OS"); } else { @@ -2044,34 +2060,32 @@ The server will not act as a slave."); #ifdef EXTRA_DEBUG sql_print_error("After lock_thread_count"); #endif -#else - if (Service.IsNT()) +#endif + + /* Wait until cleanup is done */ + (void) pthread_mutex_lock(&LOCK_thread_count); + while (!ready_to_exit) { + pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); + } + (void) pthread_mutex_unlock(&LOCK_thread_count); +#ifdef __WIN__ + if (Service.IsNT()) + { if(start_mode) - { - if (WaitForSingleObject(hEventShutdown,1000)==WAIT_TIMEOUT) - Service.Stop(); - } + Service.Stop(); else { Service.SetShutdownEvent(0); if(hEventShutdown) CloseHandle(hEventShutdown); } - } - else - { + } + else + { Service.SetShutdownEvent(0); if(hEventShutdown) CloseHandle(hEventShutdown); - } + } #endif - - /* Wait until cleanup is done */ - (void) pthread_mutex_lock(&LOCK_thread_count); - while (!ready_to_exit) - { - pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); - } - (void) pthread_mutex_unlock(&LOCK_thread_count); my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); exit(0); return(0); /* purecov: deadcode */ diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc index 6930800982e..8c705a94f55 100644 --- a/sql/nt_servc.cc +++ b/sql/nt_servc.cc @@ -28,7 +28,7 @@ NTService::NTService() //time-out variables nStartTimeOut = 15000; - nStopTimeOut = 15000; + nStopTimeOut = 86400000; nPauseTimeOut = 5000; nResumeTimeOut = 5000; @@ -253,7 +253,7 @@ void NTService::ServiceMain(DWORD argc, LPTSTR *argv) WaitForSingleObject (pService->hExitEvent, INFINITE); // wait for thread to exit - if (WaitForSingleObject (pService->hThreadHandle, 1000) == WAIT_TIMEOUT) + if (WaitForSingleObject (pService->hThreadHandle, INFINITE) == WAIT_TIMEOUT) CloseHandle(pService->hThreadHandle); pService->Exit(0); -- cgit v1.2.1 From f2e7bb12047576bf871b061d744f3d04f15df68b Mon Sep 17 00:00:00 2001 From: "serg@serg.mysql.com" <> Date: Sat, 23 Feb 2002 15:22:19 +0000 Subject: mf_qsort.c: qsort implementation backported from 4.0 tree, the old one was buggy --- mysys/mf_qsort.c | 360 +++++++++++++++++++++++++------------------------------ 1 file changed, 164 insertions(+), 196 deletions(-) diff --git a/mysys/mf_qsort.c b/mysys/mf_qsort.c index 64e70990696..9cc937f6e8b 100644 --- a/mysys/mf_qsort.c +++ b/mysys/mf_qsort.c @@ -1,249 +1,217 @@ -/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Written by Douglas C. Schmidt (schmidt@ics.uci.edu). +/* Copyright (C) 2000 MySQL AB - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* - Modifications by monty: - - Uses mysys include files - - Small fixes to make the it a bit faster - - Can be compiled with a cmp function that takes one extra argument. + qsort implementation optimized for comparison of pointers + Inspired by the qsort implementations by Douglas C. Schmidt, + and Bentley & McIlroy's "Engineering a Sort Function". */ + #include "mysys_priv.h" +#ifndef SCO #include +#endif -/* Envoke the comparison function, returns either 0, < 0, or > 0. */ +/* We need to use qsort with 2 different compare functions */ #ifdef QSORT_EXTRA_CMP_ARGUMENT #define CMP(A,B) ((*cmp)(cmp_argument,(A),(B))) #else #define CMP(A,B) ((*cmp)((A),(B))) #endif -/* Byte-wise swap two items of size SIZE. */ -#define SWAP(a, b, size) \ - do \ - { \ - register size_t __size = (size); \ - register char *__a = (a), *__b = (b); \ - do \ - { \ - char __tmp = *__a; \ - *__a++ = *__b; \ - *__b++ = __tmp; \ - } while (--__size > 0); \ - } while (0) - -/* Discontinue quicksort algorithm when partition gets below this size. - This particular magic number was chosen to work best on a Sun 4/260. */ -#define MAX_THRESH 8 - -/* Stack node declarations used to store unfulfilled partition obligations. */ -typedef struct _qsort_stack_node - { - char *lo; - char *hi; - } stack_node; - -/* The next 4 #defines implement a very fast in-line stack abstraction. */ -#define STACK_SIZE (8 * sizeof(unsigned long int)) -#define PUSH(LOW,HIGH) do {top->lo = LOW;top++->hi = HIGH;} while (0) -#define POP(LOW,HIGH) do {LOW = (--top)->lo;HIGH = top->hi;} while (0) -#define STACK_NOT_EMPTY (stack < top) - -/* Order size using quicksort. This implementation incorporates - four optimizations discussed in Sedgewick: - - 1. Non-recursive, using an explicit stack of pointer that store the - next array partition to sort. To save time, this maximum amount - of space required to store an array of MAX_INT is allocated on the - stack. Assuming a 32-bit integer, this needs only 32 * - sizeof (stack_node) == 136 bits. Pretty cheap, actually. +#define SWAP(A, B, size,swap_ptrs) \ +do { \ + if (swap_ptrs) \ + { \ + reg1 char **a = (char**) (A), **b = (char**) (B); \ + char *tmp = *a; *a++ = *b; *b++ = tmp; \ + } \ + else \ + { \ + reg1 char *a = (A), *b = (B); \ + reg3 char *end= a+size; \ + do \ + { \ + char tmp = *a; *a++ = *b; *b++ = tmp; \ + } while (a < end); \ + } \ +} while (0) + +/* Put the median in the middle argument */ +#define MEDIAN(low, mid, high) \ +{ \ + if (CMP(high,low) < 0) \ + SWAP(high, low, size, ptr_cmp); \ + if (CMP(mid, low) < 0) \ + SWAP(mid, low, size, ptr_cmp); \ + else if (CMP(high, mid) < 0) \ + SWAP(mid, high, size, ptr_cmp); \ +} - 2. Chose the pivot element using a median-of-three decision tree. - This reduces the probability of selecting a bad pivot value and - eliminates certain extraneous comparisons. +/* The following node is used to store ranges to avoid recursive calls */ - 3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving - insertion sort to order the MAX_THRESH items within each partition. - This is a big win, since insertion sort is faster for small, mostly - sorted array segments. +typedef struct st_stack +{ + char *low,*high; +} stack_node; - 4. The larger of the two sub-partitions is always pushed onto the - stack first, with the algorithm then concentrating on the - smaller partition. This *guarantees* no more than log (n) - stack size is needed (actually O(1) in this case)! */ +#define PUSH(LOW,HIGH) {stack_ptr->low = LOW; stack_ptr++->high = HIGH;} +#define POP(LOW,HIGH) {LOW = (--stack_ptr)->low; HIGH = stack_ptr->high;} +/* The following stack size is enough for ulong ~0 elements */ +#define STACK_SIZE (8 * sizeof(unsigned long int)) +#define THRESHOLD_FOR_INSERT_SORT 10 #if defined(QSORT_TYPE_IS_VOID) #define SORT_RETURN return #else #define SORT_RETURN return 0 #endif +/**************************************************************************** +** 'standard' quicksort with the following extensions: +** +** Can be compiled with the qsort2_cmp compare function +** Store ranges on stack to avoid recursion +** Use insert sort on small ranges +** Optimize for sorting of pointers (used often by MySQL) +** Use median comparison to find partition element +*****************************************************************************/ + #ifdef QSORT_EXTRA_CMP_ARGUMENT -qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size, qsort2_cmp cmp, +qsort_t qsort2(void *base_ptr, size_t count, size_t size, qsort2_cmp cmp, void *cmp_argument) #else -qsort_t qsort(void *base_ptr, size_t total_elems, size_t size, qsort_cmp cmp) +qsort_t qsort(void *base_ptr, size_t count, size_t size, qsort_cmp cmp) #endif { - /* Allocating SIZE bytes for a pivot buffer facilitates a better - algorithm below since we can do comparisons directly on the pivot. - */ - size_t max_thresh = (size_t) (MAX_THRESH * size); - if (total_elems <= 1) - SORT_RETURN; /* Crashes on MSDOS if continues */ - - if (total_elems > MAX_THRESH) - { - char *lo = (char*) base_ptr; - char *hi = &lo[size * (total_elems - 1)]; - stack_node stack[STACK_SIZE]; /* Largest size needed for 32-bit int!!! */ - stack_node *top = stack + 1; - char *pivot = (char *) my_alloca ((int) size); + char *low, *high, *pivot; + stack_node stack[STACK_SIZE], *stack_ptr; + my_bool ptr_cmp; + /* Handle the simple case first */ + /* This will also make the rest of the code simpler */ + if (count <= 1) + SORT_RETURN; + + low = (char*) base_ptr; + high = low+ size * (count - 1); + stack_ptr = stack + 1; #ifdef HAVE_purify - stack[0].lo=stack[0].hi=0; + /* The first element in the stack will be accessed for the last POP */ + stack[0].low=stack[0].high=0; #endif + pivot = (char *) my_alloca((int) size); + ptr_cmp= size == sizeof(char*) && !((low - (char*) 0)& (sizeof(char*)-1)); - do + /* The following loop sorts elements between high and low */ + do + { + char *low_ptr, *high_ptr, *mid; + + count=((size_t) (high - low) / size)+1; + /* If count is small, then an insert sort is faster than qsort */ + if (count < THRESHOLD_FOR_INSERT_SORT) { - char *left_ptr,*right_ptr; - - /* Select median value from among LO, MID, and HI. Rearrange - LO and HI so the three values are sorted. This lowers the - probability of picking a pathological pivot value and - skips a comparison for both the LEFT_PTR and RIGHT_PTR. */ - - char *mid = lo + size * (((ulong) (hi - lo) / (ulong) size) >> 1); - - if (CMP(hi,lo) < 0) - SWAP (hi, lo, size); - if (CMP (mid, lo) < 0) - SWAP (mid, lo, size); - else if (CMP (hi, mid) < 0) - SWAP (mid, hi, size); - memcpy (pivot, mid, size); - - left_ptr = lo + size; - right_ptr = hi - size; - - /* Here's the famous ``collapse the walls'' section of quicksort. - Gotta like those tight inner loops! They are the main reason - that this algorithm runs much faster than others. */ - do + for (low_ptr = low + size; low_ptr <= high; low_ptr += size) { - while (CMP (left_ptr, pivot) < 0) - left_ptr += size; - - while (CMP (pivot, right_ptr) < 0) - right_ptr -= size; - - if (left_ptr < right_ptr) - { - SWAP (left_ptr, right_ptr, size); - left_ptr += size; - right_ptr -= size; - } - else if (left_ptr == right_ptr) - { - left_ptr += size; - right_ptr -= size; - break; - } - else - break; /* left_ptr > right_ptr */ + char *ptr; + for (ptr = low_ptr; ptr > low && CMP(ptr - size, ptr) > 0; + ptr -= size) + SWAP(ptr, ptr - size, size, ptr_cmp); } - while (left_ptr <= right_ptr); + POP(low, high); + continue; + } + /* Try to find a good middle element */ + mid= low + size * (count >> 1); + if (count > 40) /* Must be bigger than 24 */ + { + size_t step = size* (count / 8); + MEDIAN(low, low + step, low+step*2); + MEDIAN(mid - step, mid, mid+step); + MEDIAN(high - 2 * step, high-step, high); + /* Put best median in 'mid' */ + MEDIAN(low+step, mid, high-step); + low_ptr = low; + high_ptr = high; + } + else + { + MEDIAN(low, mid, high); + /* The low and high argument are already in sorted against 'pivot' */ + low_ptr = low + size; + high_ptr = high - size; + } + memcpy(pivot, mid, size); - /* Set up pointers for next iteration. First determine whether - left and right partitions are below the threshold size. If so, - ignore one or both. Otherwise, push the larger partition's - bounds on the stack and continue sorting the smaller one. */ + do + { + while (CMP(low_ptr, pivot) < 0) + low_ptr += size; + while (CMP(pivot, high_ptr) < 0) + high_ptr -= size; - if ((size_t) (right_ptr - lo) <= max_thresh) + if (low_ptr < high_ptr) { - if ((size_t) (hi - left_ptr) <= max_thresh) - POP (lo, hi); /* Ignore both small partitions. */ - else - lo = left_ptr; /* Ignore small left part. */ + SWAP(low_ptr, high_ptr, size, ptr_cmp); + low_ptr += size; + high_ptr -= size; } - else if ((size_t) (hi - left_ptr) <= max_thresh) - hi = right_ptr; /* Ignore small right partition. */ - else if ((right_ptr - lo) > (hi - left_ptr)) - { - PUSH (lo, right_ptr); /* Push larger left part */ - lo = left_ptr; - } - else + else { - PUSH (left_ptr, hi); /* Push larger right part */ - hi = right_ptr; + if (low_ptr == high_ptr) + { + low_ptr += size; + high_ptr -= size; + } + break; } - } while (STACK_NOT_EMPTY); - my_afree(pivot); - } - - /* Once the BASE_PTR array is partially sorted by quicksort the rest - is completely sorted using insertion sort, since this is efficient - for partitions below MAX_THRESH size. BASE_PTR points to the beginning - of the array to sort, and END_PTR points at the very last element in - the array (*not* one beyond it!). */ - - { - char *end_ptr = (char*) base_ptr + size * (total_elems - 1); - char *tmp_ptr = (char*) base_ptr; - char *thresh = min (end_ptr, (char*) base_ptr + max_thresh); - register char *run_ptr; - - /* Find smallest element in first threshold and place it at the - array's beginning. This is the smallest array element, - and the operation speeds up insertion sort's inner loop. */ - - for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size) - if (CMP (run_ptr, tmp_ptr) < 0) - tmp_ptr = run_ptr; - - if (tmp_ptr != (char*) base_ptr) - SWAP (tmp_ptr, (char*) base_ptr, size); + } + while (low_ptr <= high_ptr); - /* Insertion sort, running from left-hand-side up to right-hand-side. */ + /* + Prepare for next iteration. + Skip partitions of size 1 as these doesn't have to be sorted + Push the larger partition and sort the smaller one first. + This ensures that the stack is keept small. + */ - for (run_ptr = (char*) base_ptr + size; - (run_ptr += size) <= end_ptr; ) + if ((int) (high_ptr - low) <= 0) { - if (CMP (run_ptr, (tmp_ptr = run_ptr-size)) < 0) + if ((int) (high - low_ptr) <= 0) { - char *trav; - while (CMP (run_ptr, tmp_ptr -= size) < 0) ; - tmp_ptr += size; - - /* Shift down all smaller elements, put found element in 'run_ptr' */ - for (trav = run_ptr + size; --trav >= run_ptr;) - { - char c = *trav; - char *hi, *lo; - - for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo) - *hi = *lo; - *hi = c; - } + POP(low, high); /* Nothing more to sort */ } + else + low = low_ptr; /* Ignore small left part. */ + } + else if ((int) (high - low_ptr) <= 0) + high = high_ptr; /* Ignore small right part. */ + else if ((high_ptr - low) > (high - low_ptr)) + { + PUSH(low, high_ptr); /* Push larger left part */ + low = low_ptr; + } + else + { + PUSH(low_ptr, high); /* Push larger right part */ + high = high_ptr; } - } + } while (stack_ptr > stack); + my_afree(pivot); SORT_RETURN; } -- cgit v1.2.1 From 5a34e9d250949118e364d242ded275130d8f04e6 Mon Sep 17 00:00:00 2001 From: "sasha@mysql.sashanet.com" <> Date: Sat, 23 Feb 2002 14:42:32 -0700 Subject: updated glibc build instructions --- Docs/glibc-2.2.5.patch | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ Docs/linuxthreads.txt | 10 ++++--- 2 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 Docs/glibc-2.2.5.patch diff --git a/Docs/glibc-2.2.5.patch b/Docs/glibc-2.2.5.patch new file mode 100644 index 00000000000..c6bc2bf39a8 --- /dev/null +++ b/Docs/glibc-2.2.5.patch @@ -0,0 +1,73 @@ +diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet ../glibc-2.2.5/linuxthreads/internals.h ./linuxthreads/internals.h +--- ../glibc-2.2.5/linuxthreads/internals.h Thu Nov 29 00:44:16 2001 ++++ ./linuxthreads/internals.h Fri Feb 22 21:18:09 2002 +@@ -343,7 +343,7 @@ + THREAD_SELF implementation is used, this must be a power of two and + a multiple of PAGE_SIZE. */ + #ifndef STACK_SIZE +-#define STACK_SIZE (2 * 1024 * 1024) ++#define STACK_SIZE (128 * 1024) + #endif + + /* The initial size of the thread stack. Must be a multiple of PAGE_SIZE. */ +diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet ../glibc-2.2.5/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h ./linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h +--- ../glibc-2.2.5/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h Thu Jun 8 13:49:49 2000 ++++ ./linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h Fri Feb 22 21:18:09 2002 +@@ -64,7 +64,7 @@ + /* The number of threads per process. */ + #define _POSIX_THREAD_THREADS_MAX 64 + /* This is the value this implementation supports. */ +-#define PTHREAD_THREADS_MAX 1024 ++#define PTHREAD_THREADS_MAX 4096 + + /* Maximum amount by which a process can descrease its asynchronous I/O + priority level. */ +diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet ../glibc-2.2.5/nss/nsswitch.c ./nss/nsswitch.c +--- ../glibc-2.2.5/nss/nsswitch.c Tue Jul 17 02:21:36 2001 ++++ ./nss/nsswitch.c Fri Feb 22 21:18:09 2002 +@@ -515,8 +515,16 @@ + + (line - name + 1)); + if (new_service == NULL) + return result; +- ++#ifdef DO_STATIC_NSS ++ if (strncmp(name,"files",5) == 0 || ++ strncmp(name,"dns",3) == 0) ++#endif + *((char *) __mempcpy (new_service->name, name, line - name)) = '\0'; ++#ifdef DO_STATIC_NSS ++ else ++ *((char *) __mempcpy (new_service->name, "files", 5)) = '\0'; ++#endif ++ + + /* Set default actions. */ + new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE; +diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet ../glibc-2.2.5/time/Makefile ./time/Makefile +--- ../glibc-2.2.5/time/Makefile Fri Feb 22 21:27:19 2002 ++++ ./time/Makefile Fri Feb 22 21:26:47 2002 +@@ -37,8 +37,8 @@ + + include ../Rules + +-tz-cflags = -DTZDIR='"$(zonedir)"' \ +- -DTZDEFAULT='"$(localtime-file)"' \ ++tz-cflags = -DTZDIR='"/usr/share/zoneinfo/"' \ ++ -DTZDEFAULT='"/etc/localtime"' \ + -DTZDEFRULES='"$(posixrules-file)"' + + CFLAGS-tzfile.c = $(tz-cflags) +diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet ../glibc-2.2.5/timezone/Makefile ./timezone/Makefile +--- ../glibc-2.2.5/timezone/Makefile Wed Aug 29 16:45:25 2001 ++++ ./timezone/Makefile Fri Feb 22 21:18:09 2002 +@@ -159,8 +159,8 @@ + + $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o + +-tz-cflags = -DTZDIR='"$(zonedir)"' \ +- -DTZDEFAULT='"$(localtime-file)"' \ ++tz-cflags = -DTZDIR='"/usr/share/zoneinfo/"' \ ++ -DTZDEFAULT='"/etc/localtime"' \ + -DTZDEFRULES='"$(posixrules-file)"' \ + -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone + diff --git a/Docs/linuxthreads.txt b/Docs/linuxthreads.txt index 0989f8d3718..30270125c0d 100644 --- a/Docs/linuxthreads.txt +++ b/Docs/linuxthreads.txt @@ -5,11 +5,13 @@ Notes on compiling glibc for the standard MySQL binary: - wget ftp://ftp.gnu.org/pub/gnu/glibc/glibc-linuxthreads-2.2.5.tar.gz - tar zxvf glibc-2.2.5.tar.gz ; cd glibc-2.2.5 ; tar zxvf ../glibc-linuxthreads-2.2.5.tar.gz - - in linuxthreads/internals.h change STACK_SIZE to (128*1024) - - in linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h change - PTHREAD_THREADS_MAX to 4096 - - ./configure --prefix=/usr/local/mysql-glibc --enable-static-nss --disable-shared --enable-add-ons=linuxthreads + - patch -p1 < ~/bk/mysql/Docs/glibc-2.2.5.patch + - ./configure --prefix=/usr/local/mysql-glibc --enable-static-nss \ + --disable-shared --enable-add-ons=linuxthreads --target=i386 \ + --host=i386-pc-linux-gnu - make - possible problems - if compiler is not properly installed, one can get "cpp: too many input" files error - easiest way to solve - SUSE RPM for gcc 2.95 + - surun make install + - To build the binaries, run Build-tools/Do-linux-build -- cgit v1.2.1 From 8c01c96f90c3d017864c34c55a75a10514be00f9 Mon Sep 17 00:00:00 2001 From: "sasha@mysql.sashanet.com" <> Date: Sat, 23 Feb 2002 16:08:04 -0700 Subject: updated version --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index fc63e3f4082..1971ac65785 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 3.23.49) +AM_INIT_AUTOMAKE(mysql, 3.23.49a) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 -- cgit v1.2.1 From 539718ba25d93af7364d73ee1e8d909dc303643a Mon Sep 17 00:00:00 2001 From: "monty@tik.mysql.fi" <> Date: Tue, 5 Mar 2002 15:46:30 +0200 Subject: Update scripts for new POSIX spec Fix for --enable-local-infile Portability fix for bison --- bdb/dist/s_recover | 12 ++++++++++-- configure.in | 2 ++ libmysql/libmysql.c | 2 +- mysql-test/mysql-test-run.sh | 11 ++++++----- scripts/safe_mysqld.sh | 2 +- sql-bench/server-cfg.sh | 2 +- sql/sql_yacc.yy | 2 +- 7 files changed, 22 insertions(+), 11 deletions(-) diff --git a/bdb/dist/s_recover b/bdb/dist/s_recover index 0e8b3731c77..b0593cfc052 100755 --- a/bdb/dist/s_recover +++ b/bdb/dist/s_recover @@ -12,6 +12,13 @@ rm -f $loglist trap 'rm -f $t; exit 1' 1 2 3 13 15 +# Use the standard -k option if it works; +# otherwise fall back on the traditional notation. +if sort -k 1,1 /dev/null +then sort_2_etc='-k 2' +else sort_2_etc='+1' +fi + # Check to make sure we haven't duplicated a log record entry, and build # the list of log record types that the test suite uses. for i in $DIR; do @@ -19,13 +26,14 @@ for i in $DIR; do for f in ../$i/*.src; do # Grab the PREFIX; there should only be one per file, and # so it's okay to just take the first. - grep '^PREFIX' $f | head -1 + grep '^PREFIX' $f | sed q egrep '^DEPRECATED[ ]|^BEGIN[ ]' $f | \ awk '{print $1 "\t" $2 "\t" $3}' done done > $loglist -grep -v '^PREFIX' $loglist | awk '{print $2 "\t" $3}' | sort +1 -n | \ +grep -v '^PREFIX' $loglist | awk '{print $2 "\t" $3}' | \ + sort $sort_2_etc -n | \ uniq -d -f 1 > $t [ -s $t ] && { echo "DUPLICATE LOG VALUES:" diff --git a/configure.in b/configure.in index f11e2354dfd..0cd1bf8a145 100644 --- a/configure.in +++ b/configure.in @@ -591,6 +591,8 @@ AC_ARG_ENABLE(local-infile, [ ENABLED_LOCAL_INFILE=no ] ) +AC_SUBST(ENABLE_LOCAL_INFILE) + # Use Paul Eggerts macros from GNU tar to check for large file support. MYSQL_SYS_LARGEFILE diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index c75bb0ad462..348e3942a63 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1022,7 +1022,7 @@ mysql_init(MYSQL *mysql) /* Only enable LOAD DATA INFILE by default if configured with - --with-enabled-local-inflile + --enable-local-infile */ #ifdef ENABLED_LOCAL_INFILE mysql->options.client_flag|= CLIENT_LOCAL_FILES; diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 09cdab9664b..76abbc75557 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -44,21 +44,22 @@ which () # No paths below as we can't be sure where the program is! -BASENAME=`which basename | head -1` -DIFF=`which diff | head -1` +SED=sed + +BASENAME=`which basename | $SED q` +DIFF=`which diff | $SED q` CAT=cat CUT=cut TAIL=tail ECHO=echo # use internal echo if possible EXPR=expr # use internal if possible FIND=find -GCOV=`which gcov | head -1` +GCOV=`which gcov | $SED q` PRINTF=printf RM=rm TIME=time TR=tr -XARGS=`which xargs | head -1` -SED=sed +XARGS=`which xargs | $SED q` # Are we using a source or a binary distribution? diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh index e7418819604..3494e3d707e 100644 --- a/scripts/safe_mysqld.sh +++ b/scripts/safe_mysqld.sh @@ -253,7 +253,7 @@ do I=1 while test "$I" -le "$numofproces" do - PROC=`ps xa | grep $ledir/$MYSQLD | grep -v "grep" | tail -1` + PROC=`ps xa | grep $ledir/$MYSQLD | grep -v "grep" | sed -n '$p'` for T in $PROC do break diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh index b4e134cd2c1..886c428e3b9 100644 --- a/sql-bench/server-cfg.sh +++ b/sql-bench/server-cfg.sh @@ -932,7 +932,7 @@ sub version { if ($dir && -e "$dir/bin/solcon") { - $version=`$dir/bin/solcon -e"ver" $main::opt_user $main::opt_password | grep Server | head -1`; + $version=`$dir/bin/solcon -e"ver" $main::opt_user $main::opt_password | grep Server | sed q`; if ($? == 0) { chomp($version); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 54a03d4a714..0cbf6f45194 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -30,7 +30,7 @@ extern void yyerror(const char*); int yylex(void *yylval); -#define yyoverflow(A,B,C,D,E,F) if (my_yyoverflow((B),(D),(F))) { yyerror((char*) (A)); return 2; } +#define yyoverflow(A,B,C,D,E,F) if (my_yyoverflow((B),(D),(int*) (F))) { yyerror((char*) (A)); return 2; } inline Item *or_or_concat(Item* A, Item* B) { -- cgit v1.2.1 From c1ab560c3dcc9b7060d90baffb4d6551203d2cc0 Mon Sep 17 00:00:00 2001 From: "monty@tik.mysql.fi" <> Date: Tue, 5 Mar 2002 17:38:16 +0200 Subject: Corrected fix for not freed memory when using corrupted tables --- Docs/manual.texi | 8 ++++++++ configure.in | 2 +- sql/sql_base.cc | 1 - sql/table.cc | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index bbf2f93a90d..413a9a8ce0c 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46892,6 +46892,12 @@ not yet 100% confident in this code. @itemize @bullet @item Memory leak (16 bytes per every @strong{corrupted} table) closed. +@item +Fixed binary builds to use @code{--enable-local-infile}. +@item +Update source to work with new @code{bison} version. +@item +Updated shell scripts to new agree with new POSIX standard. @end itemize @node News-3.23.49, News-3.23.48, News-3.23.50, News-3.23.x @@ -46909,6 +46915,8 @@ Added options to make @code{LOAD DATA LOCAL INFILE} more secure. MySQL binary release 3.23.48 for Linux contained a new glibc library, which has serious problems under high load and RedHat 7.2. The 3.23.49 binary release doesn't have this problem. +@item +Fixed shutdown problem on NT. @end itemize @node News-3.23.48, News-3.23.47, News-3.23.49, News-3.23.x diff --git a/configure.in b/configure.in index 66cdb8d09c8..cf971463b69 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 3.23.49a) +AM_INIT_AUTOMAKE(mysql, 3.23.50) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 1c281163b5a..656758623bc 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -277,7 +277,6 @@ void intern_close_table(TABLE *table) free_io_cache(table); if (table->file) VOID(closefrm(table)); // close file - hash_free(&table->name_hash); } diff --git a/sql/table.cc b/sql/table.cc index ce7d185a7a1..7510e6bcce8 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -573,6 +573,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, delete outparam->file; outparam->file=0; // For easyer errorchecking outparam->db_stat=0; + hash_free(&outparam->name_hash); free_root(&outparam->mem_root,MYF(0)); my_free(outparam->table_name,MYF(MY_ALLOW_ZERO_PTR)); DBUG_RETURN (error); @@ -600,6 +601,7 @@ int closefrm(register TABLE *table) } delete table->file; table->file=0; /* For easyer errorchecking */ + hash_free(&outparam->name_hash); free_root(&table->mem_root,MYF(0)); DBUG_RETURN(error); } -- cgit v1.2.1 From 668d09cc5c4e0c9e7c180f2dfb521244f325cf3f Mon Sep 17 00:00:00 2001 From: "monty@hundin.mysql.fi" <> Date: Wed, 6 Mar 2002 18:36:31 +0200 Subject: Fixed bug in DATE_FORMAT when used with GROUP BY --- Build-tools/Do-compile | 2 +- Docs/manual.texi | 3 +++ mysql-test/r/type_date.result | 4 ++++ mysql-test/t/type_date.test | 13 +++++++++++++ scripts/mysqlhotcopy.sh | 4 ++-- sql/item_timefunc.cc | 2 +- sql/item_timefunc.h | 1 + sql/table.cc | 2 +- 8 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 4fc0becab71..1e20cb35ed7 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -7,7 +7,7 @@ $opt_tmp=$opt_version_suffix=""; $opt_help=$opt_Information=$opt_delete=$opt_debug=$opt_stage=$opt_rsh_mail=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_no_mysqltest=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=0; $opt_innodb=$opt_bdb=0; -GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix=s", "with-other-libc=s) || usage(); +GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip","version-suffix=s", "with-other-libc=s") || usage(); usage() if ($opt_help || $opt_Information); usage() if (!$opt_distribution); diff --git a/Docs/manual.texi b/Docs/manual.texi index 413a9a8ce0c..48b5be95b41 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46898,6 +46898,9 @@ Fixed binary builds to use @code{--enable-local-infile}. Update source to work with new @code{bison} version. @item Updated shell scripts to new agree with new POSIX standard. +@item +Fixed bug where @code{DATE_FORMAT()} returned empty string when used +with @code{GROUP BY}. @end itemize @node News-3.23.49, News-3.23.48, News-3.23.50, News-3.23.x diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 9aa6d6fb9b7..df8f0ee1814 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -18,3 +18,7 @@ s date_add(date,INTERVAL 1 DAY) date_add(date,INTERVAL 1 SECOND) 2000-08-11 2000-08-10 00:00:01 2000-08-12 2000-08-11 00:00:01 +DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) +Wed, 06 March 2002 10:11:12 GMT-0800 +DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) +Wed, 06 March 2002 10:11:12 GMT-0800 Wed, 06 March 2002 10:11:12 GMT-0800 diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 0d2e18bcc94..68c2d55aac9 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -62,3 +62,16 @@ create table t1 (date date); insert into t1 values ("2000-08-10"),("2000-08-11"); select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1; drop table t1; + +# +# Test problem with DATE_FORMAT +# + +CREATE TABLE t1(AFIELD INT); +INSERT INTO t1 VALUES(1); +CREATE TABLE t2(GMT VARCHAR(32)); +INSERT INTO t2 VALUES('GMT-0800'); +SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD; +INSERT INTO t1 VALUES(1); +SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD; +drop table t1,t2; diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index caf2615fe7a..b0fee84c332 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome. # Documentation continued at end of file -my $VERSION = "1.14"; +my $VERSION = "1.15"; my $opt_tmpdir = $ENV{TMPDIR} || "/tmp"; @@ -562,7 +562,7 @@ sub copy_files { # add recursive option for scp push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd)$/ && $method =~ /^scp\b/; - my @non_raid = grep { $_ !~ m:\d\d/: } @$files; + my @non_raid = grep { ! m:/\d{2}/[^/]+$: } @$files; # add files to copy and the destination directory safe_system( @cp, @non_raid, $target ); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index b198900d24e..eb9b1423c78 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -672,7 +672,7 @@ String *Item_func_date_format::val_str(String *str) else size=format_length(format); if (format == str) - str=&str_value; // Save result here + str=&value; // Save result here if (str->alloc(size)) { null_value=1; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 1343cdad390..6913d4c6809 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -297,6 +297,7 @@ class Item_func_date_format :public Item_str_func { int fixed_length; const bool date_or_time; + String value; public: Item_func_date_format(Item *a,Item *b,bool date_or_time_arg) :Item_str_func(a,b),date_or_time(date_or_time_arg) {} diff --git a/sql/table.cc b/sql/table.cc index 7510e6bcce8..247e1dda196 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -601,7 +601,7 @@ int closefrm(register TABLE *table) } delete table->file; table->file=0; /* For easyer errorchecking */ - hash_free(&outparam->name_hash); + hash_free(&table->name_hash); free_root(&table->mem_root,MYF(0)); DBUG_RETURN(error); } -- cgit v1.2.1