5.5 merge

This commit is contained in:
Sergei Golubchik 2015-01-21 12:03:02 +01:00
commit d9c01e4b4a
159 changed files with 2559 additions and 449 deletions

View file

@ -28,10 +28,12 @@ ENDIF()
# We use the LOCATION target property (CMP0026)
# and get_target_property() for non-existent targets (CMP0045)
# and INSTALL_NAME_DIR (CMP0042)
IF(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR
CMAKE_VERSION VERSION_GREATER "3.0.0")
CMAKE_POLICY(SET CMP0026 OLD)
CMAKE_POLICY(SET CMP0045 OLD)
CMAKE_POLICY(SET CMP0042 OLD)
ENDIF()
MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")
@ -108,36 +110,15 @@ FOREACH(_base
ENDFOREACH()
# Following autotools tradition, add preprocessor definitions
# specified in environment variable CPPFLAGS
IF(DEFINED ENV{CPPFLAGS})
ADD_DEFINITIONS($ENV{CPPFLAGS})
ENDIF()
#
# Control aspects of the development environment which are
# specific to MySQL maintainers and developers.
#
INCLUDE(maintainer)
SET(MYSQL_MAINTAINER_MODE "OFF" CACHE STRING "MySQL maintainer-specific development environment. Options are: ON OFF AUTO.")
SET(MYSQL_MAINTAINER_MODE "AUTO" CACHE STRING "MySQL maintainer-specific development environment. Options are: ON OFF AUTO.")
MARK_AS_ADVANCED(MYSQL_MAINTAINER_MODE)
# Whether the maintainer mode compiler options should be enabled.
IF(CMAKE_C_COMPILER_ID MATCHES "GNU")
SET_MYSQL_MAINTAINER_GNU_C_OPTIONS()
ENDIF()
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS()
ENDIF()
IF(CMAKE_C_COMPILER_ID MATCHES "Intel")
SET_MYSQL_MAINTAINER_INTEL_C_OPTIONS()
ENDIF()
IF(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
SET_MYSQL_MAINTAINER_INTEL_CXX_OPTIONS()
ENDIF()
# Packaging
IF (NOT CPACK_GENERATOR)
IF(WIN32)
@ -185,7 +166,7 @@ OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED)
OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system libraries. Only set it you never plan to distribute the resulting binaries" OFF)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
# We need some extra FAIL_REGEX patterns
@ -388,18 +369,7 @@ CHECK_PCRE()
# We have to add MAINTAINER_C_WARNINGS first to ensure that the flags
# given by the invoking user are honored
#
IF(MYSQL_MAINTAINER_MODE MATCHES "ON")
SET(CMAKE_C_FLAGS "${MY_MAINTAINER_C_WARNINGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${MY_MAINTAINER_CXX_WARNINGS} ${CMAKE_CXX_FLAGS}")
ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO")
SET(CMAKE_C_FLAGS_DEBUG "${MY_MAINTAINER_C_WARNINGS} ${CMAKE_C_FLAGS_DEBUG}")
SET(CMAKE_CXX_FLAGS_DEBUG "${MY_MAINTAINER_CXX_WARNINGS} ${CMAKE_CXX_FLAGS_DEBUG}")
ENDIF()
IF(CMAKE_CROSSCOMPILING)
SET(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Path to import_executables.cmake from a native build")
INCLUDE(${IMPORT_EXECUTABLES})
ENDIF()
INCLUDE(maintainer)
IF(WITH_UNIT_TESTS)
ENABLE_TESTING()
@ -523,4 +493,3 @@ IF(NON_DISTRIBUTABLE_WARNING)
MESSAGE(WARNING "
You have linked MariaDB with GPLv3 libraries! You may not distribute the resulting binary. If you do, you will put yourself into a legal problem with Free Software Foundation.")
ENDIF()

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab.
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2014, MariaDB
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
@ -2435,6 +2435,7 @@ int main(int argc, char** argv)
DBUG_PROCESS(argv[0]);
my_init_time(); // for time functions
tzset(); // set tzname
init_alloc_root(&s_mem_root, 16384, 0, MYF(0));
if (load_defaults("my", load_groups, &argc, &argv))

View file

@ -202,15 +202,16 @@ IF(UNIX)
ENDIF()
ENDIF()
# OSX flags
IF(APPLE)
SET(COMMON_C_FLAGS "-g -fno-common -fno-strict-aliasing")
# XXX: why are we using -felide-constructors on OSX?
SET(COMMON_CXX_FLAGS "-g -fno-common -felide-constructors -fno-strict-aliasing")
SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}")
SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os ${COMMON_C_FLAGS}")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os ${COMMON_CXX_FLAGS}")
# Default Clang flags
IF(CMAKE_C_COMPILER_ID MATCHES "Clang")
SET(COMMON_C_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing")
SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}")
ENDIF()
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET(COMMON_CXX_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing")
SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}")
ENDIF()
# Solaris flags

44
cmake/compile_flags.cmake Normal file
View file

@ -0,0 +1,44 @@
# Copyright (c) 2014, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
## ADD_COMPILE_FLAGS(<source files> COMPILE_FLAGS <flags>)
MACRO(ADD_COMPILE_FLAGS)
SET(FILES "")
SET(FLAGS "")
SET(COMPILE_FLAGS)
FOREACH(ARG ${ARGV})
IF(ARG STREQUAL "COMPILE_FLAGS")
SET(COMPILE_FLAGS "COMPILE_FLAGS")
ELSEIF(COMPILE_FLAGS)
LIST(APPEND FLAGS ${ARG})
ELSE()
LIST(APPEND FILES ${ARG})
ENDIF()
ENDFOREACH()
FOREACH(FILE ${FILES})
FOREACH(FLAG ${FLAGS})
GET_SOURCE_FILE_PROPERTY(PROP ${FILE} COMPILE_FLAGS)
IF(NOT PROP)
SET(PROP ${FLAG})
ELSE()
SET(PROP "${PROP} ${FLAG}")
ENDIF()
SET_SOURCE_FILES_PROPERTIES(
${FILE} PROPERTIES COMPILE_FLAGS "${PROP}"
)
ENDFOREACH()
ENDFOREACH()
ENDMACRO()

View file

@ -188,6 +188,7 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7")
ALTERNATIVE_NAME("client" "mysql")
ALTERNATIVE_NAME("devel" "mariadb-devel")
ALTERNATIVE_NAME("server" "mariadb-server")
ALTERNATIVE_NAME("server" "mysql-compat-server")
ALTERNATIVE_NAME("shared" "mariadb-libs")
ALTERNATIVE_NAME("shared" "mysql-libs")
ALTERNATIVE_NAME("test" "mariadb-test")

View file

@ -1,4 +1,4 @@
# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2014, 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
@ -13,51 +13,46 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE(CheckCCompilerFlag)
# Common warning flags for GCC, G++, Clang and Clang++
SET(MY_WARNING_FLAGS "-Wall -Wextra -Wformat-security")
MY_CHECK_C_COMPILER_FLAG("-Wvla" HAVE_WVLA) # Requires GCC 4.3+ or Clang
IF(HAVE_WVLA)
SET(MY_WARNING_FLAGS "${MY_WARNING_FLAGS} -Wvla")
ENDIF()
# Setup GCC (GNU C compiler) warning options.
MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS)
SET(MY_MAINTAINER_WARNINGS
"-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -DFORCE_INIT_OF_VARS")
# Common warning flags for GCC and Clang
SET(MY_C_WARNING_FLAGS
"${MY_WARNING_FLAGS} -Wwrite-strings -Wdeclaration-after-statement")
CHECK_C_COMPILER_FLAG("-Wno-missing-field-initializers"
HAVE_NO_MISSING_FIELD_INITIALIZERS)
# Common warning flags for G++ and Clang++
SET(MY_CXX_WARNING_FLAGS
"${MY_WARNING_FLAGS} -Woverloaded-virtual -Wno-unused-parameter")
IF (HAVE_NO_MISSING_FIELD_INITIALIZERS)
SET(MY_MAINTAINER_WARNINGS
"${MY_MAINTAINER_WARNINGS} -Wno-missing-field-initializers")
ENDIF()
# Extra warning flags for Clang++
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET(MY_CXX_WARNING_FLAGS
"${MY_CXX_WARNING_FLAGS} -Wno-null-conversion -Wno-unused-private-field")
ENDIF()
CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement"
HAVE_DECLARATION_AFTER_STATEMENT)
IF(HAVE_DECLARATION_AFTER_STATEMENT)
SET(MY_MAINTAINER_DECLARATION_AFTER_STATEMENT
"-Wdeclaration-after-statement")
ENDIF()
SET(MY_MAINTAINER_C_WARNINGS
"${MY_MAINTAINER_WARNINGS} ${MY_MAINTAINER_DECLARATION_AFTER_STATEMENT}"
CACHE INTERNAL "C warning options used in maintainer builds.")
# Do not make warnings in checks into errors.
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error")
ENDMACRO()
# Turn on Werror (warning => error) when using maintainer mode.
IF(MYSQL_MAINTAINER_MODE MATCHES "ON")
SET(MY_C_WARNING_FLAGS "${MY_C_WARNING_FLAGS} -DFORCE_INIT_OF_VARS -Werror")
SET(MY_CXX_WARNING_FLAGS "${MY_CXX_WARNING_FLAGS} -DFORCE_INIT_OF_VARS -Werror")
ENDIF()
# Setup G++ (GNU C++ compiler) warning options.
MACRO(SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS)
SET(MY_MAINTAINER_CXX_WARNINGS
"${MY_MAINTAINER_WARNINGS} -Wno-invalid-offsetof -Wno-unused-parameter -Woverloaded-virtual"
CACHE INTERNAL "C++ warning options used in maintainer builds.")
ENDMACRO()
# Setup ICC (Intel C Compiler) warning options.
MACRO(SET_MYSQL_MAINTAINER_INTEL_C_OPTIONS)
SET(MY_MAINTAINER_WARNINGS "-Wcheck")
SET(MY_MAINTAINER_C_WARNINGS "${MY_MAINTAINER_WARNINGS}"
CACHE INTERNAL "C warning options used in maintainer builds.")
ENDMACRO()
# Setup ICPC (Intel C++ Compiler) warning options.
MACRO(SET_MYSQL_MAINTAINER_INTEL_CXX_OPTIONS)
SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_WARNINGS}"
CACHE INTERNAL "C++ warning options used in maintainer builds.")
ENDMACRO()
# Set warning flags for GCC/Clang
IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
SET(MY_MAINTAINER_C_WARNINGS "${MY_C_WARNING_FLAGS}")
ENDIF()
# Set warning flags for G++/Clang++
IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET(MY_MAINTAINER_CXX_WARNINGS "${MY_CXX_WARNING_FLAGS}")
ENDIF()
IF(MYSQL_MAINTAINER_MODE MATCHES "ON")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_MAINTAINER_C_WARNINGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_MAINTAINER_CXX_WARNINGS}")
ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${MY_MAINTAINER_C_WARNINGS}")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${MY_MAINTAINER_CXX_WARNINGS}")
ENDIF()

View file

@ -1,5 +1,4 @@
# Copyright (c) 2010 Sun Microsystems, Inc.
# Use is subject to license terms.
# Copyright (c) 2010, 2014, 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
@ -15,21 +14,3 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# This file includes OSX specific options and quirks, related to system checks
# Workaround for CMake bug#9051
# (CMake does not pass CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET when
# running TRY_COMPILE)
IF(CMAKE_OSX_SYSROOT)
SET(ENV{CMAKE_OSX_SYSROOT} ${CMAKE_OSX_SYSROOT})
ENDIF()
IF(CMAKE_OSX_SYSROOT)
SET(ENV{MACOSX_DEPLOYMENT_TARGET} ${OSX_DEPLOYMENT_TARGET})
ENDIF()
IF(CMAKE_OSX_DEPLOYMENT_TARGET)
# Workaround linker problems on OSX 10.4
IF(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.5")
ADD_DEFINITIONS(-fno-common)
ENDIF()
ENDIF()

View file

@ -1,4 +1,4 @@
# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2014, 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
@ -90,7 +90,7 @@ SET(HAVE_GETRLIMIT CACHE INTERNAL "")
SET(HAVE_GETRUSAGE CACHE INTERNAL "")
SET(HAVE_GETTIMEOFDAY CACHE INTERNAL "")
SET(HAVE_GETWD CACHE INTERNAL "")
SET(HAVE_GMTIME_R CACHE INTERNAL "")
SET(HAVE_GMTIME_R 1 CACHE INTERNAL "")
SET(HAVE_GRP_H CACHE INTERNAL "")
SET(HAVE_IA64INTRIN_H CACHE INTERNAL "")
SET(HAVE_IEEEFP_H CACHE INTERNAL "")
@ -111,7 +111,7 @@ SET(HAVE_LANGINFO_H CACHE INTERNAL "")
SET(HAVE_LDIV 1 CACHE INTERNAL "")
SET(HAVE_LIMITS_H 1 CACHE INTERNAL "")
SET(HAVE_LOCALE_H 1 CACHE INTERNAL "")
SET(HAVE_LOCALTIME_R CACHE INTERNAL "")
SET(HAVE_LOCALTIME_R 1 CACHE INTERNAL "")
SET(HAVE_LOG2 CACHE INTERNAL "")
SET(HAVE_LONGJMP 1 CACHE INTERNAL "")
SET(HAVE_LRAND48 CACHE INTERNAL "")

View file

@ -52,16 +52,6 @@ IF(NOT SYSTEM_TYPE)
ENDIF()
ENDIF()
# Always enable -Wall for gnu C/C++
IF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_FLAGS MATCHES ".*-Wall.*")
SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_FLAGS MATCHES ".*-Wall.*")
SET(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS} -Wall")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX)
# MySQL "canonical" GCC flags. At least -fno-rtti flag affects
# ABI and cannot be simply removed.

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates
Copyright (c) 2000, 2014, Oracle and/or its affiliates
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -1021,7 +1021,7 @@ FILE *in,*out;
updated=retain=0;
reset_buffer();
while ((error=fill_buffer_retaining(fileno(in),retain)) > 0)
while ((error=fill_buffer_retaining(my_fileno(in),retain)) > 0)
{
end_of_line=buffer ;
buffer[bufbytes]=0; /* Sentinel */

View file

@ -12,6 +12,15 @@ before calling SSL_new();
*** end Note ***
yaSSL Release notes, version 2.3.5 (9/29/2014)
This release of yaSSL fixes an RSA Padding check vulnerability reported by
Intel Security Advanced Threat Research team
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
yaSSL Release notes, version 2.3.4 (8/15/2014)
This release of yaSSL adds checking to the input_buffer class itself.

View file

@ -34,7 +34,7 @@
#include "rsa.h"
#define YASSL_VERSION "2.3.4"
#define YASSL_VERSION "2.3.5"
#if defined(__cplusplus)

View file

@ -177,7 +177,7 @@ word32 RSA_BlockType1::UnPad(const byte* pkcsBlock, word32 pkcsBlockLen,
// skip past the padding until we find the separator
unsigned i=1;
while (i<pkcsBlockLen && pkcsBlock[i++]) { // null body
while (i<pkcsBlockLen && pkcsBlock[i++] == 0xFF) { // null body
}
if (!(i==pkcsBlockLen || pkcsBlock[i-1]==0))
return 0;

View file

@ -64,9 +64,11 @@ extern "C" {
#define T_ZEROFILL_KEEP_LSN (1ULL << 33)
/** If repair should not bump create_rename_lsn */
#define T_NO_CREATE_RENAME_LSN (1ULL << 34)
#define T_CREATE_UNIQUE_BY_SORT (1ULL << 35)
#define T_SUPPRESS_ERR_HANDLING (1ULL << 36)
#define T_FORCE_SORT_MEMORY (1ULL << 37)
/** If repair shouldn't do any locks */
#define T_NO_LOCKS (1ULL << 35)
#define T_CREATE_UNIQUE_BY_SORT (1ULL << 36)
#define T_SUPPRESS_ERR_HANDLING (1ULL << 37)
#define T_FORCE_SORT_MEMORY (1ULL << 38)
#define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL)

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab.
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2014, MariaDB
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
@ -104,8 +104,18 @@ int pthread_attr_init(pthread_attr_t *connect_att);
int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack);
int pthread_attr_destroy(pthread_attr_t *connect_att);
int my_pthread_once(my_pthread_once_t *once_control,void (*init_routine)(void));
struct tm *localtime_r(const time_t *timep,struct tm *tmp);
struct tm *gmtime_r(const time_t *timep,struct tm *tmp);
static inline struct tm *localtime_r(const time_t *timep, struct tm *tmp)
{
localtime_s(tmp, timep);
return tmp;
}
static inline struct tm *gmtime_r(const time_t *clock, struct tm *res)
{
gmtime_s(res, clock);
return res;
}
void pthread_exit(void *a);
int pthread_join(pthread_t thread, void **value_ptr);

View file

@ -75,6 +75,7 @@ typedef int my_socket;
#include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */
extern unsigned int mariadb_deinitialize_ssl;
extern unsigned int mysql_port;
extern char *mysql_unix_port;

View file

@ -172,6 +172,7 @@ extern LIST *list_reverse(LIST *root);
extern void list_free(LIST *root,unsigned int free_data);
extern unsigned int list_length(LIST *);
extern int list_walk(LIST *,list_walk_action action,unsigned char * argument);
extern unsigned int mariadb_deinitialize_ssl;
extern unsigned int mysql_port;
extern char *mysql_unix_port;
typedef struct st_mysql_field {

View file

@ -257,7 +257,8 @@ mariadb_dyncol_unpack_free
mariadb_dyncol_column_cmp_named
mariadb_dyncol_column_count
mariadb_dyncol_prepare_decimal
#
mariadb_deinitialize_ssl
# Added in MariaDB-10.0 to stay compatible with MySQL-5.6, yuck!
mysql_options4
)

View file

@ -205,7 +205,8 @@ void STDCALL mysql_server_end()
mysql_client_plugin_deinit();
finish_client_errs();
vio_end();
if (mariadb_deinitialize_ssl)
vio_end();
#ifdef EMBEDDED_LIBRARY
end_embedded_server();
#endif

View file

@ -2,6 +2,9 @@
* Copyright (c) 2000
* SWsoft company
*
* Modifications copyright (c) 2001, 2013. Oracle and/or its affiliates.
* All rights reserved.
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*

View file

@ -180,6 +180,7 @@ sub create_process {
}
$SIG{INT}= 'DEFAULT';
$SIG{HUP}= 'DEFAULT';
# Make this process it's own process group to be able to kill
# it and any childs(that hasn't changed group themself)

View file

@ -141,6 +141,7 @@ extern "C" void handle_signal(int sig)
// Ignore further signals
signal(SIGTERM, SIG_IGN);
signal(SIGINT, SIG_IGN);
signal(SIGHUP, SIG_IGN);
// Continune execution, allow the child to be started and
// finally terminated by monitor loop
@ -164,6 +165,7 @@ int main(int argc, char* const argv[] )
/* Install signal handlers */
sigaction(SIGTERM, &sa,NULL);
sigaction(SIGINT, &sa,NULL);
sigaction(SIGHUP, &sa, NULL);
sigaction(SIGCHLD, &sa,NULL);
sigaction(SIGABRT, &sa_abort,NULL);
@ -231,6 +233,7 @@ int main(int argc, char* const argv[] )
// Use default signal handlers in child
signal(SIGTERM, SIG_DFL);
signal(SIGINT, SIG_DFL);
signal(SIGHUP, SIG_DFL);
signal(SIGCHLD, SIG_DFL);
// Make this process it's own process group to be able to kill

View file

@ -109,6 +109,7 @@ require "lib/mtr_gprof.pl";
require "lib/mtr_misc.pl";
$SIG{INT}= sub { mtr_error("Got ^C signal"); };
$SIG{HUP}= sub { mtr_error("Hangup detected on controlling terminal"); };
our $mysql_version_id;
my $mysql_version_extra;
@ -258,6 +259,7 @@ our $opt_ddd;
our $opt_client_ddd;
my $opt_boot_ddd;
our $opt_manual_gdb;
our $opt_manual_lldb;
our $opt_manual_dbx;
our $opt_manual_ddd;
our $opt_manual_debug;
@ -919,6 +921,7 @@ sub run_worker ($) {
my ($server_port, $thread_num)= @_;
$SIG{INT}= sub { exit(1); };
$SIG{HUP}= sub { exit(1); };
# Connect to server
my $server = new IO::Socket::INET
@ -1168,6 +1171,7 @@ sub command_line_setup {
'gdb' => \$opt_gdb,
'client-gdb' => \$opt_client_gdb,
'manual-gdb' => \$opt_manual_gdb,
'manual-lldb' => \$opt_manual_lldb,
'boot-gdb' => \$opt_boot_gdb,
'manual-debug' => \$opt_manual_debug,
'ddd' => \$opt_ddd,
@ -1498,6 +1502,7 @@ sub command_line_setup {
{
$default_vardir= "$glob_mysql_test_dir/var";
}
$default_vardir = realpath $default_vardir unless IS_WINDOWS;
if ( ! $opt_vardir )
{
@ -1604,8 +1609,9 @@ sub command_line_setup {
$opt_debugger= undef;
}
if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_ddd ||
$opt_manual_debug || $opt_debugger || $opt_dbx || $opt_manual_dbx)
if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_lldb ||
$opt_manual_ddd || $opt_manual_debug || $opt_debugger || $opt_dbx ||
$opt_manual_dbx)
{
mtr_error("You need to use the client debug options for the",
"embedded server. Ex: --client-gdb");
@ -1632,9 +1638,9 @@ sub command_line_setup {
# --------------------------------------------------------------------------
# Check debug related options
# --------------------------------------------------------------------------
if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
$opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug ||
$opt_dbx || $opt_client_dbx || $opt_manual_dbx ||
if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
$opt_manual_gdb || $opt_manual_lldb || $opt_manual_ddd ||
$opt_manual_debug || $opt_dbx || $opt_client_dbx || $opt_manual_dbx ||
$opt_debugger || $opt_client_debugger )
{
if ( using_extern() )
@ -2491,6 +2497,15 @@ sub environment_setup {
"$bindir/sql$opt_vs_config/mysql_tzinfo_to_sql");
$ENV{'MYSQL_TZINFO_TO_SQL'}= native_path($exe_mysql_tzinfo_to_sql);
# ----------------------------------------------------
# replace
# ----------------------------------------------------
my $exe_replace= mtr_exe_exists(vs_config_dirs('extra', 'replace'),
"$basedir/extra/replace",
"$bindir/extra$opt_vs_config/replace",
"$path_client_bindir/replace");
$ENV{'REPLACE'}= native_path($exe_replace);
# ----------------------------------------------------
# innochecksum
# ----------------------------------------------------
@ -5462,6 +5477,10 @@ sub mysqld_start ($$) {
{
gdb_arguments(\$args, \$exe, $mysqld->name());
}
elsif ( $opt_manual_lldb )
{
lldb_arguments(\$args, \$exe, $mysqld->name());
}
elsif ( $opt_ddd || $opt_manual_ddd )
{
ddd_arguments(\$args, \$exe, $mysqld->name());
@ -6008,7 +6027,6 @@ sub start_mysqltest ($) {
return $proc;
}
#
# Modify the exe and args so that program is run in gdb in xterm
#
@ -6059,6 +6077,32 @@ sub gdb_arguments {
$$exe= "xterm";
}
#
# Modify the exe and args so that program is run in lldb
#
sub lldb_arguments {
my $args= shift;
my $exe= shift;
my $type= shift;
my $input= shift;
my $lldb_init_file= "$opt_vardir/tmp/lldbinit.$type";
unlink($lldb_init_file);
# Put $args into a single string
my $str= join(" ", @$$args);
$input = $input ? "< $input" : "";
# write init file for mysqld or client
mtr_tofile($lldb_init_file, "set args $str $input\n");
print "\nTo start lldb for $type, type in another window:\n";
print "cd $glob_mysql_test_dir && lldb -s $lldb_init_file $$exe\n";
# Indicate the exe should not be started
$$exe= undef;
return;
}
#
# Modify the exe and args so that program is run in ddd
@ -6493,6 +6537,8 @@ Options for debugging the product
test(s)
manual-dbx Let user manually start mysqld in dbx, before running
test(s)
manual-lldb Let user manually start mysqld in lldb, before running
test(s)
max-save-core Limit the number of core files saved (to avoid filling
up disks for heavily crashing server). Defaults to
$opt_max_save_core, set to 0 for no limit. Set

View file

@ -0,0 +1,14 @@
call mtr.add_suppression("bad_row_type.frm: invalid value 11 for the field row_format");
select * from bad_row_type;
category_id category_name
show create table bad_row_type;
Table Create Table
bad_row_type CREATE TABLE `bad_row_type` (
`category_id` int(11) NOT NULL AUTO_INCREMENT,
`category_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`category_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 /* `compression`='tokudb_zlib' */
show table status like 'bad_row_type';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
bad_row_type MyISAM 10 Dynamic 0 0 0 281474976710655 1024 0 1 x x NULL utf8_general_ci NULL `compression`='tokudb_zlib'
drop table bad_row_type;

View file

@ -2677,3 +2677,27 @@ Warning 1292 Truncated incorrect time value: '9336:00:00'
Warning 1292 Truncated incorrect time value: '2952:00:00'
Warning 1292 Truncated incorrect time value: '2952:00:00'
DROP TABLE t1;
#
# MDEV-7221 from_days fails after null value
#
CREATE TABLE t1 (
id INT(11) NOT NULL PRIMARY KEY,
date1 DATE NULL DEFAULT NULL
);
INSERT INTO t1 VALUES (12, '2011-05-12');
INSERT INTO t1 VALUES (13, NULL);
INSERT INTO t1 VALUES (14, '2009-10-23');
INSERT INTO t1 VALUES (15, '2014-10-30');
INSERT INTO t1 VALUES (16, NULL);
INSERT INTO t1 VALUES (17, NULL);
INSERT INTO t1 VALUES (18, '2010-10-13');
SELECT a.id,a.date1,FROM_DAYS(TO_DAYS(a.date1)-10) as date2, DATE_ADD(a.date1,INTERVAL -10 DAY),TO_DAYS(a.date1)-10 FROM t1 a ORDER BY a.id;
id date1 date2 DATE_ADD(a.date1,INTERVAL -10 DAY) TO_DAYS(a.date1)-10
12 2011-05-12 2011-05-02 2011-05-02 734624
13 NULL NULL NULL NULL
14 2009-10-23 2009-10-13 2009-10-13 734058
15 2014-10-30 2014-10-20 2014-10-20 735891
16 NULL NULL NULL NULL
17 NULL NULL NULL NULL
18 2010-10-13 2010-10-03 2010-10-03 734413
DROP TABLE t1;

View file

@ -2494,6 +2494,20 @@ WHERE t1a.c1 = c2 GROUP BY i2;
i2
DROP TABLE t1,t2;
#
# MDEV-6855
# MIN(*) with subqueries with IS NOT NULL in WHERE clause crashed.
#
CREATE TABLE t1 (i INT, c VARCHAR(3), KEY(c,i)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (7,'foo'),(0,'bar');
CREATE TABLE t2 (j INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (0),(8),(1),(8),(9);
SELECT MAX(i), c FROM t1
WHERE c != 'qux' AND ( SELECT SUM(j) FROM t1, t2 ) IS NOT NULL GROUP BY c;
MAX(i) c
0 bar
7 foo
drop table t1,t2;
#
# Bug #58782
# Missing rows with SELECT .. WHERE .. IN subquery
# with full GROUP BY and no aggr

View file

@ -0,0 +1,9 @@
create table t1 (a int(10) auto_increment primary key, b int(11));
insert t1 values (null,1);
insert t1 values (null,2), (1,-1), (null,3) on duplicate key update b=values(b);
select * from t1;
a b
1 -1
2 2
3 3
drop table t1;

View file

@ -0,0 +1,10 @@
#
# MDEV-6896 kill user command cause MariaDB crash!
#
create user foo@'127.0.0.1';
select user from information_schema.processlist;
user
foo
root
kill user foo@'127.0.0.1';
drop user foo@'127.0.0.1';

View file

@ -0,0 +1,49 @@
drop table if exists t1,t2,t3;
drop view if exists v2,v3;
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t2 (
f1 DATE,
f2 VARCHAR(1024),
f3 VARCHAR(10),
f4 DATE,
f5 VARCHAR(10),
f6 VARCHAR(10),
f7 VARCHAR(10),
f8 DATETIME,
f9 INT,
f10 VARCHAR(1024),
f11 VARCHAR(1024),
f12 INT,
f13 VARCHAR(1024)
) ENGINE=MyISAM;
CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2;
CREATE TABLE t3 (
f1 VARCHAR(1024),
f2 VARCHAR(1024),
f3 DATETIME,
f4 VARCHAR(10),
f5 INT,
f6 VARCHAR(10),
f7 VARCHAR(1024),
f8 VARCHAR(10),
f9 INT,
f10 DATE,
f11 INT,
f12 VARCHAR(1024),
f13 VARCHAR(10),
f14 DATE,
f15 DATETIME
) ENGINE=MyISAM;
CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3;
INSERT INTO t3 VALUES
('FOO','foo','2000-08-04 00:00:00','one',1,'1','FOO','foo',1,'2004-05-09',1,'one','one','2001-12-07','2001-10-17 08:25:04'),
('BAR','bar','2001-01-01 04:52:37','two',2,'2','BAR','bar',2,'2008-01-01',2,'two','two','2006-06-19','2002-01-01 08:22:49');
CREATE TABLE t4 (f1 VARCHAR(10), f2 INT) ENGINE=MyISAM;
SELECT * FROM t1;
pk
SELECT non_existing FROM v2;
ERROR 42S22: Unknown column 'non_existing' in 'field list'
SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5;
pk f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f1 f2
drop table t1,t2,t3,t4;
drop view v2,v3;

View file

@ -7,9 +7,8 @@ SELECT ID, TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE CONCAT(":", ID
SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
ID TIME TIME_MS
TID 0 0.000
SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done EXECUTE 2';
SET DEBUG_SYNC= 'now WAIT_FOR query_done';
SET DEBUG_SYNC= 'now SIGNAL nosignal';
set debug_sync='reset';
SET debug_dbug="+d,sleep_inject_query_done_debug_sync";
select sleep(5);
sleep(5)
0

View file

@ -0,0 +1,32 @@
drop table if exists t1,t2;
drop procedure if exists p1;
#
#MDEV-6985: MariaDB crashes on stored procedure call
#
CREATE TABLE `t1` (
`ID` int(11) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB;
CREATE TABLE `t2` (
`ID` int(11) NOT NULL,
`DATE` datetime DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB;
CREATE PROCEDURE `p1`()
BEGIN
DECLARE _mySelect CURSOR FOR
SELECT DISTINCT t1.ID
FROM t1
LEFT JOIN t2 AS t2 ON
t2.ID = t1.ID
AND t2.DATE = (
SELECT MAX(T3.DATE) FROM t2 AS T3 WHERE T3.ID = t2.ID AND T3.DATE<=NOW()
)
WHERE t1.ID = 1;
OPEN _mySelect;
CLOSE _mySelect;
END ;;
CALL p1();
CALL p1();
drop procedure p1;
drop table t1,t2;

View file

@ -5394,6 +5394,8 @@ SELECT `f1`(1);
DROP FUNCTION f1;
DROP VIEW v1;
DROP TABLE t1, t2;
create view v1 as select 1;
drop view v1;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------

View file

@ -60,3 +60,8 @@ SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME = 'socket';
VARIABLE_NAME
SOCKET
#
# Bug#16581605: REPLACE.EXE UTILITY IS BROKEN IN 5.5
#
xyz
def

View file

Binary file not shown.

Binary file not shown.

View file

@ -1,6 +1,5 @@
set @save_binlog_format= @@global.binlog_format;
set @save_binlog_dirct= @@global.binlog_direct_non_transactional_updates;
set @save_sql_log_bin= @@global.sql_log_bin;
create table t1 (a int) engine= myisam;
create table t2 (a int) engine= innodb;
SELECT @@session.binlog_format;
@ -129,7 +128,7 @@ commit;
begin;
insert into t2 values (5);
# Test that the global variable 'binlog_format' and
# 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are
# 'binlog_direct_non_transactional_updates' are
# writable inside a transaction.
# Current session values are ROW, FALSE, TRUE respectively.
SELECT @@global.binlog_format;
@ -137,20 +136,15 @@ SELECT @@global.binlog_format;
ROW
set @@global.binlog_format= statement;
set @@global.binlog_direct_non_transactional_updates= TRUE;
set @@global.sql_log_bin= FALSE;
SELECT @@global.binlog_format;
@@global.binlog_format
STATEMENT
SELECT @@global.binlog_direct_non_transactional_updates;
@@global.binlog_direct_non_transactional_updates
1
SELECT @@global.sql_log_bin;
@@global.sql_log_bin
0
commit;
set @@global.binlog_format= @save_binlog_format;
set @@global.binlog_direct_non_transactional_updates= @save_binlog_dirct;
set @@global.sql_log_bin= @save_sql_log_bin;
create table t3(a int, b int) engine= innodb;
create table t4(a int) engine= innodb;
create table t5(a int) engine= innodb;

View file

@ -15,7 +15,7 @@ show grants for mysqltest_1@localhost;
connect (plain,localhost,mysqltest_1,,test);
connect (root,localhost,root,,test);
# Testing setting both session and global SQL_LOG_BIN variable both as
# Testing setting session SQL_LOG_BIN variable both as
# root and as plain user.
--echo **** Variable SQL_LOG_BIN ****

View file

@ -10,7 +10,6 @@ source include/have_binlog_format_row.inc;
set @save_binlog_format= @@global.binlog_format;
set @save_binlog_dirct= @@global.binlog_direct_non_transactional_updates;
set @save_sql_log_bin= @@global.sql_log_bin;
create table t1 (a int) engine= myisam;
create table t2 (a int) engine= innodb;
@ -117,21 +116,18 @@ commit;
begin;
insert into t2 values (5);
--echo # Test that the global variable 'binlog_format' and
--echo # 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are
--echo # 'binlog_direct_non_transactional_updates' are
--echo # writable inside a transaction.
--echo # Current session values are ROW, FALSE, TRUE respectively.
SELECT @@global.binlog_format;
set @@global.binlog_format= statement;
set @@global.binlog_direct_non_transactional_updates= TRUE;
set @@global.sql_log_bin= FALSE;
SELECT @@global.binlog_format;
SELECT @@global.binlog_direct_non_transactional_updates;
SELECT @@global.sql_log_bin;
commit;
set @@global.binlog_format= @save_binlog_format;
set @@global.binlog_direct_non_transactional_updates= @save_binlog_dirct;
set @@global.sql_log_bin= @save_sql_log_bin;
create table t3(a int, b int) engine= innodb;
create table t4(a int) engine= innodb;

View file

@ -78,4 +78,5 @@ z
31
32
drop table corrupt_bit_test_ā;
DROP DATABASE pad;
SET GLOBAL innodb_change_buffering_debug = 0;

View file

@ -0,0 +1,11 @@
#
# Bug#19904003 INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=1
# CAUSES INFINITE PAGE SPLIT
#
SET GLOBAL innodb_change_buffering_debug=1;
SET GLOBAL innodb_limit_optimistic_insert_debug=1;
CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=InnoDB
PARTITION BY HASH (c1) PARTITIONS 15;
DROP TABLE t1;
SET GLOBAL innodb_change_buffering_debug=0;
SET GLOBAL innodb_limit_optimistic_insert_debug=0;

View file

@ -0,0 +1,21 @@
create table `t1`(`a` int) engine=innodb partition by key (`a`);
create table `t2`(`b` int) engine=innodb;
create table `t3`(`c` int) engine=innodb;
insert t1 values (1);
insert t2 values (2);
insert t3 values (3);
repair table `t1`,`t2`,`t3`;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
select * from t1;
a
1
select * from t2;
b
2
select * from t3;
c
3
drop table t1, t2, t3;

View file

@ -0,0 +1,253 @@
#
# Bug #19306524 FAILING ASSERTION WITH TEMP TABLE FOR A PROCEDURE
# CALLED FROM A FUNCTION
#
call mtr.add_suppression("MySQL is trying to drop table");
CREATE PROCEDURE cachedata(
IN obj_id BIGINT UNSIGNED,
IN start DATETIME,
IN end DATETIME
)
cachedata:BEGIN
DECLARE cache_count BIGINT;
SET @timestamp := NOW();
CREATE TEMPORARY TABLE IF NOT EXISTS cachedata (
timestamp DATETIME,
object_id BIGINT UNSIGNED NOT NULL,
start DATETIME,
end DATETIME,
seqno BIGINT AUTO_INCREMENT,
value FLOAT,
PRIMARY KEY (seqno),
INDEX (timestamp),
INDEX (object_id, start, end)
) ENGINE=INNODB;
DELETE FROM cachedata WHERE
timestamp < DATE_SUB(@timestamp, INTERVAL 15 SECOND);
SELECT count(*) INTO cache_count FROM cachedata WHERE
object_id = obj_id
AND start = start
AND end = end;
IF cache_count > 0 THEN LEAVE cachedata;
END IF;
INSERT INTO cachedata (timestamp, object_id, start, end, value) VALUES
(@timestamp, obj_id, start, end, 1234),
(@timestamp, obj_id, start, end, 4567),
(@timestamp, obj_id, start, end, 8901),
(@timestamp, obj_id, start, end, 1234),
(@timestamp, obj_id, start, end, 4567),
(@timestamp, obj_id, start, end, 8901),
(@timestamp, obj_id, start, end, 1234),
(@timestamp, obj_id, start, end, 4567),
(@timestamp, obj_id, start, end, 8901),
(@timestamp, obj_id, start, end, 1234),
(@timestamp, obj_id, start, end, 4567),
(@timestamp, obj_id, start, end, 8901),
(@timestamp, obj_id, start, end, 2345),
(@timestamp, obj_id, start, end, 1234),
(@timestamp, obj_id, start, end, 4567),
(@timestamp, obj_id, start, end, 8901),
(@timestamp, obj_id, start, end, 2345),
(@timestamp, obj_id, start, end, 1234),
(@timestamp, obj_id, start, end, 4567),
(@timestamp, obj_id, start, end, 8901),
(@timestamp, obj_id, start, end, 2345);
END$$
CREATE FUNCTION get_cache(
obj_id BIGINT UNSIGNED,
start DATETIME,
end DATETIME
)
RETURNS FLOAT
READS SQL DATA
BEGIN
DECLARE result FLOAT;
CALL cachedata(obj_id, start, end);
SELECT SUM(value) INTO result FROM cachedata WHERE
object_id = obj_id
AND start = start
AND end = end;
RETURN result;
END$$
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
SELECT get_cache(1, '2014-01-01', '2014-02-01');
get_cache(1, '2014-01-01', '2014-02-01')
95247
select sleep(1);
sleep(1)
0
DROP FUNCTION get_cache;
DROP PROCEDURE cachedata;

View file

@ -0,0 +1,240 @@
#
# Bug #17852083 PRINT A WARNING WHEN DDL HAS AN ERROR IN
# INNODB_STRICT_MODE = 1
#
set innodb_strict_mode = 0;
create table t1 (id int auto_increment primary key,
v varchar(32),
col1 text,
col2 text,
col3 text,
col4 text,
col5 text,
col6 text,
col7 text,
col8 text,
col9 text,
col10 text,
col11 text,
col12 text,
col13 text,
col14 text,
col15 text,
col16 text,
col17 text,
col18 text,
col19 text,
col20 text,
col21 text,
col22 text,
col23 text,
col24 text,
col25 text,
col26 text,
col27 text,
col28 text,
col29 text,
col30 text,
col31 text,
col32 text,
col33 text,
col34 text,
col35 text,
col36 text,
col37 text,
col38 text,
col39 text,
col40 text,
col41 text,
col42 text,
col43 text,
col44 text,
col45 text ,
col46 text,
col47 text,
col48 text,
col49 text,
col50 text,
col51 text,
col52 text,
col53 text,
col54 text,
col55 text,
col56 text,
col57 text,
col58 text,
col59 text,
col60 text,
col61 text,
col62 text,
col63 text,
col64 text,
col65 text,
col66 text,
col67 text,
col68 text ,
col69 text,
col70 text,
col71 text,
col72 text,
col73 text,
col74 text,
col75 text,
col76 text,
col77 text,
col78 text,
col79 text,
col80 text,
col81 text,
col82 text,
col83 text,
col84 text,
col85 text,
col86 text,
col87 text,
col88 text,
col89 text,
col90 text,
col91 text,
col92 text,
col93 text,
col94 text,
col95 text,
col96 text,
col97 text,
col98 text,
col99 text,
col100 text,
col101 text,
col102 text,
col103 text,
col104 text,
col105 text,
col106 text,
col107 text,
col108 text,
col109 text,
col110 text,
col111 text,
col112 text,
col113 text,
col114 text,
col115 text,
col116 text,
col117 text,
col118 text,
col119 text,
col120 text,
col121 text,
col122 text,
col123 text,
col124 text,
col125 text,
col126 text ,
col127 text,
col128 text,
col129 text,
col130 text,
col131 text,
col132 text,
col133 text,
col134 text,
col135 text,
col136 text,
col137 text,
col138 text,
col139 text,
col140 text,
col141 text,
col142 text,
col143 text,
col144 text,
col145 text,
col146 text,
col147 text ,
col148 text,
col149 text,
col150 text,
col151 text,
col152 text,
col153 text,
col154 text,
col155 text,
col156 text,
col157 text,
col158 text,
col159 text,
col160 text,
col161 text,
col162 text,
col163 text,
col164 text,
col165 text,
col166 text,
col167 text,
col168 text,
col169 text,
col170 text,
col171 text,
col172 text ,
col173 text,
col174 text,
col175 text,
col176 text,
col177 text,
col178 text,
col179 text,
col180 text,
col181 text,
col182 text,
col183 text,
col184 text,
col185 text,
col186 text,
col187 text,
col188 text,
col189 text,
col190 text,
col191 text,
col192 text,
col193 text,
col194 text,
col195 text,
col196 text,
col197 text,
col198 text,
col199 text,
col200 text,
col201 text,
col202 text,
col203 text,
col204 text,
col205 text,
col206 text,
col207 text,
col208 text,
col209 text,
col210 text,
col211 text,
col212 text,
col213 text,
col214 text,
col215 text,
col216 text,
col217 text,
col218 text,
col219 text,
col220 text,
col221 text,
col222 text,
col223 text,
col224 text,
col225 text,
col226 text,
col227 text,
col228 text
) ENGINE=InnoDB;
set innodb_strict_mode = 1;
alter table t1 engine=InnoDB;
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
drop table t1;

View file

@ -14,6 +14,8 @@ if (`select plugin_auth_version < "5.6.17" from information_schema.plugins where
--source include/not_embedded.inc
# DBUG_SUICIDE() hangs under valgrind
--source include/not_valgrind.inc
# No windows, need perl
--source include/not_windows.inc
# The flag innodb_change_buffering_debug is only available in debug builds.
# It instructs InnoDB to try to evict pages from the buffer pool when

View file

@ -10,6 +10,8 @@ if (`select count(*)=0 from information_schema.global_variables where variable_n
# Don't test under valgrind, undo slots of the previous test might exist still
# and cause unstable result.
--source include/not_valgrind.inc
# undo slots of the previous test might exist still
--source include/not_windows.inc
# Previous undo slots cause unnecessary failures
--source include/not_windows.inc

View file

@ -4,6 +4,11 @@
-- source include/have_innodb.inc
-- source include/have_innodb_16k.inc
if (`select plugin_auth_version <= "5.5.40-MariaDB-36.1" from information_schema.plugins where plugin_name='innodb'`)
{
--skip Not fixed in XtraDB as of 5.5.40-MariaDB-36.1 or earlier
}
# Issues with innodb_change_buffering_debug on Windows, so the test scenario
# cannot be created on windows
--source include/not_windows.inc
@ -18,14 +23,20 @@ call mtr.add_suppression("Flagged corruption of idx.*in CHECK TABLE");
# It instructs InnoDB to try to evict pages from the buffer pool when
# change buffering is possible, so that the change buffer will be used
# whenever possible.
-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug;
-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
SET GLOBAL innodb_change_buffering_debug = 1;
# Turn off Unique Check to create corrupted index with dup key
SET UNIQUE_CHECKS=0;
CREATE DATABASE pad;
let $i=345;
while ($i)
{
--eval CREATE TABLE pad.t$i (a INT PRIMARY KEY) ENGINE=InnoDB;
dec $i;
}
-- enable_query_log
set names utf8;
@ -121,6 +132,6 @@ select z from corrupt_bit_test_ā limit 10;
# Drop table
drop table corrupt_bit_test_ā;
DROP DATABASE pad;
-- error 0, ER_UNKNOWN_SYSTEM_VARIABLE
SET GLOBAL innodb_change_buffering_debug = 0;

View file

@ -0,0 +1,17 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_partition.inc
--echo #
--echo # Bug#19904003 INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=1
--echo # CAUSES INFINITE PAGE SPLIT
--echo #
SET GLOBAL innodb_change_buffering_debug=1;
SET GLOBAL innodb_limit_optimistic_insert_debug=1;
CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=InnoDB
PARTITION BY HASH (c1) PARTITIONS 15;
DROP TABLE t1;
SET GLOBAL innodb_change_buffering_debug=0;
SET GLOBAL innodb_limit_optimistic_insert_debug=0;

View file

@ -0,0 +1,18 @@
#
# MDEV-7404 REPAIR multiple tables crash in MDL_ticket::has_stronger_or_equal_type
#
--source include/have_partition.inc
--source include/have_innodb.inc
create table `t1`(`a` int) engine=innodb partition by key (`a`);
create table `t2`(`b` int) engine=innodb;
create table `t3`(`c` int) engine=innodb;
insert t1 values (1);
insert t2 values (2);
insert t3 values (3);
repair table `t1`,`t2`,`t3`;
select * from t1;
select * from t2;
select * from t3;
drop table t1, t2, t3;

View file

@ -0,0 +1,103 @@
--source include/have_innodb.inc
--source include/big_test.inc
--echo #
--echo # Bug #19306524 FAILING ASSERTION WITH TEMP TABLE FOR A PROCEDURE
--echo # CALLED FROM A FUNCTION
--echo #
call mtr.add_suppression("MySQL is trying to drop table");
DELIMITER $$;
CREATE PROCEDURE cachedata(
IN obj_id BIGINT UNSIGNED,
IN start DATETIME,
IN end DATETIME
)
cachedata:BEGIN
DECLARE cache_count BIGINT;
SET @timestamp := NOW();
CREATE TEMPORARY TABLE IF NOT EXISTS cachedata (
timestamp DATETIME,
object_id BIGINT UNSIGNED NOT NULL,
start DATETIME,
end DATETIME,
seqno BIGINT AUTO_INCREMENT,
value FLOAT,
PRIMARY KEY (seqno),
INDEX (timestamp),
INDEX (object_id, start, end)
) ENGINE=INNODB;
DELETE FROM cachedata WHERE
timestamp < DATE_SUB(@timestamp, INTERVAL 15 SECOND);
SELECT count(*) INTO cache_count FROM cachedata WHERE
object_id = obj_id
AND start = start
AND end = end;
IF cache_count > 0 THEN LEAVE cachedata;
END IF;
INSERT INTO cachedata (timestamp, object_id, start, end, value) VALUES
(@timestamp, obj_id, start, end, 1234),
(@timestamp, obj_id, start, end, 4567),
(@timestamp, obj_id, start, end, 8901),
(@timestamp, obj_id, start, end, 1234),
(@timestamp, obj_id, start, end, 4567),
(@timestamp, obj_id, start, end, 8901),
(@timestamp, obj_id, start, end, 1234),
(@timestamp, obj_id, start, end, 4567),
(@timestamp, obj_id, start, end, 8901),
(@timestamp, obj_id, start, end, 1234),
(@timestamp, obj_id, start, end, 4567),
(@timestamp, obj_id, start, end, 8901),
(@timestamp, obj_id, start, end, 2345),
(@timestamp, obj_id, start, end, 1234),
(@timestamp, obj_id, start, end, 4567),
(@timestamp, obj_id, start, end, 8901),
(@timestamp, obj_id, start, end, 2345),
(@timestamp, obj_id, start, end, 1234),
(@timestamp, obj_id, start, end, 4567),
(@timestamp, obj_id, start, end, 8901),
(@timestamp, obj_id, start, end, 2345);
END$$
CREATE FUNCTION get_cache(
obj_id BIGINT UNSIGNED,
start DATETIME,
end DATETIME
)
RETURNS FLOAT
READS SQL DATA
BEGIN
DECLARE result FLOAT;
CALL cachedata(obj_id, start, end);
SELECT SUM(value) INTO result FROM cachedata WHERE
object_id = obj_id
AND start = start
AND end = end;
RETURN result;
END$$
DELIMITER ;$$
let $i = 30;
while ($i)
{
SELECT get_cache(1, '2014-01-01', '2014-02-01');
select sleep(1);
dec $i;
}
DROP FUNCTION get_cache;
DROP PROCEDURE cachedata;

View file

@ -0,0 +1,251 @@
--source include/have_innodb.inc
if (`select plugin_auth_version <= "5.5.40-MariaDB-36.1" from information_schema.plugins where plugin_name='innodb'`)
{
--skip Not fixed in XtraDB as of 5.5.40-MariaDB-36.1 or earlier
}
--echo #
--echo # Bug #17852083 PRINT A WARNING WHEN DDL HAS AN ERROR IN
--echo # INNODB_STRICT_MODE = 1
--echo #
set innodb_strict_mode = 0;
create table t1 (id int auto_increment primary key,
v varchar(32),
col1 text,
col2 text,
col3 text,
col4 text,
col5 text,
col6 text,
col7 text,
col8 text,
col9 text,
col10 text,
col11 text,
col12 text,
col13 text,
col14 text,
col15 text,
col16 text,
col17 text,
col18 text,
col19 text,
col20 text,
col21 text,
col22 text,
col23 text,
col24 text,
col25 text,
col26 text,
col27 text,
col28 text,
col29 text,
col30 text,
col31 text,
col32 text,
col33 text,
col34 text,
col35 text,
col36 text,
col37 text,
col38 text,
col39 text,
col40 text,
col41 text,
col42 text,
col43 text,
col44 text,
col45 text ,
col46 text,
col47 text,
col48 text,
col49 text,
col50 text,
col51 text,
col52 text,
col53 text,
col54 text,
col55 text,
col56 text,
col57 text,
col58 text,
col59 text,
col60 text,
col61 text,
col62 text,
col63 text,
col64 text,
col65 text,
col66 text,
col67 text,
col68 text ,
col69 text,
col70 text,
col71 text,
col72 text,
col73 text,
col74 text,
col75 text,
col76 text,
col77 text,
col78 text,
col79 text,
col80 text,
col81 text,
col82 text,
col83 text,
col84 text,
col85 text,
col86 text,
col87 text,
col88 text,
col89 text,
col90 text,
col91 text,
col92 text,
col93 text,
col94 text,
col95 text,
col96 text,
col97 text,
col98 text,
col99 text,
col100 text,
col101 text,
col102 text,
col103 text,
col104 text,
col105 text,
col106 text,
col107 text,
col108 text,
col109 text,
col110 text,
col111 text,
col112 text,
col113 text,
col114 text,
col115 text,
col116 text,
col117 text,
col118 text,
col119 text,
col120 text,
col121 text,
col122 text,
col123 text,
col124 text,
col125 text,
col126 text ,
col127 text,
col128 text,
col129 text,
col130 text,
col131 text,
col132 text,
col133 text,
col134 text,
col135 text,
col136 text,
col137 text,
col138 text,
col139 text,
col140 text,
col141 text,
col142 text,
col143 text,
col144 text,
col145 text,
col146 text,
col147 text ,
col148 text,
col149 text,
col150 text,
col151 text,
col152 text,
col153 text,
col154 text,
col155 text,
col156 text,
col157 text,
col158 text,
col159 text,
col160 text,
col161 text,
col162 text,
col163 text,
col164 text,
col165 text,
col166 text,
col167 text,
col168 text,
col169 text,
col170 text,
col171 text,
col172 text ,
col173 text,
col174 text,
col175 text,
col176 text,
col177 text,
col178 text,
col179 text,
col180 text,
col181 text,
col182 text,
col183 text,
col184 text,
col185 text,
col186 text,
col187 text,
col188 text,
col189 text,
col190 text,
col191 text,
col192 text,
col193 text,
col194 text,
col195 text,
col196 text,
col197 text,
col198 text,
col199 text,
col200 text,
col201 text,
col202 text,
col203 text,
col204 text,
col205 text,
col206 text,
col207 text,
col208 text,
col209 text,
col210 text,
col211 text,
col212 text,
col213 text,
col214 text,
col215 text,
col216 text,
col217 text,
col218 text,
col219 text,
col220 text,
col221 text,
col222 text,
col223 text,
col224 text,
col225 text,
col226 text,
col227 text,
col228 text
) ENGINE=InnoDB;
set innodb_strict_mode = 1;
--error ER_TOO_BIG_ROWSIZE
alter table t1 engine=InnoDB;
drop table t1;

View file

@ -0,0 +1,17 @@
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
#
# MDEV-7314
# Concurrent "INSERT INTO table SELECT MAX(id)+1 FROM table" are
# hitting deadlocks on Aria tables using ROW_FORMAT=PAGE
#
create table t1 (pk int primary key) engine=Aria;
insert into t1 values (1);
insert into t1 select sleep(2)+1 from t1;
insert into t1 select 2 from t1;
select * from t1;
pk
1
2
drop table t1;

View file

@ -0,0 +1,27 @@
-- source include/have_maria.inc
--source include/have_binlog_format_statement.inc
drop table if exists t1;
--echo #
--echo # MDEV-7314
--echo # Concurrent "INSERT INTO table SELECT MAX(id)+1 FROM table" are
--echo # hitting deadlocks on Aria tables using ROW_FORMAT=PAGE
--echo #
create table t1 (pk int primary key) engine=Aria;
insert into t1 values (1);
send insert into t1 select sleep(2)+1 from t1;
--connect (con1,localhost,root,,)
--error 0,1062
insert into t1 select 2 from t1;
--connection default
--error 0,1062
--reap
select * from t1;
drop table t1;

View file

@ -1,17 +1,6 @@
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
#
# MDEV-7314
# Concurrent "INSERT INTO table SELECT MAX(id)+1 FROM table" are
# hitting deadlocks on Aria tables using ROW_FORMAT=PAGE
#
create table t1 (pk int primary key) engine=Aria;
insert into t1 values (1);
insert into t1 select sleep(2)+1 from t1;
insert into t1 select 2 from t1;
select * from t1;
pk
1
2
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
drop table t1;

View file

@ -1,14 +1,10 @@
-- source include/have_maria.inc
#
# MDEV-4010
# Deadlock on concurrent INSERT .. SELECT into an Aria table with statement
# binary logging
#
--source include/have_binlog_format_statement.inc
drop table if exists t1;
--echo #
--echo # MDEV-7314
--echo # Concurrent "INSERT INTO table SELECT MAX(id)+1 FROM table" are
--echo # hitting deadlocks on Aria tables using ROW_FORMAT=PAGE
--echo #
create table t1 (pk int primary key) engine=Aria;
insert into t1 values (1);
@ -16,12 +12,10 @@ send insert into t1 select sleep(2)+1 from t1;
--connect (con1,localhost,root,,)
--error 0,1062
insert into t1 select 2 from t1;
--connection default
--error 0,1062
--error 1062
--reap
select * from t1;
--disconnect con1
drop table t1;

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,2 @@
--log-slave-updates=0
--skip_external_locking=0

File diff suppressed because one or more lines are too long

View file

@ -57,11 +57,16 @@ ERROR 42000: Variable 'sql_log_bin' can't be set to the value of '
SET @@session.sql_log_bin = NO;
ERROR 42000: Variable 'sql_log_bin' can't be set to the value of 'NO'
'#-------------------FN_DYNVARS_156_05----------------------------#'
SET @@global.sql_log_bin = 0;
SELECT @@global.sql_log_bin;
@@global.sql_log_bin
0
1
SET @@global.sql_log_bin = 0;
ERROR HY000: Variable 'sql_log_bin' is a SESSION variable
SELECT @@global.sql_log_bin;
@@global.sql_log_bin
1
SET @@global.sql_log_bin = 1;
ERROR HY000: Variable 'sql_log_bin' is a SESSION variable
'#----------------------FN_DYNVARS_156_06------------------------#'
SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sql_log_bin';
count(VARIABLE_VALUE)

View file

@ -23,7 +23,7 @@ Warnings:
Warning 1292 Truncated incorrect stored_program_cache value: '-1'
SELECT @@global.stored_program_cache;
@@global.stored_program_cache
256
0
SET @@global.stored_program_cache =100000000000;
Warnings:
Warning 1292 Truncated incorrect stored_program_cache value: '100000000000'
@ -31,11 +31,9 @@ SELECT @@global.stored_program_cache;
@@global.stored_program_cache
524288
SET @@global.stored_program_cache = 0;
Warnings:
Warning 1292 Truncated incorrect stored_program_cache value: '0'
SELECT @@global.stored_program_cache;
@@global.stored_program_cache
256
0
SET @@global.stored_program_cache = 10000.01;
ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
SET @@global.stored_program_cache = ON;

View file

@ -0,0 +1,52 @@
create procedure p1() select 1;
flush status;
show status like 'handler_read_key';
Variable_name Value
Handler_read_key 0
call p1;
1
1
show status like 'handler_read_key';
Variable_name Value
Handler_read_key 1
call p1;
1
1
show status like 'handler_read_key';
Variable_name Value
Handler_read_key 1
set global stored_program_cache=0;
call p1;
1
1
show status like 'handler_read_key';
Variable_name Value
Handler_read_key 2
call p1;
1
1
show status like 'handler_read_key';
Variable_name Value
Handler_read_key 3
drop procedure p1;
set global stored_program_cache=default;
create procedure pr(i int) begin
create table t1 (a int, b int);
if (i = 1) then alter table t1 drop a;
else alter table t1 drop b;
end if;
select * from t1;
drop table t1;
end |
call pr(1);
b
call pr(2);
ERROR 42S22: Unknown column 'test.t1.b' in 'field list'
drop table t1;
set global stored_program_cache=0;
call pr(1);
b
call pr(2);
a
drop procedure pr;
set global stored_program_cache=default;

View file

@ -109,11 +109,15 @@ SET @@session.sql_log_bin = NO;
--echo '#-------------------FN_DYNVARS_156_05----------------------------#'
###########################################################################
# Test if accessing global sql_log_bin gives error #
# Test if setting global sql_log_bin gives error, #
# and there is no error on reading it. #
###########################################################################
SELECT @@global.sql_log_bin;
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.sql_log_bin = 0;
SELECT @@global.sql_log_bin;
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.sql_log_bin = 1;
--echo '#----------------------FN_DYNVARS_156_06------------------------#'

View file

@ -0,0 +1,43 @@
create procedure p1() select 1;
flush status;
show status like 'handler_read_key';
call p1;
show status like 'handler_read_key';
call p1;
show status like 'handler_read_key';
set global stored_program_cache=0;
call p1;
show status like 'handler_read_key';
call p1;
show status like 'handler_read_key';
drop procedure p1;
set global stored_program_cache=default;
# Test for missing SP automatic reparsing.
# when MDEV-5816 is implemented, it should be removed.
--delimiter |
create procedure pr(i int) begin
create table t1 (a int, b int);
if (i = 1) then alter table t1 drop a;
else alter table t1 drop b;
end if;
select * from t1;
drop table t1;
end |
--delimiter ;
call pr(1);
--error ER_BAD_FIELD_ERROR
call pr(2);
drop table t1;
set global stored_program_cache=0;
call pr(1);
call pr(2);
drop procedure pr;
set global stored_program_cache=default;

View file

@ -0,0 +1,14 @@
#
# MDEV-7333 "'show table status like 'table_name'" on tokudb table lead to MariaDB crash
#
let $datadir= `select @@datadir`;
call mtr.add_suppression("bad_row_type.frm: invalid value 11 for the field row_format");
copy_file std_data/bad_row_type.MYD $datadir/test/bad_row_type.MYD;
copy_file std_data/bad_row_type.MYI $datadir/test/bad_row_type.MYI;
copy_file std_data/bad_row_type.frm $datadir/test/bad_row_type.frm;
select * from bad_row_type;
show create table bad_row_type;
replace_column 12 x 13 x;
show table status like 'bad_row_type';
drop table bad_row_type;

View file

@ -1631,3 +1631,21 @@ CREATE TABLE t1 ( d DATE, t TIME );
INSERT INTO t1 VALUES ('2008-12-05','22:34:09'),('2005-03-27','14:26:02');
SELECT EXTRACT(DAY_MINUTE FROM GREATEST(t,d)), GREATEST(t,d) FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-7221 from_days fails after null value
--echo #
CREATE TABLE t1 (
id INT(11) NOT NULL PRIMARY KEY,
date1 DATE NULL DEFAULT NULL
);
INSERT INTO t1 VALUES (12, '2011-05-12');
INSERT INTO t1 VALUES (13, NULL);
INSERT INTO t1 VALUES (14, '2009-10-23');
INSERT INTO t1 VALUES (15, '2014-10-30');
INSERT INTO t1 VALUES (16, NULL);
INSERT INTO t1 VALUES (17, NULL);
INSERT INTO t1 VALUES (18, '2010-10-13');
SELECT a.id,a.date1,FROM_DAYS(TO_DAYS(a.date1)-10) as date2, DATE_ADD(a.date1,INTERVAL -10 DAY),TO_DAYS(a.date1)-10 FROM t1 a ORDER BY a.id;
DROP TABLE t1;

View file

@ -1664,6 +1664,21 @@ WHERE t1a.c1 = c2 GROUP BY i2;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-6855
--echo # MIN(*) with subqueries with IS NOT NULL in WHERE clause crashed.
--echo #
CREATE TABLE t1 (i INT, c VARCHAR(3), KEY(c,i)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (7,'foo'),(0,'bar');
CREATE TABLE t2 (j INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (0),(8),(1),(8),(9);
SELECT MAX(i), c FROM t1
WHERE c != 'qux' AND ( SELECT SUM(j) FROM t1, t2 ) IS NOT NULL GROUP BY c;
drop table t1,t2;
#
# End of MariaDB 5.5 tests
#

View file

@ -0,0 +1,8 @@
#
# MDEV-7150 Wrong auto increment values on INSERT .. ON DUPLICATE KEY UPDATE when the inserted columns include NULL in an auto-increment column
#
create table t1 (a int(10) auto_increment primary key, b int(11));
insert t1 values (null,1);
insert t1 values (null,2), (1,-1), (null,3) on duplicate key update b=values(b);
select * from t1;
drop table t1;

View file

@ -0,0 +1 @@
--skip-name-resolve

29
mysql-test/t/kill-2.test Normal file
View file

@ -0,0 +1,29 @@
#
# Test KILL and KILL QUERY statements.
#
# Killing a connection in an embedded server does not work like in a normal
# server, if it is waiting for a new statement. In an embedded server, the
# connection does not read() from a socket, but returns control to the
# application. 'mysqltest' does not handle the kill request.
#
-- source include/not_embedded.inc
-- source include/not_threadpool.inc
--echo #
--echo # MDEV-6896 kill user command cause MariaDB crash!
--echo #
create user foo@'127.0.0.1';
--connect (con1,127.0.0.1,foo,,)
--connection default
select user from information_schema.processlist;
kill user foo@'127.0.0.1';
let $wait_condition=
select count(*) = 0 from information_schema.processlist
where user = "foo";
--source include/wait_condition.inc
drop user foo@'127.0.0.1';

View file

@ -1186,7 +1186,6 @@ DROP TABLE t1;
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

View file

@ -0,0 +1 @@
--debug

View file

@ -0,0 +1,63 @@
--source include/have_debug.inc
--disable_warnings
drop table if exists t1,t2,t3;
drop view if exists v2,v3;
--enable_warnings
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t2 (
f1 DATE,
f2 VARCHAR(1024),
f3 VARCHAR(10),
f4 DATE,
f5 VARCHAR(10),
f6 VARCHAR(10),
f7 VARCHAR(10),
f8 DATETIME,
f9 INT,
f10 VARCHAR(1024),
f11 VARCHAR(1024),
f12 INT,
f13 VARCHAR(1024)
) ENGINE=MyISAM;
CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2;
CREATE TABLE t3 (
f1 VARCHAR(1024),
f2 VARCHAR(1024),
f3 DATETIME,
f4 VARCHAR(10),
f5 INT,
f6 VARCHAR(10),
f7 VARCHAR(1024),
f8 VARCHAR(10),
f9 INT,
f10 DATE,
f11 INT,
f12 VARCHAR(1024),
f13 VARCHAR(10),
f14 DATE,
f15 DATETIME
) ENGINE=MyISAM;
CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3;
INSERT INTO t3 VALUES
('FOO','foo','2000-08-04 00:00:00','one',1,'1','FOO','foo',1,'2004-05-09',1,'one','one','2001-12-07','2001-10-17 08:25:04'),
('BAR','bar','2001-01-01 04:52:37','two',2,'2','BAR','bar',2,'2008-01-01',2,'two','two','2006-06-19','2002-01-01 08:22:49');
CREATE TABLE t4 (f1 VARCHAR(10), f2 INT) ENGINE=MyISAM;
SELECT * FROM t1;
--error ER_BAD_FIELD_ERROR
SELECT non_existing FROM v2;
SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5;
drop table t1,t2,t3,t4;
drop view v2,v3;

View file

@ -2,6 +2,7 @@
# MDEV-4578 information_schema.processlist reports incorrect value for Time (2147483647)
#
source include/have_debug.inc;
source include/have_debug_sync.inc;
let $tid= `SELECT CONNECTION_ID()`;
@ -21,6 +22,7 @@ SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
connection con1;
--replace_result $tid TID
reap;
set debug_sync='reset';
connection default;
#
@ -28,15 +30,13 @@ connection default;
#
connection con1;
# Trigger a signal once the thread has gone from "Query" to "Sleep" command
# state. Note we need to execute this twice: Once at the end of SET DEBUG_SYNC,
# and once for the intended time, at the end of SELECT SLEEP().
SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done EXECUTE 2';
connection default;
# Wait for and clear the first signal set during SET DEBUG_SYNC.
SET DEBUG_SYNC= 'now WAIT_FOR query_done';
SET DEBUG_SYNC= 'now SIGNAL nosignal';
connection con1;
# This DBUG insertion triggers a DEBUG_SYNC signal "query_done" once
# the below SELECT SLEEP(5) has gone from "Query" to "Sleep" command
# state. (We cannot just set the DEBUG_SYNC directly here, because
# then it can trigger at the end of the SET DEBUG_SYNC statement (or
# at the end of the Prepare step of the SELECT, if --ps-protocol),
# thus occuring too early).
SET debug_dbug="+d,sleep_inject_query_done_debug_sync";
select sleep(5); #run a query that will take some time
connection default;

View file

@ -0,0 +1,45 @@
--source include/have_innodb.inc
--disable_warnings
drop table if exists t1,t2;
drop procedure if exists p1;
--enable_warnings
--echo #
--echo #MDEV-6985: MariaDB crashes on stored procedure call
--echo #
CREATE TABLE `t1` (
`ID` int(11) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB;
CREATE TABLE `t2` (
`ID` int(11) NOT NULL,
`DATE` datetime DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB;
--delimiter ;;
CREATE PROCEDURE `p1`()
BEGIN
DECLARE _mySelect CURSOR FOR
SELECT DISTINCT t1.ID
FROM t1
LEFT JOIN t2 AS t2 ON
t2.ID = t1.ID
AND t2.DATE = (
SELECT MAX(T3.DATE) FROM t2 AS T3 WHERE T3.ID = t2.ID AND T3.DATE<=NOW()
)
WHERE t1.ID = 1;
OPEN _mySelect;
CLOSE _mySelect;
END ;;
--delimiter ;
CALL p1();
CALL p1();
drop procedure p1;
drop table t1,t2;

View file

@ -5335,6 +5335,16 @@ DROP FUNCTION f1;
DROP VIEW v1;
DROP TABLE t1, t2;
create view v1 as select 1;
--let $MYSQLD_DATADIR= `select @@datadir`
--let SEARCH_FILE= $MYSQLD_DATADIR/test/v1.frm
--let SEARCH_PATTERN=mariadb-version
--source include/search_pattern_in_file.inc
drop view v1;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------

View file

@ -98,3 +98,19 @@ deallocate prepare abc;
SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME = 'socket';
--echo #
--echo # Bug#16581605: REPLACE.EXE UTILITY IS BROKEN IN 5.5
--echo #
# Creating a temporary text file.
--write_file $MYSQL_TMP_DIR/bug16581605.txt
abc
def
EOF
#REPLACE.EXE UTILITY will work fine after the fix.
--exec $REPLACE abc xyz < $MYSQL_TMP_DIR/bug16581605.txt
#Cleanup
remove_file $MYSQL_TMP_DIR/bug16581605.txt;

View file

@ -727,33 +727,36 @@ my_context_continue(struct my_context *c)
#ifdef MY_CONTEXT_DISABLE
int
my_context_continue(struct my_context *c)
my_context_continue(struct my_context *c __attribute__((unused)))
{
return -1;
}
int
my_context_spawn(struct my_context *c, void (*f)(void *), void *d)
my_context_spawn(struct my_context *c __attribute__((unused)),
void (*f)(void *) __attribute__((unused)),
void *d __attribute__((unused)))
{
return -1;
}
int
my_context_yield(struct my_context *c)
my_context_yield(struct my_context *c __attribute__((unused)))
{
return -1;
}
int
my_context_init(struct my_context *c, size_t stack_size)
my_context_init(struct my_context *c __attribute__((unused)),
size_t stack_size __attribute__((unused)))
{
return -1; /* Out of memory */
}
void
my_context_destroy(struct my_context *c)
my_context_destroy(struct my_context *c __attribute__((unused)))
{
}

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2014, 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
@ -328,26 +328,4 @@ int pthread_attr_destroy(pthread_attr_t *connect_att)
return 0;
}
/****************************************************************************
** Fix localtime_r() to be a bit safer
****************************************************************************/
struct tm *localtime_r(const time_t *timep,struct tm *tmp)
{
if (*timep == (time_t) -1) /* This will crash win32 */
{
bzero(tmp,sizeof(*tmp));
}
else
{
struct tm *res=localtime(timep);
if (!res) /* Wrong date */
{
bzero(tmp,sizeof(*tmp)); /* Keep things safe */
return 0;
}
*tmp= *res;
}
return tmp;
}
#endif /* __WIN__ */

View file

@ -325,7 +325,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
found_errors++;
fprintf(stderr,
"Warning at '%s': Write lock %d waiting while no exclusive read locks\n",where,(int) lock->write_wait.data->type);
DBUG_PRINT("warning", ("Warning at '%s': Write lock %d waiting while no exclusive read locks\n",where,(int) lock->write_wait.data->type));
DBUG_PRINT("warning", ("Warning at '%s': Write lock %d waiting while no exclusive read locks",where,(int) lock->write_wait.data->type));
}
}
}
@ -345,7 +345,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
fprintf(stderr,
"Warning at '%s': Found TL_WRITE_CONCURRENT_INSERT lock mixed with other write lock: %d\n",
where, data->type);
DBUG_PRINT("warning", ("Warning at '%s': Found TL_WRITE_CONCURRENT_INSERT lock mixed with other write lock: %d\n",
DBUG_PRINT("warning", ("Warning at '%s': Found TL_WRITE_CONCURRENT_INSERT lock mixed with other write lock: %d",
where, data->type));
break;
}
@ -361,7 +361,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
fprintf(stderr,
"Warning at '%s': Found WRITE_ALLOW_WRITE lock waiting for WRITE_ALLOW_WRITE lock\n",
where);
DBUG_PRINT("warning", ("Warning at '%s': Found WRITE_ALLOW_WRITE lock waiting for WRITE_ALLOW_WRITE lock\n",
DBUG_PRINT("warning", ("Warning at '%s': Found WRITE_ALLOW_WRITE lock waiting for WRITE_ALLOW_WRITE lock",
where));
}
@ -384,7 +384,7 @@ static void check_locks(THR_LOCK *lock, const char *where,
"Warning at '%s' for lock: %d: Found lock of type %d that is write and read locked. Read_no_write_count: %d\n",
where, (int) type, lock->write.data->type,
lock->read_no_write_count);
DBUG_PRINT("warning",("At '%s' for lock %d: Found lock of type %d that is write and read locked\n",
DBUG_PRINT("warning",("At '%s' for lock %d: Found lock of type %d that is write and read locked",
where, (int) type,
lock->write.data->type));
}
@ -800,7 +800,8 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
The idea is to allow us to get a lock at once if we already have
a write lock or if there is no pending write locks and if all
write locks are of the same type and are either
TL_WRITE_ALLOW_WRITE or TL_WRITE_CONCURRENT_INSERT
TL_WRITE_ALLOW_WRITE or TL_WRITE_CONCURRENT_INSERT and
there is no TL_READ_NO_INSERT lock.
Note that, since lock requests for the same table are sorted in
such way that requests with higher thr_lock_type value come first
@ -817,7 +818,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
situation.
**) The exceptions are situations when:
- when old lock type is TL_WRITE_DELAYED
But these should never happen within MySQL.
But these should never happen within MariaDB.
Therefore it is OK to allow acquiring write lock on the table if
this thread already holds some write lock on it.
@ -836,7 +837,8 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
lock->allow_multiple_concurrent_insert &&
!lock->read_no_write_count)) &&
! lock->write_wait.data &&
lock->write.data->type == lock_type) ||
lock->write.data->type == lock_type &&
! lock->read_no_write_count) ||
has_old_lock(lock->write.data, data->owner))
{
DBUG_PRINT("info", ("write_wait.data: 0x%lx old_type: %d",

View file

@ -8,10 +8,19 @@
# post mode : ping server until answer is received
#
get_option () {
local section=$1
local option=$2
local default=$3
ret=$(/usr/bin/my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2-)
[ -z $ret ] && ret=$default
echo $ret
}
install_db () {
# Note: something different than datadir=/var/lib/mysql requires SELinux policy changes (in enforcing mode)
datadir=$(/usr/bin/my_print_defaults server mysqld | grep '^--datadir=' | sed -n 's/--datadir=//p')
datadir=$(get_option mysqld datadir "/var/lib/mysql")
# Restore log, dir, perms and SELinux contexts
[ -d "$datadir" ] || install -d -m 0755 -omysql -gmysql "$datadir" || exit 1
log=/var/log/mysqld.log
@ -35,9 +44,16 @@ pinger () {
# Wait for ping to answer to signal startup completed,
# might take a while in case of e.g. crash recovery
# MySQL systemd service will timeout script if no answer
datadir=$(get_option mysqld datadir "/var/lib/mysql")
socket=$(get_option mysqld socket "$datadir/mysql.sock")
case $socket in
/*) adminsocket="$socket" ;;
*) adminsocket="$datadir/$socket" ;;
esac
while /bin/true ; do
sleep 1
mysqladmin ping >/dev/null 2>&1 && break
mysqladmin --no-defaults --socket="$adminsocket" --user=UNKNOWN_MYSQL_USER ping >/dev/null 2>&1 && break
done
exit 0
}

View file

@ -50,11 +50,15 @@ errlogfile="$result"
get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
mypidfile="$result"
case $socketfile in
/*) adminsocket="$socketfile" ;;
*) adminsocket="$datadir/$socketfile" ;;
esac
start(){
[ -x $exec ] || exit 5
# check to see if it's already running
RESPONSE=`/usr/bin/mysqladmin --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1`
RESPONSE=$(/usr/bin/mysqladmin --no-defaults --socket="$adminsocket" --user=UNKNOWN_MYSQL_USER ping 2>&1)
if [ $? = 0 ]; then
# already running, do nothing
action $"Starting $prog: " /bin/true
@ -107,7 +111,7 @@ start(){
ret=0
TIMEOUT="$STARTTIMEOUT"
while [ $TIMEOUT -gt 0 ]; do
RESPONSE=`/usr/bin/mysqladmin --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1` && break
RESPONSE=$(/usr/bin/mysqladmin --no-defaults --socket="$adminsocket" --user=UNKNOWN_MYSQL_USER ping 2>&1) && break
echo "$RESPONSE" | grep -q "Access denied for user" && break
if ! /bin/kill -0 $safe_pid 2>/dev/null; then
echo "MySQL Daemon failed to start."

View file

@ -90,17 +90,10 @@ IF(MALLOC_LIB)
ENDIF()
IF(CMAKE_GENERATOR MATCHES "Makefiles")
# Strip maintainer mode options if necessary
STRING(REPLACE "${MY_MAINTAINER_C_WARNINGS}" "" CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
STRING(REPLACE "${MY_MAINTAINER_CXX_WARNINGS}" "" CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
FOREACH(ARCH ${CMAKE_OSX_ARCHITECTURES})
SET(CFLAGS "${CFLAGS} -arch ${ARCH}")
SET(CXXFLAGS "${CXXFLAGS} -arch ${ARCH}")
ENDFOREACH()
ELSE()
# Strip maintainer mode options if necessary
STRING(REPLACE "${MY_MAINTAINER_C_WARNINGS}" "" CFLAGS "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
STRING(REPLACE "${MY_MAINTAINER_CXX_WARNINGS}" "" CXXFLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
ENDIF()
IF(UNIX)

View file

@ -264,13 +264,13 @@ sub addall {
foreach $host (@hosts) {
# user privileges: SELECT
if (($todo == 2) || ($todo == 3)) {
$sth = $dbh->do("GRANT SELECT ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
$sth = $dbh->do("GRANT SELECT ON $db.* TO \'$user\'@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
} elsif ($todo == 4) {
# user privileges: SELECT,INSERT,UPDATE,DELETE
$sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
$sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE ON $db.* TO \'$user\'@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
} elsif ($todo == 5) {
# user privileges: SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES
$sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
$sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES ON $db.* TO \'$user\'@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
} elsif ($todo == 6) {
# all privileges
$sth = $dbh->do("GRANT ALL ON $db.* TO \'$user\'\@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;

View file

@ -579,6 +579,7 @@ then
then
# User explicitly asked for syslog, so warn that it isn't used
log_error "Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect."
want_syslog=0
fi
# Log to err_log file

View file

@ -1,4 +1,4 @@
#!@PERL@
#!/usr/bin/perl
# Test of table elimination feature
use Cwd;

View file

@ -113,7 +113,7 @@ my_bool net_flush(NET *net);
#define native_password_plugin_name "mysql_native_password"
#define old_password_plugin_name "mysql_old_password"
uint mariadb_deinitialize_ssl= 1;
uint mysql_port=0;
char *mysql_unix_port= 0;
const char *unknown_sqlstate= "HY000";

View file

@ -28,11 +28,6 @@
There is no reference counting and no unloading either.
*/
#if _MSC_VER
/* Silence warnings about variable 'unused' being used. */
#define FORCE_INIT_OF_VARS 1
#endif
#include <my_global.h>
#include "mysql.h"
#include <my_sys.h>

View file

@ -83,9 +83,7 @@ static const LEX_STRING sys_table_aliases[]=
};
const char *ha_row_type[] = {
"", "FIXED", "DYNAMIC", "COMPRESSED", "REDUNDANT", "COMPACT",
"PAGE",
"?","?","?"
"", "FIXED", "DYNAMIC", "COMPRESSED", "REDUNDANT", "COMPACT", "PAGE"
};
const char *tx_isolation_names[] =

View file

@ -452,8 +452,10 @@ enum legacy_db_type
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT,
ROW_TYPE_PAGE };
ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_PAGE };
/* not part of the enum, so that it shouldn't be in switch(row_type) */
#define ROW_TYPE_MAX ((uint)ROW_TYPE_PAGE + 1)
/* Specifies data storage format for individual columns */
enum column_format_type {
@ -1389,6 +1391,9 @@ static inline sys_var *find_hton_sysvar(handlerton *hton, st_mysql_sys_var *var)
#define HTON_NO_BINLOG_ROW_OPT (1 << 9)
#define HTON_SUPPORTS_EXTENDED_KEYS (1 <<10) //supports extended keys
// MySQL compatibility. Unused.
#define HTON_SUPPORTS_FOREIGN_KEYS (1 << 0) //Foreign key constraint supported.
class Ha_trx_info;
struct THD_TRANS
@ -1570,7 +1575,7 @@ class partition_info;
struct st_partition_iter;
enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };
enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES, HA_CHOICE_MAX };
enum enum_stats_auto_recalc { HA_STATS_AUTO_RECALC_DEFAULT= 0,
HA_STATS_AUTO_RECALC_ON,

View file

@ -885,20 +885,20 @@ Item_ident::Item_ident(THD *thd, Item_ident *item)
void Item_ident::cleanup()
{
DBUG_ENTER("Item_ident::cleanup");
#ifdef CANT_BE_USED_AS_MEMORY_IS_FREED
db_name ? db_name : "(null)",
orig_db_name ? orig_db_name : "(null)",
table_name ? table_name : "(null)",
orig_table_name ? orig_table_name : "(null)",
field_name ? field_name : "(null)",
orig_field_name ? orig_field_name : "(null)"));
#endif
bool was_fixed= fixed;
Item::cleanup();
db_name= orig_db_name;
table_name= orig_table_name;
field_name= orig_field_name;
/* Store if this Item was depended */
can_be_depended= MY_TEST(depended_from);
if (was_fixed)
{
/*
We can trust that depended_from set correctly only if this item
was fixed
*/
can_be_depended= MY_TEST(depended_from);
}
DBUG_VOID_RETURN;
}

View file

@ -4458,7 +4458,7 @@ private:
/**
@todo
Implement the is_null() method for this class. Currently calling is_null()
on any Item_cache object resolves to Item::is_null(), which reutns FALSE
on any Item_cache object resolves to Item::is_null(), which returns FALSE
for any value.
*/

View file

@ -4620,6 +4620,11 @@ longlong Item_func_sleep::val_int()
mysql_cond_destroy(&cond);
DBUG_EXECUTE_IF("sleep_inject_query_done_debug_sync", {
debug_sync_set_action
(thd, STRING_WITH_LEN("dispatch_command_end SIGNAL query_done"));
};);
return MY_TEST(!error); // Return 1 killed
}

View file

@ -1,7 +1,7 @@
#ifndef ITEM_FUNC_INCLUDED
#define ITEM_FUNC_INCLUDED
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2014, SkySQL Ab.
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2014, MariaDB
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
@ -287,7 +287,8 @@ public:
inline longlong check_integer_overflow(longlong value, bool val_unsigned)
{
if ((unsigned_flag && !val_unsigned && value < 0) ||
(!unsigned_flag && val_unsigned && (ulonglong) value > LONGLONG_MAX))
(!unsigned_flag && val_unsigned &&
(ulonglong) value > (ulonglong) LONGLONG_MAX))
return raise_integer_overflow();
return value;
}

View file

@ -1564,10 +1564,9 @@ String *Item_temporal_hybrid_func::val_str_ascii(String *str)
bool Item_func_from_days::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
{
longlong value=args[0]->val_int();
if (args[0]->null_value)
return (null_value= 1);
if ((fuzzy_date & TIME_NO_ZERO_DATE) && value == 0)
return (null_value= 1);
if ((null_value= (args[0]->null_value ||
((fuzzy_date & TIME_NO_ZERO_DATE) && value == 0))))
return true;
bzero(ltime, sizeof(MYSQL_TIME));
if (get_date_from_daynr((long) value, &ltime->year, &ltime->month,
&ltime->day))

View file

@ -1669,7 +1669,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
ev = new Execute_load_log_event(buf, event_len, description_event);
break;
case START_EVENT_V3: /* this is sent only by MySQL <=4.x */
ev = new Start_log_event_v3(buf, description_event);
ev = new Start_log_event_v3(buf, event_len, description_event);
break;
case STOP_EVENT:
ev = new Stop_log_event(buf, description_event);
@ -4662,11 +4662,16 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
Start_log_event_v3::Start_log_event_v3()
*/
Start_log_event_v3::Start_log_event_v3(const char* buf,
Start_log_event_v3::Start_log_event_v3(const char* buf, uint event_len,
const Format_description_log_event
*description_event)
:Log_event(buf, description_event)
:Log_event(buf, description_event), binlog_version(BINLOG_VERSION)
{
if (event_len < LOG_EVENT_MINIMAL_HEADER_LEN + ST_COMMON_HEADER_LEN_OFFSET)
{
server_version[0]= 0;
return;
}
buf+= LOG_EVENT_MINIMAL_HEADER_LEN;
binlog_version= uint2korr(buf+ST_BINLOG_VER_OFFSET);
memcpy(server_version, buf+ST_SERVER_VER_OFFSET,
@ -4971,9 +4976,12 @@ Format_description_log_event(const char* buf,
const
Format_description_log_event*
description_event)
:Start_log_event_v3(buf, description_event), event_type_permutation(0)
:Start_log_event_v3(buf, event_len, description_event),
common_header_len(0), post_header_len(NULL), event_type_permutation(0)
{
DBUG_ENTER("Format_description_log_event::Format_description_log_event(char*,...)");
if (!Start_log_event_v3::is_valid())
DBUG_VOID_RETURN; /* sanity check */
buf+= LOG_EVENT_MINIMAL_HEADER_LEN;
if ((common_header_len=buf[ST_COMMON_HEADER_LEN_OFFSET]) < OLD_HEADER_LEN)
DBUG_VOID_RETURN; /* sanity check */

View file

@ -2515,7 +2515,7 @@ public:
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
#endif
Start_log_event_v3(const char* buf,
Start_log_event_v3(const char* buf, uint event_len,
const Format_description_log_event* description_event);
~Start_log_event_v3() {}
Log_event_type get_type_code() { return START_EVENT_V3;}
@ -2524,7 +2524,7 @@ public:
#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
#endif
bool is_valid() const { return 1; }
bool is_valid() const { return server_version[0] != 0; }
int get_data_size()
{
return START_V3_HEADER_LEN; //no variable-sized part

View file

@ -13167,12 +13167,13 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
SYNOPSIS
check_group_min_max_predicates()
cond [in] the expression tree being analyzed
min_max_arg [in] the field referenced by the MIN/MAX function(s)
image_type [in]
has_min_max_arg [out] true if the subtree being analyzed references min_max_arg
has_other_arg [out] true if the subtree being analyzed references a column
other min_max_arg
cond [in] the expression tree being analyzed
min_max_arg [in] the field referenced by the MIN/MAX function(s)
image_type [in]
has_min_max_arg [out] true if the subtree being analyzed references
min_max_arg
has_other_arg [out] true if the subtree being analyzed references a
column other min_max_arg
DESCRIPTION
The function walks recursively over the cond tree representing a WHERE
@ -13216,7 +13217,7 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
(2) the subtree passes the test, but it is an OR and it references both
the min/max argument and other columns.
*/
if (!check_group_min_max_predicates(and_or_arg, min_max_arg_item, //1
if (!check_group_min_max_predicates(and_or_arg, min_max_arg_item, //1
image_type,
&has_min_max, &has_other) ||
(func_type == Item_func::COND_OR_FUNC && has_min_max && has_other))//2
@ -13232,7 +13233,7 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
a subquery in the WHERE clause.
*/
if (cond_type == Item::SUBSELECT_ITEM)
if (unlikely(cond_type == Item::SUBSELECT_ITEM))
{
Item_subselect *subs_cond= (Item_subselect*) cond;
if (subs_cond->is_correlated)
@ -13249,7 +13250,14 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
}
DBUG_RETURN(TRUE);
}
/*
Subquery with IS [NOT] NULL
TODO: Look into the cache_item and optimize it like we do for
subselect's above
*/
if (unlikely(cond_type == Item::CACHE_ITEM))
DBUG_RETURN(cond->const_item());
/*
Condition of the form 'field' is equivalent to 'field <> 0' and thus
satisfies the SA3 condition.
@ -13266,7 +13274,9 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
/* We presume that at this point there are no other Items than functions. */
DBUG_ASSERT(cond_type == Item::FUNC_ITEM);
if (unlikely(cond_type != Item::FUNC_ITEM)) /* Safety */
DBUG_RETURN(FALSE);
/* Test if cond references only group-by or non-group fields. */
Item_func *pred= (Item_func*) cond;
Item_func::Functype pred_type= pred->functype();

View file

@ -1758,7 +1758,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
table->file->adjust_next_insert_id_after_explicit_value(table->next_number_field->val_int());
}
else
else if (prev_insert_id_for_cur_row)
{
table->file->restore_auto_increment(prev_insert_id_for_cur_row);
}

View file

@ -5982,6 +5982,115 @@ bool check_global_access(THD *thd, ulong want_access, bool no_errors)
#endif
}
/**
Checks foreign key's parent table access.
@param thd [in] Thread handler
@param create_info [in] Create information (like MAX_ROWS, ENGINE or
temporary table flag)
@param alter_info [in] Initial list of columns and indexes for the
table to be created
@retval
false ok.
@retval
true error or access denied. Error is sent to client in this case.
*/
bool check_fk_parent_table_access(THD *thd,
HA_CREATE_INFO *create_info,
Alter_info *alter_info)
{
Key *key;
List_iterator<Key> key_iterator(alter_info->key_list);
while ((key= key_iterator++))
{
if (key->type == Key::FOREIGN_KEY)
{
TABLE_LIST parent_table;
bool is_qualified_table_name;
Foreign_key *fk_key= (Foreign_key *)key;
LEX_STRING db_name;
LEX_STRING table_name= { fk_key->ref_table.str,
fk_key->ref_table.length };
const ulong privileges= (SELECT_ACL | INSERT_ACL | UPDATE_ACL |
DELETE_ACL | REFERENCES_ACL);
// Check if tablename is valid or not.
DBUG_ASSERT(table_name.str != NULL);
if (check_table_name(table_name.str, table_name.length, false))
{
my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name.str);
return true;
}
if (fk_key->ref_db.str)
{
is_qualified_table_name= true;
db_name.str= (char *) thd->memdup(fk_key->ref_db.str,
fk_key->ref_db.length+1);
db_name.length= fk_key->ref_db.length;
// Check if database name is valid or not.
if (fk_key->ref_db.str && check_db_name(&db_name))
{
my_error(ER_WRONG_DB_NAME, MYF(0), db_name.str);
return true;
}
}
else if (thd->lex->copy_db_to(&db_name.str, &db_name.length))
return true;
else
is_qualified_table_name= false;
// if lower_case_table_names is set then convert tablename to lower case.
if (lower_case_table_names)
{
table_name.str= (char *) thd->memdup(fk_key->ref_table.str,
fk_key->ref_table.length+1);
table_name.length= my_casedn_str(files_charset_info, table_name.str);
}
parent_table.init_one_table(db_name.str, db_name.length,
table_name.str, table_name.length,
table_name.str, TL_IGNORE);
/*
Check if user has any of the "privileges" at table level on
"parent_table".
Having privilege on any of the parent_table column is not
enough so checking whether user has any of the "privileges"
at table level only here.
*/
if (check_some_access(thd, privileges, &parent_table) ||
parent_table.grant.want_privilege)
{
if (is_qualified_table_name)
{
const size_t qualified_table_name_len= NAME_LEN + 1 + NAME_LEN + 1;
char *qualified_table_name= (char *) thd->alloc(qualified_table_name_len);
my_snprintf(qualified_table_name, qualified_table_name_len, "%s.%s",
db_name.str, table_name.str);
table_name.str= qualified_table_name;
}
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
"REFERENCES",
thd->security_ctx->priv_user,
thd->security_ctx->host_or_ip,
table_name.str);
return true;
}
}
}
return false;
}
/****************************************************************************
Check stack size; Send error if there isn't enough stack to continue
****************************************************************************/
@ -7391,7 +7500,7 @@ static uint kill_threads_for_user(THD *thd, LEX_USER *user,
host.str[0] == '%' means that host name was not given. See sql_yacc.yy
*/
if (((user->host.str[0] == '%' && !user->host.str[1]) ||
!strcmp(tmp->security_ctx->host, user->host.str)) &&
!strcmp(tmp->security_ctx->host_or_ip, user->host.str)) &&
!strcmp(tmp->security_ctx->user, user->user.str))
{
if (!(thd->security_ctx->master_access & SUPER_ACL) &&
@ -8047,7 +8156,9 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
if (check_table_access(thd, SELECT_ACL, tables, FALSE, UINT_MAX, FALSE))
goto err;
}
error= FALSE;
if (check_fk_parent_table_access(thd, &lex->create_info, &lex->alter_info))
goto err;
/*
For CREATE TABLE we should not open the table even if it exists.
@ -8055,6 +8166,8 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
*/
lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB;
error= FALSE;
err:
DBUG_RETURN(error);
}

View file

@ -46,6 +46,9 @@ bool delete_precheck(THD *thd, TABLE_LIST *tables);
bool insert_precheck(THD *thd, TABLE_LIST *tables);
bool create_table_precheck(THD *thd, TABLE_LIST *tables,
TABLE_LIST *create_table);
bool check_fk_parent_table_access(THD *thd,
HA_CREATE_INFO *create_info,
Alter_info *alter_info);
bool parse_sql(THD *thd, Parser_state *parser_state,
Object_creation_ctx *creation_ctx, bool do_pfs_digest=false);

Some files were not shown because too many files have changed in this diff Show more