diff options
author | serg@serg.mysql.com <> | 2002-02-20 12:03:43 +0000 |
---|---|---|
committer | serg@serg.mysql.com <> | 2002-02-20 12:03:43 +0000 |
commit | 26e0a5c5eb943d291a5fd69e1fadb8537b3ecdbc (patch) | |
tree | c048f9bdd321bb95a52264c12a1c5f89f283064f | |
parent | 6adc34bd0ad495e2b1a9134548c2b38bd207999a (diff) | |
parent | b0658731631a30b4c3f8123571f28df5cb780546 (diff) | |
download | mariadb-git-26e0a5c5eb943d291a5fd69e1fadb8537b3ecdbc.tar.gz |
Merge work:/home/bk/mysql into serg.mysql.com:/usr/home/serg/Abk/mysql
79 files changed, 1489 insertions, 473 deletions
diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh index c7cd43fa64e..fbeaf1e3c68 100644 --- a/BUILD/FINISH.sh +++ b/BUILD/FINISH.sh @@ -10,7 +10,7 @@ done commands="\ $make -k clean || true -/bin/rm -f */.deps/*.P config.cache +/bin/rm -f */.deps/*.P config.cache innobase/config.cache bdb/build_unix/config.cache aclocal && autoheader && aclocal && automake && autoconf (cd bdb/dist && sh s_all) @@ -20,7 +20,8 @@ then (cd gemini && aclocal && autoheader && aclocal && automake && autoconf) fi -CFLAGS=\"$cflags\" CXX=$CXX CXXFLAGS=\"$cxxflags\" $configure" +CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" \ +$configure" if [ -z "$just_configure" ] then diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 0f2334dd573..a69cdcb14fd 100644 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -52,7 +52,8 @@ debug_cflags="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DSAFE_MUTEX -O1" base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti" -base_configs="--prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static" +base_configs="--prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client" +static_link="--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static" alpha_configs="" # Not used yet pentium_configs="" sparc_configs="" @@ -68,7 +69,9 @@ fi if gcc -v 2>&1 | grep 'version 3' > /dev/null 2>&1 then - CXX=c++ + CXX="gcc -DUSE_MYSYS_NEW" + CXXLDFLAGS="-Wl,--defsym -Wl,__cxa_pure_virtual=0" else CXX=gcc + CXXLDFLAGS="" fi diff --git a/BUILD/compile-alpha b/BUILD/compile-alpha index 10b9d67e1c1..ce5050fee72 100755 --- a/BUILD/compile-alpha +++ b/BUILD/compile-alpha @@ -4,6 +4,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$alpha_cflags $fast_cflags" -extra_configs="$alpha_configs" +extra_configs="$alpha_configs $static_link" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium b/BUILD/compile-pentium index 11559be93de..b8f8d028e1f 100755 --- a/BUILD/compile-pentium +++ b/BUILD/compile-pentium @@ -4,9 +4,7 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $fast_cflags" -extra_configs="$pentium_configs" +extra_configs="$pentium_configs $static_link" strip=yes -extra_configs="$extra_configs" - . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-debug-max b/BUILD/compile-pentium-debug-max index dc88bab62d3..993c48565b8 100755 --- a/BUILD/compile-pentium-debug-max +++ b/BUILD/compile-pentium-debug-max @@ -8,6 +8,6 @@ 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" +extra_configs="$extra_configs --with-berkeley-db --with-innodb --enable-local-infile" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-gcov b/BUILD/compile-pentium-gcov index 6b5c432e999..873d1d0d8e8 100755 --- a/BUILD/compile-pentium-gcov +++ b/BUILD/compile-pentium-gcov @@ -4,6 +4,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags -O2 -fprofile-arcs -ftest-coverage" -extra_configs="$pentium_configs $debug_configs --disable-shared" +extra_configs="$pentium_configs $debug_configs --disable-shared $static_link" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-gprof b/BUILD/compile-pentium-gprof index 02b595d1015..aa74de0b1b2 100755 --- a/BUILD/compile-pentium-gprof +++ b/BUILD/compile-pentium-gprof @@ -4,6 +4,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags -O2 -pg -g" -extra_configs="$pentium_configs $debug_configs --disable-shared" +extra_configs="$pentium_configs $debug_configs --disable-shared $static_link" . "$path/FINISH.sh" diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index e9dc3e56d39..0116fac8efd 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -1,11 +1,15 @@ Miguel@light.local -monty@hundin.mysql.fi -paul@central.snake.net -serg@serg.mysql.com -monty@work.mysql.com -sasha@mysql.sashanet.com heikki@donna.mysql.fi +jorge@linux.jorge.mysql.com miguel@light.local -monty@donna.mysql.fi monty@bitch.mysql.fi +monty@donna.mysql.fi +monty@hundin.mysql.fi +monty@tik.mysql.fi +monty@work.mysql.com mwagner@cash.mwagner.org +paul@central.snake.net +sasha@mysql.sashanet.com +serg@serg.mysql.com +heikki@hundin.mysql.fi +jani@hynda.mysql.fi diff --git a/Build-tools/Do-all-build-steps b/Build-tools/Do-all-build-steps index 158c06a04a3..eb14b7105cd 100755 --- a/Build-tools/Do-all-build-steps +++ b/Build-tools/Do-all-build-steps @@ -64,6 +64,7 @@ aclocal; autoheader; aclocal; automake; autoconf --with-mit-threads=yes $EXTRA_CONFIG \ --enable-thread-safe-client \ --with-berkeley-db \ + --enable-local-infile \ --with-innodb gmake -j 2 @@ -71,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 24b70453e5f..4fc0becab71 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -3,30 +3,30 @@ use Getopt::Long; $opt_distribution=$opt_user=$opt_result=$opt_config_options=$opt_config_env=""; $opt_dbd_options=$opt_perl_options=$opt_suffix=""; -$opt_tmp=$version_suffix=""; +$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") || 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); -if ($opt_innodb || $opt_bdb) +if (($opt_innodb || $opt_bdb) && $opt_version_suffix eq "") { - $version_suffix="-max"; + $opt_version_suffix="-max"; } chomp($host=`hostname`); $full_host_name=$host; -info("Compiling MySQL$version_suffix at $host$suffix, stage: $opt_stage\n"); +info("Compiling MySQL$opt_version_suffix at $host$suffix, stage: $opt_stage\n"); $connect_option= ($opt_tcpip ? "--host=$host" : ""); $host =~ /^([^.-]*)/; $host=$1 . $opt_suffix; $email="$opt_user\@mysql.com"; $pwd = `pwd`; chomp($pwd); -$log="$pwd/Logs/$host$version_suffix.log"; -$opt_distribution =~ /(mysql-[^\/]*)\.tar/; +$log="$pwd/Logs/$host$opt_version_suffix.log"; +$opt_distribution =~ /(mysql[^\/]*)\.tar/; $ver=$1; $gcc_version=which("gcc"); if (defined($gcc_version) && ! $opt_config_env) @@ -108,7 +108,7 @@ $|=1; select STDOUT; $|=1; -safe_cd("$host"); +safe_cd($host); if ($opt_stage == 0 && ! $opt_use_old_distribution) { safe_system("gunzip < $opt_distribution | $tar xf -"); @@ -118,6 +118,7 @@ if ($opt_stage == 0 && ! $opt_use_old_distribution) system("touch timestamp; find . -newer timestamp -print | xargs touch; rm -f timestamp"); sleep(2); # Ensure that files we don't want to rebuild are newer than other files + safe_cd($ver); foreach $name ("configure", "Docs/include.texi", "Docs/*.html", "Docs/manual.txt", "Docs/mysql.info", @@ -125,9 +126,11 @@ if ($opt_stage == 0 && ! $opt_use_old_distribution) { system("touch $name"); } + # Fix some file modes in BDB tables that makes life harder. + system("chmod -R u+rw ."); } -safe_cd($ver); +safe_cd("$pwd/$host/$ver"); if ($opt_stage <= 1) { $opt_config_options.=" --with-low-memory" if ($opt_with_low_memory); @@ -144,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 @@ -156,7 +163,7 @@ if ($opt_stage <= 1) { $opt_config_options.= " --with-innodb" } - check_system("$opt_config_env ./configure --prefix=/usr/local/mysql \"--with-comment=Official MySQL$version_suffix binary\" --with-extra-charsets=complex \"--with-server-suffix=$version_suffix\" --enable-thread-safe-client $opt_config_options","Thank you for choosing MySQL"); + check_system("$opt_config_env ./configure --prefix=/usr/local/mysql \"--with-comment=Official MySQL$opt_version_suffix binary\" --with-extra-charsets=complex \"--with-server-suffix=$opt_version_suffix\" --enable-thread-safe-client --enable-local-infile $opt_config_options","Thank you for choosing MySQL"); if (-d "$pwd/$host/include-mysql") { safe_system("cp -r $pwd/$host/include-mysql/* $pwd/$host/$ver/include"); @@ -209,7 +216,7 @@ if ($opt_stage <= 4 && !$opt_no_test) safe_system("gunzip < $tar_file | $tar xf -"); } -$tar_file =~ /(mysql-[^\/]*)\.tar/; +$tar_file =~ /(mysql[^\/]*)\.tar/; $ver=$1; $test_dir="$pwd/$host/test/$ver"; $ENV{"LD_LIBRARY_PATH"}= "$test_dir/lib:" . $ENV{"LD_LIBRARY_PATH"}; @@ -361,6 +368,9 @@ To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3' --dbd-options 'options' Options for Makefile.PL when configuring msql-mysql-modules. +--version-suffix suffix +Can be used to set a suffix (normally 'com' or '-max') for a distribution + --with-low-memory Use less memory when compiling. 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/Build-tools/mysql-copyright b/Build-tools/mysql-copyright index df819b20fa1..0d49acac400 100755 --- a/Build-tools/mysql-copyright +++ b/Build-tools/mysql-copyright @@ -96,7 +96,7 @@ sub main # remove the 'PUBLIC' file from distribution and copy LICENSE # on the toplevel of the directory instead. file 'PUBLIC' shouldn't # exist in the new mysql distributions, but let's be sure.. - `rm -f $destdir/PUBLIC`; + `rm -f $destdir/PUBLIC $destdir/README`; `cp -p $WD/Docs/LICENSE $destdir/`; # fix file copyrights @@ -129,7 +129,7 @@ sub fix_usage_copyright foreach my $Cfile (@Cfiles) { chop $Cfile; - `replace \"This is free software,\\\\\\nand you are welcome to modify and redistribute it under the GPL license\" \"This is commercial software,\\\\nplease see the file LICENSE for details\" -- $Cfile`; + `replace "This is free software," "This is commercial software," "and you are welcome to modify and redistribute it under the GPL license" "please see the file LICENSE for details" -- $Cfile`; } } 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/Docs/manual.texi b/Docs/manual.texi index 367591f6039..a93d5b2194b 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.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 * News-3.23.46:: Changes in release 3.23.46 @@ -46885,13 +46886,74 @@ not yet 100% confident in this code. * News-3.23.0:: Changes in release 3.23.0 @end menu -@node News-3.23.48, News-3.23.47, News-3.23.x, News-3.23.x +@node News-3.23.49, News-3.23.48, News-3.23.x, News-3.23.x +@appendixsubsec Changes in release 3.23.49 +@itemize @bullet +@item +Don't give warning for statement that is only a comment; This is needed for +@code{mysqldump --disable-keys} to work. +@item +Fixed unlikely caching bug when doing a join without keys. In this case +the last used field for a table always returned @code{NULL}. +@item +Added options to make @code{LOAD DATA LOCAL INFILE} more secure. +@item +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. +@end itemize + +@node News-3.23.48, News-3.23.47, News-3.23.49, News-3.23.x @appendixsubsec Changes in release 3.23.48 @itemize @bullet @item +Changed to use @code{autoconf} 2.52 (from @code{autoconf} 2.13) +@item Fixed bug in complicated join with @code{const} tables. @item Added internal safety checks for InnoDB. +@item +Some InnoDB variables was always shown in @code{SHOW VARIABLES} as +@code{OFF} on high-byte-first systems (like sparc). +@item +Fixed problem with one thread using an InnoDB table and another +thread doing an @code{ALTER TABLE} on the same table. Before that, +mysqld could crash with an assertion failure in row0row.c, line 474. +@item +Tuned the InnoDB SQL optimizer to favor more often index searches +over table scans. +@item +Fixed a performance problem with InnoDB tables when several large SELECT +queries are run concurrently on a multiprocessor Linux computer. Large +CPU-bound SELECT queries will now also generally run faster on all +platforms. +@item +If MySQL binlogging is used, InnoDB now prints after crash recovery the +latest MySQL binlog name and the offset InnoDB was able to recover +to. This is useful, for example, when resynchronizing a master and a +slave database in replication. +@item +Added better error messages to help in installation problems of InnoDB tables. +@item +One can now recover also MySQL temporary tables which have become +orphaned inside the InnoDB tablespace. +@item +InnoDB now prevents a @code{FOREIGN KEY} declaration where the signedness +is not the same in the referencing and referenced integer columns. +@item +Calling @code{SHOW CREATE TABLE} or @code{SHOW TABLE STATUS} could cause +memory corruption and make mysqld to crash. Especially at risk was +@code{mysqldump}, because it calls frequently @code{SHOW CREATE TABLE}. +@item +If inserts to several tables containing an auto-inc column were wrapped +inside one @code{LOCK TABLES}, InnoDB asserted in lock0lock.c. +@item +In 3.23.47 we allowed several @code{NULLS} in a @code{UNIQUE} secondary +index for an InnoDB table. But @code{CHECK TABLE} was not relaxed: it +reports the table as corrupt. @code{CHECK TABLE} no longer complains in +this situation. +@item +@code{SHOW GRANTS} now shows @code{REFERENCES} instead of @code{REFERENCE}. @end itemize @node News-3.23.47, News-3.23.46, News-3.23.48, News-3.23.x diff --git a/acconfig.h b/acconfig.h index c6a67ac7f26..3cea5bf4b73 100644 --- a/acconfig.h +++ b/acconfig.h @@ -14,9 +14,16 @@ Leave the following blank line there!! Autoheader needs it. */ +#undef C_ALLOCA + +#undef CRAY_STACKSEG_END + /* Version of .frm files */ #undef DOT_FRM_VERSION +/* If LOAD DATA LOCAL INFILE should be enabled by default */ +#undef ENABLED_LOCAL_INFILE + /* READLINE: */ #undef FIONREAD_IN_SYS_IOCTL @@ -38,6 +45,9 @@ /* atomic_sub() from <asm/atomic.h> (Linux only) */ #undef HAVE_ATOMIC_SUB +/* If we have a working alloca() implementation */ +#undef HAVE_ALLOCA + /* bool is not defined by all C++ compilators */ #undef HAVE_BOOL @@ -212,6 +222,8 @@ /* Needed to get large file supportat HPUX 10.20 */ #undef __STDC_EXT__ +#undef STACK_DIRECTION + #undef STRCOLL_BROKEN #undef STRUCT_DIRENT_HAS_D_FILENO diff --git a/acinclude.m4 b/acinclude.m4 index 1eb95e1e9c9..0f8b076ff62 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -315,14 +315,6 @@ case "x$am_cv_prog_cc_stdc" in esac ]) -# serial 1 - -AC_DEFUN(AM_PROG_INSTALL, -[AC_REQUIRE([AC_PROG_INSTALL]) -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' -AC_SUBST(INSTALL_SCRIPT)dnl -]) - # # Check to make sure that the build environment is sane. # @@ -527,7 +519,7 @@ fi ])dnl AC_DEFUN(MYSQL_STACK_DIRECTION, - AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, + [AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, [AC_TRY_RUN([find_stack_direction () { static char *addr = 0; @@ -546,7 +538,7 @@ AC_DEFUN(MYSQL_STACK_DIRECTION, }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1, ac_cv_c_stack_direction=0)]) AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) -)dnl +])dnl AC_DEFUN(MYSQL_FUNC_ALLOCA, [ @@ -708,6 +700,7 @@ dnl echo "DBG2: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'" no ) bdb_includes= bdb_libs= + bdb_libs_with_path= ;; supplied-two ) MYSQL_CHECK_INSTALLED_BDB([$bdb_includes], [$bdb_libs]) @@ -737,6 +730,7 @@ dnl echo "DBG2: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'" esac bdb_includes= bdb_libs= + bdb_libs_with_path= ;; esac ;; @@ -765,6 +759,7 @@ dnl echo "DBG3: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'" AC_SUBST(bdb_includes) AC_SUBST(bdb_libs) + AC_SUBST(bdb_libs_with_path) ]) AC_DEFUN([MYSQL_CHECK_INSTALLED_BDB], [ @@ -785,6 +780,7 @@ dnl echo ["MYSQL_CHECK_INSTALLED_BDB ($1) ($2)"] MYSQL_TOP_BUILDDIR([lib]) bdb_includes="-I$inc" bdb_libs="-L$lib -ldb" + bdb_libs_with_path="$lib/libdb.a" ]) LDFLAGS="$save_LDFLAGS" else @@ -813,6 +809,7 @@ dnl echo ["MYSQL_CHECK_BDB_DIR ($1)"] MYSQL_TOP_BUILDDIR([dir]) bdb_includes="-I$dir/build_unix" bdb_libs="-L$dir/build_unix -ldb" + bdb_libs_with_path="$dir/build_unix/libdb.a" else bdb_dir_ok="$bdb_version_ok" fi @@ -924,47 +921,48 @@ AC_DEFUN([MYSQL_CHECK_INNODB], [ AC_DEFINE(HAVE_INNOBASE_DB) have_innodb="yes" innodb_includes="-I../innobase/include" + innodb_system_libs="" dnl Some libs are listed several times, in order for gcc to sort out dnl circular references. innodb_libs="\ - ../innobase/usr/libusr.a\ - ../innobase/odbc/libodbc.a\ - ../innobase/srv/libsrv.a\ - ../innobase/que/libque.a\ - ../innobase/srv/libsrv.a\ - ../innobase/dict/libdict.a\ - ../innobase/ibuf/libibuf.a\ - ../innobase/row/librow.a\ - ../innobase/pars/libpars.a\ - ../innobase/btr/libbtr.a\ - ../innobase/trx/libtrx.a\ - ../innobase/read/libread.a\ - ../innobase/usr/libusr.a\ - ../innobase/buf/libbuf.a\ - ../innobase/ibuf/libibuf.a\ - ../innobase/eval/libeval.a\ - ../innobase/log/liblog.a\ - ../innobase/fsp/libfsp.a\ - ../innobase/fut/libfut.a\ - ../innobase/fil/libfil.a\ - ../innobase/lock/liblock.a\ - ../innobase/mtr/libmtr.a\ - ../innobase/page/libpage.a\ - ../innobase/rem/librem.a\ - ../innobase/thr/libthr.a\ - ../innobase/com/libcom.a\ - ../innobase/sync/libsync.a\ - ../innobase/data/libdata.a\ - ../innobase/mach/libmach.a\ - ../innobase/ha/libha.a\ - ../innobase/dyn/libdyn.a\ - ../innobase/mem/libmem.a\ - ../innobase/sync/libsync.a\ - ../innobase/ut/libut.a\ - ../innobase/os/libos.a\ - ../innobase/ut/libut.a" - - AC_CHECK_LIB(rt, aio_read, [innodb_libs="$innodb_libs -lrt"]) + \$(top_builddir)/innobase/usr/libusr.a\ + \$(top_builddir)/innobase/odbc/libodbc.a\ + \$(top_builddir)/innobase/srv/libsrv.a\ + \$(top_builddir)/innobase/dict/libdict.a\ + \$(top_builddir)/innobase/que/libque.a\ + \$(top_builddir)/innobase/srv/libsrv.a\ + \$(top_builddir)/innobase/ibuf/libibuf.a\ + \$(top_builddir)/innobase/row/librow.a\ + \$(top_builddir)/innobase/pars/libpars.a\ + \$(top_builddir)/innobase/btr/libbtr.a\ + \$(top_builddir)/innobase/trx/libtrx.a\ + \$(top_builddir)/innobase/read/libread.a\ + \$(top_builddir)/innobase/usr/libusr.a\ + \$(top_builddir)/innobase/buf/libbuf.a\ + \$(top_builddir)/innobase/ibuf/libibuf.a\ + \$(top_builddir)/innobase/eval/libeval.a\ + \$(top_builddir)/innobase/log/liblog.a\ + \$(top_builddir)/innobase/fsp/libfsp.a\ + \$(top_builddir)/innobase/fut/libfut.a\ + \$(top_builddir)/innobase/fil/libfil.a\ + \$(top_builddir)/innobase/lock/liblock.a\ + \$(top_builddir)/innobase/mtr/libmtr.a\ + \$(top_builddir)/innobase/page/libpage.a\ + \$(top_builddir)/innobase/rem/librem.a\ + \$(top_builddir)/innobase/thr/libthr.a\ + \$(top_builddir)/innobase/com/libcom.a\ + \$(top_builddir)/innobase/sync/libsync.a\ + \$(top_builddir)/innobase/data/libdata.a\ + \$(top_builddir)/innobase/mach/libmach.a\ + \$(top_builddir)/innobase/ha/libha.a\ + \$(top_builddir)/innobase/dyn/libdyn.a\ + \$(top_builddir)/innobase/mem/libmem.a\ + \$(top_builddir)/innobase/sync/libsync.a\ + \$(top_builddir)/innobase/ut/libut.a\ + \$(top_builddir)/innobase/os/libos.a\ + \$(top_builddir)/innobase/ut/libut.a" + + AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"]) ;; * ) AC_MSG_RESULT([Not using Innodb]) @@ -973,6 +971,7 @@ dnl circular references. AC_SUBST(innodb_includes) AC_SUBST(innodb_libs) + AC_SUBST(innodb_system_libs) ]) dnl --------------------------------------------------------------------------- @@ -1103,10 +1102,10 @@ changequote([, ])dnl AC_DEFINE_UNQUOTED([$1], [$]$2, [$3]) fi]) -AC_DEFUN(AC_SYS_LARGEFILE, +AC_DEFUN(MYSQL_SYS_LARGEFILE, [AC_REQUIRE([AC_CANONICAL_HOST]) - AC_ARG_ENABLE(largefile, - [ --disable-largefile Omit support for large files]) + 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) diff --git a/bdb/dist/configure.in b/bdb/dist/configure.in index d5196be9740..6656a588a66 100644 --- a/bdb/dist/configure.in +++ b/bdb/dist/configure.in @@ -21,9 +21,7 @@ AC_SUBST(ADDITIONAL_LANG) AC_SUBST(ADDITIONAL_LIBS) AC_SUBST(ADDITIONAL_OBJS) AC_SUBST(ADDITIONAL_PROGS) -AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) -AC_SUBST(CXX) AC_SUBST(CXXFLAGS) AC_SUBST(DBS_LIBS) AC_SUBST(DEFAULT_INSTALL) @@ -145,55 +143,6 @@ osf*) CPPFLAGS="-D_REENTRANT $CPPFLAGS";; *qnx) AC_DEFINE(HAVE_QNX);; sco3.2v4*) CC=${CC-"cc -belf"} LIBS="-lsocket -lnsl_s $LIBS";; -sco3.2v5*) if test "$GCC" != "yes"; then - CFLAGS="$CFLAGS" - LD='$(CC) $(CFLAGS)' - LIBS="-lsocket -lnsl $LIBS" - CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS" - case "$CFLAGS" in - *-belf*) - AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[ - case "$LDFLAGS" in - *-belf*) ;; - *) echo "Adding -belf option to ldflags." - LDFLAGS="$LDFLAGS -belf" - ;; - esac - ]) - ;; - *) - AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[ - case "$LDFLAGS" in - *-belf*) ;; - *) - echo "Adding -belf option to ldflags." - LDFLAGS="$LDFLAGS -belf" - ;; - esac - ]) - ;; - esac - else - CC="gcc" - LIBS="-lsocket -lnsl $LIBS" - CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS" - fi - ;; -sysv5uw7*) LIBS="-lsocket -lnsl $LIBS" - if test "$GCC" != "yes"; then - # We are using built-in inline function - CC="cc -belf" - CXX="CC -belf" - CFLAGS="$CFLAGS -Kalloca -Kthread" - CXX="$CXX -DNO_CPLUSPLUS_ALLOCA" - LIBS="-Kthread -lsocket -lnsl $LIBS" - else - CFLAGS="$CFLAGS -Kalloca -pthread" - CXX="$CXX -DNO_CPLUSPLUS_ALLOCA" - CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS" - LIBS="-pthread -lsocket -lnsl $LIBS" - fi - ;; sco*) CC=${CC-"cc -belf"} LIBS="-lsocket -lnsl $LIBS";; solaris*) CPPFLAGS="-D_REENTRANT $CPPFLAGS";; @@ -281,6 +230,59 @@ if test "$GXX" = "yes"; then esac fi +dnl Give the OS a last chance to override CFLAGS and LDFLAGS + +case "$host_os" in +sco3.2v5*) + if test "$GCC" != "yes"; then + CFLAGS="$CFLAGS" + LD='$(CC) $(CFLAGS)' + LIBS="-lsocket -lnsl $LIBS" + CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS" + case "$CFLAGS" in + *-belf*) + AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[ + case "$LDFLAGS" in + *-belf*) ;; + *) echo "Adding -belf option to ldflags." + LDFLAGS="$LDFLAGS -belf" + ;; + esac + ]) + ;; + *) + AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[ + case "$LDFLAGS" in + *-belf*) ;; + *) + echo "Adding -belf option to ldflags." + LDFLAGS="$LDFLAGS -belf" + ;; + esac + ]) + ;; + esac + else + CC="gcc" + LIBS="-lsocket -lnsl $LIBS" + CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS" + fi ;; +sysv5uw7*) LIBS="-lsocket -lnsl $LIBS" + if test "$GCC" != "yes"; then + # We are using built-in inline function + CC="cc -belf" + CXX="CC -belf -DNO_CPLUSPLUS_ALLOCA" + CFLAGS="$CFLAGS -Kalloca -Kthread" + LIBS="-Kthread -lsocket -lnsl $LIBS" + else + CFLAGS="$CFLAGS -Kalloca -pthread" + CXX="$CXX -DNO_CPLUSPLUS_ALLOCA" + CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS" + LIBS="-pthread -lsocket -lnsl $LIBS" + fi + ;; +esac + dnl Export our compiler preferences for the libtool configuration. export CC CCC CCC=CXX diff --git a/client/Makefile.am b/client/Makefile.am index d1b16870f67..1710e573d20 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -28,6 +28,7 @@ noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \ client_priv.h mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS) +mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS) mysql_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) mysqladmin_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) mysqlcheck_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) diff --git a/client/client_priv.h b/client/client_priv.h index 261367f7176..56eaf311070 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -30,4 +30,4 @@ enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS, OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE, OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES, - OPT_MASTER_DATA, OPT_AUTOCOMMIT}; + OPT_MASTER_DATA, OPT_AUTOCOMMIT, OPT_LOCAL_INFILE}; diff --git a/client/mysql.cc b/client/mysql.cc index 5ae8df39863..ab8740dbe3c 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -34,7 +34,7 @@ #include "my_readline.h" #include <signal.h> -const char *VER="11.15"; +const char *VER="11.17"; /* Don't try to make a nice table if the data is too big */ #define MAX_COLUMN_LENGTH 1024 @@ -113,10 +113,10 @@ static MYSQL mysql; /* The connection */ static bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0, connected=0,opt_raw_data=0,unbuffered=0,output_tables=0, no_rehash=0,skip_updates=0,safe_updates=0,one_database=0, - opt_compress=0, + opt_compress=0, using_opt_local_infile=0, vertical=0,skip_line_numbers=0,skip_column_names=0,opt_html=0, opt_nopager=1, opt_outfile=0, no_named_cmds=1; -static uint verbose=0,opt_silent=0,opt_mysql_port=0; +static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0; static my_string opt_mysql_unix_port=0; static int connect_flag=CLIENT_INTERACTIVE; static char *current_host,*current_db,*current_user=0,*opt_password=0, @@ -394,6 +394,7 @@ static struct option long_options[] = {"html", no_argument, 0, 'H'}, {"host", required_argument, 0, 'h'}, {"ignore-spaces", no_argument, 0, 'i'}, + {"local-infile", optional_argument, 0, OPT_LOCAL_INFILE}, {"no-auto-rehash",no_argument, 0, 'A'}, {"no-named-commands", no_argument, 0, 'g'}, {"no-tee", no_argument, 0, OPT_NOTEE}, @@ -693,6 +694,10 @@ static int get_options(int argc, char **argv) case 'C': opt_compress=1; break; + case OPT_LOCAL_INFILE: + using_opt_local_infile=1; + opt_local_infile= test(!optarg || atoi(optarg)>0); + break; case 'L': skip_line_numbers=1; break; @@ -1771,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)) @@ -1782,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; } @@ -2105,6 +2116,8 @@ sql_real_connect(char *host,char *database,char *user,char *password, } if (opt_compress) mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS); + if (using_opt_local_infile) + mysql_options(&mysql,MYSQL_OPT_LOCAL_INFILE, (char*) &opt_local_infile); #ifdef HAVE_OPENSSL if (opt_use_ssl) mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, diff --git a/client/mysqldump.c b/client/mysqldump.c index 8020fa58304..b1d3195eba9 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1192,7 +1192,7 @@ static void dumpTable(uint numFields, char *table) fputs(");\n", md_result_file); } - //XML - close table tag and supress regular output + /*XML - close table tag and supress regular output*/ if (opt_xml) fprintf(md_result_file, "\t</%s>\n", table); else if (extended_insert && row_break) @@ -1295,7 +1295,7 @@ static int dump_databases(char **db_names) int result=0; for ( ; *db_names ; db_names++) { - //XML edit - add database element + /*XML edit - add database element*/ if (opt_xml) fprintf(md_result_file, "<%s>\n", *db_names); if (dump_all_tables_in_db(*db_names)) diff --git a/configure.in b/configure.in index 7b0c604d2be..fc63e3f4082 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.48) +AM_INIT_AUTOMAKE(mysql, 3.23.49) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 @@ -65,6 +65,12 @@ AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE") AC_SUBST(MACHINE_TYPE) AC_DEFINE_UNQUOTED(MACHINE_TYPE, "$MACHINE_TYPE") +# Detect intel x86 like processor +BASE_MACHINE_TYPE=$MACHINE_TYPE +case $MACHINE_TYPE in + i?86) BASE_MACHINE_TYPE=i386 ;; +esac + # Save some variables and the command line options for mysqlbug SAVE_CFLAGS="$CFLAGS" SAVE_CXXFLAGS="$CXXFLAGS" @@ -81,7 +87,7 @@ AC_SUBST(CXXLDFLAGS) AC_PREREQ(2.12)dnl Minimum Autoconf version required. AM_MAINTAINER_MODE -AC_ARG_PROGRAM +#AC_ARG_PROGRAM # Automaticly invoked by AM_INIT_AUTOMAKE AM_SANITY_CHECK # This is needed is SUBDIRS is set AC_PROG_MAKE_SET @@ -145,8 +151,10 @@ AM_PROG_LIBTOOL #AC_LIBTOOL_DLOPEN AC_LIBTOOL_WIN32_DLL AC_DISABLE_FAST_INSTALL AC_DISABLE_SHARED AC_DISABLE_STATIC -# AC_PROG_INSTALL We should only need a AM_PROG_INSTALL +# AC_PROG_INSTALL AC_PROG_INSTALL +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + # Not critical since the generated file is distributed AC_PROG_YACC AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf) @@ -179,7 +187,8 @@ AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int"), AC_DEFINE(SPRINTF_RETURNS_GARBAGE) AC_MSG_RESULT("garbage"))) -# option, cache_name, variable +# option, cache_name, variable, +# code to execute if yes, code to exectute if fail AC_DEFUN(AC_SYS_COMPILER_FLAG, [ AC_MSG_CHECKING($1) @@ -188,7 +197,7 @@ AC_DEFUN(AC_SYS_COMPILER_FLAG, [ CFLAGS="[$]OLD_CFLAGS $1" AC_TRY_RUN([int main(){exit(0);}],mysql_cv_option_$2=yes,mysql_cv_option_$2=no,mysql_cv_option_$2=no) - ]) + ]) CFLAGS="[$]OLD_CFLAGS" @@ -288,6 +297,7 @@ AC_SUBST(CFLAGS) AC_SUBST(CXX) AC_SUBST(CXXFLAGS) AC_SUBST(LD) +AC_SUBST(INSTALL_SCRIPT) export CC CFLAGS LD LDFLAGS @@ -416,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 ], [ @@ -429,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" @@ -508,19 +538,29 @@ AC_ARG_ENABLE(thread-safe-client, [ THREAD_SAFE_CLIENT=no ] ) -# Make thread safe client +# compile with strings functions in assembler AC_ARG_ENABLE(assembler, [ --enable-assembler Use assembler versions of some string functions if available.], [ ENABLE_ASSEMBLER=$enableval ], [ ENABLE_ASSEMBLER=no ] ) + +AC_MSG_CHECKING(if we should use assembler functions) # For now we only support assembler on i386 and sparc systems -AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$MACHINE_TYPE" = "i386") -AM_CONDITIONAL(ASSEMBLER_sparc, test "$ENABLE_ASSEMBLER" = "yes" -a "$MACHINE_TYPE" = "sparc") -AM_CONDITIONAL(ASSEMBLER, test ASSEMBLER_x86 = "" -o ASSEMBLER_x86 = "") +AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386") +AM_CONDITIONAL(ASSEMBLER_sparc, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc") +AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc_TRUE" = "") + +if test "$ASSEMBLER_TRUE" = "" +then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi -AC_MSG_CHECKING(whether to use RAID) + +AC_MSG_CHECKING(if we should use RAID) AC_ARG_WITH(raid, [ --with-raid Enable RAID Support], [ USE_RAID=$withval ], @@ -563,9 +603,16 @@ AC_ARG_WITH(mysqld-user, ) AC_SUBST(MYSQLD_USER) -# Use Paul Eggerts macros from GNU tar to check for large file -# support. -AC_SYS_LARGEFILE +# compile with strings functions in assembler +AC_ARG_ENABLE(local-infile, + [ --enable-local-infile + If LOAD DATA LOCAL INFILE is enabled by default.], + [ ENABLED_LOCAL_INFILE=$enablewal ], + [ ENABLED_LOCAL_INFILE=no ] + ) + +# Use Paul Eggerts macros from GNU tar to check for large file support. +MYSQL_SYS_LARGEFILE # Types that must be checked AFTER large file support is checked AC_TYPE_SIZE_T @@ -764,8 +811,8 @@ case $SYSTEM_TYPE in ;; *hpux10.20*) echo "Enabling snprintf workaround for hpux 10.20" - CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ" - CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ" + CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE" + CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE" if test "$with_named_thread" = "no" then echo "Using --with-named-thread=-lpthread" @@ -774,8 +821,8 @@ case $SYSTEM_TYPE in ;; *hpux11.*) echo "Enabling pread/pwrite workaround for hpux 11" - CFLAGS="$CFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK" - CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK" + CFLAGS="$CFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS" + CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS" if test "$with_named_thread" = "no" then echo "Using --with-named-thread=-lpthread" @@ -1419,7 +1466,7 @@ MYSQL_TYPE_QSORT AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF AC_CHECK_FUNCS(alarm bmove \ - chsize ftruncate rint finite fpsetmask fpresetsticky\ + chsize ftruncate rint finite isnan fpsetmask fpresetsticky\ cuserid fcntl fconvert poll \ getrusage getpwuid getcwd getrlimit getwd index stpcpy locking longjmp \ perror pread realpath readlink rename \ @@ -1728,7 +1775,7 @@ AC_ARG_WITH(readline, if test "$with_readline" = "yes" then readline_dir="readline" - readline_link="../readline/libreadline.a" + readline_link="\$(top_builddir)/readline/libreadline.a" else # This requires readline to be in a standard place. Mosty for linux # there readline may be a shared library. @@ -1738,15 +1785,15 @@ fi AC_SUBST(readline_dir) AC_SUBST(readline_link) -# Choose a character set -dnl in order to add new charset, you must add charset name to -dnl CHARSETS_AVAILABLE list and add the charset name to -dnl sql/share/charsets/Index. If the character set uses strcoll -dnl or other special handling, you must also create -dnl strings/ctype-$charset_name.c +dnl In order to add new charset, you must add charset name to +dnl this CHARSETS_AVAILABLE list and sql/share/charsets/Index. +dnl If the character set uses strcoll or other special handling, +dnl you must also create strings/ctype-$charset_name.c +AC_DIVERT_PUSH(0) CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 latin5 swe7 usa7 win1250 win1251 win1251ukr ujis sjis tis620" DEFAULT_CHARSET=latin1 +AC_DIVERT_POP dnl win1251 is deprecated - it's available, but not listed here in the help AC_ARG_WITH(charset, @@ -1996,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) @@ -2086,7 +2139,17 @@ EOF then sql_server_dirs="innobase $sql_server_dirs" echo "CONFIGURING FOR INNODB" - (cd innobase && sh ./configure) \ + if test ! -d "innobase"; then + # This should only happen when doing a VPATH build + echo "NOTICE: I have to make the Innobase directory: `pwd`/innobase" + mkdir "innobase" || exit 1 + fi + rel_srcdir= + case "$srcdir" in + /* ) rel_srcdir="$srcdir" ;; + * ) rel_srcdir="../$srcdir" ;; + esac + (cd innobase && sh $rel_srcdir/innobase/configure) \ || AC_MSG_ERROR([could not configure INNODB]) echo "END OF INNODB CONFIGURATION" @@ -2129,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) @@ -2158,9 +2232,9 @@ AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile \ include/mysql_version.h , , [ test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h - rm -f $AVAILABLE_LANGUAGES_ERRORS_RULES ]) +rm -f $AVAILABLE_LANGUAGES_ERRORS_RULES echo echo "MySQL has a Web site at http://www.mysql.com/ which carries details on the" echo "latest release, upcoming features, and other information to make your" @@ -2170,6 +2244,6 @@ echo echo "Remember to check the platform specific part in the reference manual for" echo "hints about installing on your platfrom. See the Docs directory." echo -# This text is checked in ./Do-compile to se that the configure finished. +# The following text is checked in ./Do-compile to se that the configure ends. echo "Thank you for choosing MySQL!" echo diff --git a/include/mysql.h b/include/mysql.h index bd54be0bc22..0bd5b7092b8 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -143,7 +143,8 @@ struct st_mysql_options { enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, - MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME}; + MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, + MYSQL_OPT_LOCAL_INFILE}; enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT}; diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index da51be11176..a078c843159 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -2552,6 +2552,7 @@ btr_estimate_number_of_different_key_vals( ulint total_external_size = 0; ulint i; ulint j; + ulint add_on; mtr_t mtr; n_cols = dict_index_get_n_unique(index); @@ -2624,8 +2625,25 @@ btr_estimate_number_of_different_key_vals( + not_empty_flag) / (BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size); - } + /* If the tree is small, smaller than < + 10 * BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size, then + the above estimate is ok. For bigger trees it is common that we + do not see any borders between key values in the few pages + we pick. But still there may be BTR_KEY_VAL_ESTIMATE_N_PAGES + different key values, or even more. Let us try to approximate + that: */ + + add_on = index->stat_n_leaf_pages / + (10 * (BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size)); + + if (add_on > BTR_KEY_VAL_ESTIMATE_N_PAGES) { + add_on = BTR_KEY_VAL_ESTIMATE_N_PAGES; + } + + index->stat_n_diff_key_vals[j] += add_on; + } + mem_free(n_diff); } diff --git a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c index c3118544492..a2996eefca9 100644 --- a/innobase/buf/buf0lru.c +++ b/innobase/buf/buf0lru.c @@ -242,7 +242,6 @@ loop: if (n_iterations > 30) { ut_print_timestamp(stderr); fprintf(stderr, - " ***********************************************\n" "InnoDB: Warning: difficult to find free blocks from\n" "InnoDB: the buffer pool (%lu search iterations)! Consider\n" "InnoDB: increasing the buffer pool size.\n", diff --git a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c index f60db829380..f15d36251e4 100644 --- a/innobase/dict/dict0crea.c +++ b/innobase/dict/dict0crea.c @@ -1235,16 +1235,23 @@ loop: if (error != DB_SUCCESS) { fprintf(stderr, - "InnoDB: foreign constraint creation failed;\n" + "InnoDB: Foreign key constraint creation failed:\n" "InnoDB: internal error number %lu\n", error); - ut_a(error == DB_OUT_OF_FILE_SPACE); - - fprintf(stderr, "InnoDB: tablespace is full\n"); - - trx_general_rollback_for_mysql(trx, FALSE, NULL); + if (error == DB_DUPLICATE_KEY) { + fprintf(stderr, + "InnoDB: Duplicate key error in system table %s index %s\n", + ((dict_index_t*)trx->error_info)->table_name, + ((dict_index_t*)trx->error_info)->name); - error = DB_MUST_GET_MORE_FILE_SPACE; + fprintf(stderr, "%s\n", buf); + + fprintf(stderr, + "InnoDB: Maybe the internal data dictionary of InnoDB is\n" + "InnoDB: out-of-sync from the .frm files of your tables.\n" + "InnoDB: See section 15.1 Troubleshooting data dictionary operations\n" + "InnoDB: at http://www.innodb.com/ibman.html\n"); + } return(error); } diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 95f9b54c914..657ce2d6809 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -196,21 +196,6 @@ dict_mutex_exit_for_mysql(void) } /************************************************************************ -Increments the count of open MySQL handles to a table. */ - -void -dict_table_increment_handle_count( -/*==============================*/ - dict_table_t* table) /* in: table */ -{ - mutex_enter(&(dict_sys->mutex)); - - table->n_mysql_handles_opened++; - - mutex_exit(&(dict_sys->mutex)); -} - -/************************************************************************ Decrements the count of open MySQL handles to a table. */ void @@ -496,6 +481,41 @@ dict_table_get( } /************************************************************************** +Returns a table object and increments MySQL open handle count on the table. +*/ + +dict_table_t* +dict_table_get_and_increment_handle_count( +/*======================================*/ + /* out: table, NULL if does not exist */ + char* table_name, /* in: table name */ + trx_t* trx) /* in: transaction handle or NULL */ +{ + dict_table_t* table; + + UT_NOT_USED(trx); + + mutex_enter(&(dict_sys->mutex)); + + table = dict_table_get_low(table_name); + + if (table != NULL) { + + table->n_mysql_handles_opened++; + } + + mutex_exit(&(dict_sys->mutex)); + + if (table != NULL) { + if (!table->stat_initialized) { + dict_update_statistics(table); + } + } + + return(table); +} + +/************************************************************************** Adds a table object to the dictionary cache. */ void @@ -1963,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); diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c index 62389c8394c..138f1a78985 100644 --- a/innobase/fil/fil0fil.c +++ b/innobase/fil/fil0fil.c @@ -1088,7 +1088,15 @@ loop: node = UT_LIST_GET_FIRST(space->chain); for (;;) { - ut_a(node); + if (node == NULL) { + fprintf(stderr, + "InnoDB: Error: trying to access page number %lu in space %lu\n" + "InnoDB: which is outside the tablespace bounds.\n" + "InnoDB: Byte offset %lu, len %lu, i/o type %lu\n", + block_offset, space_id, byte_offset, len, type); + + ut_a(0); + } if (node->size > block_offset) { /* Found! */ diff --git a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h index 79d67ecae15..0f6f516c2cb 100644 --- a/innobase/include/dict0dict.h +++ b/innobase/include/dict0dict.h @@ -27,13 +27,6 @@ Created 1/8/1996 Heikki Tuuri #include "trx0types.h" /************************************************************************ -Increments the count of open MySQL handles to a table. */ - -void -dict_table_increment_handle_count( -/*==============================*/ - dict_table_t* table); /* in: table */ -/************************************************************************ Decrements the count of open MySQL handles to a table. */ void @@ -195,6 +188,16 @@ dict_table_get( char* table_name, /* in: table name */ trx_t* trx); /* in: transaction handle */ /************************************************************************** +Returns a table object and increments MySQL open handle count on the table. +*/ + +dict_table_t* +dict_table_get_and_increment_handle_count( +/*======================================*/ + /* out: table, NULL if does not exist */ + char* table_name, /* in: table name */ + trx_t* trx); /* in: transaction handle or NULL */ +/************************************************************************** Returns a table object, based on table id, and memoryfixes it. */ dict_table_t* diff --git a/innobase/include/log0recv.h b/innobase/include/log0recv.h index 51f14393d38..8f896756db9 100644 --- a/innobase/include/log0recv.h +++ b/innobase/include/log0recv.h @@ -258,6 +258,7 @@ struct recv_sys_struct{ extern recv_sys_t* recv_sys; extern ibool recv_recovery_on; extern ibool recv_no_ibuf_operations; +extern ibool recv_needed_recovery; /* States of recv_addr_struct */ #define RECV_NOT_PROCESSED 71 diff --git a/innobase/include/mem0mem.h b/innobase/include/mem0mem.h index 57fac93d3ac..89c5428f054 100644 --- a/innobase/include/mem0mem.h +++ b/innobase/include/mem0mem.h @@ -269,13 +269,24 @@ mem_realloc( ulint n, /* in: desired number of bytes */ char* file_name,/* in: file name where called */ ulint line); /* in: line where called */ +#ifdef MEM_PERIODIC_CHECK +/********************************************************************** +Goes through the list of all allocated mem blocks, checks their magic +numbers, and reports possible corruption. */ +void +mem_validate_all_blocks(void); +/*=========================*/ +#endif /*#######################################################################*/ /* The info header of a block in a memory heap */ struct mem_block_info_struct { + ulint magic_n;/* magic number for debugging */ + char file_name[8];/* file name where the mem heap was created */ + ulint line; /* line number where the mem heap was created */ UT_LIST_BASE_NODE_T(mem_block_t) base; /* In the first block in the the list this is the base node of the list of blocks; in subsequent blocks this is undefined */ @@ -299,9 +310,11 @@ struct mem_block_info_struct { allocated buffer frame, which can be appended as a free block to the heap, if we need more space; otherwise, this is NULL */ - ulint magic_n;/* magic number for debugging */ - char file_name[8];/* file name where the mem heap was created */ - ulint line; /* line number where the mem heap was created */ +#ifdef MEM_PERIODIC_CHECK + UT_LIST_NODE_T(mem_block_t) mem_block_list; + /* List of all mem blocks allocated; protected + by the mem_comm_pool mutex */ +#endif }; #define MEM_BLOCK_MAGIC_N 764741555 diff --git a/innobase/include/mem0pool.h b/innobase/include/mem0pool.h index eb675b4a7f9..43707bd5f61 100644 --- a/innobase/include/mem0pool.h +++ b/innobase/include/mem0pool.h @@ -72,6 +72,18 @@ mem_pool_get_reserved( /* out: reserved mmeory in bytes */ mem_pool_t* pool); /* in: memory pool */ /************************************************************************ +Reserves the mem pool mutex. */ + +void +mem_pool_mutex_enter(void); +/*======================*/ +/************************************************************************ +Releases the mem pool mutex. */ + +void +mem_pool_mutex_exit(void); +/*=====================*/ +/************************************************************************ Validates a memory pool. */ ibool diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h index 0346299bb10..48b6ba8a715 100644 --- a/innobase/include/row0mysql.h +++ b/innobase/include/row0mysql.h @@ -251,6 +251,24 @@ row_table_add_foreign_constraints( char* name); /* in: table full name in the normalized form database_name/table_name */ /************************************************************************* +The master thread in srv0srv.c calls this regularly to drop tables which +we must drop in background after queries to them have ended. Such lazy +dropping of tables is needed in ALTER TABLE on Unix. */ + +ulint +row_drop_tables_for_mysql_in_background(void); +/*=========================================*/ + /* out: how many tables dropped + + remaining tables in list */ +/************************************************************************* +Get the background drop list length. NOTE: the caller must own the kernel +mutex! */ + +ulint +row_get_background_drop_list_len_low(void); +/*======================================*/ + /* out: how many tables in list */ +/************************************************************************* Drops a table for MySQL. If the name of the dropped table ends to characters INNODB_MONITOR, then this also stops printing of monitor output by the master thread. */ @@ -426,7 +444,7 @@ struct row_prebuilt_struct { fetched row in fetch_cache */ ulint n_fetch_cached; /* number of not yet fetched rows in fetch_cache */ - mem_heap_t* blob_heap; /* in SELECTS BLOB fields are copied + mem_heap_t* blob_heap; /* in SELECTS BLOB fie lds are copied to this heap */ mem_heap_t* old_vers_heap; /* memory heap where a previous version is built in consistent read */ diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index 05989c6410e..01986c759d7 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -249,6 +249,12 @@ mutex, for performace reasons). */ void srv_active_wake_master_thread(void); /*===============================*/ +/*********************************************************************** +Wakes up the master thread if it is suspended or being suspended. */ + +void +srv_wake_master_thread(void); +/*========================*/ /************************************************************************* Puts an OS thread to wait if there are too many concurrent threads (>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */ diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h index d67628b8bad..26c9ace08b6 100644 --- a/innobase/include/trx0trx.h +++ b/innobase/include/trx0trx.h @@ -50,6 +50,13 @@ trx_allocate_for_mysql(void); /*========================*/ /* out, own: transaction object */ /************************************************************************ +Creates a transaction object for background operations by the master thread. */ + +trx_t* +trx_allocate_for_background(void); +/*=============================*/ + /* out, own: transaction object */ +/************************************************************************ Frees a transaction object. */ void @@ -63,6 +70,13 @@ void trx_free_for_mysql( /*===============*/ trx_t* trx); /* in, own: trx object */ +/************************************************************************ +Frees a transaction object of a background operation of the master thread. */ + +void +trx_free_for_background( +/*====================*/ + trx_t* trx); /* in, own: trx object */ /******************************************************************** Creates trx objects for transactions and initializes the trx list of trx_sys at database start. Rollback segment and undo log lists must @@ -266,11 +280,14 @@ struct trx_sig_struct{ transaction is waiting a reply */ }; +#define TRX_MAGIC_N 91118598 + /* The transaction handle; every session has a trx object which is freed only when the session is freed; in addition there may be session-less transactions rolling back after a database recovery */ struct trx_struct{ + ulint magic_n; /* All the next fields are protected by the kernel mutex, except the undo logs which are protected by undo_mutex */ char* op_info; /* English text describing the diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c index 7be172685ae..29e87c7572b 100644 --- a/innobase/log/log0recv.c +++ b/innobase/log/log0recv.c @@ -1020,8 +1020,9 @@ loop: if (recv_addr->state == RECV_NOT_PROCESSED) { if (!has_printed) { + ut_print_timestamp(stderr); fprintf(stderr, -"InnoDB: Starting an apply batch of log records to the database...\n" +" InnoDB: Starting an apply batch of log records to the database...\n" "InnoDB: Progress in percents: "); has_printed = TRUE; } diff --git a/innobase/mem/mem0mem.c b/innobase/mem/mem0mem.c index 58fb618e2db..0680968a7eb 100644 --- a/innobase/mem/mem0mem.c +++ b/innobase/mem/mem0mem.c @@ -50,7 +50,7 @@ of the blocks stay the same. An exception is, of course, the case where the caller requests a memory buffer whose size is bigger than the threshold. In that case a block big enough must be allocated. - + The heap is physically arranged so that if the current block becomes full, a new block is allocated and always inserted in the chain of blocks as the last block. @@ -75,6 +75,14 @@ After freeing, all the blocks in the heap are set to random bytes to help us discover errors which result from the use of buffers in an already freed heap. */ +#ifdef MEM_PERIODIC_CHECK + +ibool mem_block_list_inited; +/* List of all mem blocks allocated; protected by the mem_comm_pool mutex */ +UT_LIST_BASE_NODE_T(mem_block_t) mem_block_list; + +#endif + /******************************************************************* NOTE: Use the corresponding macro instead of this function. Allocates a single buffer of memory from the dynamic memory of @@ -119,6 +127,10 @@ mem_heap_create_block( ut_ad((type == MEM_HEAP_DYNAMIC) || (type == MEM_HEAP_BUFFER) || (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH)); + if (heap && heap->magic_n != MEM_BLOCK_MAGIC_N) { + mem_analyze_corruption((byte*)heap); + } + /* In dynamic allocation, calculate the size: block header + data. */ if (init_block != NULL) { @@ -165,7 +177,19 @@ mem_heap_create_block( 7); block->file_name[7]='\0'; block->line = line; + +#ifdef MEM_PERIODIC_CHECK + mem_pool_mutex_enter(); + + if (!mem_block_list_inited) { + mem_block_list_inited = TRUE; + UT_LIST_INIT(mem_block_list); + } + UT_LIST_ADD_LAST(mem_block_list, mem_block_list, block); + + mem_pool_mutex_exit(); +#endif mem_block_set_len(block, len); mem_block_set_type(block, type); mem_block_set_free(block, MEM_BLOCK_HEADER_SIZE); @@ -251,8 +275,19 @@ mem_heap_block_free( ulint len; ibool init_block; + if (block->magic_n != MEM_BLOCK_MAGIC_N) { + mem_analyze_corruption((byte*)block); + } + UT_LIST_REMOVE(list, heap->base, block); +#ifdef MEM_PERIODIC_CHECK + mem_pool_mutex_enter(); + + UT_LIST_REMOVE(mem_block_list, mem_block_list, block); + + mem_pool_mutex_exit(); +#endif type = heap->type; len = block->len; init_block = block->init_block; @@ -298,3 +333,30 @@ mem_heap_free_block_free( heap->free_block = NULL; } } + +#ifdef MEM_PERIODIC_CHECK +/********************************************************************** +Goes through the list of all allocated mem blocks, checks their magic +numbers, and reports possible corruption. */ + +void +mem_validate_all_blocks(void) +/*=========================*/ +{ + mem_block_t* block; + + mem_pool_mutex_enter(); + + block = UT_LIST_GET_FIRST(mem_block_list); + + while (block) { + if (block->magic_n != MEM_BLOCK_MAGIC_N) { + mem_analyze_corruption((byte*)block); + } + + block = UT_LIST_GET_NEXT(mem_block_list, block); + } + + mem_pool_mutex_exit(); +} +#endif diff --git a/innobase/mem/mem0pool.c b/innobase/mem/mem0pool.c index 48e7e686953..3681c8ef779 100644 --- a/innobase/mem/mem0pool.c +++ b/innobase/mem/mem0pool.c @@ -78,9 +78,9 @@ pool, and after that its locks will grow into the buffer pool. */ /* The smallest memory area total size */ #define MEM_AREA_MIN_SIZE (2 * MEM_AREA_EXTRA_SIZE) + /* Data structure for a memory pool. The space is allocated using the buddy algorithm, where free list i contains areas of size 2 to power i. */ - struct mem_pool_struct{ byte* buf; /* memory pool */ ulint size; /* memory common pool size */ @@ -99,6 +99,26 @@ mem_pool_t* mem_comm_pool = NULL; ulint mem_out_of_mem_err_msg_count = 0; /************************************************************************ +Reserves the mem pool mutex. */ + +void +mem_pool_mutex_enter(void) +/*======================*/ +{ + mutex_enter(&(mem_comm_pool->mutex)); +} + +/************************************************************************ +Releases the mem pool mutex. */ + +void +mem_pool_mutex_exit(void) +/*=====================*/ +{ + mutex_exit(&(mem_comm_pool->mutex)); +} + +/************************************************************************ Returns memory area size. */ UNIV_INLINE ulint @@ -240,15 +260,15 @@ mem_pool_fill_free_list( if (mem_out_of_mem_err_msg_count % 1000000000 == 0) { /* We do not print the message every time: */ + + ut_print_timestamp(stderr); fprintf(stderr, - "Innobase: Warning: out of memory in additional memory pool.\n"); - fprintf(stderr, - "Innobase: Innobase will start allocating memory from the OS.\n"); - fprintf(stderr, - "Innobase: You should restart the database with a bigger value in\n"); - fprintf(stderr, - "Innobase: the MySQL .cnf file for innobase_additional_mem_pool_size.\n"); + " InnoDB: Out of memory in additional memory pool.\n" + "InnoDB: InnoDB will start allocating memory from the OS.\n" + "InnoDB: You may get better performance if you configure a bigger\n" + "InnoDB: value in the MySQL my.cnf file for\n" + "InnoDB: innodb_additional_mem_pool_size.\n"); } mem_out_of_mem_err_msg_count++; diff --git a/innobase/rem/rem0cmp.c b/innobase/rem/rem0cmp.c index 363bb013ac9..60828b122ba 100644 --- a/innobase/rem/rem0cmp.c +++ b/innobase/rem/rem0cmp.c @@ -113,6 +113,16 @@ cmp_types_are_equal( return(FALSE); } + if (type1->mtype == DATA_INT + && (type1->prtype & DATA_UNSIGNED) + != (type2->prtype & DATA_UNSIGNED)) { + /* The storage format of an unsigned integer is different + from a signed integer: in a signed integer we OR + 0x8000... to the value of positive integers. */ + + return(FALSE); + } + if (type1->mtype == DATA_MYSQL || type1->mtype == DATA_VARMYSQL) { diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index c0f527017e0..c4a844b3fa9 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -26,6 +26,19 @@ Created 9/17/2000 Heikki Tuuri #include "trx0purge.h" #include "lock0lock.h" #include "rem0cmp.h" +#include "log0log.h" + +/* List of tables we should drop in background. ALTER TABLE in MySQL requires +that the table handler can drop the table in background when there are no +queries to it any more. Protected by the kernel mutex. */ +typedef struct row_mysql_drop_struct row_mysql_drop_t; +struct row_mysql_drop_struct{ + char* table_name; + UT_LIST_NODE_T(row_mysql_drop_t) row_mysql_drop_list; +}; + +UT_LIST_BASE_NODE_T(row_mysql_drop_t) row_mysql_drop_list; +ibool row_mysql_drop_list_inited = FALSE; /*********************************************************************** Reads a MySQL format variable-length field (like VARCHAR) length and @@ -172,10 +185,22 @@ handle_new_error: trx_general_rollback_for_mysql(trx, TRUE, savept); } } else if (err == DB_TOO_BIG_RECORD) { + if (savept) { + /* Roll back the latest, possibly incomplete + insertion or update */ + + trx_general_rollback_for_mysql(trx, TRUE, savept); + } /* MySQL will roll back the latest SQL statement */ } else if (err == DB_ROW_IS_REFERENCED || err == DB_NO_REFERENCED_ROW || err == DB_CANNOT_ADD_CONSTRAINT) { + if (savept) { + /* Roll back the latest, possibly incomplete + insertion or update */ + + trx_general_rollback_for_mysql(trx, TRUE, savept); + } /* MySQL will roll back the latest SQL statement */ } else if (err == DB_LOCK_WAIT) { @@ -200,6 +225,12 @@ handle_new_error: trx_general_rollback_for_mysql(trx, FALSE, NULL); } else if (err == DB_OUT_OF_FILE_SPACE) { + if (savept) { + /* Roll back the latest, possibly incomplete + insertion or update */ + + trx_general_rollback_for_mysql(trx, TRUE, savept); + } /* MySQL will roll back the latest SQL statement */ } else if (err == DB_MUST_GET_MORE_FILE_SPACE) { @@ -242,8 +273,6 @@ row_create_prebuilt( ulint ref_len; ulint i; - dict_table_increment_handle_count(table); - heap = mem_heap_create(128); prebuilt = mem_heap_alloc(heap, sizeof(row_prebuilt_t)); @@ -375,13 +404,13 @@ row_update_prebuilt_trx( handle */ trx_t* trx) /* in: transaction handle */ { - if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) { + if (trx->magic_n != TRX_MAGIC_N) { fprintf(stderr, - "InnoDB: Error: trying to free a corrupt\n" - "InnoDB: table handle. Magic n %lu, table name %s\n", - prebuilt->magic_n, prebuilt->table->name); + "InnoDB: Error: trying to use a corrupt\n" + "InnoDB: trx handle. Magic n %lu\n", + trx->magic_n); - mem_analyze_corruption((byte*)prebuilt); + mem_analyze_corruption((byte*)trx); ut_a(0); } @@ -1170,8 +1199,11 @@ row_create_table_for_mysql( row_drop_table_for_mysql(table->name, trx, TRUE); } else { ut_a(err == DB_DUPLICATE_KEY); + + ut_print_timestamp(stderr); + fprintf(stderr, - "InnoDB: Error: table %s already exists in InnoDB internal\n" + " InnoDB: Error: table %s already exists in InnoDB internal\n" "InnoDB: data dictionary. Have you deleted the .frm file\n" "InnoDB: and not used DROP TABLE? Have you used DROP DATABASE\n" "InnoDB: for InnoDB tables in MySQL version <= 3.23.43?\n" @@ -1350,6 +1382,177 @@ row_table_add_foreign_constraints( } /************************************************************************* +Drops a table for MySQL as a background operation. MySQL relies on Unix +in ALTER TABLE to the fact that the table handler does not remove the +table before all handles to it has been removed. Furhermore, the MySQL's +call to drop table must be non-blocking. Therefore we do the drop table +as a background operation, which is taken care of by the master thread +in srv0srv.c. */ +static +int +row_drop_table_for_mysql_in_background( +/*===================================*/ + /* out: error code or DB_SUCCESS */ + char* name) /* in: table name */ +{ + ulint error; + trx_t* trx; + + trx = trx_allocate_for_background(); + +/* fprintf(stderr, "InnoDB: Dropping table %s in background drop list\n", + name); */ + /* Drop the table in InnoDB */ + + error = row_drop_table_for_mysql(name, trx, FALSE); + + if (error != DB_SUCCESS) { + fprintf(stderr, + "InnoDB: Error: Dropping table %s in background drop list failed\n", + name); + } + + /* Flush the log to reduce probability that the .frm files and + the InnoDB data dictionary get out-of-sync if the user runs + with innodb_flush_log_at_trx_commit = 0 */ + + log_flush_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP); + + trx_commit_for_mysql(trx); + + trx_free_for_background(trx); + + return(DB_SUCCESS); +} + +/************************************************************************* +The master thread in srv0srv.c calls this regularly to drop tables which +we must drop in background after queries to them have ended. Such lazy +dropping of tables is needed in ALTER TABLE on Unix. */ + +ulint +row_drop_tables_for_mysql_in_background(void) +/*=========================================*/ + /* out: how many tables dropped + + remaining tables in list */ +{ + row_mysql_drop_t* drop; + dict_table_t* table; + ulint n_tables; + ulint n_tables_dropped = 0; +loop: + mutex_enter(&kernel_mutex); + + if (!row_mysql_drop_list_inited) { + + UT_LIST_INIT(row_mysql_drop_list); + row_mysql_drop_list_inited = TRUE; + } + + drop = UT_LIST_GET_FIRST(row_mysql_drop_list); + + n_tables = UT_LIST_GET_LEN(row_mysql_drop_list); + + mutex_exit(&kernel_mutex); + + if (drop == NULL) { + + return(n_tables + n_tables_dropped); + } + + mutex_enter(&(dict_sys->mutex)); + table = dict_table_get_low(drop->table_name); + mutex_exit(&(dict_sys->mutex)); + + if (table == NULL) { + /* If for some reason the table has already been dropped + through some other mechanism, do not try to drop it */ + + goto already_dropped; + } + + if (table->n_mysql_handles_opened > 0) { + + return(n_tables + n_tables_dropped); + } + + n_tables_dropped++; + + row_drop_table_for_mysql_in_background(drop->table_name); + +already_dropped: + mutex_enter(&kernel_mutex); + + UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop); + + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Dropped table %s in background drop queue.\n", + drop->table_name); + + mem_free(drop->table_name); + + mem_free(drop); + + mutex_exit(&kernel_mutex); + + goto loop; +} + +/************************************************************************* +Get the background drop list length. NOTE: the caller must own the kernel +mutex! */ + +ulint +row_get_background_drop_list_len_low(void) +/*======================================*/ + /* out: how many tables in list */ +{ + ut_ad(mutex_own(&kernel_mutex)); + + if (!row_mysql_drop_list_inited) { + + UT_LIST_INIT(row_mysql_drop_list); + row_mysql_drop_list_inited = TRUE; + } + + return(UT_LIST_GET_LEN(row_mysql_drop_list)); +} + +/************************************************************************* +Adds a table to the list of tables which the master thread drops in +background. We need this on Unix because in ALTER TABLE MySQL may call +drop table even if the table has running queries on it. */ +static +void +row_add_table_to_background_drop_list( +/*==================================*/ + dict_table_t* table) /* in: table */ +{ + row_mysql_drop_t* drop; + + drop = mem_alloc(sizeof(row_mysql_drop_t)); + + drop->table_name = mem_alloc(1 + ut_strlen(table->name)); + + ut_memcpy(drop->table_name, table->name, 1 + ut_strlen(table->name)); + + mutex_enter(&kernel_mutex); + + if (!row_mysql_drop_list_inited) { + + UT_LIST_INIT(row_mysql_drop_list); + row_mysql_drop_list_inited = TRUE; + } + + UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list, drop); + +/* fprintf(stderr, "InnoDB: Adding table %s to background drop list\n", + drop->table_name); */ + mutex_exit(&kernel_mutex); +} + +/************************************************************************* Drops a table for MySQL. If the name of the dropped table ends to characters INNODB_MONITOR, then this also stops printing of monitor output by the master thread. */ @@ -1536,9 +1739,10 @@ row_drop_table_for_mysql( if (!table) { err = DB_TABLE_NOT_FOUND; + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Error: table %s does not exist in the InnoDB internal\n" + " InnoDB: Error: table %s does not exist in the InnoDB internal\n" "InnoDB: data dictionary though MySQL is trying to drop it.\n" "InnoDB: Have you copied the .frm file of the table to the\n" "InnoDB: MySQL database directory from another database?\n", @@ -1546,42 +1750,26 @@ row_drop_table_for_mysql( goto funct_exit; } - /* Remove any locks there are on the table or its records */ - - lock_reset_all_on_table(table); -loop: if (table->n_mysql_handles_opened > 0) { - rw_lock_s_unlock(&(purge_sys->purge_is_running)); - - rw_lock_x_unlock(&(dict_foreign_key_check_lock)); - - mutex_exit(&(dict_sys->mutex)); - - if (rounds > 60) { - fprintf(stderr, - "InnoDB: waiting for queries to table %s to end before dropping it\n", - name); - } - - os_thread_sleep(1000000); - - mutex_enter(&(dict_sys->mutex)); - rw_lock_x_lock(&(dict_foreign_key_check_lock)); + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Warning: MySQL is trying to drop table %s\n" + "InnoDB: though there are still open handles to it.\n" + "InnoDB: Adding the table to the background drop queue.\n", + table->name); - rw_lock_s_lock(&(purge_sys->purge_is_running)); + row_add_table_to_background_drop_list(table); - rounds++; + err = DB_SUCCESS; - if (rounds > 120) { - fprintf(stderr, -"InnoDB: Warning: queries to table %s have not ended but we continue anyway\n", - name); - } else { - goto loop; - } + goto funct_exit; } + /* Remove any locks there are on the table or its records */ + + lock_reset_all_on_table(table); + trx->dict_operation = TRUE; trx->table_id = table->id; @@ -1617,6 +1805,8 @@ funct_exit: trx->op_info = ""; + srv_wake_master_thread(); + return((int) err); } @@ -1630,6 +1820,7 @@ row_drop_database_for_mysql( char* name, /* in: database name which ends to '/' */ trx_t* trx) /* in: transaction handle */ { + dict_table_t* table; char* table_name; int err = DB_SUCCESS; @@ -1640,12 +1831,35 @@ row_drop_database_for_mysql( trx->op_info = "dropping database"; trx_start_if_not_started(trx); - +loop: mutex_enter(&(dict_sys->mutex)); while (table_name = dict_get_first_table_name_in_db(name)) { ut_a(memcmp(table_name, name, strlen(name)) == 0); + table = dict_table_get_low(table_name); + + ut_a(table); + + /* Wait until MySQL does not have any queries running on + the table */ + + if (table->n_mysql_handles_opened > 0) { + mutex_exit(&(dict_sys->mutex)); + + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Warning: MySQL is trying to drop database %s\n" + "InnoDB: though there are still open handles to table %s.\n", + name, table_name); + + os_thread_sleep(1000000); + + mem_free(table_name); + + goto loop; + } + err = row_drop_table_for_mysql(table_name, trx, TRUE); mem_free(table_name); @@ -1788,7 +2002,31 @@ row_rename_table_for_mysql( err = trx->error_state; if (err != DB_SUCCESS) { - row_mysql_handle_errors(&err, trx, thr, NULL); + if (err == DB_DUPLICATE_KEY) { + ut_print_timestamp(stderr); + + fprintf(stderr, + " InnoDB: Error: table %s exists in the InnoDB internal data\n" + "InnoDB: dictionary though MySQL is trying rename table %s to it.\n" + "InnoDB: Have you deleted the .frm file and not used DROP TABLE?\n", + new_name, old_name); + + fprintf(stderr, + "InnoDB: If table %s is a temporary table #sql..., then it can be that\n" + "InnoDB: there are still queries running on the table, and it will be\n" + "InnoDB: dropped automatically when the queries end.\n", new_name); + + fprintf(stderr, + "InnoDB: You can drop the orphaned table inside InnoDB by\n" + "InnoDB: creating an InnoDB table with the same name in another\n" + "InnoDB: database and moving the .frm file to the current database.\n" + "InnoDB: Then MySQL thinks the table exists, and DROP TABLE will\n" + "InnoDB: succeed.\n"); + } + + trx->error_state = DB_SUCCESS; + trx_general_rollback_for_mysql(trx, FALSE, NULL); + trx->error_state = DB_SUCCESS; } else { ut_a(dict_table_rename_in_cache(table, new_name)); } @@ -1945,7 +2183,7 @@ row_check_table_for_mysql( ulint ret = DB_SUCCESS; prebuilt->trx->op_info = "checking table"; - + index = dict_table_get_first_index(table); while (index != NULL) { diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index d75783fe425..553c012bf85 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -20,7 +20,7 @@ Windows 2000 will have something called thread pooling Another possibility could be to use some very fast user space thread library. This might confuse NT though. -(c) 1995 InnoDB Oy +(c) 1995 Innobase Oy Created 10/8/1995 Heikki Tuuri *******************************************************/ @@ -49,6 +49,7 @@ Created 10/8/1995 Heikki Tuuri #include "btr0sea.h" #include "dict0load.h" #include "srv0start.h" +#include "row0mysql.h" /* Buffer which can be used in printing fatal error messages */ char srv_fatal_errbuf[5000]; @@ -91,8 +92,43 @@ ibool srv_log_archive_on = TRUE; ulint srv_log_buffer_size = ULINT_MAX; /* size in database pages */ ibool srv_flush_log_at_trx_commit = TRUE; -byte srv_latin1_ordering[256]; /* The sort order table of the latin1 - character set */ +byte srv_latin1_ordering[256] /* The sort order table of the latin1 + character set. The following table is + the MySQL order as of Feb 10th, 2002 */ += { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 +, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F +, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 +, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F +, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27 +, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F +, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37 +, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F +, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47 +, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F +, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57 +, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F +, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47 +, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F +, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57 +, 0x58, 0x59, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F +, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87 +, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F +, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97 +, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F +, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7 +, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF +, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7 +, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF +, 0x41, 0x41, 0x41, 0x41, 0x5C, 0x5B, 0x5C, 0x43 +, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49 +, 0x44, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0x5D, 0xD7 +, 0xD8, 0x55, 0x55, 0x55, 0x59, 0x59, 0xDE, 0xDF +, 0x41, 0x41, 0x41, 0x41, 0x5C, 0x5B, 0x5C, 0x43 +, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49 +, 0x44, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0x5D, 0xF7 +, 0xD8, 0x55, 0x55, 0x55, 0x59, 0x59, 0xDE, 0xFF +}; ibool srv_use_native_aio = FALSE; @@ -1911,17 +1947,12 @@ srv_boot(void) srv_init(); - /* Reserve the first slot for the current thread, i.e., the master - thread */ - - srv_table_reserve_slot(SRV_MASTER); - return(DB_SUCCESS); } /************************************************************************* Reserves a slot in the thread table for the current MySQL OS thread. -NOTE! The server mutex has to be reserved by the caller! */ +NOTE! The kernel mutex has to be reserved by the caller! */ static srv_slot_t* srv_table_reserve_slot_for_mysql(void) @@ -1931,6 +1962,8 @@ srv_table_reserve_slot_for_mysql(void) srv_slot_t* slot; ulint i; + ut_ad(mutex_own(&kernel_mutex)); + i = 0; slot = srv_mysql_table + i; @@ -2352,6 +2385,22 @@ srv_active_wake_master_thread(void) } } +/*********************************************************************** +Wakes up the master thread if it is suspended or being suspended. */ + +void +srv_wake_master_thread(void) +/*========================*/ +{ + srv_activity_count++; + + mutex_enter(&kernel_mutex); + + srv_release_threads(SRV_MASTER, 1); + + mutex_exit(&kernel_mutex); +} + /************************************************************************* The master thread controlling the server. */ @@ -2374,6 +2423,7 @@ srv_master_thread( ulint n_bytes_merged; ulint n_pages_flushed; ulint n_bytes_archived; + ulint n_tables_to_drop; ulint n_ios; ulint n_ios_old; ulint n_ios_very_old; @@ -2415,7 +2465,11 @@ loop: can drop tables lazily after there no longer are SELECT queries to them. */ -/* row_drop_tables_for_mysql_in_background(); */ + srv_main_thread_op_info = "doing background drop tables"; + + row_drop_tables_for_mysql_in_background(); + + srv_main_thread_op_info = ""; if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) { @@ -2465,6 +2519,11 @@ loop: printf("Master thread wakes up!\n"); } +#ifdef MEM_PERIODIC_CHECK + /* Check magic numbers of every allocated mem block once in 10 + seconds */ + mem_validate_all_blocks(); +#endif /* If there were less than 200 i/os during the 10 second period, we assume that there is free disk i/o capacity available, and it makes sense to do a buffer pool flush. */ @@ -2521,6 +2580,12 @@ background_loop: /* In this loop we run background operations when the server is quiet and we also come here about once in 10 seconds */ + srv_main_thread_op_info = "doing background drop tables"; + + n_tables_to_drop = row_drop_tables_for_mysql_in_background(); + + srv_main_thread_op_info = ""; + srv_main_thread_op_info = "flushing buffer pool pages"; /* Flush a few oldest pages to make the checkpoint younger */ @@ -2604,11 +2669,13 @@ background_loop: log_archive_do(FALSE, &n_bytes_archived); if (srv_fast_shutdown && srv_shutdown_state > 0) { - if (n_pages_flushed + n_bytes_archived != 0) { + if (n_tables_to_drop + n_pages_flushed + + n_bytes_archived != 0) { goto background_loop; } - } else if (n_pages_purged + n_bytes_merged + n_pages_flushed + } else if (n_tables_to_drop + + n_pages_purged + n_bytes_merged + n_pages_flushed + n_bytes_archived != 0) { goto background_loop; } @@ -2627,6 +2694,12 @@ suspend_thread: mutex_enter(&kernel_mutex); + if (row_get_background_drop_list_len_low() > 0) { + mutex_exit(&kernel_mutex); + + goto loop; + } + event = srv_suspend_thread(); mutex_exit(&kernel_mutex); diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 93e1addd3c3..f9a13944bb5 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -270,13 +270,18 @@ open_or_create_log_file( } else { *log_file_created = TRUE; + ut_print_timestamp(stderr); + fprintf(stderr, - "InnoDB: Log file %s did not exist: new to be created\n", + " InnoDB: Log file %s did not exist: new to be created\n", name); fprintf(stderr, "InnoDB: Setting log file %s size to %lu MB\n", name, srv_log_file_size >> (20 - UNIV_PAGE_SIZE_SHIFT)); + fprintf(stderr, + "InnoDB: Database physically writes the file full: wait...\n"); + ret = os_file_set_size(name, files[i], srv_calc_low32(srv_log_file_size), srv_calc_high32(srv_log_file_size)); @@ -454,8 +459,9 @@ open_or_create_data_files( one_created = TRUE; if (i > 0) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Data file %s did not exist: new to be created\n", + " InnoDB: Data file %s did not exist: new to be created\n", name); } else { fprintf(stderr, @@ -464,8 +470,9 @@ open_or_create_data_files( *create_new_db = TRUE; } + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Setting file %s size to %lu MB\n", + " InnoDB: Setting file %s size to %lu MB\n", name, (srv_data_file_sizes[i] >> (20 - UNIV_PAGE_SIZE_SHIFT))); @@ -905,6 +912,12 @@ innobase_start_or_create_for_mysql(void) mtr_commit(&mtr); } + if (recv_needed_recovery) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Flushing modified pages from the buffer pool...\n"); + } + log_make_checkpoint_at(ut_dulint_max, TRUE); if (!srv_log_archive_on) { @@ -983,9 +996,8 @@ innobase_shutdown_for_mysql(void) ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Warning: shutting down a not properly started\n"); - ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: or created database!\n"); + " InnoDB: or created database!\n"); } return(DB_SUCCESS); diff --git a/innobase/trx/trx0purge.c b/innobase/trx/trx0purge.c index a91ac135f81..b73629c9fa4 100644 --- a/innobase/trx/trx0purge.c +++ b/innobase/trx/trx0purge.c @@ -226,9 +226,9 @@ trx_purge_sys_create(void) value */ purge_sys->sess = sess_open(com_endpoint, (byte*)"purge_system", 13); - purge_sys->trx = (purge_sys->sess)->trx; + purge_sys->trx = purge_sys->sess->trx; - (purge_sys->trx)->type = TRX_PURGE; + purge_sys->trx->type = TRX_PURGE; ut_a(trx_start_low(purge_sys->trx, ULINT_UNDEFINED)); diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index 43cca5b62b3..6cbf97104b3 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -26,9 +26,9 @@ Created 3/26/1996 Heikki Tuuri /* Copy of the prototype for innobase_mysql_print_thd: this - copy must be equal to the one in mysql/sql/ha_innobase.cc ! */ -void innobase_mysql_print_thd(void* thd); +copy must be equal to the one in mysql/sql/ha_innobase.cc ! */ +void innobase_mysql_print_thd(void* thd); /* Dummy session used currently in MySQL interface */ sess_t* trx_dummy_sess = NULL; @@ -64,6 +64,8 @@ trx_create( trx = mem_alloc(sizeof(trx_t)); + trx->magic_n = TRX_MAGIC_N; + trx->op_info = ""; trx->type = TRX_USER; @@ -158,6 +160,32 @@ trx_allocate_for_mysql(void) } /************************************************************************ +Creates a transaction object for background operations by the master thread. */ + +trx_t* +trx_allocate_for_background(void) +/*=============================*/ + /* out, own: transaction object */ +{ + trx_t* trx; + + mutex_enter(&kernel_mutex); + + /* Open a dummy session */ + + if (!trx_dummy_sess) { + trx_dummy_sess = sess_open(NULL, (byte*)"Dummy sess", + ut_strlen("Dummy sess")); + } + + trx = trx_create(trx_dummy_sess); + + mutex_exit(&kernel_mutex); + + return(trx); +} + +/************************************************************************ Releases the search latch if trx has reserved it. */ void @@ -181,6 +209,11 @@ trx_free( trx_t* trx) /* in, own: trx object */ { ut_ad(mutex_own(&kernel_mutex)); + + ut_a(trx->magic_n == TRX_MAGIC_N); + + trx->magic_n = 11112222; + ut_a(trx->conc_state == TRX_NOT_STARTED); mutex_free(&(trx->undo_mutex)); @@ -242,6 +275,21 @@ trx_free_for_mysql( mutex_exit(&kernel_mutex); } +/************************************************************************ +Frees a transaction object of a background operation of the master thread. */ + +void +trx_free_for_background( +/*====================*/ + trx_t* trx) /* in, own: trx object */ +{ + mutex_enter(&kernel_mutex); + + trx_free(trx); + + mutex_exit(&kernel_mutex); +} + /******************************************************************** Inserts the trx handle in the trx system trx list in the right position. The list is sorted on the trx id so that the biggest id is at the list diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 8a73f694e41..c75bb0ad462 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -61,7 +61,7 @@ static my_bool mysql_client_init=0; uint mysql_port=0; my_string mysql_unix_port=0; -#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES | CLIENT_TRANSACTIONS) +#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS) #ifdef __WIN__ #define CONNECT_TIMEOUT 20 @@ -671,11 +671,12 @@ mysql_free_result(MYSQL_RES *result) ****************************************************************************/ static const char *default_options[]= -{"port","socket","compress","password","pipe", "timeout", "user", - "init-command", "host", "database", "debug", "return-found-rows", - "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath", - "character-set-dir", "default-character-set", "interactive-timeout", - "connect_timeout", +{ + "port","socket","compress","password","pipe", "timeout", "user", + "init-command", "host", "database", "debug", "return-found-rows", + "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath", + "character-set-dir", "default-character-set", "interactive-timeout", + "connect-timeout", "local-infile", "disable-local-infile", NullS }; @@ -710,6 +711,9 @@ static void mysql_read_default_options(struct st_mysql_options *options, opt_arg=end+1; *end=0; /* Remove '=' */ } + /* Change all '_' in variable name to '-' */ + for (end= *option ; (end= strcend(end,'_')) ; ) + *end= '-'; switch (find_type(*option+2,&option_types,2)) { case 1: /* port */ if (opt_arg) @@ -807,7 +811,16 @@ static void mysql_read_default_options(struct st_mysql_options *options, options->charset_name = my_strdup(opt_arg, MYF(MY_WME)); break; case 19: /* Interactive-timeout */ - options->client_flag|=CLIENT_INTERACTIVE; + options->client_flag|= CLIENT_INTERACTIVE; + break; + case 21: + if (!opt_arg || atoi(opt_arg) != 0) + options->client_flag|= CLIENT_LOCAL_FILES; + else + options->client_flag&= ~CLIENT_LOCAL_FILES; + break; + case 22: + options->client_flag&= CLIENT_LOCAL_FILES; break; default: DBUG_PRINT("warning",("unknown option: %s",option[0])); @@ -1006,6 +1019,14 @@ mysql_init(MYSQL *mysql) if (!((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE)) (void) signal(SIGPIPE,pipe_sig_handler); #endif + +/* + Only enable LOAD DATA INFILE by default if configured with + --with-enabled-local-inflile +*/ +#ifdef ENABLED_LOCAL_INFILE + mysql->options.client_flag|= CLIENT_LOCAL_FILES; +#endif return mysql; } @@ -1453,7 +1474,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, if (mysql->options.use_ssl) client_flag|=CLIENT_SSL; #endif /* HAVE_OPENSSL */ - if (db) client_flag|=CLIENT_CONNECT_WITH_DB; #ifdef HAVE_COMPRESS @@ -2267,11 +2287,17 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg) mysql->options.connect_timeout= *(uint*) arg; break; case MYSQL_OPT_COMPRESS: - mysql->options.compress=1; /* Remember for connect */ + mysql->options.compress= 1; /* Remember for connect */ break; case MYSQL_OPT_NAMED_PIPE: mysql->options.named_pipe=1; /* Force named pipe */ break; + case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/ + if (!arg || test(*(uint*) arg)) + mysql->options.client_flag|= CLIENT_LOCAL_FILES; + else + mysql->options.client_flag&= ~CLIENT_LOCAL_FILES; + break; case MYSQL_INIT_COMMAND: my_free(mysql->options.init_command,MYF(MY_ALLOW_ZERO_PTR)); mysql->options.init_command=my_strdup(arg,MYF(MY_WME)); diff --git a/myisam/myisampack.c b/myisam/myisampack.c index 7ee0ff61204..98fa8fcb377 100644 --- a/myisam/myisampack.c +++ b/myisam/myisampack.c @@ -283,7 +283,7 @@ static void usage(void) -?, --help Display this help and exit.\n\ -V, --version Output version information and exit."); print_defaults("my",load_default_groups); -}; +} /* reads options */ /* Initiates DEBUG - but no debugging here ! */ diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index daf8b8abd03..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" @@ -266,7 +270,6 @@ fi [ -z "$COLUMNS" ] && COLUMNS=80 E=`$EXPR $COLUMNS - 8` -#DASH72=`$EXPR substr '------------------------------------------------------------------------' 1 $E` DASH72=`$ECHO '------------------------------------------------------------------------'|$CUT -c 1-$E` # on source dist, we pick up freshly build executables @@ -906,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` diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 63674d050c1..d13347b7903 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -134,8 +134,8 @@ Table Op Msg_type Msg_text test.t1 optimize error The handler for the table doesn't support check/repair Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment t1 0 PRIMARY 1 id A 87 NULL NULL -t1 1 parent_id 1 parent_id A 21 NULL NULL -t1 1 level 1 level A 4 NULL NULL +t1 1 parent_id 1 parent_id A 43 NULL NULL +t1 1 level 1 level A 8 NULL NULL gesuchnr benutzer_id 1 1 2 1 @@ -150,7 +150,7 @@ a b Table Op Msg_type Msg_text test.t1 analyze error The handler for the table doesn't support check/repair Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment -t1 1 skr 1 a A 1 NULL NULL +t1 1 skr 1 a A 3 NULL NULL a b 1 n after rollback @@ -438,7 +438,7 @@ hello 1 Table Op Msg_type Msg_text test.t1 optimize error The handler for the table doesn't support check/repair Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment -t1 0 PRIMARY 1 a A 1 NULL NULL +t1 0 PRIMARY 1 a A 2 NULL NULL i j 1 2 i j diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index 6c7284e4a37..c99c63245dd 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -31,3 +31,6 @@ COUNT(t1.Title) 1 COUNT(t1.Title) 1 +t1_id t2_id type cost_unit min_value max_value t3_id item_id id name +22 1 Percent Cost 100 -1 6 291 1 s1 +23 1 Percent Cost 100 -1 21 291 1 s1 diff --git a/mysql-test/t/comments.test b/mysql-test/t/comments.test index a85419c0295..2fc6237907c 100644 --- a/mysql-test/t/comments.test +++ b/mysql-test/t/comments.test @@ -5,7 +5,7 @@ select 1+2/*hello*/+3; select 1 /* long multi line comment */; -!$1065 /* empty query */; +!$1065 ; select 1 /*!32301 +1 */; select 1 /*!52301 +1 */; select 1--1; @@ -15,3 +15,4 @@ select 1 --2 +1; select 1 # The rest of the row will be ignored ; +/* line with only comment */; diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 32ce4947b91..9db520a5edf 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -194,3 +194,27 @@ t3.Contractor_ID = '999999' OR t3.Contractor_ID = '1') AND t3.CanRead='1' AND t3.Active='1'; drop table t1,t2,t3; + +# +# Bug when doing full join and NULL fields. +# + +CREATE TABLE t1 ( + t1_id int(11) default NULL, + t2_id int(11) default NULL, + type enum('Cost','Percent') default NULL, + cost_unit enum('Cost','Unit') default NULL, + min_value double default NULL, + max_value double default NULL, + t3_id int(11) default NULL, + item_id int(11) default NULL +) TYPE=MyISAM; +INSERT INTO t1 VALUES (12,5,'Percent','Cost',-1,0,-1,-1),(14,4,'Percent','Cost',-1,0,-1,-1),(18,5,'Percent','Cost',-1,0,-1,-1),(19,4,'Percent','Cost',-1,0,-1,-1),(20,5,'Percent','Cost',100,-1,22,291),(21,5,'Percent','Cost',100,-1,18,291),(22,1,'Percent','Cost',100,-1,6,291),(23,1,'Percent','Cost',100,-1,21,291),(24,1,'Percent','Cost',100,-1,9,291),(25,1,'Percent','Cost',100,-1,4,291),(26,1,'Percent','Cost',100,-1,20,291),(27,4,'Percent','Cost',100,-1,7,202),(28,1,'Percent','Cost',50,-1,-1,137),(29,2,'Percent','Cost',100,-1,4,354),(30,2,'Percent','Cost',100,-1,9,137),(93,2,'Cost','Cost',-1,10000000,-1,-1); +CREATE TABLE t2 ( + id int(10) unsigned NOT NULL auto_increment, + name varchar(255) default NULL, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5'); +select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2; +drop table t1,t2; diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 6dd9bb06fe9..73cd9768013 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -30,7 +30,8 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \ my_lock.c mf_brkhant.c my_alarm.c \ my_malloc.c my_realloc.c my_once.c mulalloc.c \ - my_alloc.c safemalloc.c my_fopen.c my_fstream.c \ + my_alloc.c safemalloc.c my_new.cc \ + my_fopen.c my_fstream.c \ my_error.c errors.c my_div.c my_messnc.c \ mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \ my_symlink.c my_symlink2.c \ diff --git a/mysys/my_new.cc b/mysys/my_new.cc new file mode 100644 index 00000000000..5cc291af9aa --- /dev/null +++ b/mysys/my_new.cc @@ -0,0 +1,49 @@ +/* Copyright (C) 2000 MySQL AB + + 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. + + 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 General Public License for more details. + + 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 */ + +/* + This is a replacement of new/delete operators to be used when compiling + with gcc 3.0.x to avoid including libstdc++ +*/ + +#include "mysys_priv.h" + +#ifdef USE_MYSYS_NEW + +void *operator new (size_t sz) +{ + return (void *) malloc (sz ? sz+1 : sz); +} + +void *operator new[] (size_t sz) +{ + return (void *) malloc (sz ? sz+1 : sz); +} + +void operator delete (void *ptr) +{ + if (ptr) + free(ptr); +} + +void operator delete[] (void *ptr) throw () +{ + if (ptr) + free(ptr); +} + +#endif /* USE_MYSYS_NEW */ + diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 45fbe275476..18957b6422d 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -71,7 +71,7 @@ CLEANFILES = @server_scripts@ \ SUPERCLEANFILES = mysqlbug # We want the right version and configure comand line in mysqlbug -mysqlbug: ${top_builddir}/config.status ${top_builddir}/config.cache mysqlbug.sh +mysqlbug: ${top_builddir}/config.status mysqlbug.sh SUFFIXES = .sh diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index a923a259ebd..2cdf15ce974 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -16,7 +16,7 @@ /* This file defines the InnoDB handler: the interface between MySQL and InnoDB */ - + /* TODO list for the InnoDB handler: - Ask Monty if strings of different languages can exist in the same database. Answer: in near future yes, but not yet. @@ -85,7 +85,7 @@ long innobase_mirrored_log_groups, innobase_log_files_in_group, char *innobase_data_home_dir, *innobase_data_file_path; char *innobase_log_group_home_dir, *innobase_log_arch_dir; char *innobase_unix_file_flush_method; -bool innobase_flush_log_at_trx_commit, innobase_log_archive, +my_bool innobase_flush_log_at_trx_commit, innobase_log_archive, innobase_use_native_aio, innobase_fast_shutdown; /* innobase_data_file_path=ibdata:15,idata2:1,... */ @@ -229,7 +229,7 @@ convert_error_code_to_mysql( extern "C" { /***************************************************************** Prints info of a THD object (== user session thread) to the -standatd output. NOTE that mysql/innobase/trx/trx0trx.c must contain +standard output. NOTE that mysql/innobase/trx/trx0trx.c must contain the prototype for this function! */ void @@ -298,6 +298,8 @@ check_trx_exists( thd->transaction.stmt.innobase_tid = (void*)&innodb_dummy_stmt_trx_handle; + } else { + ut_a(trx->magic_n == TRX_MAGIC_N); } return(trx); @@ -835,6 +837,7 @@ innobase_close_connection( whose transaction should be rolled back */ { if (NULL != thd->transaction.all.innobase_tid) { + trx_rollback_for_mysql((trx_t*) (thd->transaction.all.innobase_tid)); trx_free_for_mysql((trx_t*) @@ -978,7 +981,10 @@ ha_innobase::open( /* Get pointer to a table object in InnoDB dictionary cache */ - if (NULL == (ib_table = dict_table_get(norm_name, NULL))) { + ib_table = dict_table_get_and_increment_handle_count( + norm_name, NULL); + + if (NULL == ib_table) { fprintf(stderr, "InnoDB: Error: cannot find table %s from the internal data dictionary\n" @@ -2435,44 +2441,6 @@ ha_innobase::position( ref_stored_len = len; } -/*********************************************************************** -Tells something additional to the handler about how to do things. */ - -int -ha_innobase::extra( -/*===============*/ - /* out: 0 or error number */ - enum ha_extra_function operation) - /* in: HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE */ -{ - row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; - - switch (operation) { - case HA_EXTRA_RESET: - case HA_EXTRA_RESET_STATE: - prebuilt->read_just_key = 0; - break; - case HA_EXTRA_NO_KEYREAD: - prebuilt->read_just_key = 0; - break; - case HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE: - prebuilt->in_update_remember_pos = FALSE; - break; - case HA_EXTRA_KEYREAD: - prebuilt->read_just_key = 1; - break; - default:/* Do nothing */ - ; - } - - return(0); -} - -int ha_innobase::reset(void) -{ - return(0); -} - /********************************************************************* Creates a table definition to an InnoDB database. */ static @@ -2839,6 +2807,16 @@ innobase_drop_database( namebuf[len] = '/'; namebuf[len + 1] = '\0'; +#ifdef __WIN__ + /* Put to lower case */ + + ptr = namebuf; + + while (*ptr != '\0') { + *ptr = tolower(*ptr); + ptr++; + } +#endif trx = trx_allocate_for_mysql(); error = row_drop_database_for_mysql(namebuf, trx); @@ -2953,9 +2931,9 @@ ha_innobase::records_in_range( DBUG_ENTER("records_in_range"); - if (prebuilt->trx) { - prebuilt->trx->op_info = "estimating range size"; - } + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ active_index = keynr; @@ -2989,10 +2967,6 @@ ha_innobase::records_in_range( my_free((char*) key_val_buff2, MYF(0)); - if (prebuilt->trx) { - prebuilt->trx->op_info = ""; - } - DBUG_RETURN((ha_rows) n_rows); } @@ -3013,10 +2987,9 @@ ha_innobase::estimate_number_of_rows(void) ulonglong estimate; ulonglong data_file_length; - if (prebuilt->trx) { - prebuilt->trx->op_info = - "estimating upper bound of table size"; - } + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ DBUG_ENTER("info"); @@ -3033,10 +3006,6 @@ ha_innobase::estimate_number_of_rows(void) estimate = 2 * data_file_length / dict_index_calc_min_rec_len(index); - if (prebuilt->trx) { - prebuilt->trx->op_info = ""; - } - return((ha_rows) estimate); } @@ -3052,10 +3021,12 @@ ha_innobase::scan_time() { row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; - /* In the following formula we assume that scanning 10 pages - takes the same time as a disk seek: */ - - return((double) (prebuilt->table->stat_clustered_index_size / 10)); + /* Since MySQL seems to favor table scans too much over index + searches, we pretend that a sequential read takes the same time + as a random disk read, that is, we do not divide the following + by 10, which would be physically realistic. */ + + return((double) (prebuilt->table->stat_clustered_index_size)); } /************************************************************************* @@ -3076,10 +3047,10 @@ ha_innobase::info( DBUG_ENTER("info"); - if (prebuilt->trx) { - prebuilt->trx->op_info = "calculating table stats"; - } - + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ + ib_table = prebuilt->table; if (flag & HA_STATUS_TIME) { @@ -3126,6 +3097,13 @@ ha_innobase::info( index->stat_n_diff_key_vals[j + 1]); } + /* Since MySQL seems to favor table scans + too much over index searches, we pretend + index selectivity is 2 times better than + our estimate: */ + + rec_per_key = rec_per_key / 2; + if (rec_per_key == 0) { rec_per_key = 1; } @@ -3145,15 +3123,13 @@ ha_innobase::info( pointer and cause a seg fault. */ if (flag & HA_STATUS_ERRKEY) { + ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N); + errkey = (unsigned int) row_get_mysql_key_number_for_index( (dict_index_t*) trx_get_error_info(prebuilt->trx)); } - if (prebuilt->trx) { - prebuilt->trx->op_info = ""; - } - DBUG_VOID_RETURN; } @@ -3173,7 +3149,9 @@ ha_innobase::check( { row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; ulint ret; - + + ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N); + if (prebuilt->mysql_template == NULL) { /* Build the template; we will use a dummy template in index scans done in checking */ @@ -3207,6 +3185,10 @@ ha_innobase::update_table_comment( char* str = my_malloc(length + 550, MYF(0)); char* pos; + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ + if (!str) { return((char*)comment); } @@ -3228,6 +3210,53 @@ ha_innobase::update_table_comment( return(str); } +/*********************************************************************** +Tells something additional to the handler about how to do things. */ + +int +ha_innobase::extra( +/*===============*/ + /* out: 0 or error number */ + enum ha_extra_function operation) + /* in: HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE */ +{ + row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; + + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ + + switch (operation) { + case HA_EXTRA_RESET: + case HA_EXTRA_RESET_STATE: + prebuilt->read_just_key = 0; + break; + case HA_EXTRA_NO_KEYREAD: + prebuilt->read_just_key = 0; + break; + case HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE: + prebuilt->in_update_remember_pos = FALSE; + break; + case HA_EXTRA_KEYREAD: + prebuilt->read_just_key = 1; + break; + default:/* Do nothing */ + ; + } + + return(0); +} + +/********************************************************************** +????????????? */ + +int +ha_innobase::reset(void) +/*====================*/ +{ + return(0); +} + /********************************************************************** As MySQL will execute an external lock for every new table it uses when it starts to process an SQL statement, we can use this function to store the @@ -3452,5 +3481,4 @@ ha_innobase::get_auto_increment() return(nr); } - #endif /* HAVE_INNOBASE_DB */ diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h index 54449a1ef2b..ec77cd1a70f 100644 --- a/sql/ha_innobase.h +++ b/sql/ha_innobase.h @@ -174,8 +174,9 @@ extern long innobase_force_recovery, innobase_thread_concurrency; extern char *innobase_data_home_dir, *innobase_data_file_path; extern char *innobase_log_group_home_dir, *innobase_log_arch_dir; extern char *innobase_unix_file_flush_method; -extern bool innobase_flush_log_at_trx_commit, innobase_log_archive, - innobase_use_native_aio, innobase_fast_shutdown; +/* The following variables have to be my_bool for SHOW VARIABLES to work */ +extern my_bool innobase_flush_log_at_trx_commit, innobase_log_archive, + innobase_use_native_aio, innobase_fast_shutdown; extern TYPELIB innobase_lock_typelib; diff --git a/sql/handler.cc b/sql/handler.cc index c1e28b0058e..5a713bccc1e 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -257,28 +257,31 @@ int ha_autocommit_or_rollback(THD *thd, int error) DBUG_RETURN(error); } -/* This function is called when MySQL writes the log segment of a transaction -to the binlog. It is called when the LOCK_log mutex is reserved. Here we -communicate to transactional table handlers whta binlog position corresponds -to the current transaction. The handler can store it and in recovery print -to the user, so that the user knows from what position in the binlog to -start possible roll-forward, for example, if the crashed server was a slave -in replication. This function also calls the commit of the table handler, -because the order of trasnactions in the log of the table handler must be -the same as in the binlog. */ - -int ha_report_binlog_offset_and_commit( - THD *thd, /* in: user thread */ - char *log_file_name, /* in: latest binlog file name */ - my_off_t end_offset) /* in: the offset in the binlog file - up to which we wrote */ +/* + This function is called when MySQL writes the log segment of a + transaction to the binlog. It is called when the LOCK_log mutex is + reserved. Here we communicate to transactional table handlers whta + binlog position corresponds to the current transaction. The handler + can store it and in recovery print to the user, so that the user + knows from what position in the binlog to start possible + roll-forward, for example, if the crashed server was a slave in + replication. This function also calls the commit of the table + handler, because the order of trasnactions in the log of the table + handler must be the same as in the binlog. + + arguments: + log_file_name: latest binlog file name + end_offset: the offset in the binlog file up to which we wrote +*/ + +int ha_report_binlog_offset_and_commit(THD *thd, + char *log_file_name, + my_off_t end_offset) { + int error= 0; +#ifdef HAVE_INNOBASE_DB THD_TRANS *trans; - int error = 0; - trans = &thd->transaction.all; - -#ifdef HAVE_INNOBASE_DB if (trans->innobase_tid) { if ((error=innobase_report_binlog_offset_and_commit(thd, @@ -292,10 +295,10 @@ int ha_report_binlog_offset_and_commit( trans->innodb_active_trans=0; } #endif - return error; } + int ha_commit_trans(THD *thd, THD_TRANS* trans) { int error=0; diff --git a/sql/my_lock.c b/sql/my_lock.c index 7025682d40e..647c07a03c3 100644 --- a/sql/my_lock.c +++ b/sql/my_lock.c @@ -26,10 +26,6 @@ #include <thr_alarm.h> #include <errno.h> -#ifdef HAVE_FCNTL -static struct flock lock; /* Must be static for sun-sparc */ -#endif - /* Lock a part of a file */ int my_lock(File fd,int locktype,my_off_t start,my_off_t length,myf MyFlags) @@ -37,24 +33,25 @@ int my_lock(File fd,int locktype,my_off_t start,my_off_t length,myf MyFlags) thr_alarm_t alarmed; ALARM alarm_buff; uint wait_for_alarm; + struct flock m_lock; DBUG_ENTER("my_lock"); DBUG_PRINT("my",("Fd: %d Op: %d start: %ld Length: %ld MyFlags: %d", fd,locktype,(ulong) start,(ulong) length,MyFlags)); if (my_disable_locking) DBUG_RETURN(0); /* purecov: inspected */ - lock.l_type=(short) locktype; - lock.l_whence=0L; - lock.l_start=(long) start; - lock.l_len=(long) length; + m_lock.l_type=(short) locktype; + m_lock.l_whence=0L; + m_lock.l_start=(long) start; + m_lock.l_len=(long) length; wait_for_alarm=(MyFlags & MY_DONT_WAIT ? MY_HOW_OFTEN_TO_ALARM : (uint) 12*60*60); - if (fcntl(fd,F_SETLK,&lock) != -1) /* Check if we can lock */ + if (fcntl(fd,F_SETLK,&m_lock) != -1) /* Check if we can lock */ DBUG_RETURN(0); /* Ok, file locked */ DBUG_PRINT("info",("Was locked, trying with alarm")); if (!thr_alarm(&alarmed,wait_for_alarm,&alarm_buff)) { int value; - while ((value=fcntl(fd,F_SETLKW,&lock)) && !thr_got_alarm(&alarmed) && + while ((value=fcntl(fd,F_SETLKW,&m_lock)) && !thr_got_alarm(&alarmed) && errno == EINTR) ; thr_end_alarm(&alarmed); if (value != -1) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index a569fecfc9d..657ca3274cd 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -158,7 +158,8 @@ void kill_one_thread(THD *thd, ulong id); #define OPTION_LOW_PRIORITY_UPDATES 8192 #define OPTION_WARNINGS 16384 #define OPTION_AUTO_IS_NULL 32768 -#define OPTION_SAFE_UPDATES 65536L*2 +#define OPTION_FOUND_COMMENT 65536L +#define OPTION_SAFE_UPDATES OPTION_FOUND_COMMENT*2 #define OPTION_BUFFER_RESULT OPTION_SAFE_UPDATES*2 #define OPTION_BIN_LOG OPTION_BUFFER_RESULT*2 #define OPTION_NOT_AUTO_COMMIT OPTION_BIN_LOG*2 @@ -524,7 +525,7 @@ extern pthread_cond_t COND_refresh,COND_thread_count, COND_binlog_update, COND_slave_stopped, COND_slave_start; extern pthread_attr_t connection_attrib; extern bool opt_endinfo, using_udf_functions, locked_in_memory, - opt_using_transactions, use_temp_pool; + opt_using_transactions, use_temp_pool, opt_local_infile; extern char f_fyllchar; extern ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count, ha_read_key_count, ha_read_next_count, ha_read_prev_count, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index be20c5fa964..09c05a6463f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -287,6 +287,7 @@ ulong bytes_sent = 0L, bytes_received = 0L; bool opt_endinfo,using_udf_functions,low_priority_updates, locked_in_memory; bool opt_using_transactions, using_update_log, opt_warnings=0; +bool opt_local_infile=1; bool volatile abort_loop,select_thread_in_use,grant_option; bool volatile ready_to_exit,shutdown_in_progress; ulong refresh_version=1L,flush_version=1L; /* Increments on each reload */ @@ -683,8 +684,9 @@ pthread_handler_decl(kill_server_thread,arg __attribute__((unused))) static sig_handler print_signal_warning(int sig) { - sql_print_error("Warning: Got signal %d from thread %d", - sig,my_thread_id()); + if (opt_warnings) + sql_print_error("Warning: Got signal %d from thread %d", + sig,my_thread_id()); #ifdef DONT_REMEMBER_SIGNAL sigset(sig,print_signal_warning); /* int. thread system calls */ #endif @@ -2612,7 +2614,7 @@ enum options { OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL, OPT_SAFE_USER_CREATE, OPT_SQL_MODE, - OPT_SLAVE_SKIP_ERRORS + OPT_SLAVE_SKIP_ERRORS, OPT_LOCAL_INFILE }; static struct option long_options[] = { @@ -2676,6 +2678,7 @@ static struct option long_options[] = { {"init-file", required_argument, 0, (int) OPT_INIT_FILE}, {"log", optional_argument, 0, 'l'}, {"language", required_argument, 0, 'L'}, + {"local-infile", optional_argument, 0, (int) OPT_LOCAL_INFILE}, {"log-bin", optional_argument, 0, (int) OPT_BIN_LOG}, {"log-bin-index", required_argument, 0, (int) OPT_BIN_LOG_INDEX}, {"log-isam", optional_argument, 0, (int) OPT_ISAM_LOG}, @@ -3183,10 +3186,11 @@ static void use_help(void) static void usage(void) { print_version(); - puts("Copyright (C) 2000 MySQL AB & MySQL Finland AB, by Monty and others"); - puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); - puts("and you are welcome to modify and redistribute it under the GPL license\n"); - puts("Starts the MySQL server\n"); + puts("\ +Copyright (C) 2000 MySQL AB, by Monty and others\n\ +This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ +and you are welcome to modify and redistribute it under the GPL license\n\ +Starts the MySQL server\n"); printf("Usage: %s [OPTIONS]\n", my_progname); puts("\n\ @@ -3467,6 +3471,9 @@ static void get_options(int argc,char **argv) case 'P': mysql_port= (unsigned int) atoi(optarg); break; + case OPT_LOCAL_INFILE: + opt_local_infile= test(!optarg || atoi(optarg) != 0); + break; case OPT_SLAVE_SKIP_ERRORS: init_slave_skip_errors(optarg); break; diff --git a/sql/slave.cc b/sql/slave.cc index ee8b82052b7..cff3af42ce1 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -79,7 +79,6 @@ static byte* get_table_key(TABLE_RULE_ENT* e, uint* len, void init_slave_skip_errors(char* arg) { char* p; - my_bool last_was_digit = 0; if (bitmap_init(&slave_error_mask,MAX_SLAVE_ERROR,0)) { fprintf(stderr, "Badly out of memory, please check your system status\n"); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ce66b60a49f..7ad778cf5d0 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2315,7 +2315,7 @@ uint get_column_grant(THD *thd, TABLE_LIST *table, Field *field) static const char *command_array[]= {"SELECT", "INSERT","UPDATE","DELETE","CREATE", "DROP","RELOAD","SHUTDOWN", "PROCESS","FILE","GRANT","REFERENCES","INDEX","ALTER"}; -static int command_lengths[]={6,6,6,6,6,4,6,8,7,4,5,9,5,5}; +static int command_lengths[]={6,6,6,6,6,4,6,8,7,4,5,10,5,5}; int mysql_show_grants(THD *thd,LEX_USER *lex_user) { diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 358850dbd10..1e798a392b1 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -164,8 +164,6 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists) } remove_db_from_cache(db); - ha_drop_database(path); - if ((deleted=mysql_rm_known_files(thd, dirp, path,0)) >= 0) { if (!thd->query) @@ -191,6 +189,14 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists) exit: VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_mysql_create_db)); + + /* It seems MySQL may call this function when there still are queries + running on tables of the database. Since InnoDB waits until the + queries have ended, we have to call ha_drop_database outside + the above two mutexes to avoid deadlocks. */ + + ha_drop_database(path); + DBUG_VOID_RETURN; } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7c3b933bbd7..a3c3db8947e 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -734,6 +734,7 @@ int yylex(void *arg) return(TEXT_STRING); case STATE_COMMENT: // Comment + lex->options|= OPTION_FOUND_COMMENT; while ((c = yyGet()) != '\n' && c) ; yyUnget(); // Safety against eof state = STATE_START; // Try again @@ -745,6 +746,7 @@ int yylex(void *arg) break; } yySkip(); // Skip '*' + lex->options|= OPTION_FOUND_COMMENT; if (yyPeek() == '!') // MySQL command in comment { ulong version=MYSQL_VERSION_ID; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 7555d605e35..2b889d356bb 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -53,7 +53,7 @@ enum enum_sql_command { SQLCOM_BEGIN, SQLCOM_LOAD_MASTER_TABLE, SQLCOM_CHANGE_MASTER, SQLCOM_RENAME_TABLE, SQLCOM_BACKUP_TABLE, SQLCOM_RESTORE_TABLE, SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_SHOW_BINLOGS, - SQLCOM_SHOW_OPEN_TABLES, SQLCOM_DO, + SQLCOM_SHOW_OPEN_TABLES, SQLCOM_DO, SQLCOM_EMPTY_QUERY, SQLCOM_END }; diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 9d3b899d31b..dd8487ceecc 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -132,7 +132,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, if (read_file_from_client && handle_duplicates == DUP_ERROR) handle_duplicates=DUP_IGNORE; - if (read_file_from_client && (thd->client_capabilities & CLIENT_LOCAL_FILES)) + if (read_file_from_client) { char tmp [FN_REFLEN+1],*end; DBUG_PRINT("info",("reading local file")); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 48b48dc77a7..fa4a4fd4f3b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1181,6 +1181,10 @@ mysql_execute_command(void) res=mysql_do(thd, *lex->insert_list); break; + case SQLCOM_EMPTY_QUERY: + send_ok(&thd->net); + break; + case SQLCOM_PURGE: { if (check_process_priv(thd)) @@ -1796,13 +1800,20 @@ mysql_execute_command(void) { uint privilege= (lex->duplicates == DUP_REPLACE ? INSERT_ACL | UPDATE_ACL | DELETE_ACL : INSERT_ACL); - if (!(lex->local_file && (thd->client_capabilities & CLIENT_LOCAL_FILES))) + + if (!lex->local_file) { if (check_access(thd,privilege | FILE_ACL,tables->db)) goto error; } else { + if (!(thd->client_capabilities & CLIENT_LOCAL_FILES) || + ! opt_local_infile) + { + send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); + goto error; + } if (check_access(thd,privilege,tables->db,&tables->grant.privilege) || grant_option && check_grant(thd,privilege,tables)) goto error; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 57053b87fa6..1ee0d84e182 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5636,10 +5636,10 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length) /***************************************************************************** -** Fill join cache with packed records -** Records are stored in tab->cache.buffer and last record in -** last record is stored with pointers to blobs to support very big -** records + Fill join cache with packed records + Records are stored in tab->cache.buffer and last record in + last record is stored with pointers to blobs to support very big + records ******************************************************************************/ static int @@ -5701,7 +5701,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) if (null_fields && tables[i].table->null_fields) { /* must copy null bits */ copy->str=(char*) tables[i].table->null_flags; - copy->length=(tables[i].table->null_fields+7)/8; + copy->length=tables[i].table->null_bytes; copy->strip=0; copy->blob_field=0; length+=copy->length; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index aa54f325ebb..7b5fc5797c9 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -771,7 +771,7 @@ bool close_cached_table(THD *thd,TABLE *table) /* Mark all tables that are in use as 'old' */ mysql_lock_abort(thd,table); // end threads waiting on lock -#ifdef REMOVE_LOCKS +#if defined(USING_TRANSACTIONS) || defined( __WIN__) || defined( __EMX__) || !defined(OS2) /* Wait until all there are no other threads that has this table open */ while (remove_table_from_cache(thd,table->table_cache_key, table->table_name)) @@ -1569,20 +1569,29 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, } } -#if defined( __WIN__) || defined( __EMX__) || defined( OS2) - // Win32 can't rename an open table, so we must close the org table! - table_name=thd->strdup(table_name); // must be saved - if (close_cached_table(thd,table)) - { // Aborted - VOID(quick_rm_table(new_db_type,new_db,tmp_name)); - VOID(pthread_mutex_unlock(&LOCK_open)); - goto err; +#if (!defined( __WIN__) && !defined( __EMX__) && !defined( OS2)) + if (table->file->has_transactions()) +#endif + { + /* + Win32 and InnoDB can't drop a table that is in use, so we must + close all the original table at before doing the rename + */ + table_name=thd->strdup(table_name); // must be saved + if (close_cached_table(thd,table)) + { // Aborted + VOID(quick_rm_table(new_db_type,new_db,tmp_name)); + VOID(pthread_mutex_unlock(&LOCK_open)); + goto err; + } + table=0; // Marker that table is closed } - table=0; // Marker for win32 version -#else - table->file->extra(HA_EXTRA_FORCE_REOPEN); // Don't use this file anymore +#if (!defined( __WIN__) && !defined( __EMX__) && !defined( OS2)) + else + table->file->extra(HA_EXTRA_FORCE_REOPEN); // Don't use this file anymore #endif + error=0; if (mysql_rename_table(old_db_type,db,table_name,db,old_name)) { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 42872399dec..54a03d4a714 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -544,9 +544,17 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); query: END_OF_INPUT { - if (!current_thd->bootstrap) + THD *thd=current_thd; + if (!thd->bootstrap && + (!(thd->lex.options & OPTION_FOUND_COMMENT))) + { send_error(¤t_thd->net,ER_EMPTY_QUERY); - YYABORT; + YYABORT; + } + else + { + thd->lex.sql_command = SQLCOM_EMPTY_QUERY; + } } | verb_clause END_OF_INPUT {} @@ -2356,8 +2364,9 @@ use: USE_SYM ident load: LOAD DATA_SYM load_data_lock opt_local INFILE TEXT_STRING { - Lex->sql_command= SQLCOM_LOAD; - Lex->local_file= $4; + LEX *lex= Lex; + lex->sql_command= SQLCOM_LOAD; + lex->local_file= $4; if (!(Lex->exchange= new sql_exchange($6.str,0))) YYABORT; Lex->field_list.empty(); @@ -2643,11 +2652,12 @@ set: SET opt_option { THD *thd=current_thd; - Lex->sql_command= SQLCOM_SET_OPTION; - Lex->options=thd->options; - Lex->select_limit=thd->default_select_limit; - Lex->gemini_spin_retries=thd->gemini_spin_retries; - Lex->tx_isolation=thd->tx_isolation; + LEX *lex= &thd->lex; + lex->sql_command= SQLCOM_SET_OPTION; + lex->options=thd->options; + lex->select_limit=thd->default_select_limit; + lex->gemini_spin_retries=thd->gemini_spin_retries; + lex->tx_isolation=thd->tx_isolation; } option_value_list diff --git a/sql/unireg.cc b/sql/unireg.cc index 0bfc462f01a..f7b040adebe 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -486,11 +486,11 @@ static bool pack_fields(File file,List<create_field> &create_fields) if (field->interval_id > int_count) { int_count=field->interval_id; - tmp.append('\377'); + tmp.append(NAMES_SEP_CHAR); for (const char **pos=field->interval->type_names ; *pos ; pos++) { tmp.append(*pos); - tmp.append('\377'); + tmp.append(NAMES_SEP_CHAR); } tmp.append('\0'); // End of intervall } diff --git a/sql/unireg.h b/sql/unireg.h index 159832295fd..f8f5edd5156 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -70,11 +70,6 @@ #define FERR -1 /* Error from my_functions */ #define CREATE_MODE 0 /* Default mode on new files */ #define NAMES_SEP_CHAR '\377' /* Char to sep. names */ -#ifdef MSDOS -#define EXTRA_FIELD_CHAR (char) '\234' /* Interchangebly with '#' */ -#else -#define EXTRA_FIELD_CHAR '#' /* Interchangebly with '#' */ -#endif #define READ_RECORD_BUFFER (uint) (IO_SIZE*8) /* Pointer_buffer_size */ #define DISK_BUFFER_SIZE (uint) (IO_SIZE*16) /* Size of diskbuffer */ 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/my-huge.cnf.sh b/support-files/my-huge.cnf.sh index 103a6c16cfd..ce9b5b18586 100644 --- a/support-files/my-huge.cnf.sh +++ b/support-files/my-huge.cnf.sh @@ -4,7 +4,7 @@ # MySQL. # # You can copy this file to -# /etc/mf.cnf to set global options, +# /etc/my.cnf to set global options, # mysql-data-dir/my.cnf to set server-specific options (in this # installation this directory is @localstatedir@) or # ~/.my.cnf to set user-specific options. diff --git a/support-files/my-large.cnf.sh b/support-files/my-large.cnf.sh index f314566c5fb..0602921abc1 100644 --- a/support-files/my-large.cnf.sh +++ b/support-files/my-large.cnf.sh @@ -4,7 +4,7 @@ # MySQL. # # You can copy this file to -# /etc/mf.cnf to set global options, +# /etc/my.cnf to set global options, # mysql-data-dir/my.cnf to set server-specific options (in this # installation this directory is @localstatedir@) or # ~/.my.cnf to set user-specific options. diff --git a/support-files/my-medium.cnf.sh b/support-files/my-medium.cnf.sh index 675241b25dd..bddba03eee9 100644 --- a/support-files/my-medium.cnf.sh +++ b/support-files/my-medium.cnf.sh @@ -5,7 +5,7 @@ # other programs (like a web server) # # You can copy this file to -# /etc/mf.cnf to set global options, +# /etc/my.cnf to set global options, # mysql-data-dir/my.cnf to set server-specific options (in this # installation this directory is @localstatedir@) or # ~/.my.cnf to set user-specific options. diff --git a/support-files/my-small.cnf.sh b/support-files/my-small.cnf.sh index cad0e10e684..9e7d07ec449 100644 --- a/support-files/my-small.cnf.sh +++ b/support-files/my-small.cnf.sh @@ -5,7 +5,7 @@ # doesn't use much resources. # # You can copy this file to -# /etc/mf.cnf to set global options, +# /etc/my.cnf to set global options, # mysql-data-dir/my.cnf to set server-specific options (in this # installation this directory is @localstatedir@) or # ~/.my.cnf to set user-specific options. diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 428bbdf0862..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 @@ -160,6 +164,7 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-/bin:/usr/bin}\" \ ./configure \ $* \ --enable-assembler \ + --enable-local-infile \ --with-mysqld-user=%{mysqld_user} \ --with-unix-socket-path=/var/lib/mysql/mysql.sock \ --prefix=/ \ @@ -185,26 +190,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*) @@ -219,6 +234,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 @@ -398,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 @@ -415,6 +431,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 |