Commit 658503a4 authored by Vasil Dimov's avatar Vasil Dimov

Merge mysql-5.5-bugteam -> mysql-5.5-innodb

parents 939b48bf 7d8f7081
......@@ -331,23 +331,33 @@ ELSE()
SET(CPACK_GENERATOR "TGZ")
ENDIF()
ADD_SUBDIRECTORY(packaging/WiX)
# Create a single package with "make package"
# (see http://public.kitware.com/Bug/view.php?id=11452)
SET(CPACK_MONOLITHIC_INSTALL 1 CACHE INTERNAL "")
INCLUDE(CPack)
IF(UNIX)
INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL)
INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL COMPONENT Info)
ENDIF()
#
# RPM installs documentation directly from the source tree
#
IF(NOT INSTALL_LAYOUT MATCHES "RPM")
INSTALL(FILES COPYING EXCEPTIONS-CLIENT LICENSE.mysql DESTINATION ${INSTALL_DOCREADMEDIR} OPTIONAL)
INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR})
INSTALL(FILES COPYING EXCEPTIONS-CLIENT LICENSE.mysql
DESTINATION ${INSTALL_DOCREADMEDIR}
COMPONENT Readme
OPTIONAL
)
INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme)
IF(UNIX)
INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR})
INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme)
ENDIF()
# MYSQL_DOCS_LOCATON is used in "make dist", points to the documentation directory
SET(MYSQL_DOCS_LOCATION "" CACHE PATH "Location from where documentation is copied")
MARK_AS_ADVANCED(MYSQL_DOCS_LOCATION)
INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR}
COMPONENT Documentation
PATTERN "INSTALL-BINARY" EXCLUDE
PATTERN "Makefile.*" EXCLUDE
PATTERN "glibc*" EXCLUDE
......
......@@ -185,6 +185,11 @@ foreach my $option (@ARGV)
($option =~ /enable/ ? "1" : "0");
next;
}
if ($option =~ /with-comment=/)
{
$cmakeargs = $cmakeargs." \"-DWITH_COMMENT=".substr($option,13)."\"";
next;
}
$option = uc($option);
$option =~ s/-/_/g;
......
......@@ -86,7 +86,7 @@ IF(UNIX)
SET(CMAKE_INSTALL_PREFIX ${default_prefix}
CACHE PATH "install prefix" FORCE)
ENDIF()
SET(VALID_INSTALL_LAYOUTS "RPM" "STANDALONE" "DEB" "SVR5")
SET(VALID_INSTALL_LAYOUTS "RPM" "STANDALONE" "DEB" "SVR4")
LIST(FIND VALID_INSTALL_LAYOUTS "${INSTALL_LAYOUT}" ind)
IF(ind EQUAL -1)
MESSAGE(FATAL_ERROR "Invalid INSTALL_LAYOUT parameter:${INSTALL_LAYOUT}."
......
......@@ -78,7 +78,9 @@ FUNCTION(INSTALL_MANPAGE file)
ELSE()
SET(SECTION man8)
ENDIF()
INSTALL(FILES "${MANPAGE}" DESTINATION "${INSTALL_MANDIR}/${SECTION}")
MESSAGE("huj!")
INSTALL(FILES "${MANPAGE}" DESTINATION "${INSTALL_MANDIR}/${SECTION}"
COMPONENT ManPages)
ENDIF()
ENDFUNCTION()
......@@ -137,12 +139,7 @@ IF(UNIX)
STRING(REPLACE "${CMAKE_CFG_INTDIR}"
"\${CMAKE_INSTALL_CONFIG_NAME}" output ${output})
ENDIF()
IF(component)
SET(COMP COMPONENT ${component})
ELSE()
SET(COMP)
ENDIF()
INSTALL(FILES ${output} DESTINATION ${destination} ${COMP})
INSTALL(FILES ${output} DESTINATION ${destination} COMPONENT ${component})
ENDIF()
ENDMACRO()
......@@ -224,8 +221,6 @@ FUNCTION(MYSQL_INSTALL_TARGETS)
IF(SIGNCODE AND SIGNCODE_ENABLED)
SIGN_TARGET(${target})
ENDIF()
# For Windows, add version info to executables
ADD_VERSION_INFO(${target})
# Install man pages on Unix
IF(UNIX)
GET_TARGET_PROPERTY(target_location ${target} LOCATION)
......
......@@ -250,6 +250,9 @@ MACRO(MERGE_LIBRARIES)
ENDFOREACH()
ENDIF()
CREATE_EXPORT_FILE(SRC ${TARGET} "${ARG_EXPORTS}")
IF(NOT ARG_NOINSTALL)
ADD_VERSION_INFO(${TARGET} SHARED SRC)
ENDIF()
ADD_LIBRARY(${TARGET} ${LIBTYPE} ${SRC})
TARGET_LINK_LIBRARIES(${TARGET} ${LIBS})
IF(ARG_OUTPUT_NAME)
......
......@@ -37,7 +37,7 @@ FUNCTION (MYSQL_ADD_EXECUTABLE)
LIST(REMOVE_AT ARG_DEFAULT_ARGS 0)
SET(sources ${ARG_DEFAULT_ARGS})
ADD_VERSION_INFO(${target} EXECUTABLE sources)
ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
# tell CPack where to install
IF(NOT ARG_EXCLUDE_FROM_ALL)
......
......@@ -133,9 +133,8 @@ ENDIF()
# Refer to http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx
# for more info.
IF(MSVC)
GET_TARGET_PROPERTY(location gen_versioninfo LOCATION)
IF(NOT location)
GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
SET(FILETYPE VFT_APP)
CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
${CMAKE_BINARY_DIR}/versioninfo_exe.rc)
......@@ -143,31 +142,14 @@ IF(MSVC)
SET(FILETYPE VFT_DLL)
CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
${CMAKE_BINARY_DIR}/versioninfo_dll.rc)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_BINARY_DIR}/versioninfo_exe.res
${CMAKE_BINARY_DIR}/versioninfo_dll.res
COMMAND ${CMAKE_RC_COMPILER} versioninfo_exe.rc
COMMAND ${CMAKE_RC_COMPILER} versioninfo_dll.rc
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
ADD_CUSTOM_TARGET(gen_versioninfo
DEPENDS
${CMAKE_BINARY_DIR}/versioninfo_exe.res
${CMAKE_BINARY_DIR}/versioninfo_dll.res
)
ENDIF()
FUNCTION(ADD_VERSION_INFO target)
GET_TARGET_PROPERTY(target_type ${target} TYPE)
ADD_DEPENDENCIES(${target} gen_versioninfo)
IF(target_type MATCHES "SHARED" OR target_type MATCHES "MODULE")
SET_PROPERTY(TARGET ${target} APPEND PROPERTY LINK_FLAGS
"\"${CMAKE_BINARY_DIR}/versioninfo_dll.res\"")
ELSEIF(target_type MATCHES "EXE")
SET_PROPERTY(TARGET ${target} APPEND PROPERTY LINK_FLAGS
"${target_link_flags} \"${CMAKE_BINARY_DIR}/versioninfo_exe.res\"")
FUNCTION(ADD_VERSION_INFO target target_type sources_var)
IF("${target_type}" MATCHES "SHARED" OR "${target_type}" MATCHES "MODULE")
SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_dll.rc)
ELSEIF("${target_type}" MATCHES "EXE")
SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_exe.rc)
ENDIF()
SET(${sources_var} ${${sources_var}} ${rcfile} PARENT_SCOPE)
ENDFUNCTION()
ELSE()
FUNCTION(ADD_VERSION_INFO)
......
......@@ -151,6 +151,7 @@ MACRO(MYSQL_ADD_PLUGIN)
ENDIF()
ENDIF()
ADD_VERSION_INFO(${target} MODULE SOURCES)
ADD_LIBRARY(${target} MODULE ${SOURCES})
DTRACE_INSTRUMENT(${target})
SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX ""
......
......@@ -855,7 +855,7 @@ _rl_read_init_file (filename, include_level)
{
register int i;
char *buffer, *openname, *line, *end;
size_t file_size;
size_t file_size = 0;
current_readline_init_file = filename;
current_readline_init_include_level = include_level;
......
......@@ -76,7 +76,9 @@ extern "C" {
extern void *(*my_str_malloc)(size_t);
extern void (*my_str_free)(void *);
#if defined(HAVE_STPCPY)
#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4)
#define strmov(A,B) __builtin_stpcpy((A),(B))
#elif defined(HAVE_STPCPY)
#define strmov(A,B) stpcpy((A),(B))
#ifndef stpcpy
extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
......
......@@ -76,6 +76,11 @@
/**
Generic (compiler-independent) features.
*/
#ifndef MY_GNUC_PREREQ
# define MY_GNUC_PREREQ(maj, min) (0)
#endif
#ifndef MY_ALIGNOF
# ifdef __cplusplus
template<typename type> struct my_alignof_helper { char m1; type m2; };
......
......@@ -79,8 +79,7 @@ struct st_mysql_client_plugin_AUTHENTICATION
/**
loads a plugin and initializes it
@param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used,
and last_errno/last_error, for error reporting
@param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded, -1 to disable type check
@param argc number of arguments to pass to the plugin initialization
......@@ -100,8 +99,7 @@ mysql_load_plugin(struct st_mysql *mysql, const char *name, int type,
This is the same as mysql_load_plugin, but take va_list instead of
a list of arguments.
@param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used,
and last_errno/last_error, for error reporting
@param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded, -1 to disable type check
@param argc number of arguments to pass to the plugin initialization
......@@ -118,8 +116,7 @@ mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type,
/**
finds an already loaded plugin by name, or loads it, if necessary
@param mysql MYSQL structure. only MYSQL_PLUGIN_DIR option value is used,
and last_errno/last_error, for error reporting
@param mysql MYSQL structure.
@param name a name of the plugin to load
@param type type of plugin that should be loaded
......
......@@ -255,7 +255,11 @@ enum enum_server_command
#define SERVER_STATUS_CLEAR_SET (SERVER_QUERY_NO_GOOD_INDEX_USED| \
SERVER_QUERY_NO_INDEX_USED|\
SERVER_MORE_RESULTS_EXISTS|\
SERVER_STATUS_METADATA_CHANGED)
SERVER_STATUS_METADATA_CHANGED |\
SERVER_QUERY_WAS_SLOW |\
SERVER_STATUS_DB_DROPPED |\
SERVER_STATUS_CURSOR_EXISTS|\
SERVER_STATUS_LAST_ROW_SENT)
#define MYSQL_ERRMSG_SIZE 512
#define NET_READ_TIMEOUT 30 /* Timeout on read */
......
......@@ -172,7 +172,7 @@ IF(UNIX)
SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION})
ENDIF()
ENDMACRO()
INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} Development)
ENDIF()
IF(NOT DISABLE_SHARED)
......@@ -210,7 +210,7 @@ IF(NOT DISABLE_SHARED)
"${CMAKE_SHARED_LIBRARY_SUFFIX}"
""
linkname)
INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries)
SET(OS_SHARED_LIB_SYMLINKS "${SHARED_LIB_MAJOR_VERSION}" "${OS_SHARED_LIB_VERSION}")
LIST(REMOVE_DUPLICATES OS_SHARED_LIB_SYMLINKS)
FOREACH(ver ${OS_SHARED_LIB_SYMLINKS})
......@@ -219,7 +219,7 @@ IF(NOT DISABLE_SHARED)
"${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${ver}"
linkname)
INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} COMPONENT SharedLibraries)
INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries)
ENDFOREACH()
ENDIF()
ENDIF()
......@@ -22,4 +22,4 @@ SET(MYSQLSERVICES_SOURCES
my_thread_scheduler_service.c)
ADD_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR})
INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR} COMPONENT Development)
......@@ -21,8 +21,10 @@ IF(MAN1_FILES)
IF(MAN1_EXCLUDE)
LIST(REMOVE_ITEM MAN1_FILES ${MAN1_EXCLUDE})
ENDIF()
INSTALL(FILES ${MAN1_FILES} DESTINATION ${INSTALL_MANDIR}/man1)
INSTALL(FILES ${MAN1_FILES} DESTINATION ${INSTALL_MANDIR}/man1
COMPONENT ManPages)
ENDIF()
IF(MAN8_FILES)
INSTALL(FILES ${MAN8_FILES} DESTINATION ${INSTALL_MANDIR}/man8)
INSTALL(FILES ${MAN8_FILES} DESTINATION ${INSTALL_MANDIR}/man8
COMPONENT ManPages)
ENDIF()
......@@ -53,7 +53,8 @@ IF(UNIX)
IF(INSTALL_MYSQLTESTDIR)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mtr
${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run
DESTINATION ${INSTALL_MYSQLTESTDIR})
DESTINATION ${INSTALL_MYSQLTESTDIR}
COMPONENT Test)
ENDIF()
ENDIF()
......
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
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 large_tests.alter_table main.alter_table-big main.archive-big main.count_distinct3 main.create-big main.events_stress main.events_time_zone main.information_schema-big main.log_tables-big main.merge-big main.mysqlbinlog_row_big main.read_many_rows_innodb main.ssl-big main.sum_distinct-big main.type_newdecimal-big main.variables-big 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 rpl_ndb.rpl_truncate_7ndb_2
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-ndb
perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --comment=main_ps_row --vardir=var-main-ps_row --suite=main --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --comment=main_embedded --vardir=var-main_emebbed --suite=main --embedded --experimental=collections/default.experimental --skip-ndb
perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb
#
# SUMMARY
# Check that a statement is compatible with FLUSH TABLES WITH READ LOCK.
#
# PARAMETERS
# $con_aux1 Name of the 1st aux connection to be used by this script.
# $con_aux2 Name of the 2nd aux connection to be used by this script.
# $statement The statement to be checked.
# $cleanup_stmt The statement to be run in order to revert effects of
# the statement to be checked.
# $skip_3rd_chk Skip the 3rd stage of checking. The purpose of the third
# stage is to check that metadata locks taken by this
# statement are compatible with metadata locks taken
# by FTWRL.
#
# EXAMPLE
# flush_read_lock.test
#
--disable_result_log
--disable_query_log
# Reset DEBUG_SYNC facility for safety.
set debug_sync= "RESET";
#
# First, check that the statement can be run under FTWRL.
#
flush tables with read lock;
--disable_abort_on_error
--eval $statement
--enable_abort_on_error
let $err= $mysql_errno;
if (!$err)
{
--echo Success: Was able to run '$statement' under FTWRL.
unlock tables;
if (`SELECT "$cleanup_stmt" <> ""`)
{
--eval $cleanup_stmt;
}
}
if ($err)
{
--echo Error: Wasn't able to run '$statement' under FTWRL!
unlock tables;
}
#
# Then check that this statement won't be blocked by FTWRL
# that is active in another connection.
#
connection $con_aux1;
flush tables with read lock;
connection default;
--send_eval $statement;
connection $con_aux1;
--enable_result_log
--enable_query_log
let $wait_condition=
select count(*) = 0 from information_schema.processlist
where info = "$statement";
--source include/wait_condition.inc
--disable_result_log
--disable_query_log
if ($success)
{
--echo Success: Was able to run '$statement' with FTWRL active in another connection.
connection default;
# Apparently statement was successfully executed and so
# was not blocked by FTWRL.
# To be safe against wait_condition.inc succeeding due to
# races let us first reap the statement being checked to
# ensure that it has been successfully executed.
--reap
connection $con_aux1;
unlock tables;
connection default;
}
if (!$success)
{
--echo Error: Wasn't able to run '$statement' with FTWRL active in another connection!
unlock tables;
connection default;
--reap
}
if (`SELECT "$cleanup_stmt" <> ""`)
{
--eval $cleanup_stmt;
}
if (`SELECT "$skip_3rd_check" = ""`)
{
#
# Finally, let us check that FTWRL will succeed if this statement
# is active but has already closed its tables.
#
connection default;
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
--send_eval $statement;
connection $con_aux1;
set debug_sync="now WAIT_FOR parked";
--send flush tables with read lock
connection $con_aux2;
--enable_result_log
--enable_query_log
let $wait_condition=
select count(*) = 0 from information_schema.processlist
where info = "flush tables with read lock";
--source include/wait_condition.inc
--disable_result_log
--disable_query_log
if ($success)
{
--echo Success: Was able to run FTWRL while '$statement' was active in another connection.
connection $con_aux1;
# Apparently FTWRL was successfully executed and so was not blocked by
# the statement being checked. To be safe against wait_condition.inc
# succeeding due to races let us first reap the FTWRL to ensure that it
# has been successfully executed.
--reap
unlock tables;
set debug_sync="now SIGNAL go";
connection default;
--reap
}
if (!$success)
{
--echo Error: Wasn't able to run FTWRL while '$statement' was active in another connection!
set debug_sync="now SIGNAL go";
connection default;
--reap
connection $con_aux1;
--reap
unlock tables;
connection default;
}
set debug_sync= "RESET";
if (`SELECT "$cleanup_stmt" <> ""`)
{
--eval $cleanup_stmt;
}
}
--enable_result_log
--enable_query_log
#
# SUMMARY
# Check that a statement is incompatible with FLUSH TABLES WITH READ LOCK.
#
# PARAMETERS
# $con_aux1 Name of the 1st aux connection to be used by this script.
# $con_aux2 Name of the 2nd aux connection to be used by this script.
# $statement The statement to be checked.
# $cleanup_stmt1 The 1st statement to be run in order to revert effects
# of statement to be checked.
# $cleanup_stmt2 The 2nd statement to be run in order to revert effects
# of statement to be checked.
# $skip_3rd_chk Skip the 3rd stage of checking. The purpose of the third
# stage is to check that metadata locks taken by this
# statement are incompatible with metadata locks taken
# by FTWRL.
#
# EXAMPLE
# flush_read_lock.test
#
--disable_result_log
--disable_query_log
# Reset DEBUG_SYNC facility for safety.
set debug_sync= "RESET";
#
# First, check that the statement cannot be run under FTWRL.
#
flush tables with read lock;
--disable_abort_on_error
--eval $statement
--enable_abort_on_error
let $err= $mysql_errno;
if ($err)
{
--echo Success: Was not able to run '$statement' under FTWRL.
unlock tables;
}
if (!$err)
{
--echo Error: Was able to run '$statement' under FTWRL!
unlock tables;
if (`SELECT "$cleanup_stmt1" <> ""`)
{
--eval $cleanup_stmt1;
}
if (`SELECT "$cleanup_stmt2" <> ""`)
{
--eval $cleanup_stmt2;
}
}
#
# Then check that this statement is blocked by FTWRL
# that is active in another connection.
#
connection $con_aux1;
flush tables with read lock;
connection default;
--send_eval $statement;
connection $con_aux1;
--enable_result_log
--enable_query_log
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where (state = "Waiting for global read lock" or
state = "Waiting for commit lock") and
info = "$statement";
--source include/wait_condition.inc
--disable_result_log
--disable_query_log
if ($success)
{
--echo Success: '$statement' is blocked by FTWRL active in another connection.
}
if (!$success)
{
--echo Error: '$statement' wasn't blocked by FTWRL active in another connection!
}
unlock tables;
connection default;
--reap
if (`SELECT "$cleanup_stmt1" <> ""`)
{
--eval $cleanup_stmt1;
}
if (`SELECT "$cleanup_stmt2" <> ""`)
{
--eval $cleanup_stmt2;
}
if (`SELECT "$skip_3rd_check" = ""`)
{
#
# Finally, let us check that FTWRL will not succeed if this
# statement is active but has already closed its tables.
#
connection default;
--eval set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
--send_eval $statement;
connection $con_aux1;
set debug_sync="now WAIT_FOR parked";
--send flush tables with read lock
connection $con_aux2;
--enable_result_log
--enable_query_log
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where (state = "Waiting for global read lock" or
state = "Waiting for commit lock") and
info = "flush tables with read lock";
--source include/wait_condition.inc
--disable_result_log
--disable_query_log
if ($success)
{
--echo Success: FTWRL is blocked when '$statement' is active in another connection.
}
if (!$success)
{
--echo Error: FTWRL isn't blocked when '$statement' is active in another connection!
}
set debug_sync="now SIGNAL go";
connection default;
--reap
connection $con_aux1;
--reap
unlock tables;
connection default;
set debug_sync= "RESET";
if (`SELECT "$cleanup_stmt1" <> ""`)
{
--eval $cleanup_stmt1;
}
if (`SELECT "$cleanup_stmt2" <> ""`)
{
--eval $cleanup_stmt2;
}
}
--enable_result_log
--enable_query_log
......@@ -1545,8 +1545,6 @@ lock table not_exists_write read;
--echo # We still have the read lock.
--error ER_CANT_UPDATE_WITH_READLOCK
drop table t1;
handler t1 read next;
handler t1 close;
handler t1 open;
select a from t2;
handler t1 read next;
......
......@@ -101,7 +101,7 @@ if (`SELECT '$wait_for_all' = '1'`)
if (!$found)
{
echo # Timeout in include/wait_show_condition.inc for $wait_condition;
echo # Timeout in include/wait_show_condition.inc for $condition;
echo # show_statement : $show_statement;
echo # field : $field;
echo # condition : $condition;
......
......@@ -177,8 +177,6 @@ sub collect_test_cases ($$$$) {
if ( $opt_reorder && !$quick_collect)
{
# Reorder the test cases in an order that will make them faster to run
my %sort_criteria;
# Make a mapping of test name to a string that represents how that test
# should be sorted among the other tests. Put the most important criterion
# first, then a sub-criterion, then sub-sub-criterion, etc.
......@@ -190,24 +188,31 @@ sub collect_test_cases ($$$$) {
# Append the criteria for sorting, in order of importance.
#
push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "A" : "B"));
push(@criteria, $tinfo->{template_path});
# Group test with equal options together.
# Ending with "~" makes empty sort later than filled
my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : [];
push(@criteria, join("!", sort @{$opts}) . "~");
# Add slave opts if any
if ($tinfo->{'slave_opt'})
{
push(@criteria, join("!", sort @{$tinfo->{'slave_opt'}}));
}
# This sorts tests with force-restart *before* identical tests
push(@criteria, $tinfo->{force_restart} ? "force-restart" : "no-restart");
$sort_criteria{$tinfo->{name}} = join(" ", @criteria);
$tinfo->{criteria}= join(" ", @criteria);
}
@$cases = sort {
$sort_criteria{$a->{'name'}} . $a->{'name'} cmp
$sort_criteria{$b->{'name'}} . $b->{'name'}; } @$cases;
@$cases = sort {$a->{criteria} cmp $b->{criteria}; } @$cases;
# For debugging the sort-order
# foreach my $tinfo (@$cases)
# {
# print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n");
# my $tname= $tinfo->{name} . ' ' . $tinfo->{combination};
# my $crit= $tinfo->{criteria};
# print("$tname\n\t$crit\n");
# }
}
if (defined $print_testcases){
......
......@@ -704,22 +704,40 @@ sub run_test_server ($$$) {
next;
}
# Prefer same configuration, or just use next if --noreorder
if (!$opt_reorder or (defined $result and
$result->{template_path} eq $t->{template_path}))
{
#mtr_report("Test uses same config => good match");
# Test uses same config => good match
$next= splice(@$tests, $i, 1);
last;
}
# Second best choice is the first that does not fulfill
# any of the above conditions
if (!defined $second_best){
#mtr_report("Setting second_best to $i");
$second_best= $i;
}
# Smart allocation of next test within this thread.
if ($opt_reorder and $opt_parallel > 1 and defined $result)
{
my $wid= $result->{worker};
# Reserved for other thread, try next
next if (defined $t->{reserved} and $t->{reserved} != $wid);
if (! defined $t->{reserved})
{
# Force-restart not relevant when comparing *next* test
$t->{criteria} =~ s/force-restart$/no-restart/;
my $criteria= $t->{criteria};
# Reserve similar tests for this worker, but not too many
my $maxres= (@$tests - $i) / $opt_parallel + 1;
for (my $j= $i+1; $j <= $i + $maxres; $j++)
{
my $tt= $tests->[$j];
last unless defined $tt;
last if $tt->{criteria} ne $criteria;
$tt->{reserved}= $wid;
}
}
}
# At this point we have found next suitable test
$next= splice(@$tests, $i, 1);
last;
}
# Use second best choice if no other test has been found
......@@ -728,10 +746,12 @@ sub run_test_server ($$$) {
mtr_error("Internal error, second best too large($second_best)")
if $second_best > $#$tests;
$next= splice(@$tests, $second_best, 1);
delete $next->{reserved};
}
if ($next) {
#$next->print_test();
# We don't need this any more
delete $next->{criteria};
$next->write_test($sock, 'TESTCASE');
$running{$next->key()}= $next;
$num_ndb_tests++ if ($next->{ndb_test});
......@@ -816,6 +836,11 @@ sub run_worker ($) {
delete($test->{'comment'});
delete($test->{'logfile'});
# A sanity check. Should this happen often we need to look at it.
if (defined $test->{reserved} && $test->{reserved} != $thread_num) {
my $tres= $test->{reserved};
mtr_warning("Test reserved for w$tres picked up by w$thread_num");
}
$test->{worker} = $thread_num if $opt_parallel > 1;
run_testcase($test);
......@@ -894,7 +919,7 @@ sub command_line_setup {
'ssl|with-openssl' => \$opt_ssl,
'skip-ssl' => \$opt_skip_ssl,
'compress' => \$opt_compress,
'vs-config' => \$opt_vs_config,
'vs-config=s' => \$opt_vs_config,
# Max number of parallel threads to use
'parallel=s' => \$opt_parallel,
......@@ -4741,17 +4766,6 @@ sub server_need_restart {
}
}
# Temporary re-enable the "always restart slave" hack
# this should be removed asap, but will require that each rpl
# testcase cleanup better after itself - ie. stop and reset
# replication
# Use the "#!use-slave-opt" marker to detect that this is a "slave"
# server
if ( $server->option("#!use-slave-opt") ){
mtr_verbose_restart($server, "Always restart slave(s)");
return 1;
}
my $is_mysqld= grep ($server eq $_, mysqlds());
if ($is_mysqld)
{
......
......@@ -2040,6 +2040,20 @@ predicted_order hex(utf8_encoding)
100 E0B78AE2808DE0B6BA
101 E0B78AE2808DE0B6BB
DROP TABLE t1;
SET NAMES utf8 COLLATE utf8_sinhala_ci;
CREATE TABLE t1 (s1 VARCHAR(10) COLLATE utf8_sinhala_ci);
INSERT INTO t1 VALUES ('a'),('ae'),('af');
SELECT s1,hex(s1) FROM t1 ORDER BY s1;
s1 hex(s1)
a 61
ae 6165
af 6166
SELECT * FROM t1 ORDER BY s1;
s1
a
ae
af
DROP TABLE t1;
End of 5.4 tests
#
# Start of 5.5 tests
......
......@@ -418,6 +418,18 @@ COMMIT;
UNLOCK TABLES;
# Connection con1
# Reaping: INSERT DELAYED INTO t1 VALUES (5)
# Connection default
# Test 5: LOCK TABLES + INSERT DELAYED in one connection.
# This test has triggered some asserts in metadata locking
# subsystem at some point in time..
LOCK TABLE t1 WRITE;
INSERT DELAYED INTO t2 VALUES (7);
UNLOCK TABLES;
SET AUTOCOMMIT= 0;
LOCK TABLE t1 WRITE;
INSERT DELAYED INTO t2 VALUES (8);
UNLOCK TABLES;
SET AUTOCOMMIT= 1;
# Connection con2
# Connection con1
# Connection default
......
......@@ -133,15 +133,15 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e2;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
lock table t1 write;
show create event e1;
......@@ -151,15 +151,15 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e2;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
lock table t1 read, mysql.event read;
show create event e1;
......@@ -169,15 +169,15 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e2;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
lock table t1 write, mysql.event read;
show create event e1;
......@@ -187,15 +187,15 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e2;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
lock table t1 read, mysql.event write;
ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
......@@ -209,11 +209,17 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e3;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
drop event e1;
Make sure we have left no events
select event_name from information_schema.events;
event_name
......
......@@ -423,3 +423,31 @@ i
4
unlock tables;
drop tables tm, t1, t2;
#
# Test for bug #57006 "Deadlock between HANDLER and
# FLUSH TABLES WITH READ LOCK".
#
drop table if exists t1, t2;
create table t1 (i int);
create table t2 (i int);
handler t1 open;
# Switching to connection 'con1'.
# Sending:
flush tables with read lock;
# Switching to connection 'con2'.
# Wait until FTWRL starts waiting for 't1' to be closed.
# Switching to connection 'default'.
# The below statement should not cause deadlock.
# Sending:
insert into t2 values (1);
# Switching to connection 'con2'.
# Wait until INSERT starts to wait for FTWRL to go away.
# Switching to connection 'con1'.
# FTWRL should be able to continue now.
# Reap FTWRL.
unlock tables;
# Switching to connection 'default'.
# Reap INSERT.
handler t1 close;
# Cleanup.
drop tables t1, t2;
This diff is collapsed.
SET @old_concurrent_insert= @@global.concurrent_insert;
SET @@global.concurrent_insert= 0;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (kill_id INT);
SET DEBUG_SYNC= 'RESET';
CREATE TABLE t1 (kill_id INT) engine = InnoDB;
INSERT INTO t1 VALUES(connection_id());
# Switching to connection 'default'.
# Start transaction.
BEGIN;
INSERT INTO t1 VALUES(connection_id());
# Ensure that COMMIT will pause once it acquires protection
# against its global read lock.
SET DEBUG_SYNC='ha_commit_trans_after_acquire_commit_lock SIGNAL acquired WAIT_FOR go';
# Sending:
COMMIT;
# Switching to 'con1'.
# Wait till COMMIT acquires protection against global read
# lock and pauses.
SET DEBUG_SYNC='now WAIT_FOR acquired';
# Sending:
FLUSH TABLES WITH READ LOCK;
SELECT ((@id := kill_id) - kill_id) FROM t1;
# Switching to 'con2'.
SELECT ((@id := kill_id) - kill_id) FROM t1 LIMIT 1;
((@id := kill_id) - kill_id)
0
# Wait till FLUSH TABLES WITH READ LOCK blocks due
# to active COMMIT
# Kill connection 'con1'.
KILL CONNECTION @id;
# Switching to 'con1'.
# Try to reap FLUSH TABLES WITH READ LOCK,
# it fail due to killed statement and connection.
Got one of the listed errors
# Switching to 'con2'.
# Resume COMMIT.
SET DEBUG_SYNC='now SIGNAL go';
# Switching to 'default'.
# Reaping COMMIT.
DROP TABLE t1;
SET @@global.concurrent_insert= @old_concurrent_insert;
SET DEBUG_SYNC= 'RESET';
......@@ -607,3 +607,12 @@ SELECT floor(log10(format(concat_ws(5445796E25, 5306463, 30837), -358821)))
as foo;
foo
2
#
# Bug #58137 char(0) column cause:
# my_gcvt: Assertion `width > 0 && to != ((void *)0)' failed
#
CREATE TABLE t1(a char(0));
INSERT INTO t1 (SELECT -pi());
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
DROP TABLE t1;
......@@ -375,4 +375,10 @@ GREATEST(a, (SELECT b FROM t1 LIMIT 1))
3
1
DROP TABLE t1;
End of 5.1 tests
#
# Bug #58199: name_const in the having clause crashes
#
CREATE TABLE t1 (a INT);
SELECT 1 from t1 HAVING NAME_CONST('', a);
ERROR HY000: Incorrect arguments to NAME_CONST
DROP TABLE t1;
......@@ -1485,10 +1485,6 @@ ERROR 42S02: Table 'test.not_exists_write' doesn't exist
# We still have the read lock.
drop table t1;
ERROR HY000: Can't execute the query because you have a conflicting read lock
handler t1 read next;
a b
1 1
handler t1 close;
handler t1 open;
select a from t2;
a
......
......@@ -1481,10 +1481,6 @@ ERROR 42S02: Table 'test.not_exists_write' doesn't exist
# We still have the read lock.
drop table t1;
ERROR HY000: Can't execute the query because you have a conflicting read lock
handler t1 read next;
a b
1 1
handler t1 close;
handler t1 open;
select a from t2;
a
......
......@@ -30,6 +30,7 @@ FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
PROCESSLIST ID
......@@ -42,6 +43,7 @@ SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
TABLESPACES TABLESPACE_NAME
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
TABLE_PRIVILEGES TABLE_SCHEMA
TRIGGERS TRIGGER_SCHEMA
......@@ -74,6 +76,7 @@ FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
PROCESSLIST ID
......@@ -86,6 +89,7 @@ SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
TABLESPACES TABLESPACE_NAME
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
TABLE_PRIVILEGES TABLE_SCHEMA
TRIGGERS TRIGGER_SCHEMA
......
set @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 0;
drop table if exists t1, t2, t3;
create table t1 (kill_id int);
insert into t1 values(connection_id());
select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id)
0
kill @id;
select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id)
0
select @id != connection_id();
@id != connection_id()
SET DEBUG_SYNC = 'RESET';
DROP TABLE IF EXISTS t1, t2, t3;
DROP FUNCTION IF EXISTS MY_KILL;
CREATE FUNCTION MY_KILL(tid INT) RETURNS INT
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
KILL tid;
RETURN (SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = tid);
END|
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read';
SET DEBUG_SYNC='now WAIT_FOR con1_read';
SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
SET DEBUG_SYNC = 'RESET';
SELECT 1;
Got one of the listed errors
SELECT 1;
1
1
select 4;
SELECT @id != CONNECTION_ID();
@id != CONNECTION_ID()
1
SELECT 4;
4
4
drop table t1;
kill (select count(*) from mysql.user);
KILL (SELECT COUNT(*) FROM mysql.user);
ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
create table t1 (id int primary key);
create table t2 (id int unsigned not null);
insert into t2 select id from t1;
create table t3 (kill_id int);
insert into t3 values(connection_id());
select id from t1 where id in (select distinct a.id from t2 a, t2 b, t2 c, t2 d group by a.id, b.id, c.id, d.id having a.id between 10 and 20);
select ((@id := kill_id) - kill_id) from t3;
((@id := kill_id) - kill_id)
0
kill @id;
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill';
SET DEBUG_SYNC= 'now WAIT_FOR con1_read';
SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
SET DEBUG_SYNC = 'RESET';
SELECT 1;
Got one of the listed errors
drop table t1, t2, t3;
select get_lock("a", 10);
get_lock("a", 10)
1
select get_lock("a", 10);
get_lock("a", 10)
NULL
select 1;
1
1
select RELEASE_LOCK("a");
RELEASE_LOCK("a")
1
create table t1(f1 int);
create function bug27563() returns int(11)
deterministic
begin
declare continue handler for sqlstate '70100' set @a:= 'killed';
declare continue handler for sqlexception set @a:= 'exception';
set @a= get_lock("lock27563", 10);
return 1;
end|
select get_lock("lock27563",10);
get_lock("lock27563",10)
1
insert into t1 values (bug27563());
ERROR 70100: Query execution was interrupted
select @a;
@a
NULL
select * from t1;
SELECT 1;
1
1
SELECT @id != CONNECTION_ID();
@id != CONNECTION_ID()
1
SELECT 4;
4
4
CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT);
CREATE TABLE t2 (id INT UNSIGNED NOT NULL);
INSERT INTO t1 VALUES
(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0);
INSERT t1 SELECT 0 FROM t1 AS a1, t1 AS a2 LIMIT 4032;
INSERT INTO t2 SELECT id FROM t1;
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync';
SELECT id FROM t1 WHERE id IN
(SELECT DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d
GROUP BY ACOS(1/a.id), b.id, c.id, d.id
HAVING a.id BETWEEN 10 AND 20);
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL @id;
SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
Got one of the listed errors
SELECT 1;
1
1
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1, t2;
SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync WAIT_FOR kill';
SELECT ACOS(0);
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
ACOS(0)
1.5707963267948966
SELECT 1;
1
1
SELECT @id = CONNECTION_ID();
@id = CONNECTION_ID()
1
SET DEBUG_SYNC = 'RESET';
CREATE TABLE t1 (f1 INT);
CREATE FUNCTION bug27563() RETURNS INT(11)
DETERMINISTIC
BEGIN
DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed';
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill';
RETURN 1;
END|
INSERT INTO t1 VALUES (bug27563());
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
ERROR 70100: Query execution was interrupted
SELECT * FROM t1;
f1
insert into t1 values(0);
update t1 set f1= bug27563();
SET DEBUG_SYNC = 'RESET';
INSERT INTO t1 VALUES(0);
UPDATE t1 SET f1= bug27563();
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
ERROR 70100: Query execution was interrupted
select @a;
@a
NULL
select * from t1;
SELECT * FROM t1;
f1
0
insert into t1 values(1);
delete from t1 where bug27563() is null;
SET DEBUG_SYNC = 'RESET';
INSERT INTO t1 VALUES(1);
DELETE FROM t1 WHERE bug27563() IS NULL;
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
ERROR 70100: Query execution was interrupted
select @a;
@a
NULL
select * from t1;
SELECT * FROM t1;
f1
0
1
select * from t1 where f1= bug27563();
ERROR 70100: Query execution was interrupted
select @a;
@a
NULL
create procedure proc27563()
begin
declare continue handler for sqlstate '70100' set @a:= 'killed';
declare continue handler for sqlexception set @a:= 'exception';
select get_lock("lock27563",10);
select "shouldn't be selected";
end|
call proc27563();
get_lock("lock27563",10)
NULL
ERROR 70100: Query execution was interrupted
select @a;
@a
NULL
create table t2 (f2 int);
create trigger trg27563 before insert on t1 for each row
begin
declare continue handler for sqlstate '70100' set @a:= 'killed';
declare continue handler for sqlexception set @a:= 'exception';
set @a:= get_lock("lock27563",10);
insert into t2 values(1);
end|
insert into t1 values(2),(3);
ERROR 70100: Query execution was interrupted
select @a;
@a
NULL
select * from t1;
SET DEBUG_SYNC = 'RESET';
SELECT * FROM t1 WHERE f1= bug27563();
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
ERROR 70100: Query execution was interrupted
SELECT * FROM t1;
f1
0
1
select * from t2;
f2
select release_lock("lock27563");
release_lock("lock27563")
SET DEBUG_SYNC = 'RESET';
DROP FUNCTION bug27563;
CREATE TABLE t2 (f2 INT);
CREATE TRIGGER trg27563 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed';
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
INSERT INTO t2 VALUES(0);
SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill';
INSERT INTO t2 VALUES(1);
END|
INSERT INTO t1 VALUES(2),(3);
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
ERROR 70100: Query execution was interrupted
SELECT * FROM t1;
f1
0
1
drop table t1, t2;
drop function bug27563;
drop procedure proc27563;
SELECT * FROM t2;
f2
0
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1, t2;
SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40 WHERE a1=a2 AND a2=a3 AND a3=a4 AND a4=a5 AND a5=a6 AND a6=a7 AND a7=a8 AND a8=a9 AND a9=a10 AND a10=a11 AND a11=a12 AND a12=a13 AND a13=a14 AND a14=a15 AND a15=a16 AND a16=a17 AND a17=a18 AND a18=a19 AND a19=a20 AND a20=a21 AND a21=a22 AND a22=a23 AND a23=a24 AND a24=a25 AND a25=a26 AND a26=a27 AND a27=a28 AND a28=a29 AND a29=a30 AND a30=a31 AND a31=a32 AND a32=a33 AND a33=a34 AND a34=a35 AND a35=a36 AND a36=a37 AND a37=a38 AND a38=a39 AND a39=a40 ';
EXECUTE stmt;
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
ERROR 70100: Query execution was interrupted
SET DEBUG_SYNC = 'RESET';
#
# Bug#19723: kill of active connection yields different error code
# depending on platform.
#
# Connection: con2.
KILL CONNECTION_ID();
# CR_SERVER_LOST, CR_SERVER_GONE_ERROR, depending on the timing
# of close of the connection socket
# Connection: con1.
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
KILL @id;
ERROR 70100: Query execution was interrupted
SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
# ER_SERVER_SHUTDOWN, CR_SERVER_GONE_ERROR, CR_SERVER_LOST,
# depending on the timing of close of the connection socket
SELECT 1;
Got one of the listed errors
SELECT 1;
1
1
SELECT @id != CONNECTION_ID();
@id != CONNECTION_ID()
1
SET DEBUG_SYNC = 'RESET';
#
# Additional test for WL#3726 "DDL locking for all metadata objects"
# Check that DDL and DML statements waiting for metadata locks can
......@@ -208,13 +243,11 @@ ERROR 70100: Query execution was interrupted
# Test for DML waiting for meta-data lock
# Switching to connection 'blocker'
unlock tables;
drop table t2;
create table t2 (k int);
lock tables t1 read;
# Switching to connection 'ddl'
rename tables t1 to t3, t2 to t1;
truncate table t1;
# Switching to connection 'dml'
insert into t2 values (1);
insert into t1 values (1);
# Switching to connection 'default'
kill query ID2;
# Switching to connection 'dml'
......@@ -239,6 +272,7 @@ unlock tables;
# Switching to connection 'ddl'
# Cleanup.
# Switching to connection 'default'
drop table t3;
drop table t1;
set @@global.concurrent_insert= @old_concurrent_insert;
drop table t2;
SET DEBUG_SYNC = 'RESET';
DROP FUNCTION MY_KILL;
......@@ -2471,7 +2471,7 @@ CREATE PROCEDURE p1() SELECT 1;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
# Check that FLUSH must wait to get the GRL
# and let CREATE PROCEDURE continue
SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL grlwait';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
FLUSH TABLES WITH READ LOCK;
# Connection 1
# Connection 2
......@@ -2486,10 +2486,17 @@ DROP PROCEDURE p1;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
# Check that FLUSH must wait to get the GRL
# and let DROP PROCEDURE continue
SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL grlwait';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
FLUSH TABLES WITH READ LOCK;
# Connection 1
# Once FLUSH TABLES WITH READ LOCK starts waiting
# DROP PROCEDURE will be waked up and will drop
# procedure. Global read lock will be granted after
# this statement ends.
#
# Reaping DROP PROCEDURE.
# Connection 2
# Reaping FTWRL.
UNLOCK TABLES;
# Connection 1
SET DEBUG_SYNC= 'RESET';
......
......@@ -14,3 +14,32 @@ flush privileges;
ERROR HY000: Table 'host' was not locked with LOCK TABLES
unlock tables;
drop table t1;
#
# Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN
#
CREATE USER nopriv_user@localhost;
connection: default
DROP TABLE IF EXISTS t1,t2,t3;
DROP FUNCTION IF EXISTS f;
CREATE TABLE t1 (key1 INT PRIMARY KEY);
CREATE TABLE t2 (key2 INT);
INSERT INTO t1 VALUES (1),(2);
CREATE FUNCTION f() RETURNS INT RETURN 1;
GRANT FILE ON *.* TO 'nopriv_user'@'localhost';
FLUSH PRIVILEGES;
connection: con1
SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE 'mytest';
ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1;
ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
SELECT MAX(key1) INTO @dummy FROM t1 WHERE f() < 1;
ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
CREATE TABLE t3 (i INT) AS SELECT MAX(key1) FROM t1 WHERE f() < 1;
ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
connection: default
DROP TABLE t1,t2;
DROP FUNCTION f;
DROP USER nopriv_user@localhost;
#
# End Bug#54812
#
drop table if exists t1, t2;
#
# Bug#57778: failed primary key add to partitioned innodb table
# inconsistent and crashes
#
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL)
PARTITION BY KEY (a) PARTITIONS 2;
INSERT INTO t1 VALUES (0,1), (0,2);
ALTER TABLE t1 ADD PRIMARY KEY (a);
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 2 */
SELECT * FROM t1;
a b
0 1
0 2
UPDATE t1 SET a = 1, b = 1 WHERE a = 0 AND b = 2;
ALTER TABLE t1 ADD PRIMARY KEY (a);
SELECT * FROM t1;
a b
1 1
0 1
ALTER TABLE t1 DROP PRIMARY KEY;
SELECT * FROM t1;
a b
1 1
0 1
DROP TABLE t1;
#
# Bug#57113: ha_partition::extra(ha_extra_function):
# Assertion `m_extra_cache' failed
CREATE TABLE t1
......
......@@ -25,7 +25,7 @@ ALTER TABLE t1 REMOVE PARTITIONING;
# Con default
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_part2_before_delete_table WAIT_FOR partitioning_removed';
SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table WAIT_FOR partitioning_removed';
DROP TABLE IF EXISTS t1;
# Con 1
SET SESSION debug= "-d,sleep_before_create_table_no_lock";
......@@ -51,12 +51,12 @@ SET DEBUG_SYNC= 'alter_table_before_open_tables SIGNAL removing_partitions WAIT_
SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
ALTER TABLE t2 REMOVE PARTITIONING;
# Con default
SET SESSION debug= "+d,sleep_before_part2_delete_table";
SET SESSION debug= "+d,sleep_before_no_locks_delete_table";
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions';
SET DEBUG_SYNC= 'rm_table_part2_before_delete_table SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_part2_before_binlog SIGNAL delete_done';
SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_no_locks_before_binlog SIGNAL delete_done';
DROP TABLE IF EXISTS t2;
SET SESSION debug= "-d,sleep_before_part2_delete_table";
SET SESSION debug= "-d,sleep_before_no_locks_delete_table";
# Con 1
ERROR 42S02: Table 'test.t2' doesn't exist
SET DEBUG_SYNC= 'RESET';
......
......@@ -489,3 +489,31 @@ Warning 1265 Data truncated for column 'b' at row 1
Error 1067 Invalid default value for 'b'
SET SESSION sql_mode = @old_mode;
DROP TABLE t1;
#
# Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the
# table unusable".
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a bigint not null, b int not null, PRIMARY KEY (a))
ENGINE = InnoDB PARTITION BY KEY(a) PARTITIONS 2;
INSERT INTO t1 values (0,1), (1,2);
# The below ALTER should fail. It should leave the
# table in its original, non-corrupted, usable state.
ALTER TABLE t1 ADD UNIQUE KEY (b);
ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
# The below statements should succeed, as ALTER should
# have left table intact.
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) NOT NULL,
`b` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 2 */
SELECT * FROM t1;
a b
1 2
0 1
DROP TABLE t1;
This diff is collapsed.
......@@ -1514,3 +1514,27 @@ ALTER TABLE t1 CHARACTER SET = utf8;
COMMIT;
DROP TRIGGER t1_bi;
DROP TABLE t1;
#
# Bug#57306 SHOW PROCESSLIST does not display string literals well.
#
SET NAMES latin1;
SELECT GET_LOCK('t', 1000);
GET_LOCK('t', 1000)
1
SET NAMES latin1;
SELECT GET_LOCK('t',1000) AS 'óóóó';;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
### root ### test Query ### ### SHOW PROCESSLIST
### root ### test Query ### ### SELECT GET_LOCK('t',1000) AS 'óóóó'
SET NAMES utf8;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
### root ### test Query ### ### SHOW PROCESSLIST
### root ### test Query ### ### SELECT GET_LOCK('t',1000) AS 'óóóó'
SELECT RELEASE_LOCK('t');
RELEASE_LOCK('t')
1
óóóó
1
SET NAMES latin1;
......@@ -75,4 +75,40 @@ CALL p1 ();
ERROR HY000: Trigger does not exist
DROP TABLE t1;
DROP PROCEDURE p1;
#
# Bug#54375: Error in stored procedure leaves connection
# in different default schema
#
SET @@SQL_MODE = 'STRICT_ALL_TABLES';
DROP DATABASE IF EXISTS db1;
CREATE DATABASE db1;
USE db1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY);
INSERT INTO t1 VALUES (1);
CREATE FUNCTION f1 (
some_value int
)
RETURNS smallint
DETERMINISTIC
BEGIN
INSERT INTO t1 SET c1 = some_value;
RETURN(LAST_INSERT_ID());
END$$
DROP DATABASE IF EXISTS db2;
CREATE DATABASE db2;
USE db2;
SELECT DATABASE();
DATABASE()
db2
SELECT db1.f1(1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SELECT DATABASE();
DATABASE()
db2
USE test;
DROP FUNCTION db1.f1;
DROP TABLE db1.t1;
DROP DATABASE db1;
DROP DATABASE db2;
End of 5.1 tests
......@@ -735,5 +735,96 @@ END latin1 latin1_swedish_ci latin1_swedish_ci
# Connection default;
DROP PROCEDURE p1;
#
# Bug#57663 Concurrent statement using stored function and DROP DATABASE
# breaks SBR
#
DROP DATABASE IF EXISTS db1;
DROP FUNCTION IF EXISTS f1;
# Test 1: Check that DROP DATABASE block if a function is used
# by an active transaction.
# Connection default
CREATE DATABASE db1;
CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
START TRANSACTION;
SELECT db1.f1();
db1.f1()
1
# Connection con1
# Sending:
DROP DATABASE db1;
# Connection default
# Waiting for DROP DATABASE to be blocked by the lock on f1()
COMMIT;
# Connection con1
# Reaping: DROP DATABASE db1
# Test 2: Check that DROP DATABASE blocks if a procedure is
# used by an active transaction.
# Connection default
CREATE DATABASE db1;
CREATE PROCEDURE db1.p1() BEGIN END;
CREATE FUNCTION f1() RETURNS INTEGER
BEGIN
CALL db1.p1();
RETURN 1;
END|
START TRANSACTION;
SELECT f1();
f1()
1
# Connection con1
# Sending:
DROP DATABASE db1;
# Connection default
# Waiting for DROP DATABASE to be blocked by the lock on p1()
COMMIT;
# Connection con1
# Reaping: DROP DATABASE db1
# Test 3: Check that DROP DATABASE is not selected as a victim if a
# deadlock is discovered with DML statements.
# Connection default
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT);
CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
START TRANSACTION;
SELECT db1.f1();
db1.f1()
1
# Connection con1
# Sending:
DROP DATABASE db1;
# Connection default
# Waiting for DROP DATABASE to be blocked by the lock on f1()
SELECT * FROM db1.t1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
# Connection con1
# Reaping: DROP DATABASE db1
# Test 4: Check that active DROP DATABASE blocks stored routine DDL.
# Connection default
CREATE DATABASE db1;
CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
CREATE FUNCTION db1.f2() RETURNS INTEGER RETURN 2;
START TRANSACTION;
SELECT db1.f2();
db1.f2()
2
# Connection con1
# Sending:
DROP DATABASE db1;
# Connection con2
# Waiting for DROP DATABASE to be blocked by the lock on f2()
# Sending:
ALTER FUNCTION db1.f1 COMMENT "test";
# Connection default
# Waiting for ALTER FUNCTION to be blocked by the schema lock on db1
COMMIT;
# Connection con1
# Reaping: DROP DATABASE db1
# Connection con2
# Reaping: ALTER FUNCTION f1 COMMENT 'test'
ERROR 42000: FUNCTION db1.f1 does not exist
# Connection default
DROP FUNCTION f1;
#
# End of 5.5 tests
#
......@@ -5005,3 +5005,15 @@ SELECT * FROM t2 UNION SELECT * FROM t2
ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
DROP TABLE t1,t2;
End of 5.1 tests
#
# Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool):
# Assertion `file' failed.
#
CREATE TABLE t1 (a INT);
SELECT 1 FROM
(SELECT ROW(
(SELECT 1 FROM t1 RIGHT JOIN
(SELECT 1 FROM t1, t1 t2) AS d ON 1),
1) FROM t1) AS e;
ERROR 21000: Operand should contain 1 column(s)
DROP TABLE t1;
SET SESSION transaction_prealloc_size=1024*1024*1024*1;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*2;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*3;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*4;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*5;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
......@@ -1093,4 +1093,11 @@ Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
DROP TABLE t1;
#
# Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0
#
SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1);
ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1));
ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
End of 5.1 tests
--max_binlog_size=4096 --default-storage-engine=MyISAM
--force-restart
# Check for IBM i 6.1 or later
--disable_query_log
system uname -rv > $MYSQLTEST_VARDIR/tmp/version;
--disable_warnings
drop table if exists uname_vr;
--enable_warnings
create temporary table uname_vr (r int, v int);
--disable_warnings
eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/version" into table uname_vr fields terminated by ' ';
--enable_warnings
let $ok = `select count(*) from uname_vr where v = 5 and r = 4`;
drop table uname_vr;
remove_file $MYSQLTEST_VARDIR/tmp/version;
--enable_query_log
if (!$ok)
{
skip "Need IBM i 5.4 or later";
}
# Check for IBM i 6.1 or later
--disable_query_log
system uname -rv > $MYSQLTEST_VARDIR/tmp/version;
--disable_warnings
drop table if exists uname_vr;
--enable_warnings
create temporary table uname_vr (r int, v int);
--disable_warnings
eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/version" into table uname_vr fields terminated by ' ';
--enable_warnings
let $ok = `select count(*) from uname_vr where v > 5`;
drop table uname_vr;
remove_file $MYSQLTEST_VARDIR/tmp/version;
--enable_query_log
if (!$ok)
{
skip "Need IBM i 6.1 or later";
}
if (!`SELECT count(*) FROM information_schema.engines WHERE
(support = 'YES' OR support = 'DEFAULT') AND
engine = 'ibmdb2i'`)
{
skip Need ibmdb2i engine;
}
create schema `A12345_@$#`;
create table `A12345_@$#`.t1 (i int) engine=ibmdb2i;
show create table `A12345_@$#`.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=IBMDB2I DEFAULT CHARSET=latin1
select * from `A12345_@$#`.t1;
i
drop table `A12345_@$#`.t1;
drop schema `A12345_@$#`;
create table t1 (c char(10) collate utf8_swedish_ci, index(c)) engine=ibmdb2i;
drop table t1;
create table t1 (c char(10) collate ucs2_swedish_ci, index(c)) engine=ibmdb2i;
drop table t1;
create table t1 (c char(1) character set armscii8) engine=ibmdb2i;
ERROR HY000: Can't create table 'test.t1' (errno: 2504)
create table t1 (c char(1) character set eucjpms ) engine=ibmdb2i;
ERROR HY000: Can't create table 'test.t1' (errno: 2504)
create table ABC (i int) engine=ibmdb2i;
drop table ABC;
create table `1234567890ABC` (i int) engine=ibmdb2i;
drop table `1234567890ABC`;
create table `!@#$%` (i int) engine=ibmdb2i;
drop table `!@#$%`;
create table `ABCD#########` (i int) engine=ibmdb2i;
drop table `ABCD#########`;
create table `_` (i int) engine=ibmdb2i;
drop table `_`;
create table `abc##def` (i int) engine=ibmdb2i;
drop table `abc##def`;
set names utf8;
create table İ (s1 int) engine=ibmdb2i;
drop table İ;
create table İİ (s1 int) engine=ibmdb2i;
drop table İİ;
set names latin1;
drop table if exists t1;
create table t1 (c char(10), index(c)) collate ucs2_czech_ci engine=ibmdb2i;
insert into t1 values ("ch"),("h"),("i");
select * from t1 order by c;
c
h
ch
i
drop table t1;
create table t1 (c char(10), index(c)) collate utf8_czech_ci engine=ibmdb2i;
insert into t1 values ("ch"),("h"),("i");
select * from t1 order by c;
c
h
ch
i
drop table t1;
create table t1 (c char(10), index(c)) collate ucs2_danish_ci engine=ibmdb2i;
insert into t1 values("abc"),("abcd"),("aaaa");
select c from t1 order by c;
c
abc
abcd
aaaa
drop table t1;
create table t1 (c char(10), index(c)) collate utf8_danish_ci engine=ibmdb2i;
insert into t1 values("abc"),("abcd"),("aaaa");
select c from t1 order by c;
c
abc
abcd
aaaa
drop table t1;
drop table if exists t1;
create table t1 (c char(10), index(c)) charset macce engine=ibmdb2i;
insert into t1 values ("test");
select * from t1 order by c;
c
test
drop table t1;
set ibmdb2i_create_index_option=1;
drop schema if exists test1;
create schema test1;
use test1;
CREATE TABLE t1 (f int primary key, index(f)) engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (f char(10) collate utf8_bin primary key, index(f)) engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, index(f)) engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, i int, index i(i,f)) engine=ibmdb2i;
drop table t1;
create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
select * from fd;
SQSSEQ
*HEX
*HEX
*HEX
*HEX
drop table fd;
create table ABC (i int) engine=ibmdb2i;
insert into ABC values(1);
create table abc (i int) engine=ibmdb2i;
insert into abc values (2);
select * from ABC;
i
1
drop table ABC;
drop table abc;
This diff is collapsed.
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source include/have_case_sensitive_file_system.inc;
create schema `A12345_@$#`;
create table `A12345_@$#`.t1 (i int) engine=ibmdb2i;
show create table `A12345_@$#`.t1;
select * from `A12345_@$#`.t1;
drop table `A12345_@$#`.t1;
drop schema `A12345_@$#`;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source suite/ibmdb2i/include/have_i61.inc;
create table t1 (c char(10) collate utf8_swedish_ci, index(c)) engine=ibmdb2i;
drop table t1;
create table t1 (c char(10) collate ucs2_swedish_ci, index(c)) engine=ibmdb2i;
drop table t1;
--source suite/ibmdb2i/include/have_ibmdb2i.inc
--source suite/ibmdb2i/include/have_i54.inc
--error 1005
create table t1 (c char(1) character set armscii8) engine=ibmdb2i;
--error 1005
create table t1 (c char(1) character set eucjpms ) engine=ibmdb2i;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
# Test RCDFMT generation for a variety of kinds of table names
create table ABC (i int) engine=ibmdb2i;
drop table ABC;
create table `1234567890ABC` (i int) engine=ibmdb2i;
drop table `1234567890ABC`;
create table `!@#$%` (i int) engine=ibmdb2i;
drop table `!@#$%`;
create table `ABCD#########` (i int) engine=ibmdb2i;
drop table `ABCD#########`;
create table `_` (i int) engine=ibmdb2i;
drop table `_`;
create table `abc##def` (i int) engine=ibmdb2i;
drop table `abc##def`;
set names utf8;
create table İ (s1 int) engine=ibmdb2i;
drop table İ;
create table İİ (s1 int) engine=ibmdb2i;
drop table İİ;
set names latin1;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source suite/ibmdb2i/include/have_i61.inc;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (c char(10), index(c)) collate ucs2_czech_ci engine=ibmdb2i;
insert into t1 values ("ch"),("h"),("i");
select * from t1 order by c;
drop table t1;
create table t1 (c char(10), index(c)) collate utf8_czech_ci engine=ibmdb2i;
insert into t1 values ("ch"),("h"),("i");
select * from t1 order by c;
drop table t1;
create table t1 (c char(10), index(c)) collate ucs2_danish_ci engine=ibmdb2i;
insert into t1 values("abc"),("abcd"),("aaaa");
select c from t1 order by c;
drop table t1;
create table t1 (c char(10), index(c)) collate utf8_danish_ci engine=ibmdb2i;
insert into t1 values("abc"),("abcd"),("aaaa");
select c from t1 order by c;
drop table t1;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source suite/ibmdb2i/include/have_i61.inc;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (c char(10), index(c)) charset macce engine=ibmdb2i;
insert into t1 values ("test");
select * from t1 order by c;
drop table t1;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
# Confirm that ibmdb2i_create_index_option causes additional *HEX sorted indexes to be created for all non-binary keys.
set ibmdb2i_create_index_option=1;
--disable_warnings
drop schema if exists test1;
create schema test1;
use test1;
--enable_warnings
--disable_abort_on_error
--error 0,255
exec system "DLTF QGPL/FDOUT" > /dev/null;
--enable_abort_on_error
#No additional index because no string fields in key
CREATE TABLE t1 (f int primary key, index(f)) engine=ibmdb2i;
--error 255
exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
--error 255
exec system "DSPFD FILE(\"test1\"/\"f___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
drop table t1;
#No additional index because binary sorting
CREATE TABLE t1 (f char(10) collate utf8_bin primary key, index(f)) engine=ibmdb2i;
--error 255
exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
--error 255
exec system "DSPFD FILE(\"test1\"/\"f___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
drop table t1;
CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, index(f)) engine=ibmdb2i;
exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
exec system "DSPFD FILE(\"test1\"/\"f___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
drop table t1;
CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, i int, index i(i,f)) engine=ibmdb2i;
exec system "DSPFD FILE(\"test1\"/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
exec system "DSPFD FILE(\"test1\"/\"i___H_t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
drop table t1;
create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
system system "CPYF FROMFILE(QGPL/FDOUT) TOFILE(\"test1\"/\"fd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null;
select * from fd;
drop table fd;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source include/have_case_sensitive_file_system.inc;
create table ABC (i int) engine=ibmdb2i;
insert into ABC values(1);
create table abc (i int) engine=ibmdb2i;
insert into abc values (2);
select * from ABC;
drop table ABC;
drop table abc;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source suite/ibmdb2i/include/have_i61.inc;
--disable_warnings
drop table if exists t1, ffd, fd;
--enable_warnings
--disable_abort_on_error
--error 0,255
exec system "DLTF QGPL/FFDOUT" > /dev/null;
--error 0,255
exec system "DLTF QGPL/FDOUT" > /dev/null;
--enable_abort_on_error
let $count= query_get_value(select count(*) from information_schema.COLLATIONS where COLLATION_NAME <> "binary", count(*),1);
while ($count)
{
let $collation = query_get_value(select COLLATION_NAME from information_schema.COLLATIONS where COLLATION_NAME <> "binary" order by COLLATION_NAME desc, COLLATION_NAME, $count);
error 0,1005,2504,2028;
eval CREATE TABLE t1 ($collation integer, c char(10), v varchar(20), index(c), index(v)) collate $collation engine=ibmdb2i;
if (!$mysql_errno)
{
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
explain select c,v from t1 force index(v) where v like "de%";
drop table t1;
eval create table t1 ($collation char(10) primary key) collate $collation engine=ibmdb2i;
system system "DSPFFD FILE(\"test\"/\"t1\") OUTPUT(*OUTFILE) OUTFILE(QGPL/FFDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
system system "DSPFD FILE(\"test\"/\"t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
drop table t1;
}
dec $count;
}
create table ffd (WHCHD1 CHAR(20), WHCSID decimal(5,0)) engine=ibmdb2i;
system system "CPYF FROMFILE(QGPL/FFDOUT) TOFILE(\"test\"/\"ffd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null;
create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
system system "CPYF FROMFILE(QGPL/FDOUT) TOFILE(\"test\"/\"fd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null;
create temporary table intermed (row integer key auto_increment, cs char(30), ccsid integer);
insert into intermed (cs, ccsid) select * from ffd;
create temporary table intermed2 (row integer key auto_increment, srtseq char(10));
insert into intermed2 (srtseq) select * from fd;
select ccsid, cs, srtseq from intermed inner join intermed2 on intermed.row = intermed2.row;
drop table ffd, fd;
......@@ -105,6 +105,30 @@ OPTIMIZE TABLE t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
if (!$skip_update)
{
eval CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE=$engine;
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
DROP TABLE t1;
SET INSERT_ID = 1;
}
-- echo # Simple test with NULL
eval CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
......@@ -831,5 +855,30 @@ SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
if (!$skip_update)
{
eval CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE=$engine
PARTITION BY KEY(a) PARTITIONS 2;
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
DROP TABLE t1;
}
--echo ##############################################################################
}
......@@ -120,6 +120,38 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='Blackhole';
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
DROP TABLE t1;
SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
......
......@@ -136,6 +136,42 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='InnoDB';
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
1
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
DROP TABLE t1;
SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
......@@ -1023,4 +1059,40 @@ c1 c2
2 20
127 40
DROP TABLE t;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='InnoDB'
PARTITION BY KEY(a) PARTITIONS 2;
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
1
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
DROP TABLE t1;
##############################################################################
......@@ -136,6 +136,42 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='Memory';
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
1
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
DROP TABLE t1;
SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
......@@ -1051,4 +1087,40 @@ c1 c2
2 20
127 40
DROP TABLE t;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='Memory'
PARTITION BY KEY(a) PARTITIONS 2;
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
1
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
DROP TABLE t1;
##############################################################################
......@@ -136,6 +136,42 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='MyISAM';
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
1
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
DROP TABLE t1;
SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
......@@ -1070,4 +1106,40 @@ c1 c2
2 20
127 40
DROP TABLE t;
CREATE TABLE t1
(a INT NULL AUTO_INCREMENT,
UNIQUE KEY (a))
ENGINE='MyISAM'
PARTITION BY KEY(a) PARTITIONS 2;
SET LAST_INSERT_ID = 999;
SET INSERT_ID = 0;
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
1
INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = 1 WHERE a IS NULL;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
UPDATE t1 SET a = NULL WHERE a = 1;
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
999
SELECT * FROM t1;
a
0
DROP TABLE t1;
##############################################################################
......@@ -17,12 +17,12 @@
RESET MASTER;
select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
select count(*) > 0 from performance_schema.setup_instruments;
update performance_schema.SETUP_INSTRUMENTS set enabled='NO'
update performance_schema.setup_instruments set enabled='NO'
where name like "wait/synch/rwlock/%";
select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT;
select count(*) > 0 from performance_schema.events_waits_current;
--disable_warnings
drop table if exists test.t1;
......@@ -33,16 +33,16 @@ create table test.t1 (thread_id integer);
create table test.t2 (name varchar(128));
insert into test.t1
select thread_id from performance_schema.EVENTS_WAITS_CURRENT;
select thread_id from performance_schema.events_waits_current;
insert into test.t2
select name from performance_schema.SETUP_INSTRUMENTS
select name from performance_schema.setup_instruments
where name like "wait/synch/rwlock/%";
drop table test.t1;
drop table test.t2;
update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
update performance_schema.setup_instruments set enabled='YES'
where name like "wait/synch/rwlock/%";
--source include/show_binlog_events.inc
......
......@@ -15,7 +15,7 @@
# Tests for PERFORMANCE_SCHEMA
update performance_schema.SETUP_INSTRUMENTS set enabled='YES';
update performance_schema.setup_instruments set enabled='YES';
disconnect con1;
disconnect con2;
......
......@@ -32,48 +32,48 @@ drop table if exists test.t1;
## drop table performance_schema.t1;
##
## --error ER_DBACCESS_DENIED_ERROR
## create table performance_schema.SETUP_INSTRUMENTS(a int);
## create table performance_schema.setup_instruments(a int);
##
## --error ER_DBACCESS_DENIED_ERROR
## create table performance_schema.EVENTS_WAITS_CURRENT(a int);
## create table performance_schema.events_waits_current(a int);
##
## --error ER_DBACCESS_DENIED_ERROR
## create table performance_schema.FILE_INSTANCES(a int);
## create table performance_schema.file_instances(a int);
##
## --error ER_DBACCESS_DENIED_ERROR
## drop table performance_schema.SETUP_INSTRUMENTS;
## drop table performance_schema.setup_instruments;
##
## --error ER_DBACCESS_DENIED_ERROR
## drop table performance_schema.EVENTS_WAITS_CURRENT;
## drop table performance_schema.events_waits_current;
##
## --error ER_DBACCESS_DENIED_ERROR
## drop table performance_schema.FILE_INSTANCES;
## drop table performance_schema.file_instances;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.SETUP_INSTRUMENTS to test.t1;
rename table performance_schema.setup_instruments to test.t1;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.EVENTS_WAITS_CURRENT to test.t1;
rename table performance_schema.events_waits_current to test.t1;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.FILE_INSTANCES to test.t1;
rename table performance_schema.file_instances to test.t1;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.SETUP_INSTRUMENTS to performance_schema.t1;
rename table performance_schema.setup_instruments to performance_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.EVENTS_WAITS_CURRENT to performance_schema.t1;
rename table performance_schema.events_waits_current to performance_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.FILE_INSTANCES to performance_schema.t1;
rename table performance_schema.file_instances to performance_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.SETUP_INSTRUMENTS
to performance_schema.EVENTS_WAITS_CURRENT;
rename table performance_schema.setup_instruments
to performance_schema.events_waits_current;
--error ER_DBACCESS_DENIED_ERROR
rename table performance_schema.EVENTS_WAITS_CURRENT
to performance_schema.SETUP_INSTRUMENTS;
rename table performance_schema.events_waits_current
to performance_schema.setup_instruments;
--error ER_DBACCESS_DENIED_ERROR
create procedure performance_schema.my_proc() begin end;
......@@ -87,108 +87,93 @@ do begin end;
--error ER_DBACCESS_DENIED_ERROR
create trigger performance_schema.bi_setup_instruments
before insert on performance_schema.SETUP_INSTRUMENTS
before insert on performance_schema.setup_instruments
for each row begin end;
--error ER_DBACCESS_DENIED_ERROR
create trigger performance_schema.bi_events_waits_current
before insert on performance_schema.EVENTS_WAITS_CURRENT
before insert on performance_schema.events_waits_current
for each row begin end;
--error ER_DBACCESS_DENIED_ERROR
create trigger performance_schema.bi_file_instances
before insert on performance_schema.FILE_INSTANCES
before insert on performance_schema.file_instances
for each row begin end;
--error ER_WRONG_PERFSCHEMA_USAGE
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
--error ER_WRONG_PERFSCHEMA_USAGE
create table test.t1 like performance_schema.SETUP_INSTRUMENTS;
create table test.t1 like performance_schema.setup_instruments;
--error ER_WRONG_PERFSCHEMA_USAGE
create table test.t1 like performance_schema.EVENTS_WAITS_CURRENT;
create table test.t1 like performance_schema.events_waits_current;
--error ER_WRONG_PERFSCHEMA_USAGE
create table test.t1 like performance_schema.FILE_INSTANCES;
create table test.t1 like performance_schema.file_instances;
--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
insert into performance_schema.SETUP_INSTRUMENTS
insert into performance_schema.setup_instruments
set name="foo";
--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
insert into performance_schema.EVENTS_WAITS_CURRENT
insert into performance_schema.events_waits_current
set name="foo";
--replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
insert into performance_schema.FILE_INSTANCES
insert into performance_schema.file_instances
set name="foo";
--replace_result '\'setup_instruments' '\'SETUP_INSTRUMENTS'
--error ER_TABLEACCESS_DENIED_ERROR
delete from performance_schema.SETUP_INSTRUMENTS;
delete from performance_schema.setup_instruments;
--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
delete from performance_schema.EVENTS_WAITS_CURRENT;
delete from performance_schema.events_waits_current;
--replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
delete from performance_schema.FILE_INSTANCES;
delete from performance_schema.file_instances;
lock table performance_schema.SETUP_INSTRUMENTS read;
lock table performance_schema.setup_instruments read;
unlock tables;
lock table performance_schema.SETUP_INSTRUMENTS write;
lock table performance_schema.setup_instruments write;
unlock tables;
--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
lock table performance_schema.EVENTS_WAITS_CURRENT read;
lock table performance_schema.events_waits_current read;
unlock tables;
--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
--error ER_TABLEACCESS_DENIED_ERROR
lock table performance_schema.EVENTS_WAITS_CURRENT write;
lock table performance_schema.events_waits_current write;
unlock tables;
--replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
lock table performance_schema.FILE_INSTANCES read;
lock table performance_schema.file_instances read;
unlock tables;
--replace_result '\'file_instances' '\'FILE_INSTANCES'
--error ER_TABLEACCESS_DENIED_ERROR
lock table performance_schema.FILE_INSTANCES write;
lock table performance_schema.file_instances write;
unlock tables;
--echo #
--echo # WL#4818, NFS2: Can use grants to give normal user access
--echo # to view data from _CURRENT and _HISTORY tables
--echo # to view data from _current and _history tables
--echo #
--echo # Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3.
--echo # (Except for EVENTS_WAITS_CURRENT, which is granted.)
--echo # (Except for events_waits_current, which is granted.)
# Errors here will be caught by the diff afterwards
--disable_abort_on_error
--replace_result '\'events_waits_history' '\'EVENTS_WAITS_HISTORY'
SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY LIMIT 1;
SELECT "can select" FROM performance_schema.events_waits_history LIMIT 1;
--replace_result '\'events_waits_history_long' '\'EVENTS_WAITS_HISTORY_LONG'
SELECT "can select" FROM performance_schema.EVENTS_WAITS_HISTORY_LONG LIMIT 1;
SELECT "can select" FROM performance_schema.events_waits_history_long LIMIT 1;
--replace_result '\'events_waits_current' '\'EVENTS_WAITS_CURRENT'
SELECT "can select" FROM performance_schema.EVENTS_WAITS_CURRENT LIMIT 1;
SELECT "can select" FROM performance_schema.events_waits_current LIMIT 1;
--replace_result '\'events_waits_summary_by_instance' '\'EVENTS_WAITS_SUMMARY_BY_INSTANCE'
SELECT "can select" FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE LIMIT 1;
SELECT "can select" FROM performance_schema.events_waits_summary_by_instance LIMIT 1;
--replace_result '\'file_summary_by_instance' '\'FILE_SUMMARY_BY_INSTANCE'
SELECT "can select" FROM performance_schema.FILE_SUMMARY_BY_INSTANCE LIMIT 1;
SELECT "can select" FROM performance_schema.file_summary_by_instance LIMIT 1;
--enable_abort_on_error
......@@ -19,23 +19,23 @@ let $MYSQLD_DATADIR= `select @@datadir`;
let $MYSQLD_TMPDIR= `select @@tmpdir`;
--disable_query_log
update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
update performance_schema.SETUP_CONSUMERS set enabled='YES';
update performance_schema.setup_instruments set enabled='NO';
update performance_schema.setup_consumers set enabled='YES';
--enable_query_log
connect (con1, localhost, root, , );
let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
let $con1_THREAD_ID=`select thread_id from performance_schema.threads
where PROCESSLIST_ID = connection_id()`;
connect (con2, localhost, root, , );
let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
let $con2_THREAD_ID=`select thread_id from performance_schema.threads
where PROCESSLIST_ID = connection_id()`;
connect (con3, localhost, root, , );
let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
let $con3_THREAD_ID=`select thread_id from performance_schema.threads
where PROCESSLIST_ID = connection_id()`;
connection default;
......@@ -45,10 +45,10 @@ prepare stmt_dump_events from
"select event_name,
left(source, locate(\":\", source)) as short_source,
operation, number_of_bytes
from performance_schema.EVENTS_WAITS_HISTORY_LONG
from performance_schema.events_waits_history_long
where thread_id=? order by event_id;";
prepare stmt_dump_thread from
"select name from performance_schema.THREADS where thread_id=? ;";
"select name from performance_schema.threads where thread_id=? ;";
--enable_query_log
......@@ -17,31 +17,31 @@
show databases;
select count(*) from performance_schema.PERFORMANCE_TIMERS;
select count(*) from performance_schema.SETUP_CONSUMERS;
select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
select count(*) from performance_schema.SETUP_TIMERS;
select count(*) from performance_schema.performance_timers;
select count(*) from performance_schema.setup_consumers;
select count(*) > 0 from performance_schema.setup_instruments;
select count(*) from performance_schema.setup_timers;
# Make sure we don't crash, no matter what the starting parameters are
--disable_result_log
select * from performance_schema.COND_INSTANCES;
select * from performance_schema.EVENTS_WAITS_CURRENT;
select * from performance_schema.EVENTS_WAITS_HISTORY;
select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
select * from performance_schema.FILE_INSTANCES;
select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
select * from performance_schema.MUTEX_INSTANCES;
select * from performance_schema.PERFORMANCE_TIMERS;
select * from performance_schema.RWLOCK_INSTANCES;
select * from performance_schema.SETUP_CONSUMERS;
select * from performance_schema.SETUP_INSTRUMENTS;
select * from performance_schema.SETUP_TIMERS;
select * from performance_schema.THREADS;
select * from performance_schema.cond_instances;
select * from performance_schema.events_waits_current;
select * from performance_schema.events_waits_history;
select * from performance_schema.events_waits_history_long;
select * from performance_schema.events_waits_summary_by_instance;
select * from performance_schema.events_waits_summary_by_thread_by_event_name;
select * from performance_schema.events_waits_summary_global_by_event_name;
select * from performance_schema.file_instances;
select * from performance_schema.file_summary_by_event_name;
select * from performance_schema.file_summary_by_instance;
select * from performance_schema.mutex_instances;
select * from performance_schema.performance_timers;
select * from performance_schema.rwlock_instances;
select * from performance_schema.setup_consumers;
select * from performance_schema.setup_instruments;
select * from performance_schema.setup_timers;
select * from performance_schema.threads;
--enable_result_log
# This has a stable output, printing the result:
......
set binlog_format=mixed;
RESET MASTER;
select count(*) > 0 from performance_schema.SETUP_INSTRUMENTS;
select count(*) > 0 from performance_schema.setup_instruments;
count(*) > 0
1
update performance_schema.SETUP_INSTRUMENTS set enabled='NO'
update performance_schema.setup_instruments set enabled='NO'
where name like "wait/synch/rwlock/%";
select count(*) > 0 from performance_schema.EVENTS_WAITS_CURRENT;
select count(*) > 0 from performance_schema.events_waits_current;
count(*) > 0
1
drop table if exists test.t1;
......@@ -13,18 +13,18 @@ drop table if exists test.t2;
create table test.t1 (thread_id integer);
create table test.t2 (name varchar(128));
insert into test.t1
select thread_id from performance_schema.EVENTS_WAITS_CURRENT;
select thread_id from performance_schema.events_waits_current;
insert into test.t2
select name from performance_schema.SETUP_INSTRUMENTS
select name from performance_schema.setup_instruments
where name like "wait/synch/rwlock/%";
drop table test.t1;
drop table test.t2;
update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
update performance_schema.setup_instruments set enabled='YES'
where name like "wait/synch/rwlock/%";
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: # (performance_schema.SETUP_INSTRUMENTS)
master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments)
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
......@@ -43,7 +43,7 @@ master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (performance_schema.SETUP_INSTRUMENTS)
master-bin.000001 # Table_map # # table_id: # (performance_schema.setup_instruments)
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
alter table performance_schema.COND_INSTANCES add column foo integer;
alter table performance_schema.cond_instances add column foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
truncate table performance_schema.COND_INSTANCES;
truncate table performance_schema.cond_instances;
ERROR HY000: Invalid performance_schema usage.
ALTER TABLE performance_schema.COND_INSTANCES ADD INDEX test_index(NAME);
ALTER TABLE performance_schema.cond_instances ADD INDEX test_index(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
CREATE UNIQUE INDEX test_index ON performance_schema.COND_INSTANCES(NAME);
CREATE UNIQUE INDEX test_index ON performance_schema.cond_instances(NAME);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment