diff options
364 files changed, 7948 insertions, 2872 deletions
diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index 7d0379c08a0..36f40105d26 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.5-bugfixing" +tree_name = "mysql-5.5-bugteam" diff --git a/BUILD/build_mccge.sh b/BUILD/build_mccge.sh index cb70a8cef67..f29a2f1db34 100755 --- a/BUILD/build_mccge.sh +++ b/BUILD/build_mccge.sh @@ -71,9 +71,10 @@ cat <<EOF same type as that on which you intend to run MySQL/MySQL Cluster. The simplest possible way to run this script is to allow it to use the - built-in defaults everywhere, invoking it simply as: + built-in defaults everywhere, invoking it simply as (from top-level + MySQL directory): - shell> ./build_mccge.sh + shell> BUILD/build_mccge.sh This performs the following operations: 1) Detects the operating system. Currently, Linux, FreeBSD, Solaris @@ -128,7 +129,7 @@ cat <<EOF information in the binary then use --debug. If your aim is not to build MySQL Cluster Carrier Grade Edition, you - can also use this script to build MySQL Classic and MySQL Pro + can also use this script to build MySQL Classic and MySQL Enterprise Pro versions; see the --extended-help for descriptions of these packages. EOF } @@ -147,7 +148,13 @@ Usage: $0 [options] configure --extended-help Show extended help message --without-debug Build non-debug version + --use-comment Set the comment in the build + --with-fast-mutexes Use try/retry method of acquiring mutex --with-debug Build debug version + --with-link-time-optimizer + Link time optimizations enabled (Requires GCC 4.5 + if GCC used), available for icc as well. This flag + is only considered if also fast is set. --configure-only Stop after running configure. --use-autotools Start by running autoconf, automake,.. tools --no-autotools Start from configure @@ -297,6 +304,7 @@ extended_usage() by MySQL (cannot be overridden). --with-ssl: Enable use of yaSSL library included in the MySQL source + if possible (GCC and same CC and CXX). (cannot be overridden). --with-pic: Build all binaries using position independent assembler @@ -377,17 +385,17 @@ extended_usage() Compiler options: ----------------- - This section describes the compiler options for each of the different - platforms supported by this script. + This section describes the compiler options for each of the different + platforms supported by this script. - The --fast option adds -mtune=cpu_arg to the C/C++ flags (provides - support for Nocona, K8, and other processors). + The --fast option adds -mtune=cpu_arg to the C/C++ flags (provides + support for Nocona, K8, and other processors). - Use of the --debug option adds -g to the C/C++ flags. + Use of the --debug option adds -g to the C/C++ flags. - In all cases it is possible to override the definition of CC and CXX - by calling the script as follows: - CC="/usr/local/bin/gcc" CXX="/usr/local/bin/gcc" BUILD/build_mccge.sh + In all cases it is possible to override the definition of CC and CXX + by calling the script as follows: + CC="/usr/local/bin/gcc" CXX="/usr/local/bin/gcc" BUILD/build_mccge.sh FreeBSD/x86/gcc --------------- @@ -411,15 +419,19 @@ extended_usage() On Itanium we also add -no-ftz and to CC and C++ flags. - The non-debug versions also add the following: - C/C++ flags += -O3 unroll2 -ip + Note that if the user of this script sets CC or CXX explicitly then + also -static-libgcc and -static-intel needs to be set in the CC and + CXX. - The fast version adds: - C/C++ flags += -ipo + The non-debug versions also add the following: + C/C++ flags += -O3 unroll2 -ip - On discovery of a Core 2 Duo architecture while using icc, -xT is also - added to the C/C++ flags; this provides optimisations specific to Core - 2 Duo. This is added only when the --fast flag is set. + The fast version adds (if --with-link-time-optimizer is used): + C/C++ flags += -ipo + + On discovery of a Core 2 Duo architecture while using icc, -xT is also + added to the C/C++ flags; this provides optimisations specific to Core + 2 Duo. This is added only when the --fast flag is set. Solaris/x86/gcc --------------- @@ -445,7 +457,7 @@ extended_usage() Sparc v9 binaries, also -mt is set in all those since we're always building a multithreaded program. - C flags = -xstrconst + C flags = -xstrconst This flag is set only on SPARC C++ flags = -noex Set the following C/C++ flags: @@ -458,8 +470,10 @@ extended_usage() Set the C++ flag: -noex + -features=no%except This flag is set only on x86 - When compiling with fast we set: + When compiling with fast we set (-ipo only used if we have + set --with-link-time-optimizer): C/C++ flags: -xtarget=native -xunroll=3 -xipo LDFLAGS: -xipo @@ -471,6 +485,11 @@ extended_usage() When compiling with fast on x86 we also set: C/C++ flags: -xregs=frameptr + When not compiling with fast we set on x86 + C/C++ flags: -xregs=no%frameptr + + On SPARC we set + ASFLAGS = LDFLAGS = C/C++ flags = -xarch=sparc The optimisation level is -xO Debug builds @@ -480,17 +499,19 @@ extended_usage() MacOSX/x86/gcc -------------- - C/C++ flags include -fno-common -arch i386. + C/C++ flags include -fno-common -arch i386. + When 64-bits builds then i386 is replaced by x86_64. - Non-debug versions also add -Os -felide-constructors, where "-Os" - means the build is space-optimised as long as the space optimisations - do not negatively affect performance. Debug versions use -O. + Non-debug versions also add -Os -felide-constructors, where "-Os" + means the build is space-optimised as long as the space optimisations + do not negatively affect performance. Debug versions use -O. - Mac OS X builds will always be 32-bit by default, when --64 is added - the build will be 64 bit instead. Thus the flag --m64 is added only - when specifically given as an option. + Mac OS X builds will always be 32-bit by default, when --64 is added + the build will be 64 bit instead. Thus the flag --m64 is added only + when specifically given as an option. EOF } + with_usage() { cat <<EOF @@ -593,13 +614,13 @@ parse_cpu_type() case "$cpu_type" in x86 ) cpu_type="x86" - if test "x$m64" != "x" ; then + if test "x$m64" = "x" ; then m64="no" fi ;; x86_64 ) cpu_type="x86" - if test "x$m64" != "x" ; then + if test "x$m64" = "x" ; then m64="yes" fi ;; @@ -629,10 +650,7 @@ parse_compiler() icc ) compiler="icc" ;; - forte ) - compiler="forte" - ;; - SunStudio | sunstudio ) + forte | SunStudio | sunstudio ) compiler="forte" ;; *) @@ -653,12 +671,21 @@ parse_options() --datadir=*) datadir=`get_key_value "$1"` ;; + --with-link-time-optimizer) + with_link_time_optimizer="yes" + ;; --without-debug) with_debug_flag="no" if test "x$fast_flag" != "xyes" ; then fast_flag="generic" fi ;; + --use-comment) + without_comment="no" + ;; + --with-fast-mutexes) + with_fast_mutexes="yes" + ;; --use-tcmalloc) use_tcmalloc="yes" ;; @@ -817,9 +844,11 @@ set_cpu_base() fi case "$cpu_arg" in core2 | nocona | prescott | pentium* | i*86 ) + # Intel CPU cpu_base_type="x86" ;; - athlon* | opteron* ) + athlon* | opteron* | k6 | k8 ) + # AMD CPU cpu_base_type="x86" ;; sparc ) @@ -871,15 +900,15 @@ init_configure_commands() cxxflags="$cxx_warnings $base_cxxflags $compiler_flags" configure="./configure $base_configs $with_flags" - flags="CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\"" + env_flags="CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\"" if test "x$LDFLAGS" != "x" ; then - flags="$flags LDFLAGS=\"$LDFLAGS\"" + env_flags="$env_flags LDFLAGS=\"$LDFLAGS\"" fi if test "x$ASFLAGS" != "x" ; then - flags="$flags ASFLAGS=\"$ASFLAGS\"" + env_flags="$env_flags ASFLAGS=\"$ASFLAGS\"" fi commands="$commands - $flags $configure" + $env_flags $configure" } # @@ -1082,6 +1111,18 @@ set_debug_flag() } # +# We compile in SSL support if we can, this isn't possible if CXX +# and CC aren't the same and we're not using GCC. +# +set_ssl() +{ + if test "x$compiler" = "xgcc" && \ + test "x$CC" = "x$CXX" ; then + base_configs="$base_configs --with-ssl" + fi +} + +# # Base options used by all packages # # SSL library to use. --with-ssl selects the bundled yaSSL @@ -1105,10 +1146,13 @@ set_base_configs() base_configs="$base_configs --enable-local-infile" base_configs="$base_configs --enable-thread-safe-client" base_configs="$base_configs --with-big-tables" - base_configs="$base_configs --with-extra-charsets=complex" - base_configs="$base_configs --with-ssl" + base_configs="$base_configs --with-extra-charsets=all" + if test "x$with_fast_mutexes" = "xyes" ; then + base_configs="$base_configs --with-fast-mutexes" + fi base_configs="$base_configs --with-pic" base_configs="$base_configs --with-csv-storage-engine" + base_configs="$base_configs --with-perfschema" } # @@ -1139,7 +1183,9 @@ set_ndb_engine() set_pro_package() { - base_configs="$base_configs --with-comment=\"MySQL Pro $version_text built from source\"" + if test "x$without_comment" != "xyes" ; then + base_configs="$base_configs --with-comment=\"MySQL Enterprise Pro $version_text built from source\"" + fi if test "x$with_debug_flag" = "xyes" ; then base_configs="$base_configs --with-server-suffix=\"-debug\"" fi @@ -1147,33 +1193,37 @@ set_pro_package() set_cge_extended_package() { - if test "x$gpl" = "xno" ; then - echo "Cannot build Extended Carrier Grade Edition as Commercial version" + if test "x$without_comment" != "xyes" ; then + base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Extended Edition $version_text built from source\"" fi - base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Extended Edition $version_text built from source\"" if test "x$with_debug_flag" = "xyes" ; then base_configs="$base_configs --with-server-suffix=\"-cge-extended-debug\"" else - base_configs="$base_configs --with-server-suffix=\"-cge-extended"\" + base_configs="$base_configs --with-server-suffix=\"-cge-extended\"" fi } set_cge_package() { - base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Edition $version_text built from source\"" + if test "x$without_comment" != "xyes" ; then + base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Edition $version_text built from source\"" + fi if test "x$with_debug_flag" = "xyes" ; then base_configs="$base_configs --with-server-suffix=\"-cge-debug\"" else - base_configs="$base_configs --with-server-suffix=\"-cge"\" + base_configs="$base_configs --with-server-suffix=\"-cge\"" fi } set_classic_package() { - base_configs="$base_configs --with-comment=\"MySQL Classic $version_text built from source\"" + if test "x$without_comment" != "xyes" ; then + base_configs="$base_configs --with-comment=\"MySQL Classic $version_text built from source\"" + fi if test "x$with_debug_flag" = "xyes" ; then base_configs="$base_configs --with-server-suffix=\"-debug\"" fi + base_configs="$base_configs --without-example-storage-engine" } # @@ -1204,10 +1254,10 @@ set_gcc_special_options() set_cc_and_cxx_for_gcc() { if test "x$CC" = "x" ; then - CC="gcc -static-libgcc" + CC="gcc -static-libgcc -fno-exceptions" fi if test "x$CXX" = "x" ; then - CXX="gcc -static-libgcc" + CXX="gcc -static-libgcc -fno-exceptions" fi } @@ -1266,6 +1316,61 @@ set_bsd_configs() set_cc_and_cxx_for_gcc } +check_64_bits() +{ + echo "Checking for 32/64-bits compilation" + echo "int main() { return 0; }" > temp_test.c + if test "x$m64" = "xyes" ; then + cmd="$CC $compile_flags -m64 temp_test.c" + if ! $cmd 2>1 ; then + m64="no" + echo "Changing to 32-bits since 64-bits didn't work" + else + echo "Will use 64-bits" + fi + else + cmd="$CC $compile_flags -m32 temp_test.c" + if ! $cmd 2>1 ; then + m64="yes" + echo "Changing to 64-bits since 32-bits didn't work" + else + echo "Will use 32-bits" + fi + fi + rm temp_test.c +} + +# +# Get GCC version +# +get_gcc_version() +{ + # check if compiler is gcc and dump its version + cc_verno=`$cc -dumpversion 2>/dev/null` + if test "x$?" = "x0" ; then + set -- `echo $cc_verno | tr '.' ' '` + cc_ver="GCC" + cc_major=$1 + cc_minor=$2 + cc_patch=$3 + gcc_version=`expr $cc_major '*' 100 '+' $cc_minor` + fi +} + +# +# Link Time Optimizer in GCC (LTO) uses a parameter -flto +# which was added to GCC 4.5, if --with-link-time-optimizer +# is set then use this feature +# +check_for_link_time_optimizer() +{ + get_gcc_version + if test "$gcc_version" -ge 405 && \ + test "x$with_link_time_optimizer" = "xyes" ; then + compiler_flags="$compiler_flags -flto" + LDFLAGS="$LDFLAGS -flto" + fi +} # # Linux Section # @@ -1284,20 +1389,22 @@ set_linux_configs() fi if test "x$compiler" = "xgcc" ; then set_cc_and_cxx_for_gcc - if test "x$m64" = "xyes" ; then - compiler_flags="$compiler_flags -m64" - else - compiler_flags="$compiler_flags -m32" - fi if test "x$fast_flag" != "xno" ; then if test "x$fast_flag" = "xyes" ; then compiler_flags="$compiler_flags -O3" + check_for_link_time_optimizer else compiler_flags="$compiler_flags -O2" fi else compiler_flags="$compiler_flags -O0" fi + check_64_bits + if test "x$m64" = "xyes" ; then + compiler_flags="$compiler_flags -m64" + else + compiler_flags="$compiler_flags -m32" + fi # configure will set proper compiler flags for gcc on Linux elif test "x$compiler" = "xicc" ; then compiler_flags="$compiler_flags -mp -restrict" @@ -1307,8 +1414,10 @@ set_linux_configs() fi if test "x$fast_flag" != "xno" ; then compiler_flags="$compiler_flags -O3 -unroll2 -ip" - if test "x$fast_flag" = "xyes" ; then + if test "x$fast_flag" = "xyes" && \ + test "x$with_link_time_optimizer" = "xyes" ; then compiler_flags="$compiler_flags -ipo" + LDFLAGS="$LDFLAGS -ipo" fi fi else @@ -1323,11 +1432,16 @@ set_linux_configs() set_solaris_configs() { # Use mtmalloc as malloc, see Tim Cook blog - base_configs="$base_configs --with-mysqld-libs=-lmtmalloc" +# For information on optimal compiler settings, see article at +# http://developers.sun.com/solaris/articles/mysql_perf_tune.html +# by Luojia Chen at Sun. base_configs="$base_configs --with-named-curses=-lcurses" case "`uname -a`" in - *5.8* | *5.9* | *5.10* | *5.11*) + *5.8* | *5.9* ) + ;; + *5.10* | *5.11*) + base_configs="$base_configs --with-mysqld-libs=-lmtmalloc" ;; *) usage "Only versions 8,9, 10 and 11 supported for Solaris" @@ -1361,6 +1475,7 @@ set_solaris_configs() if test "x$fast_flag" = "xyes" ; then LDFLAGS="$LDFLAGS -O3" compiler_flags="$compiler_flags -O3" + check_for_link_time_optimizer else if test "x$fast_flag" = "xgeneric" ; then LDFLAGS="$LDFLAGS -O2" @@ -1373,44 +1488,50 @@ set_solaris_configs() else #Using Forte compiler (SunStudio) set_cc_and_cxx_for_forte - base_cflags="$base_cflags -xstrconst" compiler_flags="$compiler_flags -mt" - LD_FLAGS="$LD_FLAGS -mt" + LDFLAGS="$LDFLAGS -mt" compiler_flags="$compiler_flags -fsimple=1" compiler_flags="$compiler_flags -ftrap=%none" compiler_flags="$compiler_flags -xbuiltin=%all" compiler_flags="$compiler_flags -xlibmil" compiler_flags="$compiler_flags -xlibmopt" - base_cxxflags="$base_cxxflags -noex" if test "x$fast_flag" = "xyes" ; then compiler_flags="$compiler_flags -xtarget=native" - compiler_flags="$compiler_flags -xipo" compiler_flags="$compiler_flags -xunroll=3" - LD_FLAGS="$LD_FLAGS -xipo" + if test "x$with_link_time_optimizer" = "xyes" ; then + compiler_flags="$compiler_flags -xipo" + LDFLAGS="$LDFLAGS -xipo" + fi else compiler_flags="$compiler_flags -xtarget=generic" fi if test "x$cpu_base_type" = "xx86" ; then compiler_flags="$compiler_flags -nofstore" + base_cxx_flags="$base_cxx_flags -features=no%except" if test "x$fast_flag" = "xyes" ; then compiler_flags="$compiler_flags -xregs=frameptr" compiler_flags="$compiler_flags -xO4" - elif test "x$fast_flag" = "xgeneric" ; then - compiler_flags="$compiler_flags -xO2" else - compiler_flags="$compiler_flags -xO0" + compiler_flags="$compiler_flags -xregs=no%frameptr" + if test "x$fast_flag" = "xgeneric" ; then + compiler_flags="$compiler_flags -xO2" + else + compiler_flags="$compiler_flags -xO0" + fi fi else #Using SPARC cpu with SunStudio (Forte) compiler ASFLAGS="$ASFLAGS -xarch=sparc" LDFLAGS="$LDFLAGS -xarch=sparc" + base_cxxflags="$base_cxxflags -noex" + base_cflags="$base_cflags -xstrconst" compiler_flags="$compiler_flags -xarch=sparc" if test "x$fast_flag" = "xyes" ; then compiler_flags="$compiler_flags -xbinopt=prepare" LDFLAGS="$LDFLAGS -xbinopt=prepare" compiler_flags="$compiler_flags -xO4" elif test "x$fast_flag" = "xgeneric" ; then - compiler_flags="$compiler_flags -xO2" + compiler_flags="$compiler_flags -xO3" else compiler_flags="$compiler_flags -xO0" fi @@ -1432,7 +1553,7 @@ set_macosx_configs() # optimisations also when not in fast mode. # base_cxxflags="$base_cxxflags -felide-constructors" - base_cxxflags="$base_cxxflags -fno-common" + compiler_flags="$compiler_flags -fno-common" if test "x$m64" = "xyes" ; then compiler_flags="$compiler_flags -m64" compiler_flags="$compiler_flags -arch x86_64" @@ -1526,7 +1647,7 @@ fi cpu_type= package= prefix="/usr/local/mysql" -parallelism="4" +parallelism="8" fast_flag="generic" compiler="gcc" gpl="yes" @@ -1562,6 +1683,10 @@ engine_configs= ASFLAGS= LDFLAGS= use_tcmalloc= +without_comment="yes" +with_fast_mutexes= +with_link_time_optimizer= +gcc_version="0" set_defaults_based_on_environment @@ -1656,7 +1781,7 @@ elif test "x$os" = "xbsd" ; then else die "Operating system not supported by this script" fi - +set_ssl # # Final step before setting up commands is to set up proper make and # proper libtoolize versions, and to determine whether to use ccache. diff --git a/BUILD/check-cpu b/BUILD/check-cpu index 585043de67c..070e7de0125 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -4,6 +4,7 @@ # best compiler optimization flags for gcc # Will return result in: # cpu_arg : Type of CPU +# low_cpu_arg : Type of CPU used up until GCC v3.3 # check_cpu_args : Arguments for GCC compiler settings # @@ -33,7 +34,7 @@ check_compiler_cpu_flags () { case `gcc -dumpmachine` in i?86-* | x86_64-*) if test "$cc_comp" -lt 304 ; then - check_cpu_cflags="-mcpu=${cpu_arg}" + check_cpu_cflags="-mcpu=${low_cpu_arg}" elif test "$cc_comp" -ge 402 ; then check_cpu_cflags="-mtune=native" else @@ -141,9 +142,10 @@ check_cpu () { # detect CPU shortname as used by gcc options # this list is not complete, feel free to add further entries cpu_arg="" - case "$cpu_family--$model_name--$spu_arch" in + low_cpu_arg="" + case "$cpu_vendor--$cpu_family--$model_name--$spu_arch" in # DEC Alpha - Alpha*EV6*) + *Alpha*EV6*) cpu_arg="ev6"; ;; #Core 2 Duo @@ -172,6 +174,13 @@ check_cpu () { *Pentium*4*Mobile*) cpu_arg="pentium4m" ;; + *Pentium\(R\)*\ M*) + cpu_arg="pentium-m" + low_cpu_arg="pentium3" + ;; + *Pentium\(R\)*\ D*) + cpu_arg="prescott" + ;; *Pentium*4*) cpu_arg="pentium4" ;; @@ -196,6 +205,12 @@ check_cpu () { *Celeron*) cpu_arg="pentium2" ;; + *Atom*) + cpu_arg="prescott" + ;; + *GenuineIntel*) + cpu_arg="pentium" + ;; *Turion*) cpu_arg="athlon64" ;; @@ -205,9 +220,30 @@ check_cpu () { *Athlon*) cpu_arg="athlon" ;; + *AMD-K7*) + cpu_arg="athlon" + ;; + *Athlon*XP\ *) + cpu_arg="athlon-xp" + ;; + *AMD*Sempron\(tm\)*) + cpu_arg="athlon-mp" + ;; + *AMD*Athlon\(tm\)\ 64*) + cpu_arg="k8" + ;; *Opteron*) cpu_arg="opteron" ;; + *Phenom*) + cpu_arg="k8" + ;; + *AuthenticAMD*) + cpu_arg="k6" + ;; + *VIA\ *) + cpu_arg="i686" + ;; # MacOSX / Intel *i386*i486*) cpu_arg="pentium-m" @@ -239,6 +275,10 @@ check_cpu () { ;; esac + if test "x$low_cpu_arg" = "x" ; then + low_cpu_arg="$cpu_arg" + fi + if test -z "$cpu_arg" ; then if test "$CPUINFO" != " " ; then # fallback to uname if necessary diff --git a/CMakeLists.txt b/CMakeLists.txt index eecfa422bf6..5eddad4ad15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,7 +112,8 @@ OPTION(MYSQL_MAINTAINER_MODE "MySQL maintainer-specific development environment" # Whether the maintainer mode should be enabled. IF(MYSQL_MAINTAINER_MODE) IF(CMAKE_COMPILER_IS_GNUCC) - SET(MY_MAINTAINER_C_WARNINGS "-Wall -Wextra -Wunused -Wwrite-strings -Werror" + SET(MY_MAINTAINER_C_WARNINGS + "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror" CACHE STRING "C warning options used in maintainer builds.") ENDIF() IF(CMAKE_COMPILER_IS_GNUCXX) diff --git a/Makefile.am b/Makefile.am index 7ab9a9aa061..dcb55bdfa86 100644 --- a/Makefile.am +++ b/Makefile.am @@ -264,7 +264,8 @@ test-full-qa: # Headers which need to be checked for abi/api compatibility. # -API_PREPROCESSOR_HEADER = $(top_srcdir)/include/mysql/plugin.h \ +API_PREPROCESSOR_HEADER = $(top_srcdir)/include/mysql/plugin_audit.h \ + $(top_srcdir)/include/mysql/plugin_ftparser.h \ $(top_srcdir)/include/mysql.h \ $(top_srcdir)/include/mysql/psi/psi_abi_v1.h \ $(top_srcdir)/include/mysql/psi/psi_abi_v2.h diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 771ebf290f1..e39e8d7178a 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -64,7 +64,10 @@ MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c) SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS") TARGET_LINK_LIBRARIES(mysqlslap mysqlclient) -ADD_EXECUTABLE(echo echo.c) +# "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/". +IF(WIN32) + MYSQL_ADD_EXECUTABLE(echo echo.c) +ENDIF(WIN32) SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap PROPERTIES HAS_CXX TRUE) diff --git a/client/mysqldump.c b/client/mysqldump.c index 68cfde864b5..ac704f152de 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -50,7 +50,6 @@ #include "mysql.h" #include "mysql_version.h" #include "mysqld_error.h" -#include "../sql/ha_ndbcluster_tables.h" /* Exit codes */ diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 6c8f1ee3561..eb5c858b45b 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -248,10 +248,14 @@ struct st_connection my_bool pending; #ifdef EMBEDDED_LIBRARY + pthread_t tid; const char *cur_query; int cur_query_len; - pthread_mutex_t mutex; - pthread_cond_t cond; + int command, result; + pthread_mutex_t query_mutex; + pthread_cond_t query_cond; + pthread_mutex_t result_mutex; + pthread_cond_t result_cond; int query_done; #endif /*EMBEDDED_LIBRARY*/ }; @@ -443,7 +447,7 @@ struct st_command char *query, *query_buf,*first_argument,*last_argument,*end; DYNAMIC_STRING content; int first_word_len, query_len; - my_bool abort_on_error; + my_bool abort_on_error, used_replace; struct st_expected_errors expected_errors; char require_file[FN_REFLEN]; enum enum_commands type; @@ -703,67 +707,148 @@ void handle_no_error(struct st_command*); #ifdef EMBEDDED_LIBRARY +#define EMB_SEND_QUERY 1 +#define EMB_READ_QUERY_RESULT 2 +#define EMB_END_CONNECTION 3 + /* attributes of the query thread */ pthread_attr_t cn_thd_attrib; + /* - send_one_query executes query in separate thread, which is - necessary in embedded library to run 'send' in proper way. - This implementation doesn't handle errors returned - by mysql_send_query. It's technically possible, though - I don't see where it is needed. + This procedure represents the connection and actually + runs queries when in the EMBEDDED-SERVER mode. + The run_query_normal() just sends request for running + mysql_send_query and mysql_read_query_result() here. */ -pthread_handler_t send_one_query(void *arg) + +pthread_handler_t connection_thread(void *arg) { struct st_connection *cn= (struct st_connection*)arg; mysql_thread_init(); - (void) mysql_send_query(&cn->mysql, cn->cur_query, cn->cur_query_len); + while (cn->command != EMB_END_CONNECTION) + { + if (!cn->command) + { + pthread_mutex_lock(&cn->query_mutex); + while (!cn->command) + pthread_cond_wait(&cn->query_cond, &cn->query_mutex); + pthread_mutex_unlock(&cn->query_mutex); + } + switch (cn->command) + { + case EMB_END_CONNECTION: + goto end_thread; + case EMB_SEND_QUERY: + cn->result= mysql_send_query(&cn->mysql, cn->cur_query, cn->cur_query_len); + break; + case EMB_READ_QUERY_RESULT: + cn->result= mysql_read_query_result(&cn->mysql); + break; + default: + DBUG_ASSERT(0); + } + cn->command= 0; + pthread_mutex_lock(&cn->result_mutex); + cn->query_done= 1; + pthread_cond_signal(&cn->result_cond); + pthread_mutex_unlock(&cn->result_mutex); + } - mysql_thread_end(); - pthread_mutex_lock(&cn->mutex); +end_thread: cn->query_done= 1; - pthread_cond_signal(&cn->cond); - pthread_mutex_unlock(&cn->mutex); + mysql_thread_end(); pthread_exit(0); return 0; } -static int do_send_query(struct st_connection *cn, const char *q, int q_len, - int flags) + +static void wait_query_thread_done(struct st_connection *con) { - pthread_t tid; + DBUG_ASSERT(con->tid); + if (!con->query_done) + { + pthread_mutex_lock(&con->result_mutex); + while (!con->query_done) + pthread_cond_wait(&con->result_cond, &con->result_mutex); + pthread_mutex_unlock(&con->result_mutex); + } +} - if (flags & QUERY_REAP_FLAG) - return mysql_send_query(&cn->mysql, q, q_len); - if (pthread_mutex_init(&cn->mutex, NULL) || - pthread_cond_init(&cn->cond, NULL)) - die("Error in the thread library"); +static void signal_connection_thd(struct st_connection *cn, int command) +{ + DBUG_ASSERT(cn->tid); + cn->query_done= 0; + cn->command= command; + pthread_mutex_lock(&cn->query_mutex); + pthread_cond_signal(&cn->query_cond); + pthread_mutex_unlock(&cn->query_mutex); +} + +/* + Sometimes we try to execute queries when the connection is closed. + It's done to make sure it was closed completely. + So that if our connection is closed (cn->tid == 0), we just return + the mysql_send_query() result which is an error in this case. +*/ + +static int do_send_query(struct st_connection *cn, const char *q, int q_len) +{ + if (!cn->tid) + return mysql_send_query(&cn->mysql, q, q_len); cn->cur_query= q; cn->cur_query_len= q_len; - cn->query_done= 0; - if (pthread_create(&tid, &cn_thd_attrib, send_one_query, (void*)cn)) - die("Cannot start new thread for query"); - + signal_connection_thd(cn, EMB_SEND_QUERY); return 0; } -static void wait_query_thread_end(struct st_connection *con) + +static int do_read_query_result(struct st_connection *cn) { - if (!con->query_done) - { - pthread_mutex_lock(&con->mutex); - while (!con->query_done) - pthread_cond_wait(&con->cond, &con->mutex); - pthread_mutex_unlock(&con->mutex); - } + DBUG_ASSERT(cn->tid); + wait_query_thread_done(cn); + signal_connection_thd(cn, EMB_READ_QUERY_RESULT); + wait_query_thread_done(cn); + + return cn->result; +} + + +static void emb_close_connection(struct st_connection *cn) +{ + if (!cn->tid) + return; + wait_query_thread_done(cn); + signal_connection_thd(cn, EMB_END_CONNECTION); + pthread_join(cn->tid, NULL); + cn->tid= 0; + pthread_mutex_destroy(&cn->query_mutex); + pthread_cond_destroy(&cn->query_cond); + pthread_mutex_destroy(&cn->result_mutex); + pthread_cond_destroy(&cn->result_cond); } + +static void init_connection_thd(struct st_connection *cn) +{ + cn->query_done= 1; + cn->command= 0; + if (pthread_mutex_init(&cn->query_mutex, NULL) || + pthread_cond_init(&cn->query_cond, NULL) || + pthread_mutex_init(&cn->result_mutex, NULL) || + pthread_cond_init(&cn->result_cond, NULL) || + pthread_create(&cn->tid, &cn_thd_attrib, connection_thread, (void*)cn)) + die("Error in the thread library"); +} + + #else /*EMBEDDED_LIBRARY*/ -#define do_send_query(cn,q,q_len,flags) mysql_send_query(&cn->mysql, q, q_len) +#define do_send_query(cn,q,q_len) mysql_send_query(&cn->mysql, q, q_len) +#define do_read_query_result(cn) mysql_read_query_result(&cn->mysql) #endif /*EMBEDDED_LIBRARY*/ @@ -1106,6 +1191,9 @@ void close_connections() DBUG_ENTER("close_connections"); for (--next_con; next_con >= connections; --next_con) { +#ifdef EMBEDDED_LIBRARY + emb_close_connection(next_con); +#endif if (next_con->stmt) mysql_stmt_close(next_con->stmt); next_con->stmt= 0; @@ -3326,7 +3414,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname, if (ds_wild && ds_wild->length && wild_compare(file->name, ds_wild->str, 0)) continue; - dynstr_append(ds, file->name); + replace_dynstr_append(ds, file->name); dynstr_append(ds, "\n"); } set_wild_chars(0); @@ -3356,6 +3444,7 @@ static void do_list_files(struct st_command *command) {"file", ARG_STRING, FALSE, &ds_wild, "Filename (incl. wildcard)"} }; DBUG_ENTER("do_list_files"); + command->used_replace= 1; check_command_args(command, command->first_argument, list_files_args, @@ -3397,6 +3486,7 @@ static void do_list_files_write_file_command(struct st_command *command, {"file", ARG_STRING, FALSE, &ds_wild, "Filename (incl. wildcard)"} }; DBUG_ENTER("do_list_files_write_file"); + command->used_replace= 1; check_command_args(command, command->first_argument, list_files_args, @@ -4866,7 +4956,7 @@ void do_close_connection(struct st_command *command) we need to check if the query's thread was finished and probably wait (embedded-server specific) */ - wait_query_thread_end(con); + emb_close_connection(con); #endif /*EMBEDDED_LIBRARY*/ if (con->stmt) mysql_stmt_close(con->stmt); @@ -5216,8 +5306,9 @@ void do_connect(struct st_command *command) } #ifdef EMBEDDED_LIBRARY - con_slot->query_done= 1; -#endif + init_connection_thd(con_slot); +#endif /*EMBEDDED_LIBRARY*/ + if (!mysql_init(&con_slot->mysql)) die("Failed on mysql_init()"); @@ -5542,6 +5633,8 @@ int read_line(char *buf, int size) char c, UNINIT_VAR(last_quote), last_char= 0; char *p= buf, *buf_end= buf + size - 1; int skip_char= 0; + my_bool have_slash= FALSE; + enum {R_NORMAL, R_Q, R_SLASH_IN_Q, R_COMMENT, R_LINE_START} state= R_LINE_START; DBUG_ENTER("read_line"); @@ -5613,9 +5706,13 @@ int read_line(char *buf, int size) } else if (c == '\'' || c == '"' || c == '`') { - last_quote= c; - state= R_Q; + if (! have_slash) + { + last_quote= c; + state= R_Q; + } } + have_slash= (c == '\\'); break; case R_COMMENT: @@ -6228,8 +6325,10 @@ get_one_option(int optid, const struct my_option *opt, char *argument) print_version(); exit(0); case OPT_MYSQL_PROTOCOL: +#ifndef EMBEDDED_LIBRARY opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, opt->name); +#endif break; case '?': usage(); @@ -6766,21 +6865,13 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, /* Send the query */ - if (do_send_query(cn, query, query_len, flags)) + if (do_send_query(cn, query, query_len)) { handle_error(command, mysql_errno(mysql), mysql_error(mysql), mysql_sqlstate(mysql), ds); goto end; } } -#ifdef EMBEDDED_LIBRARY - /* - Here we handle 'reap' command, so we need to check if the - query's thread was finished and probably wait - */ - else if (flags & QUERY_REAP_FLAG) - wait_query_thread_end(cn); -#endif /*EMBEDDED_LIBRARY*/ if (!(flags & QUERY_REAP_FLAG)) { cn->pending= TRUE; @@ -6793,7 +6884,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, When on first result set, call mysql_read_query_result to retrieve answer to the query sent earlier */ - if ((counter==0) && mysql_read_query_result(mysql)) + if ((counter==0) && do_read_query_result(cn)) { handle_error(command, mysql_errno(mysql), mysql_error(mysql), mysql_sqlstate(mysql), ds); @@ -7968,6 +8059,9 @@ int main(int argc, char **argv) ps_protocol_enabled= 1; st_connection *con= connections; +#ifdef EMBEDDED_LIBRARY + init_connection_thd(con); +#endif /*EMBEDDED_LIBRARY*/ if (!( mysql_init(&con->mysql))) die("Failed in mysql_init()"); if (opt_connect_timeout) @@ -8387,7 +8481,7 @@ int main(int argc, char **argv) memset(&saved_expected_errors, 0, sizeof(saved_expected_errors)); } - if (command_executed != last_command_executed) + if (command_executed != last_command_executed || command->used_replace) { /* As soon as any command has been executed, diff --git a/client/sql_string.cc b/client/sql_string.cc index 6b749409a64..dec6ac94eb2 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -31,9 +31,12 @@ ** String functions *****************************************************************************/ -bool String::real_alloc(uint32 arg_length) +bool String::real_alloc(uint32 length) { - arg_length=ALIGN_SIZE(arg_length+1); + uint32 arg_length= ALIGN_SIZE(length + 1); + DBUG_ASSERT(arg_length > length); + if (arg_length <= length) + return TRUE; /* Overflow */ str_length=0; if (Alloced_length < arg_length) { @@ -56,6 +59,9 @@ bool String::real_alloc(uint32 arg_length) bool String::realloc(uint32 alloc_length) { uint32 len=ALIGN_SIZE(alloc_length+1); + DBUG_ASSERT(len > alloc_length); + if (len <= alloc_length) + return TRUE; /* Overflow */ if (Alloced_length < len) { char *new_ptr; diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake index 7911b7848a8..b9ff9f7af73 100644 --- a/cmake/abi_check.cmake +++ b/cmake/abi_check.cmake @@ -15,7 +15,8 @@ # # Headers which need to be checked for abi/api compatibility are in -# API_PREPROCESSOR_HEADER. +# API_PREPROCESSOR_HEADER. plugin.h is tested implicitly via +# plugin_audit.h and plugin_ftparser.h. # # We use gcc specific preprocessing command and sed/diff, so it will # only be run on Unix and only if gcc is used. @@ -27,7 +28,8 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux") SET(COMPILER ${CMAKE_C_COMPILER}) ENDIF() SET(API_PREPROCESSOR_HEADER - ${CMAKE_SOURCE_DIR}/include/mysql/plugin.h + ${CMAKE_SOURCE_DIR}/include/mysql/plugin_audit.h + ${CMAKE_SOURCE_DIR}/include/mysql/plugin_ftparser.h ${CMAKE_SOURCE_DIR}/include/mysql.h ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h @@ -38,18 +40,18 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux") -DCOMPILER=${COMPILER} -DSOURCE_DIR=${CMAKE_SOURCE_DIR} -DBINARY_DIR=${CMAKE_BINARY_DIR} - "-DDMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}" + "-DABI_HEADERS=${API_PREPROCESSOR_HEADER}" -P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake VERBATIM ) ADD_CUSTOM_TARGET(abi_check_all COMMAND ${CMAKE_COMMAND} - -DCMAKE_C_COMPILER=${COMPILER} - -DCMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} - -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR} - "-DMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}" - -P ${CMAKE_SOURCE_DIR}/cmake/scripts/do_abi_check.cmake + -DCOMPILER=${COMPILER} + -DSOURCE_DIR=${CMAKE_SOURCE_DIR} + -DBINARY_DIR=${CMAKE_BINARY_DIR} + "-DABI_HEADERS=${API_PREPROCESSOR_HEADER}" + -P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake VERBATIM ) ENDIF() diff --git a/cmake/cmake_parse_arguments.cmake b/cmake/cmake_parse_arguments.cmake index ea601f916a8..db540ae9020 100644 --- a/cmake/cmake_parse_arguments.cmake +++ b/cmake/cmake_parse_arguments.cmake @@ -15,7 +15,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Handy macro to parse macro arguments -MACRO(CMAKE_PARSE_ARGUMENTS prefix arg_names option_names) +MACRO(MYSQL_PARSE_ARGUMENTS prefix arg_names option_names) SET(DEFAULT_ARGS) FOREACH(arg_name ${arg_names}) SET(${prefix}_${arg_name}) diff --git a/cmake/do_abi_check.cmake b/cmake/do_abi_check.cmake index aa7784e7372..78006bd018c 100644 --- a/cmake/do_abi_check.cmake +++ b/cmake/do_abi_check.cmake @@ -56,8 +56,9 @@ FOREACH(file ${ABI_HEADERS}) SET(tmpfile ${file}.pp.tmp) EXECUTE_PROCESS( COMMAND ${COMPILER} - -E -nostdinc -dI -I${SOURCE_DIR}/include -I${BINARY_DIR}/include - -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql ${file} + -E -nostdinc -dI -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include + -I${BINARY_DIR}/include -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql + ${file} ERROR_QUIET OUTPUT_FILE ${tmpfile}) EXECUTE_PROCESS( COMMAND sed -e diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake index d5566d03913..c12a74cba31 100644 --- a/cmake/dtrace.cmake +++ b/cmake/dtrace.cmake @@ -13,13 +13,30 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCXX + AND CMAKE_SIZEOF_VOID_P EQUAL 4) + IF(NOT DEFINED BUGGY_GCC_NO_DTRACE_MODULES) + EXECUTE_PROCESS( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version + OUTPUT_VARIABLE out) + IF(out MATCHES "3.4.6") + # This gcc causes crashes in dlopen() for dtraced shared libs, + # while standard shipped with Solaris10 3.4.3 is ok + SET(BUGGY_GCC_NO_DTRACE_MODULES 1 CACHE INTERNAL "") + ELSE() + SET(BUGGY_GCC_NO_DTRACE_MODULES 0 CACHE INTERNAL "") + ENDIF() + ENDIF() +ENDIF() + # Check if OS supports DTrace MACRO(CHECK_DTRACE) FIND_PROGRAM(DTRACE dtrace) MARK_AS_ADVANCED(DTRACE) # On FreeBSD, dtrace does not handle userland tracing yet - IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD" + AND NOT BUGGY_GCC_NO_DTRACE_MODULES) SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace") ENDIF() SET(HAVE_DTRACE ${ENABLE_DTRACE}) @@ -72,22 +89,6 @@ IF(ENABLE_DTRACE) ) ENDIF() -IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCXX - AND CMAKE_SIZEOF_VOID_P EQUAL 4) - IF(NOT DEFINED BUGGY_GCC_NO_DTRACE_MODULES) - EXECUTE_PROCESS( - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version - OUTPUT_VARIABLE out) - IF(out MATCHES "3.4.6") - # This gcc causes crashes in dlopen() for dtraced shared libs, - # while standard shipped with Solaris10 3.4.3 is ok - SET(BUGGY_GCC_NO_DTRACE_MODULES 1 CACHE INTERNAL "") - ELSE() - SET(BUGGY_GCC_NO_DTRACE_MODULES 0 CACHE INTERNAL "") - ENDIF() - ENDIF() -ENDIF() - FUNCTION(DTRACE_INSTRUMENT target) IF(BUGGY_GCC_NO_DTRACE_MODULES) GET_TARGET_PROPERTY(target_type ${target} TYPE) diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 56a540fde89..bc8d9945690 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -83,7 +83,7 @@ FUNCTION(INSTALL_MANPAGE file) ENDFUNCTION() FUNCTION(INSTALL_SCRIPT) - CMAKE_PARSE_ARGUMENTS(ARG + MYSQL_PARSE_ARGUMENTS(ARG "DESTINATION;COMPONENT" "" ${ARGN} @@ -205,7 +205,7 @@ ENDMACRO() # FUNCTION(MYSQL_INSTALL_TARGETS) - CMAKE_PARSE_ARGUMENTS(ARG + MYSQL_PARSE_ARGUMENTS(ARG "DESTINATION;COMPONENT" "" ${ARGN} @@ -249,7 +249,7 @@ SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug FUNCTION(INSTALL_DEBUG_TARGET target) - CMAKE_PARSE_ARGUMENTS(ARG + MYSQL_PARSE_ARGUMENTS(ARG "DESTINATION;RENAME;PDB_DESTINATION;COMPONENT" "" ${ARGN} diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index ba63df71428..0cc8895f43e 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -213,7 +213,7 @@ ENDMACRO() # [OUTPUT_NAME output_name] #) MACRO(MERGE_LIBRARIES) - CMAKE_PARSE_ARGUMENTS(ARG + MYSQL_PARSE_ARGUMENTS(ARG "EXPORTS;OUTPUT_NAME;COMPONENT" "STATIC;SHARED;MODULE;NOINSTALL" ${ARGN} diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake index 86301c2eec8..b49a737716c 100644 --- a/cmake/mysql_add_executable.cmake +++ b/cmake/mysql_add_executable.cmake @@ -28,7 +28,7 @@ INCLUDE(cmake_parse_arguments) FUNCTION (MYSQL_ADD_EXECUTABLE)
# Pass-through arguments for ADD_EXECUTABLE
- CMAKE_PARSE_ARGUMENTS(ARG
+ MYSQL_PARSE_ARGUMENTS(ARG
"WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION;COMPONENT"
""
${ARGN}
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 138901dfa8a..94fdc8bf1e9 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -28,7 +28,7 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) # [DEPENDENCIES target1...targetN] MACRO(MYSQL_ADD_PLUGIN) - CMAKE_PARSE_ARGUMENTS(ARG + MYSQL_PARSE_ARGUMENTS(ARG "LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME" "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED" ${ARGN} diff --git a/config.h.cmake b/config.h.cmake index c484edb65a5..7047cc6bbf5 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -220,7 +220,6 @@ #cmakedefine HAVE_PTHREAD_KEY_DELETE 1 #cmakedefine HAVE_PTHREAD_KILL 1 #cmakedefine HAVE_PTHREAD_RWLOCK_RDLOCK 1 -#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP 1 #cmakedefine HAVE_PTHREAD_SETPRIO_NP 1 #cmakedefine HAVE_PTHREAD_SETSCHEDPARAM 1 #cmakedefine HAVE_PTHREAD_SIGMASK 1 diff --git a/config/ac-macros/maintainer.m4 b/config/ac-macros/maintainer.m4 index 1b7df75d6f7..24be31395f2 100644 --- a/config/ac-macros/maintainer.m4 +++ b/config/ac-macros/maintainer.m4 @@ -16,7 +16,7 @@ AC_DEFUN([MY_MAINTAINER_MODE], [ AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [ # Setup GCC warning options. AS_IF([test "$GCC" = "yes"], [ - C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror" + C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror" CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter" ]) diff --git a/configure.cmake b/configure.cmake index c2e1dc4647b..91c39fc5b09 100644 --- a/configure.cmake +++ b/configure.cmake @@ -346,7 +346,6 @@ CHECK_FUNCTION_EXISTS (pthread_condattr_setclock HAVE_PTHREAD_CONDATTR_SETCLOCK) CHECK_FUNCTION_EXISTS (pthread_init HAVE_PTHREAD_INIT) CHECK_FUNCTION_EXISTS (pthread_key_delete HAVE_PTHREAD_KEY_DELETE) CHECK_FUNCTION_EXISTS (pthread_rwlock_rdlock HAVE_PTHREAD_RWLOCK_RDLOCK) -CHECK_FUNCTION_EXISTS (pthread_rwlockattr_setkind_np HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP) CHECK_FUNCTION_EXISTS (pthread_sigmask HAVE_PTHREAD_SIGMASK) CHECK_FUNCTION_EXISTS (pthread_threadmask HAVE_PTHREAD_THREADMASK) CHECK_FUNCTION_EXISTS (pthread_yield_np HAVE_PTHREAD_YIELD_NP) diff --git a/configure.in b/configure.in index 59d08f0a9e5..4cde9ce1597 100644 --- a/configure.in +++ b/configure.in @@ -27,7 +27,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.5.6-m3], [], [mysql]) +AC_INIT([MySQL Server], [5.5.7-rc], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM @@ -2169,7 +2169,7 @@ AC_CHECK_FUNCS(alarm bfill bmove bsearch bzero \ mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \ pthread_attr_getstacksize pthread_attr_setstacksize pthread_condattr_create \ pthread_getsequence_np pthread_key_delete pthread_rwlock_rdlock \ - pthread_rwlockattr_setkind_np pthread_sigmask \ + pthread_sigmask \ readlink realpath rename rint rwlock_init setupterm \ shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \ sighold sigset sigthreadmask port_create sleep thr_yield \ diff --git a/dbug/dbug.c b/dbug/dbug.c index fd87669b8ca..5029bbb8d61 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -515,11 +515,16 @@ int DbugParse(CODE_STATE *cs, const char *control) stack->maxdepth= stack->next->maxdepth; stack->sub_level= stack->next->sub_level; strcpy(stack->name, stack->next->name); - stack->out_file= stack->next->out_file; stack->prof_file= stack->next->prof_file; if (stack->next == &init_settings) { - /* never share with the global parent - it can change under your feet */ + /* + Never share with the global parent - it can change under your feet. + + Reset out_file to stderr to prevent sharing of trace files between + global and session settings. + */ + stack->out_file= stderr; stack->functions= ListCopy(init_settings.functions); stack->p_functions= ListCopy(init_settings.p_functions); stack->keywords= ListCopy(init_settings.keywords); @@ -527,6 +532,7 @@ int DbugParse(CODE_STATE *cs, const char *control) } else { + stack->out_file= stack->next->out_file; stack->functions= stack->next->functions; stack->p_functions= stack->next->p_functions; stack->keywords= stack->next->keywords; @@ -1335,15 +1341,11 @@ void _db_doprnt_(const char *format,...) * This function is intended as a * vfprintf clone with consistent, platform independent output for * problematic formats like %p, %zd and %lld. - * However: full functionality for my_vsnprintf has not been backported yet, - * so code using "%g" or "%f" will have undefined behaviour. */ static void DbugVfprintf(FILE *stream, const char* format, va_list args) { char cvtbuf[1024]; - size_t len; - /* Do not use my_vsnprintf, it does not support "%g". */ - len = vsnprintf(cvtbuf, sizeof(cvtbuf), format, args); + (void) my_vsnprintf(cvtbuf, sizeof(cvtbuf), format, args); (void) fprintf(stream, "%s\n", cvtbuf); } diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index aee7561d242..5334fc0f5ae 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -54,6 +54,7 @@ SET(HEADERS keycache.h m_ctype.h my_attribute.h + my_compiler.h ${HEADERS_GEN_CONFIGURE} ) diff --git a/include/Makefile.am b/include/Makefile.am index e30588de065..909f68936dc 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -26,12 +26,15 @@ HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \ my_xml.h mysql_embed.h mysql/services.h \ mysql/service_my_snprintf.h mysql/service_thd_alloc.h \ + mysql/service_thread_scheduler.h \ + mysql/service_thd_wait.h \ my_pthread.h my_no_pthread.h \ decimal.h errmsg.h my_global.h my_net.h \ my_getopt.h sslopt-longopts.h my_dir.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ - m_ctype.h my_attribute.h $(HEADERS_GEN_CONFIGURE) \ - $(HEADERS_GEN_MAKE) probes_mysql.h probes_mysql_nodtrace.h + m_ctype.h my_attribute.h my_compiler.h \ + $(HEADERS_GEN_CONFIGURE) $(HEADERS_GEN_MAKE) \ + probes_mysql.h probes_mysql_nodtrace.h noinst_HEADERS = lf.h my_bit.h \ heap.h my_bitmap.h my_uctype.h password.h \ @@ -45,7 +48,7 @@ noinst_HEADERS = lf.h my_bit.h \ my_user.h my_atomic.h atomic/nolock.h \ atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \ atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \ - atomic/solaris.h mysql/innodb_priv.h my_compiler.h + atomic/solaris.h mysql/innodb_priv.h pkgpsiinclude_HEADERS = mysql/psi/psi.h mysql/psi/mysql_thread.h \ mysql/psi/mysql_file.h diff --git a/include/atomic/x86-gcc.h b/include/atomic/x86-gcc.h index 8baa84e110e..90602ef900c 100644 --- a/include/atomic/x86-gcc.h +++ b/include/atomic/x86-gcc.h @@ -111,9 +111,9 @@ On some platforms (e.g. Mac OS X and Solaris) the ebx register is held as a pointer to the global offset table. Thus we're not allowed to use the b-register on those platforms when compiling - PIC code, to avoid this we push ebx and pop ebx and add a movl - instruction to avoid having ebx in the interface of the assembler - instruction. + PIC code, to avoid this we push ebx and pop ebx. The new value + is copied directly from memory to avoid problems with a implicit + manipulation of the stack pointer by the push. cmpxchg8b works on both 32-bit platforms and 64-bit platforms but the code here is only used on 32-bit platforms, on 64-bit @@ -121,11 +121,13 @@ fine. */ #define make_atomic_cas_body64 \ - int32 ebx=(set & 0xFFFFFFFF), ecx=(set >> 32); \ - asm volatile ("push %%ebx; movl %3, %%ebx;" \ - LOCK_prefix "; cmpxchg8b %0; setz %2; pop %%ebx" \ - : "=m" (*a), "+A" (*cmp), "=c" (ret) \ - : "m" (ebx), "c" (ecx), "m" (*a) \ + asm volatile ("push %%ebx;" \ + "movl (%%ecx), %%ebx;" \ + "movl 4(%%ecx), %%ecx;" \ + LOCK_prefix "; cmpxchg8b %0;" \ + "setz %2; pop %%ebx" \ + : "=m" (*a), "+A" (*cmp), "=c" (ret) \ + : "c" (&set), "m" (*a) \ : "memory", "esp") #endif diff --git a/include/m_ctype.h b/include/m_ctype.h index 06cbfd779c8..42e8f88cc0e 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -539,6 +539,11 @@ size_t my_strnxfrm_unicode(CHARSET_INFO *, uchar *dst, size_t dstlen, const uchar *src, size_t srclen); +size_t my_strnxfrm_unicode_full_bin(CHARSET_INFO *, + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen); +size_t my_strnxfrmlen_unicode_full_bin(CHARSET_INFO *, size_t); + int my_wildcmp_unicode(CHARSET_INFO *cs, const char *str, const char *str_end, const char *wildstr, const char *wildend, diff --git a/include/my_pthread.h b/include/my_pthread.h index 5cf181596ad..27ab5ba23fe 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -594,7 +594,7 @@ int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp); /* Use our own version of read/write locks */ #define NEED_MY_RW_LOCK 1 #define rw_lock_t my_rw_lock_t -#define my_rwlock_init(A,B) my_rw_init((A), 0) +#define my_rwlock_init(A,B) my_rw_init((A)) #define rw_rdlock(A) my_rw_rdlock((A)) #define rw_wrlock(A) my_rw_wrlock((A)) #define rw_tryrdlock(A) my_rw_tryrdlock((A)) @@ -606,49 +606,82 @@ int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp); #endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */ -/* - Portable read-write locks which prefer readers. - - Required by some algorithms in order to provide correctness. +/** + Portable implementation of special type of read-write locks. + + These locks have two properties which are unusual for rwlocks: + 1) They "prefer readers" in the sense that they do not allow + situations in which rwlock is rd-locked and there is a + pending rd-lock which is blocked (e.g. due to pending + request for wr-lock). + This is a stronger guarantee than one which is provided for + PTHREAD_RWLOCK_PREFER_READER_NP rwlocks in Linux. + MDL subsystem deadlock detector relies on this property for + its correctness. + 2) They are optimized for uncontended wr-lock/unlock case. + This is scenario in which they are most oftenly used + within MDL subsystem. Optimizing for it gives significant + performance improvements in some of tests involving many + connections. + + Another important requirement imposed on this type of rwlock + by the MDL subsystem is that it should be OK to destroy rwlock + object which is in unlocked state even though some threads might + have not yet fully left unlock operation for it (of course there + is an external guarantee that no thread will try to lock rwlock + which is destroyed). + Putting it another way the unlock operation should not access + rwlock data after changing its state to unlocked. + + TODO/FIXME: We should consider alleviating this requirement as + it blocks us from doing certain performance optimizations. */ -#if defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP) -/* - On systems which have a way to specify that readers should - be preferred through attribute mechanism (e.g. Linux) we use - system implementation of read/write locks. -*/ -#define rw_pr_lock_t pthread_rwlock_t +typedef struct st_rw_pr_lock_t { + /** + Lock which protects the structure. + Also held for the duration of wr-lock. + */ + pthread_mutex_t lock; + /** + Condition variable which is used to wake-up + writers waiting for readers to go away. + */ + pthread_cond_t no_active_readers; + /** Number of active readers. */ + uint active_readers; + /** Number of writers waiting for readers to go away. */ + uint writers_waiting_readers; + /** Indicates whether there is an active writer. */ + my_bool active_writer; +#ifdef SAFE_MUTEX + /** Thread holding wr-lock (for debug purposes only). */ + pthread_t writer_thread; +#endif +} rw_pr_lock_t; + extern int rw_pr_init(rw_pr_lock_t *); -#define rw_pr_rdlock(A) pthread_rwlock_rdlock(A) -#define rw_pr_wrlock(A) pthread_rwlock_wrlock(A) -#define rw_pr_tryrdlock(A) pthread_rwlock_tryrdlock(A) -#define rw_pr_trywrlock(A) pthread_rwlock_trywrlock(A) -#define rw_pr_unlock(A) pthread_rwlock_unlock(A) -#define rw_pr_destroy(A) pthread_rwlock_destroy(A) +extern int rw_pr_rdlock(rw_pr_lock_t *); +extern int rw_pr_wrlock(rw_pr_lock_t *); +extern int rw_pr_unlock(rw_pr_lock_t *); +extern int rw_pr_destroy(rw_pr_lock_t *); +#ifdef SAFE_MUTEX +#define rw_pr_lock_assert_write_owner(A) \ + DBUG_ASSERT((A)->active_writer && pthread_equal(pthread_self(), \ + (A)->writer_thread)) +#define rw_pr_lock_assert_not_write_owner(A) \ + DBUG_ASSERT(! (A)->active_writer || ! pthread_equal(pthread_self(), \ + (A)->writer_thread)) +#else #define rw_pr_lock_assert_write_owner(A) #define rw_pr_lock_assert_not_write_owner(A) -#else -/* Otherwise we have to use our own implementation of read/write locks. */ -#define NEED_MY_RW_LOCK 1 -struct st_my_rw_lock_t; -#define rw_pr_lock_t my_rw_lock_t -extern int rw_pr_init(struct st_my_rw_lock_t *); -#define rw_pr_rdlock(A) my_rw_rdlock((A)) -#define rw_pr_wrlock(A) my_rw_wrlock((A)) -#define rw_pr_tryrdlock(A) my_rw_tryrdlock((A)) -#define rw_pr_trywrlock(A) my_rw_trywrlock((A)) -#define rw_pr_unlock(A) my_rw_unlock((A)) -#define rw_pr_destroy(A) my_rw_destroy((A)) -#define rw_pr_lock_assert_write_owner(A) my_rw_lock_assert_write_owner((A)) -#define rw_pr_lock_assert_not_write_owner(A) my_rw_lock_assert_not_write_owner((A)) -#endif /* defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP) */ +#endif /* SAFE_MUTEX */ #ifdef NEED_MY_RW_LOCK /* - On systems which don't support native read/write locks, or don't support - read/write locks which prefer readers we have to use own implementation. + On systems which don't support native read/write locks we have + to use own implementation. */ typedef struct st_my_rw_lock_t { pthread_mutex_t lock; /* lock for structure */ @@ -656,13 +689,12 @@ typedef struct st_my_rw_lock_t { pthread_cond_t writers; /* waiting writers */ int state; /* -1:writer,0:free,>0:readers */ int waiters; /* number of waiting writers */ - my_bool prefer_readers; #ifdef SAFE_MUTEX pthread_t write_thread; #endif } my_rw_lock_t; -extern int my_rw_init(my_rw_lock_t *, my_bool *); +extern int my_rw_init(my_rw_lock_t *); extern int my_rw_destroy(my_rw_lock_t *); extern int my_rw_rdlock(my_rw_lock_t *); extern int my_rw_wrlock(my_rw_lock_t *); diff --git a/include/mysql.h b/include/mysql.h index dc6e4eb19a6..fdb29124d68 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -208,7 +208,8 @@ struct st_mysql_options { enum mysql_status { - MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT + MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT, + MYSQL_STATUS_STATEMENT_GET_RESULT }; enum mysql_protocol_type diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 531062aee80..c7bc5c294ce 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -297,7 +297,8 @@ struct st_mysql_options { }; enum mysql_status { - MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT + MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT, + MYSQL_STATUS_STATEMENT_GET_RESULT }; enum mysql_protocol_type { diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index 15f7d785ead..43de7deef74 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -71,7 +71,7 @@ typedef struct st_mysql_xid MYSQL_XID; Plugin API. Common for all plugin types. */ -#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0101 +#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0102 /* The allowable types of plugins diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp new file mode 100644 index 00000000000..b48cbca2e87 --- /dev/null +++ b/include/mysql/plugin_audit.h.pp @@ -0,0 +1,217 @@ +#include "plugin.h" +#include <mysql/services.h> +#include <mysql/service_my_snprintf.h> +extern struct my_snprintf_service_st { + size_t (*my_snprintf_type)(char*, size_t, const char*, ...); + size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list); +} *my_snprintf_service; +size_t my_snprintf(char* to, size_t n, const char* fmt, ...); +size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap); +#include <mysql/service_thd_alloc.h> +struct st_mysql_lex_string +{ + char *str; + size_t length; +}; +typedef struct st_mysql_lex_string MYSQL_LEX_STRING; +extern struct thd_alloc_service_st { + void *(*thd_alloc_func)(void*, unsigned int); + void *(*thd_calloc_func)(void*, unsigned int); + char *(*thd_strdup_func)(void*, const char *); + char *(*thd_strmake_func)(void*, const char *, unsigned int); + void *(*thd_memdup_func)(void*, const void*, unsigned int); + MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *, + const char *, unsigned int, int); +} *thd_alloc_service; +void *thd_alloc(void* thd, unsigned int size); +void *thd_calloc(void* thd, unsigned int size); +char *thd_strdup(void* thd, const char *str); +char *thd_strmake(void* thd, const char *str, unsigned int size); +void *thd_memdup(void* thd, const void* str, unsigned int size); +MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str, + const char *str, unsigned int size, + int allocate_lex_string); +#include <mysql/service_thd_wait.h> +typedef enum _thd_wait_type_e { + THD_WAIT_MUTEX= 1, + THD_WAIT_DISKIO= 2, + THD_WAIT_ROW_TABLE_LOCK= 3, + THD_WAIT_GLOBAL_LOCK= 4 +} thd_wait_type; +extern struct thd_wait_service_st { + void (*thd_wait_begin_func)(void*, thd_wait_type); + void (*thd_wait_end_func)(void*); +} *thd_wait_service; +void thd_wait_begin(void* thd, thd_wait_type wait_type); +void thd_wait_end(void* thd); +#include <mysql/service_thread_scheduler.h> +struct scheduler_functions; +extern struct my_thread_scheduler_service { + int (*set)(struct scheduler_functions *scheduler); + int (*reset)(); +} *my_thread_scheduler_service; +int my_thread_scheduler_set(struct scheduler_functions *scheduler); +int my_thread_scheduler_reset(); +struct st_mysql_xid { + long formatID; + long gtrid_length; + long bqual_length; + char data[128]; +}; +typedef struct st_mysql_xid MYSQL_XID; +enum enum_mysql_show_type +{ + SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG, + SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, + SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE, + SHOW_always_last +}; +struct st_mysql_show_var { + const char *name; + char *value; + enum enum_mysql_show_type type; +}; +typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *); +struct st_mysql_sys_var; +struct st_mysql_value; +typedef int (*mysql_var_check_func)(void* thd, + struct st_mysql_sys_var *var, + void *save, struct st_mysql_value *value); +typedef void (*mysql_var_update_func)(void* thd, + struct st_mysql_sys_var *var, + void *var_ptr, const void *save); +struct st_mysql_plugin +{ + int type; + void *info; + const char *name; + const char *author; + const char *descr; + int license; + int (*init)(void *); + int (*deinit)(void *); + unsigned int version; + struct st_mysql_show_var *status_vars; + struct st_mysql_sys_var **system_vars; + void * __reserved1; +}; +#include "plugin_ftparser.h" +#include "plugin.h" +enum enum_ftparser_mode +{ + MYSQL_FTPARSER_SIMPLE_MODE= 0, + MYSQL_FTPARSER_WITH_STOPWORDS= 1, + MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2 +}; +enum enum_ft_token_type +{ + FT_TOKEN_EOF= 0, + FT_TOKEN_WORD= 1, + FT_TOKEN_LEFT_PAREN= 2, + FT_TOKEN_RIGHT_PAREN= 3, + FT_TOKEN_STOPWORD= 4 +}; +typedef struct st_mysql_ftparser_boolean_info +{ + enum enum_ft_token_type type; + int yesno; + int weight_adjust; + char wasign; + char trunc; + char prev; + char *quot; +} MYSQL_FTPARSER_BOOLEAN_INFO; +typedef struct st_mysql_ftparser_param +{ + int (*mysql_parse)(struct st_mysql_ftparser_param *, + char *doc, int doc_len); + int (*mysql_add_word)(struct st_mysql_ftparser_param *, + char *word, int word_len, + MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info); + void *ftparser_state; + void *mysql_ftparam; + struct charset_info_st *cs; + char *doc; + int length; + int flags; + enum enum_ftparser_mode mode; +} MYSQL_FTPARSER_PARAM; +struct st_mysql_ftparser +{ + int interface_version; + int (*parse)(MYSQL_FTPARSER_PARAM *param); + int (*init)(MYSQL_FTPARSER_PARAM *param); + int (*deinit)(MYSQL_FTPARSER_PARAM *param); +}; +struct st_mysql_daemon +{ + int interface_version; +}; +struct st_mysql_information_schema +{ + int interface_version; +}; +struct st_mysql_storage_engine +{ + int interface_version; +}; +struct handlerton; + struct Mysql_replication { + int interface_version; + }; +struct st_mysql_value +{ + int (*value_type)(struct st_mysql_value *); + const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length); + int (*val_real)(struct st_mysql_value *, double *realbuf); + int (*val_int)(struct st_mysql_value *, long long *intbuf); + int (*is_unsigned)(struct st_mysql_value *); +}; +int thd_in_lock_tables(const void* thd); +int thd_tablespace_op(const void* thd); +long long thd_test_options(const void* thd, long long test_options); +int thd_sql_command(const void* thd); +const char *thd_proc_info(void* thd, const char *info); +void **thd_ha_data(const void* thd, const struct handlerton *hton); +void thd_storage_lock_wait(void* thd, long long value); +int thd_tx_isolation(const void* thd); +char *thd_security_context(void* thd, char *buffer, unsigned int length, + unsigned int max_query_len); +void thd_inc_row_count(void* thd); +int mysql_tmpfile(const char *prefix); +int thd_killed(const void* thd); +unsigned long thd_get_thread_id(const void* thd); +void thd_get_xid(const void* thd, MYSQL_XID *xid); +void mysql_query_cache_invalidate4(void* thd, + const char *key, unsigned int key_length, + int using_trx); +void *thd_get_ha_data(const void* thd, const struct handlerton *hton); +void thd_set_ha_data(void* thd, const struct handlerton *hton, + const void *ha_data); +struct mysql_event +{ + unsigned int event_class; +}; +struct mysql_event_general +{ + unsigned int event_class; + unsigned int event_subclass; + int general_error_code; + unsigned long general_thread_id; + const char *general_user; + unsigned int general_user_length; + const char *general_command; + unsigned int general_command_length; + const char *general_query; + unsigned int general_query_length; + struct charset_info_st *general_charset; + unsigned long long general_time; + unsigned long long general_rows; +}; +struct st_mysql_audit +{ + int interface_version; + void (*release_thd)(void*); + void (*event_notify)(void*, const struct mysql_event *); + unsigned long class_mask[1]; +}; diff --git a/include/mysql/plugin.h.pp b/include/mysql/plugin_ftparser.h.pp index 55d62b8daab..2c2c1adbf88 100644 --- a/include/mysql/plugin.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -1,3 +1,4 @@ +#include "plugin.h" #include <mysql/services.h> #include <mysql/service_my_snprintf.h> extern struct my_snprintf_service_st { @@ -30,6 +31,27 @@ void *thd_memdup(void* thd, const void* str, unsigned int size); MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str, const char *str, unsigned int size, int allocate_lex_string); +#include <mysql/service_thd_wait.h> +typedef enum _thd_wait_type_e { + THD_WAIT_MUTEX= 1, + THD_WAIT_DISKIO= 2, + THD_WAIT_ROW_TABLE_LOCK= 3, + THD_WAIT_GLOBAL_LOCK= 4 +} thd_wait_type; +extern struct thd_wait_service_st { + void (*thd_wait_begin_func)(void*, thd_wait_type); + void (*thd_wait_end_func)(void*); +} *thd_wait_service; +void thd_wait_begin(void* thd, thd_wait_type wait_type); +void thd_wait_end(void* thd); +#include <mysql/service_thread_scheduler.h> +struct scheduler_functions; +extern struct my_thread_scheduler_service { + int (*set)(struct scheduler_functions *scheduler); + int (*reset)(); +} *my_thread_scheduler_service; +int my_thread_scheduler_set(struct scheduler_functions *scheduler); +int my_thread_scheduler_reset(); struct st_mysql_xid { long formatID; long gtrid_length; @@ -74,7 +96,51 @@ struct st_mysql_plugin void * __reserved1; }; #include "plugin_ftparser.h" -#include "plugin.h" +struct st_mysql_daemon +{ + int interface_version; +}; +struct st_mysql_information_schema +{ + int interface_version; +}; +struct st_mysql_storage_engine +{ + int interface_version; +}; +struct handlerton; + struct Mysql_replication { + int interface_version; + }; +struct st_mysql_value +{ + int (*value_type)(struct st_mysql_value *); + const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length); + int (*val_real)(struct st_mysql_value *, double *realbuf); + int (*val_int)(struct st_mysql_value *, long long *intbuf); + int (*is_unsigned)(struct st_mysql_value *); +}; +int thd_in_lock_tables(const void* thd); +int thd_tablespace_op(const void* thd); +long long thd_test_options(const void* thd, long long test_options); +int thd_sql_command(const void* thd); +const char *thd_proc_info(void* thd, const char *info); +void **thd_ha_data(const void* thd, const struct handlerton *hton); +void thd_storage_lock_wait(void* thd, long long value); +int thd_tx_isolation(const void* thd); +char *thd_security_context(void* thd, char *buffer, unsigned int length, + unsigned int max_query_len); +void thd_inc_row_count(void* thd); +int mysql_tmpfile(const char *prefix); +int thd_killed(const void* thd); +unsigned long thd_get_thread_id(const void* thd); +void thd_get_xid(const void* thd, MYSQL_XID *xid); +void mysql_query_cache_invalidate4(void* thd, + const char *key, unsigned int key_length, + int using_trx); +void *thd_get_ha_data(const void* thd, const struct handlerton *hton); +void thd_set_ha_data(void* thd, const struct handlerton *hton, + const void *ha_data); enum enum_ftparser_mode { MYSQL_FTPARSER_SIMPLE_MODE= 0, @@ -121,48 +187,3 @@ struct st_mysql_ftparser int (*init)(MYSQL_FTPARSER_PARAM *param); int (*deinit)(MYSQL_FTPARSER_PARAM *param); }; -struct st_mysql_daemon -{ - int interface_version; -}; -struct st_mysql_information_schema -{ - int interface_version; -}; -struct st_mysql_storage_engine -{ - int interface_version; -}; -struct handlerton; - struct Mysql_replication { - int interface_version; - }; -struct st_mysql_value -{ - int (*value_type)(struct st_mysql_value *); - const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length); - int (*val_real)(struct st_mysql_value *, double *realbuf); - int (*val_int)(struct st_mysql_value *, long long *intbuf); - int (*is_unsigned)(struct st_mysql_value *); -}; -int thd_in_lock_tables(const void* thd); -int thd_tablespace_op(const void* thd); -long long thd_test_options(const void* thd, long long test_options); -int thd_sql_command(const void* thd); -const char *thd_proc_info(void* thd, const char *info); -void **thd_ha_data(const void* thd, const struct handlerton *hton); -void thd_storage_lock_wait(void* thd, long long value); -int thd_tx_isolation(const void* thd); -char *thd_security_context(void* thd, char *buffer, unsigned int length, - unsigned int max_query_len); -void thd_inc_row_count(void* thd); -int mysql_tmpfile(const char *prefix); -int thd_killed(const void* thd); -unsigned long thd_get_thread_id(const void* thd); -void thd_get_xid(const void* thd, MYSQL_XID *xid); -void mysql_query_cache_invalidate4(void* thd, - const char *key, unsigned int key_length, - int using_trx); -void *thd_get_ha_data(const void* thd, const struct handlerton *hton); -void thd_set_ha_data(void* thd, const struct handlerton *hton, - const void *ha_data); diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h index 60b4f5d6ef4..5b8ea3dc5dc 100644 --- a/include/mysql/psi/mysql_thread.h +++ b/include/mysql/psi/mysql_thread.h @@ -141,9 +141,7 @@ typedef struct st_mysql_rwlock mysql_rwlock_t; @c mysql_prlock_t is a drop-in replacement for @c rw_pr_lock_t. @sa mysql_prlock_init @sa mysql_prlock_rdlock - @sa mysql_prlock_tryrdlock @sa mysql_prlock_wrlock - @sa mysql_prlock_trywrlock @sa mysql_prlock_unlock @sa mysql_prlock_destroy */ @@ -421,20 +419,6 @@ typedef struct st_mysql_cond mysql_cond_t; #endif /** - @def mysql_prlock_tryrdlock(RW) - Instrumented rw_pr_tryrdlock. - @c mysql_prlock_tryrdlock is a drop-in replacement - for @c rw_pr_tryrdlock. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_prlock_tryrdlock(RW) \ - inline_mysql_prlock_tryrdlock(RW, __FILE__, __LINE__) -#else - #define mysql_prlock_tryrdlock(RW) \ - inline_mysql_prlock_tryrdlock(RW) -#endif - -/** @def mysql_rwlock_trywrlock(RW) Instrumented rwlock_trywrlock. @c mysql_rwlock_trywrlock is a drop-in replacement @@ -449,20 +433,6 @@ typedef struct st_mysql_cond mysql_cond_t; #endif /** - @def mysql_prlock_trywrlock(RW) - Instrumented rw_pr_trywrlock. - @c mysql_prlock_trywrlock is a drop-in replacement - for @c rw_pr_trywrlock. -*/ -#ifdef HAVE_PSI_INTERFACE - #define mysql_prlock_trywrlock(RW) \ - inline_mysql_prlock_trywrlock(RW, __FILE__, __LINE__) -#else - #define mysql_prlock_trywrlock(RW) \ - inline_mysql_prlock_trywrlock(RW) -#endif - -/** @def mysql_rwlock_unlock(RW) Instrumented rwlock_unlock. @c mysql_rwlock_unlock is a drop-in replacement @@ -905,35 +875,6 @@ static inline int inline_mysql_rwlock_tryrdlock( return result; } -#ifndef DISABLE_MYSQL_PRLOCK_H -static inline int inline_mysql_prlock_tryrdlock( - mysql_prlock_t *that -#ifdef HAVE_PSI_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_rwlock_locker *locker= NULL; - PSI_rwlock_locker_state state; - if (likely(PSI_server && that->m_psi)) - { - locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, - PSI_RWLOCK_TRYREADLOCK); - if (likely(locker != NULL)) - PSI_server->start_rwlock_rdwait(locker, src_file, src_line); - } -#endif - result= rw_pr_tryrdlock(&that->m_prlock); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_rwlock_rdwait(locker, result); -#endif - return result; -} -#endif - static inline int inline_mysql_rwlock_trywrlock( mysql_rwlock_t *that #ifdef HAVE_PSI_INTERFACE @@ -961,35 +902,6 @@ static inline int inline_mysql_rwlock_trywrlock( return result; } -#ifndef DISABLE_MYSQL_PRLOCK_H -static inline int inline_mysql_prlock_trywrlock( - mysql_prlock_t *that -#ifdef HAVE_PSI_INTERFACE - , const char *src_file, uint src_line -#endif - ) -{ - int result; -#ifdef HAVE_PSI_INTERFACE - struct PSI_rwlock_locker *locker= NULL; - PSI_rwlock_locker_state state; - if (likely(PSI_server && that->m_psi)) - { - locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi, - PSI_RWLOCK_TRYWRITELOCK); - if (likely(locker != NULL)) - PSI_server->start_rwlock_wrwait(locker, src_file, src_line); - } -#endif - result= rw_pr_trywrlock(&that->m_prlock); -#ifdef HAVE_PSI_INTERFACE - if (likely(locker != NULL)) - PSI_server->end_rwlock_wrwait(locker, result); -#endif - return result; -} -#endif - static inline int inline_mysql_rwlock_unlock( mysql_rwlock_t *that) { diff --git a/include/mysql/service_my_snprintf.h b/include/mysql/service_my_snprintf.h index d7f8d07e110..f6b4aa39dc5 100644 --- a/include/mysql/service_my_snprintf.h +++ b/include/mysql/service_my_snprintf.h @@ -53,7 +53,7 @@ <length modifier> can be 'l', 'll', or 'z'. Supported formats are 's' (null pointer is accepted, printed as - "(null)"), 'b' (extension, see below), 'c', 'd', 'u', 'x', 'o', + "(null)"), 'b' (extension, see below), 'c', 'd', 'i', 'u', 'x', 'o', 'X', 'p' (works as 0x%x). Standard syntax for positional arguments $n is supported. diff --git a/include/mysql/service_thd_wait.h b/include/mysql/service_thd_wait.h new file mode 100644 index 00000000000..2a8f5e610a3 --- /dev/null +++ b/include/mysql/service_thd_wait.h @@ -0,0 +1,83 @@ +/* Copyright (C) 2010, Oracle and/or its affiliates. All rights reserved. + + 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; version 2 of the License. + + 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 */ + +#ifndef MYSQL_SERVICE_THD_WAIT_INCLUDED +#define MYSQL_SERVICE_THD_WAIT_INCLUDED + +/** + @file include/mysql/service_thd_wait.h + This service provides functions for plugins and storage engines to report + when they are going to sleep/stall. + + SYNOPSIS + thd_wait_begin() - call just before a wait begins + thd Thread object + Use NULL if the thd is NOT known. + wait_type Type of wait + 1 -- short wait (e.g. for mutex) + 2 -- medium wait (e.g. for disk io) + 3 -- large wait (e.g. for locked row/table) + NOTES + This is used by the threadpool to have better knowledge of which + threads that currently are actively running on CPUs. When a thread + reports that it's going to sleep/stall, the threadpool scheduler is + free to start another thread in the pool most likely. The expected wait + time is simply an indication of how long the wait is expected to + become, the real wait time could be very different. + + thd_wait_end() called immediately after the wait is complete + + thd_wait_end() MUST be called if thd_wait_begin() was called. + + Using thd_wait_...() service is optional but recommended. Using it will + improve performance as the thread pool will be more active at managing the + thread workload. +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum _thd_wait_type_e { + THD_WAIT_MUTEX= 1, + THD_WAIT_DISKIO= 2, + THD_WAIT_ROW_TABLE_LOCK= 3, + THD_WAIT_GLOBAL_LOCK= 4 +} thd_wait_type; + +extern struct thd_wait_service_st { + void (*thd_wait_begin_func)(MYSQL_THD, thd_wait_type); + void (*thd_wait_end_func)(MYSQL_THD); +} *thd_wait_service; + +#ifdef MYSQL_DYNAMIC_PLUGIN + +#define thd_wait_begin(_THD, _WAIT_TYPE) \ + thd_wait_service->thd_wait_begin_func(_THD, _WAIT_TYPE) +#define thd_wait_end(_THD) thd_wait_service->thd_wait_end_func(_THD) + +#else + +void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type); +void thd_wait_end(MYSQL_THD thd); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/include/mysql/service_thread_scheduler.h b/include/mysql/service_thread_scheduler.h new file mode 100644 index 00000000000..a4396b721bd --- /dev/null +++ b/include/mysql/service_thread_scheduler.h @@ -0,0 +1,65 @@ +/* + Copyright (C) 2010, Oracle and/or its affiliates. All rights reserved. + + 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; version 2 of the License. + + 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 +*/ + +#ifndef SERVICE_THREAD_SCHEDULER_INCLUDED +#define SERVICE_THREAD_SCHEDULER_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +struct scheduler_functions; + +extern struct my_thread_scheduler_service { + int (*set)(struct scheduler_functions *scheduler); + int (*reset)(); +} *my_thread_scheduler_service; + +#ifdef MYSQL_DYNAMIC_PLUGIN + +#define my_thread_scheduler_set(F) my_thread_scheduler_service->set((F)) +#define my_thread_scheduler_reset() my_thread_scheduler_service->reset() + +#else + +/** + Set the thread scheduler to use for the server. + + @param scheduler Pointer to scheduler callbacks to use. + @retval 0 Scheduler installed correctly. + @retval 1 Invalid value (NULL) used for scheduler. +*/ +int my_thread_scheduler_set(struct scheduler_functions *scheduler); + +/** + Restore the previous thread scheduler. + + @note If no thread scheduler was installed previously with + thd_set_thread_scheduler, this function will report an error. + + @retval 0 Scheduler installed correctly. + @retval 1 No scheduler installed. +*/ +int my_thread_scheduler_reset(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* SERVICE_THREAD_SCHEDULER_INCLUDED */ diff --git a/include/mysql/services.h b/include/mysql/services.h index 19003e66b96..6c67a582fb8 100644 --- a/include/mysql/services.h +++ b/include/mysql/services.h @@ -20,6 +20,8 @@ extern "C" { #include <mysql/service_my_snprintf.h> #include <mysql/service_thd_alloc.h> +#include <mysql/service_thd_wait.h> +#include <mysql/service_thread_scheduler.h> #ifdef __cplusplus } diff --git a/include/service_versions.h b/include/service_versions.h index 114957cdd86..4fd886c8a83 100644 --- a/include/service_versions.h +++ b/include/service_versions.h @@ -21,4 +21,5 @@ #define VERSION_my_snprintf 0x0100 #define VERSION_thd_alloc 0x0100 - +#define VERSION_thd_wait 0x0100 +#define VERSION_my_thread_scheduler 0x0100 diff --git a/include/thr_lock.h b/include/thr_lock.h index 5626c067e5e..91473737be3 100644 --- a/include/thr_lock.h +++ b/include/thr_lock.h @@ -155,6 +155,8 @@ void thr_downgrade_write_lock(THR_LOCK_DATA *data, enum thr_lock_type new_lock_type); my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data, ulong lock_wait_timeout); +void thr_set_lock_wait_callback(void (*before_wait)(void), + void (*after_wait)(void)); #ifdef __cplusplus } #endif diff --git a/include/violite.h b/include/violite.h index 05ceaa272c1..f4083216894 100644 --- a/include/violite.h +++ b/include/violite.h @@ -217,6 +217,7 @@ struct st_vio void (*timeout)(Vio*, unsigned int which, unsigned int timeout); my_bool (*poll_read)(Vio *vio, uint timeout); my_bool (*is_connected)(Vio*); + my_bool (*has_data) (Vio*); #ifdef HAVE_OPENSSL void *ssl_arg; #endif diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 550b1b7b107..a44395578c6 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -2118,6 +2118,8 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) set_stmt_errmsg(stmt, net); DBUG_RETURN(1); } + else if (mysql->status == MYSQL_STATUS_GET_RESULT) + stmt->mysql->status= MYSQL_STATUS_STATEMENT_GET_RESULT; DBUG_RETURN(0); } @@ -2256,7 +2258,7 @@ static int stmt_read_row_unbuffered(MYSQL_STMT *stmt, unsigned char **row) set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate, NULL); return 1; } - if (mysql->status != MYSQL_STATUS_GET_RESULT) + if (mysql->status != MYSQL_STATUS_STATEMENT_GET_RESULT) { set_stmt_error(stmt, stmt->unbuffered_fetch_cancelled ? CR_FETCH_CANCELED : CR_COMMANDS_OUT_OF_SYNC, @@ -4448,7 +4450,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt) DBUG_RETURN(1); } } - else if (mysql->status != MYSQL_STATUS_GET_RESULT) + else if (mysql->status != MYSQL_STATUS_STATEMENT_GET_RESULT) { set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate, NULL); DBUG_RETURN(1); @@ -4872,6 +4874,9 @@ int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt) DBUG_RETURN(rc); } + if (mysql->status == MYSQL_STATUS_GET_RESULT) + mysql->status= MYSQL_STATUS_STATEMENT_GET_RESULT; + stmt->state= MYSQL_STMT_EXECUTE_DONE; stmt->bind_result_done= FALSE; diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index b4083be0966..dabfa2b02cc 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -1,21 +1,17 @@ -# Copyright (C) 2001-2006 MySQL AB +# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. # -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; version 2 -# of the License. +# 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; version 2 of the License. # -# This library is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU Library General Public -# License along with this library; if not, write to the Free -# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA -# -# This file is public domain and comes with NO WARRANTY of any kind +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA MYSQLDATAdir = $(localstatedir) MYSQLSHAREdir = $(pkgdatadir) diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 94927c590cf..7d61dbc55f4 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -481,6 +481,10 @@ int init_embedded_server(int argc, char **argv, char **groups) char *fake_argv[] = { (char *)"", 0 }; const char *fake_groups[] = { "server", "embedded", 0 }; my_bool acl_error; + + if (my_thread_init()) + return 1; + if (argc) { argcp= &argc; diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt index 79431ff65fe..396430fba12 100644 --- a/libservices/CMakeLists.txt +++ b/libservices/CMakeLists.txt @@ -15,7 +15,11 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) -SET(MYSQLSERVICES_SOURCES my_snprintf_service.c thd_alloc_service.c) +SET(MYSQLSERVICES_SOURCES + my_snprintf_service.c + thd_alloc_service.c + thd_wait_service.c + my_thread_scheduler_service.c) ADD_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES}) INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR}) diff --git a/libservices/Makefile.am b/libservices/Makefile.am index 642081859c1..d25c5c9680c 100644 --- a/libservices/Makefile.am +++ b/libservices/Makefile.am @@ -15,5 +15,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include pkglib_LIBRARIES = libmysqlservices.a -libmysqlservices_a_SOURCES = my_snprintf_service.c thd_alloc_service.c +libmysqlservices_a_SOURCES = my_snprintf_service.c thd_alloc_service.c \ + thd_wait_service.c \ + my_thread_scheduler_service.c EXTRA_DIST = CMakeLists.txt diff --git a/libservices/my_thread_scheduler_service.c b/libservices/my_thread_scheduler_service.c new file mode 100644 index 00000000000..dc8d40c6713 --- /dev/null +++ b/libservices/my_thread_scheduler_service.c @@ -0,0 +1,21 @@ +/* + Copyright (C) 2010, Oracle and/or its affiliates. All rights reserved. + + 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; version 2 of the License. + + 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 +*/ + +#include <service_versions.h> +SERVICE_VERSION my_thread_scheduler_service= + (void*)VERSION_my_thread_scheduler; diff --git a/libservices/thd_wait_service.c b/libservices/thd_wait_service.c new file mode 100644 index 00000000000..3c87a2d0d1b --- /dev/null +++ b/libservices/thd_wait_service.c @@ -0,0 +1,19 @@ +/* + Copyright (C) 2010, Oracle and/or its affiliates. All rights reserved. + + 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; version 2 of the License. + + 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 +*/ + +#include <service_versions.h> +SERVICE_VERSION *thd_wait_service= (void*)VERSION_thd_wait; diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt index b8eb11b2fea..3c38e5772d0 100644 --- a/mysql-test/CMakeLists.txt +++ b/mysql-test/CMakeLists.txt @@ -13,6 +13,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +IF(INSTALL_MYSQLTESTDIR) INSTALL( DIRECTORY . DESTINATION ${INSTALL_MYSQLTESTDIR} @@ -28,6 +29,7 @@ INSTALL( PATTERN "*.am" EXCLUDE PATTERN "*.in" EXCLUDE ) +ENDIF() @@ -48,9 +50,11 @@ IF(UNIX) ./mysql-test-run.pl mysql-test-run WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mtr - ${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run - DESTINATION ${INSTALL_MYSQLTESTDIR}) + IF(INSTALL_MYSQLTESTDIR) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mtr + ${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run + DESTINATION ${INSTALL_MYSQLTESTDIR}) + ENDIF() ENDIF() IF(CMAKE_GENERATOR MATCHES "Visual Studio") diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 7609a4799e3..b292356f1c7 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -24,8 +24,6 @@ main.sp @solaris # Bug#47791 2010-01-20 alik Several tes main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris -parts.partition_alter4_innodb # Bug#45299 2010-06-28 alik Test "partition_alter4_innodb" is taking too long, timeout - rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically rpl.rpl_innodb_bug28430* # Bug#46029 @@ -92,5 +90,6 @@ parts.partition_mgm_lc1_ndb # joro : NDB tests marked as experiment parts.partition_mgm_lc2_ndb # joro : NDB tests marked as experimental as agreed with bochklin parts.partition_syntax_ndb # joro : NDB tests marked as experimental as agreed with bochklin parts.partition_value_ndb # joro : NDB tests marked as experimental as agreed with bochklin -main.mysqlhotcopy_myisam # horst: due to bug#54129 -main.mysqlhotcopy_archive # horst: due to bug#54129 +main.gis-rtree # svoj: due to BUG#38965 +main.type_float # svoj: due to BUG#38965 +main.type_newdecimal # svoj: due to BUG#38965 diff --git a/mysql-test/collections/default.weekly b/mysql-test/collections/default.weekly index 452a79eacbd..d874c2f4519 100644 --- a/mysql-test/collections/default.weekly +++ b/mysql-test/collections/default.weekly @@ -1 +1,2 @@ -perl mysql-test-run.pl --timer --force --comment=1st --experimental=collections/default.experimental 1st +perl mysql-test-run.pl --timer --force --comment=1st --experimental=collections/default.experimental 1st +perl mysql-test-run.pl --timer --force --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 parts.part_supported_sql_func_innodb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_ndb parts.partition_alter1_2_innodb parts.partition_alter1_2_ndb parts.partition_alter2_1_1_innodb parts.partition_alter2_1_2_innodb parts.partition_alter2_2_2_innodb parts.partition_alter4_innodb main.variables-big rpl_ndb.rpl_truncate_7ndb_2 diff --git a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test index c99d0b86be3..2526b2dd149 100644 --- a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test +++ b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test @@ -52,13 +52,19 @@ inc $count; FLUSH TABLES; source include/show_binlog_events.inc; -insert delayed into t1 values (null),(null),(null),(null); +RESET MASTER; +insert /* before delayed */ delayed /* after delayed */ into t1 values (null),(null),(null),(null); inc $count; inc $count; inc $count; inc $count; --source include/wait_until_rows_count.inc -insert delayed into t1 values (null),(null),(400),(null); +insert /*! delayed */ into t1 values (null),(null),(400),(null); inc $count; inc $count; inc $count; inc $count; --source include/wait_until_rows_count.inc +if (`SELECT @@SESSION.BINLOG_FORMAT = 'STATEMENT'`) { + FLUSH TABLES; + source include/show_binlog_events.inc; +} + select * from t1; drop table t1; diff --git a/mysql-test/extra/rpl_tests/create_recursive_construct.inc b/mysql-test/extra/rpl_tests/create_recursive_construct.inc index 3a9c628cbb0..ac10ab8ddb2 100644 --- a/mysql-test/extra/rpl_tests/create_recursive_construct.inc +++ b/mysql-test/extra/rpl_tests/create_recursive_construct.inc @@ -338,10 +338,21 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) { SHOW BINLOG EVENTS; --die Warnings printed } - # The first event is format_description, the second is - # Query_event('BEGIN'), and the third should be our Table_map. --let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 3) - if (`SELECT '$event_type' != 'Table_map'`) { + # The first event is format_description, the second is + # Query_event('BEGIN'), and the third should be our Query + # for 'INSERT DELAYED' unsafe_type 3, which is safe after + # the fix of bug#54579. + if (`SELECT $unsafe_type = 3 AND '$event_type' != 'Query'`) { + --enable_query_log + --echo ******** Failure! Event number 3 was a '$event_type', not a 'Query'. ******** + SHOW BINLOG EVENTS; + --die Wrong events in binlog. + } + # The first event is format_description, the second is + # Query_event('BEGIN'), and the third should be our Table_map + # for unsafe statement. + if (`SELECT $unsafe_type != 3 AND '$event_type' != 'Table_map'`) { --enable_query_log --echo ******** Failure! Event number 3 was a '$event_type', not a 'Table_map'. ******** SHOW BINLOG EVENTS; diff --git a/mysql-test/include/ctype_filesort2.inc b/mysql-test/include/ctype_filesort2.inc new file mode 100644 index 00000000000..7b09eb482a5 --- /dev/null +++ b/mysql-test/include/ctype_filesort2.inc @@ -0,0 +1,16 @@ +# +# Testing filesort for full Unicode character sets +# with supplementary characters. +# + +--echo # +--echo # Bug#55980 Character sets: supplementary character _bin ordering is wrong +--echo # +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); +INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +ALTER TABLE t1 ADD KEY(a); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 46fdda7df84..f83b671b5dc 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -43,5 +43,11 @@ log-bin=mysqld-bin # Run tests with the performance schema instrumentation loose-enable-performance-schema +# Run tests with a small number of instrumented objects +# to limit memory consumption with MTR +loose-performance-schema-max-mutex-instances=10000 +loose-performance-schema-max-rwlock-instances=10000 +loose-performance-schema-max-table-instances=500 +loose-performance-schema-max-table-handles=1000 binlog-direct-non-transactional-updates diff --git a/mysql-test/include/handler.inc b/mysql-test/include/handler.inc index 65e9e61d077..b86d5d9287f 100644 --- a/mysql-test/include/handler.inc +++ b/mysql-test/include/handler.inc @@ -1809,9 +1809,32 @@ CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1); HANDLER t1 OPEN; # This used to cause the assert ---error ER_NO_SUCH_TABLE +--error ER_NOT_SUPPORTED_YET HANDLER t1 READ FIRST WHERE f1() = 1; HANDLER t1 CLOSE; DROP FUNCTION f1; DROP TABLE t1; + + +--echo # +--echo # Bug#54920 Stored functions are allowed in HANDLER statements, +--echo # but broken. +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); +CREATE FUNCTION f1() RETURNS INT RETURN 1; +HANDLER t1 OPEN; + +--error ER_NOT_SUPPORTED_YET +HANDLER t1 READ FIRST WHERE f1() = 1; + +HANDLER t1 CLOSE; +DROP FUNCTION f1; +DROP TABLE t1; diff --git a/mysql-test/include/index_merge_ror_cpk.inc b/mysql-test/include/index_merge_ror_cpk.inc index cfc2ed3885e..3912aa34026 100644 --- a/mysql-test/include/index_merge_ror_cpk.inc +++ b/mysql-test/include/index_merge_ror_cpk.inc @@ -126,3 +126,19 @@ WHERE drop table t1; +--echo # +--echo # Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB +--echo # +CREATE TABLE t1 (f1 INT, PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (2); +CREATE TABLE t2 (f1 INT, f2 INT, f3 char(1), + PRIMARY KEY (f1), KEY (f2), KEY (f3) ); +INSERT INTO t2 VALUES (1, 1, 'h'), (2, 3, 'h'), (3, 2, ''), (4, 2, ''); + +SELECT t1.f1 FROM t1 +WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2; + +EXPLAIN SELECT t1.f1 FROM t1 +WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2; + +DROP TABLE t1,t2; diff --git a/mysql-test/include/mysqld--help.inc b/mysql-test/include/mysqld--help.inc index 3c50e50ac0e..5d20cff2c13 100644 --- a/mysql-test/include/mysqld--help.inc +++ b/mysql-test/include/mysqld--help.inc @@ -7,15 +7,27 @@ # force lower-case-table-names=1 (linux/macosx have different defaults) # force symbolic-links=0 (valgrind build has a different default) # + exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --lower-case-table-names=1 --help --verbose > $MYSQL_TMP_DIR/mysqld--help.txt 2>&1; +# The inline perl code below will copy $MYSQL_TMP_DIR/mysqld--help.txt +# to output, but filter away some variable stuff (e.g. paths). + perl; + # Variables which we don't want to display in the result file since + # their paths may vary: @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir log-slow-queries pid-file slow-query-log-file - datadir slave-load-tmpdir tmpdir/; + datadir slave-load-tmpdir tmpdir socket/; + + # Plugins which may or may not be there: @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster debug temp-pool ssl des-key-file thread-concurrency super-large-pages mutex-deadlock-detector null-audit/; - @env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_LIBDIR MYSQL_CHARSETSDIR MYSQL_SHAREDIR /; + + # And substitute the content some environment variables with their + # names: + @env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_LIBDIR MYSQL_CHARSETSDIR MYSQL_SHAREDIR/; + $re1=join('|', @skipvars, @plugins); $re2=join('|', @plugins); $skip=0; diff --git a/mysql-test/include/mysqlhotcopy.inc b/mysql-test/include/mysqlhotcopy.inc index b3fd5e47179..91e0eff1e0f 100644 --- a/mysql-test/include/mysqlhotcopy.inc +++ b/mysql-test/include/mysqlhotcopy.inc @@ -5,7 +5,7 @@ --source include/not_windows.inc --source include/not_embedded.inc -if ($MYSQLHOTCOPY) +if (!$MYSQLHOTCOPY) { die due to missing mysqlhotcopy tool; } diff --git a/mysql-test/include/not_blackhole.inc b/mysql-test/include/not_blackhole.inc new file mode 100644 index 00000000000..078927ec4ca --- /dev/null +++ b/mysql-test/include/not_blackhole.inc @@ -0,0 +1,5 @@ +if (`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = 'blackhole'`){ + skip Blackhole engine enabled; +} diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 897382219ec..3c684062600 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -701,6 +701,13 @@ sub process_opts_file { next; } + $value= mtr_match_prefix($opt, "--testcase-timeout="); + if ( defined $value ) { + # Overrides test case timeout for this test + $tinfo->{'case-timeout'}= $value; + next; + } + # Ok, this was a real option, add it push(@{$tinfo->{$opt_name}}, $opt); } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 03d0c9eb621..a3c3e1847d4 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -231,7 +231,6 @@ my $opt_suite_timeout = $ENV{MTR_SUITE_TIMEOUT} || 300; # minutes my $opt_shutdown_timeout= $ENV{MTR_SHUTDOWN_TIMEOUT} || 10; # seconds my $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds -sub testcase_timeout { return $opt_testcase_timeout * 60; }; sub suite_timeout { return $opt_suite_timeout * 60; }; sub check_timeout { return $opt_testcase_timeout * 6; }; @@ -245,6 +244,7 @@ my $opt_repeat= 1; my $opt_retry= 3; my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2); my $opt_reorder= 1; +my $opt_force_restart= 0; my $opt_strace_client; @@ -260,6 +260,17 @@ my $opt_callgrind; my %mysqld_logs; my $opt_debug_sync_timeout= 300; # Default timeout for WAIT_FOR actions. +sub testcase_timeout ($) { + my ($tinfo)= @_; + if (exists $tinfo->{'case-timeout'}) { + # Return test specific timeout if *longer* that the general timeout + my $test_to= $tinfo->{'case-timeout'}; + $test_to*= 10 if $opt_valgrind; + return $test_to * 60 if $test_to > $opt_testcase_timeout; + } + return $opt_testcase_timeout * 60; +} + our $opt_warnings= 1; our $opt_skip_ndbcluster= 0; @@ -934,6 +945,7 @@ sub command_line_setup { 'report-features' => \$opt_report_features, 'comment=s' => \$opt_comment, 'fast' => \$opt_fast, + 'force-restart' => \$opt_force_restart, 'reorder!' => \$opt_reorder, 'enable-disabled' => \&collect_option, 'verbose+' => \$opt_verbose, @@ -2155,10 +2167,12 @@ sub environment_setup { # mysqlhotcopy # ---------------------------------------------------- my $mysqlhotcopy= - mtr_pl_maybe_exists("$bindir/scripts/mysqlhotcopy"); - # Since mysqltest interprets the real path as "false" in an if, - # use 1 ("true") to indicate "not exists" so it can be tested for - $ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy || 1; + mtr_pl_maybe_exists("$bindir/scripts/mysqlhotcopy") || + mtr_pl_maybe_exists("$path_client_bindir/mysqlhotcopy"); + if ($mysqlhotcopy) + { + $ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy; + } # ---------------------------------------------------- # perror @@ -3550,7 +3564,7 @@ sub run_testcase ($) { } } - my $test_timeout= start_timer(testcase_timeout()); + my $test_timeout= start_timer(testcase_timeout($tinfo)); do_before_run_mysqltest($tinfo); @@ -3750,7 +3764,7 @@ sub run_testcase ($) { { my $log_file_name= $opt_vardir."/log/".$tinfo->{shortname}.".log"; $tinfo->{comment}= - "Test case timeout after ".testcase_timeout(). + "Test case timeout after ".testcase_timeout($tinfo). " seconds\n\n"; # Add 20 last executed commands from test case log file if (-e $log_file_name) @@ -3759,7 +3773,7 @@ sub run_testcase ($) { "== $log_file_name == \n". mtr_lastlinesfromfile($log_file_name, 20)."\n"; } - $tinfo->{'timeout'}= testcase_timeout(); # Mark as timeout + $tinfo->{'timeout'}= testcase_timeout($tinfo); # Mark as timeout run_on_all($tinfo, 'analyze-timeout'); report_failure_and_restart($tinfo); @@ -4565,6 +4579,11 @@ sub server_need_restart { return 1; } + if ( $opt_force_restart ) { + mtr_verbose_restart($server, "forced restart turned on"); + return 1; + } + if ( $tinfo->{template_path} ne $current_config_name) { mtr_verbose_restart($server, "using different config file"); @@ -5593,6 +5612,7 @@ Misc options servers to exit before finishing the process fast Run as fast as possible, dont't wait for servers to shutdown etc. + force-restart Always restart servers between tests parallel=N Run tests in N parallel threads (default=1) Use parallel=auto for auto-setting of N repeat=N Run each test N number of times diff --git a/mysql-test/r/check.result b/mysql-test/r/check.result index 0bff34dba20..ac9c7bca9d7 100644 --- a/mysql-test/r/check.result +++ b/mysql-test/r/check.result @@ -23,3 +23,19 @@ REPAIR TABLE t1; Table Op Msg_type Msg_text test.t1 repair status OK DROP TABLE t1; +# +# Bug#56422 CHECK TABLE run when the table is locked reports corruption +# along with timeout +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(a INT); +LOCK TABLE t1 WRITE; +# Connection con1 +SET lock_wait_timeout= 1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check Error Lock wait timeout exceeded; try restarting transaction +test.t1 check status Operation failed +# Connection default +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index a84ce6aaddf..d5f3945fb6b 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1542,6 +1542,7 @@ show status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index c5fd7ef1439..7cee15aecef 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -611,6 +611,31 @@ utf16_bin 00610009 utf16_bin 0061 utf16_bin 00610020 drop table t1; +# +# Bug#55980 Character sets: supplementary character _bin ordering is wrong +# +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); +INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +HEX(a) HEX(CONVERT(a USING utf8mb4)) +0385 CE85 +D800DF84 F0908E84 +DBC0DC00 F4808080 +FF9D EFBE9D +ALTER TABLE t1 ADD KEY(a); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +HEX(a) HEX(CONVERT(a USING utf8mb4)) +0385 CE85 +D800DF84 F0908E84 +DBC0DC00 F4808080 +FF9D EFBE9D +DROP TABLE IF EXISTS t1; select @@collation_connection; @@collation_connection utf16_bin diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result index 79e714eab47..37d5aa98be3 100644 --- a/mysql-test/r/ctype_utf32.result +++ b/mysql-test/r/ctype_utf32.result @@ -610,6 +610,31 @@ utf32_bin 0000006100000009 utf32_bin 00000061 utf32_bin 0000006100000020 drop table t1; +# +# Bug#55980 Character sets: supplementary character _bin ordering is wrong +# +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); +INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +HEX(a) HEX(CONVERT(a USING utf8mb4)) +00000385 CE85 +0000FF9D EFBE9D +00010384 F0908E84 +00100000 F4808080 +ALTER TABLE t1 ADD KEY(a); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +HEX(a) HEX(CONVERT(a USING utf8mb4)) +00000385 CE85 +0000FF9D EFBE9D +00010384 F0908E84 +00100000 F4808080 +DROP TABLE IF EXISTS t1; select @@collation_connection; @@collation_connection utf32_bin @@ -1114,5 +1139,18 @@ format(123,2,'no_NO') 123,00 DROP TABLE t1; # +# Bug#42511 mysqld: ctype-ucs2.c:2044: my_strnncollsp_utf32: Assertion (tlen % 4) == 0' faied +# +CREATE TABLE t1 ( +b char(250) CHARACTER SET utf32, +key (b) +) ENGINE=MYISAM; +INSERT INTO t1 VALUES ('d'),('f'); +SELECT * FROM t1 WHERE b BETWEEN 'a' AND 'z'; +b +d +f +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result index 454c9d4bfbb..3b9abbc5412 100644 --- a/mysql-test/r/ctype_utf8mb4.result +++ b/mysql-test/r/ctype_utf8mb4.result @@ -987,6 +987,31 @@ utf8mb4_bin 6109 utf8mb4_bin 61 utf8mb4_bin 6120 drop table t1; +# +# Bug#55980 Character sets: supplementary character _bin ordering is wrong +# +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); +INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +HEX(a) HEX(CONVERT(a USING utf8mb4)) +CE85 CE85 +EFBE9D EFBE9D +F0908E84 F0908E84 +F4808080 F4808080 +ALTER TABLE t1 ADD KEY(a); +SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; +HEX(a) HEX(CONVERT(a USING utf8mb4)) +CE85 CE85 +EFBE9D EFBE9D +F0908E84 F0908E84 +F4808080 F4808080 +DROP TABLE IF EXISTS t1; select @@collation_connection; @@collation_connection utf8mb4_bin diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result index 2bc77c52bec..77aa0d49407 100644 --- a/mysql-test/r/delayed.result +++ b/mysql-test/r/delayed.result @@ -345,3 +345,108 @@ CREATE TABLE t1 LIKE t2; ERROR 42S01: Table 't1' already exists DROP TABLE t2; DROP TABLE t1; +# +# Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED +# +# This test is not supposed to work under --ps-protocol since +# INSERT DELAYED doesn't work under LOCK TABLES with this protocol. +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +CREATE TABLE t3 (a INT); +# Test 1: Using LOCK TABLE +# Connection con1 +LOCK TABLE t1 WRITE; +# Connection default +LOCK TABLE t2 WRITE; +# Sending: +INSERT DELAYED INTO t1 VALUES (1); +# Connection con1 +# Wait until INSERT DELAYED is blocked on table 't1'. +INSERT DELAYED INTO t2 VALUES (1); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +UNLOCK TABLES; +# Connection default +# Reaping: INSERT DELAYED INTO t1 VALUES (1) +UNLOCK TABLES; +# Test 2: Using ALTER TABLE +START TRANSACTION; +SELECT * FROM t1 WHERE a=0; +a +# Connection con1 +# Sending: +ALTER TABLE t1 COMMENT 'test'; +# Connection default +# Wait until ALTER TABLE is blocked on table 't1'. +INSERT DELAYED INTO t1 VALUES (3); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +# Connection con1 +# Reaping: ALTER TABLE t1 COMMENT 'test' +# Test 3: Using RENAME TABLE +# Connection default +START TRANSACTION; +INSERT INTO t2 VALUES (1); +# Connection con1 +# Sending: +RENAME TABLE t1 to t5, t2 to t4; +# Connection default +# Wait until RENAME TABLE is blocked on table 't1'. +INSERT DELAYED INTO t1 VALUES (4); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +# Connection con1 +# Reaping: RENAME TABLE t1 to t5, t2 to t4 +# Connection default +# Reverting the renames +RENAME TABLE t5 to t1, t4 to t2; +# Test 4: Two INSERT DELAYED on the same table +START TRANSACTION; +INSERT INTO t2 VALUES (1); +# Connection con2 +LOCK TABLE t1 WRITE, t2 WRITE; +# Connection con1 +# Wait until LOCK TABLE is blocked on table 't2'. +INSERT DELAYED INTO t1 VALUES (5); +# Connection default +# Wait until INSERT DELAYED is blocked on table 't1'. +INSERT DELAYED INTO t1 VALUES (6); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +# Connection con2 +# Reaping: LOCK TABLE t1 WRITE, t2 WRITE +UNLOCK TABLES; +# Connection con1 +# Reaping: INSERT DELAYED INTO t1 VALUES (5) +# Connection con2 +# Connection con1 +# Connection default +DROP TABLE t1, t2, t3; +# +# Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables". +# +drop table if exists t1, t2, tm; +create table t1(a int); +create table t2(a int); +create table tm(a int) engine=merge union=(t1, t2); +begin; +select * from t1; +a +# Connection 'con1'. +# Sending: +alter table t1 comment 'test'; +# Connection 'default'. +# Wait until ALTER TABLE blocks and starts waiting +# for connection 'default'. It should wait with a +# pending SNW lock on 't1'. +# Attempt to perform delayed insert into 'tm' should not lead +# to a deadlock. Instead error ER_DELAYED_NOT_SUPPORTED should +# be emitted. +insert delayed into tm values (1); +ERROR HY000: DELAYED option not supported for table 'tm' +# Unblock ALTER TABLE. +commit; +# Connection 'con1'. +# Reaping ALTER TABLE: +# Connection 'default'. +drop tables tm, t1, t2; diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index 0c9b0d7d2e5..702b9348b7d 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -499,4 +499,13 @@ INDEX(a), INDEX(b), INDEX(c)); INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9); DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1; DROP TABLE t1; +# +# Bug #53034: Multiple-table DELETE statements not accepting +# "Access compatibility" syntax +# +CREATE TABLE t1 (id INT); +CREATE TABLE t2 LIKE t1; +CREATE TABLE t3 LIKE t1; +DELETE FROM t1.*, test.t2.*, a.* USING t1, t2, t3 AS a; +DROP TABLE t1, t2, t3; End of 5.1 tests diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result index aee18d91edf..ced8306c3ab 100644 --- a/mysql-test/r/flush.result +++ b/mysql-test/r/flush.result @@ -373,3 +373,53 @@ commit; # --> connection con2 # --> connection default drop table t1; +# +# Test for bug #55273 "FLUSH TABLE tm WITH READ LOCK for Merge table +# causes assert failure". +# +drop table if exists t1, t2, tm; +create table t1 (i int); +create table t2 (i int); +create table tm (i int) engine=merge union=(t1, t2); +insert into t1 values (1), (2); +insert into t2 values (3), (4); +# The below statement should succeed and lock merge +# table for read. Only merge table gets flushed and +# not underlying tables. +flush tables tm with read lock; +select * from tm; +i +1 +2 +3 +4 +# Check that underlying tables are locked. +select * from t1; +i +1 +2 +select * from t2; +i +3 +4 +unlock tables; +# This statement should succeed as well and flush +# all tables in the list. +flush tables tm, t1, t2 with read lock; +select * from tm; +i +1 +2 +3 +4 +# Naturally, underlying tables should be locked in this case too. +select * from t1; +i +1 +2 +select * from t2; +i +3 +4 +unlock tables; +drop tables tm, t1, t2; diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 1a393b3cdd5..302de9de9f7 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -1003,6 +1003,7 @@ SELECT 1 FROM 1 1 DROP TABLE t1; +End of 5.0 tests # # Bug #52397: another crash with explain extended and group_concat # @@ -1019,6 +1020,25 @@ Warnings: Note 1003 select 1 AS `1` from dual DROP TABLE t1; End of 5.0 tests +# +# Bug #54476: crash when group_concat and 'with rollup' in prepared statements +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); +PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP"; +EXECUTE stmt; +GROUP_CONCAT(t1.a ORDER BY t1.a) +1,1 +2,2 +1,1,2,2 +EXECUTE stmt; +GROUP_CONCAT(t1.a ORDER BY t1.a) +1,1 +2,2 +1,1,2,2 +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +End of 5.1 tests DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 (a VARCHAR(6), b INT); CREATE TABLE t2 (a VARCHAR(6), b INT); diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 45c93971852..5f874f4665d 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1713,9 +1713,20 @@ f1 f2 f3 f4 f1 = f2 NULL NULL NULL NULL NULL drop table t1; # +# Bug #54465: assert: field_types == 0 || field_types[field_pos] == +# MYSQL_TYPE_LONGLONG +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); +SELECT MAX((SELECT 1 FROM t1 ORDER BY @var LIMIT 1)) m FROM t1 t2, t1 +ORDER BY t1.a; +m +1 +DROP TABLE t1; +# End of 5.1 tests # -# Bug#55648: Server crash on MIX/MAX on maximum time value +# Bug#55648: Server crash on MIN/MAX on maximum time value # CREATE TABLE t1(c1 TIME NOT NULL); INSERT INTO t1 VALUES('837:59:59'); @@ -1725,3 +1736,13 @@ MAX(c1) 838:59:59 DROP TABLE t1; # End of the bug#55648 +# +# Bug#56120: Failed assertion on MIN/MAX on negative time value +# +CREATE TABLE t1(c1 TIME NOT NULL); +INSERT INTO t1 VALUES('-00:00:01'); +SELECT MAX(c1),MIN(c1) FROM t1; +MAX(c1) MIN(c1) +-00:00:01 -00:00:01 +DROP TABLE t1; +# End of the bug#56120 diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index 955a784f04c..c70589a27b7 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -186,3 +186,13 @@ MAX(IFNULL(CAST(c AS UNSIGNED), 0)) 12345678901234567890 DROP TABLE t1; End of 5.0 tests +# +# Bug#55077: Assertion failed: width > 0 && to != ((void *)0), file .\dtoa.c +# +CREATE TABLE t1 (a LONGBLOB, b DOUBLE); +INSERT INTO t1 VALUES (NULL, 0), (NULL, 1); +SELECT IF(b, (SELECT a FROM t1 LIMIT 1), b) c FROM t1 GROUP BY c; +c +NULL +0 +DROP TABLE t1; diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index e21e7903459..85448a258e4 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -337,6 +337,21 @@ select connection_id() > 0; connection_id() > 0 1 # +# Bug #54461: crash with longblob and union or update with subquery +# +CREATE TABLE t1 (a INT, b LONGBLOB); +INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2'); +SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; +LEAST(a, (SELECT b FROM t1 LIMIT 1)) +1 +2 +SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; +GREATEST(a, (SELECT b FROM t1 LIMIT 1)) +2 +3 +1 +DROP TABLE t1; +# # Bug #52165: Assertion failed: file .\dtoa.c, line 465 # CREATE TABLE t1 (a SET('a'), b INT); @@ -345,4 +360,19 @@ SELECT COALESCE(a) = COALESCE(b) FROM t1; COALESCE(a) = COALESCE(b) 1 DROP TABLE t1; -End of tests +# +# Bug #54461: crash with longblob and union or update with subquery +# +CREATE TABLE t1 (a INT, b LONGBLOB); +INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2'); +SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; +LEAST(a, (SELECT b FROM t1 LIMIT 1)) +1 +2 +SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; +GREATEST(a, (SELECT b FROM t1 LIMIT 1)) +2 +3 +1 +DROP TABLE t1; +End of 5.1 tests diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index c3f210edee5..f2c26110d8a 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1200,6 +1200,8 @@ set time_zone= @@global.time_zone; select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE NULL +Warnings: +Warning 1411 Incorrect datetime value: '10:00 PM' for function str_to_date create table t1 (field DATE); insert into t1 values ('2006-11-06'); select * from t1 where field < '2006-11-06 04:08:36.0'; @@ -1305,4 +1307,12 @@ date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND) select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND); date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND) 0168-12-31 23:59:59 +CREATE TABLE t1(a DOUBLE NOT NULL); +INSERT INTO t1 VALUES (0),(9.216e-096); +# should not crash +SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a); +1 +1 +1 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 717dd33231e..5663f167d00 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -707,10 +707,7 @@ numgeometries(b) IS NULL, numinteriorrings(b) IS NULL, numpoints(b) IS NULL, area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL, y(b) IS NULL from t1; -geometryfromtext(b) IS NULL geometryfromwkb(b) IS NULL astext(b) IS NULL aswkb(b) IS NULL geometrytype(b) IS NULL centroid(b) IS NULL envelope(b) IS NULL startpoint(b) IS NULL endpoint(b) IS NULL exteriorring(b) IS NULL pointn(b, 1) IS NULL geometryn(b, 1) IS NULL interiorringn(b, 1) IS NULL multipoint(b) IS NULL isempty(b) IS NULL issimple(b) IS NULL isclosed(b) IS NULL dimension(b) IS NULL numgeometries(b) IS NULL numinteriorrings(b) IS NULL numpoints(b) IS NULL area(b) IS NULL glength(b) IS NULL srid(b) IS NULL x(b) IS NULL y(b) IS NULL -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing select within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL, equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL, @@ -725,10 +722,7 @@ point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS multilinestring(b) IS NULL, multipolygon(b) IS NULL, geometrycollection(b) IS NULL from t1; -point(b, b) IS NULL linestring(b) IS NULL polygon(b) IS NULL multipoint(b) IS NULL multilinestring(b) IS NULL multipolygon(b) IS NULL geometrycollection(b) IS NULL -0 1 1 1 1 1 1 -1 1 1 1 1 1 1 -0 1 1 1 1 1 1 +ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing drop table t1; CREATE TABLE t1(a POINT) ENGINE=MyISAM; INSERT INTO t1 VALUES (NULL); @@ -1010,53 +1004,16 @@ f5 datetime YES NULL drop view v1; drop table t1; SELECT MultiPoint(12345,''); -MultiPoint(12345,'') -NULL -SELECT MultiPoint(123451,''); -MultiPoint(123451,'') -NULL -SELECT MultiPoint(1234512,''); -MultiPoint(1234512,'') -NULL -SELECT MultiPoint(12345123,''); -MultiPoint(12345123,'') -NULL -SELECT MultiLineString(12345,''); -MultiLineString(12345,'') -NULL -SELECT MultiLineString(123451,''); -MultiLineString(123451,'') -NULL -SELECT MultiLineString(1234512,''); -MultiLineString(1234512,'') -NULL -SELECT MultiLineString(12345123,''); -MultiLineString(12345123,'') -NULL -SELECT LineString(12345,''); -LineString(12345,'') -NULL -SELECT LineString(123451,''); -LineString(123451,'') -NULL -SELECT LineString(1234512,''); -LineString(1234512,'') -NULL -SELECT LineString(12345123,''); -LineString(12345123,'') -NULL -SELECT Polygon(12345,''); -Polygon(12345,'') -NULL -SELECT Polygon(123451,''); -Polygon(123451,'') -NULL -SELECT Polygon(1234512,''); -Polygon(1234512,'') -NULL -SELECT Polygon(12345123,''); -Polygon(12345123,'') -NULL +ERROR 22007: Illegal non geometric '12345' value found during parsing +SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b)); +ERROR 22007: Illegal non geometric ''00000'' value found during parsing +# +# BUG#51875: crash when loading data into geometry function polyfromwkb +# +SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=POLYFROMWKB(@a); +SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=POLYFROMWKB(@a); End of 5.1 tests CREATE TABLE t1( col0 BINARY NOT NULL, diff --git a/mysql-test/r/handler_innodb.result b/mysql-test/r/handler_innodb.result index 121cfa89f1c..66914285733 100644 --- a/mysql-test/r/handler_innodb.result +++ b/mysql-test/r/handler_innodb.result @@ -1726,7 +1726,22 @@ CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1); HANDLER t1 OPEN; HANDLER t1 READ FIRST WHERE f1() = 1; -ERROR 42S02: Table 'test.t2' doesn't exist +ERROR 42000: This version of MySQL doesn't yet support 'stored functions in HANDLER ... READ' +HANDLER t1 CLOSE; +DROP FUNCTION f1; +DROP TABLE t1; +# +# Bug#54920 Stored functions are allowed in HANDLER statements, +# but broken. +# +DROP TABLE IF EXISTS t1; +DROP FUNCTION IF EXISTS f1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); +CREATE FUNCTION f1() RETURNS INT RETURN 1; +HANDLER t1 OPEN; +HANDLER t1 READ FIRST WHERE f1() = 1; +ERROR 42000: This version of MySQL doesn't yet support 'stored functions in HANDLER ... READ' HANDLER t1 CLOSE; DROP FUNCTION f1; DROP TABLE t1; diff --git a/mysql-test/r/handler_myisam.result b/mysql-test/r/handler_myisam.result index fd08fd12f15..d5d43ca0717 100644 --- a/mysql-test/r/handler_myisam.result +++ b/mysql-test/r/handler_myisam.result @@ -1722,7 +1722,22 @@ CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1); HANDLER t1 OPEN; HANDLER t1 READ FIRST WHERE f1() = 1; -ERROR 42S02: Table 'test.t2' doesn't exist +ERROR 42000: This version of MySQL doesn't yet support 'stored functions in HANDLER ... READ' +HANDLER t1 CLOSE; +DROP FUNCTION f1; +DROP TABLE t1; +# +# Bug#54920 Stored functions are allowed in HANDLER statements, +# but broken. +# +DROP TABLE IF EXISTS t1; +DROP FUNCTION IF EXISTS f1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); +CREATE FUNCTION f1() RETURNS INT RETURN 1; +HANDLER t1 OPEN; +HANDLER t1 READ FIRST WHERE f1() = 1; +ERROR 42000: This version of MySQL doesn't yet support 'stored functions in HANDLER ... READ' HANDLER t1 CLOSE; DROP FUNCTION f1; DROP TABLE t1; diff --git a/mysql-test/r/handler_read_last.result b/mysql-test/r/handler_read_last.result new file mode 100644 index 00000000000..a21e9ed9564 --- /dev/null +++ b/mysql-test/r/handler_read_last.result @@ -0,0 +1,60 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT, INDEX (a)); +INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(); +FLUSH STATUS; +SELECT a FROM t1 ORDER BY a LIMIT 1; +a +NULL +SHOW STATUS LIKE 'HANDLER_READ%'; +Variable_name Value +Handler_read_first 1 +Handler_read_key 0 +Handler_read_last 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +SELECT a FROM t1 ORDER BY a DESC LIMIT 1; +a +NULL +SHOW STATUS LIKE 'HANDLER_READ%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_last 1 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +SELECT a FROM t1 ORDER BY a LIMIT 3; +a +NULL +NULL +NULL +SHOW STATUS LIKE 'HANDLER_READ%'; +Variable_name Value +Handler_read_first 1 +Handler_read_key 0 +Handler_read_last 0 +Handler_read_next 2 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +FLUSH STATUS; +SELECT a FROM t1 ORDER BY a DESC LIMIT 3; +a +NULL +NULL +NULL +SHOW STATUS LIKE 'HANDLER_READ%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_last 1 +Handler_read_next 0 +Handler_read_prev 2 +Handler_read_rnd 0 +Handler_read_rnd_next 0 +DROP TABLE t1; diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result index 6d130a64e35..8bbbed2865f 100644 --- a/mysql-test/r/index_merge_innodb.result +++ b/mysql-test/r/index_merge_innodb.result @@ -255,3 +255,21 @@ WHERE `RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND `TESTID`='' AND `UCCHECK`=''; drop table t1; +# +# Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB +# +CREATE TABLE t1 (f1 INT, PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (2); +CREATE TABLE t2 (f1 INT, f2 INT, f3 char(1), +PRIMARY KEY (f1), KEY (f2), KEY (f3) ); +INSERT INTO t2 VALUES (1, 1, 'h'), (2, 3, 'h'), (3, 2, ''), (4, 2, ''); +SELECT t1.f1 FROM t1 +WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2; +f1 +2 +EXPLAIN SELECT t1.f1 FROM t1 +WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using index +2 DEPENDENT SUBQUERY t2 index_merge f2,f3 f3,f2 2,5 NULL 1 Using intersect(f3,f2); Using where; Using index +DROP TABLE t1,t2; diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result index 1be96da5c7d..7377b450872 100644 --- a/mysql-test/r/index_merge_myisam.result +++ b/mysql-test/r/index_merge_myisam.result @@ -1414,6 +1414,24 @@ WHERE `TESTID`='' AND `UCCHECK`=''; drop table t1; # +# Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB +# +CREATE TABLE t1 (f1 INT, PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (2); +CREATE TABLE t2 (f1 INT, f2 INT, f3 char(1), +PRIMARY KEY (f1), KEY (f2), KEY (f3) ); +INSERT INTO t2 VALUES (1, 1, 'h'), (2, 3, 'h'), (3, 2, ''), (4, 2, ''); +SELECT t1.f1 FROM t1 +WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2; +f1 +2 +EXPLAIN SELECT t1.f1 FROM t1 +WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 ref f2,f3 f2 5 1 Using where +DROP TABLE t1,t2; +# # Generic @@optimizer_switch tests (move those into a separate file if # we get another @@optimizer_switch user) # diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index f12c9a0a61a..b0858894b71 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -694,6 +694,7 @@ show status like 'Handler_read%'; Variable_name Value Handler_read_first 1 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index 9f87ea082db..a7f1b5b64f1 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -854,6 +854,7 @@ show status like 'Handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -1184,4 +1185,40 @@ NULL NULL 1 DROP TABLE t1, t2, mm1; +# +# Bug #54468: crash after item's print() function when ordering/grouping +# by subquery +# +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (), (); +SELECT 1 FROM t1 +GROUP BY +GREATEST(t1.a, +(SELECT 1 FROM +(SELECT t1.b FROM t1,t1 t2 +ORDER BY t1.a, t1.a LIMIT 1) AS d) +); +1 +1 +DROP TABLE t1; +# +# Bug #53544: Server hangs during JOIN query in stored procedure called +# twice in a row +# +CREATE TABLE t1(c INT); +INSERT INTO t1 VALUES (1), (2); +PREPARE stmt FROM "SELECT t2.c AS f1 FROM t1 LEFT JOIN + t1 t2 ON t1.c=t2.c RIGHT JOIN + t1 t3 ON t1.c=t3.c + GROUP BY f1;"; +EXECUTE stmt; +f1 +1 +2 +EXECUTE stmt; +f1 +1 +2 +DEALLOCATE PREPARE stmt; +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 847a00cad94..0af32d8f749 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -1238,6 +1238,7 @@ show status like 'Handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 5 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 diff --git a/mysql-test/r/locale.result b/mysql-test/r/locale.result index b52ed8070f9..aa61d8cd86f 100644 --- a/mysql-test/r/locale.result +++ b/mysql-test/r/locale.result @@ -44,7 +44,7 @@ a abmon mon 2006-12-01 Δεκ Δεκέμβριος SELECT format(123456.789, 3, 'el_GR'); format(123456.789, 3, 'el_GR') -123456.789 +123456,789 DROP TABLE t1; # # Bug#46633 Obsolete Serbian locale name diff --git a/mysql-test/r/log_tables_upgrade.result b/mysql-test/r/log_tables_upgrade.result index 5d9be85a48a..814ebd7d5dc 100644 --- a/mysql-test/r/log_tables_upgrade.result +++ b/mysql-test/r/log_tables_upgrade.result @@ -17,9 +17,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK -mysql.general_log -Error : You can't use locks with log tables. -status : OK +mysql.general_log OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -31,9 +29,7 @@ mysql.proc OK mysql.procs_priv OK mysql.renamed_general_log OK mysql.servers OK -mysql.slow_log -Error : You can't use locks with log tables. -status : OK +mysql.slow_log OK mysql.tables_priv OK mysql.time_zone OK mysql.time_zone_leap_second OK diff --git a/mysql-test/r/lowercase_fs_off.result b/mysql-test/r/lowercase_fs_off.result index 30f835a8ea3..c3284b225dd 100644 --- a/mysql-test/r/lowercase_fs_off.result +++ b/mysql-test/r/lowercase_fs_off.result @@ -55,3 +55,11 @@ DROP USER user_1@localhost; DROP USER USER_1@localhost; DROP DATABASE db1; use test; +# +# Extra test coverage for Bug#56595 RENAME TABLE causes assert on OS X +# +CREATE TABLE t1(a INT); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1; +RENAME TABLE t1 TO T1; +ALTER TABLE T1 RENAME t1; +DROP TABLE t1; diff --git a/mysql-test/r/mdl_sync.result b/mysql-test/r/mdl_sync.result index d484ab77701..de57e3859b7 100644 --- a/mysql-test/r/mdl_sync.result +++ b/mysql-test/r/mdl_sync.result @@ -2913,3 +2913,41 @@ UNLOCK TABLES; # Connection default UNLOCK TABLES; DROP DATABASE db1; +# +# Bug#56292 Deadlock with ALTER TABLE and MERGE tables +# +DROP TABLE IF EXISTS t1, t2, m1; +CREATE TABLE t1(a INT) engine=MyISAM; +CREATE TABLE t2(a INT) engine=MyISAM; +CREATE TABLE m1(a INT) engine=MERGE UNION=(t1, t2); +INSERT INTO t1 VALUES (1), (2); +INSERT INTO t2 VALUES (3), (4); +# Connection con1 +SET DEBUG_SYNC= 'mdl_upgrade_shared_lock_to_exclusive SIGNAL upgrade WAIT_FOR continue'; +# Sending: +ALTER TABLE m1 engine=MERGE UNION=(t2, t1); +# Connection con2 +# Waiting for ALTER TABLE to try lock upgrade +SET DEBUG_SYNC= 'now WAIT_FOR upgrade'; +# Sending: +DELETE FROM t2 WHERE a = 3; +# Connection default +# Check that DELETE is waiting on a metadata lock and not a table lock. +# Now that DELETE blocks on a metadata lock, we should be able to do +# SELECT * FROM m1 here. SELECT used to be blocked by a DELETE table +# lock request. +SELECT * FROM m1; +a +1 +2 +3 +4 +# Resuming ALTER TABLE +SET DEBUG_SYNC= 'now SIGNAL continue'; +# Connection con1 +# Reaping: ALTER TABLE m1 engine=MERGE UNION=(t2, t1) +# Connection con2 +# Reaping: DELETE FROM t2 WHERE a = 3 +# Connection default +DROP TABLE m1, t1, t2; +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index c7e54288f8b..bb6af084f38 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -2358,6 +2358,48 @@ t2 WHERE b SOUNDS LIKE e AND d = 1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t2, t1; +# +# Bug#46339 - crash on REPAIR TABLE merge table USE_FRM +# +DROP TABLE IF EXISTS m1, t1; +CREATE TABLE t1 (c1 INT) ENGINE=MYISAM; +CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1) INSERT_METHOD=LAST; +LOCK TABLE m1 READ; +REPAIR TABLE m1 USE_FRM; +Table Op Msg_type Msg_text +test.m1 repair Error Table 'm1' was locked with a READ lock and can't be updated +test.m1 repair status Operation failed +UNLOCK TABLES; +REPAIR TABLE m1 USE_FRM; +Table Op Msg_type Msg_text +test.m1 repair note The storage engine for the table doesn't support repair +DROP TABLE m1,t1; +CREATE TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1); +REPAIR TABLE m1 USE_FRM; +Table Op Msg_type Msg_text +test.m1 repair Warning Can't open table +test.m1 repair error Corrupt +CREATE TABLE t1 (f1 BIGINT) ENGINE = MyISAM; +REPAIR TABLE m1 USE_FRM; +Table Op Msg_type Msg_text +test.m1 repair note The storage engine for the table doesn't support repair +REPAIR TABLE m1; +Table Op Msg_type Msg_text +test.m1 repair note The storage engine for the table doesn't support repair +DROP TABLE m1, t1; +CREATE TEMPORARY TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1); +REPAIR TABLE m1 USE_FRM; +Table Op Msg_type Msg_text +test.m1 repair Error Table 'test.m1' doesn't exist +test.m1 repair error Corrupt +CREATE TEMPORARY TABLE t1 (f1 BIGINT) ENGINE=MyISAM; +REPAIR TABLE m1 USE_FRM; +Table Op Msg_type Msg_text +m1 repair error Cannot repair temporary table from .frm file +REPAIR TABLE m1; +Table Op Msg_type Msg_text +test.m1 repair note The storage engine for the table doesn't support repair +DROP TABLE m1, t1; End of 5.1 tests # # An additional test case for Bug#27430 Crash in subquery code @@ -2677,7 +2719,7 @@ OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize Error Table 'test.t_not_exists' doesn't exist test.t1 optimize Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist -test.t1 optimize note The storage engine for the table doesn't support optimize +test.t1 optimize error Corrupt DROP TABLE t1; # # Bug#36171 - CREATE TEMPORARY TABLE and MERGE engine @@ -3444,13 +3486,12 @@ ALTER TABLE m1 ADD INDEX (c1); UNLOCK TABLES; DROP TABLE m1, t1; # -# If children are to be altered, they need an explicit lock. +# Locking the merge table will implicitly lock children. # CREATE TABLE t1 (c1 INT); CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1); LOCK TABLE m1 WRITE; ALTER TABLE t1 ADD INDEX (c1); -ERROR HY000: Table 't1' was locked with a READ lock and can't be updated LOCK TABLE m1 WRITE, t1 WRITE; ALTER TABLE t1 ADD INDEX (c1); UNLOCK TABLES; @@ -3576,4 +3617,48 @@ ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1 drop view v1; drop temporary table tmp; drop table t1, t2, t3, m1, m2; +# +# Bug#56494 Segfault in upgrade_shared_lock_to_exclusive() for +# REPAIR of merge table +# +DROP TABLE IF EXISTS t1, t2, t_not_exists; +CREATE TABLE t1(a INT); +ALTER TABLE t1 engine= MERGE UNION (t_not_exists); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze Error Table 'test.t_not_exists' doesn't exist +test.t1 analyze Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +test.t1 analyze error Corrupt +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check Error Table 'test.t_not_exists' doesn't exist +test.t1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +test.t1 check error Corrupt +CHECKSUM TABLE t1; +Table Checksum +test.t1 NULL +Warnings: +Error 1146 Table 'test.t_not_exists' doesn't exist +Error 1168 Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize Error Table 'test.t_not_exists' doesn't exist +test.t1 optimize Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +test.t1 optimize error Corrupt +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair Error Table 'test.t_not_exists' doesn't exist +test.t1 repair Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +test.t1 repair error Corrupt +REPAIR TABLE t1 USE_FRM; +Table Op Msg_type Msg_text +test.t1 repair Warning Can't open table +test.t1 repair error Corrupt +DROP TABLE t1; +CREATE TABLE t1(a INT); +CREATE TABLE t2(a INT) engine= MERGE UNION (t1); +REPAIR TABLE t2 USE_FRM; +Table Op Msg_type Msg_text +test.t2 repair note The storage engine for the table doesn't support repair +DROP TABLE t1, t2; End of 6.0 tests diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 66fe104ba0b..07a92e2abf0 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -649,4 +649,24 @@ SET SESSION sql_safe_updates = 1; UPDATE IGNORE t1, t1 t1a SET t1.a = 1 WHERE t1a.a = 1; ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column DROP TABLE t1; +# +# Bug#54543: update ignore with incorrect subquery leads to assertion +# failure: inited==INDEX +# +SET SESSION sql_safe_updates = 0; +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES (1), (2); +CREATE TABLE t2 ( a INT ); +INSERT INTO t2 VALUES (1), (2); +CREATE TABLE t3 ( a INT ); +INSERT INTO t3 VALUES (1), (2); +# Should not crash +UPDATE IGNORE +( SELECT ( SELECT COUNT(*) FROM t1 GROUP BY a, @v ) a FROM t2 ) x, t3 +SET t3.a = 0; +Warnings: +Error 1242 Subquery returns more than 1 row +Error 1242 Subquery returns more than 1 row +DROP TABLE t1, t2, t3; +SET SESSION sql_safe_updates = DEFAULT; end of tests diff --git a/mysql-test/r/myisampack.result b/mysql-test/r/myisampack.result index dd14c31f32e..91700701139 100644 --- a/mysql-test/r/myisampack.result +++ b/mysql-test/r/myisampack.result @@ -46,14 +46,12 @@ insert into t1 select * from t1; flush tables; optimize table t1; Table Op Msg_type Msg_text -test.t1 optimize error Table 'test.t1' is read only -Warnings: -Error 1036 Table 't1' is read only +test.t1 optimize Error Table 't1' is read only +test.t1 optimize status Operation failed repair table t1; Table Op Msg_type Msg_text -test.t1 repair error Table 'test.t1' is read only -Warnings: -Error 1036 Table 't1' is read only +test.t1 repair Error Table 't1' is read only +test.t1 repair status Operation failed drop table t1; # # BUG#41541 - Valgrind warnings on packed MyISAM table diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 88c74d4c497..3c53faff526 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -432,8 +432,5 @@ Bug #47147: mysql client option --skip-column-names does not apply to vertical o *************************** 1. row *************************** 1 -Bug #54466 client 5.5 built from source lacks "pager" support -a -1 End of tests diff --git a/mysql-test/r/mysql_not_windows.result b/mysql-test/r/mysql_not_windows.result new file mode 100644 index 00000000000..d5670a1a9ca --- /dev/null +++ b/mysql-test/r/mysql_not_windows.result @@ -0,0 +1,5 @@ +Bug #54466 client 5.5 built from source lacks "pager" support +a +1 + +End of tests diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 58f6ffd4040..5252d5f0c17 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -5,9 +5,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK -mysql.general_log -Error : You can't use locks with log tables. -status : OK +mysql.general_log OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -18,9 +16,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.servers OK -mysql.slow_log -Error : You can't use locks with log tables. -status : OK +mysql.slow_log OK mysql.tables_priv OK mysql.time_zone OK mysql.time_zone_leap_second OK @@ -37,9 +33,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK -mysql.general_log -Error : You can't use locks with log tables. -status : OK +mysql.general_log OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -50,9 +44,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.servers OK -mysql.slow_log -Error : You can't use locks with log tables. -status : OK +mysql.slow_log OK mysql.tables_priv OK mysql.time_zone OK mysql.time_zone_leap_second OK @@ -69,9 +61,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK -mysql.general_log -Error : You can't use locks with log tables. -status : OK +mysql.general_log OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -82,9 +72,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.servers OK -mysql.slow_log -Error : You can't use locks with log tables. -status : OK +mysql.slow_log OK mysql.tables_priv OK mysql.time_zone OK mysql.time_zone_leap_second OK @@ -103,9 +91,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK -mysql.general_log -Error : You can't use locks with log tables. -status : OK +mysql.general_log OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -116,9 +102,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.servers OK -mysql.slow_log -Error : You can't use locks with log tables. -status : OK +mysql.slow_log OK mysql.tables_priv OK mysql.time_zone OK mysql.time_zone_leap_second OK @@ -141,9 +125,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK -mysql.general_log -Error : You can't use locks with log tables. -status : OK +mysql.general_log OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -154,9 +136,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.servers OK -mysql.slow_log -Error : You can't use locks with log tables. -status : OK +mysql.slow_log OK mysql.tables_priv OK mysql.time_zone OK mysql.time_zone_leap_second OK @@ -182,9 +162,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK -mysql.general_log -Error : You can't use locks with log tables. -status : OK +mysql.general_log OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -195,9 +173,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.servers OK -mysql.slow_log -Error : You can't use locks with log tables. -status : OK +mysql.slow_log OK mysql.tables_priv OK mysql.time_zone OK mysql.time_zone_leap_second OK diff --git a/mysql-test/r/mysql_upgrade_ssl.result b/mysql-test/r/mysql_upgrade_ssl.result index f1229c4a405..b89862966b5 100644 --- a/mysql-test/r/mysql_upgrade_ssl.result +++ b/mysql-test/r/mysql_upgrade_ssl.result @@ -7,9 +7,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK -mysql.general_log -Error : You can't use locks with log tables. -status : OK +mysql.general_log OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -20,9 +18,7 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.servers OK -mysql.slow_log -Error : You can't use locks with log tables. -status : OK +mysql.slow_log OK mysql.tables_priv OK mysql.time_zone OK mysql.time_zone_leap_second OK diff --git a/mysql-test/r/mysqlbinlog_row.result b/mysql-test/r/mysqlbinlog_row.result index 85416138c6d..7ae1ea36899 100644 --- a/mysql-test/r/mysqlbinlog_row.result +++ b/mysql-test/r/mysqlbinlog_row.result @@ -385,7 +385,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -567,7 +567,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -595,7 +595,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -673,7 +673,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -759,7 +759,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -806,7 +806,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -850,7 +850,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -894,7 +894,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -960,7 +960,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1004,7 +1004,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1070,7 +1070,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1114,7 +1114,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1180,7 +1180,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1224,7 +1224,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1290,7 +1290,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1334,7 +1334,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1378,7 +1378,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1439,7 +1439,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1483,7 +1483,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1527,7 +1527,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1572,7 +1572,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1616,7 +1616,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1660,7 +1660,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1704,7 +1704,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1748,7 +1748,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1792,7 +1792,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1836,7 +1836,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1880,7 +1880,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1924,7 +1924,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -1968,7 +1968,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2032,7 +2032,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2076,7 +2076,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2120,7 +2120,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2164,7 +2164,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2230,7 +2230,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2274,7 +2274,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2318,7 +2318,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2362,7 +2362,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2406,7 +2406,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2450,7 +2450,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2494,7 +2494,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2558,7 +2558,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2622,7 +2622,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2666,7 +2666,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2710,7 +2710,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2754,7 +2754,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2798,7 +2798,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2876,7 +2876,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2920,7 +2920,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -2998,7 +2998,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3076,7 +3076,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3120,7 +3120,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3198,7 +3198,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3276,7 +3276,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3320,7 +3320,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3364,7 +3364,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3408,7 +3408,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3452,7 +3452,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3496,7 +3496,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3540,7 +3540,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3584,7 +3584,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3628,7 +3628,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3672,7 +3672,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3716,7 +3716,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3760,7 +3760,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3804,7 +3804,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3848,7 +3848,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -3994,7 +3994,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1 +DROP TABLE `t1` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 @@ -4127,7 +4127,7 @@ COMMIT # at # #010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=1000000000/*!*/; -DROP TABLE t1,t2 +DROP TABLE `t1`,`t2` /* generated by server */ /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4 diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result index 533f35c1113..63e17e1c188 100644 --- a/mysql-test/r/mysqld--help-notwin.result +++ b/mysql-test/r/mysqld--help-notwin.result @@ -688,7 +688,7 @@ The following options may be given as the first argument: How many threads we should keep in a cache for reuse --thread-handling=name Define threads usage for handling queries, one of - one-thread-per-connection, no-threads + one-thread-per-connection, no-threads, loaded-dynamically --thread-stack=# The stack size for each thread --time-format=name The TIME format (ignored) --timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are @@ -860,9 +860,9 @@ performance-schema-max-file-classes 50 performance-schema-max-file-handles 32768 performance-schema-max-file-instances 10000 performance-schema-max-mutex-classes 200 -performance-schema-max-mutex-instances 1000 -performance-schema-max-rwlock-classes 20 -performance-schema-max-rwlock-instances 1000 +performance-schema-max-mutex-instances 1000000 +performance-schema-max-rwlock-classes 30 +performance-schema-max-rwlock-instances 1000000 performance-schema-max-table-handles 100000 performance-schema-max-table-instances 50000 performance-schema-max-thread-classes 50 @@ -913,7 +913,6 @@ slave-transaction-retries 10 slave-type-conversions slow-launch-time 2 slow-query-log FALSE -socket /tmp/mysql.sock sort-buffer-size 2097152 sporadic-binlog-dump-fail FALSE sql-mode diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result index 9b6b0f53b01..e1098b71e25 100644 --- a/mysql-test/r/mysqld--help-win.result +++ b/mysql-test/r/mysqld--help-win.result @@ -692,7 +692,7 @@ The following options may be given as the first argument: How many threads we should keep in a cache for reuse --thread-handling=name Define threads usage for handling queries, one of - one-thread-per-connection, no-threads + one-thread-per-connection, no-threads, loaded-dynamically --thread-stack=# The stack size for each thread --time-format=name The TIME format (ignored) --timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are @@ -864,9 +864,9 @@ performance-schema-max-file-classes 50 performance-schema-max-file-handles 32768 performance-schema-max-file-instances 10000 performance-schema-max-mutex-classes 200 -performance-schema-max-mutex-instances 1000 -performance-schema-max-rwlock-classes 20 -performance-schema-max-rwlock-instances 1000 +performance-schema-max-mutex-instances 1000000 +performance-schema-max-rwlock-classes 30 +performance-schema-max-rwlock-instances 1000000 performance-schema-max-table-handles 100000 performance-schema-max-table-instances 50000 performance-schema-max-thread-classes 50 diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index e4f68d68c3f..1044127b06e 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -262,6 +262,9 @@ a long \$where variable content banana = banana Not a banana: ba\$cat\$cat +with\`some"escaped\'quotes +with\`some"escaped\'quotes +single'tick`backtick mysqltest: At line 1: Missing arguments to let mysqltest: At line 1: Missing variable name in let mysqltest: At line 1: Missing assignment operator in let diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 58c587fe588..fd523168e7c 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -424,6 +424,7 @@ SHOW STATUS LIKE "handler_read%"; Variable_name Value Handler_read_first 0 Handler_read_key 6 +Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 Handler_read_rnd 0 diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index fa5d8142baf..51c8f0cc741 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -1617,6 +1617,27 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 5 NULL 2 Using where; Using temporary; Using filesort 1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer DROP TABLE t1, t2; +# +# Bug #50394: Regression in EXPLAIN with index scan, LIMIT, GROUP BY and +# ORDER BY computed col +# +CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, KEY( a, b ) ); +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); +INSERT INTO t1 SELECT a + 5, b + 5 FROM t1; +CREATE TABLE t2( a INT PRIMARY KEY, b INT ); +INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); +INSERT INTO t2 SELECT a + 5, b + 5 FROM t2; +EXPLAIN +SELECT count(*) AS c, t1.a +FROM t1 JOIN t2 ON t1.b = t2.a +WHERE t2.b = 1 +GROUP BY t1.a +ORDER by c +LIMIT 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 8 NULL 10 Using index; Using temporary; Using filesort +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where +DROP TABLE t1, t2; End of 5.1 tests # # Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index 467bb7c5cb8..1ea9e91df8a 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -556,9 +556,13 @@ DROP TABLE IF EXISTS t1; SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE NULL +Warnings: +Warning 1411 Incorrect datetime value: '10:00 PM' for function str_to_date SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE; STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE NULL +Warnings: +Warning 1411 Incorrect datetime value: '10:00 PM' for function str_to_date SELECT "1997-12-31 23:59:59" + INTERVAL 1 SECOND; "1997-12-31 23:59:59" + INTERVAL 1 SECOND 1998-01-01 00:00:00 diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 693c338fc76..28206b8e9a6 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1,4 +1,29 @@ drop table if exists t1, t2; +# +# Bug#55458: Partitioned MyISAM table gets crashed by multi-table update +# +CREATE TABLE t1 ( +`id` int NOT NULL, +`user_num` int DEFAULT NULL, +PRIMARY KEY (`id`) +) ENGINE=MyISAM CHARSET=latin1; +INSERT INTO t1 VALUES (1,8601); +INSERT INTO t1 VALUES (2,8601); +INSERT INTO t1 VALUES (3,8601); +INSERT INTO t1 VALUES (4,8601); +CREATE TABLE t2 ( +`id` int(11) NOT NULL, +`user_num` int DEFAULT NULL, +`name` varchar(64) NOT NULL, +PRIMARY KEY (`id`) +) ENGINE=MyISAM CHARSET=latin1 +PARTITION BY HASH (id) +PARTITIONS 2; +INSERT INTO t2 VALUES (1,8601,'John'); +INSERT INTO t2 VALUES (2,8601,'JS'); +INSERT INTO t2 VALUES (3,8601,'John S'); +UPDATE t1, t2 SET t2.name = 'John Smith' WHERE t1.user_num = t2.user_num; +DROP TABLE t1, t2; # Bug#39338: Fieldnames in # INFORMATIONSCHEMA.PARTITIONS.PARTITION_EXPRESSION become unescaped # NOTE: the partition expression is saved as a string, so changing from @@ -359,6 +384,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 2 +Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 0 @@ -377,6 +403,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 2 +Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 0 @@ -407,6 +434,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 Handler_read_rnd 0 @@ -423,6 +451,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 Handler_read_rnd 0 @@ -439,6 +468,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 Handler_read_rnd 0 @@ -455,6 +485,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 Handler_read_rnd 0 @@ -1466,7 +1497,7 @@ NULL 2 explain partitions select * from t1 where a is null or a < 0 or a > 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pn,p2 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t1 pn,p2 ALL NULL NULL NULL NULL 2 Using where drop table t1; CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, name VARCHAR(20)) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/r/partition_column.result b/mysql-test/r/partition_column.result index 7b45ffcb0de..a494656a6a6 100644 --- a/mysql-test/r/partition_column.result +++ b/mysql-test/r/partition_column.result @@ -611,7 +611,7 @@ partition p1 values less than (3,3), partition p2 values less than (9,5)); explain partitions select * from t1 where b < 2; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 5 Using where select * from t1 where b < 2; a b 0 1 @@ -647,7 +647,7 @@ alter table t1 reorganize partition p2 into partition p22 values less than (9,5)); explain partitions select * from t1 where b < 4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p11,p12,p21 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0,p11,p12,p21 ALL NULL NULL NULL NULL 6 Using where select * from t1 where b < 4; a b 0 1 diff --git a/mysql-test/r/partition_column_prune.result b/mysql-test/r/partition_column_prune.result index 844429d24a6..95b45f4dea5 100644 --- a/mysql-test/r/partition_column_prune.result +++ b/mysql-test/r/partition_column_prune.result @@ -59,8 +59,8 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p01,p02,p03,p11 ALL NULL NULL NULL NULL 8 Using where explain partitions select * from t1 where a=4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p11,p12,p13,p21 ALL NULL NULL NULL NULL 14 Using where +1 SIMPLE t1 p11,p12,p13,p21 ALL NULL NULL NULL NULL 8 Using where explain partitions select * from t1 where a=2 and b < 22; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p01,p02,p03 ALL NULL NULL NULL NULL 14 Using where +1 SIMPLE t1 p01,p02,p03 ALL NULL NULL NULL NULL 6 Using where drop table t1; diff --git a/mysql-test/r/partition_hash.result b/mysql-test/r/partition_hash.result index dcefd70ff43..90126bdd4fd 100644 --- a/mysql-test/r/partition_hash.result +++ b/mysql-test/r/partition_hash.result @@ -69,31 +69,31 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where explain partitions select * from t1 where a is null or (a >= 5 and a <= 7); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p2,p3 ALL NULL NULL NULL NULL 9 Using where +1 SIMPLE t1 p0,p2,p3 ALL NULL NULL NULL NULL 7 Using where explain partitions select * from t1 where a is null; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 9 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 Using where explain partitions select * from t1 where a is not null; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where explain partitions select * from t1 where a >= 1 and a < 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 9 Using where +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 5 Using where explain partitions select * from t1 where a >= 3 and a <= 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 9 Using where +1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 4 Using where explain partitions select * from t1 where a > 2 and a < 4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 9 Using where +1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a > 3 and a <= 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 9 Using where +1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 4 Using where explain partitions select * from t1 where a > 5; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where explain partitions select * from t1 where a >= 1 and a <= 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 9 Using where +1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 7 Using where drop table t1; CREATE TABLE t1 ( a int not null, diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index 93cb1617d2f..148504bcc8b 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -120,31 +120,31 @@ insert INTO t1 VALUES (110); ERROR HY000: Table has no partition for value 110 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 3 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 3 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where DROP TABLE t1; # # Bug#50104: Partitioned table with just 1 partion works with fk diff --git a/mysql-test/r/partition_not_blackhole.result b/mysql-test/r/partition_not_blackhole.result new file mode 100644 index 00000000000..dc0339f8c48 --- /dev/null +++ b/mysql-test/r/partition_not_blackhole.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS t1; +# +# Bug#46086: crash when dropping a partitioned table and +# the original engine is disabled +# Copy a .frm and .par file which was created with: +# create table `t1` (`id` int primary key) engine=blackhole +# partition by key () partitions 1; +SHOW TABLES; +Tables_in_test +t1 +SHOW CREATE TABLE t1; +ERROR HY000: Incorrect information in file: './test/t1.frm' +DROP TABLE t1; +ERROR 42S02: Unknown table 't1' +t1.frm +t1.par diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index 76024cdee53..c3a59c6e5f8 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -1,5 +1,29 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; # +# Bug#53806: Wrong estimates for range query in partitioned MyISAM table +# Bug#46754: 'rows' field doesn't reflect partition pruning +# +CREATE TABLE t1 (a INT PRIMARY KEY) +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (1), +PARTITION p1 VALUES LESS THAN (2), +PARTITION p2 VALUES LESS THAN (3), +PARTITION p3 VALUES LESS THAN (4), +PARTITION p4 VALUES LESS THAN (5), +PARTITION p5 VALUES LESS THAN (6), +PARTITION max VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7),(8); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; +id select_type table partitions type possible_keys key key_len ref rows Extra +# # # # # # # # # 3 # +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7; +id select_type table partitions type possible_keys key key_len ref rows Extra +# # # # # # # # # 9 # +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; +id select_type table partitions type possible_keys key key_len ref rows Extra +# # # # # # # # # 3 # +DROP TABLE t1; +# # Bug#49742: Partition Pruning not working correctly for RANGE # CREATE TABLE t1 (a INT PRIMARY KEY) @@ -89,7 +113,7 @@ a 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p0,p1 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index SELECT * FROM t1 WHERE a <= 2; a -1 @@ -98,7 +122,7 @@ a 2 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 2; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2 index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p0,p1,p2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index SELECT * FROM t1 WHERE a <= 3; a -1 @@ -108,7 +132,7 @@ a 3 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3 index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3 index PRIMARY PRIMARY 4 NULL 5 Using where; Using index SELECT * FROM t1 WHERE a <= 4; a -1 @@ -119,7 +143,7 @@ a 4 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4 index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4 index PRIMARY PRIMARY 4 NULL 6 Using where; Using index SELECT * FROM t1 WHERE a <= 5; a -1 @@ -131,7 +155,7 @@ a 5 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5 index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4,p5 index PRIMARY PRIMARY 4 NULL 7 Using where; Using index SELECT * FROM t1 WHERE a <= 6; a -1 @@ -213,7 +237,7 @@ a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p1,p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 8 Using where; Using index SELECT * FROM t1 WHERE a >= 2; a 2 @@ -225,7 +249,7 @@ a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 2; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 7 Using where; Using index SELECT * FROM t1 WHERE a >= 3; a 3 @@ -236,7 +260,7 @@ a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 6 Using where; Using index SELECT * FROM t1 WHERE a >= 4; a 4 @@ -246,7 +270,7 @@ a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p4,p5,max index PRIMARY PRIMARY 4 NULL 5 Using where; Using index SELECT * FROM t1 WHERE a >= 5; a 5 @@ -255,7 +279,7 @@ a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p5,max index PRIMARY PRIMARY 4 NULL 4 Using where; Using index SELECT * FROM t1 WHERE a >= 6; a 6 @@ -263,14 +287,14 @@ a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 3 Using where; Using index SELECT * FROM t1 WHERE a >= 7; a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 7; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 3 Using where; Using index SELECT * FROM t1 WHERE a > 1; a 2 @@ -282,7 +306,7 @@ a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p2,p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 7 Using where; Using index SELECT * FROM t1 WHERE a > 2; a 3 @@ -293,7 +317,7 @@ a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 2; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p3,p4,p5,max index PRIMARY PRIMARY 4 NULL 6 Using where; Using index SELECT * FROM t1 WHERE a > 3; a 4 @@ -303,7 +327,7 @@ a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4,p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p4,p5,max index PRIMARY PRIMARY 4 NULL 5 Using where; Using index SELECT * FROM t1 WHERE a > 4; a 5 @@ -312,7 +336,7 @@ a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p5,max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 p5,max index PRIMARY PRIMARY 4 NULL 4 Using where; Using index SELECT * FROM t1 WHERE a > 5; a 6 @@ -320,20 +344,20 @@ a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 3 Using where; Using index SELECT * FROM t1 WHERE a > 6; a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 3 Using where; Using index SELECT * FROM t1 WHERE a > 7; a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 7; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 10 Using where; Using index +1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 3 Using where; Using index DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY) PARTITION BY RANGE (a) ( @@ -408,7 +432,7 @@ a 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p0,p1 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index SELECT * FROM t1 WHERE a <= 2; a -1 @@ -417,7 +441,7 @@ a 2 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 2; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2 index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p0,p1,p2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index SELECT * FROM t1 WHERE a <= 3; a -1 @@ -427,7 +451,7 @@ a 3 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3 index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3 index PRIMARY PRIMARY 4 NULL 5 Using where; Using index SELECT * FROM t1 WHERE a <= 4; a -1 @@ -438,7 +462,7 @@ a 4 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4 index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p0,p1,p2,p3,p4 index PRIMARY PRIMARY 4 NULL 6 Using where; Using index SELECT * FROM t1 WHERE a <= 5; a -1 @@ -511,7 +535,7 @@ a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p1,p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 7 Using where; Using index SELECT * FROM t1 WHERE a >= 2; a 2 @@ -522,7 +546,7 @@ a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 2; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 6 Using where; Using index SELECT * FROM t1 WHERE a >= 3; a 3 @@ -532,7 +556,7 @@ a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p3,p4,max index PRIMARY PRIMARY 4 NULL 5 Using where; Using index SELECT * FROM t1 WHERE a >= 4; a 4 @@ -541,7 +565,7 @@ a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p4,max index PRIMARY PRIMARY 4 NULL 4 Using where; Using index SELECT * FROM t1 WHERE a >= 5; a 5 @@ -549,14 +573,14 @@ a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 3 Using where; Using index SELECT * FROM t1 WHERE a >= 6; a 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 3 Using where; Using index SELECT * FROM t1 WHERE a > 1; a 2 @@ -567,7 +591,7 @@ a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p2,p3,p4,max index PRIMARY PRIMARY 4 NULL 6 Using where; Using index SELECT * FROM t1 WHERE a > 2; a 3 @@ -577,7 +601,7 @@ a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 2; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3,p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p3,p4,max index PRIMARY PRIMARY 4 NULL 5 Using where; Using index SELECT * FROM t1 WHERE a > 3; a 4 @@ -586,7 +610,7 @@ a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4,max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 p4,max index PRIMARY PRIMARY 4 NULL 4 Using where; Using index SELECT * FROM t1 WHERE a > 4; a 5 @@ -594,20 +618,20 @@ a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 3 Using where; Using index SELECT * FROM t1 WHERE a > 5; a 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 3 Using where; Using index SELECT * FROM t1 WHERE a > 6; a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 9 Using where; Using index +1 SIMPLE t1 max index PRIMARY PRIMARY 4 NULL 3 Using where; Using index DROP TABLE t1; # test of RANGE and index CREATE TABLE t1 (a DATE, KEY(a)) @@ -757,10 +781,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 7 Using where; Using index +1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 7 Using where; Using index +1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index @@ -880,34 +904,34 @@ a 1001-01-01 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p2001-01-01 ALL NULL NULL NULL NULL 4 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p1001-01-01 system NULL NULL NULL NULL 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 Using where # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra @@ -917,25 +941,25 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p2001-01-01 ALL NULL NULL NULL NULL 4 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p2001-01-01 ALL NULL NULL NULL NULL 4 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where DROP TABLE t1; # test of LIST and index CREATE TABLE t1 (a DATE, KEY(a)) @@ -1086,10 +1110,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 7 Using where; Using index +1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 7 Using where; Using index +1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index @@ -1101,7 +1125,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 7 Using where; Using index +1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 Using where; Using index @@ -1209,62 +1233,62 @@ a 1001-01-01 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p1001-01-01 system NULL NULL NULL NULL 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 Using where # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p1001-01-01 ALL NULL NULL NULL NULL 4 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where DROP TABLE t1; # TO_SECONDS, test of LIST and index CREATE TABLE t1 (a DATE, KEY(a)) @@ -1415,10 +1439,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 7 Using where; Using index +1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 7 Using where; Using index +1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index @@ -1430,7 +1454,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 7 Using where; Using index +1 SIMPLE t1 pNULL,p1001-01-01 index a a 4 NULL 4 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 Using where; Using index @@ -1538,62 +1562,62 @@ a 1001-01-01 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p1001-01-01 system NULL NULL NULL NULL 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 Using where # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 pNULL,p1001-01-01 ALL NULL NULL NULL NULL 4 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where DROP TABLE t1; # Test with DATETIME column NOT NULL CREATE TABLE t1 ( @@ -1618,25 +1642,25 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090402 index NULL PRIMARY 12 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra @@ -1644,99 +1668,99 @@ id select_type table partitions type possible_keys key key_len ref rows Extra EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090402 index NULL PRIMARY 12 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090402 index NULL PRIMARY 12 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra @@ -1769,21 +1793,21 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra @@ -1791,79 +1815,79 @@ id select_type table partitions type possible_keys key key_len ref rows Extra EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra @@ -1871,19 +1895,19 @@ id select_type table partitions type possible_keys key key_len ref rows Extra EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra @@ -1891,11 +1915,11 @@ id select_type table partitions type possible_keys key key_len ref rows Extra EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 12 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index DROP TABLE t1; # Test with DATETIME column NULL CREATE TABLE t1 ( @@ -1919,25 +1943,25 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 8 Using where +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 3 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra @@ -1945,99 +1969,99 @@ id select_type table partitions type possible_keys key key_len ref rows Extra EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 3 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 13 Using where +1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 3 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra @@ -2069,21 +2093,21 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra @@ -2091,79 +2115,79 @@ id select_type table partitions type possible_keys key key_len ref rows Extra EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra @@ -2171,19 +2195,19 @@ id select_type table partitions type possible_keys key key_len ref rows Extra EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra @@ -2191,11 +2215,11 @@ id select_type table partitions type possible_keys key key_len ref rows Extra EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where DROP TABLE t1; # For better code coverage of the patch CREATE TABLE t1 ( @@ -2259,7 +2283,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 Using where explain partitions select * from t2 where a=1 and b=1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where create table t3 ( a int ) @@ -2317,25 +2341,25 @@ id select_type table partitions type possible_keys key key_len ref rows Extra explain partitions select * from t5 where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t5 p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t5 p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t5 where (a=10 and b=2) or (a=10 and b=3) or (a=10 and b = 4); id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where explain partitions select * from t5 where (c=1 and d=1); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t5 p0_p0sp0,p1_p1sp0 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t5 p0_p0sp0,p1_p1sp0 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t5 where (c=2 and d=1); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t5 p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t5 p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or (c=2 and d=1); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 3 Using where explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or (b=2 and c=2 and d=1); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 3 Using where create table t6 (a int not null) partition by LIST(a) ( partition p1 values in (1), partition p3 values in (3), @@ -2373,7 +2397,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t6 p5,p7,p9 system NULL NULL NULL NULL 1 explain partitions select * from t6 where a >= 3 and a <= 8; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t6 where a > 3 and a < 5; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables @@ -2415,7 +2439,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t6 p5,p7,p9 system NULL NULL NULL NULL 1 explain partitions select * from t6 where a >= 3 and a <= 8; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t6 where a > 3 and a < 5; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables @@ -2667,7 +2691,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a > 1 and a <= 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a >= 1 and a <= 3; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p1,p2,p3 ALL NULL NULL NULL NULL 3 Using where @@ -2757,22 +2781,22 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1010 explain partitions select * from t2 where a < 801 and a > 200; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p1,p2,p3,p4 ALL NULL NULL NULL NULL 1010 Using where +1 SIMPLE t2 p1,p2,p3,p4 ALL NULL NULL NULL NULL 800 Using where explain partitions select * from t2 where a < 801 and a > 800; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 1010 Using where +1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 200 Using where explain partitions select * from t2 where a > 600; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 1010 Using where +1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 Using where explain partitions select * from t2 where a > 600 and b = 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 1010 Using where +1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 Using where explain partitions select * from t2 where a > 600 and b = 4; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 1010 Using where +1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 Using where explain partitions select * from t2 where a > 600 and b = 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 1010 Using where +1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 Using where explain partitions select * from t2 where b = 5; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1010 Using where @@ -2827,19 +2851,19 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 910 explain partitions select * from t2 where a = 101; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 910 Using where +1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 110 Using where explain partitions select * from t2 where a = 550; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 910 Using where +1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 200 Using where explain partitions select * from t2 where a = 833; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 910 Using where +1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 200 Using where explain partitions select * from t2 where (a = 100 OR a = 900); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p4 ALL NULL NULL NULL NULL 910 Using where +1 SIMPLE t2 p0,p4 ALL NULL NULL NULL NULL 310 Using where explain partitions select * from t2 where (a > 100 AND a < 600); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1,p2 ALL NULL NULL NULL NULL 910 Using where +1 SIMPLE t2 p0,p1,p2 ALL NULL NULL NULL NULL 510 Using where explain partitions select * from t2 where b = 4; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 76 Using where @@ -3125,17 +3149,17 @@ id select_type table partitions type possible_keys key key_len ref rows Extra explain partitions select * from t1 where a >= 18446744073709551000-1 and a <= 18446744073709551000+1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3,p4 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t1 p3,p4 ALL NULL NULL NULL NULL 3 Using where explain partitions select * from t1 where a between 18446744073709551001 and 18446744073709551002; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a = 18446744073709551000; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a = 18446744073709551613; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a = 18446744073709551614; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables @@ -3162,10 +3186,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a=0xFE; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t2 where a=0xFE; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a > 0xFE AND a <= 0xFF; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables @@ -3174,22 +3198,22 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t1 where a >= 0xFE AND a <= 0xFF; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t2 where a >= 0xFE AND a <= 0xFF; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a < 64 AND a >= 63; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t2 where a < 64 AND a >= 63; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a <= 64 AND a >= 63; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 4 Using where explain partitions select * from t2 where a <= 64 AND a >= 63; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 4 Using where drop table t1; drop table t2; create table t1(a bigint unsigned not null) partition by range(a+0) ( diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result index d37281d9638..4280158dd16 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -53,10 +53,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 4 Using where explain partitions select * from t1 where a <= '2007-03-07 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a < '2007-03-07 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -203,13 +203,13 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pnull system NULL NULL NULL NULL 1 explain partitions select * from t1 where a >= 0; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a < 0; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t1 where a <= 0; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a > 1; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables @@ -242,16 +242,16 @@ select * from t1 where a > 1; a b explain partitions select * from t1 where a is null; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a >= 0; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where explain partitions select * from t1 where a < 0; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a <= 0; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where explain partitions select * from t1 where a > 1; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index 1eaa2e0d256..95ff4a336ca 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -1929,26 +1929,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, @@ -1976,26 +1976,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select @@ -2026,26 +2026,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday set @my_key= 0 ; @@ -2066,26 +2066,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; @@ -2114,26 +2114,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2158,26 +2158,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2204,26 +2204,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday set @my_key= 0 ; @@ -2242,26 +2242,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 06e232fd9b0..6b4f3cb9aa9 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -1912,26 +1912,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, @@ -1959,26 +1959,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select @@ -2009,26 +2009,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday set @my_key= 0 ; @@ -2049,26 +2049,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; @@ -2097,26 +2097,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2141,26 +2141,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2187,26 +2187,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday set @my_key= 0 ; @@ -2225,26 +2225,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 1458f7d4514..7e07ba89fc9 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -1913,26 +1913,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 0 31 8 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 0 31 8 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 0 31 8 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 0 31 8 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 0 31 8 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 0 31 8 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 0 31 8 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 0 31 8 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, @@ -1960,26 +1960,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 0 31 8 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 0 31 8 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 0 31 8 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 0 31 8 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 0 31 8 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 0 31 8 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 0 31 8 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 0 31 8 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select @@ -2010,26 +2010,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 0 31 8 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 0 31 8 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 0 31 8 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 0 31 8 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 0 31 8 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 0 31 8 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 0 31 8 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 0 31 8 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday set @my_key= 0 ; @@ -2050,26 +2050,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 0 31 8 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 0 31 8 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 0 31 8 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 0 31 8 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 0 31 8 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 0 31 8 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 0 31 8 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 0 31 8 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; @@ -2098,26 +2098,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 0 31 8 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 0 31 8 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 0 31 8 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 0 31 8 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 0 31 8 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 0 31 8 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 0 31 8 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 0 31 8 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2142,26 +2142,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 0 31 8 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 0 31 8 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 0 31 8 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 0 31 8 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 0 31 8 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 0 31 8 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 0 31 8 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 0 31 8 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2188,26 +2188,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 0 31 8 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 0 31 8 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 0 31 8 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 0 31 8 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 0 31 8 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 0 31 8 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 0 31 8 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 0 31 8 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday set @my_key= 0 ; @@ -2226,26 +2226,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 0 31 8 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 0 31 8 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 0 31 8 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 0 31 8 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 0 31 8 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 0 31 8 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 0 31 8 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 0 31 8 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index ad750cccd52..0b81c7f6a43 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -1849,26 +1849,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, @@ -1896,26 +1896,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select @@ -1946,26 +1946,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday set @my_key= 0 ; @@ -1986,26 +1986,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; @@ -2034,26 +2034,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2078,26 +2078,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -2124,26 +2124,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday set @my_key= 0 ; @@ -2162,26 +2162,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; @@ -4871,26 +4871,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, @@ -4918,26 +4918,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select @@ -4968,26 +4968,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday set @my_key= 0 ; @@ -5008,26 +5008,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; @@ -5056,26 +5056,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -5100,26 +5100,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, @@ -5146,26 +5146,26 @@ def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 def @arg11 246 83 6 Y 32896 30 63 def @arg12 246 83 6 Y 32896 30 63 -def @arg13 251 16777216 10 Y 0 31 8 -def @arg14 251 16777216 19 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 8 Y 0 31 8 +def @arg13 250 16777215 10 Y 0 31 8 +def @arg14 250 16777215 19 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 8 Y 0 31 8 def @arg17 8 20 4 Y 32928 0 63 def @arg18 8 20 1 Y 32896 0 63 def @arg19 8 20 1 Y 32896 0 63 -def @arg20 251 16777216 1 Y 0 31 8 -def @arg21 251 16777216 10 Y 0 31 8 -def @arg22 251 16777216 30 Y 0 31 8 -def @arg23 251 16777216 8 Y 128 31 63 -def @arg24 251 16777216 8 Y 0 31 8 -def @arg25 251 16777216 4 Y 128 31 63 -def @arg26 251 16777216 4 Y 0 31 8 -def @arg27 251 16777216 10 Y 128 31 63 -def @arg28 251 16777216 10 Y 0 31 8 -def @arg29 251 16777216 8 Y 128 31 63 -def @arg30 251 16777216 8 Y 0 31 8 -def @arg31 251 16777216 3 Y 0 31 8 -def @arg32 251 16777216 6 Y 0 31 8 +def @arg20 250 16777215 1 Y 0 31 8 +def @arg21 250 16777215 10 Y 0 31 8 +def @arg22 250 16777215 30 Y 0 31 8 +def @arg23 250 16777215 8 Y 128 31 63 +def @arg24 250 16777215 8 Y 0 31 8 +def @arg25 250 16777215 4 Y 128 31 63 +def @arg26 250 16777215 4 Y 0 31 8 +def @arg27 250 16777215 10 Y 128 31 63 +def @arg28 250 16777215 10 Y 0 31 8 +def @arg29 250 16777215 8 Y 128 31 63 +def @arg30 250 16777215 8 Y 0 31 8 +def @arg31 250 16777215 3 Y 0 31 8 +def @arg32 250 16777215 6 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday set @my_key= 0 ; @@ -5184,26 +5184,26 @@ def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 def @arg11 246 83 0 Y 32896 30 63 def @arg12 246 83 0 Y 32896 30 63 -def @arg13 251 16777216 0 Y 0 31 8 -def @arg14 251 16777216 0 Y 0 31 8 -def @arg15 251 16777216 19 Y 0 31 8 -def @arg16 251 16777216 0 Y 0 31 8 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 def @arg17 8 20 0 Y 32928 0 63 def @arg18 8 20 0 Y 32896 0 63 def @arg19 8 20 0 Y 32896 0 63 -def @arg20 251 16777216 0 Y 0 31 8 -def @arg21 251 16777216 0 Y 0 31 8 -def @arg22 251 16777216 0 Y 0 31 8 -def @arg23 251 16777216 0 Y 128 31 63 -def @arg24 251 16777216 0 Y 0 31 8 -def @arg25 251 16777216 0 Y 128 31 63 -def @arg26 251 16777216 0 Y 0 31 8 -def @arg27 251 16777216 0 Y 128 31 63 -def @arg28 251 16777216 0 Y 0 31 8 -def @arg29 251 16777216 0 Y 128 31 63 -def @arg30 251 16777216 0 Y 0 31 8 -def @arg31 251 16777216 0 Y 0 31 8 -def @arg32 251 16777216 0 Y 0 31 8 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index aa04bfc25ea..62acb2a7710 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -1653,4 +1653,17 @@ a b 0 0 1 1 DROP TABLE t1; +# +# Bug #54802: 'NOT BETWEEN' evaluation is incorrect +# +CREATE TABLE t1 (c_key INT, c_notkey INT, KEY(c_key)); +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3); +EXPLAIN SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL c_key NULL NULL NULL 3 Using where +SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key; +c_key c_notkey +1 1 +3 3 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index 2962123fcb2..789b9c4f383 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -466,3 +466,26 @@ SELECT 1 FROM t1 WHERE ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234)); 1 DROP TABLE t1; +# +# Bug #54190: Comparison to row subquery produces incorrect result +# +SELECT ROW(1,2) = (SELECT 1,2 FROM DUAL WHERE 1 = 0); +ROW(1,2) = (SELECT 1,2 FROM DUAL WHERE 1 = 0) +NULL +SELECT ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0); +ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0) +NULL +CREATE TABLE t1 (i INT); +INSERT INTO t1 () VALUES (1), (2), (3); +SELECT ROW(1,2) = (SELECT 1,2 FROM t1 WHERE 1 = 0); +ROW(1,2) = (SELECT 1,2 FROM t1 WHERE 1 = 0) +NULL +SELECT ROW(1,2) = (SELECT 1,3 FROM t1 WHERE 1 = 0); +ROW(1,2) = (SELECT 1,3 FROM t1 WHERE 1 = 0) +NULL +SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,2 FROM DUAL WHERE 1 = 0); +i +SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0); +i +DROP TABLE t1; +End of 5.1 tests diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index b193a269288..96979d257f1 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4171,9 +4171,10 @@ str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00' set SQL_MODE=TRADITIONAL; select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' -0 +NULL Warnings: Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' +Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'; str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34' 0 @@ -4181,17 +4182,16 @@ Warnings: Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34' select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34' -0 +NULL Warnings: -Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34:00' +Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01' and '2007/10/20'; str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01' and '2007/10/20' -0 +NULL Warnings: -Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/09/01' at row 1 -Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/10/20' at row 1 +Warning 1411 Incorrect datetime value: '2007-10-00' for function str_to_date set SQL_MODE=DEFAULT; select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'; str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20' @@ -4338,6 +4338,7 @@ SHOW STATUS LIKE 'Handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 2 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -4429,11 +4430,6 @@ SELECT 1 FROM t1 WHERE a <> 1 AND NOT ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1)) INTO @var0; ERROR 21000: Subquery returns more than 1 row -SELECT 1 FROM t1 WHERE a <> 1 AND NOT -ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1)); -1 -1 -1 DROP TABLE t1; # # Bug #48458: simple query tries to allocate enormous amount of diff --git a/mysql-test/r/single_delete_update.result b/mysql-test/r/single_delete_update.result index 921d308097c..72419c6ec9d 100644 --- a/mysql-test/r/single_delete_update.result +++ b/mysql-test/r/single_delete_update.result @@ -25,6 +25,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 0 @@ -41,6 +42,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 0 @@ -74,6 +76,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -90,6 +93,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 5 @@ -120,6 +124,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -136,6 +141,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 1 @@ -170,6 +176,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 1 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 0 @@ -186,6 +193,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 1 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 0 @@ -214,6 +222,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -230,6 +239,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 1 @@ -256,6 +266,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 1 @@ -272,6 +283,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 1 @@ -301,6 +313,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 2 +Handler_read_last 0 Handler_read_next 7 Handler_read_prev 0 Handler_read_rnd 4 @@ -322,6 +335,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 2 +Handler_read_last 0 Handler_read_next 7 Handler_read_prev 0 Handler_read_rnd 8 @@ -357,6 +371,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 4 Handler_read_rnd 0 @@ -373,6 +388,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 4 Handler_read_rnd 0 @@ -406,6 +422,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -422,6 +439,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 5 @@ -464,6 +482,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 1 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 0 @@ -486,6 +505,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 1 Handler_read_next 0 Handler_read_prev 4 Handler_read_rnd 0 @@ -502,6 +522,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 1 Handler_read_next 0 Handler_read_prev 4 Handler_read_rnd 0 @@ -536,6 +557,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 0 @@ -552,6 +574,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 5 @@ -590,6 +613,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -606,6 +630,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 5 @@ -641,6 +666,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -657,6 +683,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 1 @@ -691,6 +718,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 1 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 0 @@ -707,6 +735,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 1 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 5 @@ -735,6 +764,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -751,6 +781,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 1 @@ -778,6 +809,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 1 @@ -794,6 +826,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 1 @@ -824,6 +857,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 2 +Handler_read_last 0 Handler_read_next 7 Handler_read_prev 0 Handler_read_rnd 4 @@ -845,6 +879,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 2 +Handler_read_last 0 Handler_read_next 7 Handler_read_prev 0 Handler_read_rnd 8 @@ -884,6 +919,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 4 Handler_read_rnd 0 @@ -900,6 +936,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 4 Handler_read_rnd 5 @@ -938,6 +975,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -954,6 +992,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 5 @@ -990,6 +1029,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 1 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 Handler_read_rnd 0 @@ -1012,6 +1052,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 1 Handler_read_next 0 Handler_read_prev 4 Handler_read_rnd 0 @@ -1028,6 +1069,7 @@ SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 1 Handler_read_next 0 Handler_read_prev 4 Handler_read_rnd 5 diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result index a4933ee9800..32d0e39c5af 100644 --- a/mysql-test/r/sp-destruct.result +++ b/mysql-test/r/sp-destruct.result @@ -134,3 +134,19 @@ Warning 1405 Failed to revoke all privileges to dropped routine # Restore the procs_priv table RENAME TABLE procs_priv_backup TO mysql.procs_priv; FLUSH TABLE mysql.procs_priv; +# +# Bug #56137 "Assertion `thd->lock == 0' failed on upgrading from +# 5.1.50 to 5.5.6". +# +drop database if exists mysqltest; +# Backup mysql.proc. +flush table mysql.proc; +create database mysqltest; +# Corrupt mysql.proc to make it unusable by current version of server. +alter table mysql.proc drop column type; +# The below statement should not cause assertion failure. +drop database mysqltest; +Warnings: +Error 1547 Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted +# Restore mysql.proc. +drop table mysql.proc; diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 79f8c20a150..872bfdc4873 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -206,12 +206,11 @@ INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y')); INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i')); INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i')); INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); -Warnings: -Note 1265 Data truncated for column 'col1' at row 1 +ERROR HY000: Incorrect datetime value: '31.10.0000 15.30' for function str_to_date INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect date value: '2004-00-31 15:30:00' for column 'col1' at row 1 +ERROR HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_date INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect date value: '2004-10-00 15:30:00' for column 'col1' at row 1 +ERROR HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); ERROR 22007: Incorrect date value: '2004-09-31 15:30:00' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); @@ -221,12 +220,13 @@ ERROR 22007: Incorrect date value: '2003-02-29 15:30:00' for column 'col1' at ro INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); -ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 +ERROR HY000: Incorrect datetime value: '00.00.0000' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); +ERROR HY000: Incorrect datetime value: '31.10.0000 15.30' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col2' at row 1 +ERROR HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1 +ERROR HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); @@ -236,13 +236,13 @@ ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col2' a INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); -ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col2' at row 1 +ERROR HY000: Incorrect datetime value: '00.00.0000' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1 +ERROR HY000: Incorrect datetime value: '31.10.0000 15.30' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col3' at row 1 +ERROR HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1 +ERROR HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); @@ -252,7 +252,7 @@ ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col3' a INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); -ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col3' at row 1 +ERROR HY000: Incorrect datetime value: '00.00.0000' for function str_to_date drop table t1; CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp); INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE)); @@ -1108,6 +1108,9 @@ Warnings: Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date +Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date +Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date +Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date drop table t1; create table t1 (col1 char(3), col2 integer); insert into t1 (col1) values (cast(1000 as char(3))); diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 72d63e47d9a..13941b56040 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -922,7 +922,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a) 1 1 a 2 0 b -NULL 0 NULL +NULL NULL NULL select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2; a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a) 1 0 a @@ -932,7 +932,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a) 1 0 a 2 0 b -NULL 0 NULL +NULL NULL NULL drop table t1,t2; create table t1 (a int, b real, c varchar(10)); insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b'); diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result index 586e2e7822b..2962a12d9a2 100644 --- a/mysql-test/r/subselect3.result +++ b/mysql-test/r/subselect3.result @@ -113,6 +113,7 @@ show status like '%Handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index 2e638ddb9ab..ebda4b52f10 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -77,6 +77,92 @@ Note 1249 Select 2 was reduced during optimization CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) ); CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) ); DROP VIEW v1, v2; +# +# Bug#51070: Query with a NOT IN subquery predicate returns a wrong +# result set +# +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES ( 1, NULL ), ( 2, NULL ); +CREATE TABLE t2 ( c INT, d INT ); +INSERT INTO t2 VALUES ( NULL, 3 ), ( NULL, 4 ); +CREATE TABLE t3 ( e INT, f INT ); +INSERT INTO t3 VALUES ( NULL, NULL ), ( NULL, NULL ); +CREATE TABLE t4 ( a INT ); +INSERT INTO t4 VALUES (1), (2), (3); +CREATE TABLE t5 ( a INT ); +INSERT INTO t5 VALUES (NULL), (2); +EXPLAIN +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +x PRIMARY x x x x x x x x +x DEPENDENT SUBQUERY x x x x x x x x +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ); +a b +EXPLAIN +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL; +a b +1 NULL +2 NULL +SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) IS NULL; +a b +1 NULL +2 NULL +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS UNKNOWN; +a b +1 NULL +2 NULL +SELECT * FROM t1 WHERE (( a, b ) NOT IN ( SELECT c, d FROM t2 )) IS UNKNOWN; +a b +1 NULL +2 NULL +SELECT * FROM t1 WHERE 1 = 1 AND ( a, b ) NOT IN ( SELECT c, d FROM t2 ); +a b +EXPLAIN +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 ); +id select_type table type possible_keys key key_len ref rows Extra +x PRIMARY x x x x x x x x +x DEPENDENT SUBQUERY x x x x x x x x +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 ); +a b +EXPLAIN +SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 ); +id select_type table type possible_keys key key_len ref rows Extra +x PRIMARY x x x x x x x x +x DEPENDENT SUBQUERY x x x x x x x x +SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 ); +c d +EXPLAIN +SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +x PRIMARY x x x x x x x x +x DEPENDENT SUBQUERY x x x x x x x x +SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 ); +e f +EXPLAIN +SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 ); +id select_type table type possible_keys key key_len ref rows Extra +x PRIMARY x x x x x x x x +x DEPENDENT SUBQUERY x x x x x x x x +SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 ); +c d +SELECT * FROM t1 WHERE ( a, b ) NOT IN +( SELECT c, d FROM t2 WHERE c = 1 AND c <> 1 ); +a b +1 NULL +2 NULL +SELECT * FROM t1 WHERE b NOT IN ( SELECT c FROM t2 WHERE c = 1 ); +a b +1 NULL +2 NULL +SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 ); +a b +1 NULL +2 NULL +DROP TABLE t1, t2, t3, t4, t5; # # End of 5.1 tests. # diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result index 2948bb8ecec..e2e337628ce 100644 --- a/mysql-test/r/timezone2.result +++ b/mysql-test/r/timezone2.result @@ -296,4 +296,16 @@ CONVERT_TZ(NOW(), 'UTC', 'Europe/Moscow') IS NULL UPDATE t1 SET t = CONVERT_TZ(t, 'UTC', 'Europe/Moscow'); UNLOCK TABLES; DROP TABLE t1; +# +# Bug #55424: convert_tz crashes when fed invalid data +# +CREATE TABLE t1 (a SET('x') NOT NULL); +INSERT INTO t1 VALUES (''); +SELECT CONVERT_TZ(1, a, 1) FROM t1; +CONVERT_TZ(1, a, 1) +NULL +SELECT CONVERT_TZ(1, 1, a) FROM t1; +CONVERT_TZ(1, 1, a) +NULL +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/trigger_notembedded.result b/mysql-test/r/trigger_notembedded.result index 982966f6689..5760b6b6e6b 100644 --- a/mysql-test/r/trigger_notembedded.result +++ b/mysql-test/r/trigger_notembedded.result @@ -472,4 +472,25 @@ SHOW CREATE TRIGGER db1.trg; ERROR 42000: Access denied; you need (at least one of) the TRIGGER privilege(s) for this operation DROP USER 'no_rights'@'localhost'; DROP DATABASE db1; +DROP DATABASE IF EXISTS mysqltest_db1; +CREATE DATABASE mysqltest_db1; +USE mysqltest_db1; +GRANT ALL ON mysqltest_db1.* TO mysqltest_u1@localhost; +CREATE TABLE t1 ( +a1 int, +a2 int +); +INSERT INTO t1 VALUES (1, 20); +CREATE TRIGGER mysqltest_db1.upd_t1 +BEFORE UPDATE ON t1 FOR EACH ROW SET new.a2 = 200; +CREATE TABLE t2 ( +a1 int +); +INSERT INTO t2 VALUES (2); +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; +UPDATE IGNORE t1, t2 SET t1.a1 = 2, t2.a1 = 3 WHERE t1.a1 = 1 AND t2.a1 = 2; +ERROR 42000: TRIGGER command denied to user 'mysqltest_u1'@'localhost' for table 't1' +DROP DATABASE mysqltest_db1; +DROP USER mysqltest_u1@localhost; +USE test; End of 5.1 tests. diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index a054659abe9..f7bfba0accd 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -655,5 +655,30 @@ Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from DROP TABLE t1; SET NAMES latin1; # +# Bug#56271: Wrong comparison result with STR_TO_DATE function +# +CREATE TABLE t1 ( +`year` int(4) NOT NULL, +`month` int(2) NOT NULL +); +INSERT INTO t1 VALUES (2010,3),(2010,4),(2009,8),(2008,9); +SELECT * +FROM t1 +WHERE STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') >= +STR_TO_DATE('1/1/2010', '%m/%d/%Y'); +year month +2010 3 +2010 4 +create table t2(f1 datetime primary key); +insert into t2 select STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') from t1; +select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y'); +f1 +2010-04-01 00:00:00 +t2 should be const +explain select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 const PRIMARY PRIMARY 8 const 1 Using index +DROP TABLE t1,t2; +# # End of 5.5 tests # diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index e5fbf158a8b..819e41f41c5 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -1908,4 +1908,16 @@ group by PAY.id + 1; mult v_net_with_discount v_total 1.0000 27.18 27.180000 DROP TABLE currencies, payments, sub_tasks; +# +# BUG#52171: distinct aggregates on unsigned decimal fields trigger assertions +# +CREATE TABLE t1 (a DECIMAL(4,4) UNSIGNED); +INSERT INTO t1 VALUES (0); +SELECT AVG(DISTINCT a) FROM t1; +AVG(DISTINCT a) +0.00000000 +SELECT SUM(DISTINCT a) FROM t1; +SUM(DISTINCT a) +0.0000 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index 672b4d423a3..10a2b47ba02 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -503,6 +503,27 @@ f1 f2-f3 5 0 DROP TABLE t1; End of 5.0 tests +# +# Bug #55779: select does not work properly in mysql server +# Version "5.1.42 SUSE MySQL RPM" +# +CREATE TABLE t1 (a TIMESTAMP, KEY (a)); +INSERT INTO t1 VALUES ('2000-01-01 00:00:00'), ('2000-01-01 00:00:00'), +('2000-01-01 00:00:01'), ('2000-01-01 00:00:01'); +SELECT a FROM t1 WHERE a >= 20000101000000; +a +2000-01-01 00:00:00 +2000-01-01 00:00:00 +2000-01-01 00:00:01 +2000-01-01 00:00:01 +SELECT a FROM t1 WHERE a >= '20000101000000'; +a +2000-01-01 00:00:00 +2000-01-01 00:00:00 +2000-01-01 00:00:01 +2000-01-01 00:00:01 +DROP TABLE t1; +End of 5.1 tests Bug#50888 valgrind warnings in Field_timestamp::val_str diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index 05ab1b71018..54170ae3dad 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -273,6 +273,7 @@ show status like 'handler_read%'; Variable_name Value Handler_read_first 1 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -284,6 +285,7 @@ show status like 'handler_read%'; Variable_name Value Handler_read_first 1 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 2 @@ -294,6 +296,7 @@ show status like 'handler_read%'; Variable_name Value Handler_read_first 1 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -304,6 +307,7 @@ show status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 1 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -315,6 +319,7 @@ show status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 0 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 1 @@ -368,6 +373,7 @@ show status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 1 Handler_read_prev 0 Handler_read_rnd 1 @@ -405,6 +411,7 @@ show status like '%Handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -415,6 +422,7 @@ show status like '%Handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 2 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -424,6 +432,7 @@ show status like '%Handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 3 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 @@ -433,6 +442,7 @@ show status like '%Handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 3 +Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 Handler_read_rnd 0 diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 29c05a60166..a680e837cae 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -428,6 +428,23 @@ CREATE TRIGGER t_after_insert AFTER INSERT ON t1 FOR EACH ROW SET @bug42188 = 10 INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1); DROP TABLE t1; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (0),(0); +# BUG#55615 : should not crash +SELECT (@a:=(SELECT @a:=1 FROM t1 LIMIT 1)) AND COUNT(1) FROM t1 GROUP BY @a; +(@a:=(SELECT @a:=1 FROM t1 LIMIT 1)) AND COUNT(1) +1 +1 +# BUG#55564 : should not crash +SELECT IF( +@v:=LEAST((SELECT 1 FROM t1 t2 LEFT JOIN t1 ON (@v) GROUP BY t1.a), a), +count(*), 1) +FROM t1 GROUP BY a LIMIT 1; +IF( +@v:=LEAST((SELECT 1 FROM t1 t2 LEFT JOIN t1 ON (@v) GROUP BY t1.a), a), +count(*), 1) +1 +DROP TABLE t1; End of 5.1 tests DROP TABLE IF EXISTS t1; CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1)); diff --git a/mysql-test/r/variables_debug.result b/mysql-test/r/variables_debug.result index a02d285b15b..8abdbdaed12 100644 --- a/mysql-test/r/variables_debug.result +++ b/mysql-test/r/variables_debug.result @@ -32,3 +32,47 @@ SELECT @@global.debug; SET GLOBAL debug=@old_debug; End of 5.1 tests +# +# Bug#46165 server crash in dbug +# +SET @old_globaldebug = @@global.debug; +SET @old_sessiondebug= @@session.debug; +# Test 1 - Bug test case, single connection +SET GLOBAL debug= '+O,../../log/bug46165.1.trace'; +SET SESSION debug= '-d:-t:-i'; +SET GLOBAL debug= ''; +SET SESSION debug= ''; +# Test 2 - Bug test case, two connections +# Connection default +SET GLOBAL debug= '+O,../../log/bug46165.2.trace'; +SET SESSION debug= '-d:-t:-i'; +# Connection con1 +SET GLOBAL debug= ''; +# Connection default +SET SESSION debug= ''; +# Connection con1 +# Connection default +SET GLOBAL debug= ''; +# Test 3 - Active session trace file on disconnect +# Connection con1 +SET GLOBAL debug= '+O,../../log/bug46165.3.trace'; +SET SESSION debug= '-d:-t:-i'; +SET GLOBAL debug= ''; +# Test 4 - Active session trace file on two connections +# Connection default +SET GLOBAL debug= '+O,../../log/bug46165.4.trace'; +SET SESSION debug= '-d:-t:-i'; +# Connection con1 +SET SESSION debug= '-d:-t:-i'; +SET GLOBAL debug= ''; +SET SESSION debug= ''; +# Connection default +SET SESSION debug= ''; +# Connection con1 +# Connection default +# Test 5 - Different trace files +SET SESSION debug= '+O,../../log/bug46165.5.trace'; +SET SESSION debug= '+O,../../log/bug46165.6.trace'; +SET SESSION debug= '-O'; +SET GLOBAL debug= @old_globaldebug; +SET SESSION debug= @old_sessiondebug; diff --git a/mysql-test/r/xa.result b/mysql-test/r/xa.result index fedbb43ea2a..6ef3bf392d9 100644 --- a/mysql-test/r/xa.result +++ b/mysql-test/r/xa.result @@ -131,3 +131,14 @@ XA START 'xid1'; XA END 'xid1'; XA ROLLBACK 'xid1'; DROP TABLE t1; +# +# Bug#56448 Assertion failed: ! is_set() with second xa end +# +XA START 'x'; +XA END 'x'; +XA END 'x'; +ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state +XA PREPARE 'x'; +XA PREPARE 'x'; +ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state +XA ROLLBACK 'x'; diff --git a/mysql-test/std_data/parts/t1_blackhole.frm b/mysql-test/std_data/parts/t1_blackhole.frm Binary files differnew file mode 100644 index 00000000000..be77b7a041a --- /dev/null +++ b/mysql-test/std_data/parts/t1_blackhole.frm diff --git a/mysql-test/std_data/parts/t1_blackhole.par b/mysql-test/std_data/parts/t1_blackhole.par Binary files differnew file mode 100644 index 00000000000..6528edf190c --- /dev/null +++ b/mysql-test/std_data/parts/t1_blackhole.par diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index 3c4668b72bb..e45f4a76643 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -1267,8 +1267,9 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; FLUSH TABLES -insert delayed into t1 values (null),(null),(null),(null); -insert delayed into t1 values (null),(null),(400),(null); +RESET MASTER; +insert /* before delayed */ delayed /* after delayed */ into t1 values (null),(null),(null),(null); +insert /*! delayed */ into t1 values (null),(null),(400),(null); select * from t1; a 207 diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index dbedb21c33d..406b519aee8 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -53,10 +53,10 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT my_savepoint +master-bin.000001 # Query # # SAVEPOINT `my_savepoint` master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO my_savepoint +master-bin.000001 # Query # # ROLLBACK TO `my_savepoint` master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; @@ -84,10 +84,10 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT my_savepoint +master-bin.000001 # Query # # SAVEPOINT `my_savepoint` master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO my_savepoint +master-bin.000001 # Query # # ROLLBACK TO `my_savepoint` master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ diff --git a/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result b/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result index e081bed40e6..2219961aca0 100644 --- a/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result +++ b/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result @@ -20,12 +20,21 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; insert delayed into t1 values (300) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; FLUSH TABLES -insert delayed into t1 values (null),(null),(null),(null); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. -insert delayed into t1 values (null),(null),(400),(null); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. +RESET MASTER; +insert /* before delayed */ delayed /* after delayed */ into t1 values (null),(null),(null),(null); +insert /*! delayed */ into t1 values (null),(null),(400),(null); +FLUSH TABLES; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Intvar # # INSERT_ID=301 +master-bin.000001 # Query # # use `test`; insert /* before delayed */ /* after delayed */ into t1 values (null),(null),(null),(null) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Intvar # # INSERT_ID=305 +master-bin.000001 # Query # # use `test`; insert /*! */ into t1 values (null),(null),(400),(null) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; FLUSH TABLES select * from t1; a 207 diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index b96707f994c..187a778d9cc 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -758,8 +758,9 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; FLUSH TABLES -insert delayed into t1 values (null),(null),(null),(null); -insert delayed into t1 values (null),(null),(400),(null); +RESET MASTER; +insert /* before delayed */ delayed /* after delayed */ into t1 values (null),(null),(null),(null); +insert /*! delayed */ into t1 values (null),(null),(400),(null); select * from t1; a 207 diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result index 958643c3314..20d82557122 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result @@ -51,10 +51,10 @@ show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; insert into t1 values(3) -master-bin.000001 # Query # # SAVEPOINT my_savepoint +master-bin.000001 # Query # # SAVEPOINT `my_savepoint` master-bin.000001 # Query # # use `test`; insert into t1 values(4) master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 -master-bin.000001 # Query # # ROLLBACK TO my_savepoint +master-bin.000001 # Query # # ROLLBACK TO `my_savepoint` master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; @@ -79,10 +79,10 @@ show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; insert into t1 values(5) -master-bin.000001 # Query # # SAVEPOINT my_savepoint +master-bin.000001 # Query # # SAVEPOINT `my_savepoint` master-bin.000001 # Query # # use `test`; insert into t1 values(6) master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 -master-bin.000001 # Query # # ROLLBACK TO my_savepoint +master-bin.000001 # Query # # ROLLBACK TO `my_savepoint` master-bin.000001 # Query # # use `test`; insert into t1 values(7) master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result index ba361e59428..7222f384a1f 100644 --- a/mysql-test/suite/binlog/r/binlog_unsafe.result +++ b/mysql-test/suite/binlog/r/binlog_unsafe.result @@ -862,65 +862,51 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc * Invoke statement so that return value is dicarded: expect no warning. SELECT * FROM data_table LIMIT 1; -==== Testing INSERT DELAYED unsafeness ==== +==== Testing INSERT DELAYED safeness after BUG#54579 is fixed ==== Invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement. CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO t0 VALUES (1), (2); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t1 SELECT func_sidef_1(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP FUNCTION func_sidef_2; Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement. CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. CALL proc_2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PROCEDURE proc_2; Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement. CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP TRIGGER trig_2; Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement. CREATE VIEW view_sidef_2 AS SELECT func_sidef_1(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t2 SELECT * FROM view_sidef_2; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP VIEW view_sidef_2; Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement. PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()"; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PREPARE prep_2; @@ -928,49 +914,39 @@ DROP FUNCTION func_sidef_1; Invoking procedure proc_1 invoking unsafe INSERT DELAYED statement. CREATE PROCEDURE proc_1() BEGIN INSERT DELAYED INTO t0 VALUES (1), (2); INSERT INTO ta1 VALUES (47); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. CALL proc_1(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP FUNCTION func_sidef_2; Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement. CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. CALL proc_2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PROCEDURE proc_2; Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement. CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP TRIGGER trig_2; Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement. PREPARE prep_2 FROM "CALL proc_1()"; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PREPARE prep_2; @@ -978,49 +954,39 @@ DROP PROCEDURE proc_1; Invoking trigger trig_1 invoking unsafe INSERT DELAYED statement. CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO t0 VALUES (1), (2); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO trigger_table_1 VALUES (1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP FUNCTION func_sidef_2; Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement. CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. CALL proc_2(); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PROCEDURE proc_2; Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement. CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP TRIGGER trig_2; Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement. PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)"; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PREPARE prep_2; @@ -1028,19 +994,15 @@ DROP TRIGGER trig_1; Invoking prepared statement prep_1 invoking unsafe INSERT DELAYED statement. PREPARE prep_1 FROM "INSERT DELAYED INTO t0 VALUES (1), (2)"; -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. EXECUTE prep_1; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PREPARE prep_1; Invoking unsafe INSERT DELAYED statement. -* binlog_format = STATEMENT: expect 1 warnings. +* binlog_format = STATEMENT: expect 0 warnings. INSERT DELAYED INTO t0 VALUES (1), (2); -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1798,11 +1760,10 @@ SELECT COUNT(*) FROM mysql.general_log; Invoking function func_sidef_1 invoking statement that is unsafe in many ways. CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; RETURN 0; END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO t1 SELECT func_sidef_1(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1813,11 +1774,10 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc Invoking function func_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO t2 SELECT func_sidef_2(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1829,11 +1789,10 @@ DROP FUNCTION func_sidef_2; Invoking procedure proc_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. CALL proc_2(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1845,11 +1804,10 @@ DROP PROCEDURE proc_2; Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO trigger_table_2 VALUES (1); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1863,17 +1821,15 @@ Invoking view view_sidef_2 invoking function func_sidef_1 invoking statement tha CREATE VIEW view_sidef_2 AS SELECT func_sidef_1(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO t2 SELECT * FROM view_sidef_2; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1885,11 +1841,10 @@ DROP VIEW view_sidef_2; Invoking prepared statement prep_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()"; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. EXECUTE prep_2; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1902,11 +1857,10 @@ DROP FUNCTION func_sidef_1; Invoking procedure proc_1 invoking statement that is unsafe in many ways. CREATE PROCEDURE proc_1() BEGIN INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; INSERT INTO ta1 VALUES (47); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. CALL proc_1(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1917,11 +1871,10 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc Invoking function func_sidef_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO t2 SELECT func_sidef_2(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1933,11 +1886,10 @@ DROP FUNCTION func_sidef_2; Invoking procedure proc_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. CALL proc_2(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1949,11 +1901,10 @@ DROP PROCEDURE proc_2; Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO trigger_table_2 VALUES (1); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1965,11 +1916,10 @@ DROP TRIGGER trig_2; Invoking prepared statement prep_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. PREPARE prep_2 FROM "CALL proc_1()"; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. EXECUTE prep_2; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1982,11 +1932,10 @@ DROP PROCEDURE proc_1; Invoking trigger trig_1 invoking statement that is unsafe in many ways. CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO trigger_table_1 VALUES (1); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -1997,11 +1946,10 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc Invoking function func_sidef_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO t2 SELECT func_sidef_2(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -2013,11 +1961,10 @@ DROP FUNCTION func_sidef_2; Invoking procedure proc_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. CALL proc_2(); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -2029,11 +1976,10 @@ DROP PROCEDURE proc_2; Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT INTO trigger_table_2 VALUES (1); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -2045,11 +1991,10 @@ DROP TRIGGER trig_2; Invoking prepared statement prep_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)"; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. EXECUTE prep_2; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -2062,11 +2007,10 @@ DROP TRIGGER trig_1; Invoking prepared statement prep_1 invoking statement that is unsafe in many ways. PREPARE prep_1 FROM "INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1"; -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. EXECUTE prep_1; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -2077,11 +2021,10 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc DROP PREPARE prep_1; Invoking statement that is unsafe in many ways. -* binlog_format = STATEMENT: expect 7 warnings. +* binlog_format = STATEMENT: expect 6 warnings. INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave. @@ -2554,8 +2497,7 @@ func_limit() show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; INSERT DELAYED INTO t1 VALUES (1), (2) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test index ed42a2cdb19..abcdf08d7a7 100644 --- a/mysql-test/suite/binlog/t/binlog_unsafe.test +++ b/mysql-test/suite/binlog/t/binlog_unsafe.test @@ -179,13 +179,13 @@ while (`SELECT $unsafe_type < 9`) { } if (`SELECT $unsafe_type = 3`) { - --echo ==== Testing INSERT DELAYED unsafeness ==== + --echo ==== Testing INSERT DELAYED safeness after BUG#54579 is fixed ==== --let $desc_0= unsafe INSERT DELAYED statement --let $stmt_sidef_0= INSERT DELAYED INTO t0 VALUES (1), (2) --let $value_0= --let $sel_sidef_0= --let $sel_retval_0= - --let $CRC_ARG_expected_number_of_warnings= 1 + --let $CRC_ARG_expected_number_of_warnings= 0 } if (`SELECT $unsafe_type = 4`) { @@ -227,7 +227,7 @@ while (`SELECT $unsafe_type < 9`) { --let $value_0= --let $sel_sidef_0= --let $sel_retval_0= - --let $CRC_ARG_expected_number_of_warnings= 7 + --let $CRC_ARG_expected_number_of_warnings= 6 } if (`SELECT $unsafe_type = 8`) { diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result index a36b3a1a865..350c7ebd541 100644 --- a/mysql-test/suite/innodb/r/innodb-autoinc.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc.result @@ -1244,3 +1244,16 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1(c1 BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (18446744073709551615); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index ff325b454ad..14eb3f0a6a8 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -2549,6 +2549,76 @@ LOCK TABLES t1 READ; ALTER TABLE t1 COMMENT 'test'; UNLOCK TABLES; DROP TABLE t1; +# +# Bug#55656: mysqldump can be slower after bug #39653 fix +# +CREATE TABLE t1 (a INT , b INT, c INT, d INT, +KEY (b), PRIMARY KEY (a,b)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3); +EXPLAIN SELECT COUNT(*) FROM t1; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 4 +ref NULL +rows 3 +Extra Using index +DROP INDEX b ON t1; +CREATE INDEX b ON t1(a,b); +EXPLAIN SELECT COUNT(*) FROM t1; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 8 +ref NULL +rows 3 +Extra Using index +DROP INDEX b ON t1; +CREATE INDEX b ON t1(a,b,c); +EXPLAIN SELECT COUNT(*) FROM t1; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 13 +ref NULL +rows 3 +Extra Using index +DROP INDEX b ON t1; +CREATE INDEX b ON t1(a,b,c,d); +EXPLAIN SELECT COUNT(*) FROM t1; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key PRIMARY +key_len 8 +ref NULL +rows 3 +Extra Using index +DROP TABLE t1; +# +# +# Bug#55826: create table .. select crashes with when KILL_BAD_DATA +# is returned +# +CREATE TABLE t1(a INT) ENGINE=innodb; +INSERT INTO t1 VALUES (0); +SET SQL_MODE='STRICT_ALL_TABLES'; +CREATE TABLE t2 +SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`; +ERROR 22007: Incorrect datetime value: '' for column 'NOW()' at row 2 +DROP TABLE t1; +SET SQL_MODE=DEFAULT; End of 5.1 tests # # Test for bug #39932 "create table fails if column for FK is in different @@ -2595,3 +2665,13 @@ COMMIT; COMMIT; DROP TABLE t1; DROP FUNCTION f1; +# +# Bug#54606 innodb fast alter table + pack_keys=0 +# prevents adding new indexes +# +CREATE TABLE t1 (a INT, b CHAR(9), c INT, key(b)) +ENGINE=InnoDB +PACK_KEYS=0; +CREATE INDEX a ON t1 (a); +CREATE INDEX c on t1 (c); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test index a8e853baef7..da0783bdc7c 100644 --- a/mysql-test/suite/innodb/t/innodb-autoinc.test +++ b/mysql-test/suite/innodb/t/innodb-autoinc.test @@ -665,7 +665,17 @@ SELECT * FROM t1; SHOW CREATE TABLE t1; DROP TABLE t1; - +## +# 55277: Failing assertion: auto_inc > 0 +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(c1 BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (18446744073709551615); +# Restart the server +-- source include/restart_mysqld.inc +SHOW CREATE TABLE t1; +DROP TABLE t1; # # restore environment to the state it was before this test execution # diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test index 2ff6971444e..8925f538c38 100644 --- a/mysql-test/suite/innodb/t/innodb_mysql.test +++ b/mysql-test/suite/innodb/t/innodb_mysql.test @@ -746,6 +746,45 @@ UNLOCK TABLES; DROP TABLE t1; +--echo # +--echo # Bug#55656: mysqldump can be slower after bug #39653 fix +--echo # + +CREATE TABLE t1 (a INT , b INT, c INT, d INT, + KEY (b), PRIMARY KEY (a,b)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3); +--query_vertical EXPLAIN SELECT COUNT(*) FROM t1 + +DROP INDEX b ON t1; +CREATE INDEX b ON t1(a,b); +--query_vertical EXPLAIN SELECT COUNT(*) FROM t1 + +DROP INDEX b ON t1; +CREATE INDEX b ON t1(a,b,c); +--query_vertical EXPLAIN SELECT COUNT(*) FROM t1 + +DROP INDEX b ON t1; +CREATE INDEX b ON t1(a,b,c,d); +--query_vertical EXPLAIN SELECT COUNT(*) FROM t1 + +DROP TABLE t1; + +--echo # + +--echo # +--echo # Bug#55826: create table .. select crashes with when KILL_BAD_DATA +--echo # is returned +--echo # + +CREATE TABLE t1(a INT) ENGINE=innodb; +INSERT INTO t1 VALUES (0); +SET SQL_MODE='STRICT_ALL_TABLES'; +--error ER_TRUNCATED_WRONG_VALUE +CREATE TABLE t2 + SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; + --echo End of 5.1 tests @@ -805,3 +844,16 @@ connection default; COMMIT; DROP TABLE t1; DROP FUNCTION f1; + +--echo # +--echo # Bug#54606 innodb fast alter table + pack_keys=0 +--echo # prevents adding new indexes +--echo # + +CREATE TABLE t1 (a INT, b CHAR(9), c INT, key(b)) + ENGINE=InnoDB + PACK_KEYS=0; +CREATE INDEX a ON t1 (a); +CREATE INDEX c on t1 (c); + +DROP TABLE t1; diff --git a/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result b/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result index 0699f8c4a59..e3792f8272d 100644 --- a/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result +++ b/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result @@ -193,4 +193,4 @@ mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) mysqld-bin.000001 # Write_rows 2 # table_id: # mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query 2 # COMMIT -mysqld-bin.000001 # Query 2 # use `test`; drop table t2 +mysqld-bin.000001 # Query 2 # use `test`; DROP TABLE `t2` /* generated by server */ diff --git a/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result b/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result index d018f67dd71..423b9f71ac6 100644 --- a/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result +++ b/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result @@ -7,5 +7,5 @@ create table t1 (a int primary key, b int) engine=ndb; insert into t1 values (1, 1); show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info -mysqld-bin.000001 # Query 1 # use `test`; drop table if exists t1 +mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ drop database mysqltest; diff --git a/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result b/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result index 0260d49f75f..ab952430d2d 100644 --- a/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result +++ b/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result @@ -47,8 +47,8 @@ mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) mysqld-bin.000001 # Write_rows 1 # table_id: # mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query 1 # COMMIT -mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table t1 -mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table t2 +mysqld-bin.000001 # Query 1 # use `mysqltest`; DROP TABLE `t1` /* generated by server */ +mysqld-bin.000001 # Query 1 # use `mysqltest`; DROP TABLE `t2` /* generated by server */ mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb mysqld-bin.000001 # Query 1 # BEGIN diff --git a/mysql-test/suite/ndb/r/ndb_binlog_multi.result b/mysql-test/suite/ndb/r/ndb_binlog_multi.result index e1af4aea092..3fbb2660eb6 100644 --- a/mysql-test/suite/ndb/r/ndb_binlog_multi.result +++ b/mysql-test/suite/ndb/r/ndb_binlog_multi.result @@ -37,7 +37,7 @@ mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) mysqld-bin.000001 # Write_rows 1 # table_id: # mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query 1 # COMMIT -mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE t2 +mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE `t2` /* generated by server */ SELECT inserts,updates,deletes,schemaops FROM mysql.ndb_binlog_index WHERE epoch=<the_epoch>; inserts updates deletes schemaops @@ -73,7 +73,7 @@ mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) mysqld-bin.000001 # Write_rows 2 # table_id: # mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F mysqld-bin.000001 # Query 2 # COMMIT -mysqld-bin.000001 # Query 2 # use `test`; drop table t1 +mysqld-bin.000001 # Query 2 # use `test`; DROP TABLE `t1` /* generated by server */ SELECT inserts,updates,deletes,schemaops FROM mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>; inserts updates deletes schemaops diff --git a/mysql-test/suite/parts/inc/partition_check_drop.inc b/mysql-test/suite/parts/inc/partition_check_drop.inc index daaa5e541c7..0941cd9703b 100644 --- a/mysql-test/suite/parts/inc/partition_check_drop.inc +++ b/mysql-test/suite/parts/inc/partition_check_drop.inc @@ -26,10 +26,12 @@ if ($do_file_tests) { let $ls_file= $MYSQLD_DATADIR/test/tmp2; # List the files belonging to the table t1 + --replace_result $MYSQLTEST_VARDIR \$MYSQLTEST_VARDIR #p# #P# #sp# #SP# --list_files_write_file $ls_file $MYSQLD_DATADIR/test t1* --chmod 0644 $ls_file if ($with_directories) { + --replace_result $MYSQLTEST_VARDIR \$MYSQLTEST_VARDIR #p# #P# #sp# #SP# --list_files_append_file $ls_file $MYSQLTEST_VARDIR/tmp t1* } eval SET @aux = load_file('$ls_file'); @@ -60,16 +62,15 @@ if ($found_garbage) --echo # <alter partitioning> worked incomplete. --echo # We found: # Print the list of files into the protocol - eval SELECT REPLACE(file_list,'$MYSQLTEST_VARDIR','\$MYSQLTEST_VARDIR') - AS "unified filelist" + eval SELECT file_list AS "unified filelist" FROM t0_definition WHERE state = 'old'; } # Do a manual cleanup, because the following tests should not suffer from # remaining files - --exec rm -f $MYSQLD_DATADIR/test/t1* || true + --remove_files_wildcard $MYSQLD_DATADIR/test t1* if ($with_directories) { - --exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true + --remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1* } } --enable_query_log diff --git a/mysql-test/suite/parts/inc/partition_crash.inc b/mysql-test/suite/parts/inc/partition_crash.inc index f18b8728784..b8a7c61792b 100644 --- a/mysql-test/suite/parts/inc/partition_crash.inc +++ b/mysql-test/suite/parts/inc/partition_crash.inc @@ -3,7 +3,7 @@ --eval $create_statement --eval $insert_statement --echo # State before crash ---replace_result #p# #P# +--replace_result #p# #P# #sp# #SP# --list_files $DATADIR/test SHOW CREATE TABLE t1; --sorted_result @@ -14,13 +14,13 @@ SELECT * FROM t1; --error 2013 --eval $crash_statement --echo # State after crash (before recovery) ---replace_regex /sqlx.*\./sqlx-nnnn_nnnn./ /#p#/#P#/ +--replace_regex /sqlx.*\./sqlx-nnnn_nnnn./ /#p#/#P#/ /#sp#/#SP#/ /#tmp#/#TMP#/ --list_files $DATADIR/test --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc --echo # State after crash recovery ---replace_result #p# #P# +--replace_result #p# #P# #sp# #SP# --list_files $DATADIR/test SHOW CREATE TABLE t1; --sorted_result diff --git a/mysql-test/suite/parts/inc/partition_fail.inc b/mysql-test/suite/parts/inc/partition_fail.inc index 6942b40042a..2c154a90499 100644 --- a/mysql-test/suite/parts/inc/partition_fail.inc +++ b/mysql-test/suite/parts/inc/partition_fail.inc @@ -3,6 +3,7 @@ --eval $create_statement --eval $insert_statement --echo # State before failure +--replace_result #p# #P# #sp# #SP# --list_files $DATADIR/test SHOW CREATE TABLE t1; --sorted_result @@ -11,6 +12,7 @@ SELECT * FROM t1; --eval $fail_statement --enable_abort_on_error --echo # State after failure +--replace_result #p# #P# #sp# #SP# --list_files $DATADIR/test SHOW CREATE TABLE t1; --sorted_result diff --git a/mysql-test/suite/parts/inc/partition_layout.inc b/mysql-test/suite/parts/inc/partition_layout.inc index 67d0fd4c0e9..12fbfb9a46a 100644 --- a/mysql-test/suite/parts/inc/partition_layout.inc +++ b/mysql-test/suite/parts/inc/partition_layout.inc @@ -10,6 +10,6 @@ eval SHOW CREATE TABLE t1; if ($ls) { let $MYSQLD_DATADIR= `select @@datadir`; - --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR + --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR #p# #P# #sp# #SP# --list_files $MYSQLD_DATADIR/test t1* } diff --git a/mysql-test/suite/parts/inc/partition_layout_check1.inc b/mysql-test/suite/parts/inc/partition_layout_check1.inc index bca41b6f9c7..1b0b24f1088 100644 --- a/mysql-test/suite/parts/inc/partition_layout_check1.inc +++ b/mysql-test/suite/parts/inc/partition_layout_check1.inc @@ -69,7 +69,7 @@ if ($do_file_tests) if ($ls) { # Print the list of files into the protocol - replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR; + replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR #p# #P# #sp# #SP# part_n part_N; SELECT file_list AS "unified filelist" FROM t0_definition WHERE state = 'old'; } diff --git a/mysql-test/suite/parts/inc/partition_layout_check2.inc b/mysql-test/suite/parts/inc/partition_layout_check2.inc index 7ff871a4c45..b1ec56ceedd 100644 --- a/mysql-test/suite/parts/inc/partition_layout_check2.inc +++ b/mysql-test/suite/parts/inc/partition_layout_check2.inc @@ -65,7 +65,7 @@ let $run= `SELECT @aux`; if ($run) { --vertical_results - --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR #p# #P# #sp# #SP# SELECT state, REPLACE(create_command,'\n',' ') AS "Table definition", REPLACE(file_list ,'\n',' ') AS "File list" diff --git a/mysql-test/suite/parts/r/partition_alter3_innodb.result b/mysql-test/suite/parts/r/partition_alter3_innodb.result index dc6008842a3..c5750e007e6 100644 --- a/mysql-test/suite/parts/r/partition_alter3_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter3_innodb.result @@ -148,7 +148,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -176,7 +176,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -209,7 +209,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -252,7 +252,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -280,7 +280,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -306,7 +306,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -330,7 +330,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -352,7 +352,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -372,7 +372,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -505,7 +505,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -533,7 +533,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -569,7 +569,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -610,7 +610,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -641,7 +641,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 3 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -670,7 +670,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 23 Using where +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 10 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -697,7 +697,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -722,7 +722,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -745,7 +745,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 diff --git a/mysql-test/suite/parts/r/partition_alter3_myisam.result b/mysql-test/suite/parts/r/partition_alter3_myisam.result index 374b108b57e..a5dec48e85c 100644 --- a/mysql-test/suite/parts/r/partition_alter3_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter3_myisam.result @@ -155,7 +155,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -187,7 +187,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -228,7 +228,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -278,7 +278,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -312,7 +312,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -343,7 +343,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -371,7 +371,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -396,7 +396,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -418,7 +418,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -552,7 +552,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -584,7 +584,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -628,7 +628,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -676,7 +676,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -713,7 +713,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 3 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -747,7 +747,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 10 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -778,7 +778,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -806,7 +806,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -831,7 +831,7 @@ t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 diff --git a/mysql-test/suite/parts/r/partition_recover_myisam.result b/mysql-test/suite/parts/r/partition_recover_myisam.result index f4cdc2a418a..3c73817ef2e 100644 --- a/mysql-test/suite/parts/r/partition_recover_myisam.result +++ b/mysql-test/suite/parts/r/partition_recover_myisam.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("./test/t1_will_crash"); +call mtr.add_suppression("t1_will_crash"); call mtr.add_suppression("Got an error from unknown thread"); CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM; INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11); diff --git a/mysql-test/suite/parts/r/partition_special_innodb.result b/mysql-test/suite/parts/r/partition_special_innodb.result index b8dffd61fbe..0738f45b012 100644 --- a/mysql-test/suite/parts/r/partition_special_innodb.result +++ b/mysql-test/suite/parts/r/partition_special_innodb.result @@ -242,7 +242,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check Error Lock wait timeout exceeded; try restarting transaction -test.t1 check error Corrupt +test.t1 check status Operation failed UNLOCK TABLES; DROP TABLE t1; CREATE TABLE t2 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT ) diff --git a/mysql-test/suite/parts/r/partition_special_myisam.result b/mysql-test/suite/parts/r/partition_special_myisam.result index f8618fcbb6d..bc8036ba861 100644 --- a/mysql-test/suite/parts/r/partition_special_myisam.result +++ b/mysql-test/suite/parts/r/partition_special_myisam.result @@ -214,7 +214,7 @@ SET lock_wait_timeout = 2; ALTER TABLE t1 COALESCE PARTITION 2; ERROR HY000: Lock wait timeout exceeded; try restarting transaction # Connection 3 tries to load into the table: -LOAD DATA LOCAL INFILE '/tmp/load.in' INTO TABLE t1 (f); +LOAD DATA INFILE 'load.in' INTO TABLE t1 (f); # Connection 1 commits the transaction COMMIT; # Connection 3... diff --git a/mysql-test/suite/parts/t/part_supported_sql_func_innodb.test b/mysql-test/suite/parts/t/part_supported_sql_func_innodb.test index e8d263e369c..002da3c8f37 100644 --- a/mysql-test/suite/parts/t/part_supported_sql_func_innodb.test +++ b/mysql-test/suite/parts/t/part_supported_sql_func_innodb.test @@ -28,6 +28,9 @@ let $do_long_tests= 1; # The server must support partitioning. --source include/have_partition.inc +# This test takes long time, so only run it with the --big mtr-flag. +--source include/big_test.inc + #------------------------------------------------------------------------------# # Engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_alter1_1_2_innodb.test b/mysql-test/suite/parts/t/partition_alter1_1_2_innodb.test index 8e3dde286cf..6ac1803a972 100644 --- a/mysql-test/suite/parts/t/partition_alter1_1_2_innodb.test +++ b/mysql-test/suite/parts/t/partition_alter1_1_2_innodb.test @@ -46,6 +46,9 @@ let $more_pk_ui_tests= 0; # The server must support partitioning. --source include/have_partition.inc +# This test takes long time, so only run it with the --big mtr-flag. +--source include/big_test.inc + #------------------------------------------------------------------------------# # Engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_alter1_2_innodb.test b/mysql-test/suite/parts/t/partition_alter1_2_innodb.test index 76fe7eb0223..2cbe0ab77ab 100644 --- a/mysql-test/suite/parts/t/partition_alter1_2_innodb.test +++ b/mysql-test/suite/parts/t/partition_alter1_2_innodb.test @@ -46,6 +46,9 @@ let $more_pk_ui_tests= 0; # The server must support partitioning. --source include/have_partition.inc +# This test takes long time, so only run it with the --big mtr-flag. +--source include/big_test.inc + #------------------------------------------------------------------------------# # Engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_alter2_1_1_innodb.test b/mysql-test/suite/parts/t/partition_alter2_1_1_innodb.test index 9500f05b173..37e1cb4a099 100644 --- a/mysql-test/suite/parts/t/partition_alter2_1_1_innodb.test +++ b/mysql-test/suite/parts/t/partition_alter2_1_1_innodb.test @@ -45,6 +45,9 @@ let $only_part_1= 1; # The server must support partitioning. --source include/have_partition.inc +# This test takes long time, so only run it with the --big mtr-flag. +--source include/big_test.inc + #------------------------------------------------------------------------------# # Engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_alter2_1_2_innodb.test b/mysql-test/suite/parts/t/partition_alter2_1_2_innodb.test index 28bbcb3115b..6448a8ac734 100644 --- a/mysql-test/suite/parts/t/partition_alter2_1_2_innodb.test +++ b/mysql-test/suite/parts/t/partition_alter2_1_2_innodb.test @@ -45,6 +45,9 @@ let $only_part_2= 1; # The server must support partitioning. --source include/have_partition.inc +# This test takes long time, so only run it with the --big mtr-flag. +--source include/big_test.inc + #------------------------------------------------------------------------------# # Engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_alter2_2_2_innodb.test b/mysql-test/suite/parts/t/partition_alter2_2_2_innodb.test index a356b4e31a3..e3544c382a3 100644 --- a/mysql-test/suite/parts/t/partition_alter2_2_2_innodb.test +++ b/mysql-test/suite/parts/t/partition_alter2_2_2_innodb.test @@ -45,6 +45,9 @@ let $only_part_2= 1; # The server must support partitioning. --source include/have_partition.inc +# This test takes long time, so only run it with the --big mtr-flag. +--source include/big_test.inc + #------------------------------------------------------------------------------# # Engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_alter4_innodb.test b/mysql-test/suite/parts/t/partition_alter4_innodb.test index 3061e5c9e7f..1e28a2fc812 100644 --- a/mysql-test/suite/parts/t/partition_alter4_innodb.test +++ b/mysql-test/suite/parts/t/partition_alter4_innodb.test @@ -43,6 +43,9 @@ let $more_pk_ui_tests= 0; # The server must support partitioning. --source include/have_partition.inc +# This test takes long time, so only run it with the --big mtr-flag. +--source include/big_test.inc + #------------------------------------------------------------------------------# # Engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test index 915a3f2ceb6..fce26132030 100644 --- a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test +++ b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test @@ -56,6 +56,7 @@ partition by range (a) insert into t1 values (1), (11), (21), (33); SELECT * FROM t1; SHOW CREATE TABLE t1; +--replace_result #p# #P# #sp# #SP# --list_files $MYSQLD_DATADIR/test SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open'; @@ -78,6 +79,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO disconnect con1; connection default; --reap +--replace_result #p# #P# #sp# #SP# --list_files $MYSQLD_DATADIR/test SHOW CREATE TABLE t1; SELECT * FROM t1; diff --git a/mysql-test/suite/parts/t/partition_recover_myisam.test b/mysql-test/suite/parts/t/partition_recover_myisam.test index d06e1914949..ecc83629768 100644 --- a/mysql-test/suite/parts/t/partition_recover_myisam.test +++ b/mysql-test/suite/parts/t/partition_recover_myisam.test @@ -1,6 +1,6 @@ # test the auto-recover (--myisam-recover) of partitioned myisam tables -call mtr.add_suppression("./test/t1_will_crash"); +call mtr.add_suppression("t1_will_crash"); call mtr.add_suppression("Got an error from unknown thread"); --source include/have_partition.inc diff --git a/mysql-test/suite/parts/t/partition_special_myisam.test b/mysql-test/suite/parts/t/partition_special_myisam.test index 032722cbb7d..2eac5b3bf16 100644 --- a/mysql-test/suite/parts/t/partition_special_myisam.test +++ b/mysql-test/suite/parts/t/partition_special_myisam.test @@ -62,13 +62,14 @@ ALTER TABLE t1 COALESCE PARTITION 2; --connect (con3,localhost,root,,) -perl; -open( LD, ">" . "/tmp/load.in" ) || die "Could not open file for writing " . $ENV{'MYSQLTEST_DATADIR'} . "/test/load.in"; -print LD "1\n2\n3\n"; -close( LD ); +--let $MYSQLD_DATADIR= `SELECT @@datadir` +--write_file $MYSQLD_DATADIR/test/load.in +1 +2 +3 EOF --echo # Connection 3 tries to load into the table: -send LOAD DATA LOCAL INFILE '/tmp/load.in' INTO TABLE t1 (f); +send LOAD DATA INFILE 'load.in' INTO TABLE t1 (f); --connection default --real_sleep 1 diff --git a/mysql-test/suite/perfschema/include/upgrade_check.inc b/mysql-test/suite/perfschema/include/upgrade_check.inc index 935a71ab065..3620e80002f 100644 --- a/mysql-test/suite/perfschema/include/upgrade_check.inc +++ b/mysql-test/suite/perfschema/include/upgrade_check.inc @@ -18,7 +18,7 @@ # --error 1 ---exec $MYSQL_UPGRADE --skip-verbose > $out_file 2> $err_file +--exec $MYSQL_UPGRADE --skip-verbose --force > $out_file 2> $err_file # Verify that mysql_upgrade complained about the performance_schema --cat_file $err_file diff --git a/mysql-test/suite/perfschema/r/bad_option_3.result b/mysql-test/suite/perfschema/r/bad_option_3.result new file mode 100644 index 00000000000..ec717d6f7d2 --- /dev/null +++ b/mysql-test/suite/perfschema/r/bad_option_3.result @@ -0,0 +1,2 @@ +Found: unknown option '-x' +Found: Aborting diff --git a/mysql-test/suite/perfschema/r/bad_option_4.result b/mysql-test/suite/perfschema/r/bad_option_4.result new file mode 100644 index 00000000000..812ee546200 --- /dev/null +++ b/mysql-test/suite/perfschema/r/bad_option_4.result @@ -0,0 +1,2 @@ +Found: Can't change dir to.*bad_option_h_param +Found: Aborting diff --git a/mysql-test/suite/perfschema/r/bad_option_5.result b/mysql-test/suite/perfschema/r/bad_option_5.result new file mode 100644 index 00000000000..b318b6e0482 --- /dev/null +++ b/mysql-test/suite/perfschema/r/bad_option_5.result @@ -0,0 +1,2 @@ +Found: unknown option '-X' +Found: Aborting diff --git a/mysql-test/suite/perfschema/r/checksum.result b/mysql-test/suite/perfschema/r/checksum.result new file mode 100644 index 00000000000..323cb303dae --- /dev/null +++ b/mysql-test/suite/perfschema/r/checksum.result @@ -0,0 +1,34 @@ +checksum table performance_schema.COND_INSTANCES; +checksum table performance_schema.EVENTS_WAITS_CURRENT; +checksum table performance_schema.EVENTS_WAITS_HISTORY; +checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; +checksum table performance_schema.FILE_INSTANCES; +checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE; +checksum table performance_schema.MUTEX_INSTANCES; +checksum table performance_schema.PERFORMANCE_TIMERS; +checksum table performance_schema.RWLOCK_INSTANCES; +checksum table performance_schema.SETUP_CONSUMERS; +checksum table performance_schema.SETUP_INSTRUMENTS; +checksum table performance_schema.SETUP_TIMERS; +checksum table performance_schema.THREADS; +checksum table performance_schema.COND_INSTANCES extended; +checksum table performance_schema.EVENTS_WAITS_CURRENT extended; +checksum table performance_schema.EVENTS_WAITS_HISTORY extended; +checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG extended; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE extended; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME extended; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME extended; +checksum table performance_schema.FILE_INSTANCES extended; +checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME extended; +checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE extended; +checksum table performance_schema.MUTEX_INSTANCES extended; +checksum table performance_schema.PERFORMANCE_TIMERS extended; +checksum table performance_schema.RWLOCK_INSTANCES extended; +checksum table performance_schema.SETUP_CONSUMERS extended; +checksum table performance_schema.SETUP_INSTRUMENTS extended; +checksum table performance_schema.SETUP_TIMERS extended; +checksum table performance_schema.THREADS extended; diff --git a/mysql-test/suite/perfschema/r/server_init.result b/mysql-test/suite/perfschema/r/server_init.result index 5f3b071484d..0c1e06d157c 100644 --- a/mysql-test/suite/perfschema/r/server_init.result +++ b/mysql-test/suite/perfschema/r/server_init.result @@ -116,18 +116,10 @@ where name like "wait/synch/mutex/sql/LOCK_rpl_status"; count(name) 1 select count(name) from MUTEX_INSTANCES -where name like "wait/synch/mutex/sql/LOG_INFO::lock"; -count(name) -1 -select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex"; count(name) 1 select count(name) from MUTEX_INSTANCES -where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state"; -count(name) -1 -select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_event_metadata"; count(name) 1 @@ -144,15 +136,15 @@ where name like "wait/synch/mutex/sql/Cversion_lock"; count(name) 1 select count(name) from MUTEX_INSTANCES -where name like "wait/synch/mutex/sql/LOCK_xid_cache"; +where name like "wait/synch/mutex/sql/LOCK_audit_mask"; count(name) 1 select count(name) from MUTEX_INSTANCES -where name like "wait/synch/mutex/sql/LOCK_plugin"; +where name like "wait/synch/mutex/sql/LOCK_xid_cache"; count(name) 1 select count(name) from MUTEX_INSTANCES -where name like "wait/synch/mutex/sql/LOCK_gdl"; +where name like "wait/synch/mutex/sql/LOCK_plugin"; count(name) 1 select count(name) from MUTEX_INSTANCES @@ -212,10 +204,6 @@ where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed"; count(name) 1 select count(name) from COND_INSTANCES -where name like "wait/synch/cond/sql/Event_scheduler::COND_state"; -count(name) -1 -select count(name) from COND_INSTANCES where name like "wait/synch/cond/sql/COND_queue_state"; count(name) 1 diff --git a/mysql-test/suite/perfschema/r/short_option_1.result b/mysql-test/suite/perfschema/r/short_option_1.result new file mode 100644 index 00000000000..ad48fe05ad9 --- /dev/null +++ b/mysql-test/suite/perfschema/r/short_option_1.result @@ -0,0 +1,27 @@ +select 'Ok, the server started' as result; +result +Ok, the server started +select @@SQL_MODE; +@@SQL_MODE +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI +show variables like 'sql_mode'; +Variable_name Value +sql_mode REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI +select @@character_set_server; +@@character_set_server +utf8 +show variables like 'character_set_system'; +Variable_name Value +character_set_system utf8 +show variables like 'log'; +Variable_name Value +log ON +show variables like 'general_log'; +Variable_name Value +general_log ON +show variables like 'new'; +Variable_name Value +new ON +show variables like 'log_warnings'; +Variable_name Value +log_warnings 3 diff --git a/mysql-test/suite/perfschema/r/short_option_2.result b/mysql-test/suite/perfschema/r/short_option_2.result new file mode 100644 index 00000000000..0587fdef73b --- /dev/null +++ b/mysql-test/suite/perfschema/r/short_option_2.result @@ -0,0 +1,9 @@ +select 'Ok, the server started' as result; +result +Ok, the server started +select @@SQL_MODE; +@@SQL_MODE +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI +select @@log_warnings; +@@log_warnings +5 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result index 48891adce73..d03e227fc83 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000 -performance_schema_max_rwlock_classes 20 -performance_schema_max_rwlock_instances 1000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_mutex_instances 10000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result index cb1d64bf1e7..812dc329aaf 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000 -performance_schema_max_rwlock_classes 20 -performance_schema_max_rwlock_instances 1000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_mutex_instances 10000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result index 3856d241d73..7ef247e0755 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 0 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000 -performance_schema_max_rwlock_classes 20 -performance_schema_max_rwlock_instances 1000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_mutex_instances 10000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result index e52f04cbae7..301c4e44f1e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 0 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000 -performance_schema_max_rwlock_classes 20 -performance_schema_max_rwlock_instances 1000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_mutex_instances 10000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result index aab39dfb619..a1f880d3b9e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 0 -performance_schema_max_mutex_instances 1000 -performance_schema_max_rwlock_classes 20 -performance_schema_max_rwlock_instances 1000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_mutex_instances 10000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result index 0665058a469..ab566f0703a 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result @@ -46,10 +46,10 @@ performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 performance_schema_max_mutex_instances 0 -performance_schema_max_rwlock_classes 20 -performance_schema_max_rwlock_instances 1000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result index 721f9957b1e..aabc9ec49bb 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000 +performance_schema_max_mutex_instances 10000 performance_schema_max_rwlock_classes 0 -performance_schema_max_rwlock_instances 1000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result index 63398bce1f5..5e5998a9959 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result @@ -45,18 +45,18 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000 -performance_schema_max_rwlock_classes 20 +performance_schema_max_mutex_instances 10000 +performance_schema_max_rwlock_classes 30 performance_schema_max_rwlock_instances 0 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; show status like "performance_schema%"; show variables like "performance_schema_max_rwlock_classes"; Variable_name Value -performance_schema_max_rwlock_classes 20 +performance_schema_max_rwlock_classes 30 select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS where name like "wait/synch/rwlock/%"; count(*) > 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result index 006f0fc6002..96c3cae97ab 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000 -performance_schema_max_rwlock_classes 20 -performance_schema_max_rwlock_instances 1000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_mutex_instances 10000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 0 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result index e0377e10583..e2cf0917cbf 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000 -performance_schema_max_rwlock_classes 20 -performance_schema_max_rwlock_instances 1000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_mutex_instances 10000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 0 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result index 5f72cb4eba1..8bf52580e77 100644 --- a/mysql-test/suite/perfschema/r/start_server_off.result +++ b/mysql-test/suite/perfschema/r/start_server_off.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000 -performance_schema_max_rwlock_classes 20 -performance_schema_max_rwlock_instances 1000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_mutex_instances 10000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result index 2639fb8e540..15fe4e082ab 100644 --- a/mysql-test/suite/perfschema/r/start_server_on.result +++ b/mysql-test/suite/perfschema/r/start_server_on.result @@ -45,11 +45,11 @@ performance_schema_max_file_classes 50 performance_schema_max_file_handles 32768 performance_schema_max_file_instances 10000 performance_schema_max_mutex_classes 200 -performance_schema_max_mutex_instances 1000 -performance_schema_max_rwlock_classes 20 -performance_schema_max_rwlock_instances 1000 -performance_schema_max_table_handles 100000 -performance_schema_max_table_instances 50000 +performance_schema_max_mutex_instances 10000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 10000 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 performance_schema_max_thread_classes 50 performance_schema_max_thread_instances 1000 show engine PERFORMANCE_SCHEMA status; diff --git a/mysql-test/suite/perfschema/t/bad_option_3.test b/mysql-test/suite/perfschema/t/bad_option_3.test new file mode 100644 index 00000000000..1a9efb61fdf --- /dev/null +++ b/mysql-test/suite/perfschema/t/bad_option_3.test @@ -0,0 +1,49 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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; version 2 of the License. +# +# 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, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA + +# Tests for PERFORMANCE_SCHEMA +# Check error handling for invalid server start options + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_3.txt; +--error 0,1 +--remove_file $outfile +--error 2 +--exec $MYSQLD_BOOTSTRAP_CMD --loose-console -a -x > $outfile 2>&1 + +perl; + use strict; + use warnings; + my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_3.txt"; + open(FILE, "<", $fname) or die; + my @lines= <FILE>; + # those must be in the file for the test to pass + my @patterns= + ("unknown option '-x'", + "Aborting"); + foreach my $one_line (@lines) + { + foreach my $one_pattern (@patterns) + { + # print pattern, not line, to get a stable output + print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/); + } + } + close FILE; +EOF +--remove_file $outfile + diff --git a/mysql-test/suite/perfschema/t/bad_option_4.test b/mysql-test/suite/perfschema/t/bad_option_4.test new file mode 100644 index 00000000000..c13df1b614d --- /dev/null +++ b/mysql-test/suite/perfschema/t/bad_option_4.test @@ -0,0 +1,49 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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; version 2 of the License. +# +# 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, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA + +# Tests for PERFORMANCE_SCHEMA +# Check error handling for invalid server start options + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_4.txt; +--error 0,1 +--remove_file $outfile +--error 1 +--exec $MYSQLD_BOOTSTRAP_CMD --loose-console -a -h bad_option_h_param > $outfile 2>&1 + +perl; + use strict; + use warnings; + my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_4.txt"; + open(FILE, "<", $fname) or die; + my @lines= <FILE>; + # those must be in the file for the test to pass + my @patterns= + ("Can't change dir to.*bad_option_h_param", + "Aborting"); + foreach my $one_line (@lines) + { + foreach my $one_pattern (@patterns) + { + # print pattern, not line, to get a stable output + print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/); + } + } + close FILE; +EOF +--remove_file $outfile + diff --git a/mysql-test/suite/perfschema/t/bad_option_5.test b/mysql-test/suite/perfschema/t/bad_option_5.test new file mode 100644 index 00000000000..d0ae1370859 --- /dev/null +++ b/mysql-test/suite/perfschema/t/bad_option_5.test @@ -0,0 +1,52 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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; version 2 of the License. +# +# 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, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA + +# Tests for PERFORMANCE_SCHEMA +# Check error handling for invalid server start options + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_5.txt; +--error 0,1 +--remove_file $outfile +--error 2 +--exec $MYSQLD_BOOTSTRAP_CMD --loose-console -aXbroken > $outfile 2>&1 + +# -aXbroken should be parsed as -a -Xbroken, or --ansi -Xbroken, +# therefore the -X option is what the server should complain about + +perl; + use strict; + use warnings; + my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_5.txt"; + open(FILE, "<", $fname) or die; + my @lines= <FILE>; + # those must be in the file for the test to pass + my @patterns= + ("unknown option '-X'", + "Aborting"); + foreach my $one_line (@lines) + { + foreach my $one_pattern (@patterns) + { + # print pattern, not line, to get a stable output + print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/); + } + } + close FILE; +EOF +--remove_file $outfile + diff --git a/mysql-test/suite/perfschema/t/checksum.test b/mysql-test/suite/perfschema/t/checksum.test new file mode 100644 index 00000000000..d7fdd7b4c2c --- /dev/null +++ b/mysql-test/suite/perfschema/t/checksum.test @@ -0,0 +1,64 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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; version 2 of the License. +# +# 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, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# +# The checksum value itself is random (data is volatile), +# just testing that this does not crash +# +--disable_result_log + +checksum table performance_schema.COND_INSTANCES; +checksum table performance_schema.EVENTS_WAITS_CURRENT; +checksum table performance_schema.EVENTS_WAITS_HISTORY; +checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME; +checksum table performance_schema.FILE_INSTANCES; +checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME; +checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE; +checksum table performance_schema.MUTEX_INSTANCES; +checksum table performance_schema.PERFORMANCE_TIMERS; +checksum table performance_schema.RWLOCK_INSTANCES; +checksum table performance_schema.SETUP_CONSUMERS; +checksum table performance_schema.SETUP_INSTRUMENTS; +checksum table performance_schema.SETUP_TIMERS; +checksum table performance_schema.THREADS; + +checksum table performance_schema.COND_INSTANCES extended; +checksum table performance_schema.EVENTS_WAITS_CURRENT extended; +checksum table performance_schema.EVENTS_WAITS_HISTORY extended; +checksum table performance_schema.EVENTS_WAITS_HISTORY_LONG extended; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE extended; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME extended; +checksum table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME extended; +checksum table performance_schema.FILE_INSTANCES extended; +checksum table performance_schema.FILE_SUMMARY_BY_EVENT_NAME extended; +checksum table performance_schema.FILE_SUMMARY_BY_INSTANCE extended; +checksum table performance_schema.MUTEX_INSTANCES extended; +checksum table performance_schema.PERFORMANCE_TIMERS extended; +checksum table performance_schema.RWLOCK_INSTANCES extended; +checksum table performance_schema.SETUP_CONSUMERS extended; +checksum table performance_schema.SETUP_INSTRUMENTS extended; +checksum table performance_schema.SETUP_TIMERS extended; +checksum table performance_schema.THREADS extended; + +--enable_result_log + diff --git a/mysql-test/suite/perfschema/t/server_init.test b/mysql-test/suite/perfschema/t/server_init.test index 2e19d2c843a..cc461374a79 100644 --- a/mysql-test/suite/perfschema/t/server_init.test +++ b/mysql-test/suite/perfschema/t/server_init.test @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -10,8 +10,8 @@ # 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 +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA # Tests for PERFORMANCE_SCHEMA @@ -43,10 +43,6 @@ select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/mysys/THR_LOCK_myisam_log"; - select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/mysys/THR_LOCK_heap"; @@ -83,11 +79,6 @@ select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_delayed_insert"; -# Named LOCK_uuid_short in 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/LOCK_uuid_short"; - -# Named LOCK_uuid_generator in 5.5, LOCK_uuid_short in 6.0 select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_uuid_generator"; @@ -130,14 +121,16 @@ select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_rpl_status"; -select count(name) from MUTEX_INSTANCES - where name like "wait/synch/mutex/sql/LOG_INFO::lock"; +# LOG_INFO object are created on demand, and are not global. +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/LOG_INFO::lock"; select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex"; -select count(name) from MUTEX_INSTANCES - where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state"; +# The event scheduler may be disabled +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state"; select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_event_metadata"; @@ -148,16 +141,11 @@ select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_user_locks"; -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/LOCK_mdl"; - select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/Cversion_lock"; -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/LOCK_audit_mask"; +select count(name) from MUTEX_INSTANCES + where name like "wait/synch/mutex/sql/LOCK_audit_mask"; select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_xid_cache"; @@ -165,28 +153,13 @@ select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_plugin"; -select count(name) from MUTEX_INSTANCES - where name like "wait/synch/mutex/sql/LOCK_gdl"; +# Not a global variable, may be destroyed already. +# select count(name) from MUTEX_INSTANCES +# where name like "wait/synch/mutex/sql/LOCK_gdl"; select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/tz_LOCK"; -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/slave_start"; - -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML"; - -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML_active"; - -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from MUTEX_INSTANCES -# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML_get"; - # Verify that these global rwlocks have been properly initilized in sql select count(name) from RWLOCK_INSTANCES @@ -230,25 +203,10 @@ select count(name) from COND_INSTANCES select count(name) from COND_INSTANCES where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed"; -select count(name) from COND_INSTANCES - where name like "wait/synch/cond/sql/Event_scheduler::COND_state"; +# The event scheduler may be disabled +# select count(name) from COND_INSTANCES +# where name like "wait/synch/cond/sql/Event_scheduler::COND_state"; select count(name) from COND_INSTANCES where name like "wait/synch/cond/sql/COND_queue_state"; -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from COND_INSTANCES -# where name like "wait/synch/cond/sql/COND_mdl"; - -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from COND_INSTANCES -# where name like "wait/synch/cond/sql/BML_class::COND_BML"; - -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from COND_INSTANCES -# where name like "wait/synch/cond/sql/BML_class::COND_BML_registered"; - -# Does not exist in mysql 5.5, 6.0 only -# select count(name) from COND_INSTANCES -# where name like "wait/synch/cond/sql/BML_class::COND_BML_release"; - diff --git a/mysql-test/suite/perfschema/t/short_option_1-master.opt b/mysql-test/suite/perfschema/t/short_option_1-master.opt new file mode 100644 index 00000000000..6a6e8d4c5ca --- /dev/null +++ b/mysql-test/suite/perfschema/t/short_option_1-master.opt @@ -0,0 +1 @@ +-a -n -Cutf8 --collation=utf8_bin -l -T12 -W3 diff --git a/mysql-test/suite/perfschema/t/short_option_1.test b/mysql-test/suite/perfschema/t/short_option_1.test new file mode 100644 index 00000000000..1d3e0835188 --- /dev/null +++ b/mysql-test/suite/perfschema/t/short_option_1.test @@ -0,0 +1,35 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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; version 2 of the License. +# +# 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, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA + +# Tests for PERFORMANCE_SCHEMA +# Check server start for short server start options + +select 'Ok, the server started' as result; + +# See the associated -master.opt file. + +select @@SQL_MODE; +show variables like 'sql_mode'; + +select @@character_set_server; +show variables like 'character_set_system'; + +show variables like 'log'; +show variables like 'general_log'; + +show variables like 'new'; + +show variables like 'log_warnings'; + diff --git a/mysql-test/suite/perfschema/t/short_option_2-master.opt b/mysql-test/suite/perfschema/t/short_option_2-master.opt new file mode 100644 index 00000000000..5cf7590a1c8 --- /dev/null +++ b/mysql-test/suite/perfschema/t/short_option_2-master.opt @@ -0,0 +1 @@ +-aW5 diff --git a/mysql-test/suite/perfschema/t/short_option_2.test b/mysql-test/suite/perfschema/t/short_option_2.test new file mode 100644 index 00000000000..eb528dfcf72 --- /dev/null +++ b/mysql-test/suite/perfschema/t/short_option_2.test @@ -0,0 +1,29 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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; version 2 of the License. +# +# 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, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA + +# Tests for PERFORMANCE_SCHEMA +# Check server start for short server start options + +select 'Ok, the server started' as result; + +# See the associated -master.opt file. +# -aW5 should be parsed as -a -W5, which are two separate short options +# stuffed inside a single argv[i] argument. + +# Should contain ANSI, since we started the server with -a (stands for --ansi) +select @@SQL_MODE; + +# Should be 5, since we started the server with -W5 +select @@log_warnings; diff --git a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result index 1ed7e0116a2..94c4e31d584 100644 --- a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result +++ b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result @@ -150,14 +150,14 @@ show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO db1.t1 VALUES(20) -master-bin.000001 # Query # # SAVEPOINT has_comment +master-bin.000001 # Query # # SAVEPOINT `has_comment` master-bin.000001 # Query # # use `db1`; INSERT INTO db1.t1 VALUES(30) master-bin.000001 # Query # # use `db1`; INSERT INTO db1.t2 VALUES("in savepoint has_comment") -master-bin.000001 # Query # # SAVEPOINT mixed_cases +master-bin.000001 # Query # # SAVEPOINT `mixed_cases` master-bin.000001 # Query # # use `db1`; INSERT INTO db1.t2 VALUES("in savepoint mixed_cases") master-bin.000001 # Query # # use `db1`; INSERT INTO db1.t1 VALUES(40) -master-bin.000001 # Query # # ROLLBACK TO mixed_cases -master-bin.000001 # Query # # ROLLBACK TO has_comment +master-bin.000001 # Query # # ROLLBACK TO `mixed_cases` +master-bin.000001 # Query # # ROLLBACK TO `has_comment` master-bin.000001 # Query # # use `db1`; INSERT INTO db1.t2 VALUES("after rollback to") master-bin.000001 # Query # # use `db1`; INSERT INTO db1.t1 VALUES(50) master-bin.000001 # Xid # # COMMIT /* XID */ diff --git a/mysql-test/suite/rpl/r/rpl_flush_logs.result b/mysql-test/suite/rpl/r/rpl_flush_logs.result index 7f50ce0cdd0..4c3352559c4 100644 --- a/mysql-test/suite/rpl/r/rpl_flush_logs.result +++ b/mysql-test/suite/rpl/r/rpl_flush_logs.result @@ -4,12 +4,8 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -# Make sure the 'master_log.err-old' file does not -# exist before execute 'flush error logs' statement. # Test if support 'flush error logs' statement. flush error logs; -# Check the 'master_log.err-old' file is created -# after executed 'flush error logs' statement. # Make sure binary logs was not be flushed # after execute 'flush error logs' statement. # Make sure relay logs was not be flushed @@ -42,12 +38,8 @@ flush binary logs; # after executed 'flush binary logs' statement. # Make sure the 'slave-relay-bin.000007' file does not exist # exist before execute 'flush error logs, relay logs' statement. -# Make sure the 'master_log.err-old' file does not exist -# before execute 'flush error logs, relay logs' statement. # Test if support to combine all kinds of logs into one statement. flush error logs, relay logs; -# Check the 'master_log.err-old' file is created -# after executed 'flush error logs, relay logs' statement. # Make sure binary logs was not be flushed # after execute 'flush error logs, relay logs' statement. # Check the 'slave-relay-bin.000007' file is created after @@ -55,12 +47,8 @@ flush error logs, relay logs; # Make sure the 'slave-relay-bin.000008' and 'slave-relay-bin.000009' # files do not exist before execute 'flush error logs, relay logs' # statement. -# Make sure the 'master_log.err-old' file does not exist -# before execute 'flush logs' statement. # Test if 'flush logs' statement works fine and flush all the logs. flush logs; -# Check the 'master_log.err-old' file is created -# after executed 'flush logs' statement. # Check 'master-bin.000003' is created # after execute 'flush logs' statement. # Check the 'slave-relay-bin.000008' and 'slave-relay-bin.000009' diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index c1fd3396626..818a883a602 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -995,7 +995,7 @@ master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES (3, 'before master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES (5, 'before savepoint s2') -master-bin.000001 # Query # # SAVEPOINT s2 +master-bin.000001 # Query # # SAVEPOINT `s2` master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t1 VALUES (6, 'after savepoint s2') master-bin.000001 # Table_map # # table_id: # (test_rpl.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F diff --git a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result index 7024851d369..5e42ca3d6da 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result @@ -10260,9 +10260,9 @@ COMMIT; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 4) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B N T S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -10272,9 +10272,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VA master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 4) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B N T S1 T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -10312,9 +10312,9 @@ COMMIT; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T N S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -10324,9 +10324,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VA master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T N S1 T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -10364,9 +10364,9 @@ COMMIT; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 N T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -10376,9 +10376,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VA master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T S1 N T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -11346,20 +11346,20 @@ ROLLBACK; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 5) master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_12 (a int) engine=Innodb -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 T CT R1 R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 5) master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_12 (a int) engine=Innodb -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T S1 T CT R1 R << -e-e-e-e-e-e-e-e-e-e-e- diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result index 2db035d0ecf..1f62ea7b100 100644 --- a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result @@ -10628,9 +10628,9 @@ COMMIT; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 4) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B N T S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -10640,9 +10640,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VA master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 4) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B N T S1 T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -10681,9 +10681,9 @@ COMMIT; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T N S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -10694,9 +10694,9 @@ master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T N S1 T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -10735,9 +10735,9 @@ COMMIT; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 N T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -10748,9 +10748,9 @@ master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T S1 N T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -11718,20 +11718,20 @@ ROLLBACK; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 5) master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_12 (a int) engine=Innodb -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 T CT R1 R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 5) master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_12 (a int) engine=Innodb -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T S1 T CT R1 R << -e-e-e-e-e-e-e-e-e-e-e- diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result index 9467039a407..7390d5fd316 100644 --- a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result @@ -12240,10 +12240,10 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B N T S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -12255,10 +12255,10 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B N T S1 T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -12298,10 +12298,10 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T N S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -12313,10 +12313,10 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T N S1 T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -12356,10 +12356,10 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 N T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -12371,10 +12371,10 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T S1 N T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -13579,10 +13579,10 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 T CT R1 R << -b-b-b-b-b-b-b-b-b-b-b- @@ -13590,10 +13590,10 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T S1 T CT R1 R << -e-e-e-e-e-e-e-e-e-e-e- diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result index 993baeb32f0..213a50f97ac 100644 --- a/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result @@ -9878,9 +9878,9 @@ COMMIT; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 4) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B N T S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9890,9 +9890,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VA master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 4) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B N T S1 T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -9930,9 +9930,9 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 2) master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T N S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9940,9 +9940,9 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 2) master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T N S1 T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -9979,20 +9979,20 @@ COMMIT; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5) master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 N T R1 C << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5) master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T S1 N T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -10908,20 +10908,20 @@ ROLLBACK; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 5) master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_12 (a int) engine=Innodb -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 T CT R1 R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 5) master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_12 (a int) engine=Innodb -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T S1 T CT R1 R << -e-e-e-e-e-e-e-e-e-e-e- diff --git a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result index 9467039a407..7390d5fd316 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result @@ -12240,10 +12240,10 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B N T S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -12255,10 +12255,10 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B N T S1 T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -12298,10 +12298,10 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T N S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -12313,10 +12313,10 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T N S1 T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -12356,10 +12356,10 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 N T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -12371,10 +12371,10 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T S1 N T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -13579,10 +13579,10 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 T CT R1 R << -b-b-b-b-b-b-b-b-b-b-b- @@ -13590,10 +13590,10 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Table_map # # table_id: # (test.tt_1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T S1 T CT R1 R << -e-e-e-e-e-e-e-e-e-e-e- diff --git a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result index c71dd780138..c11f974ac2f 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result @@ -10010,9 +10010,9 @@ COMMIT; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 4) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B N T S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -10022,9 +10022,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VA master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 4) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (318, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B N T S1 T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -10062,9 +10062,9 @@ COMMIT; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T N S1 T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -10074,9 +10074,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VA master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (319, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T N S1 T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -10114,9 +10114,9 @@ COMMIT; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 N T R1 C << -b-b-b-b-b-b-b-b-b-b-b- @@ -10126,9 +10126,9 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VA master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (320, 7) -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T S1 N T R1 C << -e-e-e-e-e-e-e-e-e-e-e- @@ -11051,20 +11051,20 @@ ROLLBACK; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 5) master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_12 (a int) engine=Innodb -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 T CT R1 R << -b-b-b-b-b-b-b-b-b-b-b- Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 2) -master-bin.000001 # Query # # SAVEPOINT s1 +master-bin.000001 # Query # # SAVEPOINT `s1` master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (353, 5) master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_12 (a int) engine=Innodb -master-bin.000001 # Query # # ROLLBACK TO s1 +master-bin.000001 # Query # # ROLLBACK TO `s1` master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T S1 T CT R1 R << -e-e-e-e-e-e-e-e-e-e-e- diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index f864139495a..347b0dff70a 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -11,7 +11,7 @@ ############################################################################## rpl_failed_optimize : WL#4284: Can't optimize table used by a pending transaction (there is metadata lock on the table). -rpl_plugin_load : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 rpl_read_only : WL#4284: Setting Read only won't succeed until all metadata locks are released. rpl_row_create_table : Bug#51574 2010-02-27 andrei failed different way than earlier with bug#45576 rpl_spec_variables : BUG#47661 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux +rpl_log_pos : BUG#55675 2010-09-10 alfranio rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle diff --git a/mysql-test/suite/rpl/t/rpl_flush_logs.test b/mysql-test/suite/rpl/t/rpl_flush_logs.test index 2118b48f946..5159acaae14 100644 --- a/mysql-test/suite/rpl/t/rpl_flush_logs.test +++ b/mysql-test/suite/rpl/t/rpl_flush_logs.test @@ -9,17 +9,10 @@ connection master; # Test 'flush error logs' statement. ---echo # Make sure the 'master_log.err-old' file does not ---echo # exist before execute 'flush error logs' statement. ---error 1 -file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old; --echo # Test if support 'flush error logs' statement. flush error logs; ---echo # Check the 'master_log.err-old' file is created ---echo # after executed 'flush error logs' statement. -file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old; file_exists $MYSQLTEST_VARDIR/tmp/master_log.err; --echo # Make sure binary logs was not be flushed @@ -109,19 +102,10 @@ sync_slave_with_master; file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007; connection master; -remove_file $MYSQLTEST_VARDIR/tmp/master_log.err-old; - ---echo # Make sure the 'master_log.err-old' file does not exist ---echo # before execute 'flush error logs, relay logs' statement. ---error 1 -file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old; --echo # Test if support to combine all kinds of logs into one statement. flush error logs, relay logs; ---echo # Check the 'master_log.err-old' file is created ---echo # after executed 'flush error logs, relay logs' statement. -file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old; file_exists $MYSQLTEST_VARDIR/tmp/master_log.err; --echo # Make sure binary logs was not be flushed @@ -145,19 +129,10 @@ file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008; file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000009; connection master; -remove_file $MYSQLTEST_VARDIR/tmp/master_log.err-old; - ---echo # Make sure the 'master_log.err-old' file does not exist ---echo # before execute 'flush logs' statement. ---error 1 -file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old; --echo # Test if 'flush logs' statement works fine and flush all the logs. flush logs; ---echo # Check the 'master_log.err-old' file is created ---echo # after executed 'flush logs' statement. -file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old; file_exists $MYSQLTEST_VARDIR/tmp/master_log.err; --echo # Check 'master-bin.000003' is created diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result index 375717ee171..ef563d71342 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result @@ -25,7 +25,7 @@ master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # use `test`; drop table t1 +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=NDB master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) @@ -204,7 +204,7 @@ master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # use `test`; drop table t1 +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=NDB master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) @@ -240,7 +240,7 @@ slave-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) slave-bin.000001 # Write_rows # # table_id: # slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000001 # Query # # COMMIT -slave-bin.000001 # Query # # use `test`; drop table t1 +slave-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ slave-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=NDB slave-bin.000001 # Query # # BEGIN slave-bin.000001 # Table_map # # table_id: # (test.t1) diff --git a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result index 14d3baee1b0..36a7ae0016b 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result @@ -37,7 +37,7 @@ master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 -master-bin.000001 # Query # # use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ **** On Master **** CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; INSERT INTO t1 VALUES (1,1), (2,2); @@ -72,7 +72,7 @@ master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 -master-bin.000001 # Query # # use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) @@ -86,4 +86,4 @@ master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test index ff23b352b5a..2234d2c680f 100644 --- a/mysql-test/t/check.test +++ b/mysql-test/t/check.test @@ -53,5 +53,29 @@ REPAIR TABLE t1; DROP TABLE t1; +--echo # +--echo # Bug#56422 CHECK TABLE run when the table is locked reports corruption +--echo # along with timeout +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1(a INT); +LOCK TABLE t1 WRITE; + +--echo # Connection con1 +connect(con1, localhost, root); +SET lock_wait_timeout= 1; +CHECK TABLE t1; + +--echo # Connection default +connection default; +UNLOCK TABLES; +DROP TABLE t1; +disconnect con1; + + # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index e9c7e569250..ef705474eee 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -326,6 +326,7 @@ SET collation_connection='utf16_general_ci'; SET NAMES latin1; SET collation_connection='utf16_bin'; -- source include/ctype_filesort.inc +-- source include/ctype_filesort2.inc -- source include/ctype_like_escape.inc # diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test index 668b3b033bd..b03284a1c7c 100644 --- a/mysql-test/t/ctype_utf32.test +++ b/mysql-test/t/ctype_utf32.test @@ -328,6 +328,7 @@ SET collation_connection='utf32_general_ci'; SET NAMES latin1; SET collation_connection='utf32_bin'; -- source include/ctype_filesort.inc +-- source include/ctype_filesort2.inc -- source include/ctype_like_escape.inc # @@ -819,5 +820,16 @@ SELECT * FROM t1; DROP TABLE t1; --echo # +--echo # Bug#42511 mysqld: ctype-ucs2.c:2044: my_strnncollsp_utf32: Assertion (tlen % 4) == 0' faied +--echo # +CREATE TABLE t1 ( + b char(250) CHARACTER SET utf32, + key (b) +) ENGINE=MYISAM; +INSERT INTO t1 VALUES ('d'),('f'); +SELECT * FROM t1 WHERE b BETWEEN 'a' AND 'z'; +DROP TABLE t1; + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test index 8fcba92ff47..03696f385b5 100644 --- a/mysql-test/t/ctype_utf8mb4.test +++ b/mysql-test/t/ctype_utf8mb4.test @@ -733,6 +733,7 @@ SET collation_connection='utf8mb4_general_ci'; -- source include/ctype_german.inc SET collation_connection='utf8mb4_bin'; -- source include/ctype_filesort.inc +-- source include/ctype_filesort2.inc -- source include/ctype_like_escape.inc # diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test index 2bf0d5d2633..3a2bc982ad3 100644 --- a/mysql-test/t/delayed.test +++ b/mysql-test/t/delayed.test @@ -388,3 +388,216 @@ CREATE TABLE t1 LIKE t2; DROP TABLE t2; DROP TABLE t1; + + +--echo # +--echo # Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED +--echo # + +--echo # This test is not supposed to work under --ps-protocol since +--echo # INSERT DELAYED doesn't work under LOCK TABLES with this protocol. +--disable_ps_protocol + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +CREATE TABLE t3 (a INT); + +--echo # Test 1: Using LOCK TABLE + +--echo # Connection con1 +connect (con1, localhost, root); +LOCK TABLE t1 WRITE; + +--echo # Connection default +connection default; +LOCK TABLE t2 WRITE; +--echo # Sending: +--send INSERT DELAYED INTO t1 VALUES (1) + +--echo # Connection con1 +connection con1; +--echo # Wait until INSERT DELAYED is blocked on table 't1'. +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table metadata lock" + AND info = "INSERT DELAYED INTO t1 VALUES (1)"; +--source include/wait_condition.inc +--error ER_LOCK_DEADLOCK +INSERT DELAYED INTO t2 VALUES (1); +UNLOCK TABLES; + +--echo # Connection default +connection default; +--echo # Reaping: INSERT DELAYED INTO t1 VALUES (1) +--reap +UNLOCK TABLES; + +--echo # Test 2: Using ALTER TABLE + +START TRANSACTION; +SELECT * FROM t1 WHERE a=0; + +--echo # Connection con1 +connection con1; +--echo # Sending: +--send ALTER TABLE t1 COMMENT 'test' + +--echo # Connection default +connection default; +--echo # Wait until ALTER TABLE is blocked on table 't1'. +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table metadata lock" + AND info = "ALTER TABLE t1 COMMENT 'test'"; +--source include/wait_condition.inc +--error ER_LOCK_DEADLOCK +INSERT DELAYED INTO t1 VALUES (3); +COMMIT; + +--echo # Connection con1 +connection con1; +--echo # Reaping: ALTER TABLE t1 COMMENT 'test' +--reap + +--echo # Test 3: Using RENAME TABLE + +--echo # Connection default +connection default; +START TRANSACTION; +INSERT INTO t2 VALUES (1); + +--echo # Connection con1 +connection con1; +--echo # Sending: +--send RENAME TABLE t1 to t5, t2 to t4 + +--echo # Connection default +connection default; +--echo # Wait until RENAME TABLE is blocked on table 't1'. +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table metadata lock" + AND info = "RENAME TABLE t1 to t5, t2 to t4"; +--source include/wait_condition.inc +--error ER_LOCK_DEADLOCK +INSERT DELAYED INTO t1 VALUES (4); +COMMIT; + +--echo # Connection con1 +connection con1; +--echo # Reaping: RENAME TABLE t1 to t5, t2 to t4 +--reap + +--echo # Connection default +connection default; +--echo # Reverting the renames +RENAME TABLE t5 to t1, t4 to t2; + +--echo # Test 4: Two INSERT DELAYED on the same table + +START TRANSACTION; +INSERT INTO t2 VALUES (1); + +--echo # Connection con2 +connect (con2, localhost, root); +--send LOCK TABLE t1 WRITE, t2 WRITE + +--echo # Connection con1 +connection con1; +--echo # Wait until LOCK TABLE is blocked on table 't2'. +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table metadata lock" + AND info = "LOCK TABLE t1 WRITE, t2 WRITE"; +--source include/wait_condition.inc +--send INSERT DELAYED INTO t1 VALUES (5) + +--echo # Connection default +connection default; +--echo # Wait until INSERT DELAYED is blocked on table 't1'. +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table metadata lock" + AND info = "INSERT DELAYED INTO t1 VALUES (5)"; +--source include/wait_condition.inc +--error ER_LOCK_DEADLOCK +INSERT DELAYED INTO t1 VALUES (6); +COMMIT; + +--echo # Connection con2 +connection con2; +--echo # Reaping: LOCK TABLE t1 WRITE, t2 WRITE +--reap +UNLOCK TABLES; + +--echo # Connection con1 +connection con1; +--echo # Reaping: INSERT DELAYED INTO t1 VALUES (5) +--reap + +--echo # Connection con2 +connection con2; +disconnect con2; +--source include/wait_until_disconnected.inc +--echo # Connection con1 +connection con1; +disconnect con1; +--source include/wait_until_disconnected.inc + +--echo # Connection default +connection default; +DROP TABLE t1, t2, t3; +--enable_ps_protocol + + +--echo # +--echo # Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables". +--echo # +connect (con1,localhost,root,,); +connection default; +--disable_warnings +drop table if exists t1, t2, tm; +--enable_warnings +create table t1(a int); +create table t2(a int); +create table tm(a int) engine=merge union=(t1, t2); +begin; +select * from t1; + +--echo # Connection 'con1'. +connection con1; +--echo # Sending: +--send alter table t1 comment 'test' + +--echo # Connection 'default'. +connection default; +--echo # Wait until ALTER TABLE blocks and starts waiting +--echo # for connection 'default'. It should wait with a +--echo # pending SNW lock on 't1'. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "alter table t1 comment 'test'"; +--source include/wait_condition.inc +--echo # Attempt to perform delayed insert into 'tm' should not lead +--echo # to a deadlock. Instead error ER_DELAYED_NOT_SUPPORTED should +--echo # be emitted. +--error ER_DELAYED_NOT_SUPPORTED +insert delayed into tm values (1); +--echo # Unblock ALTER TABLE. +commit; + +--echo # Connection 'con1'. +connection con1; +--echo # Reaping ALTER TABLE: +--reap + +disconnect con1; +--source include/wait_until_disconnected.inc +--echo # Connection 'default'. +connection default; +drop tables tm, t1, t2; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index a21fff60d33..15aade73ab7 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -540,4 +540,17 @@ DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1; DROP TABLE t1; +--echo # +--echo # Bug #53034: Multiple-table DELETE statements not accepting +--echo # "Access compatibility" syntax +--echo # + +CREATE TABLE t1 (id INT); +CREATE TABLE t2 LIKE t1; +CREATE TABLE t3 LIKE t1; + +DELETE FROM t1.*, test.t2.*, a.* USING t1, t2, t3 AS a; + +DROP TABLE t1, t2, t3; + --echo End of 5.1 tests diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 8a1f91086d2..d35d612f93c 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,10 +11,9 @@ ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. lowercase_table3 : Bug#54845 2010-06-30 alik main.lowercase_table3 on Mac OSX +mysqlhotcopy_myisam : Bug#54129 2010-08-31 alik mysqlhotcopy* fails +mysqlhotcopy_archive : Bug#54129 2010-08-31 alik mysqlhotcopy* fails partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings -plugin : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 -plugin_load : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 -plugin_not_embedded : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically sp_sync : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution ctype_utf8mb4_ndb : Bug#55799, Bug#51907, disabled by Konstantin 2010-08-06 diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test index d4c3533847d..1cafbe3e6bd 100644 --- a/mysql-test/t/flush.test +++ b/mysql-test/t/flush.test @@ -546,3 +546,34 @@ disconnect con2; connection default; drop table t1; + +--echo # +--echo # Test for bug #55273 "FLUSH TABLE tm WITH READ LOCK for Merge table +--echo # causes assert failure". +--echo # +--disable_warnings +drop table if exists t1, t2, tm; +--enable_warnings +create table t1 (i int); +create table t2 (i int); +create table tm (i int) engine=merge union=(t1, t2); +insert into t1 values (1), (2); +insert into t2 values (3), (4); +--echo # The below statement should succeed and lock merge +--echo # table for read. Only merge table gets flushed and +--echo # not underlying tables. +flush tables tm with read lock; +select * from tm; +--echo # Check that underlying tables are locked. +select * from t1; +select * from t2; +unlock tables; +--echo # This statement should succeed as well and flush +--echo # all tables in the list. +flush tables tm, t1, t2 with read lock; +select * from tm; +--echo # Naturally, underlying tables should be locked in this case too. +select * from t1; +select * from t2; +unlock tables; +drop tables tm, t1, t2; diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index e191b9750e3..0624fce3a34 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -708,6 +708,7 @@ SELECT 1 FROM DROP TABLE t1; +--echo End of 5.0 tests --echo # --echo # Bug #52397: another crash with explain extended and group_concat @@ -722,6 +723,25 @@ DROP TABLE t1; --echo End of 5.0 tests + +--echo # +--echo # Bug #54476: crash when group_concat and 'with rollup' in prepared statements +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); + +PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP"; +EXECUTE stmt; +EXECUTE stmt; + +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + + +--echo End of 5.1 tests + + # # Bug#36785: Wrong error message when group_concat() exceeds max length # diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 2914bb15d18..6d128be7f34 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -1082,11 +1082,25 @@ select a.f1 as a, b.f4 as b, a.f1 > b.f4 as gt, from t1 a, t1 b; select *, f1 = f2 from t1; drop table t1; + +--echo # +--echo # Bug #54465: assert: field_types == 0 || field_types[field_pos] == +--echo # MYSQL_TYPE_LONGLONG +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); + +SELECT MAX((SELECT 1 FROM t1 ORDER BY @var LIMIT 1)) m FROM t1 t2, t1 + ORDER BY t1.a; + +DROP TABLE t1; + --echo # --echo End of 5.1 tests --echo # ---echo # Bug#55648: Server crash on MIX/MAX on maximum time value +--echo # Bug#55648: Server crash on MIN/MAX on maximum time value --echo # CREATE TABLE t1(c1 TIME NOT NULL); INSERT INTO t1 VALUES('837:59:59'); @@ -1095,3 +1109,12 @@ SELECT MAX(c1) FROM t1; DROP TABLE t1; --echo # End of the bug#55648 +--echo # +--echo # Bug#56120: Failed assertion on MIN/MAX on negative time value +--echo # +CREATE TABLE t1(c1 TIME NOT NULL); +INSERT INTO t1 VALUES('-00:00:01'); +SELECT MAX(c1),MIN(c1) FROM t1; +DROP TABLE t1; +--echo # End of the bug#56120 + diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 4efea8e195e..91f70bb98d7 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -165,3 +165,15 @@ DROP TABLE t1; --echo End of 5.0 tests + + +--echo # +--echo # Bug#55077: Assertion failed: width > 0 && to != ((void *)0), file .\dtoa.c +--echo # + +CREATE TABLE t1 (a LONGBLOB, b DOUBLE); +INSERT INTO t1 VALUES (NULL, 0), (NULL, 1); + +SELECT IF(b, (SELECT a FROM t1 LIMIT 1), b) c FROM t1 GROUP BY c; + +DROP TABLE t1; diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index a60eb9cf845..ec71e950ca7 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -468,6 +468,19 @@ select NAME_CONST('_id',1234) as id; select connection_id() > 0; --echo # +--echo # Bug #54461: crash with longblob and union or update with subquery +--echo # + +CREATE TABLE t1 (a INT, b LONGBLOB); +INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2'); + +SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; +SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; + +DROP TABLE t1; + + +--echo # --echo # Bug #52165: Assertion failed: file .\dtoa.c, line 465 --echo # @@ -478,4 +491,17 @@ SELECT COALESCE(a) = COALESCE(b) FROM t1; DROP TABLE t1; ---echo End of tests + +--echo # +--echo # Bug #54461: crash with longblob and union or update with subquery +--echo # + +CREATE TABLE t1 (a INT, b LONGBLOB); +INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2'); + +SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; +SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; + +DROP TABLE t1; + +--echo End of 5.1 tests diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 219a857a597..1f6001219a3 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -821,4 +821,15 @@ select date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND); select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND); +# +# Bug #55565: debug assertion when ordering by expressions with user +# variable assignments +# + +CREATE TABLE t1(a DOUBLE NOT NULL); +INSERT INTO t1 VALUES (0),(9.216e-096); +--echo # should not crash +SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a); +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 1aeb2fa5b14..4aad3f80b68 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -404,6 +404,7 @@ create table t1 (a int, b blob); insert into t1 values (1, ''), (2, NULL), (3, '1'); select * from t1; +--error ER_ILLEGAL_VALUE_FOR_TYPE select geometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL, aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL, @@ -422,6 +423,7 @@ select intersects(b, b) IS NULL, crosses(b, b) IS NULL from t1; +--error ER_ILLEGAL_VALUE_FOR_TYPE select point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL, multilinestring(b) IS NULL, multipolygon(b) IS NULL, @@ -705,25 +707,45 @@ drop table t1; # Bug#44684: valgrind reports invalid reads in # Item_func_spatial_collection::val_str # +--error ER_ILLEGAL_VALUE_FOR_TYPE SELECT MultiPoint(12345,''); -SELECT MultiPoint(123451,''); -SELECT MultiPoint(1234512,''); -SELECT MultiPoint(12345123,''); - -SELECT MultiLineString(12345,''); -SELECT MultiLineString(123451,''); -SELECT MultiLineString(1234512,''); -SELECT MultiLineString(12345123,''); - -SELECT LineString(12345,''); -SELECT LineString(123451,''); -SELECT LineString(1234512,''); -SELECT LineString(12345123,''); - -SELECT Polygon(12345,''); -SELECT Polygon(123451,''); -SELECT Polygon(1234512,''); -SELECT Polygon(12345123,''); +#SELECT MultiPoint(123451,''); +#SELECT MultiPoint(1234512,''); +#SELECT MultiPoint(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT MultiLineString(12345,''); +#SELECT MultiLineString(123451,''); +#SELECT MultiLineString(1234512,''); +#SELECT MultiLineString(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT LineString(12345,''); +#SELECT LineString(123451,''); +#SELECT LineString(1234512,''); +#SELECT LineString(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT Polygon(12345,''); +#SELECT Polygon(123451,''); +#SELECT Polygon(1234512,''); +#SELECT Polygon(12345123,''); + +# +# Bug55531 crash with conversions of geometry types / strings +# +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b)); + + +--echo # +--echo # BUG#51875: crash when loading data into geometry function polyfromwkb +--echo # +SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=POLYFROMWKB(@a); +SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=POLYFROMWKB(@a); + --echo End of 5.1 tests diff --git a/mysql-test/t/handler_read_last.test b/mysql-test/t/handler_read_last.test new file mode 100644 index 00000000000..376829b9baf --- /dev/null +++ b/mysql-test/t/handler_read_last.test @@ -0,0 +1,40 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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; version 2 of the License. +# +# 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, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT, INDEX (a)); +INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(); + +FLUSH STATUS; +SELECT a FROM t1 ORDER BY a LIMIT 1; +SHOW STATUS LIKE 'HANDLER_READ%'; + +FLUSH STATUS; +SELECT a FROM t1 ORDER BY a DESC LIMIT 1; +SHOW STATUS LIKE 'HANDLER_READ%'; + +FLUSH STATUS; +SELECT a FROM t1 ORDER BY a LIMIT 3; +SHOW STATUS LIKE 'HANDLER_READ%'; + +FLUSH STATUS; +SELECT a FROM t1 ORDER BY a DESC LIMIT 3; +SHOW STATUS LIKE 'HANDLER_READ%'; + +DROP TABLE t1; + diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 43b373c9703..05d630edfb2 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -851,4 +851,74 @@ ENGINE=MERGE UNION=(t1,t2); SELECT t1.a FROM mm1,t1; DROP TABLE t1, t2, mm1; +#--echo # +#--echo # Bug #55568: user variable assignments crash server when used within +#--echo # query +#--echo # +# +# +# This test case is invalidated because of fix of bug 55531 +# The reason is that {1} is not a valid geometric collection. +# +#CREATE TABLE t1 (a INT); + +#INSERT INTO t1 VALUES (0), (1); + +#let $i=2; +#while ($i) +#{ +# SELECT MULTIPOINT( +# 1, +# ( +# SELECT MULTIPOINT( +# MULTIPOINT( +# 1, +# (SELECT COUNT(*) FROM (SELECT 1 FROM t1 GROUP BY a,a) d) +# ) +# ) FROM t1 +# ) +# ) != COUNT(*) q FROM t1 GROUP BY a; +# dec $i; +#} +# +#DROP TABLE t1; + +--echo # +--echo # Bug #54468: crash after item's print() function when ordering/grouping +--echo # by subquery +--echo # + +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (), (); + +SELECT 1 FROM t1 +GROUP BY +GREATEST(t1.a, + (SELECT 1 FROM + (SELECT t1.b FROM t1,t1 t2 + ORDER BY t1.a, t1.a LIMIT 1) AS d) + ); + +DROP TABLE t1; + +--echo # +--echo # Bug #53544: Server hangs during JOIN query in stored procedure called +--echo # twice in a row +--echo # + +CREATE TABLE t1(c INT); + +INSERT INTO t1 VALUES (1), (2); + +PREPARE stmt FROM "SELECT t2.c AS f1 FROM t1 LEFT JOIN + t1 t2 ON t1.c=t2.c RIGHT JOIN + t1 t3 ON t1.c=t3.c + GROUP BY f1;"; + +EXECUTE stmt; +EXECUTE stmt; + +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/log_tables_debug.test b/mysql-test/t/log_tables_debug.test index 19a62614608..78a1289b689 100644 --- a/mysql-test/t/log_tables_debug.test +++ b/mysql-test/t/log_tables_debug.test @@ -7,6 +7,7 @@ # changed (see explanation in log_state.test) let $fixed_bug38124 = 0; +--source include/not_embedded.inc --source include/have_debug.inc # Several subtests modify global variables. Save the initial values only here, diff --git a/mysql-test/t/lowercase_fs_off.test b/mysql-test/t/lowercase_fs_off.test index 86d1e084c29..1be0351f9bc 100644 --- a/mysql-test/t/lowercase_fs_off.test +++ b/mysql-test/t/lowercase_fs_off.test @@ -91,3 +91,14 @@ DROP DATABASE db1; use test; # End of 5.0 tests + + +--echo # +--echo # Extra test coverage for Bug#56595 RENAME TABLE causes assert on OS X +--echo # + +CREATE TABLE t1(a INT); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1; +RENAME TABLE t1 TO T1; +ALTER TABLE T1 RENAME t1; +DROP TABLE t1; diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test index 55c04d7870b..f7780d2003a 100644 --- a/mysql-test/t/mdl_sync.test +++ b/mysql-test/t/mdl_sync.test @@ -4532,6 +4532,68 @@ disconnect con2; disconnect con3; +--echo # +--echo # Bug#56292 Deadlock with ALTER TABLE and MERGE tables +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1, t2, m1; +--enable_warnings + +CREATE TABLE t1(a INT) engine=MyISAM; +CREATE TABLE t2(a INT) engine=MyISAM; +CREATE TABLE m1(a INT) engine=MERGE UNION=(t1, t2); + +INSERT INTO t1 VALUES (1), (2); +INSERT INTO t2 VALUES (3), (4); + +connect(con1, localhost, root); +connect(con2, localhost, root); + +--echo # Connection con1 +connection con1; +SET DEBUG_SYNC= 'mdl_upgrade_shared_lock_to_exclusive SIGNAL upgrade WAIT_FOR continue'; +--echo # Sending: +--send ALTER TABLE m1 engine=MERGE UNION=(t2, t1) + +--echo # Connection con2 +connection con2; +--echo # Waiting for ALTER TABLE to try lock upgrade +SET DEBUG_SYNC= 'now WAIT_FOR upgrade'; +--echo # Sending: +--send DELETE FROM t2 WHERE a = 3 + +--echo # Connection default +connection default; +--echo # Check that DELETE is waiting on a metadata lock and not a table lock. +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table metadata lock" AND + info = "DELETE FROM t2 WHERE a = 3"; +--source include/wait_condition.inc +--echo # Now that DELETE blocks on a metadata lock, we should be able to do +--echo # SELECT * FROM m1 here. SELECT used to be blocked by a DELETE table +--echo # lock request. +SELECT * FROM m1; +--echo # Resuming ALTER TABLE +SET DEBUG_SYNC= 'now SIGNAL continue'; + +--echo # Connection con1 +connection con1; +--echo # Reaping: ALTER TABLE m1 engine=MERGE UNION=(t2, t1) +--reap +--echo # Connection con2 +connection con2; +--echo # Reaping: DELETE FROM t2 WHERE a = 3 +--reap +--echo # Connection default +connection default; +DROP TABLE m1, t1, t2; +SET DEBUG_SYNC= 'RESET'; +disconnect con1; +disconnect con2; + + # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index b6ad3324d19..34d0b5bf237 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -2,6 +2,9 @@ # Test of MERGE TABLES # +# Save the initial number of concurrent sessions. +--source include/count_sessions.inc + # MERGE tables require MyISAM tables let $default=`select @@global.storage_engine`; set global storage_engine=myisam; @@ -1731,6 +1734,84 @@ t2 WHERE b SOUNDS LIKE e AND d = 1; DROP TABLE t2, t1; +--echo # +--echo # Bug#46339 - crash on REPAIR TABLE merge table USE_FRM +--echo # +--disable_warnings +DROP TABLE IF EXISTS m1, t1; +--enable_warnings +# +# Test derived from a proposal of Shane Bester. +# +CREATE TABLE t1 (c1 INT) ENGINE=MYISAM; +CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1) INSERT_METHOD=LAST; +# +# REPAIR ... USE_FRM with LOCK TABLES. +# +LOCK TABLE m1 READ; +REPAIR TABLE m1 USE_FRM; +UNLOCK TABLES; +# +# REPAIR ... USE_FRM without LOCK TABLES. +# +# This statement crashed the server (Bug#46339). +# +REPAIR TABLE m1 USE_FRM; +# +DROP TABLE m1,t1; +# +# Test derived from a proposal of Matthias Leich. +# +# Base table is missing. +# +CREATE TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1); +# +# This statement crashed the server (Bug#46339). +# +REPAIR TABLE m1 USE_FRM; +# +# Create base table. +# +CREATE TABLE t1 (f1 BIGINT) ENGINE = MyISAM; +# +# This statement crashed the server (Bug#46339). +# +REPAIR TABLE m1 USE_FRM; +# +# Normal repair as reference. +# +REPAIR TABLE m1; +# +# Cleanup. +# +DROP TABLE m1, t1; +# +# Same with temporary tables. +# +# Base table is missing. +# +CREATE TEMPORARY TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1); +# +# This statement crashed the server (Bug#46339). +# +REPAIR TABLE m1 USE_FRM; +# +# Create base table. +# +CREATE TEMPORARY TABLE t1 (f1 BIGINT) ENGINE=MyISAM; +# +# This statement crashed the server (Bug#46339). +# +REPAIR TABLE m1 USE_FRM; +# +# Normal repair as reference. +# +REPAIR TABLE m1; +# +# Cleanup. +# +DROP TABLE m1, t1; + --echo End of 5.1 tests --echo # @@ -2519,12 +2600,11 @@ UNLOCK TABLES; DROP TABLE m1, t1; --echo # ---echo # If children are to be altered, they need an explicit lock. +--echo # Locking the merge table will implicitly lock children. --echo # CREATE TABLE t1 (c1 INT); CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1); LOCK TABLE m1 WRITE; ---error ER_TABLE_NOT_LOCKED_FOR_WRITE ALTER TABLE t1 ADD INDEX (c1); LOCK TABLE m1 WRITE, t1 WRITE; ALTER TABLE t1 ADD INDEX (c1); @@ -2665,6 +2745,37 @@ drop view v1; drop temporary table tmp; drop table t1, t2, t3, m1, m2; + +--echo # +--echo # Bug#56494 Segfault in upgrade_shared_lock_to_exclusive() for +--echo # REPAIR of merge table +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1, t2, t_not_exists; +--enable_warnings + +CREATE TABLE t1(a INT); +ALTER TABLE t1 engine= MERGE UNION (t_not_exists); +# This caused the segfault +ANALYZE TABLE t1; +CHECK TABLE t1; +CHECKSUM TABLE t1; +OPTIMIZE TABLE t1; +REPAIR TABLE t1; + +# This caused an assert +REPAIR TABLE t1 USE_FRM; + +DROP TABLE t1; +CREATE TABLE t1(a INT); +CREATE TABLE t2(a INT) engine= MERGE UNION (t1); +# This caused an assert +REPAIR TABLE t2 USE_FRM; + +DROP TABLE t1, t2; + + --echo End of 6.0 tests --disable_result_log @@ -2672,3 +2783,7 @@ drop table t1, t2, t3, m1, m2; eval set global storage_engine=$default; --enable_result_log --enable_query_log + +# Check that all connections opened by test cases in this file are really +# gone so execution of other tests won't be affected by their presence. +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 166d36856a6..8ed0ed45b82 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -650,5 +650,26 @@ SET SESSION sql_safe_updates = 1; UPDATE IGNORE t1, t1 t1a SET t1.a = 1 WHERE t1a.a = 1; DROP TABLE t1; +--echo # +--echo # Bug#54543: update ignore with incorrect subquery leads to assertion +--echo # failure: inited==INDEX +--echo # +SET SESSION sql_safe_updates = 0; +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES (1), (2); + +CREATE TABLE t2 ( a INT ); +INSERT INTO t2 VALUES (1), (2); + +CREATE TABLE t3 ( a INT ); +INSERT INTO t3 VALUES (1), (2); + +--echo # Should not crash +UPDATE IGNORE + ( SELECT ( SELECT COUNT(*) FROM t1 GROUP BY a, @v ) a FROM t2 ) x, t3 +SET t3.a = 0; + +DROP TABLE t1, t2, t3; +SET SESSION sql_safe_updates = DEFAULT; --echo end of tests diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 765ef31f9fd..3a2084aef08 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -425,11 +425,5 @@ drop table t1; --echo --exec $MYSQL --skip-column-names --vertical test -e "select 1 as a" -# -# Bug #54466 client 5.5 built from source lacks "pager" support -# ---echo Bug #54466 client 5.5 built from source lacks "pager" support ---exec $MYSQL --pager test -e "select 1 as a" - --echo --echo End of tests diff --git a/mysql-test/t/mysql_not_windows.test b/mysql-test/t/mysql_not_windows.test new file mode 100644 index 00000000000..66853677f7b --- /dev/null +++ b/mysql-test/t/mysql_not_windows.test @@ -0,0 +1,15 @@ +-- source include/not_windows.inc +# This test should work in embedded server after we fix mysqltest +-- source include/not_embedded.inc +# +# Testing the MySQL command line client(mysql) +# + +# +# Bug #54466 client 5.5 built from source lacks "pager" support +# +--echo Bug #54466 client 5.5 built from source lacks "pager" support +--exec $MYSQL --pager test -e "select 1 as a" + +--echo +--echo End of tests diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 031c51a0720..9da19ec00e0 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -701,6 +701,16 @@ echo banana = $cat; let $cat=ba\\\$cat\\\$cat; echo Not a banana: $cat; +# Bug #55413 would cause this to fail +let $escape= with\`some\"escaped\'quotes; +echo $escape; + +--let $escape= with\`some\"escaped\'quotes +echo $escape; + +# This only works with "--let" syntax +--let $tick= single'tick`backtick +echo $tick; # Test illegal uses of let diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 2ea169d950d..7869a01a84d 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -1467,6 +1467,31 @@ SELECT * FROM t1 FORCE INDEX FOR JOIN (a), t2 WHERE t1.a < 2 ORDER BY t1.a; DROP TABLE t1, t2; +--echo # +--echo # Bug #50394: Regression in EXPLAIN with index scan, LIMIT, GROUP BY and +--echo # ORDER BY computed col +--echo # +CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, KEY( a, b ) ); + +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); +INSERT INTO t1 SELECT a + 5, b + 5 FROM t1; + +CREATE TABLE t2( a INT PRIMARY KEY, b INT ); + +INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); +INSERT INTO t2 SELECT a + 5, b + 5 FROM t2; + +EXPLAIN +SELECT count(*) AS c, t1.a +FROM t1 JOIN t2 ON t1.b = t2.a +WHERE t2.b = 1 +GROUP BY t1.a +ORDER by c +LIMIT 2; + +DROP TABLE t1, t2; + + --echo End of 5.1 tests diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index fe2ef8cea1f..196285a6d22 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -14,6 +14,34 @@ drop table if exists t1, t2; --enable_warnings +--echo # +--echo # Bug#55458: Partitioned MyISAM table gets crashed by multi-table update +--echo # +CREATE TABLE t1 ( + `id` int NOT NULL, + `user_num` int DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM CHARSET=latin1; +INSERT INTO t1 VALUES (1,8601); +INSERT INTO t1 VALUES (2,8601); +INSERT INTO t1 VALUES (3,8601); +INSERT INTO t1 VALUES (4,8601); +CREATE TABLE t2 ( + `id` int(11) NOT NULL, + `user_num` int DEFAULT NULL, + `name` varchar(64) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM CHARSET=latin1 +PARTITION BY HASH (id) +PARTITIONS 2; +INSERT INTO t2 VALUES (1,8601,'John'); +INSERT INTO t2 VALUES (2,8601,'JS'); +INSERT INTO t2 VALUES (3,8601,'John S'); + +UPDATE t1, t2 SET t2.name = 'John Smith' WHERE t1.user_num = t2.user_num; + +DROP TABLE t1, t2; + --echo # Bug#39338: Fieldnames in --echo # INFORMATIONSCHEMA.PARTITIONS.PARTITION_EXPRESSION become unescaped --echo # NOTE: the partition expression is saved as a string, so changing from diff --git a/mysql-test/t/partition_binlog_stmt.test b/mysql-test/t/partition_binlog_stmt.test index bb52c2210f3..c426de9f303 100644 --- a/mysql-test/t/partition_binlog_stmt.test +++ b/mysql-test/t/partition_binlog_stmt.test @@ -8,10 +8,8 @@ DROP TABLE IF EXISTS t1; --echo # --echo # Bug#51851: Server with SBR locks mutex twice on LOAD DATA into --echo # partitioned MyISAM table -perl; -open( INIT, ">init_file.txt"); -print INIT "abcd\n"; -close( INIT ); +--write_file init_file.txt +abcd EOF CREATE TABLE t1 diff --git a/mysql-test/t/partition_not_blackhole-master.opt b/mysql-test/t/partition_not_blackhole-master.opt new file mode 100644 index 00000000000..1e47be930bc --- /dev/null +++ b/mysql-test/t/partition_not_blackhole-master.opt @@ -0,0 +1 @@ +--loose-skip-blackhole diff --git a/mysql-test/t/partition_not_blackhole.test b/mysql-test/t/partition_not_blackhole.test new file mode 100644 index 00000000000..7352aeaa230 --- /dev/null +++ b/mysql-test/t/partition_not_blackhole.test @@ -0,0 +1,26 @@ +--source include/have_partition.inc +--source include/not_blackhole.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +let $MYSQLD_DATADIR= `SELECT @@datadir`; + +--echo # +--echo # Bug#46086: crash when dropping a partitioned table and +--echo # the original engine is disabled +--echo # Copy a .frm and .par file which was created with: +--echo # create table `t1` (`id` int primary key) engine=blackhole +--echo # partition by key () partitions 1; +--copy_file std_data/parts/t1_blackhole.frm $MYSQLD_DATADIR/test/t1.frm +--copy_file std_data/parts/t1_blackhole.par $MYSQLD_DATADIR/test/t1.par +SHOW TABLES; +--replace_result $MYSQLD_DATADIR ./ +--error ER_NOT_FORM_FILE +SHOW CREATE TABLE t1; +--error ER_BAD_TABLE_ERROR +DROP TABLE t1; +--list_files $MYSQLD_DATADIR/test t1* +--remove_file $MYSQLD_DATADIR/test/t1.frm +--remove_file $MYSQLD_DATADIR/test/t1.par diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 27f6ddde615..f2ca16b9259 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -9,6 +9,30 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; --enable_warnings --echo # +--echo # Bug#53806: Wrong estimates for range query in partitioned MyISAM table +--echo # Bug#46754: 'rows' field doesn't reflect partition pruning +--echo # +CREATE TABLE t1 (a INT PRIMARY KEY) +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (1), +PARTITION p1 VALUES LESS THAN (2), +PARTITION p2 VALUES LESS THAN (3), +PARTITION p3 VALUES LESS THAN (4), +PARTITION p4 VALUES LESS THAN (5), +PARTITION p5 VALUES LESS THAN (6), +PARTITION max VALUES LESS THAN MAXVALUE); + +INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7),(8); + +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 # +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 # +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7; +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 # +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; +DROP TABLE t1; + +--echo # --echo # Bug#49742: Partition Pruning not working correctly for RANGE --echo # CREATE TABLE t1 (a INT PRIMARY KEY) diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 5d5ad180f1a..0ad3d3e8504 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1313,4 +1313,16 @@ SELECT * FROM t1 FORCE INDEX (PRIMARY) DROP TABLE t1; +--echo # +--echo # Bug #54802: 'NOT BETWEEN' evaluation is incorrect +--echo # + +CREATE TABLE t1 (c_key INT, c_notkey INT, KEY(c_key)); +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3); + +EXPLAIN SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key; +SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key; + +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index cec44078279..fb49ce23644 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -266,3 +266,22 @@ SELECT 1 FROM t1 WHERE ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234)); --enable_warnings DROP TABLE t1; + +--echo # +--echo # Bug #54190: Comparison to row subquery produces incorrect result +--echo # + +SELECT ROW(1,2) = (SELECT 1,2 FROM DUAL WHERE 1 = 0); +SELECT ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0); + +CREATE TABLE t1 (i INT); +INSERT INTO t1 () VALUES (1), (2), (3); + +SELECT ROW(1,2) = (SELECT 1,2 FROM t1 WHERE 1 = 0); +SELECT ROW(1,2) = (SELECT 1,3 FROM t1 WHERE 1 = 0); +SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,2 FROM DUAL WHERE 1 = 0); +SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0); + +DROP TABLE t1; + +--echo End of 5.1 tests diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 495b6002986..87f36c452f2 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3772,11 +3772,6 @@ SELECT 1 FROM t1 WHERE a <> 1 AND NOT ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1)) INTO @var0; -# Query correctly return 2 rows since comparison a <=> fisrt_subquery is -# always false, thus the second query is never executed. -SELECT 1 FROM t1 WHERE a <> 1 AND NOT -ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1)); - DROP TABLE t1; --echo # diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test index b7090c01f1e..a5c287e44a8 100644 --- a/mysql-test/t/sp-destruct.test +++ b/mysql-test/t/sp-destruct.test @@ -222,3 +222,33 @@ SHOW WARNINGS; --echo # Restore the procs_priv table RENAME TABLE procs_priv_backup TO mysql.procs_priv; FLUSH TABLE mysql.procs_priv; + + +--echo # +--echo # Bug #56137 "Assertion `thd->lock == 0' failed on upgrading from +--echo # 5.1.50 to 5.5.6". +--echo # +--disable_warnings +drop database if exists mysqltest; +--enable_warnings +--echo # Backup mysql.proc. +flush table mysql.proc; +let $MYSQLD_DATADIR= `select @@datadir`; +--copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm +--copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD +--copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI + +create database mysqltest; +--echo # Corrupt mysql.proc to make it unusable by current version of server. +alter table mysql.proc drop column type; +--echo # The below statement should not cause assertion failure. +drop database mysqltest; + +--echo # Restore mysql.proc. +drop table mysql.proc; +--copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLD_DATADIR/mysql/proc.frm +--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD +--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI +--remove_file $MYSQLTEST_VARDIR/tmp/proc.frm +--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD +--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index 0dd324d5df2..fc522a69a3c 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -192,11 +192,11 @@ INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i')); # All test cases expected to fail should return # SQLSTATE 22007 <invalid date value> +--error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); - ---error 1292 +--error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); --error 1292 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); @@ -206,18 +206,18 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i')); --error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); ## Test INSERT with STR_TO_DATE into DATETIME # All test cases expected to fail should return # SQLSTATE 22007 <invalid datetime value> +--error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); - ---error 1292 +--error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); --error 1292 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); @@ -227,18 +227,18 @@ INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i')); --error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); ## Test INSERT with STR_TO_DATE into TIMESTAMP # All test cases expected to fail should return # SQLSTATE 22007 <invalid datetime value> ---error 1292 +--error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); --error 1292 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); @@ -248,7 +248,7 @@ INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i')); --error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ---error 1292 +--error 1411 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); drop table t1; diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index a2c71c664c4..6727833eb44 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -74,6 +74,68 @@ CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) ); CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) ); DROP VIEW v1, v2; +--echo # +--echo # Bug#51070: Query with a NOT IN subquery predicate returns a wrong +--echo # result set +--echo # +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES ( 1, NULL ), ( 2, NULL ); + +CREATE TABLE t2 ( c INT, d INT ); +INSERT INTO t2 VALUES ( NULL, 3 ), ( NULL, 4 ); + +CREATE TABLE t3 ( e INT, f INT ); +INSERT INTO t3 VALUES ( NULL, NULL ), ( NULL, NULL ); + +CREATE TABLE t4 ( a INT ); +INSERT INTO t4 VALUES (1), (2), (3); + +CREATE TABLE t5 ( a INT ); +INSERT INTO t5 VALUES (NULL), (2); + +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ); +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ); + +EXPLAIN +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL; +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL; +SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) IS NULL; +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS UNKNOWN; +SELECT * FROM t1 WHERE (( a, b ) NOT IN ( SELECT c, d FROM t2 )) IS UNKNOWN; + +SELECT * FROM t1 WHERE 1 = 1 AND ( a, b ) NOT IN ( SELECT c, d FROM t2 ); + +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 ); +SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 ); + +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 ); +SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 ); + +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 ); +SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 ); + +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 ); +SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 ); + +SELECT * FROM t1 WHERE ( a, b ) NOT IN + ( SELECT c, d FROM t2 WHERE c = 1 AND c <> 1 ); + +SELECT * FROM t1 WHERE b NOT IN ( SELECT c FROM t2 WHERE c = 1 ); + +SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 ); + +DROP TABLE t1, t2, t3, t4, t5; + --echo # --echo # End of 5.1 tests. diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test index 15ddceb8d68..c4445da107c 100644 --- a/mysql-test/t/timezone2.test +++ b/mysql-test/t/timezone2.test @@ -273,5 +273,14 @@ UNLOCK TABLES; DROP TABLE t1; +--echo # +--echo # Bug #55424: convert_tz crashes when fed invalid data +--echo # + +CREATE TABLE t1 (a SET('x') NOT NULL); +INSERT INTO t1 VALUES (''); +SELECT CONVERT_TZ(1, a, 1) FROM t1; +SELECT CONVERT_TZ(1, 1, a) FROM t1; +DROP TABLE t1; --echo End of 5.1 tests diff --git a/mysql-test/t/trigger_notembedded.test b/mysql-test/t/trigger_notembedded.test index 9728ae9a4ae..89857063ebd 100644 --- a/mysql-test/t/trigger_notembedded.test +++ b/mysql-test/t/trigger_notembedded.test @@ -932,4 +932,52 @@ disconnect con1; DROP USER 'no_rights'@'localhost'; DROP DATABASE db1; +# +# Bug#55421 Protocol::end_statement(): Assertion `0' on multi-table UPDATE IGNORE +# To reproduce a crash we need to provoke a trigger execution with +# the following conditions: +# - active SELECT statement during trigger execution +# (i.e. LEX::current_select != NULL); +# - IGNORE option (i.e. LEX::current_select->no_error == TRUE); +--disable_warnings +DROP DATABASE IF EXISTS mysqltest_db1; +--enable_warnings + +CREATE DATABASE mysqltest_db1; +USE mysqltest_db1; + +GRANT ALL ON mysqltest_db1.* TO mysqltest_u1@localhost; + +--connect(con1,localhost,mysqltest_u1,,mysqltest_db1) + +CREATE TABLE t1 ( + a1 int, + a2 int +); +INSERT INTO t1 VALUES (1, 20); + +CREATE TRIGGER mysqltest_db1.upd_t1 +BEFORE UPDATE ON t1 FOR EACH ROW SET new.a2 = 200; + +CREATE TABLE t2 ( + a1 int +); + +INSERT INTO t2 VALUES (2); + +--connection default + +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; + +--error ER_TABLEACCESS_DENIED_ERROR +UPDATE IGNORE t1, t2 SET t1.a1 = 2, t2.a1 = 3 WHERE t1.a1 = 1 AND t2.a1 = 2; +# Cleanup + +DROP DATABASE mysqltest_db1; +DROP USER mysqltest_u1@localhost; + +--disconnect con1 +--connection default +USE test; + --echo End of 5.1 tests. diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index e607823764b..6e40c9ccfa0 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -462,5 +462,28 @@ DROP TABLE t1; SET NAMES latin1; --echo # +--echo # Bug#56271: Wrong comparison result with STR_TO_DATE function +--echo # +CREATE TABLE t1 ( + `year` int(4) NOT NULL, + `month` int(2) NOT NULL +); + +INSERT INTO t1 VALUES (2010,3),(2010,4),(2009,8),(2008,9); + +SELECT * +FROM t1 +WHERE STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') >= +STR_TO_DATE('1/1/2010', '%m/%d/%Y'); + +create table t2(f1 datetime primary key); +insert into t2 select STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') from t1; +select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y'); +--echo t2 should be const +explain select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y'); + +DROP TABLE t1,t2; + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 3f418a339cc..bd70e64b1ad 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1509,5 +1509,14 @@ group by PAY.id + 1; DROP TABLE currencies, payments, sub_tasks; +--echo # +--echo # BUG#52171: distinct aggregates on unsigned decimal fields trigger assertions +--echo # + +CREATE TABLE t1 (a DECIMAL(4,4) UNSIGNED); +INSERT INTO t1 VALUES (0); +SELECT AVG(DISTINCT a) FROM t1; +SELECT SUM(DISTINCT a) FROM t1; +DROP TABLE t1; --echo End of 5.1 tests diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index 5c3a759b589..dfac6f93b7d 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -347,6 +347,23 @@ DROP TABLE t1; --echo End of 5.0 tests +--echo # +--echo # Bug #55779: select does not work properly in mysql server +--echo # Version "5.1.42 SUSE MySQL RPM" +--echo # + +CREATE TABLE t1 (a TIMESTAMP, KEY (a)); + +INSERT INTO t1 VALUES ('2000-01-01 00:00:00'), ('2000-01-01 00:00:00'), + ('2000-01-01 00:00:01'), ('2000-01-01 00:00:01'); + +SELECT a FROM t1 WHERE a >= 20000101000000; +SELECT a FROM t1 WHERE a >= '20000101000000'; + +DROP TABLE t1; + +--echo End of 5.1 tests + --echo --echo Bug#50888 valgrind warnings in Field_timestamp::val_str --echo diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index fc4bc61f526..06508c43766 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -326,6 +326,24 @@ INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1); DROP TABLE t1; +# +# Bug #55615: debug assertion after using variable in assignment and +# referred to +# Bug #55564: crash with user variables, assignments, joins... +# + +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (0),(0); +--echo # BUG#55615 : should not crash +SELECT (@a:=(SELECT @a:=1 FROM t1 LIMIT 1)) AND COUNT(1) FROM t1 GROUP BY @a; +--echo # BUG#55564 : should not crash +SELECT IF( + @v:=LEAST((SELECT 1 FROM t1 t2 LEFT JOIN t1 ON (@v) GROUP BY t1.a), a), + count(*), 1) +FROM t1 GROUP BY a LIMIT 1; + +DROP TABLE t1; + --echo End of 5.1 tests # diff --git a/mysql-test/t/variables_debug.test b/mysql-test/t/variables_debug.test index 8fa2124137a..63c34acc876 100644 --- a/mysql-test/t/variables_debug.test +++ b/mysql-test/t/variables_debug.test @@ -36,3 +36,78 @@ SELECT @@global.debug; SET GLOBAL debug=@old_debug; --echo End of 5.1 tests + + +--echo # +--echo # Bug#46165 server crash in dbug +--echo # + +SET @old_globaldebug = @@global.debug; +SET @old_sessiondebug= @@session.debug; + +--echo # Test 1 - Bug test case, single connection +SET GLOBAL debug= '+O,../../log/bug46165.1.trace'; +SET SESSION debug= '-d:-t:-i'; + +SET GLOBAL debug= ''; +SET SESSION debug= ''; + +--echo # Test 2 - Bug test case, two connections +--echo # Connection default +connection default; +SET GLOBAL debug= '+O,../../log/bug46165.2.trace'; +SET SESSION debug= '-d:-t:-i'; + +--echo # Connection con1 +connect (con1, localhost, root); +SET GLOBAL debug= ''; + +--echo # Connection default +connection default; +SET SESSION debug= ''; +--echo # Connection con1 +connection con1; +disconnect con1; +--source include/wait_until_disconnected.inc +--echo # Connection default +connection default; +SET GLOBAL debug= ''; + +--echo # Test 3 - Active session trace file on disconnect +--echo # Connection con1 +connect (con1, localhost, root); +SET GLOBAL debug= '+O,../../log/bug46165.3.trace'; +SET SESSION debug= '-d:-t:-i'; +SET GLOBAL debug= ''; +disconnect con1; +--source include/wait_until_disconnected.inc + +--echo # Test 4 - Active session trace file on two connections +--echo # Connection default +connection default; +SET GLOBAL debug= '+O,../../log/bug46165.4.trace'; +SET SESSION debug= '-d:-t:-i'; + +--echo # Connection con1 +connect (con1, localhost, root); +SET SESSION debug= '-d:-t:-i'; +SET GLOBAL debug= ''; +SET SESSION debug= ''; + +--echo # Connection default +connection default; +SET SESSION debug= ''; +--echo # Connection con1 +connection con1; +disconnect con1; +--source include/wait_until_disconnected.inc +--echo # Connection default +connection default; + +--echo # Test 5 - Different trace files +SET SESSION debug= '+O,../../log/bug46165.5.trace'; +SET SESSION debug= '+O,../../log/bug46165.6.trace'; +SET SESSION debug= '-O'; + +SET GLOBAL debug= @old_globaldebug; +SET SESSION debug= @old_sessiondebug; diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test index fe36af60c27..3fd243398a9 100644 --- a/mysql-test/t/xa.test +++ b/mysql-test/t/xa.test @@ -228,6 +228,23 @@ XA ROLLBACK 'xid1'; disconnect con1; DROP TABLE t1; + +--echo # +--echo # Bug#56448 Assertion failed: ! is_set() with second xa end +--echo # + +XA START 'x'; +XA END 'x'; +# Second XA END caused an assertion. +--error ER_XAER_RMFAIL +XA END 'x'; +XA PREPARE 'x'; +# Second XA PREPARE also caused an assertion. +--error ER_XAER_RMFAIL +XA PREPARE 'x'; +XA ROLLBACK 'x'; + + # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 83896378883..0d63c2cb3ff 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -745,3 +745,38 @@ Memcheck:Addr1 fun:buf_buddy_relocate } + +# +# See related Bug#56666 +# Race condition between the server main thread and the kill server thread. +# +# Because of this race condition, the call to shutdown_performance_schema() +# was commented in sql/mysqld.cc, causing the reported leaks. +# + +{ + missing shutdown_performance_schema 1 + Memcheck:Leak + fun:malloc + fun:_Z10pfs_mallocmi +} + +{ + missing shutdown_performance_schema 2 + Memcheck:Leak + fun:malloc + fun:my_malloc + fun:_lf_alloc_new + fun:lf_hash_insert +} + +{ + missing shutdown_performance_schema 3 + Memcheck:Leak + fun:malloc + fun:my_malloc + fun:initialize_bucket + fun:lf_hash_search + fun:_Z19find_or_create_fileP10PFS_threadP14PFS_file_classPKcj +} + diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c index 9ca22f2201e..d14087d061e 100644 --- a/mysys/my_gethwaddr.c +++ b/mysys/my_gethwaddr.c @@ -64,7 +64,7 @@ my_bool my_gethwaddr(uchar *to) if (ifm->ifm_type == RTM_IFINFO) { sdl = (struct sockaddr_dl *)(ifm + 1); - addr=LLADDR(sdl); + addr=(uchar *)LLADDR(sdl); res=memcpy_and_test(to, addr, ETHER_ADDR_LEN); } } diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 1c5bf0b6b1c..2ec2f8eb5c9 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -98,6 +98,49 @@ void my_getopt_register_get_addr(my_getopt_value func_addr) matches with one of the options in struct 'my_option'. Check that option was given an argument if it requires one Call the optional 'get_one_option()' function once for each option. + + Note that handle_options() can be invoked multiple times to + parse a command line in several steps. + In this case, use the global flag @c my_getopt_skip_unknown to indicate + that options unknown in the current step should be preserved in the + command line for later parsing in subsequent steps. + + For 'long' options (--a_long_option), @c my_getopt_skip_unknown is + fully supported. Command line parameters such as: + - "--a_long_option" + - "--a_long_option=value" + - "--a_long_option value" + will be preserved as is when the option is not known. + + For 'short' options (-S), support for @c my_getopt_skip_unknown + comes with some limitation, because several short options + can also be specified together in the same command line argument, + as in "-XYZ". + + The first use case supported is: all short options are declared. + handle_options() will be able to interpret "-XYZ" as one of: + - an unknown X option + - "-X -Y -Z", three short options with no arguments + - "-X -YZ", where Y is a short option with argument Z + - "-XYZ", where X is a short option with argument YZ + based on the full short options specifications. + + The second use case supported is: no short option is declared. + handle_options() will reject "-XYZ" as unknown, to be parsed later. + + The use case that is explicitly not supported is to provide + only a partial list of short options to handle_options(). + This function can not be expected to extract some option Y + in the middle of the string "-XYZ" in these conditions, + without knowing if X will be declared an option later. + + Note that this limitation only impacts parsing of several + short options from the same command line argument, + as in "mysqld -anW5". + When each short option is properly separated out in the command line + argument, for example in "mysqld -a -n -w5", the code would actually + work even with partial options specs given at each stage. + @param [in, out] argc command line options (count) @param [in, out] argv command line options (values) @param [in] longopts descriptor of all valid options @@ -110,7 +153,7 @@ int handle_options(int *argc, char ***argv, const struct my_option *longopts, my_get_one_option get_one_option) { - uint opt_found, argvpos= 0, length; + uint UNINIT_VAR(opt_found), argvpos= 0, length; my_bool end_of_options= 0, must_be_var, set_maximum_value, option_is_loose; char **pos, **pos_end, *optend, *opt_str, key_name[FN_REFLEN]; @@ -120,7 +163,6 @@ int handle_options(int *argc, char ***argv, int error, i; my_bool is_cmdline_arg= 1; - LINT_INIT(opt_found); /* handle_options() assumes arg0 (program name) always exists */ DBUG_ASSERT(argc && *argc >= 1); DBUG_ASSERT(argv && *argv); @@ -145,6 +187,7 @@ int handle_options(int *argc, char ***argv, { char **first= pos; char *cur_arg= *pos; + opt_found= 0; if (!is_cmdline_arg && (cur_arg == args_separator)) { is_cmdline_arg= 1; @@ -464,14 +507,40 @@ int handle_options(int *argc, char ***argv, } if (!opt_found) { - if (my_getopt_print_errors) - my_getopt_error_reporter(ERROR_LEVEL, - "%s: unknown option '-%c'", - my_progname, *optend); - return EXIT_UNKNOWN_OPTION; + if (my_getopt_skip_unknown) + { + /* + We are currently parsing a single argv[] argument + of the form "-XYZ". + One or the argument found (say Y) is not an option. + Hack the string "-XYZ" to make a "-YZ" substring in it, + and push that to the output as an unrecognized parameter. + */ + DBUG_ASSERT(optend > *pos); + DBUG_ASSERT(optend >= cur_arg); + DBUG_ASSERT(optend <= *pos + strlen(*pos)); + DBUG_ASSERT(*optend); + optend--; + optend[0]= '-'; /* replace 'X' or '-' by '-' */ + (*argv)[argvpos++]= optend; + /* + Do not continue to parse at the current "-XYZ" argument, + skip to the next argv[] argument instead. + */ + optend= (char*) " "; + } + else + { + if (my_getopt_print_errors) + my_getopt_error_reporter(ERROR_LEVEL, + "%s: unknown option '-%c'", + my_progname, *optend); + return EXIT_UNKNOWN_OPTION; + } } } - (*argc)--; /* option handled (short), decrease argument count */ + if (opt_found) + (*argc)--; /* option handled (short), decrease argument count */ continue; } if ((error= setval(optp, value, argument, set_maximum_value))) @@ -479,7 +548,7 @@ int handle_options(int *argc, char ***argv, if (get_one_option && get_one_option(optp->id, optp, argument)) return EXIT_UNSPECIFIED_ERROR; - (*argc)--; /* option handled (short or long), decrease argument count */ + (*argc)--; /* option handled (long), decrease argument count */ } else /* non-option found */ (*argv)[argvpos++]= cur_arg; diff --git a/mysys/my_init.c b/mysys/my_init.c index d2371278b0c..e3b189c27bb 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -477,7 +477,7 @@ static my_bool win32_init_tcp_ip() { if (win32_have_tcpip()) { - WORD wVersionRequested = MAKEWORD( 2, 0 ); + WORD wVersionRequested = MAKEWORD( 2, 2 ); WSADATA wsaData; /* Be a good citizen: maybe another lib has already initialised sockets, so dont clobber them unless necessary */ diff --git a/mysys/my_sync.c b/mysys/my_sync.c index 6497ae59159..bc050922ffc 100644 --- a/mysys/my_sync.c +++ b/mysys/my_sync.c @@ -100,9 +100,9 @@ static const char cur_dir_name[]= {FN_CURLIB, 0}; RETURN 0 if ok, !=0 if error */ +#ifdef NEED_EXPLICIT_SYNC_DIR int my_sync_dir(const char *dir_name, myf my_flags) { -#ifdef NEED_EXPLICIT_SYNC_DIR File dir_fd; int res= 0; const char *correct_dir_name; @@ -124,10 +124,14 @@ int my_sync_dir(const char *dir_name, myf my_flags) else res= 1; DBUG_RETURN(res); -#else +} +#else /* NEED_EXPLICIT_SYNC_DIR */ +int my_sync_dir(const char *dir_name __attribute__((unused)), + myf my_flags __attribute__((unused))) +{ return 0; -#endif } +#endif /* NEED_EXPLICIT_SYNC_DIR */ /* @@ -141,15 +145,18 @@ int my_sync_dir(const char *dir_name, myf my_flags) RETURN 0 if ok, !=0 if error */ +#ifdef NEED_EXPLICIT_SYNC_DIR int my_sync_dir_by_file(const char *file_name, myf my_flags) { -#ifdef NEED_EXPLICIT_SYNC_DIR char dir_name[FN_REFLEN]; size_t dir_name_length; dirname_part(dir_name, file_name, &dir_name_length); return my_sync_dir(dir_name, my_flags); -#else +} +#else /* NEED_EXPLICIT_SYNC_DIR */ +int my_sync_dir_by_file(const char *file_name __attribute__((unused)), + myf my_flags __attribute__((unused))) +{ return 0; -#endif } - +#endif /* NEED_EXPLICIT_SYNC_DIR */ diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 236b694726f..045b56b11c2 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -302,6 +302,8 @@ void my_thread_global_end(void) #ifndef HAVE_GETHOSTBYNAME_R mysql_mutex_destroy(&LOCK_gethostbyname_r); #endif + + my_thread_basic_global_init_done= 0; } static my_thread_id thread_id= 0; diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index 5d870bbc151..d96d08ea0c3 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -91,6 +91,16 @@ enum thr_lock_type thr_upgraded_concurrent_insert_lock = TL_WRITE; LIST *thr_lock_thread_list; /* List of threads in use */ ulong max_write_lock_count= ~(ulong) 0L; +static void (*before_lock_wait)(void)= 0; +static void (*after_lock_wait)(void)= 0; + +void thr_set_lock_wait_callback(void (*before_wait)(void), + void (*after_wait)(void)) +{ + before_lock_wait= before_wait; + after_lock_wait= after_wait; +} + static inline mysql_cond_t *get_cond(void) { return &my_thread_var->suspend; @@ -431,6 +441,19 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, old_proc_info= proc_info_hook(NULL, "Waiting for table level lock", __func__, __FILE__, __LINE__); + /* + Since before_lock_wait potentially can create more threads to + scheduler work for, we don't want to call the before_lock_wait + callback unless it will really start to wait. + + For similar reasons, we do not want to call before_lock_wait and + after_lock_wait for each lap around the loop, so we restrict + ourselves to call it before_lock_wait once before starting to wait + and once after the thread has exited the wait loop. + */ + if ((!thread_var->abort || in_wait_list) && before_lock_wait) + (*before_lock_wait)(); + set_timespec(wait_timeout, lock_wait_timeout); while (!thread_var->abort || in_wait_list) { @@ -462,6 +485,14 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, /* purecov: end */ } } + + /* + We call the after_lock_wait callback once the wait loop has + finished. + */ + if (after_lock_wait) + (*after_lock_wait)(); + DBUG_PRINT("thr_lock", ("aborted: %d in_wait_list: %d", thread_var->abort, in_wait_list)); diff --git a/mysys/thr_rwlock.c b/mysys/thr_rwlock.c index ecd12849822..218cfb251c8 100644 --- a/mysys/thr_rwlock.c +++ b/mysys/thr_rwlock.c @@ -59,7 +59,7 @@ * Mountain View, California 94043 */ -int my_rw_init(my_rw_lock_t *rwp, my_bool *prefer_readers_attr) +int my_rw_init(my_rw_lock_t *rwp) { pthread_condattr_t cond_attr; @@ -74,8 +74,6 @@ int my_rw_init(my_rw_lock_t *rwp, my_bool *prefer_readers_attr) #ifdef SAFE_MUTEX rwp->write_thread = 0; #endif - /* If attribute argument is NULL use default value - prefer writers. */ - rwp->prefer_readers= prefer_readers_attr ? *prefer_readers_attr : FALSE; return(0); } @@ -96,8 +94,7 @@ int my_rw_rdlock(my_rw_lock_t *rwp) pthread_mutex_lock(&rwp->lock); /* active or queued writers */ - while (( rwp->state < 0 ) || - (rwp->waiters && ! rwp->prefer_readers)) + while (( rwp->state < 0 ) || rwp->waiters) pthread_cond_wait( &rwp->readers, &rwp->lock); rwp->state++; @@ -109,8 +106,7 @@ int my_rw_tryrdlock(my_rw_lock_t *rwp) { int res; pthread_mutex_lock(&rwp->lock); - if ((rwp->state < 0 ) || - (rwp->waiters && ! rwp->prefer_readers)) + if ((rwp->state < 0 ) || rwp->waiters) res= EBUSY; /* Can't get lock */ else { @@ -192,30 +188,127 @@ int my_rw_unlock(my_rw_lock_t *rwp) return(0); } +#endif /* defined(NEED_MY_RW_LOCK) */ + -int rw_pr_init(struct st_my_rw_lock_t *rwlock) +int rw_pr_init(rw_pr_lock_t *rwlock) { - my_bool prefer_readers_attr= TRUE; - return my_rw_init(rwlock, &prefer_readers_attr); + pthread_mutex_init(&rwlock->lock, NULL); + pthread_cond_init(&rwlock->no_active_readers, NULL); + rwlock->active_readers= 0; + rwlock->writers_waiting_readers= 0; + rwlock->active_writer= FALSE; +#ifdef SAFE_MUTEX + rwlock->writer_thread= 0; +#endif + return 0; } -#else -/* - We are on system which has native read/write locks which support - preferring of readers. -*/ +int rw_pr_destroy(rw_pr_lock_t *rwlock) +{ + pthread_cond_destroy(&rwlock->no_active_readers); + pthread_mutex_destroy(&rwlock->lock); + return 0; +} -int rw_pr_init(rw_pr_lock_t *rwlock) + +int rw_pr_rdlock(rw_pr_lock_t *rwlock) +{ + pthread_mutex_lock(&rwlock->lock); + /* + The fact that we were able to acquire 'lock' mutex means + that there are no active writers and we can acquire rd-lock. + Increment active readers counter to prevent requests for + wr-lock from succeeding and unlock mutex. + */ + rwlock->active_readers++; + pthread_mutex_unlock(&rwlock->lock); + return 0; +} + + +int rw_pr_wrlock(rw_pr_lock_t *rwlock) { - pthread_rwlockattr_t rwlock_attr; + pthread_mutex_lock(&rwlock->lock); + + if (rwlock->active_readers != 0) + { + /* There are active readers. We have to wait until they are gone. */ + rwlock->writers_waiting_readers++; - pthread_rwlockattr_init(&rwlock_attr); - pthread_rwlockattr_setkind_np(&rwlock_attr, PTHREAD_RWLOCK_PREFER_READER_NP); - pthread_rwlock_init(rwlock, NULL); - pthread_rwlockattr_destroy(&rwlock_attr); + while (rwlock->active_readers != 0) + pthread_cond_wait(&rwlock->no_active_readers, &rwlock->lock); + + rwlock->writers_waiting_readers--; + } + + /* + We own 'lock' mutex so there is no active writers. + Also there are no active readers. + This means that we can grant wr-lock. + Not releasing 'lock' mutex until unlock will block + both requests for rd and wr-locks. + Set 'active_writer' flag to simplify unlock. + + Thanks to the fact wr-lock/unlock in the absence of + contention from readers is essentially mutex lock/unlock + with a few simple checks make this rwlock implementation + wr-lock optimized. + */ + rwlock->active_writer= TRUE; +#ifdef SAFE_MUTEX + rwlock->writer_thread= pthread_self(); +#endif return 0; } -#endif /* defined(NEED_MY_RW_LOCK) */ + +int rw_pr_unlock(rw_pr_lock_t *rwlock) +{ + if (rwlock->active_writer) + { + /* We are unlocking wr-lock. */ +#ifdef SAFE_MUTEX + rwlock->writer_thread= 0; +#endif + rwlock->active_writer= FALSE; + if (rwlock->writers_waiting_readers) + { + /* + Avoid expensive cond signal in case when there is no contention + or it is wr-only. + + Note that from view point of performance it would be better to + signal on the condition variable after unlocking mutex (as it + reduces number of contex switches). + + Unfortunately this would mean that such rwlock can't be safely + used by MDL subsystem, which relies on the fact that it is OK + to destroy rwlock once it is in unlocked state. + */ + pthread_cond_signal(&rwlock->no_active_readers); + } + pthread_mutex_unlock(&rwlock->lock); + } + else + { + /* We are unlocking rd-lock. */ + pthread_mutex_lock(&rwlock->lock); + rwlock->active_readers--; + if (rwlock->active_readers == 0 && + rwlock->writers_waiting_readers) + { + /* + If we are last reader and there are waiting + writers wake them up. + */ + pthread_cond_signal(&rwlock->no_active_readers); + } + pthread_mutex_unlock(&rwlock->lock); + } + return 0; +} + + #endif /* defined(THREAD) */ diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 4fc5f3f9b0d..0c9177c79c5 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -139,6 +139,7 @@ ELSE() ENDIF() SET(HOSTNAME "hostname") +SET(MYSQLD_USER "mysql") # Required for mysqlbug until autotools are deprecated, once done remove these # and expand default cmake variables diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist index 4fb57b06d71..aa106a3dfc4 100755 --- a/scripts/make_win_bin_dist +++ b/scripts/make_win_bin_dist @@ -260,6 +260,7 @@ cp include/mysql.h \ include/keycache.h \ include/m_ctype.h \ include/my_attribute.h \ + include/my_compiler.h \ include/mysqld_error.h \ include/sql_state.h \ include/mysqld_ername.h \ diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 224cf67af7f..9d307da364d 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -271,8 +271,7 @@ IF(WIN32 AND MYSQLD_EXECUTABLE) COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data - COMMAND ${CMAKE_COMMAND} -E touch initdb.dep - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep DEPENDS mysqld ) ADD_CUSTOM_TARGET(initial_database diff --git a/sql/authors.h b/sql/authors.h index 5de2659f098..db0ab00fb86 100644 --- a/sql/authors.h +++ b/sql/authors.h @@ -93,6 +93,7 @@ struct show_table_authors_st show_table_authors[]= { { "Arjen Lentz", "Brisbane, Australia", "Documentation (2001-2004), Dutch error messages, LOG2()" }, { "Marc Liyanage", "", "Created Mac OS X packages" }, + { "Kelly Long", "Denver, CO, USA", "Pool Of Threads" }, { "Zarko Mocnik", "", "Sorting for Slovenian language" }, { "Per-Erik Martin", "Uppsala, Sweden", "Stored Procedures (5.0)" }, { "Alexis Mikhailov", "", "User-defined functions" }, diff --git a/sql/derror.cc b/sql/derror.cc index bf8c589a65f..db9cd3c0c58 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -35,6 +35,8 @@ static void init_myfunc_errs(void); C_MODE_START static const char **get_server_errmsgs() { + if (!current_thd) + return DEFAULT_ERRMSGS; return CURRENT_THD_ERRMSGS; } C_MODE_END diff --git a/sql/events.cc b/sql/events.cc index 10a7535425f..e7e47801586 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -485,10 +485,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, ret= TRUE; // OOM else if ((ret= db_repository->load_named_event(thd, dbname, name, new_element))) - { - DBUG_ASSERT(ret == OP_LOAD_ERROR); delete new_element; - } else { /* diff --git a/sql/events.h b/sql/events.h index 1482e736d29..f3ebc6da4ad 100644 --- a/sql/events.h +++ b/sql/events.h @@ -44,19 +44,6 @@ class THD; typedef class Item COND; typedef struct charset_info_st CHARSET_INFO; -/* Return codes */ -enum enum_events_error_code -{ - OP_OK= 0, - OP_NOT_RUNNING, - OP_CANT_KILL, - OP_CANT_INIT, - OP_DISABLED_EVENT, - OP_LOAD_ERROR, - OP_ALREADY_EXISTS -}; - - int sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs); diff --git a/sql/field.cc b/sql/field.cc index fc55426b177..be7441f6bfd 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1564,7 +1564,7 @@ void Field::make_field(Send_field *field) } else field->org_table_name= field->db_name= ""; - if (orig_table) + if (orig_table && orig_table->alias) { field->table_name= orig_table->alias; field->org_col_name= field_name; @@ -4189,6 +4189,7 @@ String *Field_float::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { ASSERT_COLUMN_MARKED_FOR_READ; + DBUG_ASSERT(field_length <= MAX_FIELD_CHARLENGTH); float nr; #ifdef WORDS_BIGENDIAN if (table->s->db_low_byte_first) @@ -4199,8 +4200,13 @@ String *Field_float::val_str(String *val_buffer, #endif memcpy(&nr, ptr, sizeof(nr)); - uint to_length=max(field_length,70); - val_buffer->alloc(to_length); + uint to_length= 70; + if (val_buffer->alloc(to_length)) + { + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return val_buffer; + } + char *to=(char*) val_buffer->ptr(); size_t len; @@ -4209,7 +4215,7 @@ String *Field_float::val_str(String *val_buffer, else { /* - We are safe here because the buffer length is >= 70, and + We are safe here because the buffer length is 70, and fabs(float) < 10^39, dec < NOT_FIXED_DEC. So the resulting string will be not longer than 69 chars + terminating '\0'. */ @@ -4506,6 +4512,7 @@ String *Field_double::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { ASSERT_COLUMN_MARKED_FOR_READ; + DBUG_ASSERT(field_length <= MAX_FIELD_CHARLENGTH); double nr; #ifdef WORDS_BIGENDIAN if (table->s->db_low_byte_first) @@ -4515,9 +4522,13 @@ String *Field_double::val_str(String *val_buffer, else #endif doubleget(nr,ptr); + uint to_length= DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE; + if (val_buffer->alloc(to_length)) + { + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return val_buffer; + } - uint to_length=max(field_length, DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE); - val_buffer->alloc(to_length); char *to=(char*) val_buffer->ptr(); size_t len; @@ -9104,7 +9115,7 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg, case MYSQL_TYPE_NEWDECIMAL: case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_DOUBLE: - pack_flag= FIELDFLAG_DECIMAL | FIELDFLAG_NUMBER | + pack_flag= FIELDFLAG_NUMBER | (decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT; break; @@ -9153,12 +9164,13 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg, (maybe_null ? FIELDFLAG_MAYBE_NULL : 0) | (is_unsigned ? 0 : FIELDFLAG_DECIMAL); - DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s, pack_type: %d", + DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s%s, pack_type: %d", FLAGSTR(pack_flag, FIELDFLAG_BINARY), FLAGSTR(pack_flag, FIELDFLAG_NUMBER), FLAGSTR(pack_flag, FIELDFLAG_INTERVAL), FLAGSTR(pack_flag, FIELDFLAG_GEOM), FLAGSTR(pack_flag, FIELDFLAG_BLOB), + FLAGSTR(pack_flag, FIELDFLAG_DECIMAL), f_packtype(pack_flag))); DBUG_VOID_RETURN; } diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 7891f658f45..d9f69a0b28d 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -231,6 +231,8 @@ void ha_partition::init_handler_variables() m_innodb= FALSE; m_extra_cache= FALSE; m_extra_cache_size= 0; + m_extra_prepare_for_update= FALSE; + m_extra_cache_part_id= NO_CURRENT_PART_ID; m_handler_status= handler_not_initialized; m_low_byte_first= 1; m_part_field_array= NULL; @@ -2446,9 +2448,14 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root) tot_partition_words= (m_tot_parts + 3) / 4; engine_array= (handlerton **) my_alloca(m_tot_parts * sizeof(handlerton*)); for (i= 0; i < m_tot_parts; i++) + { engine_array[i]= ha_resolve_by_legacy_type(ha_thd(), (enum legacy_db_type) - *(uchar *) ((file_buffer) + 12 + i)); + *(uchar *) ((file_buffer) + + 12 + i)); + if (!engine_array[i]) + goto err3; + } address_tot_name_len= file_buffer + 12 + 4 * tot_partition_words; tot_name_words= (uint4korr(address_tot_name_len) + 3) / 4; if (len_words != (tot_partition_words + tot_name_words + 4)) @@ -5510,9 +5517,6 @@ void ha_partition::get_dynamic_partition_info(PARTITION_STATS *stat_info, when performing the sequential scan we will check this recorded value and call extra_opt whenever we start scanning a new partition. - monty: Neads to be fixed so that it's passed to all handlers when we - move to another partition during table scan. - HA_EXTRA_NO_CACHE: When performing a UNION SELECT HA_EXTRA_NO_CACHE is called from the flush method in the select_union class. @@ -5524,7 +5528,7 @@ void ha_partition::get_dynamic_partition_info(PARTITION_STATS *stat_info, for. If no cache is in use they will quickly return after finding this out. And we also ensure that all caches are disabled and no one is left by mistake. - In the future this call will probably be deleted an we will instead call + In the future this call will probably be deleted and we will instead call ::reset(); HA_EXTRA_WRITE_CACHE: @@ -5536,8 +5540,9 @@ void ha_partition::get_dynamic_partition_info(PARTITION_STATS *stat_info, This is called as part of a multi-table update. When the table to be updated is also scanned then this informs MyISAM handler to drop any caches if dynamic records are used (fixed size records do not care - about this call). We pass this along to all underlying MyISAM handlers - and ignore it for the rest. + about this call). We pass this along to the first partition to scan, and + flag that it is to be called after HA_EXTRA_CACHE when moving to the next + partition to scan. HA_EXTRA_PREPARE_FOR_DROP: Only used by MyISAM, called in preparation for a DROP TABLE. @@ -5692,9 +5697,21 @@ int ha_partition::extra(enum ha_extra_function operation) case HA_EXTRA_PREPARE_FOR_RENAME: DBUG_RETURN(prepare_for_rename()); break; + case HA_EXTRA_PREPARE_FOR_UPDATE: + DBUG_ASSERT(m_extra_cache); + /* + Needs to be run on the first partition in the range now, and + later in late_extra_cache, when switching to a new partition to scan. + */ + m_extra_prepare_for_update= TRUE; + if (m_part_spec.start_part != NO_CURRENT_PART_ID) + { + DBUG_ASSERT(m_extra_cache_part_id == m_part_spec.start_part); + (void) m_file[m_part_spec.start_part]->extra(HA_EXTRA_PREPARE_FOR_UPDATE); + } + break; case HA_EXTRA_NORMAL: case HA_EXTRA_QUICK: - case HA_EXTRA_PREPARE_FOR_UPDATE: case HA_EXTRA_FORCE_REOPEN: case HA_EXTRA_PREPARE_FOR_DROP: case HA_EXTRA_FLUSH_CACHE: @@ -5717,10 +5734,22 @@ int ha_partition::extra(enum ha_extra_function operation) break; } case HA_EXTRA_NO_CACHE: + { + int ret= 0; + if (m_extra_cache_part_id != NO_CURRENT_PART_ID) + ret= m_file[m_extra_cache_part_id]->extra(HA_EXTRA_NO_CACHE); + m_extra_cache= FALSE; + m_extra_cache_size= 0; + m_extra_prepare_for_update= FALSE; + m_extra_cache_part_id= NO_CURRENT_PART_ID; + DBUG_RETURN(ret); + } case HA_EXTRA_WRITE_CACHE: { m_extra_cache= FALSE; m_extra_cache_size= 0; + m_extra_prepare_for_update= FALSE; + m_extra_cache_part_id= NO_CURRENT_PART_ID; DBUG_RETURN(loop_extra(operation)); } case HA_EXTRA_IGNORE_NO_KEY: @@ -5857,6 +5886,7 @@ int ha_partition::extra_opt(enum ha_extra_function operation, ulong cachesize) void ha_partition::prepare_extra_cache(uint cachesize) { DBUG_ENTER("ha_partition::prepare_extra_cache()"); + DBUG_PRINT("info", ("cachesize %u", cachesize)); m_extra_cache= TRUE; m_extra_cache_size= cachesize; @@ -5915,16 +5945,18 @@ int ha_partition::loop_extra(enum ha_extra_function operation) { int result= 0, tmp; handler **file; + bool is_select; DBUG_ENTER("ha_partition::loop_extra()"); - /* - TODO, 5.2: this is where you could possibly add optimisations to add the bitmap - _if_ a SELECT. - */ + is_select= (thd_sql_command(ha_thd()) == SQLCOM_SELECT); for (file= m_file; *file; file++) { - if ((tmp= (*file)->extra(operation))) - result= tmp; + if (!is_select || + bitmap_is_set(&(m_part_info->used_partitions), file - m_file)) + { + if ((tmp= (*file)->extra(operation))) + result= tmp; + } } DBUG_RETURN(result); } @@ -5945,14 +5977,22 @@ void ha_partition::late_extra_cache(uint partition_id) { handler *file; DBUG_ENTER("ha_partition::late_extra_cache"); + DBUG_PRINT("info", ("extra_cache %u partid %u size %u", m_extra_cache, + partition_id, m_extra_cache_size)); - if (!m_extra_cache) + if (!m_extra_cache && !m_extra_prepare_for_update) DBUG_VOID_RETURN; file= m_file[partition_id]; if (m_extra_cache_size == 0) (void) file->extra(HA_EXTRA_CACHE); else (void) file->extra_opt(HA_EXTRA_CACHE, m_extra_cache_size); + if (m_extra_prepare_for_update) + { + DBUG_ASSERT(m_extra_cache); + (void) file->extra(HA_EXTRA_PREPARE_FOR_UPDATE); + } + m_extra_cache_part_id= partition_id; DBUG_VOID_RETURN; } @@ -5973,10 +6013,12 @@ void ha_partition::late_extra_no_cache(uint partition_id) handler *file; DBUG_ENTER("ha_partition::late_extra_no_cache"); - if (!m_extra_cache) + if (!m_extra_cache && !m_extra_prepare_for_update) DBUG_VOID_RETURN; file= m_file[partition_id]; (void) file->extra(HA_EXTRA_NO_CACHE); + DBUG_ASSERT(partition_id == m_extra_cache_part_id); + m_extra_cache_part_id= NO_CURRENT_PART_ID; DBUG_VOID_RETURN; } diff --git a/sql/ha_partition.h b/sql/ha_partition.h index cfab2dde394..353e0d17159 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -137,6 +137,10 @@ private: */ bool m_extra_cache; uint m_extra_cache_size; + /* The same goes for HA_EXTRA_PREPARE_FOR_UPDATE */ + bool m_extra_prepare_for_update; + /* Which partition has active cache */ + uint m_extra_cache_part_id; void init_handler_variables(); /* diff --git a/sql/item.cc b/sql/item.cc index 24f57342668..e782e90b874 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -7287,14 +7287,16 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) enum_field_types field_type= field->type(); - if (field_type == MYSQL_TYPE_DATE || field_type == MYSQL_TYPE_DATETIME) + if (field_type == MYSQL_TYPE_DATE || field_type == MYSQL_TYPE_DATETIME || + field_type == MYSQL_TYPE_TIMESTAMP) { enum_mysql_timestamp_type type= MYSQL_TIMESTAMP_ERROR; if (field_type == MYSQL_TYPE_DATE) type= MYSQL_TIMESTAMP_DATE; - if (field_type == MYSQL_TYPE_DATETIME) + if (field_type == MYSQL_TYPE_DATETIME || + field_type == MYSQL_TYPE_TIMESTAMP) type= MYSQL_TIMESTAMP_DATETIME; const char *field_name= field->field_name; @@ -7510,9 +7512,14 @@ String *Item_cache_datetime::val_str(String *str) return NULL; if (cached_field_type == MYSQL_TYPE_TIME) { - ulonglong time= int_value; - DBUG_ASSERT(time <= TIME_MAX_VALUE); + longlong time= int_value; set_zero_time(<ime, MYSQL_TIMESTAMP_TIME); + if (time < 0) + { + time= -time; + ltime.neg= TRUE; + } + DBUG_ASSERT(time <= TIME_MAX_VALUE); ltime.second= time % 100; time/= 100; ltime.minute= time % 100; @@ -7845,9 +7852,12 @@ bool Item_cache_row::null_inside() void Item_cache_row::bring_value() { + if (!example) + return; + example->bring_value(); + null_value= example->null_value; for (uint i= 0; i < item_count; i++) values[i]->bring_value(); - return; } diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 641d3726aca..b7aad733e67 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1595,6 +1595,13 @@ int Arg_comparator::compare_row() bool was_null= 0; (*a)->bring_value(); (*b)->bring_value(); + + if ((*a)->null_value || (*b)->null_value) + { + owner->null_value= 1; + return -1; + } + uint n= (*a)->cols(); for (uint i= 0; i<n; i++) { @@ -1763,6 +1770,76 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref) } +/** + The implementation of optimized \<outer expression\> [NOT] IN \<subquery\> + predicates. The implementation works as follows. + + For the current value of the outer expression + + - If it contains only NULL values, the original (before rewrite by the + Item_in_subselect rewrite methods) inner subquery is non-correlated and + was previously executed, there is no need to re-execute it, and the + previous return value is returned. + + - If it contains NULL values, check if there is a partial match for the + inner query block by evaluating it. For clarity we repeat here the + transformation previously performed on the sub-query. The expression + + <tt> + ( oc_1, ..., oc_n ) + \<in predicate\> + ( SELECT ic_1, ..., ic_n + FROM \<table\> + WHERE \<inner where\> + ) + </tt> + + was transformed into + + <tt> + ( oc_1, ..., oc_n ) + \<in predicate\> + ( SELECT ic_1, ..., ic_n + FROM \<table\> + WHERE \<inner where\> AND ... ( ic_k = oc_k OR ic_k IS NULL ) + HAVING ... NOT ic_k IS NULL + ) + </tt> + + The evaluation will now proceed according to special rules set up + elsewhere. These rules include: + + - The HAVING NOT \<inner column\> IS NULL conditions added by the + aforementioned rewrite methods will detect whether they evaluated (and + rejected) a NULL value and if so, will cause the subquery to evaluate + to NULL. + + - The added WHERE and HAVING conditions are present only for those inner + columns that correspond to outer column that are not NULL at the moment. + + - If there is an eligible index for executing the subquery, the special + access method "Full scan on NULL key" is employed which ensures that + the inner query will detect if there are NULL values resulting from the + inner query. This access method will quietly resort to table scan if it + needs to find NULL values as well. + + - Under these conditions, the sub-query need only be evaluated in order to + find out whether it produced any rows. + + - If it did, we know that there was a partial match since there are + NULL values in the outer row expression. + + - If it did not, the result is FALSE or UNKNOWN. If at least one of the + HAVING sub-predicates rejected a NULL value corresponding to an outer + non-NULL, and hence the inner query block returns UNKNOWN upon + evaluation, there was a partial match and the result is UNKNOWN. + + - If it contains no NULL values, the call is forwarded to the inner query + block. + + @see Item_in_subselect::val_bool() + @see Item_is_not_null_test::val_int() + */ longlong Item_in_optimizer::val_int() { bool tmp; @@ -1816,7 +1893,7 @@ longlong Item_in_optimizer::val_int() all_left_cols_null= false; } - if (!((Item_in_subselect*)args[1])->is_correlated && + if (!item_subs->is_correlated && all_left_cols_null && result_for_null_param != UNKNOWN) { /* @@ -1830,8 +1907,11 @@ longlong Item_in_optimizer::val_int() else { /* The subquery has to be evaluated */ - (void) args[1]->val_bool_result(); - null_value= !item_subs->engine->no_rows(); + (void) item_subs->val_bool_result(); + if (item_subs->engine->no_rows()) + null_value= item_subs->null_value; + else + null_value= TRUE; if (all_left_cols_null) result_for_null_param= null_value; } @@ -2560,27 +2640,30 @@ Item_func_if::fix_length_and_dec() cached_result_type= arg2_type; collation.set(args[2]->collation.collation); cached_field_type= args[2]->field_type(); + max_length= args[2]->max_length; + return; } - else if (null2) + + if (null2) { cached_result_type= arg1_type; collation.set(args[1]->collation.collation); cached_field_type= args[1]->field_type(); + max_length= args[1]->max_length; + return; + } + + agg_result_type(&cached_result_type, args + 1, 2); + if (cached_result_type == STRING_RESULT) + { + if (agg_arg_charsets_for_string_result(collation, args + 1, 2)) + return; } else { - agg_result_type(&cached_result_type, args+1, 2); - if (cached_result_type == STRING_RESULT) - { - if (agg_arg_charsets_for_string_result(collation, args + 1, 2)) - return; - } - else - { - collation.set_numeric(); // Number - } - cached_field_type= agg_field_type(args + 1, 2); + collation.set_numeric(); // Number } + cached_field_type= agg_field_type(args + 1, 2); uint32 char_length; if ((cached_result_type == DECIMAL_RESULT ) diff --git a/sql/item_func.cc b/sql/item_func.cc index 95965668882..7906ed71bc7 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2533,6 +2533,8 @@ void Item_func_min_max::fix_length_and_dec() decimals, unsigned_flag)); } + else if (cmp_type == REAL_RESULT) + fix_char_length(float_length(decimals)); cached_field_type= agg_field_type(args, arg_count); } @@ -2551,7 +2553,7 @@ void Item_func_min_max::fix_length_and_dec() stored to the value pointer, if latter is provided. RETURN - 0 If one of arguments is NULL + 0 If one of arguments is NULL or there was a execution error # index of the least/greatest argument */ @@ -2565,6 +2567,14 @@ uint Item_func_min_max::cmp_datetimes(ulonglong *value) Item **arg= args + i; bool is_null; longlong res= get_datetime_value(thd, &arg, 0, datetime_item, &is_null); + + /* Check if we need to stop (because of error or KILL) and stop the loop */ + if (thd->is_error()) + { + null_value= 1; + return 0; + } + if ((null_value= args[i]->null_value)) return 0; if (i == 0 || (res < min_max ? cmp_sign : -cmp_sign) > 0) @@ -2593,6 +2603,12 @@ String *Item_func_min_max::val_str(String *str) if (null_value) return 0; str_res= args[min_max_idx]->val_str(str); + if (args[min_max_idx]->null_value) + { + // check if the call to val_str() above returns a NULL value + null_value= 1; + return NULL; + } str_res->set_charset(collation.collation); return str_res; } @@ -4621,6 +4637,14 @@ longlong Item_func_set_user_var::val_int_result() return entry->val_int(&null_value); } +bool Item_func_set_user_var::val_bool_result() +{ + DBUG_ASSERT(fixed == 1); + check(TRUE); + update(); // Store expression + return entry->val_int(&null_value) != 0; +} + String *Item_func_set_user_var::str_result(String *str) { DBUG_ASSERT(fixed == 1); @@ -4999,7 +5023,7 @@ void Item_func_get_user_var::fix_length_and_dec() decimals=0; break; case STRING_RESULT: - max_length= MAX_BLOB_WIDTH; + max_length= MAX_BLOB_WIDTH - 1; break; case DECIMAL_RESULT: fix_char_length(DECIMAL_MAX_STR_LENGTH); diff --git a/sql/item_func.h b/sql/item_func.h index 834ecd60e21..15730516c71 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1416,6 +1416,7 @@ public: my_decimal *val_decimal(my_decimal *); double val_result(); longlong val_int_result(); + bool val_bool_result(); String *str_result(String *str); my_decimal *val_decimal_result(my_decimal *); bool is_null_result(); diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 25755de1e2c..84034841ad5 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -179,6 +179,21 @@ public: item_type=it; } String *val_str(String *); + void fix_length_and_dec() + { + for (unsigned int i= 0; i < arg_count; ++i) + { + if (args[i]->fixed && args[i]->field_type() != MYSQL_TYPE_GEOMETRY) + { + String str; + args[i]->print(&str, QT_ORDINARY); + str.append('\0'); + my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "non geometric", + str.ptr()); + } + } + } + const char *func_name() const { return "multipoint"; } }; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 809926338af..56bd8c75a20 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -55,7 +55,7 @@ Item_subselect::Item_subselect(): item value is NULL if select_subselect not changed this value (i.e. some rows will be found returned) */ - null_value= 1; + null_value= TRUE; } @@ -435,9 +435,9 @@ void Item_maxmin_subselect::print(String *str, enum_query_type query_type) void Item_singlerow_subselect::reset() { - null_value= 1; + null_value= TRUE; if (value) - value->null_value= 1; + value->null_value= TRUE; } @@ -574,7 +574,10 @@ bool Item_singlerow_subselect::null_inside() void Item_singlerow_subselect::bring_value() { - exec(); + if (!exec() && assigned()) + null_value= 0; + else + reset(); } double Item_singlerow_subselect::val_real() @@ -582,7 +585,7 @@ double Item_singlerow_subselect::val_real() DBUG_ASSERT(fixed == 1); if (!exec() && !value->null_value) { - null_value= 0; + null_value= FALSE; return value->val_real(); } else @@ -597,7 +600,7 @@ longlong Item_singlerow_subselect::val_int() DBUG_ASSERT(fixed == 1); if (!exec() && !value->null_value) { - null_value= 0; + null_value= FALSE; return value->val_int(); } else @@ -611,7 +614,7 @@ String *Item_singlerow_subselect::val_str(String *str) { if (!exec() && !value->null_value) { - null_value= 0; + null_value= FALSE; return value->val_str(str); } else @@ -626,7 +629,7 @@ my_decimal *Item_singlerow_subselect::val_decimal(my_decimal *decimal_value) { if (!exec() && !value->null_value) { - null_value= 0; + null_value= FALSE; return value->val_decimal(decimal_value); } else @@ -641,7 +644,7 @@ bool Item_singlerow_subselect::val_bool() { if (!exec() && !value->null_value) { - null_value= 0; + null_value= FALSE; return value->val_bool(); } else @@ -659,7 +662,7 @@ Item_exists_subselect::Item_exists_subselect(st_select_lex *select_lex): bool val_bool(); init(select_lex, new select_exists_subselect(this)); max_columns= UINT_MAX; - null_value= 0; //can't be NULL + null_value= FALSE; //can't be NULL maybe_null= 0; //can't be NULL value= 0; DBUG_VOID_RETURN; @@ -822,15 +825,14 @@ double Item_in_subselect::val_real() */ DBUG_ASSERT(0); DBUG_ASSERT(fixed == 1); - null_value= 0; + null_value= was_null= FALSE; if (exec()) { reset(); - null_value= 1; return 0; } if (was_null && !value) - null_value= 1; + null_value= TRUE; return (double) value; } @@ -843,15 +845,14 @@ longlong Item_in_subselect::val_int() */ DBUG_ASSERT(0); DBUG_ASSERT(fixed == 1); - null_value= 0; + null_value= was_null= FALSE; if (exec()) { reset(); - null_value= 1; return 0; } if (was_null && !value) - null_value= 1; + null_value= TRUE; return value; } @@ -864,16 +865,15 @@ String *Item_in_subselect::val_str(String *str) */ DBUG_ASSERT(0); DBUG_ASSERT(fixed == 1); - null_value= 0; + null_value= was_null= FALSE; if (exec()) { reset(); - null_value= 1; return 0; } if (was_null && !value) { - null_value= 1; + null_value= TRUE; return 0; } str->set((ulonglong)value, &my_charset_bin); @@ -884,20 +884,14 @@ String *Item_in_subselect::val_str(String *str) bool Item_in_subselect::val_bool() { DBUG_ASSERT(fixed == 1); - null_value= 0; + null_value= was_null= FALSE; if (exec()) { reset(); - /* - Must mark the IN predicate as NULL so as to make sure an enclosing NOT - predicate will return FALSE. See the comments in - subselect_uniquesubquery_engine::copy_ref_key for further details. - */ - null_value= 1; return 0; } if (was_null && !value) - null_value= 1; + null_value= TRUE; return value; } @@ -908,16 +902,15 @@ my_decimal *Item_in_subselect::val_decimal(my_decimal *decimal_value) method should not be used */ DBUG_ASSERT(0); - null_value= 0; + null_value= was_null= FALSE; DBUG_ASSERT(fixed == 1); if (exec()) { reset(); - null_value= 1; return 0; } if (was_null && !value) - null_value= 1; + null_value= TRUE; int2my_decimal(E_DEC_FATAL_ERROR, value, 0, decimal_value); return decimal_value; } diff --git a/sql/item_sum.cc b/sql/item_sum.cc index b05d845dead..b6e5d6d3182 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -434,26 +434,6 @@ void Item_sum::mark_as_sum_func() } -void Item_sum::make_field(Send_field *tmp_field) -{ - if (args[0]->type() == Item::FIELD_ITEM && keep_field_type()) - { - ((Item_field*) args[0])->field->make_field(tmp_field); - /* For expressions only col_name should be non-empty string. */ - char *empty_string= (char*)""; - tmp_field->db_name= empty_string; - tmp_field->org_table_name= empty_string; - tmp_field->table_name= empty_string; - tmp_field->org_col_name= empty_string; - tmp_field->col_name= name; - if (maybe_null) - tmp_field->flags&= ~NOT_NULL_FLAG; - } - else - init_make_field(tmp_field, field_type()); -} - - void Item_sum::print(String *str, enum_query_type query_type) { /* orig_args is not filled with valid values until fix_fields() */ @@ -984,7 +964,8 @@ bool Aggregator_distinct::add() { int error; copy_fields(tmp_table_param); - copy_funcs(tmp_table_param->items_to_copy); + if (copy_funcs(tmp_table_param->items_to_copy, table->in_use)) + return TRUE; for (Field **field=table->field ; *field ; field++) if ((*field)->is_real_null(0)) @@ -3058,7 +3039,6 @@ Item_func_group_concat::Item_func_group_concat(THD *thd, tree(item->tree), unique_filter(item->unique_filter), table(item->table), - order(item->order), context(item->context), arg_count_order(item->arg_count_order), arg_count_field(item->arg_count_field), @@ -3071,6 +3051,24 @@ Item_func_group_concat::Item_func_group_concat(THD *thd, { quick_group= item->quick_group; result.set_charset(collation.collation); + + /* + Since the ORDER structures pointed to by the elements of the 'order' array + may be modified in find_order_in_list() called from + Item_func_group_concat::setup(), create a copy of those structures so that + such modifications done in this object would not have any effect on the + object being copied. + */ + ORDER *tmp; + if (!(order= (ORDER **) thd->alloc(sizeof(ORDER *) * arg_count_order + + sizeof(ORDER) * arg_count_order))) + return; + tmp= (ORDER *)(order + arg_count_order); + for (uint i= 0; i < arg_count_order; i++, tmp++) + { + memcpy(tmp, item->order[i], sizeof(ORDER)); + order[i]= tmp; + } } @@ -3136,7 +3134,8 @@ bool Item_func_group_concat::add() if (always_null) return 0; copy_fields(tmp_table_param); - copy_funcs(tmp_table_param->items_to_copy); + if (copy_funcs(tmp_table_param->items_to_copy, table->in_use)) + return TRUE; for (uint i= 0; i < arg_count_field; i++) { diff --git a/sql/item_sum.h b/sql/item_sum.h index 2a722b93165..06a8c2c58a4 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -427,7 +427,6 @@ public: forced_const= TRUE; } virtual bool const_item() const { return forced_const; } - void make_field(Send_field *field); virtual void print(String *str, enum_query_type query_type); void fix_num_length_and_dec(); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 1c2c1cfe512..cc363398fdd 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -3368,6 +3368,8 @@ void Item_func_str_to_date::fix_length_and_dec() cached_field_type= MYSQL_TYPE_DATETIME; max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; cached_timestamp_type= MYSQL_TIMESTAMP_NONE; + sql_mode= (current_thd->variables.sql_mode & + (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE)); if ((const_item= args[1]->const_item())) { char format_buff[64]; @@ -3433,6 +3435,14 @@ bool Item_func_str_to_date::get_date(MYSQL_TIME *ltime, uint fuzzy_date) return 0; null_date: + if (fuzzy_date & TIME_NO_ZERO_DATE) + { + char buff[128]; + strmake(buff, val->ptr(), min(val->length(), sizeof(buff)-1)); + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WRONG_VALUE_FOR_TYPE, ER(ER_WRONG_VALUE_FOR_TYPE), + "datetime", buff, "str_to_date"); + } return (null_value=1); } @@ -3442,7 +3452,7 @@ String *Item_func_str_to_date::val_str(String *str) DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - if (Item_func_str_to_date::get_date(<ime, TIME_FUZZY_DATE)) + if (Item_func_str_to_date::get_date(<ime, TIME_FUZZY_DATE | sql_mode)) return 0; if (!make_datetime((const_item ? cached_format_type : @@ -3453,6 +3463,29 @@ String *Item_func_str_to_date::val_str(String *str) } +longlong Item_func_str_to_date::val_int() +{ + DBUG_ASSERT(fixed == 1); + MYSQL_TIME ltime; + + if (Item_func_str_to_date::get_date(<ime, TIME_FUZZY_DATE | sql_mode)) + return 0; + + if (const_item) + { + switch (cached_field_type) { + case MYSQL_TYPE_DATE: + return TIME_to_ulonglong_date(<ime); + case MYSQL_TYPE_TIME: + return TIME_to_ulonglong_time(<ime); + default: + return TIME_to_ulonglong_datetime(<ime); + } + } + return TIME_to_ulonglong_datetime(<ime); +} + + bool Item_func_last_day::get_date(MYSQL_TIME *ltime, uint fuzzy_date) { if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE) || diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 2c08853fda4..6e31b5c6705 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -1039,6 +1039,7 @@ class Item_func_str_to_date :public Item_str_func date_time_format_types cached_format_type; timestamp_type cached_timestamp_type; bool const_item; + ulonglong sql_mode; public: Item_func_str_to_date(Item *a, Item *b) :Item_str_func(a, b), const_item(false) @@ -1052,6 +1053,8 @@ public: { return tmp_table_field_from_field_type(table, 1); } + longlong val_int(); + bool result_as_longlong() { return TRUE; } }; diff --git a/sql/log.cc b/sql/log.cc index 5ca22d154b1..0e15c3b8e79 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1907,7 +1907,9 @@ static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv) String log_query; if (log_query.append(STRING_WITH_LEN("SAVEPOINT ")) || - log_query.append(thd->lex->ident.str, thd->lex->ident.length)) + log_query.append("`") || + log_query.append(thd->lex->ident.str, thd->lex->ident.length) || + log_query.append("`")) DBUG_RETURN(1); int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(), @@ -1929,7 +1931,9 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv) { String log_query; if (log_query.append(STRING_WITH_LEN("ROLLBACK TO ")) || - log_query.append(thd->lex->ident.str, thd->lex->ident.length)) + log_query.append("`") || + log_query.append(thd->lex->ident.str, thd->lex->ident.length) || + log_query.append("`")) DBUG_RETURN(1); int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(), @@ -5284,11 +5288,8 @@ int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd, const struct timespec *timeout) { int ret= 0; - const char* old_msg = thd->proc_info; DBUG_ENTER("wait_for_update_bin_log"); - old_msg= thd->enter_cond(&update_cond, &LOCK_log, - "Master has sent all binlog to slave; " - "waiting for binlog to be updated"); + if (!timeout) mysql_cond_wait(&update_cond, &LOCK_log); else @@ -5447,70 +5448,107 @@ void sql_perror(const char *message) } +#ifdef __WIN__ +extern "C" my_bool reopen_fstreams(const char *filename, + FILE *outstream, FILE *errstream) +{ + int handle_fd; + int err_fd, out_fd; + HANDLE osfh; + + DBUG_ASSERT(filename && errstream); + + // Services don't have stdout/stderr on Windows, so _fileno returns -1. + err_fd= _fileno(errstream); + if (err_fd < 0) + { + if (!freopen(filename, "a+", errstream)) + return TRUE; + + setbuf(errstream, NULL); + err_fd= _fileno(errstream); + } + + if (outstream) + { + out_fd= _fileno(outstream); + if (out_fd < 0) + { + if (!freopen(filename, "a+", outstream)) + return TRUE; + out_fd= _fileno(outstream); + } + } + + if ((osfh= CreateFile(filename, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE | + FILE_SHARE_DELETE, NULL, + OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, + NULL)) == INVALID_HANDLE_VALUE) + return TRUE; + + if ((handle_fd= _open_osfhandle((intptr_t)osfh, + _O_APPEND | _O_TEXT)) == -1) + { + CloseHandle(osfh); + return TRUE; + } + + if (_dup2(handle_fd, err_fd) < 0) + { + CloseHandle(osfh); + return TRUE; + } + + if (outstream && _dup2(handle_fd, out_fd) < 0) + { + CloseHandle(osfh); + return TRUE; + } + + _close(handle_fd); + return FALSE; +} +#else +extern "C" my_bool reopen_fstreams(const char *filename, + FILE *outstream, FILE *errstream) +{ + if (outstream && !freopen(filename, "a+", outstream)) + return TRUE; + + if (errstream && !freopen(filename, "a+", errstream)) + return TRUE; + + return FALSE; +} +#endif + + /* Unfortunately, there seems to be no good way to restore the original streams upon failure. */ static bool redirect_std_streams(const char *file) { - if (freopen(file, "a+", stdout) && freopen(file, "a+", stderr)) - { - setbuf(stderr, NULL); - return FALSE; - } + if (reopen_fstreams(file, stdout, stderr)) + return TRUE; - return TRUE; + setbuf(stderr, NULL); + return FALSE; } bool flush_error_log() { - bool result=0; + bool result= 0; if (opt_error_log) { - char err_renamed[FN_REFLEN], *end; - end= strmake(err_renamed,log_error_file,FN_REFLEN-5); - strmov(end, "-old"); mysql_mutex_lock(&LOCK_error_log); -#ifdef __WIN__ - char err_temp[FN_REFLEN+5]; - /* - On Windows is necessary a temporary file for to rename - the current error file. - */ - strxmov(err_temp, err_renamed,"-tmp",NullS); - my_delete(err_temp, MYF(0)); - if (freopen(err_temp,"a+",stdout)) - { - int fd; - size_t bytes; - uchar buf[IO_SIZE]; - - freopen(err_temp,"a+",stderr); - setbuf(stderr, NULL); - my_delete(err_renamed, MYF(0)); - my_rename(log_error_file, err_renamed, MYF(0)); - redirect_std_streams(log_error_file); - - if ((fd= my_open(err_temp, O_RDONLY, MYF(0))) >= 0) - { - while ((bytes= mysql_file_read(fd, buf, IO_SIZE, MYF(0))) && - bytes != MY_FILE_ERROR) - my_fwrite(stderr, buf, bytes, MYF(0)); - mysql_file_close(fd, MYF(0)); - } - my_delete(err_temp, MYF(0)); - } - else - result= 1; -#else - my_rename(log_error_file, err_renamed, MYF(0)); - if (redirect_std_streams(log_error_file)) - result= 1; -#endif + if (redirect_std_streams(log_error_file)) + result= 1; mysql_mutex_unlock(&LOCK_error_log); } - return result; + return result; } void MYSQL_BIN_LOG::signal_update() diff --git a/sql/log.h b/sql/log.h index 6e87b6cbade..89b3594cd1e 100644 --- a/sql/log.h +++ b/sql/log.h @@ -394,7 +394,7 @@ public: /* Use this to start writing a new log file */ void new_file(); - bool write(Log_event* event_info); + bool write(Log_event* event_info); // binary log write bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident); bool write_incident(THD *thd, bool lock); @@ -460,6 +460,7 @@ public: inline char* get_log_fname() { return log_file_name; } inline char* get_name() { return name; } inline mysql_mutex_t* get_log_lock() { return &LOCK_log; } + inline mysql_cond_t* get_log_cond() { return &update_cond; } inline IO_CACHE* get_log_file() { return &log_file; } inline void lock_index() { mysql_mutex_lock(&LOCK_index);} diff --git a/sql/log_event.cc b/sql/log_event.cc index c1f7836e08a..16290c58685 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -674,7 +674,8 @@ const char* Log_event::get_type_str() #ifndef MYSQL_CLIENT Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans) - :log_pos(0), temp_buf(0), exec_time(0), flags(flags_arg), thd(thd_arg) + :log_pos(0), temp_buf(0), exec_time(0), flags(flags_arg), + cache_type(Log_event::EVENT_INVALID_CACHE), thd(thd_arg) { server_id= thd->server_id; when= thd->start_time; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 0cd3ecdf47d..af98ed91adf 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -64,7 +64,9 @@ #include "events.h" #include "sql_audit.h" #include "probes_mysql.h" +#include "scheduler.h" #include "debug_sync.h" +#include "sql_callback.h" #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE #include "../storage/perfschema/pfs_server.h" @@ -193,6 +195,9 @@ typedef fp_except fp_except_t; # endif #endif +extern "C" my_bool reopen_fstreams(const char *filename, + FILE *outstream, FILE *errstream); + inline void setup_fpu() { #if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) @@ -456,7 +461,7 @@ ulong slave_trans_retries; uint slave_net_timeout; ulong slave_exec_mode_options; ulonglong slave_type_conversions_options; -ulong thread_cache_size=0, thread_pool_size= 0; +ulong thread_cache_size=0; ulong binlog_cache_size=0; ulonglong max_binlog_cache_size=0; ulong query_cache_size=0; @@ -898,8 +903,6 @@ my_bool opt_enable_shared_memory; HANDLE smem_event_connect_request= 0; #endif -scheduler_functions thread_scheduler; - my_bool opt_use_ssl = 0; char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL, *opt_ssl_cipher= NULL, *opt_ssl_key= NULL; @@ -1087,7 +1090,8 @@ static void close_connections(void) continue; tmp->killed= THD::KILL_CONNECTION; - thread_scheduler.post_kill_notification(tmp); + MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (tmp)); + mysql_mutex_lock(&tmp->LOCK_thd_data); if (tmp->mysys_var) { tmp->mysys_var->abort=1; @@ -1100,6 +1104,7 @@ static void close_connections(void) } mysql_mutex_unlock(&tmp->mysys_var->mutex); } + mysql_mutex_unlock(&tmp->LOCK_thd_data); } mysql_mutex_unlock(&LOCK_thread_count); // For unlink from list @@ -1390,6 +1395,12 @@ static void mysqld_exit(int exit_code) mysql_audit_finalize(); clean_up_mutexes(); clean_up_error_log_mutex(); +#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE + /* + Bug#56666 needs to be fixed before calling: + shutdown_performance_schema(); + */ +#endif my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); exit(exit_code); /* purecov: inspected */ } @@ -1479,8 +1490,9 @@ void clean_up(bool print_message) if (print_message && my_default_lc_messages && server_start_time) sql_print_information(ER_DEFAULT(ER_SHUTDOWN_COMPLETE),my_progname); cleanup_errmsgs(); - thread_scheduler.end(); + MYSQL_CALLBACK(thread_scheduler, end, ()); finish_client_errs(); + (void) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST); // finish server errs DBUG_PRINT("quit", ("Error messages freed")); /* Tell main we are ready */ logger.cleanup_end(); @@ -1752,7 +1764,7 @@ static void network_init(void) DBUG_ENTER("network_init"); LINT_INIT(ret); - if (thread_scheduler.init()) + if (MYSQL_CALLBACK_ELSE(thread_scheduler, init, (), 0)) unireg_abort(1); /* purecov: inspected */ set_ports(); @@ -2000,7 +2012,7 @@ extern "C" sig_handler end_thread_signal(int sig __attribute__((unused))) if (thd && ! thd->bootstrap) { statistic_increment(killed_threads, &LOCK_status); - thread_scheduler.end_thread(thd,0); /* purecov: inspected */ + MYSQL_CALLBACK(thread_scheduler, end_thread, (thd,0)); /* purecov: inspected */ } DBUG_VOID_RETURN; /* purecov: deadcode */ } @@ -2396,7 +2408,7 @@ and this may fail.\n\n"); (ulong) dflt_key_cache->key_cache_mem_size); fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size); fprintf(stderr, "max_used_connections=%lu\n", max_used_connections); - fprintf(stderr, "max_threads=%u\n", thread_scheduler.max_threads); + fprintf(stderr, "max_threads=%u\n", thread_scheduler->max_threads); fprintf(stderr, "thread_count=%u\n", thread_count); fprintf(stderr, "connection_count=%u\n", connection_count); fprintf(stderr, "It is possible that mysqld could use up to \n\ @@ -2404,7 +2416,7 @@ key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = %lu K\n\ bytes of memory\n", ((ulong) dflt_key_cache->key_cache_mem_size + (global_system_variables.read_buff_size + global_system_variables.sortbuff_size) * - thread_scheduler.max_threads + + thread_scheduler->max_threads + max_connections * sizeof(THD)) / 1024); fprintf(stderr, "Hope that's ok; if not, decrease some variables in the equation.\n\n"); @@ -2651,7 +2663,7 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) This should actually be '+ max_number_of_slaves' instead of +10, but the +10 should be quite safe. */ - init_thr_alarm(thread_scheduler.max_threads + + init_thr_alarm(thread_scheduler->max_threads + global_system_variables.max_insert_delayed_threads + 10); if (thd_lib_detected != THD_LIB_LT && (test_flags & TEST_SIGINT)) { @@ -2727,6 +2739,11 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) if (!abort_loop) { abort_loop=1; // mark abort for threads +#ifdef HAVE_PSI_INTERFACE + /* Delete the instrumentation for the signal thread */ + if (likely(PSI_server != NULL)) + PSI_server->delete_current_thread(); +#endif #ifdef USE_ONE_SIGNAL_HAND pthread_t tmp; if (mysql_thread_create(0, /* Not instrumented */ @@ -3738,13 +3755,15 @@ static int init_server_components() opt_error_log= 0; // Too long file name else { + my_bool res; #ifndef EMBEDDED_LIBRARY - if (freopen(log_error_file, "a+", stdout)) + res= reopen_fstreams(log_error_file, stdout, stderr); +#else + res= reopen_fstreams(log_error_file, NULL, stderr); #endif - { - if (freopen(log_error_file, "a+", stderr)) - setbuf(stderr, NULL); - } + + if (!res) + setbuf(stderr, NULL); } } @@ -4353,23 +4372,6 @@ int mysqld_main(int argc, char **argv) } #endif -#ifdef __WIN__ - /* - Before performing any socket operation (like retrieving hostname - in init_common_variables we have to call WSAStartup - */ - { - WSADATA WsaData; - if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData)) - { - /* errors are not read yet, so we use english text here */ - my_message(ER_WSAS_FAILED, "WSAStartup Failed", MYF(0)); - /* Not enough initializations for unireg_abort() */ - return 1; - } - } -#endif /* __WIN__ */ - if (init_common_variables()) unireg_abort(1); // Will do exit @@ -4457,8 +4459,8 @@ int mysqld_main(int argc, char **argv) #ifdef __WIN__ if (!opt_console) { - freopen(log_error_file,"a+",stdout); - freopen(log_error_file,"a+",stderr); + if (reopen_fstreams(log_error_file, stdout, stderr)) + unireg_abort(1); setbuf(stderr, NULL); FreeConsole(); // Remove window } @@ -4597,6 +4599,15 @@ int mysqld_main(int argc, char **argv) #endif #endif /* __WIN__ */ +#ifdef HAVE_PSI_INTERFACE + /* + Disable the main thread instrumentation, + to avoid recording events during the shutdown. + */ + if (PSI_server) + PSI_server->delete_current_thread(); +#endif + /* Wait until cleanup is done */ mysql_mutex_lock(&LOCK_thread_count); while (!ready_to_exit) @@ -4614,18 +4625,6 @@ int mysqld_main(int argc, char **argv) } #endif clean_up(1); -#ifdef HAVE_PSI_INTERFACE - /* - Disable the instrumentation, to avoid recording events - during the shutdown. - */ - if (PSI_server) - { - PSI_server->delete_current_thread(); - PSI_server= NULL; - } - shutdown_performance_schema(); -#endif mysqld_exit(0); } @@ -5028,7 +5027,7 @@ static void create_new_thread(THD *thd) thread_count++; - thread_scheduler.add_connection(thd); + MYSQL_CALLBACK(thread_scheduler, add_connection, (thd)); DBUG_VOID_RETURN; } @@ -6439,6 +6438,7 @@ SHOW_VAR status_vars[]= { {"Handler_prepare", (char*) offsetof(STATUS_VAR, ha_prepare_count), SHOW_LONG_STATUS}, {"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONG_STATUS}, {"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONG_STATUS}, + {"Handler_read_last", (char*) offsetof(STATUS_VAR, ha_read_last_count), SHOW_LONG_STATUS}, {"Handler_read_next", (char*) offsetof(STATUS_VAR, ha_read_next_count), SHOW_LONG_STATUS}, {"Handler_read_prev", (char*) offsetof(STATUS_VAR, ha_read_prev_count), SHOW_LONG_STATUS}, {"Handler_read_rnd", (char*) offsetof(STATUS_VAR, ha_read_rnd_count), SHOW_LONG_STATUS}, @@ -7343,14 +7343,12 @@ static int get_options(int *argc_ptr, char ***argv_ptr) return 1; #ifdef EMBEDDED_LIBRARY - one_thread_scheduler(&thread_scheduler); + one_thread_scheduler(); #else if (thread_handling <= SCHEDULER_ONE_THREAD_PER_CONNECTION) - one_thread_per_connection_scheduler(&thread_scheduler); - else if (thread_handling == SCHEDULER_NO_THREADS) - one_thread_scheduler(&thread_scheduler); - else - pool_of_threads_scheduler(&thread_scheduler); /* purecov: tested */ + one_thread_per_connection_scheduler(); + else /* thread_handling == SCHEDULER_NO_THREADS) */ + one_thread_scheduler(); #endif global_system_variables.engine_condition_pushdown= diff --git a/sql/mysqld.h b/sql/mysqld.h index 71b52416302..6e81c240f7d 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -28,7 +28,7 @@ class THD; struct handlerton; class Time_zone; -class scheduler_functions; +struct scheduler_functions; typedef struct st_mysql_const_lex_string LEX_CSTRING; typedef struct st_mysql_show_var SHOW_VAR; @@ -175,7 +175,7 @@ extern ulong binlog_cache_size, open_files_limit; extern ulonglong max_binlog_cache_size; extern ulong max_binlog_size, max_relay_log_size; extern ulong opt_binlog_rows_event_max_size; -extern ulong rpl_recovery_rank, thread_cache_size, thread_pool_size; +extern ulong rpl_recovery_rank, thread_cache_size; extern ulong back_log; extern char language[FN_REFLEN]; extern ulong server_id, concurrency; @@ -207,7 +207,7 @@ extern my_bool old_mode; extern LEX_STRING opt_init_connect, opt_init_slave; extern int bootstrap_error; extern I_List<THD> threads; -extern scheduler_functions thread_scheduler; +extern char err_shared_dir[]; extern TYPELIB thread_handling_typelib; extern my_decimal decimal_zero; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 6f0b7a817ca..488e27296b6 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -164,7 +164,17 @@ my_bool net_realloc(NET *net, size_t length) DBUG_ENTER("net_realloc"); DBUG_PRINT("enter",("length: %lu", (ulong) length)); - if (length >= net->max_packet_size) + /* + When compression is off, net->where_b is always 0. + With compression turned on, net->where_b may indicate + that we still have a piece of the previous logical + packet in the buffer, unprocessed. Take it into account + when checking that max_allowed_packet is not exceeded. + This ensures that the client treats max_allowed_packet + limit identically, regardless of compression being on + or off. + */ + if (length >= (net->max_packet_size + net->where_b)) { DBUG_PRINT("error", ("Packet too large. Max size: %lu", net->max_packet_size)); diff --git a/sql/opt_range.cc b/sql/opt_range.cc index af5b4b7c7d6..ffff9e3f6c8 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -5620,7 +5620,11 @@ static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond) SEL_TREE *tmp= get_full_func_mm_tree(param, cond_func, field_item, (Item*)(intptr)i, inv); if (inv) + { tree= !tree ? tmp : tree_or(param, tree, tmp); + if (tree == NULL) + break; + } else tree= tree_and(param, tree, tmp); } @@ -8546,9 +8550,14 @@ int QUICK_RANGE_SELECT::reset() in_range= FALSE; cur_range= (QUICK_RANGE**) ranges.buffer; - if (file->inited == handler::NONE && (error= file->ha_index_init(index,1))) - DBUG_RETURN(error); - + if (file->inited == handler::NONE) + { + if (in_ror_merged_scan) + head->column_bitmaps_set_no_signal(&column_bitmap, &column_bitmap); + if ((error= file->ha_index_init(index,1))) + DBUG_RETURN(error); + } + /* Do not allocate the buffers twice. */ if (multi_range_length) { diff --git a/sql/scheduler.cc b/sql/scheduler.cc index 10009246428..d61a452b99e 100644 --- a/sql/scheduler.cc +++ b/sql/scheduler.cc @@ -25,55 +25,103 @@ #include "unireg.h" // REQUIRED: for other includes #include "scheduler.h" #include "sql_connect.h" // init_new_connection_handler_thread +#include "scheduler.h" +#include "sql_callback.h" /* - 'Dummy' functions to be used when we don't need any handling for a scheduler - event - */ + End connection, in case when we are using 'no-threads' +*/ -static bool init_dummy(void) {return 0;} -static void post_kill_dummy(THD* thd) {} -static void end_dummy(void) {} -static bool end_thread_dummy(THD *thd, bool cache_thread) { return 0; } +static bool no_threads_end(THD *thd, bool put_in_cache) +{ + unlink_thd(thd); + mysql_mutex_unlock(&LOCK_thread_count); + return 1; // Abort handle_one_connection +} -/* - Initialize default scheduler with dummy functions so that setup functions - only need to declare those that are relvant for their usage +static scheduler_functions one_thread_scheduler_functions= +{ + 1, // max_threads + NULL, // init + init_new_connection_handler_thread, // init_new_connection_thread +#ifndef EMBEDDED_LIBRARY + handle_connection_in_main_thread, // add_connection +#else + NULL, // add_connection +#endif // EMBEDDED_LIBRARY + NULL, // thd_wait_begin + NULL, // thd_wait_end + NULL, // post_kill_notification + no_threads_end, // end_thread + NULL, // end +}; + +#ifndef EMBEDDED_LIBRARY +static scheduler_functions one_thread_per_connection_scheduler_functions= +{ + 0, // max_threads + NULL, // init + init_new_connection_handler_thread, // init_new_connection_thread + create_thread_to_handle_connection, // add_connection + NULL, // thd_wait_begin + NULL, // thd_wait_end + NULL, // post_kill_notification + one_thread_per_connection_end, // end_thread + NULL, // end +}; +#endif // EMBEDDED_LIBRARY + + +scheduler_functions *thread_scheduler= NULL; + +/** @internal + Helper functions to allow mysys to call the thread scheduler when + waiting for locks. */ -scheduler_functions::scheduler_functions() - :init(init_dummy), - init_new_connection_thread(init_new_connection_handler_thread), - add_connection(0), // Must be defined - post_kill_notification(post_kill_dummy), - end_thread(end_thread_dummy), end(end_dummy) -{} +/**@{*/ +static void scheduler_wait_begin(void) { + MYSQL_CALLBACK(thread_scheduler, + thd_wait_begin, (current_thd, THD_WAIT_ROW_TABLE_LOCK)); +} + +static void scheduler_wait_end(void) { + MYSQL_CALLBACK(thread_scheduler, thd_wait_end, (current_thd)); +} +/**@}*/ +/** + Common scheduler init function. + + The scheduler is either initialized by calling + one_thread_scheduler() or one_thread_per_connection_scheduler() in + mysqld.cc, so this init function will always be called. + */ +static void scheduler_init() { + thr_set_lock_wait_callback(scheduler_wait_begin, scheduler_wait_end); +} /* - End connection, in case when we are using 'no-threads' + Initialize scheduler for --thread-handling=one-thread-per-connection */ -static bool no_threads_end(THD *thd, bool put_in_cache) +#ifndef EMBEDDED_LIBRARY +void one_thread_per_connection_scheduler() { - unlink_thd(thd); - mysql_mutex_unlock(&LOCK_thread_count); - return 1; // Abort handle_one_connection + scheduler_init(); + one_thread_per_connection_scheduler_functions.max_threads= max_connections; + thread_scheduler= &one_thread_per_connection_scheduler_functions; } - +#endif /* Initailize scheduler for --thread-handling=no-threads */ -void one_thread_scheduler(scheduler_functions* func) +void one_thread_scheduler() { - func->max_threads= 1; -#ifndef EMBEDDED_LIBRARY - func->add_connection= handle_connection_in_main_thread; -#endif - func->init_new_connection_thread= init_dummy; - func->end_thread= no_threads_end; + scheduler_init(); + thread_scheduler= &one_thread_scheduler_functions; } @@ -81,11 +129,58 @@ void one_thread_scheduler(scheduler_functions* func) Initialize scheduler for --thread-handling=one-thread-per-connection */ -#ifndef EMBEDDED_LIBRARY -void one_thread_per_connection_scheduler(scheduler_functions* func) +/* + thd_scheduler keeps the link between THD and events. + It's embedded in the THD class. +*/ + +thd_scheduler::thd_scheduler() + : m_psi(NULL), data(NULL) +{ +#ifndef DBUG_OFF + dbug_explain[0]= '\0'; + set_explain= FALSE; +#endif +} + + +thd_scheduler::~thd_scheduler() +{ +} + +static scheduler_functions *saved_thread_scheduler; +static uint saved_thread_handling; + +extern "C" +int my_thread_scheduler_set(scheduler_functions *scheduler) +{ + DBUG_ASSERT(scheduler != 0); + + if (scheduler == NULL) + return 1; + + saved_thread_scheduler= thread_scheduler; + saved_thread_handling= thread_handling; + thread_scheduler= scheduler; + // Scheduler loaded dynamically + thread_handling= SCHEDULER_TYPES_COUNT; + return 0; +} + + +extern "C" +int my_thread_scheduler_reset() { - func->max_threads= max_connections; - func->add_connection= create_thread_to_handle_connection; - func->end_thread= one_thread_per_connection_end; + DBUG_ASSERT(saved_thread_scheduler != NULL); + + if (saved_thread_scheduler == NULL) + return 1; + + thread_scheduler= saved_thread_scheduler; + thread_handling= saved_thread_handling; + saved_thread_scheduler= 0; + return 0; } -#endif /* EMBEDDED_LIBRARY */ + + + diff --git a/sql/scheduler.h b/sql/scheduler.h index e7916031a27..40f0e28bc2c 100644 --- a/sql/scheduler.h +++ b/sql/scheduler.h @@ -28,38 +28,77 @@ class THD; /* Functions used when manipulating threads */ -class scheduler_functions +struct scheduler_functions { -public: uint max_threads; bool (*init)(void); bool (*init_new_connection_thread)(void); void (*add_connection)(THD *thd); + void (*thd_wait_begin)(THD *thd, int wait_type); + void (*thd_wait_end)(THD *thd); void (*post_kill_notification)(THD *thd); bool (*end_thread)(THD *thd, bool cache_thread); void (*end)(void); - scheduler_functions(); }; + +/** + Scheduler types enumeration. + + The default of --thread-handling is the first one in the + thread_handling_names array, this array has to be consistent with + the order in this array, so to change default one has to change the + first entry in this enum and the first entry in the + thread_handling_names array. + + @note The last entry of the enumeration is also used to mark the + thread handling as dynamic. In this case the name of the thread + handling is fetched from the name of the plugin that implements it. +*/ enum scheduler_types { SCHEDULER_ONE_THREAD_PER_CONNECTION=0, SCHEDULER_NO_THREADS, - SCHEDULER_POOL_OF_THREADS + SCHEDULER_TYPES_COUNT }; -void one_thread_per_connection_scheduler(scheduler_functions* func); -void one_thread_scheduler(scheduler_functions* func); +void one_thread_per_connection_scheduler(); +void one_thread_scheduler(); enum pool_command_op { NOT_IN_USE_OP= 0, NORMAL_OP= 1, CONNECT_OP, KILL_OP, DIE_OP }; -#define HAVE_POOL_OF_THREADS 0 /* For easyer tests */ -#define pool_of_threads_scheduler(A) one_thread_per_connection_scheduler(A) - +/* + To be used for pool-of-threads (implemeneted differently on various OSs) +*/ class thd_scheduler -{}; +{ +public: + /* + Thread instrumentation for the user job. + This member holds the instrumentation while the user job is not run + by a thread. + + Note that this member is not conditionally declared + (ifdef HAVE_PSI_INTERFACE), because doing so will change the binary + layout of THD, which is exposed to plugin code that may be compiled + differently. + */ + PSI_thread *m_psi; + + void *data; /* scheduler-specific data structure */ + +# ifndef DBUG_OFF + char dbug_explain[512]; + bool set_explain; +# endif -#endif /* SCHEDULER_INCLUDED */ + thd_scheduler(); + ~thd_scheduler(); +}; + +extern scheduler_functions *thread_scheduler; + +#endif diff --git a/sql/set_var.cc b/sql/set_var.cc index 9daaf883ea8..34b66dea319 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -108,7 +108,7 @@ void sys_var_end() my_hash_free(&system_variable_hash); for (sys_var *var=all_sys_vars.first; var; var= var->next) - var->~sys_var(); + var->cleanup(); DBUG_VOID_RETURN; } @@ -153,6 +153,17 @@ sys_var::sys_var(sys_var_chain *chain, const char *name_arg, guard(lock), offset(off), on_check(on_check_func), on_update(on_update_func), is_os_charset(FALSE) { + /* + There is a limitation in handle_options() related to short options: + - either all short options should be declared when parsing in multiple stages, + - or none should be declared. + Because a lot of short options are used in the normal parsing phase + for mysqld, we enforce here that no short option is present + in the first (PARSE_EARLY) stage. + See handle_options() for details. + */ + DBUG_ASSERT(parse_flag == PARSE_NORMAL || getopt_id <= 0 || getopt_id >= 255); + name.str= name_arg; name.length= strlen(name_arg); DBUG_ASSERT(name.length <= NAME_CHAR_LEN); diff --git a/sql/set_var.h b/sql/set_var.h index 5f1f889c4ce..2972b430e48 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -91,11 +91,13 @@ public: longlong def_val, PolyLock *lock, enum binlog_status_enum binlog_status_arg, on_check_function on_check_func, on_update_function on_update_func, uint deprecated_version, const char *substitute, int parse_flag); + + virtual ~sys_var() {} + /** - The instance should only be destroyed on shutdown, as it doesn't unlink - itself from the chain. + All the cleanup procedures should be performed here */ - virtual ~sys_var() {} + virtual void cleanup() {} /** downcast for sys_var_pluginvar. Returns this if it's an instance of sys_var_pluginvar, and 0 otherwise. diff --git a/sql/sp.cc b/sql/sp.cc index 0265ef45a2a..8821dc9365d 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -440,6 +440,7 @@ static TABLE *open_proc_table_for_update(THD *thd) { TABLE_LIST table_list; TABLE *table; + MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint(); DBUG_ENTER("open_proc_table_for_update"); table_list.init_one_table("mysql", 5, "proc", 4, "proc", TL_WRITE); @@ -450,6 +451,9 @@ static TABLE *open_proc_table_for_update(THD *thd) if (!proc_table_intact.check(table, &proc_table_def)) DBUG_RETURN(table); + close_thread_tables(thd); + thd->mdl_context.rollback_to_savepoint(mdl_savepoint); + DBUG_RETURN(NULL); } diff --git a/sql/spatial.cc b/sql/spatial.cc index f1dd0e6cebd..b02feb722f7 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -511,7 +511,7 @@ uint Gis_line_string::init_from_wkb(const char *wkb, uint len, n_points= wkb_get_uint(wkb, bo); proper_length= 4 + n_points * POINT_DATA_SIZE; - if (len < proper_length || res->reserve(proper_length)) + if (!n_points || len < proper_length || res->reserve(proper_length)) return 0; res->q_append(n_points); @@ -729,7 +729,9 @@ uint Gis_polygon::init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, if (len < 4) return 0; - n_linear_rings= wkb_get_uint(wkb, bo); + if (!(n_linear_rings= wkb_get_uint(wkb, bo))) + return 0; + if (res->reserve(4, 512)) return 0; wkb+= 4; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 19373507955..41e4ad7a522 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -4035,7 +4035,8 @@ end: bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables, bool any_combination_will_do, uint number, bool no_errors) { - TABLE_LIST *table, *first_not_own_table= thd->lex->first_not_own_table(); + TABLE_LIST *tl; + TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table(); Security_context *sctx= thd->security_ctx; uint i; ulong orig_want_access= want_access; @@ -4052,34 +4053,32 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables, the given table list refers to the list for prelocking (contains tables of other queries). For simple queries first_not_own_table is 0. */ - for (i= 0, table= tables; - i < number && table != first_not_own_table; - table= table->next_global, i++) + for (i= 0, tl= tables; + i < number && tl != first_not_own_table; + tl= tl->next_global, i++) { /* Save a copy of the privileges without the SHOW_VIEW_ACL attribute. It will be checked during making view. */ - table->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL); + tl->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL); } mysql_rwlock_rdlock(&LOCK_grant); - for (table= tables; - table && number-- && table != first_not_own_table; - table= table->next_global) + for (tl= tables; + tl && number-- && tl != first_not_own_table; + tl= tl->next_global) { - GRANT_TABLE *grant_table; - sctx = test(table->security_ctx) ? - table->security_ctx : thd->security_ctx; + sctx = test(tl->security_ctx) ? tl->security_ctx : thd->security_ctx; - const ACL_internal_table_access *access; - access= get_cached_table_access(&table->grant.m_internal, - table->get_db_name(), - table->get_table_name()); + const ACL_internal_table_access *access= + get_cached_table_access(&tl->grant.m_internal, + tl->get_db_name(), + tl->get_table_name()); if (access) { - switch(access->check(orig_want_access, &table->grant.privilege)) + switch(access->check(orig_want_access, &tl->grant.privilege)) { case ACL_INTERNAL_ACCESS_GRANTED: /* @@ -4103,29 +4102,33 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables, if (!want_access) continue; // ok - if (!(~table->grant.privilege & want_access) || - table->is_anonymous_derived_table() || table->schema_table) + if (!(~tl->grant.privilege & want_access) || + tl->is_anonymous_derived_table() || tl->schema_table) { /* - It is subquery in the FROM clause. VIEW set table->derived after + It is subquery in the FROM clause. VIEW set tl->derived after table opening, but this function always called before table opening. */ - if (!table->referencing_view) + if (!tl->referencing_view) { /* If it's a temporary table created for a subquery in the FROM clause, or an INFORMATION_SCHEMA table, drop the request for a privilege. */ - table->grant.want_privilege= 0; + tl->grant.want_privilege= 0; } continue; } - if (!(grant_table= table_hash_search(sctx->host, sctx->ip, - table->get_db_name(), sctx->priv_user, - table->get_table_name(), FALSE))) + GRANT_TABLE *grant_table= table_hash_search(sctx->host, sctx->ip, + tl->get_db_name(), + sctx->priv_user, + tl->get_table_name(), + FALSE); + + if (!grant_table) { - want_access &= ~table->grant.privilege; + want_access &= ~tl->grant.privilege; goto err; // No grants } @@ -4136,18 +4139,17 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables, if (any_combination_will_do) continue; - table->grant.grant_table=grant_table; // Remember for column test - table->grant.version=grant_version; - table->grant.privilege|= grant_table->privs; - table->grant.want_privilege= ((want_access & COL_ACLS) - & ~table->grant.privilege); + tl->grant.grant_table= grant_table; // Remember for column test + tl->grant.version= grant_version; + tl->grant.privilege|= grant_table->privs; + tl->grant.want_privilege= ((want_access & COL_ACLS) & ~tl->grant.privilege); - if (!(~table->grant.privilege & want_access)) + if (!(~tl->grant.privilege & want_access)) continue; - if (want_access & ~(grant_table->cols | table->grant.privilege)) + if (want_access & ~(grant_table->cols | tl->grant.privilege)) { - want_access &= ~(grant_table->cols | table->grant.privilege); + want_access &= ~(grant_table->cols | tl->grant.privilege); goto err; // impossible } } @@ -4164,7 +4166,7 @@ err: command, sctx->priv_user, sctx->host_or_ip, - table ? table->get_table_name() : "unknown"); + tl ? tl->get_table_name() : "unknown"); } DBUG_RETURN(TRUE); } diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 1f96f1cf0e4..21a05a5baca 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -111,9 +111,6 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list, table= &tmp_table; } - /* A MERGE table must not come here. */ - DBUG_ASSERT(table->file->ht->db_type != DB_TYPE_MRG_MYISAM); - /* REPAIR TABLE ... USE_FRM for temporary tables makes little sense. */ @@ -151,6 +148,9 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list, if (!ext[0] || !ext[1]) goto end; // No data file + /* A MERGE table must not come here. */ + DBUG_ASSERT(table->file->ht->db_type != DB_TYPE_MRG_MYISAM); + // Name of data file strxmov(from, table->s->normalized_path.str, ext[1], NullS); if (!mysql_file_stat(key_file_misc, from, &stat_info, MYF(0))) @@ -231,6 +231,26 @@ end: } +/** + Check if a given error is something that could occur during + open_and_lock_tables() that does not indicate table corruption. + + @param sql_errno Error number to check. + + @retval TRUE Error does not indicate table corruption. + @retval FALSE Error could indicate table corruption. +*/ + +static inline bool table_not_corrupt_error(uint sql_errno) +{ + return (sql_errno == ER_NO_SUCH_TABLE || + sql_errno == ER_FILE_NOT_FOUND || + sql_errno == ER_LOCK_WAIT_TIMEOUT || + sql_errno == ER_LOCK_DEADLOCK || + sql_errno == ER_CANT_LOCK_LOG_TABLE || + sql_errno == ER_OPEN_AS_READONLY); +} + /* RETURN VALUES @@ -311,7 +331,13 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, lex->query_tables= table; lex->query_tables_last= &table->next_global; lex->query_tables_own_last= 0; - thd->no_warnings_for_error= no_warnings_for_error; + /* + Under locked tables, we know that the table can be opened, + so any errors opening the table are logical errors. + In these cases it makes sense to report them. + */ + if (!thd->locked_tables_mode) + thd->no_warnings_for_error= no_warnings_for_error; if (view_operator_func == NULL) table->required_type=FRMTYPE_TABLE; @@ -320,6 +346,14 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, table->next_global= save_next_global; table->next_local= save_next_local; thd->open_options&= ~extra_open_options; + + /* + If open_and_lock_tables() failed, close_thread_tables() will close + the table and table->table can therefore be invalid. + */ + if (open_error) + table->table= NULL; + /* Under locked tables, we know that the table can be opened, so any errors opening the table are logical errors. @@ -418,9 +452,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM)); if (thd->stmt_da->is_error() && - (thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE || - thd->stmt_da->sql_errno() == ER_FILE_NOT_FOUND)) - /* A missing table is just issued as a failed command */ + table_not_corrupt_error(thd->stmt_da->sql_errno())) result_code= HA_ADMIN_FAILED; else /* Default failure code is corrupt table */ diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index 046e09b20a3..5af01523aa7 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -13,8 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "sql_parse.h" // check_access, - // check_merge_table_access +#include "sql_parse.h" // check_access #include "sql_table.h" // mysql_alter_table, // mysql_exchange_partition #include "sql_alter.h" @@ -60,11 +59,15 @@ bool Alter_table_statement::execute(THD *thd) check_access(thd, INSERT_ACL | CREATE_ACL, select_lex->db, &priv, NULL, /* Don't use first_tab->grant with sel_lex->db */ - 0, 0) || - check_merge_table_access(thd, first_table->db, - create_info.merge_list.first)) + 0, 0)) DBUG_RETURN(TRUE); /* purecov: inspected */ + /* If it is a merge table, check privileges for merge children. */ + if (create_info.merge_list.first && + check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL, + create_info.merge_list.first, FALSE, UINT_MAX, FALSE)) + DBUG_RETURN(TRUE); + if (check_grant(thd, priv_needed, first_table, FALSE, UINT_MAX, FALSE)) DBUG_RETURN(TRUE); /* purecov: inspected */ diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 01ab0b6dec5..8305283cd17 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -247,7 +247,8 @@ static void check_unused(void) Length of key */ -uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list, +uint create_table_def_key(THD *thd, char *key, + const TABLE_LIST *table_list, bool tmp_table) { uint key_length= (uint) (strmov(strmov(key, table_list->db)+1, @@ -1987,39 +1988,60 @@ void update_non_unique_table_error(TABLE_LIST *update, } +/** + Find temporary table specified by database and table names in the + THD::temporary_tables list. + + @return TABLE instance if a temporary table has been found; NULL otherwise. +*/ + TABLE *find_temporary_table(THD *thd, const char *db, const char *table_name) { - TABLE_LIST table_list; + TABLE_LIST tl; - table_list.db= (char*) db; - table_list.table_name= (char*) table_name; - return find_temporary_table(thd, &table_list); + tl.db= (char*) db; + tl.table_name= (char*) table_name; + + return find_temporary_table(thd, &tl); } -TABLE *find_temporary_table(THD *thd, TABLE_LIST *table_list) +/** + Find a temporary table specified by TABLE_LIST instance in the + THD::temporary_tables list. + + @return TABLE instance if a temporary table has been found; NULL otherwise. +*/ + +TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl) { - char key[MAX_DBKEY_LENGTH]; - uint key_length; - TABLE *table; - DBUG_ENTER("find_temporary_table"); - DBUG_PRINT("enter", ("table: '%s'.'%s'", - table_list->db, table_list->table_name)); + char key[MAX_DBKEY_LENGTH]; + uint key_length= create_table_def_key(thd, key, tl, 1); + + return find_temporary_table(thd, key, key_length); +} - key_length= create_table_def_key(thd, key, table_list, 1); - for (table=thd->temporary_tables ; table ; table= table->next) + +/** + Find a temporary table specified by a key in the THD::temporary_tables list. + + @return TABLE instance if a temporary table has been found; NULL otherwise. +*/ + +TABLE *find_temporary_table(THD *thd, + const char *table_key, + uint table_key_length) +{ + for (TABLE *table= thd->temporary_tables; table; table= table->next) { - if (table->s->table_cache_key.length == key_length && - !memcmp(table->s->table_cache_key.str, key, key_length)) + if (table->s->table_cache_key.length == table_key_length && + !memcmp(table->s->table_cache_key.str, table_key, table_key_length)) { - DBUG_PRINT("info", - ("Found table. server_id: %u pseudo_thread_id: %lu", - (uint) thd->server_id, - (ulong) thd->variables.pseudo_thread_id)); - DBUG_RETURN(table); + return table; } } - DBUG_RETURN(0); // Not a temporary table + + return NULL; } @@ -3023,41 +3045,11 @@ retry_share: table->reginfo.lock_type=TL_READ; /* Assume read */ reset: - DBUG_ASSERT(table->s->ref_count > 0 || table->s->tmp_table != NO_TMP_TABLE); - - if (thd->lex->need_correct_ident()) - table->alias_name_used= my_strcasecmp(table_alias_charset, - table->s->table_name.str, alias); - /* Fix alias if table name changes */ - if (strcmp(table->alias, alias)) - { - uint length=(uint) strlen(alias)+1; - table->alias= (char*) my_realloc((char*) table->alias, length, - MYF(MY_WME)); - memcpy((char*) table->alias, alias, length); - } - table->tablenr=thd->current_tablenr++; - table->used_fields=0; - table->const_table=0; - table->null_row= table->maybe_null= 0; - table->force_index= table->force_index_order= table->force_index_group= 0; - table->status=STATUS_NO_RECORD; - table->insert_values= 0; - table->fulltext_searched= 0; - table->file->ft_handler= 0; - table->reginfo.impossible_range= 0; - /* Catch wrong handling of the auto_increment_field_not_null. */ - DBUG_ASSERT(!table->auto_increment_field_not_null); - table->auto_increment_field_not_null= FALSE; - if (table->timestamp_field) - table->timestamp_field_type= table->timestamp_field->get_auto_set_type(); - table->pos_in_table_list= table_list; table_list->updatable= 1; // It is not derived table nor non-updatable VIEW - table->clear_column_bitmaps(); table_list->table= table; - DBUG_ASSERT(table->key_read == 0); - /* Tables may be reused in a sub statement. */ - DBUG_ASSERT(! table->file->extra(HA_EXTRA_IS_ATTACHED_CHILDREN)); + + table->init(thd, table_list); + DBUG_RETURN(FALSE); err_lock: @@ -4530,13 +4522,15 @@ lock_table_names(THD *thd, ! (flags & MYSQL_OPEN_SKIP_TEMPORARY) && find_temporary_table(thd, table)))) { - if (schema_set.insert(table)) + if (! (flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK) && + schema_set.insert(table)) return TRUE; mdl_requests.push_front(&table->mdl_request); } } - if (! mdl_requests.is_empty()) + if (! (flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK) && + ! mdl_requests.is_empty()) { /* Scoped locks: Take intention exclusive locks on all involved @@ -5171,6 +5165,8 @@ static bool check_lock_and_start_stmt(THD *thd, @param[in] lock_type lock to use for table @param[in] flags options to be used while opening and locking table (see open_table(), mysql_lock_tables()) + @param[in] prelocking_strategy Strategy which specifies how prelocking + algorithm should work for this statement. @return table @retval != NULL OK, opened table returned @@ -5196,7 +5192,8 @@ static bool check_lock_and_start_stmt(THD *thd, */ TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l, - thr_lock_type lock_type, uint flags) + thr_lock_type lock_type, uint flags, + Prelocking_strategy *prelocking_strategy) { TABLE_LIST *save_next_global; DBUG_ENTER("open_n_lock_single_table"); @@ -5212,7 +5209,8 @@ TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l, table_l->required_type= FRMTYPE_TABLE; /* Open the table. */ - if (open_and_lock_tables(thd, table_l, FALSE, flags)) + if (open_and_lock_tables(thd, table_l, FALSE, flags, + prelocking_strategy)) table_l->table= NULL; /* Just to be sure. */ /* Restore list. */ @@ -5704,35 +5702,37 @@ void close_tables_for_reopen(THD *thd, TABLE_LIST **tables, } -/* - Open a single table without table caching and don't set it in open_list - - SYNPOSIS - open_temporary_table() - thd Thread object - path Path (without .frm) - db database - table_name Table name - link_in_list 1 if table should be linked into thd->temporary_tables - - NOTES: - Used by alter_table to open a temporary table and when creating - a temporary table with CREATE TEMPORARY ... - - RETURN - 0 Error - # TABLE object +/** + Open a single table without table caching and don't add it to + THD::open_tables. Depending on the 'add_to_temporary_tables_list' value, + the opened TABLE instance will be addded to THD::temporary_tables list. + + @param thd Thread context. + @param path Path (without .frm) + @param db Database name. + @param table_name Table name. + @param add_to_temporary_tables_list Specifies if the opened TABLE + instance should be linked into + THD::temporary_tables list. + + @note This function is used: + - by alter_table() to open a temporary table; + - when creating a temporary table with CREATE TEMPORARY TABLE. + + @return TABLE instance for opened table. + @retval NULL on error. */ -TABLE *open_temporary_table(THD *thd, const char *path, const char *db, - const char *table_name, bool link_in_list) +TABLE *open_table_uncached(THD *thd, const char *path, const char *db, + const char *table_name, + bool add_to_temporary_tables_list) { TABLE *tmp_table; TABLE_SHARE *share; char cache_key[MAX_DBKEY_LENGTH], *saved_cache_key, *tmp_path; uint key_length; TABLE_LIST table_list; - DBUG_ENTER("open_temporary_table"); + DBUG_ENTER("open_table_uncached"); DBUG_PRINT("enter", ("table: '%s'.'%s' path: '%s' server_id: %u " "pseudo_thread_id: %lu", @@ -5775,7 +5775,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, share->tmp_table= (tmp_table->file->has_transactions() ? TRANSACTIONAL_TMP_TABLE : NON_TRANSACTIONAL_TMP_TABLE); - if (link_in_list) + if (add_to_temporary_tables_list) { /* growing temp list at the head */ tmp_table->next= thd->temporary_tables; diff --git a/sql/sql_base.h b/sql/sql_base.h index ff935c3fc09..7ae3971942b 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -17,7 +17,6 @@ #define SQL_BASE_INCLUDED #include "unireg.h" // REQUIRED: for other includes -#include "table.h" /* open_table_mode */ #include "sql_trigger.h" /* trg_event_type */ #include "sql_class.h" /* enum_mark_columns */ #include "mysqld.h" /* key_map */ @@ -79,7 +78,8 @@ void table_def_start_shutdown(void); void assign_new_table_id(TABLE_SHARE *share); uint cached_open_tables(void); uint cached_table_definitions(void); -uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list, +uint create_table_def_key(THD *thd, char *key, + const TABLE_LIST *table_list, bool tmp_table); TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key, uint key_length, uint db_flags, int *error, @@ -122,6 +122,11 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update, (LONG_TIMEOUT = 1 year) rather than the user-supplied timeout value. */ #define MYSQL_LOCK_IGNORE_TIMEOUT 0x0800 +/** + When acquiring "strong" (SNW, SNRW, X) metadata locks on tables to + be open do not acquire global and schema-scope IX locks. +*/ +#define MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK 0x1000 /** Please refer to the internals manual. */ #define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\ @@ -141,8 +146,9 @@ bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias, bool get_key_map_from_key_list(key_map *map, TABLE *table, List<String> *index_list); -TABLE *open_temporary_table(THD *thd, const char *path, const char *db, - const char *table_name, bool link_in_list); +TABLE *open_table_uncached(THD *thd, const char *path, const char *db, + const char *table_name, + bool add_to_temporary_tables_list); TABLE *find_locked_table(TABLE *list, const char *db, const char *table_name); TABLE *find_write_locked_table(TABLE *list, const char *db, const char *table_name); @@ -159,7 +165,9 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table, const char *db_name, const char *table_name); TABLE *find_temporary_table(THD *thd, const char *db, const char *table_name); -TABLE *find_temporary_table(THD *thd, TABLE_LIST *table_list); +TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl); +TABLE *find_temporary_table(THD *thd, const char *table_key, + uint table_key_length); void close_thread_tables(THD *thd); bool fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields, List<Item> &values, @@ -238,7 +246,8 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables, int open_and_lock_tables_derived(THD *thd, TABLE_LIST *tables, bool derived); /* simple open_and_lock_tables without derived handling for single table */ TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l, - thr_lock_type lock_type, uint flags); + thr_lock_type lock_type, uint flags, + Prelocking_strategy *prelocking_strategy); bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags); bool lock_tables(THD *thd, TABLE_LIST *tables, uint counter, uint flags); int decide_logging_format(THD *thd, TABLE_LIST *tables); @@ -447,6 +456,16 @@ open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags) } +inline TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l, + thr_lock_type lock_type, uint flags) +{ + DML_prelocking_strategy prelocking_strategy; + + return open_n_lock_single_table(thd, table_l, lock_type, flags, + &prelocking_strategy); +} + + /* open_and_lock_tables with derived handling */ inline bool open_and_lock_tables(THD *thd, TABLE_LIST *tables, bool derived, uint flags) diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index d6dc9edc502..b57c851edf4 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1346,6 +1346,57 @@ end: } +#ifndef EMBEDDED_LIBRARY +/** + Send a single memory block from the query cache. + + Respects the client/server protocol limits for the + size of the network packet, and splits a large block + in pieces to ensure that individual piece doesn't exceed + the maximal allowed size of the network packet (16M). + + @param[in] net NET handler + @param[in] packet packet to send + @param[in] len packet length + + @return Operation status + @retval FALSE On success + @retval TRUE On error +*/ +static bool +send_data_in_chunks(NET *net, const uchar *packet, ulong len) +{ + /* + On the client we may require more memory than max_allowed_packet + to keep, both, the truncated last logical packet, and the + compressed next packet. This never (or in practice never) + happens without compression, since without compression it's very + unlikely that a) a truncated logical packet would remain on the + client when it's time to read the next packet b) a subsequent + logical packet that is being read would be so large that + size-of-new-packet + size-of-old-packet-tail > + max_allowed_packet. To remedy this issue, we send data in 1MB + sized packets, that's below the current client default of 16MB + for max_allowed_packet, but large enough to ensure there is no + unnecessary overhead from too many syscalls per result set. + */ + static const ulong MAX_CHUNK_LENGTH= 1024*1024; + + while (len > MAX_CHUNK_LENGTH) + { + if (net_real_write(net, packet, MAX_CHUNK_LENGTH)) + return TRUE; + packet+= MAX_CHUNK_LENGTH; + len-= MAX_CHUNK_LENGTH; + } + if (len && net_real_write(net, packet, len)) + return TRUE; + + return FALSE; +} +#endif + + /* Check if the query is in the cache. If it was cached, send it to the user. @@ -1655,11 +1706,11 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d", ALIGN_SIZE(sizeof(Query_cache_result))))); Query_cache_result *result = result_block->result(); - if (net_real_write(&thd->net, result->data(), - result_block->used - - result_block->headers_len() - - ALIGN_SIZE(sizeof(Query_cache_result)))) - break; // Client aborted + if (send_data_in_chunks(&thd->net, result->data(), + result_block->used - + result_block->headers_len() - + ALIGN_SIZE(sizeof(Query_cache_result)))) + break; // Client aborted result_block = result_block->next; thd->net.pkt_nr= query->last_pkt_nr; // Keep packet number updated } while (result_block != first_result_block); diff --git a/sql/sql_callback.h b/sql/sql_callback.h new file mode 100644 index 00000000000..430514d3d7e --- /dev/null +++ b/sql/sql_callback.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2010, Oracle and/or its affiliates. All rights reserved. + + 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; version 2 of the License. + + 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 +*/ + +#ifndef SQL_CALLBACK_INCLUDED +#define SQL_CALLBACK_INCLUDED + +/** + Macro used for an internal callback. + + The macro will check that the object exists and that the function + is defined. If that is the case, it will call the function with the + given parameters. + + If the object or the function is not defined, the callback will be + considered successful (nothing needed to be done) and will + therefore return no error. + */ + +#define MYSQL_CALLBACK(OBJ, FUNC, PARAMS) \ + do { \ + if ((OBJ) && ((OBJ)->FUNC)) \ + (OBJ)->FUNC PARAMS; \ + } while (0) + +#define MYSQL_CALLBACK_ELSE(OBJ, FUNC, PARAMS, ELSE) \ + (((OBJ) && ((OBJ)->FUNC)) ? (OBJ)->FUNC PARAMS : (ELSE)) + + +#endif /* SQL_CALLBACK_INCLUDED */ diff --git a/sql/sql_class.cc b/sql/sql_class.cc index bde56777d52..f65e5c05826 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -57,6 +57,7 @@ #include "transaction.h" #include "debug_sync.h" #include "sql_parse.h" // is_update_query +#include "sql_callback.h" /* The following is used to initialise Table_ident with a internal @@ -1075,6 +1076,7 @@ THD::~THD() DBUG_ENTER("~THD()"); /* Ensure that no one is using THD */ mysql_mutex_lock(&LOCK_thd_data); + mysys_var=0; // Safety (shouldn't be needed) mysql_mutex_unlock(&LOCK_thd_data); add_to_status(&global_status_var, &status_var); @@ -1100,7 +1102,6 @@ THD::~THD() my_free(db); db= NULL; free_root(&transaction.mem_root,MYF(0)); - mysys_var=0; // Safety (shouldn't be needed) mysql_mutex_destroy(&LOCK_thd_data); #ifndef DBUG_OFF dbug_sentry= THD_SENTRY_GONE; @@ -1189,7 +1190,7 @@ void THD::awake(THD::killed_state state_to_set) { thr_alarm_kill(thread_id); if (!slave_thread) - thread_scheduler.post_kill_notification(this); + MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (this)); #ifdef SIGNAL_WITH_VIO_CLOSE if (this != current_thd) { @@ -1258,6 +1259,15 @@ bool THD::store_globals() if (my_pthread_setspecific_ptr(THR_THD, this) || my_pthread_setspecific_ptr(THR_MALLOC, &mem_root)) return 1; + /* + mysys_var is concurrently readable by a killer thread. + It is protected by LOCK_thd_data, it is not needed to lock while the + pointer is changing from NULL not non-NULL. If the kill thread reads + NULL it doesn't refer to anything, but if it is non-NULL we need to + ensure that the thread doesn't proceed to assign another thread to + have the mysys_var reference (which in fact refers to the worker + threads local storage with key THR_KEY_mysys. + */ mysys_var=my_thread_var; /* Let mysqld define the thread id (not mysys) @@ -3187,6 +3197,60 @@ extern "C" bool thd_sqlcom_can_generate_row_events(const MYSQL_THD thd) { return sqlcom_can_generate_row_events(thd); } + +#ifndef EMBEDDED_LIBRARY +extern "C" void thd_pool_wait_begin(MYSQL_THD thd, int wait_type); +extern "C" void thd_pool_wait_end(MYSQL_THD thd); + +/* + Interface for MySQL Server, plugins and storage engines to report + when they are going to sleep/stall. + + SYNOPSIS + thd_wait_begin() + thd Thread object + wait_type Type of wait + 1 -- short wait (e.g. for mutex) + 2 -- medium wait (e.g. for disk io) + 3 -- large wait (e.g. for locked row/table) + NOTES + This is used by the threadpool to have better knowledge of which + threads that currently are actively running on CPUs. When a thread + reports that it's going to sleep/stall, the threadpool scheduler is + free to start another thread in the pool most likely. The expected wait + time is simply an indication of how long the wait is expected to + become, the real wait time could be very different. + + thd_wait_end MUST be called immediately after waking up again. +*/ +extern "C" void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type) +{ + MYSQL_CALLBACK(thread_scheduler, thd_wait_begin, (thd, wait_type)); +} + +/** + Interface for MySQL Server, plugins and storage engines to report + when they waking up from a sleep/stall. + + @param thd Thread handle +*/ +extern "C" void thd_wait_end(MYSQL_THD thd) +{ + MYSQL_CALLBACK(thread_scheduler, thd_wait_end, (thd)); +} +#else +extern "C" void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type) +{ + /* do NOTHING for the embedded library */ + return; +} + +extern "C" void thd_wait_end(MYSQL_THD thd) +{ + /* do NOTHING for the embedded library */ + return; +} +#endif #endif // INNODB_COMPATIBILITY_HOOKS */ /**************************************************************************** @@ -3370,6 +3434,13 @@ void THD::set_query_id(query_id_t new_query_id) mysql_mutex_unlock(&LOCK_thd_data); } +/** Assign a new value to thd->mysys_var. */ +void THD::set_mysys_var(struct st_my_thread_var *new_mysys_var) +{ + mysql_mutex_lock(&LOCK_thd_data); + mysys_var= new_mysys_var; + mysql_mutex_unlock(&LOCK_thd_data); +} /** Leave explicit LOCK TABLES or prelocked mode and restore value of diff --git a/sql/sql_class.h b/sql/sql_class.h index 462fbf9a264..e86e42dc094 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1634,6 +1634,10 @@ public: xid_state.xid.null(); free_root(&mem_root,MYF(MY_KEEP_PREALLOC)); } + my_bool is_active() + { + return (all.ha_list != NULL); + } st_transactions() { bzero((char*)this, sizeof(*this)); @@ -2664,7 +2668,7 @@ public: virtual void set_statement(Statement *stmt); /** - Assign a new value to thd->query and thd->query_id. + Assign a new value to thd->query and thd->query_id and mysys_var. Protected with LOCK_thd_data mutex. */ void set_query(char *query_arg, uint32 query_length_arg); @@ -2677,6 +2681,7 @@ public: open_tables= open_tables_arg; mysql_mutex_unlock(&LOCK_thd_data); } + void set_mysys_var(struct st_my_thread_var *new_mysys_var); void enter_locked_tables_mode(enum_locked_tables_mode mode_arg) { DBUG_ASSERT(locked_tables_mode == LTM_NONE); diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 003203b5466..3ba6deed0a4 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -35,6 +35,7 @@ #include "hostname.h" // inc_host_errors, ip_to_hostname, // reset_host_errors #include "sql_acl.h" // acl_getroot, NO_ACCESS, SUPER_ACL +#include "sql_callback.h" #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) /* @@ -966,7 +967,7 @@ bool setup_connection_thread_globals(THD *thd) { close_connection(thd, ER_OUT_OF_RESOURCES, 1); statistic_increment(aborted_connects,&LOCK_status); - thread_scheduler.end_thread(thd, 0); + MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0)); return 1; // Error } return 0; @@ -989,7 +990,7 @@ bool setup_connection_thread_globals(THD *thd) */ -static bool login_connection(THD *thd) +bool login_connection(THD *thd) { NET *net= &thd->net; int error; @@ -1027,7 +1028,7 @@ static bool login_connection(THD *thd) This mainly updates status variables */ -static void end_connection(THD *thd) +void end_connection(THD *thd) { NET *net= &thd->net; plugin_thdvar_cleanup(thd); @@ -1068,7 +1069,7 @@ static void end_connection(THD *thd) Initialize THD to handle queries */ -static void prepare_new_connection_state(THD* thd) +void prepare_new_connection_state(THD* thd) { Security_context *sctx= thd->security_ctx; @@ -1137,11 +1138,11 @@ void do_handle_one_connection(THD *thd_arg) thd->thr_create_utime= my_micro_time(); - if (thread_scheduler.init_new_connection_thread()) + if (MYSQL_CALLBACK_ELSE(thread_scheduler, init_new_connection_thread, (), 0)) { close_connection(thd, ER_OUT_OF_RESOURCES, 1); statistic_increment(aborted_connects,&LOCK_status); - thread_scheduler.end_thread(thd,0); + MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0)); return; } @@ -1195,7 +1196,7 @@ void do_handle_one_connection(THD *thd_arg) end_thread: close_connection(thd, 0, 1); - if (thread_scheduler.end_thread(thd,1)) + if (MYSQL_CALLBACK_ELSE(thread_scheduler, end_thread, (thd, 1), 0)) return; // Probably no-threads /* diff --git a/sql/sql_connect.h b/sql/sql_connect.h index 2334b7303be..bfcc04ba093 100644 --- a/sql/sql_connect.h +++ b/sql/sql_connect.h @@ -40,4 +40,8 @@ int check_user(THD *thd, enum enum_server_command command, const char *passwd, uint passwd_len, const char *db, bool check_count); +bool login_connection(THD *thd); +void prepare_new_connection_state(THD* thd); +void end_connection(THD *thd); + #endif /* SQL_CONNECT_INCLUDED */ diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 6c23b47997a..cccb715bd5e 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -548,10 +548,25 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list) DBUG_RETURN(TRUE); } - if (delayed_get_table(thd, table_list)) + /* + In order for the deadlock detector to be able to find any deadlocks + caused by the handler thread locking this table, we take the metadata + lock inside the connection thread. If this goes ok, the ticket is cloned + and added to the list of granted locks held by the handler thread. + */ + MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint(); + if (thd->mdl_context.acquire_lock(&table_list->mdl_request, + thd->variables.lock_wait_timeout)) + /* + If a lock can't be acquired, it makes no sense to try normal insert. + Therefore we just abort the statement. + */ DBUG_RETURN(TRUE); - if (table_list->table) + bool error= FALSE; + if (delayed_get_table(thd, table_list)) + error= TRUE; + else if (table_list->table) { /* Open tables used for sub-selects or in stored functions, will also @@ -560,16 +575,36 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list) if (open_and_lock_tables(thd, table_list->next_global, TRUE, 0)) { end_delayed_insert(thd); - DBUG_RETURN(TRUE); + error= TRUE; + } + else + { + /* + First table was not processed by open_and_lock_tables(), + we need to set updatability flag "by hand". + */ + if (!table_list->derived && !table_list->view) + table_list->updatable= 1; // usual table } - /* - First table was not processed by open_and_lock_tables(), - we need to set updatability flag "by hand". - */ - if (!table_list->derived && !table_list->view) - table_list->updatable= 1; // usual table - DBUG_RETURN(FALSE); } + + /* + If a lock was acquired above, we should release it after + handle_delayed_insert() has cloned the ticket. Note that acquire_lock() can + succeed because the connection already has the lock. In this case the ticket + will be before the mdl_savepoint and we should not release it here. + */ + if (!thd->mdl_context.has_lock(mdl_savepoint, table_list->mdl_request.ticket)) + thd->mdl_context.release_lock(table_list->mdl_request.ticket); + + /* + Reset the ticket in case we end up having to use normal insert and + therefore will reopen the table and reacquire the metadata lock. + */ + table_list->mdl_request.ticket= NULL; + + if (error || table_list->table) + DBUG_RETURN(error); #endif /* * This is embedded library and we don't have auxiliary @@ -586,6 +621,30 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list) /** + Create a new query string for removing DELAYED keyword for + multi INSERT DEALAYED statement. + + @param[in] thd Thread handler + @param[in] buf Query string + + @return + 0 ok + 1 error +*/ +static int +create_insert_stmt_from_insert_delayed(THD *thd, String *buf) +{ + /* Make a copy of thd->query() and then remove the "DELAYED" keyword */ + if (buf->append(thd->query()) || + buf->replace(thd->lex->keyword_delayed_begin_offset, + thd->lex->keyword_delayed_end_offset - + thd->lex->keyword_delayed_begin_offset, 0)) + return 1; + return 0; +} + + +/** INSERT statement implementation @note Like implementations of other DDL/DML in MySQL, this function @@ -964,13 +1023,28 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, such case the flag is ignored for constructing binlog event. */ DBUG_ASSERT(thd->killed != THD::KILL_BAD_DATA || error > 0); - if (thd->binlog_query(THD::ROW_QUERY_TYPE, - thd->query(), thd->query_length(), - transactional_table, FALSE, FALSE, - errcode)) + if (was_insert_delayed && table_list->lock_type == TL_WRITE) { + /* Binlog multi INSERT DELAYED as INSERT without DELAYED. */ + String log_query; + if (create_insert_stmt_from_insert_delayed(thd, &log_query)) + { + sql_print_error("Event Error: An error occurred while creating query string" + "for INSERT DELAYED stmt, before writing it into binary log."); + + error= 1; + } + else if (thd->binlog_query(THD::ROW_QUERY_TYPE, + log_query.c_ptr(), log_query.length(), + transactional_table, FALSE, FALSE, + errcode)) + error= 1; + } + else if (thd->binlog_query(THD::ROW_QUERY_TYPE, + thd->query(), thd->query_length(), + transactional_table, FALSE, FALSE, + errcode)) error= 1; - } } } DBUG_ASSERT(transactional_table || !changed || @@ -1801,14 +1875,25 @@ public: mysql_cond_t cond, cond_client; volatile uint tables_in_use,stacked_inserts; volatile bool status; + /* + When the handler thread starts, it clones a metadata lock ticket + for the table to be inserted. This is done to allow the deadlock + detector to detect deadlocks resulting from this lock. + Before this is done, the connection thread cannot safely exit + without causing problems for clone_ticket(). + Once handler_thread_initialized has been set, it is safe for the + connection thread to exit. + Access to handler_thread_initialized is protected by di->mutex. + */ + bool handler_thread_initialized; COPY_INFO info; I_List<delayed_row> rows; ulong group_count; TABLE_LIST table_list; // Argument Delayed_insert() - :locks_in_memory(0), - table(0),tables_in_use(0),stacked_inserts(0), status(0), group_count(0) + :locks_in_memory(0), table(0),tables_in_use(0),stacked_inserts(0), + status(0), handler_thread_initialized(FALSE), group_count(0) { DBUG_ENTER("Delayed_insert constructor"); thd.security_ctx->user=thd.security_ctx->priv_user=(char*) delayed_user; @@ -2025,6 +2110,10 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list) /* Replace volatile strings with local copies */ di->table_list.alias= di->table_list.table_name= di->thd.query(); di->table_list.db= di->thd.db; + /* We need the ticket so that it can be cloned in handle_delayed_insert */ + init_mdl_requests(&di->table_list); + di->table_list.mdl_request.ticket= table_list->mdl_request.ticket; + di->lock(); mysql_mutex_lock(&di->mutex); if ((error= mysql_thread_create(key_thread_delayed_insert, @@ -2041,9 +2130,15 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list) goto end_create; } - /* Wait until table is open */ + /* + Wait until table is open unless the handler thread or the connection + thread has been killed. Note that we in all cases must wait until the + handler thread has been properly initialized before exiting. Otherwise + we risk doing clone_ticket() on a ticket that is no longer valid. + */ thd_proc_info(thd, "waiting for handler open"); - while (!di->thd.killed && !di->table && !thd->killed) + while (!di->handler_thread_initialized || + (!di->thd.killed && !di->table && !thd->killed)) { mysql_cond_wait(&di->cond_client, &di->mutex); } @@ -2399,6 +2494,65 @@ void kill_delayed_threads(void) /** + A strategy for the prelocking algorithm which prevents the + delayed insert thread from opening tables with engines which + do not support delayed inserts. + + Particularly it allows to abort open_tables() as soon as we + discover that we have opened a MERGE table, without acquiring + metadata locks on underlying tables. +*/ + +class Delayed_prelocking_strategy : public Prelocking_strategy +{ +public: + virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx, + Sroutine_hash_entry *rt, sp_head *sp, + bool *need_prelocking); + virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx, + TABLE_LIST *table_list, bool *need_prelocking); + virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx, + TABLE_LIST *table_list, bool *need_prelocking); +}; + + +bool Delayed_prelocking_strategy:: +handle_table(THD *thd, Query_tables_list *prelocking_ctx, + TABLE_LIST *table_list, bool *need_prelocking) +{ + DBUG_ASSERT(table_list->lock_type == TL_WRITE_DELAYED); + + if (!(table_list->table->file->ha_table_flags() & HA_CAN_INSERT_DELAYED)) + { + my_error(ER_DELAYED_NOT_SUPPORTED, MYF(0), table_list->table_name); + return TRUE; + } + return FALSE; +} + + +bool Delayed_prelocking_strategy:: +handle_routine(THD *thd, Query_tables_list *prelocking_ctx, + Sroutine_hash_entry *rt, sp_head *sp, + bool *need_prelocking) +{ + /* LEX used by the delayed insert thread has no routines. */ + DBUG_ASSERT(0); + return FALSE; +} + + +bool Delayed_prelocking_strategy:: +handle_view(THD *thd, Query_tables_list *prelocking_ctx, + TABLE_LIST *table_list, bool *need_prelocking) +{ + /* We don't open views in the delayed insert thread. */ + DBUG_ASSERT(0); + return FALSE; +} + + +/** Open and lock table for use by delayed thread and check that this table is suitable for delayed inserts. @@ -2408,21 +2562,21 @@ void kill_delayed_threads(void) bool Delayed_insert::open_and_lock_table() { + Delayed_prelocking_strategy prelocking_strategy; + + /* + Use special prelocking strategy to get ER_DELAYED_NOT_SUPPORTED + error for tables with engines which don't support delayed inserts. + */ if (!(table= open_n_lock_single_table(&thd, &table_list, TL_WRITE_DELAYED, - MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK))) + MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK, + &prelocking_strategy))) { thd.fatal_error(); // Abort waiting inserts return TRUE; } - if (!(table->file->ha_table_flags() & HA_CAN_INSERT_DELAYED)) - { - /* To rollback InnoDB statement transaction. */ - trans_rollback_stmt(&thd); - my_error(ER_DELAYED_NOT_SUPPORTED, MYF(ME_FATALERROR), - table_list.table_name); - return TRUE; - } + if (table->triggers) { /* @@ -2471,6 +2625,7 @@ pthread_handler_t handle_delayed_insert(void *arg) /* Can't use my_error since store_globals has not yet been called */ thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), NULL); + di->handler_thread_initialized= TRUE; } else { @@ -2481,6 +2636,7 @@ pthread_handler_t handle_delayed_insert(void *arg) /* Can't use my_error since store_globals has perhaps failed */ thd->stmt_da->set_error_status(thd, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), NULL); + di->handler_thread_initialized= TRUE; thd->fatal_error(); goto err; } @@ -2493,7 +2649,24 @@ pthread_handler_t handle_delayed_insert(void *arg) thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_DELAYED); thd->set_current_stmt_binlog_format_row_if_mixed(); - init_mdl_requests(&di->table_list); + /* + Clone the ticket representing the lock on the target table for + the insert and add it to the list of granted metadata locks held by + the handler thread. This is safe since the handler thread is + not holding nor waiting on any metadata locks. + */ + if (thd->mdl_context.clone_ticket(&di->table_list.mdl_request)) + { + di->handler_thread_initialized= TRUE; + goto err; + } + + /* + Now that the ticket has been cloned, it is safe for the connection + thread to exit. + */ + di->handler_thread_initialized= TRUE; + di->table_list.mdl_request.ticket= NULL; if (di->open_and_lock_table()) goto err; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 121b7622597..2055b609ad5 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -2354,10 +2354,20 @@ struct LEX: public Query_tables_list This pointer is required to add possibly omitted DEFINER-clause to the DDL-statement before dumping it to the binlog. + + keyword_delayed_begin_offset is the offset to the beginning of the DELAYED + keyword in INSERT DELAYED statement. keyword_delayed_end_offset is the + offset to the character right after the DELAYED keyword. */ - const char *stmt_definition_begin; + union { + const char *stmt_definition_begin; + uint keyword_delayed_begin_offset; + }; - const char *stmt_definition_end; + union { + const char *stmt_definition_end; + uint keyword_delayed_end_offset; + }; /** During name resolution search only in the table list given by diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b78815f0e52..23a5f35d967 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -177,8 +177,7 @@ static bool some_non_temp_table_to_be_updated(THD *thd, TABLE_LIST *tables) for (TABLE_LIST *table= tables; table; table= table->next_global) { DBUG_ASSERT(table->db && table->table_name); - if (table->updating && - !find_temporary_table(thd, table->db, table->table_name)) + if (table->updating && !find_temporary_table(thd, table)) return 1; } return 0; @@ -402,6 +401,7 @@ void init_update_queries(void) sql_command_flags[SQLCOM_REPAIR]= CF_WRITE_LOGS_COMMAND | CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_OPTIMIZE]|= CF_WRITE_LOGS_COMMAND | CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_ANALYZE]= CF_WRITE_LOGS_COMMAND | CF_AUTO_COMMIT_TRANS; + sql_command_flags[SQLCOM_CHECK]= CF_WRITE_LOGS_COMMAND | CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_CREATE_USER]|= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_DROP_USER]|= CF_AUTO_COMMIT_TRANS; @@ -415,7 +415,6 @@ void init_update_queries(void) sql_command_flags[SQLCOM_FLUSH]= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_RESET]= CF_AUTO_COMMIT_TRANS; - sql_command_flags[SQLCOM_CHECK]= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_CREATE_SERVER]= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_ALTER_SERVER]= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_DROP_SERVER]= CF_AUTO_COMMIT_TRANS; @@ -643,45 +642,6 @@ end: } -/** - @brief Check access privs for a MERGE table and fix children lock types. - - @param[in] thd thread handle - @param[in] db database name - @param[in,out] table_list list of child tables (merge_list) - lock_type and optionally db set per table - - @return status - @retval 0 OK - @retval != 0 Error - - @detail - This function is used for write access to MERGE tables only - (CREATE TABLE, ALTER TABLE ... UNION=(...)). Set TL_WRITE for - every child. Set 'db' for every child if not present. -*/ -#ifndef NO_EMBEDDED_ACCESS_CHECKS -bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list) -{ - int error= 0; - - if (table_list) - { - /* Check that all tables use the current database */ - TABLE_LIST *tlist; - - for (tlist= table_list; tlist; tlist= tlist->next_local) - { - if (!tlist->db || !tlist->db[0]) - tlist->db= db; /* purecov: inspected */ - } - error= check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL, - table_list, FALSE, UINT_MAX, FALSE); - } - return error; -} -#endif - /* This works because items are allocated with sql_alloc() */ void free_items(Item *item) @@ -6964,10 +6924,16 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, if (check_access(thd, want_priv, create_table->db, &create_table->grant.privilege, &create_table->grant.m_internal, - 0, 0) || - check_merge_table_access(thd, create_table->db, - lex->create_info.merge_list.first)) + 0, 0)) + goto err; + + /* If it is a merge table, check privileges for merge children. */ + if (lex->create_info.merge_list.first && + check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL, + lex->create_info.merge_list.first, + FALSE, UINT_MAX, FALSE)) goto err; + if (want_priv != CREATE_TMP_ACL && check_grant(thd, want_priv, create_table, FALSE, 1, FALSE)) goto err; diff --git a/sql/sql_parse.h b/sql/sql_parse.h index ad620544d29..c9b0f981d19 100644 --- a/sql/sql_parse.h +++ b/sql/sql_parse.h @@ -153,7 +153,6 @@ bool check_single_table_access(THD *thd, ulong privilege, bool check_routine_access(THD *thd,ulong want_access,char *db,char *name, bool is_proc, bool no_errors); bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table); -bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list); bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc); bool check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, GRANT_INTERNAL_INFO *grant_internal_info, @@ -176,8 +175,6 @@ inline bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table) table->grant.privilege= want_access; return false; } -inline bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list) -{ return false; } inline bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc) { return false; } diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 956be657af2..f48a3183289 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -519,7 +519,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) /* no op */; cur= (struct st_mysql_plugin*) - my_malloc(i*sizeof(struct st_mysql_plugin), MYF(MY_ZEROFILL|MY_WME)); + my_malloc((i+1)*sizeof(struct st_mysql_plugin), MYF(MY_ZEROFILL|MY_WME)); if (!cur) { free_plugin_mem(&plugin_dl); diff --git a/sql/sql_plugin_services.h b/sql/sql_plugin_services.h index 7491ddab79d..f39e22f1e21 100644 --- a/sql/sql_plugin_services.h +++ b/sql/sql_plugin_services.h @@ -36,9 +36,23 @@ static struct thd_alloc_service_st thd_alloc_handler= { thd_make_lex_string }; +static struct thd_wait_service_st thd_wait_handler= { + thd_wait_begin, + thd_wait_end +}; + +static struct my_thread_scheduler_service my_thread_scheduler_handler= { + my_thread_scheduler_set, + my_thread_scheduler_reset, +}; + + static struct st_service_ref list_of_services[]= { { "my_snprintf_service", VERSION_my_snprintf, &my_snprintf_handler }, - { "thd_alloc_service", VERSION_thd_alloc, &thd_alloc_handler } + { "thd_alloc_service", VERSION_thd_alloc, &thd_alloc_handler }, + { "thd_wait_service", VERSION_thd_wait, &thd_wait_handler }, + { "my_thread_scheduler_service", + VERSION_my_thread_scheduler, &my_thread_scheduler_handler }, }; diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index bf38af78536..35f27408247 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -328,7 +328,6 @@ bool reload_acl_and_cache(THD *thd, unsigned long options, ------------------------------------- - you can't flush WITH READ LOCK a non-existent table - you can't flush WITH READ LOCK under LOCK TABLES - - currently incompatible with the GRL (@todo: fix) Effect on views and temporary tables. ------------------------------------ @@ -338,6 +337,13 @@ bool reload_acl_and_cache(THD *thd, unsigned long options, if there is a base table, it's used, otherwise ER_NO_SUCH_TABLE is returned. + Handling of MERGE tables + ------------------------ + For MERGE table this statement will open and lock child tables + for read (it is impossible to lock parent table without it). + Child tables won't be flushed unless they are explicitly present + in the statement's table list. + Implicit commit --------------- This statement causes an implicit commit before and @@ -354,7 +360,6 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables) { Lock_tables_prelocking_strategy lock_tables_prelocking_strategy; TABLE_LIST *table_list; - MDL_request_list mdl_requests; /* This is called from SQLCOM_FLUSH, the transaction has @@ -368,17 +373,13 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables) } /* - Acquire SNW locks on tables to be flushed. We can't use - lock_table_names() here as this call will also acquire global IX - and database-scope IX locks on the tables, and this will make + Acquire SNW locks on tables to be flushed. Don't acquire global + IX and database-scope IX locks on the tables as this will make this statement incompatible with FLUSH TABLES WITH READ LOCK. */ - for (table_list= all_tables; table_list; - table_list= table_list->next_global) - mdl_requests.push_front(&table_list->mdl_request); - - if (thd->mdl_context.acquire_locks(&mdl_requests, - thd->variables.lock_wait_timeout)) + if (lock_table_names(thd, all_tables, NULL, + thd->variables.lock_wait_timeout, + MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK)) goto error; DEBUG_SYNC(thd,"flush_tables_with_read_lock_after_acquire_locks"); @@ -390,21 +391,24 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables) tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, table_list->db, table_list->table_name, FALSE); - - /* Skip views and temporary tables. */ - table_list->required_type= FRMTYPE_TABLE; /* Don't try to flush views. */ - table_list->open_type= OT_BASE_ONLY; /* Ignore temporary tables. */ + /* Reset ticket to satisfy asserts in open_tables(). */ + table_list->mdl_request.ticket= NULL; } /* Before opening and locking tables the below call also waits for old shares to go away, so the fact that we don't pass MYSQL_LOCK_IGNORE_FLUSH flag to it is important. + Also we don't pass MYSQL_OPEN_HAS_MDL_LOCK flag as we want + to open underlying tables if merge table is flushed. + For underlying tables of the merge the below call has to + acquire SNW locks to ensure that they can be locked for + read without further waiting. */ - if (open_and_lock_tables(thd, all_tables, FALSE, - MYSQL_OPEN_HAS_MDL_LOCK, - &lock_tables_prelocking_strategy) || - thd->locked_tables_list.init_locked_tables(thd)) + if (open_and_lock_tables(thd, all_tables, FALSE, + MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK, + &lock_tables_prelocking_strategy) || + thd->locked_tables_list.init_locked_tables(thd)) { goto error; } diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 97f8e46d052..ac15239b040 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -285,6 +285,7 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name, { if ((rc= Table_triggers_list::change_table_name(thd, ren_table->db, old_alias, + ren_table->table_name, new_db, new_alias))) { diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index ab6c6e738b2..7bca41f1265 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -448,6 +448,8 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, const char *errmsg = "Unknown error"; NET* net = &thd->net; mysql_mutex_t *log_lock; + mysql_cond_t *log_cond; + bool binlog_can_be_corrupted= FALSE; #ifndef DBUG_OFF int left_events = max_binlog_dump_events; @@ -591,7 +593,8 @@ impossible position"; mysql_bin_log, and it's already inited, and it will be destroyed only at shutdown). */ - log_lock = mysql_bin_log.get_log_lock(); + log_lock= mysql_bin_log.get_log_lock(); + log_cond= mysql_bin_log.get_log_cond(); if (pos > BIN_LOG_HEADER_SIZE) { /* reset transmit packet for the event read from binary log @@ -826,6 +829,7 @@ impossible position"; #ifndef DBUG_OFF ulong hb_info_counter= 0; #endif + const char* old_msg= thd->proc_info; signal_cnt= mysql_bin_log.signal_cnt; do { @@ -834,6 +838,9 @@ impossible position"; DBUG_ASSERT(heartbeat_ts && heartbeat_period != 0); set_timespec_nsec(*heartbeat_ts, heartbeat_period); } + thd->enter_cond(log_cond, log_lock, + "Master has sent all binlog to slave; " + "waiting for binlog to be updated"); ret= mysql_bin_log.wait_for_update_bin_log(thd, heartbeat_ts); DBUG_ASSERT(ret == 0 || (heartbeat_period != 0 && coord != NULL)); if (ret == ETIMEDOUT || ret == ETIME) @@ -849,12 +856,15 @@ impossible position"; #endif /* reset transmit packet for the heartbeat event */ if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg)) + { + thd->exit_cond(old_msg); goto err; + } if (send_heartbeat_event(net, packet, coord)) { errmsg = "Failed on my_net_write()"; my_errno= ER_UNKNOWN_ERROR; - mysql_mutex_unlock(log_lock); + thd->exit_cond(old_msg); goto err; } } @@ -863,7 +873,7 @@ impossible position"; DBUG_PRINT("wait",("binary log received update or a broadcast signal caught")); } } while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed); - mysql_mutex_unlock(log_lock); + thd->exit_cond(old_msg); } break; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3c9eb215641..2a2fe3eb36f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1523,6 +1523,15 @@ JOIN::optimize() if (order) { /* + Do we need a temporary table due to the ORDER BY not being equal to + the GROUP BY? The call to test_if_skip_sort_order above tests for the + GROUP BY clause only and hence is not valid in this case. So the + estimated number of rows to be read from the first table is not valid. + We clear it here so that it doesn't show up in EXPLAIN. + */ + if (need_tmp && (select_options & SELECT_DESCRIBE) != 0) + join_tab[const_tables].limit= 0; + /* Force using of tmp table if sorting by a SP or UDF function due to their expensive and probably non-deterministic nature. */ @@ -2402,13 +2411,8 @@ JOIN::destroy() cleanup(1); /* Cleanup items referencing temporary table columns */ - if (!tmp_all_fields3.is_empty()) - { - List_iterator_fast<Item> it(tmp_all_fields3); - Item *item; - while ((item= it++)) - item->cleanup(); - } + cleanup_item_list(tmp_all_fields1); + cleanup_item_list(tmp_all_fields3); if (exec_tmp_table1) free_tmp_table(thd, exec_tmp_table1); if (exec_tmp_table2) @@ -2419,6 +2423,19 @@ JOIN::destroy() DBUG_RETURN(error); } + +void JOIN::cleanup_item_list(List<Item> &items) const +{ + if (!items.is_empty()) + { + List_iterator_fast<Item> it(items); + Item *item; + while ((item= it++)) + item->cleanup(); + } +} + + /** An entry point to single-unit select (a select without UNION). @@ -9008,10 +9025,10 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top) /* Flatten nested joins that can be flattened. */ TABLE_LIST *right_neighbor= NULL; - bool fix_name_res= FALSE; li.rewind(); while ((table= li++)) { + bool fix_name_res= FALSE; nested_join= table->nested_join; if (nested_join && !table->on_expr) { @@ -12723,7 +12740,9 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if (!end_of_records) { copy_fields(&join->tmp_table_param); - copy_funcs(join->tmp_table_param.items_to_copy); + if (copy_funcs(join->tmp_table_param.items_to_copy, join->thd)) + DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */ + if (!join->having || join->having->val_int()) { int error; @@ -12813,7 +12832,8 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), memcpy(table->record[0]+key_part->offset, group->buff, 1); } init_tmptable_sum_functions(join->sum_funcs); - copy_funcs(join->tmp_table_param.items_to_copy); + if (copy_funcs(join->tmp_table_param.items_to_copy, join->thd)) + DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */ if ((error=table->file->ha_write_row(table->record[0]))) { if (create_myisam_from_heap(join->thd, table, &join->tmp_table_param, @@ -12848,7 +12868,8 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), init_tmptable_sum_functions(join->sum_funcs); copy_fields(&join->tmp_table_param); // Groups are copied twice. - copy_funcs(join->tmp_table_param.items_to_copy); + if (copy_funcs(join->tmp_table_param.items_to_copy, join->thd)) + DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */ if (!(error=table->file->ha_write_row(table->record[0]))) join->send_records++; // New group @@ -12935,7 +12956,8 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if (idx < (int) join->send_group_parts) { copy_fields(&join->tmp_table_param); - copy_funcs(join->tmp_table_param.items_to_copy); + if (copy_funcs(join->tmp_table_param.items_to_copy, join->thd)) + DBUG_RETURN(NESTED_LOOP_ERROR); if (init_sum_functions(join->sum_funcs, join->sum_funcs_end[idx+1])) DBUG_RETURN(NESTED_LOOP_ERROR); if (join->procedure) @@ -13238,6 +13260,34 @@ ok: } +/** + Find shortest key suitable for full table scan. + + @param table Table to scan + @param usable_keys Allowed keys + + @note + As far as + 1) clustered primary key entry data set is a set of all record + fields (key fields and not key fields) and + 2) secondary index entry data is a union of its key fields and + primary key fields (at least InnoDB and its derivatives don't + duplicate primary key fields there, even if the primary and + the secondary keys have a common subset of key fields), + then secondary index entry data is always a subset of primary key entry. + Unfortunately, key_info[nr].key_length doesn't show the length + of key/pointer pair but a sum of key field lengths only, thus + we can't estimate index IO volume comparing only this key_length + value of secondary keys and clustered PK. + So, try secondary keys first, and choose PK only if there are no + usable secondary covering keys or found best secondary key include + all table fields (i.e. same as PK): + + @return + MAX_KEY no suitable key found + key index otherwise +*/ + uint find_shortest_key(TABLE *table, const key_map *usable_keys) { uint best= MAX_KEY; @@ -13250,23 +13300,6 @@ uint find_shortest_key(TABLE *table, const key_map *usable_keys) uint min_length= (uint) ~0; for (uint nr=0; nr < table->s->keys ; nr++) { - /* - As far as - 1) clustered primary key entry data set is a set of all record - fields (key fields and not key fields) and - 2) secondary index entry data is a union of its key fields and - primary key fields (at least InnoDB and its derivatives don't - duplicate primary key fields there, even if the primary and - the secondary keys have a common subset of key fields), - then secondary index entry data is always a subset of primary key - entry, and the PK is always longer. - Unfortunately, key_info[nr].key_length doesn't show the length - of key/pointer pair but a sum of key field lengths only, thus - we can't estimate index IO volume comparing only this key_length - value of seconday keys and clustered PK. - So, try secondary keys first, and choose PK only if there are no - usable secondary covering keys: - */ if (nr == usable_clustered_pk) continue; if (usable_keys->is_set(nr)) @@ -13279,7 +13312,20 @@ uint find_shortest_key(TABLE *table, const key_map *usable_keys) } } } - return best != MAX_KEY ? best : usable_clustered_pk; + if (usable_clustered_pk != MAX_KEY) + { + /* + If the primary key is clustered and found shorter key covers all table + fields then primary key scan normally would be faster because amount of + data to scan is the same but PK is clustered. + It's safe to compare key parts with table fields since duplicate key + parts aren't allowed. + */ + if (best == MAX_KEY || + table->key_info[best].key_parts >= table->s->fields) + best= usable_clustered_pk; + } + return best; } /** @@ -15807,14 +15853,39 @@ update_sum_func(Item_sum **func_ptr) return 0; } -/** Copy result of functions to record in tmp_table. */ +/** + Copy result of functions to record in tmp_table. -void -copy_funcs(Item **func_ptr) + Uses the thread pointer to check for errors in + some of the val_xxx() methods called by the + save_in_result_field() function. + TODO: make the Item::val_xxx() return error code + + @param func_ptr array of the function Items to copy to the tmp table + @param thd pointer to the current thread for error checking + @retval + FALSE if OK + @retval + TRUE on error +*/ + +bool +copy_funcs(Item **func_ptr, const THD *thd) { Item *func; for (; (func = *func_ptr) ; func_ptr++) + { func->save_in_result_field(1); + /* + Need to check the THD error state because Item::val_xxx() don't + return error code, but can generate errors + TODO: change it for a real status check when Item::val_xxx() + are extended to return status code. + */ + if (thd->is_error()) + return TRUE; + } + return FALSE; } @@ -16642,7 +16713,15 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, if (tab->select && tab->select->quick) examined_rows= tab->select->quick->records; else if (tab->type == JT_NEXT || tab->type == JT_ALL) - examined_rows= tab->limit ? tab->limit : tab->table->file->records(); + { + if (tab->limit) + examined_rows= tab->limit; + else + { + tab->table->file->info(HA_STATUS_VARIABLE); + examined_rows= tab->table->file->stats.records; + } + } else examined_rows=(ha_rows)join->best_positions[i].records_read; diff --git a/sql/sql_select.h b/sql/sql_select.h index 40f9e6d4054..93885e23f76 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -583,6 +583,7 @@ private: */ bool implicit_grouping; bool make_simple_join(JOIN *join, TABLE *tmp_table); + void cleanup_item_list(List<Item> &items) const; }; @@ -606,7 +607,7 @@ bool setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, List<Item> &new_list1, List<Item> &new_list2, uint elements, List<Item> &fields); void copy_fields(TMP_TABLE_PARAM *param); -void copy_funcs(Item **func_ptr); +bool copy_funcs(Item **func_ptr, const THD *thd); bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, int error, bool ignore_last_dupp_error); uint find_shortest_key(TABLE *table, const key_map *usable_keys); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 3f0c0b9eaf9..6b24e3db7bc 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1815,6 +1815,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) if ((thd_info->db=tmp->db)) // Safe test thd_info->db=thd->strdup(thd_info->db); thd_info->command=(int) tmp->command; + mysql_mutex_lock(&tmp->LOCK_thd_data); if ((mysys_var= tmp->mysys_var)) mysql_mutex_lock(&mysys_var->mutex); thd_info->proc_info= (char*) (tmp->killed == THD::KILL_CONNECTION? "Killed" : 0); @@ -1822,16 +1823,15 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) if (mysys_var) mysql_mutex_unlock(&mysys_var->mutex); - thd_info->start_time= tmp->start_time; thd_info->query=0; /* Lock THD mutex that protects its data when looking at it. */ - mysql_mutex_lock(&tmp->LOCK_thd_data); if (tmp->query()) { uint length= min(max_query_length, tmp->query_length()); thd_info->query= (char*) thd->strmake(tmp->query(),length); } mysql_mutex_unlock(&tmp->LOCK_thd_data); + thd_info->start_time= tmp->start_time; thread_infos.append(thd_info); } } @@ -1918,6 +1918,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) table->field[3]->set_notnull(); } + mysql_mutex_lock(&tmp->LOCK_thd_data); if ((mysys_var= tmp->mysys_var)) mysql_mutex_lock(&mysys_var->mutex); /* COMMAND */ @@ -1938,6 +1939,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) if (mysys_var) mysql_mutex_unlock(&mysys_var->mutex); + mysql_mutex_unlock(&tmp->LOCK_thd_data); /* INFO */ /* Lock THD mutex that protects its data when looking at it. */ @@ -7490,13 +7492,16 @@ int finalize_schema_table(st_plugin_int *plugin) ST_SCHEMA_TABLE *schema_table= (ST_SCHEMA_TABLE *)plugin->data; DBUG_ENTER("finalize_schema_table"); - if (schema_table && plugin->plugin->deinit) + if (schema_table) { - DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str)); - if (plugin->plugin->deinit(NULL)) + if (plugin->plugin->deinit) { - DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.", - plugin->name.str)); + DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str)); + if (plugin->plugin->deinit(NULL)) + { + DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.", + plugin->name.str)); + } } my_free(schema_table); } diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 762eebba031..4b7dab243d2 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -31,9 +31,12 @@ ** String functions *****************************************************************************/ -bool String::real_alloc(uint32 arg_length) +bool String::real_alloc(uint32 length) { - arg_length=ALIGN_SIZE(arg_length+1); + uint32 arg_length= ALIGN_SIZE(length + 1); + DBUG_ASSERT(arg_length > length); + if (arg_length <= length) + return TRUE; /* Overflow */ str_length=0; if (Alloced_length < arg_length) { @@ -56,6 +59,9 @@ bool String::real_alloc(uint32 arg_length) bool String::realloc(uint32 alloc_length) { uint32 len=ALIGN_SIZE(alloc_length+1); + DBUG_ASSERT(len > alloc_length); + if (len <= alloc_length) + return TRUE; /* Overflow */ if (Alloced_length < len) { char *new_ptr; diff --git a/sql/sql_string.h b/sql/sql_string.h index 0ce67108423..d21b5353b76 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -104,7 +104,7 @@ public: inline uint32 alloced_length() const { return Alloced_length;} inline char& operator [] (uint32 i) const { return Ptr[i]; } inline void length(uint32 len) { str_length=len ; } - inline bool is_empty() { return (str_length == 0); } + inline bool is_empty() const { return (str_length == 0); } inline void mark_as_const() { Alloced_length= 0;} inline const char *ptr() const { return Ptr; } inline char *c_ptr() diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 3bb7f7667ea..52454936546 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -22,7 +22,7 @@ #include "sql_rename.h" // do_rename #include "sql_parse.h" // test_if_data_home_dir #include "sql_cache.h" // query_cache_* -#include "sql_base.h" // open_temporary_table, lock_table_names +#include "sql_base.h" // open_table_uncached, lock_table_names #include "lock.h" // wait_if_global_read_lock // start_waiting_global_read_lock, // mysql_unlock_tables @@ -2008,7 +2008,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, { for (table= tables; table; table= table->next_local) if (table->open_type != OT_BASE_ONLY && - find_temporary_table(thd, table->db, table->table_name)) + find_temporary_table(thd, table)) { /* A temporary table. @@ -3536,6 +3536,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, key_part_info->length=(uint16) length; /* Use packed keys for long strings on the first column */ if (!((*db_options) & HA_OPTION_NO_PACK_KEYS) && + !((create_info->table_options & HA_OPTION_NO_PACK_KEYS)) && (length >= KEY_DEFAULT_PACK_LENGTH && (sql_field->sql_type == MYSQL_TYPE_STRING || sql_field->sql_type == MYSQL_TYPE_VARCHAR || @@ -4224,9 +4225,14 @@ bool mysql_create_table_no_lock(THD *thd, if (create_info->options & HA_LEX_CREATE_TMP_TABLE) { - TABLE *table= NULL; - /* Open table and put in temporary table list */ - if (!(table= open_temporary_table(thd, path, db, table_name, 1))) + /* + Open a table (skipping table cache) and add it into + THD::temporary_tables list. + */ + + TABLE *table= open_table_uncached(thd, path, db, table_name, TRUE); + + if (!table) { (void) rm_temporary_table(create_info->db_type, path); goto err; @@ -4268,6 +4274,7 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, Alter_info *alter_info) { bool result; + bool is_trans= FALSE; DBUG_ENTER("mysql_create_table"); /* @@ -4282,7 +4289,6 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, /* Got lock. */ DEBUG_SYNC(thd, "locked_table_name"); - bool is_trans; result= mysql_create_table_no_lock(thd, create_table->db, create_table->table_name, create_info, alter_info, FALSE, 0, &is_trans); @@ -4454,6 +4460,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table, HA_CREATE_INFO local_create_info; Alter_info local_alter_info; bool res= TRUE; + bool is_trans= FALSE; uint not_used; DBUG_ENTER("mysql_create_like_table"); @@ -4503,7 +4510,6 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table, /* Reset auto-increment counter for the new table. */ local_create_info.auto_increment_value= 0; - bool is_trans; if ((res= mysql_create_table_no_lock(thd, table->db, table->table_name, &local_create_info, &local_alter_info, FALSE, 0, &is_trans))) @@ -5913,7 +5919,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, *fn_ext(new_name)=0; if (mysql_rename_table(old_db_type,db,table_name,new_db,new_alias, 0)) error= -1; - else if (Table_triggers_list::change_table_name(thd, db, table_name, + else if (Table_triggers_list::change_table_name(thd, db, + alias, table_name, new_db, new_alias)) { (void) mysql_rename_table(old_db_type, new_db, new_alias, db, @@ -6301,8 +6308,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, /* table is a normal table: Create temporary table in same directory */ build_table_filename(path, sizeof(path) - 1, new_db, tmp_name, "", FN_IS_TMP); - /* Open our intermediate table */ - new_table= open_temporary_table(thd, path, new_db, tmp_name, 1); + /* Open our intermediate table. */ + new_table= open_table_uncached(thd, path, new_db, tmp_name, TRUE); } if (!new_table) goto err_new_table_cleanup; @@ -6550,7 +6557,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, (need_copy_table != ALTER_TABLE_METADATA_ONLY || mysql_rename_table(save_old_db_type, db, table_name, new_db, new_alias, NO_FRM_RENAME)) && - Table_triggers_list::change_table_name(thd, db, table_name, + Table_triggers_list::change_table_name(thd, db, alias, table_name, new_db, new_alias))) { /* Try to get everything back. */ @@ -6642,7 +6649,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, char path[FN_REFLEN]; TABLE *t_table; build_table_filename(path + 1, sizeof(path) - 1, new_db, table_name, "", 0); - t_table= open_temporary_table(thd, path, new_db, tmp_name, 0); + t_table= open_table_uncached(thd, path, new_db, tmp_name, FALSE); if (t_table) { intern_close_table(t_table); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index b81461e8371..a9b52eee9fc 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -458,7 +458,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) DBUG_ASSERT(tables->next_global == 0); /* We do not allow creation of triggers on temporary tables. */ - if (create && find_temporary_table(thd, tables->db, tables->table_name)) + if (create && find_temporary_table(thd, tables)) { my_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE, MYF(0), tables->alias); goto end; @@ -1874,6 +1874,7 @@ Table_triggers_list::change_table_name_in_trignames(const char *old_db_name, @param[in,out] thd Thread context @param[in] db Old database of subject table + @param[in] old_alias Old alias of subject table @param[in] old_table Old name of subject table @param[in] new_db New database for subject table @param[in] new_table New name of subject table @@ -1890,6 +1891,7 @@ Table_triggers_list::change_table_name_in_trignames(const char *old_db_name, */ bool Table_triggers_list::change_table_name(THD *thd, const char *db, + const char *old_alias, const char *old_table, const char *new_db, const char *new_table) @@ -1911,7 +1913,7 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db, MDL_EXCLUSIVE)); DBUG_ASSERT(my_strcasecmp(table_alias_charset, db, new_db) || - my_strcasecmp(table_alias_charset, old_table, new_table)); + my_strcasecmp(table_alias_charset, old_alias, new_table)); if (Table_triggers_list::check_n_load(thd, db, old_table, &table, TRUE)) { @@ -1920,7 +1922,7 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db, } if (table.triggers) { - LEX_STRING old_table_name= { (char *) old_table, strlen(old_table) }; + LEX_STRING old_table_name= { (char *) old_alias, strlen(old_alias) }; LEX_STRING new_table_name= { (char *) new_table, strlen(new_table) }; /* Since triggers should be in the same schema as their subject tables @@ -2006,6 +2008,7 @@ bool Table_triggers_list::process_triggers(THD *thd, bool err_status; Sub_statement_state statement_state; sp_head *sp_trigger= bodies[event][time_type]; + SELECT_LEX *save_current_select; if (sp_trigger == NULL) return FALSE; @@ -2029,11 +2032,19 @@ bool Table_triggers_list::process_triggers(THD *thd, thd->reset_sub_statement_state(&statement_state, SUB_STMT_TRIGGER); + /* + Reset current_select before call execute_trigger() and + restore it after return from one. This way error is set + in case of failure during trigger execution. + */ + save_current_select= thd->lex->current_select; + thd->lex->current_select= NULL; err_status= sp_trigger->execute_trigger(thd, &trigger_table->s->db, &trigger_table->s->table_name, &subject_table_grants[event][time_type]); + thd->lex->current_select= save_current_select; thd->restore_sub_statement_state(&statement_state); diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index 28bf0a60877..dd954957f07 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -157,6 +157,7 @@ public: TABLE *table, bool names_only); static bool drop_all_triggers(THD *thd, char *db, char *table_name); static bool change_table_name(THD *thd, const char *db, + const char *old_alias, const char *old_table, const char *new_db, const char *new_table); diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index a61abdafe3e..c0bc726a188 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -208,8 +208,8 @@ static bool recreate_temporary_table(THD *thd, TABLE *table) ha_create_table(thd, share->normalized_path.str, share->db.str, share->table_name.str, &create_info, 1); - if (open_temporary_table(thd, share->path.str, share->db.str, - share->table_name.str, 1)) + if (open_table_uncached(thd, share->path.str, share->db.str, + share->table_name.str, TRUE)) { error= FALSE; thd->thread_specific_used= TRUE; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 70e7e21cef4..5047599f99b 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1425,6 +1425,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %type <table> table_ident table_ident_nodb references xid + table_ident_opt_wild %type <simple_string> remember_name remember_end opt_db text_or_password @@ -10371,7 +10372,7 @@ table_alias_ref_list: ; table_alias_ref: - table_ident + table_ident_opt_wild { if (!Select->add_table_to_list(YYTHD, $1, NULL, TL_OPTION_UPDATING | TL_OPTION_ALIAS, @@ -10446,8 +10447,11 @@ insert_lock_option: | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; } | DELAYED_SYM { + Lex->keyword_delayed_begin_offset= (uint)(YYLIP->get_tok_start() - + YYTHD->query()); + Lex->keyword_delayed_end_offset= Lex->keyword_delayed_begin_offset + + YYLIP->yyLength() + 1; $$= TL_WRITE_DELAYED; - Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_DELAYED); } | HIGH_PRIORITY { $$= TL_WRITE; } ; @@ -10456,8 +10460,11 @@ replace_lock_option: opt_low_priority { $$= $1; } | DELAYED_SYM { + Lex->keyword_delayed_begin_offset= (uint)(YYLIP->get_tok_start() - + YYTHD->query()); + Lex->keyword_delayed_end_offset= Lex->keyword_delayed_begin_offset + + YYLIP->yyLength() + 1; $$= TL_WRITE_DELAYED; - Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_DELAYED); } ; @@ -11277,7 +11284,11 @@ opt_with_read_lock: TABLE_LIST *tables= Lex->query_tables; Lex->type|= REFRESH_READ_LOCK; for (; tables; tables= tables->next_global) + { tables->mdl_request.set_type(MDL_SHARED_NO_WRITE); + tables->required_type= FRMTYPE_TABLE; /* Don't try to flush views. */ + tables->open_type= OT_BASE_ONLY; /* Ignore temporary tables. */ + } } ; @@ -12161,6 +12172,21 @@ table_ident: } ; +table_ident_opt_wild: + ident opt_wild + { + $$= new Table_ident($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | ident '.' ident opt_wild + { + $$= new Table_ident(YYTHD, $1,$3,0); + if ($$ == NULL) + MYSQL_YYABORT; + } + ; + table_ident_nodb: ident { @@ -13225,6 +13251,13 @@ handler: handler_read_or_scan where_clause opt_limit_clause { Lex->expr_allows_subselect= TRUE; + /* Stored functions are not supported for HANDLER READ. */ + if (Lex->uses_stored_routines()) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), + "stored functions in HANDLER ... READ"); + MYSQL_YYABORT; + } } ; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index fdda514986b..ca3447dcc82 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -145,7 +145,7 @@ static Sys_var_ulong Sys_pfs_max_mutex_instances( "performance_schema_max_mutex_instances", "Maximum number of instrumented MUTEX objects.", READ_ONLY GLOBAL_VAR(pfs_param.m_mutex_sizing), - CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024), + CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100*1024*1024), DEFAULT(PFS_MAX_MUTEX), BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES); @@ -161,7 +161,7 @@ static Sys_var_ulong Sys_pfs_max_rwlock_instances( "performance_schema_max_rwlock_instances", "Maximum number of instrumented RWLOCK objects.", READ_ONLY GLOBAL_VAR(pfs_param.m_rwlock_sizing), - CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024), + CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100*1024*1024), DEFAULT(PFS_MAX_RWLOCK), BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES); @@ -1673,19 +1673,13 @@ static Sys_var_ulong Sys_trans_prealloc_size( static const char *thread_handling_names[]= { - "one-thread-per-connection", "no-threads", -#if HAVE_POOL_OF_THREADS == 1 - "pool-of-threads", -#endif + "one-thread-per-connection", "no-threads", "loaded-dynamically", 0 }; static Sys_var_enum Sys_thread_handling( "thread_handling", "Define threads usage for handling queries, one of " - "one-thread-per-connection, no-threads" -#if HAVE_POOL_OF_THREADS == 1 - ", pool-of-threads" -#endif + "one-thread-per-connection, no-threads, loaded-dynamically" , READ_ONLY GLOBAL_VAR(thread_handling), CMD_LINE(REQUIRED_ARG), thread_handling_names, DEFAULT(0)); diff --git a/sql/sys_vars.h b/sql/sys_vars.h index ee6b429b04a..740c4f03e3e 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -385,7 +385,7 @@ public: DBUG_ASSERT(scope() == GLOBAL); DBUG_ASSERT(size == sizeof(char *)); } - ~Sys_var_charptr() + void cleanup() { if (flags & ALLOCATED) my_free(global_var(char*)); diff --git a/sql/table.cc b/sql/table.cc index f08a0aa84ca..cf6eeaf1afb 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -426,6 +426,18 @@ void TABLE_SHARE::destroy() info_it->flags= 0; } } + if (ha_data_destroy) + { + ha_data_destroy(ha_data); + ha_data_destroy= NULL; + } +#ifdef WITH_PARTITION_STORAGE_ENGINE + if (ha_part_data_destroy) + { + ha_part_data_destroy(ha_part_data); + ha_part_data_destroy= NULL; + } +#endif /* WITH_PARTITION_STORAGE_ENGINE */ /* Make a copy since the share is allocated in its own root, and free_root() updates its argument after freeing the memory. @@ -1704,11 +1716,17 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, delete handler_file; my_hash_free(&share->name_hash); if (share->ha_data_destroy) + { share->ha_data_destroy(share->ha_data); + share->ha_data_destroy= NULL; + } #ifdef WITH_PARTITION_STORAGE_ENGINE if (share->ha_part_data_destroy) + { share->ha_part_data_destroy(share->ha_part_data); -#endif + share->ha_data_destroy= NULL; + } +#endif /* WITH_PARTITION_STORAGE_ENGINE */ open_table_error(share, error, share->open_errno, errarg); DBUG_RETURN(error); @@ -3223,6 +3241,65 @@ bool TABLE_SHARE::wait_for_old_version(THD *thd, struct timespec *abstime, } +/** + Initialize TABLE instance (newly created, or coming either from table + cache or THD::temporary_tables list) and prepare it for further use + during statement execution. Set the 'alias' attribute from the specified + TABLE_LIST element. Remember the TABLE_LIST element in the + TABLE::pos_in_table_list member. + + @param thd Thread context. + @param tl TABLE_LIST element. +*/ + +void TABLE::init(THD *thd, TABLE_LIST *tl) +{ + DBUG_ASSERT(s->ref_count > 0 || s->tmp_table != NO_TMP_TABLE); + + if (thd->lex->need_correct_ident()) + alias_name_used= my_strcasecmp(table_alias_charset, + s->table_name.str, + tl->alias); + /* Fix alias if table name changes. */ + if (strcmp(alias, tl->alias)) + { + uint length= (uint) strlen(tl->alias)+1; + alias= (char*) my_realloc((char*) alias, length, MYF(MY_WME)); + memcpy((char*) alias, tl->alias, length); + } + + tablenr= thd->current_tablenr++; + used_fields= 0; + const_table= 0; + null_row= 0; + maybe_null= 0; + force_index= 0; + force_index_order= 0; + force_index_group= 0; + status= STATUS_NO_RECORD; + insert_values= 0; + fulltext_searched= 0; + file->ft_handler= 0; + reginfo.impossible_range= 0; + + /* Catch wrong handling of the auto_increment_field_not_null. */ + DBUG_ASSERT(!auto_increment_field_not_null); + auto_increment_field_not_null= FALSE; + + if (timestamp_field) + timestamp_field_type= timestamp_field->get_auto_set_type(); + + pos_in_table_list= tl; + + clear_column_bitmaps(); + + DBUG_ASSERT(key_read == 0); + + /* Tables may be reused in a sub statement. */ + DBUG_ASSERT(!file->extra(HA_EXTRA_IS_ATTACHED_CHILDREN)); +} + + /* Create Item_field for each column in the table. diff --git a/sql/table.h b/sql/table.h index bce1124fbb3..6723293c1ec 100644 --- a/sql/table.h +++ b/sql/table.h @@ -83,18 +83,6 @@ enum enum_table_ref_type }; -/** - Opening modes for open_temporary_table and open_table_from_share -*/ - -enum open_table_mode -{ - OTM_OPEN= 0, - OTM_CREATE= 1, - OTM_ALTER= 2 -}; - - /*************************************************************************/ /** @@ -204,7 +192,6 @@ typedef struct st_order { struct st_order *next; Item **item; /* Point at item in select fields */ Item *item_ptr; /* Storage for initial item */ - Item **item_copy; /* For SPs; the original item ptr */ int counter; /* position in SELECT list, correct only if counter_used is true*/ bool asc; /* true if ascending */ @@ -1097,6 +1084,7 @@ public: #endif MDL_ticket *mdl_ticket; + void init(THD *thd, TABLE_LIST *tl); bool fill_item_list(List<Item> *item_list) const; void reset_item_list(List<Item> *item_list) const; void clear_column_bitmaps(void); diff --git a/sql/transaction.cc b/sql/transaction.cc index a28fba8805d..d3e3ba142b9 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -565,7 +565,8 @@ bool trans_xa_end(THD *thd) else if (!xa_trans_rolled_back(&thd->transaction.xid_state)) thd->transaction.xid_state.xa_state= XA_IDLE; - DBUG_RETURN(thd->transaction.xid_state.xa_state != XA_IDLE); + DBUG_RETURN(thd->is_error() || + thd->transaction.xid_state.xa_state != XA_IDLE); } @@ -596,7 +597,8 @@ bool trans_xa_prepare(THD *thd) else thd->transaction.xid_state.xa_state= XA_PREPARED; - DBUG_RETURN(thd->transaction.xid_state.xa_state != XA_PREPARED); + DBUG_RETURN(thd->is_error() || + thd->transaction.xid_state.xa_state != XA_PREPARED); } diff --git a/sql/tztime.cc b/sql/tztime.cc index 43d43123158..a2f319d4307 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -2300,7 +2300,7 @@ my_tz_find(THD *thd, const String *name) DBUG_PRINT("enter", ("time zone name='%s'", name ? ((String *)name)->c_ptr_safe() : "NULL")); - if (!name) + if (!name || name->is_empty()) DBUG_RETURN(0); mysql_mutex_lock(&tz_LOCK); diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 2549589b0c7..d6185b35cf9 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -3761,9 +3761,10 @@ btr_cur_set_ownership_of_extern_field( Marks not updated extern fields as not-owned by this record. The ownership is transferred to the updated record which is inserted elsewhere in the index tree. In purge only the owner of externally stored field is allowed -to free the field. */ +to free the field. +@return TRUE if BLOB ownership was transferred */ UNIV_INTERN -void +ibool btr_cur_mark_extern_inherited_fields( /*=================================*/ page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed @@ -3777,13 +3778,14 @@ btr_cur_mark_extern_inherited_fields( ulint n; ulint j; ulint i; + ibool change_ownership = FALSE; ut_ad(rec_offs_validate(rec, NULL, offsets)); ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec)); if (!rec_offs_any_extern(offsets)) { - return; + return(FALSE); } n = rec_offs_n_fields(offsets); @@ -3806,10 +3808,14 @@ btr_cur_mark_extern_inherited_fields( btr_cur_set_ownership_of_extern_field( page_zip, rec, index, offsets, i, FALSE, mtr); + + change_ownership = TRUE; updated: ; } } + + return(change_ownership); } /*******************************************************************//** diff --git a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c index 4131d863e6a..7b51fc60fcc 100644 --- a/storage/innobase/buf/buf0flu.c +++ b/storage/innobase/buf/buf0flu.c @@ -43,6 +43,8 @@ Created 11/11/1995 Heikki Tuuri #include "log0log.h" #include "os0file.h" #include "trx0sys.h" +#include "mysql/plugin.h" +#include "mysql/service_thd_wait.h" /********************************************************************** These statistics are generated for heuristics used in estimating the @@ -1744,10 +1746,14 @@ buf_flush_wait_batch_end( buf_pool = buf_pool_from_array(i); + thd_wait_begin(NULL, THD_WAIT_DISKIO); os_event_wait(buf_pool->no_flush[type]); + thd_wait_end(NULL); } } else { + thd_wait_begin(NULL, THD_WAIT_DISKIO); os_event_wait(buf_pool->no_flush[type]); + thd_wait_end(NULL); } } diff --git a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c index 99a56bf91bc..82b45172988 100644 --- a/storage/innobase/buf/buf0rea.c +++ b/storage/innobase/buf/buf0rea.c @@ -37,6 +37,8 @@ Created 11/5/1995 Heikki Tuuri #include "os0file.h" #include "srv0start.h" #include "srv0srv.h" +#include "mysql/plugin.h" +#include "mysql/service_thd_wait.h" /** The linear read-ahead area size */ #define BUF_READ_AHEAD_LINEAR_AREA BUF_READ_AHEAD_AREA @@ -135,6 +137,7 @@ buf_read_page_low( ut_ad(buf_page_in_file(bpage)); + thd_wait_begin(NULL, THD_WAIT_DISKIO); if (zip_size) { *err = fil_io(OS_FILE_READ | wake_later, sync, space, zip_size, offset, 0, zip_size, @@ -146,6 +149,7 @@ buf_read_page_low( sync, space, 0, offset, 0, UNIV_PAGE_SIZE, ((buf_block_t*) bpage)->frame, bpage); } + thd_wait_end(NULL); ut_a(*err == DB_SUCCESS); if (sync) { diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index a004cba9603..2415b5860dc 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3542,12 +3542,19 @@ ha_innobase::innobase_initialize_autoinc() err = row_search_max_autoinc(index, col_name, &read_auto_inc); switch (err) { - case DB_SUCCESS: + case DB_SUCCESS: { + ulonglong col_max_value; + + col_max_value = innobase_get_int_col_max_value(field); + /* At the this stage we do not know the increment - or the offset, so use a default increment of 1. */ - auto_inc = read_auto_inc + 1; - break; + nor the offset, so use a default increment of 1. */ + + auto_inc = innobase_next_autoinc( + read_auto_inc, 1, 1, col_max_value); + break; + } case DB_RECORD_NOT_FOUND: ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: MySQL and InnoDB data " @@ -3842,8 +3849,6 @@ retry: dict_table_get_format(prebuilt->table)); } - info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); - /* Only if the table has an AUTOINC column. */ if (prebuilt->table != NULL && table->found_next_number_field != NULL) { dict_table_autoinc_lock(prebuilt->table); @@ -3860,6 +3865,8 @@ retry: dict_table_autoinc_unlock(prebuilt->table); } + info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); + DBUG_RETURN(0); } diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 7cafa6e0df5..16a557850a3 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -456,9 +456,10 @@ btr_estimate_number_of_different_key_vals( Marks not updated extern fields as not-owned by this record. The ownership is transferred to the updated record which is inserted elsewhere in the index tree. In purge only the owner of externally stored field is allowed -to free the field. */ +to free the field. +@return TRUE if BLOB ownership was transferred */ UNIV_INTERN -void +ibool btr_cur_mark_extern_inherited_fields( /*=================================*/ page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 971173a65a5..029cf408141 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -707,6 +707,22 @@ ulint dict_table_zip_size( /*================*/ const dict_table_t* table); /*!< in: table */ +/*********************************************************************//** +Obtain exclusive locks on all index trees of the table. This is to prevent +accessing index trees while InnoDB is updating internal metadata for +operations such as truncate tables. */ +UNIV_INLINE +void +dict_table_x_lock_indexes( +/*======================*/ + dict_table_t* table); /*!< in: table */ +/*********************************************************************//** +Release the exclusive locks on all index tree. */ +UNIV_INLINE +void +dict_table_x_unlock_indexes( +/*========================*/ + dict_table_t* table); /*!< in: table */ /********************************************************************//** Checks if a column is in the ordering columns of the clustered index of a table. Column prefixes are treated like whole columns. diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic index 09f967aa74a..42f124dedfc 100644 --- a/storage/innobase/include/dict0dict.ic +++ b/storage/innobase/include/dict0dict.ic @@ -490,6 +490,48 @@ dict_table_zip_size( return(dict_table_flags_to_zip_size(table->flags)); } +/*********************************************************************//** +Obtain exclusive locks on all index trees of the table. This is to prevent +accessing index trees while InnoDB is updating internal metadata for +operations such as truncate tables. */ +UNIV_INLINE +void +dict_table_x_lock_indexes( +/*======================*/ + dict_table_t* table) /*!< in: table */ +{ + dict_index_t* index; + + ut_a(table); + ut_ad(mutex_own(&(dict_sys->mutex))); + + /* Loop through each index of the table and lock them */ + for (index = dict_table_get_first_index(table); + index != NULL; + index = dict_table_get_next_index(index)) { + rw_lock_x_lock(dict_index_get_lock(index)); + } +} + +/*********************************************************************//** +Release the exclusive locks on all index tree. */ +UNIV_INLINE +void +dict_table_x_unlock_indexes( +/*========================*/ + dict_table_t* table) /*!< in: table */ +{ + dict_index_t* index; + + ut_a(table); + ut_ad(mutex_own(&(dict_sys->mutex))); + + for (index = dict_table_get_first_index(table); + index != NULL; + index = dict_table_get_next_index(index)) { + rw_lock_x_unlock(dict_index_get_lock(index)); + } +} /********************************************************************//** Gets the number of fields in the internal representation of an index, including fields added by the dictionary system. diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 1262ac71e98..fc71f52096f 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -2808,6 +2808,15 @@ row_truncate_table_for_mysql( trx->table_id = table->id; + /* Lock all index trees for this table, as we will + truncate the table/index and possibly change their metadata. + All DML/DDL are blocked by table level lock, with + a few exceptions such as queries into information schema + about the table, MySQL could try to access index stats + for this kind of query, we need to use index locks to + sync up */ + dict_table_x_lock_indexes(table); + if (table->space && !table->dir_path_of_temp_table) { /* Discard and create the single-table tablespace. */ ulint space = table->space; @@ -2824,6 +2833,7 @@ row_truncate_table_for_mysql( || fil_create_new_single_table_tablespace( space, table->name, FALSE, flags, FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) { + dict_table_x_unlock_indexes(table); ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: TRUNCATE TABLE %s failed to" @@ -2927,6 +2937,10 @@ next_rec: mem_heap_free(heap); + /* Done with index truncation, release index tree locks, + subsequent work relates to table level metadata change */ + dict_table_x_unlock_indexes(table); + dict_hdr_get_new_id(&new_id, NULL, NULL); info = pars_info_create(); diff --git a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c index 588ee352ba0..a1004c0d2cf 100644 --- a/storage/innobase/row/row0upd.c +++ b/storage/innobase/row/row0upd.c @@ -1626,6 +1626,7 @@ row_upd_clust_rec_by_insert( dict_table_t* table; dtuple_t* entry; ulint err; + ibool change_ownership = FALSE; ut_ad(node); ut_ad(dict_index_is_clust(index)); @@ -1658,10 +1659,11 @@ row_upd_clust_rec_by_insert( index = dict_table_get_first_index(table); offsets = rec_get_offsets(rec, index, offsets_, ULINT_UNDEFINED, &heap); - btr_cur_mark_extern_inherited_fields( + change_ownership = btr_cur_mark_extern_inherited_fields( btr_cur_get_page_zip(btr_cur), rec, index, offsets, node->update, mtr); if (referenced) { + /* NOTE that the following call loses the position of pcur ! */ @@ -1694,10 +1696,11 @@ row_upd_clust_rec_by_insert( row_upd_index_entry_sys_field(entry, index, DATA_TRX_ID, trx->id); - if (node->upd_ext) { + if (change_ownership) { /* If we return from a lock wait, for example, we may have extern fields marked as not-owned in entry (marked in the - if-branch above). We must unmark them. */ + if-branch above). We must unmark them, take the ownership + back. */ btr_cur_unmark_dtuple_extern_fields(entry); diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index bea8d7f8fdc..b2da43c188b 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -84,6 +84,8 @@ Created 10/8/1995 Heikki Tuuri #include "ha_prototypes.h" #include "trx0i_s.h" #include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */ +#include "mysql/plugin.h" +#include "mysql/service_thd_wait.h" /* This is set to TRUE if the MySQL user has set it in MySQL; currently affects only FOREIGN KEY definition parsing */ @@ -1232,7 +1234,9 @@ retry: trx->op_info = "waiting in InnoDB queue"; + thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_TABLE_LOCK); os_event_wait(slot->event); + thd_wait_end(trx->mysql_thd); trx->op_info = ""; @@ -1597,7 +1601,9 @@ srv_suspend_mysql_thread( /* Suspend this thread and wait for the event. */ + thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_TABLE_LOCK); os_event_wait(event); + thd_wait_end(trx->mysql_thd); /* After resuming, reacquire the data dictionary latch if necessary. */ diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c index bce42b64e99..75038fce070 100644 --- a/storage/myisam/mi_key.c +++ b/storage/myisam/mi_key.c @@ -253,18 +253,17 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, pos=old; if (keyseg->flag & HA_SPACE_PACK) { - uchar *end=pos+length; if (type == HA_KEYTYPE_NUM) { - while (pos < end && pos[0] == ' ') - pos++; + uchar *end= pos + length; + while (pos < end && pos[0] == ' ') + pos++; + length= (uint) (end - pos); } else if (type != HA_KEYTYPE_BINARY) { - while (end > pos && end[-1] == ' ') - end--; + length= cs->cset->lengthsp(cs, (char*) pos, length); } - length=(uint) (end-pos); FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); memcpy((uchar*) key,pos,(size_t) char_length); diff --git a/storage/myisam/mi_range.c b/storage/myisam/mi_range.c index 927c511eec1..28bf5cbe033 100644 --- a/storage/myisam/mi_range.c +++ b/storage/myisam/mi_range.c @@ -193,12 +193,11 @@ static double _mi_search_pos(register MI_INFO *info, register my_off_t pos) { int flag; - uint nod_flag,keynr,max_keynr; + uint nod_flag,keynr,UNINIT_VAR(max_keynr); my_bool after_key; uchar *keypos,*buff; double offset; DBUG_ENTER("_mi_search_pos"); - LINT_INIT(max_keynr); if (pos == HA_OFFSET_ERROR) DBUG_RETURN(0.5); diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index 24456e3d8fa..61ca3c37863 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -296,9 +296,9 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, flag is the value returned by ha_key_cmp and as treated as final */ int flag=0, my_flag=-1; - uint nod_flag, length, len, matched, cmplen, kseg_len; - uint prefix_len,suffix_len; - int key_len_skip, seg_len_pack, key_len_left; + uint nod_flag, UNINIT_VAR(length), len, matched, cmplen, kseg_len; + uint UNINIT_VAR(prefix_len), suffix_len; + int key_len_skip, UNINIT_VAR(seg_len_pack), key_len_left; uchar *end, *kseg, *vseg; uchar *sort_order=keyinfo->seg->charset->sort_order; uchar tt_buff[MI_MAX_KEY_BUFF+2], *t_buff=tt_buff+2; @@ -308,10 +308,6 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, uint length_pack; DBUG_ENTER("_mi_prefix_search"); - LINT_INIT(length); - LINT_INIT(prefix_len); - LINT_INIT(seg_len_pack); - t_buff[0]=0; /* Avoid bugs */ end= page+mi_getint(page); nod_flag=mi_test_if_nod(page); diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c index 32cf1fd924d..37a06606b3c 100644 --- a/storage/myisam/rt_index.c +++ b/storage/myisam/rt_index.c @@ -481,17 +481,13 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, uint key_length, uchar *page_buf, uint nod_flag) { double increase; - double best_incr; + double UNINIT_VAR(best_incr); double area; - double best_area; + double UNINIT_VAR(best_area); uchar *best_key= NULL; uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag); uchar *last = rt_PAGE_END(page_buf); - LINT_INIT(best_area); - LINT_INIT(best_key); - LINT_INIT(best_incr); - for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag)) { /* The following is safe as -1.0 is an exact number */ diff --git a/storage/myisam/rt_split.c b/storage/myisam/rt_split.c index 03d22de68fa..0b7cc43e062 100644 --- a/storage/myisam/rt_split.c +++ b/storage/myisam/rt_split.c @@ -178,18 +178,13 @@ static int split_rtree_node(SplitStruct *node, int n_entries, double **d_buffer, int n_dim) { SplitStruct *cur; - SplitStruct *a; - SplitStruct *b; + SplitStruct *UNINIT_VAR(a), *UNINIT_VAR(b); double *g1 = reserve_coords(d_buffer, n_dim); double *g2 = reserve_coords(d_buffer, n_dim); - SplitStruct *next; - int next_node; + SplitStruct *UNINIT_VAR(next); + int UNINIT_VAR(next_node); int i; SplitStruct *end = node + n_entries; - LINT_INIT(a); - LINT_INIT(b); - LINT_INIT(next); - LINT_INIT(next_node); if (all_size < min_size * 2) { diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index f62aff4e383..466c66ec769 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -478,6 +478,8 @@ int ha_myisammrg::add_children_list(void) /* Set the expected table version, to not cause spurious re-prepare. */ child_l->set_table_ref_id(mrg_child_def->get_child_table_ref_type(), mrg_child_def->get_child_def_version()); + /* Use the same metadata lock type for children. */ + child_l->mdl_request.set_type(parent_l->mdl_request.type); /* Link TABLE_LIST object into the children list. */ if (this->children_last_l) child_l->prev_global= this->children_last_l; diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index 0fac734f7a0..e5e324d6c6b 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -20,6 +20,7 @@ #include "my_global.h" #include "my_pthread.h" +#include "my_atomic.h" #include "sql_plugin.h" #include "mysql/plugin.h" #include "ha_perfschema.h" @@ -28,6 +29,17 @@ #include "pfs_instr_class.h" #include "pfs_instr.h" +#ifdef MY_ATOMIC_MODE_DUMMY +/* + The performance schema can can not function with MY_ATOMIC_MODE_DUMMY, + a fully functional implementation of MY_ATOMIC should be used instead. + If the build fails with this error message: + - either use a different ./configure --with-atomic-ops option + - or do not build with the performance schema. +*/ +#error "The performance schema needs a functional MY_ATOMIC implementation." +#endif + handlerton *pfs_hton= NULL; static handler* pfs_create_handler(handlerton *hton, diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index 245664bc2b6..139064ab212 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -1625,18 +1625,26 @@ static void end_mutex_wait_v1(PSI_mutex_locker* locker, int rc) if (flag_events_waits_history_long) insert_events_waits_history_long(wait); - if (rc == 0 && wait->m_timer_state == TIMER_STATE_TIMED) + if (rc == 0) { /* Thread safe: we are protected by the instrumented mutex */ - PFS_single_stat_chain *stat; PFS_mutex *mutex= pfs_locker->m_target.m_mutex; + PFS_single_stat_chain *stat= find_per_thread_mutex_class_wait_stat(wait->m_thread, mutex->m_class); mutex->m_owner= wait->m_thread; mutex->m_last_locked= wait->m_timer_end; - ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; - aggregate_single_stat_chain(&mutex->m_wait_stat, wait_time); - stat= find_per_thread_mutex_class_wait_stat(wait->m_thread, mutex->m_class); - aggregate_single_stat_chain(stat, wait_time); + /* If timed then aggregate stats, else increment the value counts only */ + if (wait->m_timer_state == TIMER_STATE_TIMED) + { + ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; + aggregate_single_stat_chain(&mutex->m_wait_stat, wait_time); + aggregate_single_stat_chain(stat, wait_time); + } + else + { + increment_single_stat_chain(&mutex->m_wait_stat); + increment_single_stat_chain(stat); + } } wait->m_thread->m_wait_locker_count--; } @@ -1682,20 +1690,26 @@ static void end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc) The statistics generated are not safe, which is why they are just statistics, not facts. */ - PFS_single_stat_chain *stat; PFS_rwlock *rwlock= pfs_locker->m_target.m_rwlock; + PFS_single_stat_chain *stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class); + if (rwlock->m_readers == 0) rwlock->m_last_read= wait->m_timer_end; rwlock->m_writer= NULL; rwlock->m_readers++; + /* If timed then aggregate stats, else increment the value counts only */ if (wait->m_timer_state == TIMER_STATE_TIMED) { ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time); - stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class); aggregate_single_stat_chain(stat, wait_time); } + else + { + increment_single_stat_chain(&rwlock->m_wait_stat); + increment_single_stat_chain(stat); + } } wait->m_thread->m_wait_locker_count--; } @@ -1735,21 +1749,26 @@ static void end_rwlock_wrwait_v1(PSI_rwlock_locker* locker, int rc) if (rc == 0) { /* Thread safe : we are protected by the instrumented rwlock */ - PFS_single_stat_chain *stat; PFS_rwlock *rwlock= pfs_locker->m_target.m_rwlock; + PFS_single_stat_chain *stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class); rwlock->m_writer= wait->m_thread; rwlock->m_last_written= wait->m_timer_end; /* Reset the readers stats, they could be off */ rwlock->m_readers= 0; rwlock->m_last_read= 0; + /* If timed then aggregate stats, else increment the value counts only */ if (wait->m_timer_state == TIMER_STATE_TIMED) { ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; aggregate_single_stat_chain(&rwlock->m_wait_stat, wait_time); - stat= find_per_thread_rwlock_class_wait_stat(wait->m_thread, rwlock->m_class); aggregate_single_stat_chain(stat, wait_time); } + else + { + increment_single_stat_chain(&rwlock->m_wait_stat); + increment_single_stat_chain(stat); + } } wait->m_thread->m_wait_locker_count--; } @@ -1803,16 +1822,21 @@ static void end_cond_wait_v1(PSI_cond_locker* locker, int rc) in condition B. This is accepted, the data will be slightly inaccurate. */ - PFS_single_stat_chain *stat; PFS_cond *cond= pfs_locker->m_target.m_cond; + PFS_single_stat_chain *stat= find_per_thread_cond_class_wait_stat(wait->m_thread, cond->m_class); + /* If timed then aggregate stats, else increment the value counts only */ if (wait->m_timer_state == TIMER_STATE_TIMED) { ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; aggregate_single_stat_chain(&cond->m_wait_stat, wait_time); - stat= find_per_thread_cond_class_wait_stat(wait->m_thread, cond->m_class); aggregate_single_stat_chain(stat, wait_time); } + else + { + increment_single_stat_chain(&cond->m_wait_stat); + increment_single_stat_chain(stat); + } } wait->m_thread->m_wait_locker_count--; } @@ -1855,12 +1879,18 @@ static void end_table_wait_v1(PSI_table_locker* locker) if (flag_events_waits_history_long) insert_events_waits_history_long(wait); + PFS_table *table= pfs_locker->m_target.m_table; + + /* If timed then aggregate stats, else increment the value counts only */ if (wait->m_timer_state == TIMER_STATE_TIMED) { - PFS_table *table= pfs_locker->m_target.m_table; ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; aggregate_single_stat_chain(&table->m_wait_stat, wait_time); } + else + { + increment_single_stat_chain(&table->m_wait_stat); + } /* There is currently no per table and per thread aggregation. @@ -1962,14 +1992,21 @@ static void end_file_wait_v1(PSI_file_locker *locker, if (flag_events_waits_history_long) insert_events_waits_history_long(wait); - PFS_single_stat_chain *stat; PFS_file *file= pfs_locker->m_target.m_file; + PFS_single_stat_chain *stat= find_per_thread_file_class_wait_stat(wait->m_thread, file->m_class); - ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; - aggregate_single_stat_chain(&file->m_wait_stat, wait_time); - stat= find_per_thread_file_class_wait_stat(wait->m_thread, - file->m_class); - aggregate_single_stat_chain(stat, wait_time); + /* If timed then aggregate stats, else increment the value counts only */ + if (wait->m_timer_state == TIMER_STATE_TIMED) + { + ulonglong wait_time= wait->m_timer_end - wait->m_timer_start; + aggregate_single_stat_chain(&file->m_wait_stat, wait_time); + aggregate_single_stat_chain(stat, wait_time); + } + else + { + increment_single_stat_chain(&file->m_wait_stat); + increment_single_stat_chain(stat); + } PFS_file_class *klass= file->m_class; diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index df00811959c..3b1959c98d2 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -223,6 +223,8 @@ int PFS_engine_table::read_row(TABLE *table, Field **fields) { my_bitmap_map *org_bitmap; + Field *f; + Field **fields_reset; /* Make sure the table structure is as expected before mapping @@ -240,6 +242,16 @@ int PFS_engine_table::read_row(TABLE *table, /* We internally write to Fields to support the read interface */ org_bitmap= dbug_tmp_use_all_columns(table, table->write_set); + + /* + Some callers of the storage engine interface do not honor the + f->is_null() flag, and will attempt to read the data itself. + A known offender is mysql_checksum_table(). + For robustness, reset every field. + */ + for (fields_reset= fields; (f= *fields_reset) ; fields_reset++) + f->reset(); + int result= read_row_values(table, buf, fields, read_all); dbug_tmp_restore_column_map(table->write_set, org_bitmap); diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h index a7af27c1038..8cb68cd52b1 100644 --- a/storage/perfschema/pfs_server.h +++ b/storage/perfschema/pfs_server.h @@ -25,13 +25,13 @@ #define PFS_MAX_MUTEX_CLASS 200 #endif #ifndef PFS_MAX_MUTEX - #define PFS_MAX_MUTEX 1000 + #define PFS_MAX_MUTEX 1000000 #endif #ifndef PFS_MAX_RWLOCK_CLASS - #define PFS_MAX_RWLOCK_CLASS 20 + #define PFS_MAX_RWLOCK_CLASS 30 #endif #ifndef PFS_MAX_RWLOCK - #define PFS_MAX_RWLOCK 1000 + #define PFS_MAX_RWLOCK 1000000 #endif #ifndef PFS_MAX_COND_CLASS #define PFS_MAX_COND_CLASS 80 diff --git a/storage/perfschema/pfs_stat.h b/storage/perfschema/pfs_stat.h index c78d5c83039..5955a515d1a 100644 --- a/storage/perfschema/pfs_stat.h +++ b/storage/perfschema/pfs_stat.h @@ -83,6 +83,22 @@ inline void aggregate_single_stat_chain(PFS_single_stat_chain *stat, while (stat); } +/** + Increment the value counts in a statistic chain. + Used for instruments that are 'ENABLED' but not 'TIMED'. + @param stat the aggregated statistic chain +*/ +inline void increment_single_stat_chain(PFS_single_stat_chain *stat) +{ + do + { + if (*stat->m_control_flag) + stat->m_count++; + stat= stat->m_parent; + } + while (stat); +} + /** Statistics for COND usage. */ struct PFS_cond_stat { diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc index 5e5972b68f1..d34f6fbe722 100644 --- a/storage/perfschema/table_events_waits.cc +++ b/storage/perfschema/table_events_waits.cc @@ -187,7 +187,7 @@ void table_events_waits_common::clear_object_columns() */ void table_events_waits_common::make_row(bool thread_own_wait, PFS_thread *pfs_thread, - PFS_events_waits *wait) + volatile PFS_events_waits *wait) { pfs_lock lock; PFS_thread *safe_thread; @@ -251,21 +251,27 @@ void table_events_waits_common::make_row(bool thread_own_wait, case WAIT_CLASS_TABLE: m_row.m_object_type= "TABLE"; m_row.m_object_type_length= 5; - memcpy(m_row.m_object_schema, wait->m_schema_name, - wait->m_schema_name_length); m_row.m_object_schema_length= wait->m_schema_name_length; - memcpy(m_row.m_object_name, wait->m_object_name, - wait->m_object_name_length); + if (unlikely((m_row.m_object_schema_length == 0) || + (m_row.m_object_schema_length > sizeof(m_row.m_object_schema)))) + return; + memcpy(m_row.m_object_schema, wait->m_schema_name, m_row.m_object_schema_length); m_row.m_object_name_length= wait->m_object_name_length; + if (unlikely((m_row.m_object_name_length == 0) || + (m_row.m_object_name_length > sizeof(m_row.m_object_name)))) + return; + memcpy(m_row.m_object_name, wait->m_object_name, m_row.m_object_name_length); safe_class= &global_table_class; break; case WAIT_CLASS_FILE: m_row.m_object_type= "FILE"; m_row.m_object_type_length= 4; m_row.m_object_schema_length= 0; - memcpy(m_row.m_object_name, wait->m_object_name, - wait->m_object_name_length); m_row.m_object_name_length= wait->m_object_name_length; + if (unlikely((m_row.m_object_name_length == 0) || + (m_row.m_object_name_length > sizeof(m_row.m_object_name)))) + return; + memcpy(m_row.m_object_name, wait->m_object_name, m_row.m_object_name_length); safe_class= sanitize_file_class((PFS_file_class*) wait->m_class); break; case NO_WAIT_CLASS: diff --git a/storage/perfschema/table_events_waits.h b/storage/perfschema/table_events_waits.h index 2aa88b54be4..aa4edb4a368 100644 --- a/storage/perfschema/table_events_waits.h +++ b/storage/perfschema/table_events_waits.h @@ -137,7 +137,7 @@ protected: void clear_object_columns(); void make_row(bool thread_own_wait, PFS_thread *pfs_thread, - PFS_events_waits *wait); + volatile PFS_events_waits *wait); /** Current row. */ row_events_waits m_row; diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index d3b0b93a939..ecfac3170d1 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1469,7 +1469,7 @@ my_strnncoll_utf16_bin(CHARSET_INFO *cs, } if (s_wc != t_wc) { - return s_wc > t_wc ? 1 : -1; + return my_bincmp(s, s + s_res, t, t + t_res); } s+= s_res; @@ -1511,7 +1511,7 @@ my_strnncollsp_utf16_bin(CHARSET_INFO *cs, if (s_wc != t_wc) { - return s_wc > t_wc ? 1 : -1; + return my_bincmp(s, s + s_res, t, t + t_res); } s+= s_res; @@ -1684,8 +1684,8 @@ static MY_COLLATION_HANDLER my_collation_utf16_bin_handler = NULL, /* init */ my_strnncoll_utf16_bin, my_strnncollsp_utf16_bin, - my_strnxfrm_unicode, - my_strnxfrmlen_simple, + my_strnxfrm_unicode_full_bin, + my_strnxfrmlen_unicode_full_bin, my_like_range_utf16, my_wildcmp_utf16_bin, my_strcasecmp_mb2_or_mb4, @@ -2711,8 +2711,8 @@ static MY_COLLATION_HANDLER my_collation_utf32_bin_handler = NULL, /* init */ my_strnncoll_utf32_bin, my_strnncollsp_utf32_bin, - my_strnxfrm_unicode, - my_strnxfrmlen_utf32, + my_strnxfrm_unicode_full_bin, + my_strnxfrmlen_unicode_full_bin, my_like_range_utf32, my_wildcmp_utf32_bin, my_strcasecmp_mb2_or_mb4, diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index ace39130c12..76fff72290b 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1893,7 +1893,13 @@ my_wildcmp_unicode(CHARSET_INFO *cs, /* - This function is shared between utf8mb3/utf8mb4/ucs2/utf16/utf32 + Store sorting weights using 2 bytes per character. + + This function is shared between + - utf8mb3_general_ci, utf8_bin, ucs2_general_ci, ucs2_bin + which support BMP only (U+0000..U+FFFF). + - utf8mb4_general_ci, utf16_general_ci, utf32_general_ci, + which map all supplementary characters to weight 0xFFFD. */ size_t my_strnxfrm_unicode(CHARSET_INFO *cs, @@ -1937,6 +1943,70 @@ my_strnxfrm_unicode(CHARSET_INFO *cs, } +/* + Store sorting weights using 3 bytes per character. + This function is shared between utf8mb4_bin, utf16_bin, utf32_bin. +*/ +size_t +my_strnxfrm_unicode_full_bin(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, + const uchar *src, size_t srclen) +{ + my_wc_t wc; + uchar *de= dst + dstlen; + uchar *de_beg= de - 2; /* The beginning of the last chunk */ + const uchar *se = src + srclen; + + LINT_INIT(wc); + DBUG_ASSERT(src); + DBUG_ASSERT(cs->state & MY_CS_BINSORT); + + while (dst < de_beg) + { + int res; + if ((res= cs->cset->mb_wc(cs, &wc, src, se)) <= 0) + break; + src+= res; + if (cs->mbminlen == 2) /* utf16_bin */ + { + /* + Reorder code points to weights as follows: + U+0000..U+D7FF -> [00][00][00]..[00][D7][FF] BMP part #1 + U+10000..U+10FFFF -> [01][00][00]..[10][FF][FF] Supplementary + U+E000..U+FFFF -> [20][E0][00]..[20][FF][FF] BMP part #2 + */ + if (wc >= 0xE000 && wc <= 0xFFFF) + wc+= 0x200000; + } + *dst++= (uchar) (wc >> 16); + *dst++= (uchar) ((wc >> 8) & 0xFF); + *dst++= (uchar) (wc & 0xFF); + } + + while (dst < de_beg) /* Fill the tail with keys for space character */ + { + *dst++= 0x00; + *dst++= 0x00; + *dst++= 0x20; + } + + /* Clear the last one or two bytes, if "dstlen" was not divisible by 3 */ + if (dst < de) + { + *dst++= 0x00; + if (dst < de) + *dst= 0x00; + } + + return dstlen; +} + + +size_t +my_strnxfrmlen_unicode_full_bin(CHARSET_INFO *cs, size_t len) +{ + return ((len + 3) / cs->mbmaxlen) * 3; +} #endif /* HAVE_UNIDATA */ @@ -5067,8 +5137,8 @@ static MY_COLLATION_HANDLER my_collation_utf8mb4_bin_handler = NULL, /* init */ my_strnncoll_mb_bin, my_strnncollsp_mb_bin, - my_strnxfrm_unicode, - my_strnxfrmlen_utf8mb4, + my_strnxfrm_unicode_full_bin, + my_strnxfrmlen_unicode_full_bin, my_like_range_mb, my_wildcmp_mb_bin, my_strcasecmp_mb_bin, diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 251c3905d5a..1284203f739 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -255,7 +255,7 @@ static char *process_int_arg(char *to, char *end, size_t length, if ((to_length= (size_t) (end-to)) < 16 || length) store_start= buff; - if (arg_type == 'd') + if (arg_type == 'd' || arg_type == 'i') store_end= longlong10_to_str(par, store_start, -10); else if (arg_type == 'u') store_end= longlong10_to_str(par, store_start, 10); @@ -399,6 +399,7 @@ start: args_arr[i].double_arg= va_arg(ap, double); break; case 'd': + case 'i': case 'u': case 'x': case 'X': @@ -406,7 +407,7 @@ start: case 'p': if (args_arr[i].have_longlong) args_arr[i].longlong_arg= va_arg(ap,longlong); - else if (args_arr[i].arg_type == 'd') + else if (args_arr[i].arg_type == 'd' || args_arr[i].arg_type == 'i') args_arr[i].longlong_arg= va_arg(ap, int); else args_arr[i].longlong_arg= va_arg(ap, uint); @@ -458,6 +459,7 @@ start: break; } case 'd': + case 'i': case 'u': case 'x': case 'X': @@ -472,7 +474,7 @@ start: if (args_arr[print_arr[i].arg_idx].have_longlong) larg = args_arr[print_arr[i].arg_idx].longlong_arg; - else if (print_arr[i].arg_type == 'd') + else if (print_arr[i].arg_type == 'd' || print_arr[i].arg_type == 'i' ) larg = (int) args_arr[print_arr[i].arg_idx].longlong_arg; else larg= (uint) args_arr[print_arr[i].arg_idx].longlong_arg; @@ -615,8 +617,8 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n, to= process_dbl_arg(to, end, width, d, *fmt); continue; } - else if (*fmt == 'd' || *fmt == 'u' || *fmt == 'x' || *fmt == 'X' || - *fmt == 'p' || *fmt == 'o') + else if (*fmt == 'd' || *fmt == 'i' || *fmt == 'u' || *fmt == 'x' || + *fmt == 'X' || *fmt == 'p' || *fmt == 'o') { /* Integer parameter */ longlong larg; @@ -625,7 +627,7 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n, if (have_longlong) larg = va_arg(ap,longlong); - else if (*fmt == 'd') + else if (*fmt == 'd' || *fmt == 'i') larg = va_arg(ap, int); else larg= va_arg(ap, uint); diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index ef8ae8dd29a..6a69dbbddd2 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -18937,6 +18937,107 @@ static void test_bug54041() } +/** + Bug#47485: mysql_store_result returns a result set for a prepared statement +*/ +static void test_bug47485() +{ + MYSQL_STMT *stmt; + MYSQL_RES *res; + MYSQL_BIND bind[2]; + int rc; + const char* sql_select = "SELECT 1, 'a'"; + int int_data; + char str_data[16]; + my_bool is_null[2]; + my_bool error[2]; + unsigned long length[2]; + + DBUG_ENTER("test_bug47485"); + myheader("test_bug47485"); + + stmt= mysql_stmt_init(mysql); + check_stmt(stmt); + rc= mysql_stmt_prepare(stmt, sql_select, strlen(sql_select)); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + res = mysql_store_result(mysql); + DIE_UNLESS(res == NULL); + + mysql_stmt_reset(stmt); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + res = mysql_use_result(mysql); + DIE_UNLESS(res == NULL); + + mysql_stmt_reset(stmt); + + memset(bind, 0, sizeof(bind)); + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (char *)&int_data; + bind[0].is_null= &is_null[0]; + bind[0].length= &length[0]; + bind[0].error= &error[0]; + + bind[1].buffer_type= MYSQL_TYPE_STRING; + bind[1].buffer= (char *)str_data; + bind[1].buffer_length= sizeof(str_data); + bind[1].is_null= &is_null[1]; + bind[1].length= &length[1]; + bind[1].error= &error[1]; + + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + rc= mysql_stmt_store_result(stmt); + check_execute(stmt, rc); + + while (!(rc= mysql_stmt_fetch(stmt))) + ; + + DIE_UNLESS(rc == MYSQL_NO_DATA); + + mysql_stmt_reset(stmt); + + memset(bind, 0, sizeof(bind)); + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (char *)&int_data; + bind[0].is_null= &is_null[0]; + bind[0].length= &length[0]; + bind[0].error= &error[0]; + + bind[1].buffer_type= MYSQL_TYPE_STRING; + bind[1].buffer= (char *)str_data; + bind[1].buffer_length= sizeof(str_data); + bind[1].is_null= &is_null[1]; + bind[1].length= &length[1]; + bind[1].error= &error[1]; + + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + while (!(rc= mysql_stmt_fetch(stmt))) + ; + + DIE_UNLESS(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); + + DBUG_VOID_RETURN; +} + + /* Bug#49972: Crash in prepared statements. @@ -19378,6 +19479,7 @@ static struct my_tests_st my_tests[]= { { "test_bug49972", test_bug49972 }, { "test_bug42373", test_bug42373 }, { "test_bug54041", test_bug54041 }, + { "test_bug47485", test_bug47485 }, { 0, 0 } }; diff --git a/unittest/mysys/my_vsnprintf-t.c b/unittest/mysys/my_vsnprintf-t.c index 4ef6c310c8f..e7f37774f85 100644 --- a/unittest/mysys/my_vsnprintf-t.c +++ b/unittest/mysys/my_vsnprintf-t.c @@ -31,7 +31,7 @@ void test1(const char *res, const char *fmt, ...) int main(void) { - plan(54); + plan(58); test1("Constant string", "Constant string"); @@ -44,6 +44,8 @@ int main(void) "Format specifier c %c", '!'); test1("Format specifier d 1", "Format specifier d %d", 1); + test1("Format specifier i 1", + "Format specifier i %i", 1); test1("Format specifier u 2", "Format specifier u %u", 2); test1("Format specifier o 375", @@ -77,6 +79,9 @@ int main(void) test1("Length modifiers work: 1 * -1 * 2 * 3", "Length modifiers work: %d * %ld * %lld * %zd", 1, -1L, 2LL, (size_t)3); + test1("Length modifiers work: 1 * -1 * 2 * 3", + "Length modifiers work: %i * %li * %lli * %zd", 1, -1L, 2LL, (size_t)3); + test1("long long X: 123456789abcdef0", "long long X: %llx", 0x123456789abcdef0LL); @@ -121,6 +126,10 @@ int main(void) "Hello int, %d", 1); test1("Hello int, -1", "Hello int, %d", -1); + test1("Hello int, 1", + "Hello int, %i", 1); + test1("Hello int, -1", + "Hello int, %i", -1); test1("Hello string 'I am a string'", "Hello string '%s'", "I am a string"); test1("Hello hack hack hack hack hack hack hack 1", diff --git a/vio/vio.c b/vio/vio.c index 67704a56b22..48f103c33e8 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -44,6 +44,11 @@ static my_bool no_poll_read(Vio *vio __attribute__((unused)), #endif +static my_bool has_no_data(Vio *vio __attribute__((unused))) +{ + return FALSE; +} + /* * Helper to fill most of the Vio* with defaults. */ @@ -83,6 +88,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type, vio->poll_read =no_poll_read; vio->is_connected =vio_is_connected_pipe; + vio->has_data =has_no_data; vio->timeout=vio_win32_timeout; /* Set default timeout */ @@ -110,6 +116,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type, vio->poll_read =no_poll_read; vio->is_connected =vio_is_connected_shared_memory; + vio->has_data =has_no_data; /* Currently, shared memory is on Windows only, hence the below is ok*/ vio->timeout= vio_win32_timeout; @@ -137,6 +144,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type, vio->timeout =vio_timeout; vio->poll_read =vio_poll_read; vio->is_connected =vio_is_connected; + vio->has_data =vio_ssl_has_data; DBUG_VOID_RETURN; } #endif /* HAVE_OPENSSL */ @@ -155,6 +163,8 @@ static void vio_init(Vio* vio, enum enum_vio_type type, vio->timeout =vio_timeout; vio->poll_read =vio_poll_read; vio->is_connected =vio_is_connected; + vio->has_data= (flags & VIO_BUFFERED_READ) ? + vio_buff_has_data : has_no_data; DBUG_VOID_RETURN; } diff --git a/vio/vio_priv.h b/vio/vio_priv.h index 69eb26083d6..1bfb857b039 100644 --- a/vio/vio_priv.h +++ b/vio/vio_priv.h @@ -49,6 +49,7 @@ int vio_close_shared_memory(Vio * vio); #endif void vio_timeout(Vio *vio,uint which, uint timeout); +my_bool vio_buff_has_data(Vio *vio); #ifdef HAVE_OPENSSL #include "my_net.h" /* needed because of struct in_addr */ @@ -62,5 +63,7 @@ void vio_ssl_delete(Vio *vio); int vio_ssl_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode); +my_bool vio_ssl_has_data(Vio *vio); + #endif /* HAVE_OPENSSL */ #endif /* VIO_PRIV_INCLUDED */ diff --git a/vio/viosocket.c b/vio/viosocket.c index 9c0243db4f3..163eb279d45 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -98,6 +98,10 @@ size_t vio_read_buff(Vio *vio, uchar* buf, size_t size) #undef VIO_UNBUFFERED_READ_MIN_SIZE } +my_bool vio_buff_has_data(Vio *vio) +{ + return (vio->read_pos != vio->read_end); +} size_t vio_write(Vio * vio, const uchar* buf, size_t size) { diff --git a/vio/viossl.c b/vio/viossl.c index 79f358b047c..5cb5f36f20d 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -244,6 +244,9 @@ int vio_ssl_blocking(Vio *vio __attribute__((unused)), return (set_blocking_mode ? 0 : 1); } - +my_bool vio_ssl_has_data(Vio *vio) +{ + return SSL_pending(vio->ssl_arg) > 0 ? TRUE : FALSE; +} #endif /* HAVE_OPENSSL */ |