mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
Auto-merge from mysql-trunk-bugfixing.
This commit is contained in:
commit
ae715642f4
72 changed files with 1261 additions and 1400 deletions
|
@ -111,7 +111,7 @@ ENDIF()
|
|||
|
||||
# Clear cached variables if install layout was changed
|
||||
IF(OLD_INSTALL_LAYOUT)
|
||||
IF(NOT OLD_INSTALL_LAYOUT STREQUAL INSTALL_LAYOUR)
|
||||
IF(NOT OLD_INSTALL_LAYOUT STREQUAL INSTALL_LAYOUT)
|
||||
SET(FORCE FORCE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
|
|
@ -43,27 +43,26 @@ ENDMACRO()
|
|||
# Install symbolic link to CMake target.
|
||||
# the link is created in the same directory as target
|
||||
# and extension will be the same as for target file.
|
||||
MACRO(INSTALL_SYMLINK linkbasename target destination)
|
||||
MACRO(INSTALL_SYMLINK linkname target destination)
|
||||
IF(UNIX)
|
||||
GET_TARGET_PROPERTY(location ${target} LOCATION)
|
||||
GET_FILENAME_COMPONENT(path ${location} PATH)
|
||||
GET_FILENAME_COMPONENT(name_we ${location} NAME_WE)
|
||||
GET_FILENAME_COMPONENT(ext ${location} EXT)
|
||||
SET(output ${path}/${linkbasename}${ext})
|
||||
GET_FILENAME_COMPONENT(name ${location} NAME)
|
||||
SET(output ${path}/${linkname})
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${output}
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${output}
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
|
||||
${name_we}${ext}
|
||||
${linkbasename}${ext}
|
||||
${name}
|
||||
${linkname}
|
||||
WORKING_DIRECTORY ${path}
|
||||
DEPENDS ${target}
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(symlink_${linkbasename}${ext}
|
||||
ADD_CUSTOM_TARGET(symlink_${linkname}
|
||||
ALL
|
||||
DEPENDS ${output})
|
||||
SET_TARGET_PROPERTIES(symlink_${linkbasename}${ext} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
SET_TARGET_PROPERTIES(symlink_${linkname} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
IF(CMAKE_GENERATOR MATCHES "Xcode")
|
||||
# For Xcode, replace project config with install config
|
||||
STRING(REPLACE "${CMAKE_CFG_INTDIR}"
|
||||
|
|
|
@ -384,7 +384,7 @@ static CODE_STATE *code_state(void)
|
|||
if (!init_done)
|
||||
{
|
||||
init_done=TRUE;
|
||||
pthread_mutex_init(&THR_LOCK_dbug,MY_MUTEX_INIT_FAST);
|
||||
pthread_mutex_init(&THR_LOCK_dbug, NULL);
|
||||
bzero(&init_settings, sizeof(init_settings));
|
||||
init_settings.out_file=stderr;
|
||||
init_settings.flags=OPEN_APPEND;
|
||||
|
|
|
@ -153,15 +153,26 @@ SET(LIBS clientlib dbug strings vio mysys ${ZLIB_LIBRARY} ${SSL_LIBRARIES})
|
|||
# Merge several convenience libraries into one big mysqlclient
|
||||
# and link them together into shared library.
|
||||
MERGE_LIBRARIES(mysqlclient STATIC ${LIBS})
|
||||
IF(UNIX)
|
||||
INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r mysqlclient ${INSTALL_LIBDIR})
|
||||
ENDIF()
|
||||
|
||||
# Visual Studio users need debug static library for debug projects
|
||||
IF(MSVC)
|
||||
INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/debug)
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
MACRO(GET_VERSIONED_LIBNAME LIBNAME EXTENSION VERSION OUTNAME)
|
||||
SET(DOT_VERSION ".${VERSION}")
|
||||
IF(DOT_VERSION STREQUAL ".")
|
||||
SET(DOT_VERSION "")
|
||||
ENDIF()
|
||||
IF(APPLE)
|
||||
SET(${OUTNAME} ${LIBNAME}${DOT_VERSION}${EXTENSION})
|
||||
ELSE()
|
||||
SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT DISABLE_SHARED)
|
||||
MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS})
|
||||
IF(UNIX)
|
||||
|
@ -182,6 +193,16 @@ IF(NOT DISABLE_SHARED)
|
|||
#(mysqlclient in this case)
|
||||
SET_TARGET_PROPERTIES(mysqlclient PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
SET_TARGET_PROPERTIES(libmysql PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
INSTALL_SYMLINK(${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r libmysql ${INSTALL_LIBDIR})
|
||||
|
||||
# Install 3 links to libmysqlclient.so (client_r)
|
||||
FOREACH(ver "" "${SHARED_LIB_MAJOR_VERSION}"
|
||||
"${SHARED_LIB_MAJOR_VERSION}.0.0")
|
||||
GET_VERSIONED_LIBNAME(
|
||||
"${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r"
|
||||
"${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
||||
"${ver}"
|
||||
linkname)
|
||||
INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR})
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
|
|
@ -131,6 +131,11 @@ IF(MSVC)
|
|||
INSTALL_DEBUG_TARGET(mysqlserver DESTINATION ${INSTALL_LIBDIR}/debug)
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
INSTALL_DEBUG_TARGET(mysqlserver DESTINATION ${INSTALL_LIBDIR} RENAME
|
||||
${CMAKE_STATIC_LIBRARY_PREFIX}/mysqld-debug)
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC AND NOT DISABLE_SHARED)
|
||||
MERGE_LIBRARIES(libmysqld SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS})
|
||||
ENDIF()
|
||||
|
|
|
@ -18,3 +18,4 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
|
|||
SET(MYSQLSERVICES_SOURCES my_snprintf_service.c thd_alloc_service.c)
|
||||
|
||||
ADD_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
|
||||
INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR})
|
||||
|
|
|
@ -46,7 +46,8 @@ IF(UNIX)
|
|||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mtr
|
||||
${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run DESTINATION mysql-test)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/mysql-test-run
|
||||
DESTINATION ${INSTALL_MYSQLTESTDIR})
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
|
|
|
@ -10,6 +10,9 @@ main.information_schema # Bug#47449 2009-09-19 alik main.inform
|
|||
main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically
|
||||
main.lock_multi_bug38691 @solaris # Bug#47792 2009-10-02 alik main.lock_multi_bug38691 times out sporadically on Solaris 10
|
||||
main.log_tables # Bug#47924 2009-10-08 alik main.log_tables times out sporadically
|
||||
main.mysqlbinlog_row @solaris # Bug#52202 2010-03-22 alik mysqlbinlog_row* fail in daily-trunk on Sol10 x86_64 debug_max
|
||||
main.mysqlbinlog_row_innodb @solaris # Bug#52202 2010-03-22 alik mysqlbinlog_row* fail in daily-trunk on Sol10 x86_64 debug_max
|
||||
main.mysqlbinlog_row_myisam @solaris # Bug#52202 2010-03-22 alik mysqlbinlog_row* fail in daily-trunk on Sol10 x86_64 debug_max
|
||||
main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible)
|
||||
main.plugin # Bug#47146 Linking problem with example plugin when dtrace enabled
|
||||
main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
|
||||
|
|
|
@ -30,14 +30,6 @@ loose-enable-performance-schema
|
|||
[mysqlbinlog]
|
||||
disable-force-if-open
|
||||
|
||||
# mysql_fix_privilege_tables.sh does not read from [client] so it
|
||||
# need its own section
|
||||
[mysql_fix_privilege_tables]
|
||||
socket= @client.socket
|
||||
port= @client.port
|
||||
user= @client.user
|
||||
password= @client.password
|
||||
|
||||
[ENV]
|
||||
MASTER_MYPORT= @mysqld.1.port
|
||||
MASTER_MYSOCK= @mysqld.1.socket
|
||||
|
|
13
mysql-test/include/not_var_link.inc
Normal file
13
mysql-test/include/not_var_link.inc
Normal file
|
@ -0,0 +1,13 @@
|
|||
perl;
|
||||
open (ISLINK, ">" . $ENV{'MYSQL_TMP_DIR'} . "/mtr_var_link");
|
||||
my $mvr= -l $ENV{'MYSQLTEST_VARDIR'} ? 1 : 0;
|
||||
print ISLINK "let \$mtr_var_link= $mvr;\n";
|
||||
close ISLINK;
|
||||
EOF
|
||||
|
||||
--source $MYSQL_TMP_DIR/mtr_var_link
|
||||
--remove_file $MYSQL_TMP_DIR/mtr_var_link
|
||||
|
||||
if ($mtr_var_link) {
|
||||
--skip Test does not work with var being softlink
|
||||
}
|
|
@ -20,8 +20,8 @@ ELSE()
|
|||
ADD_EXECUTABLE(my_safe_process safe_process.cc)
|
||||
ENDIF()
|
||||
|
||||
INSTALL(TARGETS my_safe_process DESTINATION "mysql-test/lib/My/SafeProcess")
|
||||
INSTALL(TARGETS my_safe_process DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess")
|
||||
IF(WIN32)
|
||||
INSTALL(TARGETS my_safe_kill DESTINATION "mysql-test/lib/My/SafeProcess")
|
||||
INSTALL(TARGETS my_safe_kill DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess")
|
||||
ENDIF()
|
||||
INSTALL(FILES safe_process.pl Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess")
|
||||
|
|
|
@ -1723,26 +1723,8 @@ sub client_debug_arg($$) {
|
|||
}
|
||||
|
||||
|
||||
sub mysql_fix_arguments () {
|
||||
|
||||
return "" ;
|
||||
|
||||
my $exe=
|
||||
mtr_script_exists("$basedir/scripts/mysql_fix_privilege_tables",
|
||||
"$path_client_bindir/mysql_fix_privilege_tables");
|
||||
my $args;
|
||||
mtr_init_args(\$args);
|
||||
mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
|
||||
|
||||
mtr_add_arg($args, "--basedir=%s", $basedir);
|
||||
mtr_add_arg($args, "--bindir=%s", $path_client_bindir);
|
||||
mtr_add_arg($args, "--verbose");
|
||||
return mtr_args2str($exe, @$args);
|
||||
}
|
||||
|
||||
|
||||
sub client_arguments ($;$) {
|
||||
my $client_name= shift;
|
||||
my $client_name= shift;
|
||||
my $group_suffix= shift;
|
||||
my $client_exe= mtr_exe_exists("$path_client_bindir/$client_name");
|
||||
|
||||
|
@ -2083,7 +2065,6 @@ sub environment_setup {
|
|||
$ENV{'MYSQL_UPGRADE'}= client_arguments("mysql_upgrade");
|
||||
$ENV{'MYSQLADMIN'}= native_path($exe_mysqladmin);
|
||||
$ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
|
||||
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= mysql_fix_arguments();
|
||||
$ENV{'EXE_MYSQL'}= $exe_mysql;
|
||||
|
||||
# ----------------------------------------------------
|
||||
|
@ -2647,14 +2628,6 @@ sub create_config_file_for_extern {
|
|||
character-sets-dir= $path_charsetsdir
|
||||
local-load= $opt_tmpdir
|
||||
|
||||
# mysql_fix_privilege_tables.sh don't read from [client]
|
||||
[mysql_fix_privilege_tables]
|
||||
socket = $opts{'socket'}
|
||||
port = $opts{'port'}
|
||||
user = $opts{'user'}
|
||||
password = $opts{'password'}
|
||||
|
||||
|
||||
EOF
|
||||
;
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(
|
|||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format((1 / tan(1)),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
|
||||
Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format(cot(1),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
|
||||
select degrees(pi()),radians(360);
|
||||
degrees(pi()) radians(360)
|
||||
180 6.283185307179586
|
||||
|
@ -451,23 +451,17 @@ SELECT 1 FROM (SELECT ROUND(f1, f1) AS a FROM t1) AS s WHERE a LIKE 'a';
|
|||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
SELECT 1e308 + 1e308;
|
||||
1e308 + 1e308
|
||||
NULL
|
||||
ERROR 22003: DOUBLE value is out of range in '(1e308 + 1e308)'
|
||||
SELECT -1e308 - 1e308;
|
||||
-1e308 - 1e308
|
||||
NULL
|
||||
ERROR 22003: DOUBLE value is out of range in '(-(1e308) - 1e308)'
|
||||
SELECT 1e300 * 1e300;
|
||||
1e300 * 1e300
|
||||
NULL
|
||||
ERROR 22003: DOUBLE value is out of range in '(1e300 * 1e300)'
|
||||
SELECT 1e300 / 1e-300;
|
||||
1e300 / 1e-300
|
||||
NULL
|
||||
ERROR 22003: DOUBLE value is out of range in '(1e300 / 1e-300)'
|
||||
SELECT EXP(750);
|
||||
EXP(750)
|
||||
NULL
|
||||
ERROR 22003: DOUBLE value is out of range in 'exp(750)'
|
||||
SELECT POW(10, 309);
|
||||
POW(10, 309)
|
||||
NULL
|
||||
ERROR 22003: DOUBLE value is out of range in 'pow(10,309)'
|
||||
#
|
||||
# Bug #44768: SIGFPE crash when selecting rand from a view
|
||||
# containing null
|
||||
|
@ -488,11 +482,121 @@ RAND(i)
|
|||
DROP TABLE t1;
|
||||
#
|
||||
select 123456789012345678901234567890.123456789012345678901234567890 div 1 as x;
|
||||
ERROR 22003: Out of range value for column 'x' at row 1
|
||||
ERROR 22003: BIGINT value is out of range in '(123456789012345678901234567890.123456789012345678901234567890 DIV 1)'
|
||||
select "123456789012345678901234567890.123456789012345678901234567890" div 1 as x;
|
||||
ERROR 22003: Out of range value for column 'x' at row 1
|
||||
ERROR 22003: BIGINT value is out of range in '('123456789012345678901234567890.123456789012345678901234567890' DIV 1)'
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Warning 1292 Truncated incorrect DECIMAL value: ''
|
||||
Error 1264 Out of range value for column 'x' at row 1
|
||||
Error 1690 BIGINT value is out of range in '('123456789012345678901234567890.123456789012345678901234567890' DIV 1)'
|
||||
End of 5.1 tests
|
||||
#
|
||||
# Bug #8433: Overflow must be an error
|
||||
#
|
||||
SELECT 1e308 + 1e308;
|
||||
ERROR 22003: DOUBLE value is out of range in '(1e308 + 1e308)'
|
||||
SELECT -1e308 - 1e308;
|
||||
ERROR 22003: DOUBLE value is out of range in '(-(1e308) - 1e308)'
|
||||
SELECT 1e300 * 1e300;
|
||||
ERROR 22003: DOUBLE value is out of range in '(1e300 * 1e300)'
|
||||
SELECT 1e300 / 1e-300;
|
||||
ERROR 22003: DOUBLE value is out of range in '(1e300 / 1e-300)'
|
||||
SELECT EXP(750);
|
||||
ERROR 22003: DOUBLE value is out of range in 'exp(750)'
|
||||
SELECT POW(10, 309);
|
||||
ERROR 22003: DOUBLE value is out of range in 'pow(10,309)'
|
||||
SELECT COT(0);
|
||||
ERROR 22003: DOUBLE value is out of range in 'cot(0)'
|
||||
SELECT DEGREES(1e307);
|
||||
ERROR 22003: DOUBLE value is out of range in 'degrees(1e307)'
|
||||
SELECT 9223372036854775808 + 9223372036854775808;
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 + 9223372036854775808)'
|
||||
SELECT 18446744073709551615 + 1;
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)'
|
||||
SELECT 1 + 18446744073709551615;
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(1 + 18446744073709551615)'
|
||||
SELECT -2 + CAST(1 AS UNSIGNED);
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(-(2) + cast(1 as unsigned))'
|
||||
SELECT CAST(1 AS UNSIGNED) + -2;
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(cast(1 as unsigned) + -(2))'
|
||||
SELECT -9223372036854775808 + -9223372036854775808;
|
||||
ERROR 22003: BIGINT value is out of range in '(-(9223372036854775808) + -(9223372036854775808))'
|
||||
SELECT 9223372036854775807 + 9223372036854775807;
|
||||
ERROR 22003: BIGINT value is out of range in '(9223372036854775807 + 9223372036854775807)'
|
||||
SELECT CAST(0 AS UNSIGNED) - 9223372036854775809;
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(cast(0 as unsigned) - 9223372036854775809)'
|
||||
SELECT 9223372036854775808 - 9223372036854775809;
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 - 9223372036854775809)'
|
||||
SELECT CAST(1 AS UNSIGNED) - 2;
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(cast(1 as unsigned) - 2)'
|
||||
SELECT 18446744073709551615 - (-1);
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 - -(1))'
|
||||
SELECT -1 - 9223372036854775808;
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(-(1) - 9223372036854775808)'
|
||||
SELECT -1 - CAST(1 AS UNSIGNED);
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(-(1) - cast(1 as unsigned))'
|
||||
SELECT -9223372036854775808 - 1;
|
||||
ERROR 22003: BIGINT value is out of range in '(-(9223372036854775808) - 1)'
|
||||
SELECT 9223372036854775807 - -9223372036854775808;
|
||||
ERROR 22003: BIGINT value is out of range in '(9223372036854775807 - -(9223372036854775808))'
|
||||
set SQL_MODE='NO_UNSIGNED_SUBTRACTION';
|
||||
SELECT 18446744073709551615 - 1;
|
||||
ERROR 22003: BIGINT value is out of range in '(18446744073709551615 - 1)'
|
||||
SELECT 18446744073709551615 - CAST(1 AS UNSIGNED);
|
||||
ERROR 22003: BIGINT value is out of range in '(18446744073709551615 - cast(1 as unsigned))'
|
||||
SELECT 18446744073709551614 - (-1);
|
||||
ERROR 22003: BIGINT value is out of range in '(18446744073709551614 - -(1))'
|
||||
SELECT 9223372036854775807 - -1;
|
||||
ERROR 22003: BIGINT value is out of range in '(9223372036854775807 - -(1))'
|
||||
set SQL_MODE=default;
|
||||
SELECT 4294967296 * 4294967296;
|
||||
ERROR 22003: BIGINT value is out of range in '(4294967296 * 4294967296)'
|
||||
SELECT 9223372036854775808 * 2;
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 * 2)'
|
||||
SELECT 9223372036854775808 * 2;
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 * 2)'
|
||||
SELECT 7158278827 * 3221225472;
|
||||
ERROR 22003: BIGINT value is out of range in '(7158278827 * 3221225472)'
|
||||
SELECT 9223372036854775807 * (-2);
|
||||
ERROR 22003: BIGINT value is out of range in '(9223372036854775807 * -(2))'
|
||||
SELECT CAST(1 as UNSIGNED) * (-1);
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(cast(1 as unsigned) * -(1))'
|
||||
SELECT 9223372036854775807 * 2;
|
||||
ERROR 22003: BIGINT value is out of range in '(9223372036854775807 * 2)'
|
||||
SELECT ABS(-9223372036854775808);
|
||||
ERROR 22003: BIGINT value is out of range in 'abs(-(9223372036854775808))'
|
||||
SELECT -9223372036854775808 DIV -1;
|
||||
ERROR 22003: BIGINT value is out of range in '(-(9223372036854775808) DIV -(1))'
|
||||
SELECT 18446744073709551615 DIV -1;
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 DIV -(1))'
|
||||
CREATE TABLE t1(a BIGINT, b BIGINT UNSIGNED);
|
||||
INSERT INTO t1 VALUES(-9223372036854775808, 9223372036854775809);
|
||||
SELECT -a FROM t1;
|
||||
ERROR 22003: BIGINT value is out of range in '-('-9223372036854775808')'
|
||||
SELECT -b FROM t1;
|
||||
ERROR 22003: BIGINT value is out of range in '-('9223372036854775809')'
|
||||
DROP TABLE t1;
|
||||
SET @a:=999999999999999999999999999999999999999999999999999999999999999999999999999999999;
|
||||
SELECT @a + @a;
|
||||
ERROR 22003: DECIMAL value is out of range in '((@a) + (@a))'
|
||||
SELECT @a * @a;
|
||||
ERROR 22003: DECIMAL value is out of range in '((@a) * (@a))'
|
||||
SELECT -@a - @a;
|
||||
ERROR 22003: DECIMAL value is out of range in '(-((@a)) - (@a))'
|
||||
SELECT @a / 0.5;
|
||||
ERROR 22003: DECIMAL value is out of range in '((@a) / 0.5)'
|
||||
SELECT COT(1/0);
|
||||
COT(1/0)
|
||||
NULL
|
||||
SELECT -1 + 9223372036854775808;
|
||||
-1 + 9223372036854775808
|
||||
9223372036854775807
|
||||
SELECT 2 DIV -2;
|
||||
2 DIV -2
|
||||
-1
|
||||
SELECT -(1 DIV 0);
|
||||
-(1 DIV 0)
|
||||
NULL
|
||||
SELECT -9223372036854775808 MOD -1;
|
||||
-9223372036854775808 MOD -1
|
||||
0
|
||||
|
|
|
@ -25,9 +25,9 @@ length(uuid()) charset(uuid()) length(unhex(replace(uuid(),_utf8'-',_utf8'')))
|
|||
36 utf8 16
|
||||
set @a= uuid_short();
|
||||
set @b= uuid_short();
|
||||
select cast(@a - @b as signed);
|
||||
cast(@a - @b as signed)
|
||||
-1
|
||||
select @b - @a;
|
||||
@b - @a
|
||||
1
|
||||
select length(format('nan', 2)) > 0;
|
||||
length(format('nan', 2)) > 0
|
||||
1
|
||||
|
|
|
@ -63,8 +63,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select (10 % 7) AS `10 % 7`,(10 % 7) AS `10 mod 7`,(10 DIV 3) AS `10 div 3`
|
||||
select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
|
||||
(1 << 64)-1 ((1 << 64)-1) DIV 1 ((1 << 64)-1) DIV 2
|
||||
select 18446744073709551615, 18446744073709551615 DIV 1, 18446744073709551615 DIV 2;
|
||||
18446744073709551615 18446744073709551615 DIV 1 18446744073709551615 DIV 2
|
||||
18446744073709551615 18446744073709551615 9223372036854775807
|
||||
explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
|
|
|
@ -1678,14 +1678,21 @@ insert into t2 values (1);;
|
|||
#
|
||||
# Switching to connection 'handler_con1'.
|
||||
# Wait until INSERT is blocked on table-level lock.
|
||||
# The below statement should not cause deadlock.
|
||||
# Sending 'alter table t1 drop column j'. It should not cause
|
||||
# deadlock.
|
||||
alter table t1 drop column j;
|
||||
unlock tables;
|
||||
# Switching to connection 'handler_con2'.
|
||||
# Wait until ALTER is blocked during upgrade.
|
||||
#
|
||||
# Switching to connection 'default'.
|
||||
# Reap INSERT.
|
||||
ERROR HY000: Wait on a lock was aborted due to a pending exclusive lock
|
||||
handler t1 close;
|
||||
#
|
||||
# Switching to connection 'handler_con1'.
|
||||
# Reaping 'alter table t1 drop column j'
|
||||
unlock tables;
|
||||
# Switching to connection 'default'.
|
||||
# Then, check the scenario in which upgrade of SNRW lock to X
|
||||
# lock is blocked by HANDLER which is open in connection currently
|
||||
# waiting to get SW lock on the same table.
|
||||
|
@ -2248,6 +2255,8 @@ SET DEBUG_SYNC= 'RESET';
|
|||
# Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null'
|
||||
# failed in open_ltable()
|
||||
#
|
||||
# Supress warnings written to the log file
|
||||
call mtr.add_suppression("Wait on a lock was aborted due to a pending exclusive lock");
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE TABLE t1 (i INT);
|
||||
CREATE TABLE t2 (i INT);
|
||||
|
@ -2271,7 +2280,6 @@ SET DEBUG_SYNC= 'now WAIT_FOR parked';
|
|||
# Sending:
|
||||
SELECT 1;
|
||||
# connection: con3
|
||||
# Sending:
|
||||
ALTER TABLE t1 ADD COLUMN j INT;
|
||||
# connection: default
|
||||
SET DEBUG_SYNC= 'now SIGNAL go';
|
||||
|
@ -2284,8 +2292,6 @@ HANDLER t1 CLOSE;
|
|||
# Reaping SELECT 1
|
||||
1
|
||||
1
|
||||
# connection: con3
|
||||
# Reaping ALTER TABLE t1 ADD COLUMN j INT
|
||||
# connection: default
|
||||
DROP TABLE t1, t2;
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
|
|
|
@ -1,4 +1,44 @@
|
|||
drop table if exists t1;
|
||||
CREATE TABLE t1 (a DECIMAL)
|
||||
PARTITION BY RANGE COLUMNS (a)
|
||||
(PARTITION p0 VALUES LESS THAN (0));
|
||||
ERROR HY000: Field 'a' is of a not allowed type for this type of partitioning
|
||||
CREATE TABLE t1 (a BLOB)
|
||||
PARTITION BY RANGE COLUMNS (a)
|
||||
(PARTITION p0 VALUES LESS THAN ("X"));
|
||||
ERROR HY000: A BLOB field is not allowed in partition function
|
||||
CREATE TABLE t1 (a TEXT)
|
||||
PARTITION BY RANGE COLUMNS (a)
|
||||
(PARTITION p0 VALUES LESS THAN ("X"));
|
||||
ERROR HY000: A BLOB field is not allowed in partition function
|
||||
CREATE TABLE t1 (a FLOAT)
|
||||
PARTITION BY RANGE COLUMNS (a)
|
||||
(PARTITION p0 VALUES LESS THAN (0.0));
|
||||
ERROR HY000: Field 'a' is of a not allowed type for this type of partitioning
|
||||
CREATE TABLE t1 (a DOUBLE)
|
||||
PARTITION BY RANGE COLUMNS (a)
|
||||
(PARTITION p0 VALUES LESS THAN (0.0));
|
||||
ERROR HY000: Field 'a' is of a not allowed type for this type of partitioning
|
||||
CREATE TABLE t1 (d TIMESTAMP)
|
||||
PARTITION BY RANGE COLUMNS(d)
|
||||
(PARTITION p0 VALUES LESS THAN ('2000-01-01'),
|
||||
PARTITION p1 VALUES LESS THAN ('2040-01-01'));
|
||||
ERROR HY000: Field 'd' is of a not allowed type for this type of partitioning
|
||||
CREATE TABLE t1 (d BIT(1))
|
||||
PARTITION BY RANGE COLUMNS(d)
|
||||
(PARTITION p0 VALUES LESS THAN (0),
|
||||
PARTITION p1 VALUES LESS THAN (1));
|
||||
ERROR HY000: Field 'd' is of a not allowed type for this type of partitioning
|
||||
CREATE TABLE t1 (d ENUM("YES","NO"))
|
||||
PARTITION BY RANGE COLUMNS(d)
|
||||
(PARTITION p0 VALUES LESS THAN ("NO"),
|
||||
PARTITION p1 VALUES LESS THAN (MAXVALUE));
|
||||
ERROR HY000: Field 'd' is of a not allowed type for this type of partitioning
|
||||
CREATE TABLE t1 (d SET("Car","MC"))
|
||||
PARTITION BY RANGE COLUMNS(d)
|
||||
(PARTITION p0 VALUES LESS THAN ("MC"),
|
||||
PARTITION p1 VALUES LESS THAN (MAXVALUE));
|
||||
ERROR HY000: Field 'd' is of a not allowed type for this type of partitioning
|
||||
create table t1 (a int, b int)
|
||||
partition by range columns (a,b)
|
||||
( partition p0 values less than (maxvalue, 10),
|
||||
|
@ -430,16 +470,6 @@ partition by range columns(d)
|
|||
( partition p0 values less than ('2000-01-01'),
|
||||
partition p1 values less than ('2040-01-01'));
|
||||
ERROR HY000: Partition column values of incorrect type
|
||||
create table t1 (d timestamp)
|
||||
partition by range columns(d)
|
||||
( partition p0 values less than ('2000-01-01'),
|
||||
partition p1 values less than ('2040-01-01'));
|
||||
ERROR HY000: Field 'd' is of a not allowed type for this type of partitioning
|
||||
create table t1 (d bit(1))
|
||||
partition by range columns(d)
|
||||
( partition p0 values less than (0),
|
||||
partition p1 values less than (1));
|
||||
ERROR HY000: Field 'd' is of a not allowed type for this type of partitioning
|
||||
create table t1 (a int, b int)
|
||||
partition by range columns(a,b)
|
||||
(partition p0 values less than (maxvalue, 10));
|
||||
|
|
|
@ -2426,27 +2426,28 @@ city
|
|||
London
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int(11) unsigned, b int(11) unsigned);
|
||||
insert into t1 values (1,0), (1,1), (1,2);
|
||||
insert into t1 values (1,0), (1,1), (18446744073709551615,0);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 3
|
||||
select a-b from t1 order by 1;
|
||||
a-b
|
||||
0
|
||||
1
|
||||
18446744073709551615
|
||||
4294967295
|
||||
select a-b , (a-b < 0) from t1 order by 1;
|
||||
a-b (a-b < 0)
|
||||
0 0
|
||||
1 0
|
||||
18446744073709551615 0
|
||||
4294967295 0
|
||||
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
|
||||
d (a-b >= 0) b
|
||||
1 1 0
|
||||
0 1 1
|
||||
18446744073709551615 1 2
|
||||
select cast((a - b) as unsigned) from t1 order by 1;
|
||||
cast((a - b) as unsigned)
|
||||
0
|
||||
1
|
||||
18446744073709551615
|
||||
4294967295
|
||||
drop table t1;
|
||||
create table t1 (a int(11));
|
||||
select all all * from t1;
|
||||
|
@ -3419,6 +3420,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where
|
||||
DROP TABLE t1,t2;
|
||||
SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
|
||||
CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
|
||||
INSERT t1 SET i = 0;
|
||||
UPDATE t1 SET i = -1;
|
||||
|
@ -3438,8 +3440,9 @@ Warnings:
|
|||
Warning 1264 Out of range value for column 'i' at row 1
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
255
|
||||
0
|
||||
DROP TABLE t1;
|
||||
SET SQL_MODE=default;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t2 (a int, b int, c int, e int, primary key(a,b,c));
|
||||
|
|
|
@ -6022,16 +6022,12 @@ select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
|
|||
9223372036854775810 2**63+2
|
||||
9223372036854775810
|
||||
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
|
||||
lower bounds signed bigint
|
||||
0
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'f1' at row 1
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)'
|
||||
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
|
||||
upper bounds signed bigint
|
||||
9223372036854775807
|
||||
select bug20777(0) as 'lower bounds unsigned bigint';
|
||||
lower bounds unsigned bigint
|
||||
0
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)'
|
||||
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
|
||||
upper bounds unsigned bigint
|
||||
18446744073709551615
|
||||
|
@ -6041,10 +6037,7 @@ upper bounds unsigned bigint + 1
|
|||
Warnings:
|
||||
Warning 1264 Out of range value for column 'f1' at row 1
|
||||
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
|
||||
lower bounds unsigned bigint - 1
|
||||
0
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'f1' at row 1
|
||||
ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)'
|
||||
create table examplebug20777 as select
|
||||
0 as 'i',
|
||||
bug20777(9223372036854775806) as '2**63-2',
|
||||
|
@ -6053,15 +6046,10 @@ bug20777(9223372036854775808) as '2**63',
|
|||
bug20777(9223372036854775809) as '2**63+1',
|
||||
bug20777(18446744073709551614) as '2**64-2',
|
||||
bug20777(18446744073709551615) as '2**64-1',
|
||||
bug20777(18446744073709551616) as '2**64',
|
||||
bug20777(0) as '0',
|
||||
bug20777(-1) as '-1';
|
||||
bug20777(18446744073709551616) as '2**64';
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'f1' at row 1
|
||||
Warning 1264 Out of range value for column 'f1' at row 1
|
||||
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column '-1' at row 1
|
||||
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616);
|
||||
show create table examplebug20777;
|
||||
Table Create Table
|
||||
examplebug20777 CREATE TABLE `examplebug20777` (
|
||||
|
@ -6072,14 +6060,12 @@ examplebug20777 CREATE TABLE `examplebug20777` (
|
|||
`2**63+1` bigint(20) unsigned DEFAULT NULL,
|
||||
`2**64-2` bigint(20) unsigned DEFAULT NULL,
|
||||
`2**64-1` bigint(20) unsigned DEFAULT NULL,
|
||||
`2**64` bigint(20) unsigned DEFAULT NULL,
|
||||
`0` bigint(20) unsigned DEFAULT NULL,
|
||||
`-1` bigint(20) unsigned DEFAULT NULL
|
||||
`2**64` bigint(20) unsigned DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select * from examplebug20777 order by i;
|
||||
i 2**63-2 2**63-1 2**63 2**63+1 2**64-2 2**64-1 2**64 0 -1
|
||||
0 9223372036854775806 9223372036854775807 9223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 18446744073709551615 0 0
|
||||
1 9223372036854775806 9223372036854775807 223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 8446744073709551616 0 0
|
||||
i 2**63-2 2**63-1 2**63 2**63+1 2**64-2 2**64-1 2**64
|
||||
0 9223372036854775806 9223372036854775807 9223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 18446744073709551615
|
||||
1 9223372036854775806 9223372036854775807 223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 8446744073709551616
|
||||
drop table examplebug20777;
|
||||
select bug20777(18446744073709551613)+1;
|
||||
bug20777(18446744073709551613)+1
|
||||
|
|
|
@ -895,6 +895,7 @@ ERROR 22003: Out of range value for column 'col1' at row 1
|
|||
INSERT INTO t1 (col2) VALUES ('-1.2E-3');
|
||||
ERROR 22003: Out of range value for column 'col2' at row 1
|
||||
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
|
||||
ERROR 22003: DOUBLE value is out of range in '("test"."t1"."col1" * 5000)'
|
||||
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
|
||||
ERROR 22012: Division by 0
|
||||
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
|
||||
|
@ -922,10 +923,10 @@ SELECT * FROM t1;
|
|||
col1 col2
|
||||
-2.2e-307 0
|
||||
1e-303 0
|
||||
NULL 1.7e308
|
||||
1.7e308 1.7e308
|
||||
-2.2e-307 0
|
||||
-2e-307 0
|
||||
NULL 1.7e308
|
||||
1.7e308 1.7e308
|
||||
0 NULL
|
||||
2 NULL
|
||||
NULL NULL
|
||||
|
|
|
@ -1385,11 +1385,7 @@ Warning 1264 Out of range value for column 'c1' at row 1
|
|||
insert into t1 values(
|
||||
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 *
|
||||
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DECIMAL value: ''
|
||||
Warning 1292 Truncated incorrect DECIMAL value: ''
|
||||
Warning 1292 Truncated incorrect DECIMAL value: ''
|
||||
Warning 1264 Out of range value for column 'c1' at row 1
|
||||
ERROR 22003: DECIMAL value is out of range in '(99999999999999999999999999999999999999999999999999999999999999999 * 99999999999999999999999999999999999999999999999999999999999999999)'
|
||||
insert into t1 values(1e100);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'c1' at row 1
|
||||
|
@ -1397,7 +1393,6 @@ select * from t1;
|
|||
c1
|
||||
9999999999999999999999999999999999999999999999999999999999999999
|
||||
9999999999999999999999999999999999999999999999999999999999999999
|
||||
9999999999999999999999999999999999999999999999999999999999999999
|
||||
drop table t1;
|
||||
create table t1(a decimal(7,2));
|
||||
insert into t1 values(123.12);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,6 +18,7 @@
|
|||
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_perfschema.inc
|
||||
--source include/not_var_link.inc
|
||||
|
||||
#
|
||||
# Bug#45496 Performance schema: assertion fails in
|
||||
|
|
|
@ -290,12 +290,10 @@ a b
|
|||
2 on slave
|
||||
Heartbeat event received on master
|
||||
Heartbeat event received on slave
|
||||
Slave has received more events than master (1 means 'yes'): 1
|
||||
|
||||
*** Clean up ***
|
||||
include/stop_slave.inc
|
||||
DROP TABLE t1;
|
||||
include/stop_slave.inc
|
||||
SET @@global.slave_net_timeout=@restore_slave_net_timeout;
|
||||
|
||||
End of 6.0 test
|
||||
End of tests
|
||||
|
|
|
@ -206,3 +206,19 @@ Comparing tables master:test.t1 and slave:test.t1
|
|||
TRUNCATE t1;
|
||||
## check: contents of both tables master's and slave's
|
||||
DROP TABLE t1;
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
CREATE TABLE t1 ( c INT, PRIMARY KEY (c)) Engine=MyISAM;
|
||||
CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW SET @aux = -1 ;
|
||||
SET @aux = 10294947273192243200;
|
||||
SET @aux1= @aux;
|
||||
INSERT INTO t1 VALUES (@aux) , (@aux1);
|
||||
ERROR 23000: Duplicate entry '2147483647' for key 'PRIMARY'
|
||||
## assertion: master and slave tables are in sync
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -10,6 +10,12 @@
|
|||
# * Circular replication
|
||||
#############################################################
|
||||
--source include/master-slave.inc
|
||||
#
|
||||
# The test runs long and does not have any specifics to
|
||||
# binlog_format. It is choosen therefore to run with MIXED mode
|
||||
# in order to not slow down much `make test'.
|
||||
#
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--echo
|
||||
|
||||
--echo *** Preparing ***
|
||||
|
@ -462,6 +468,9 @@ EOF
|
|||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
--connection slave
|
||||
# make sure IO thread has re-connected
|
||||
# due to slow valgrind env the following wait_for_status may time out
|
||||
--source include/wait_for_slave_io_to_start.inc
|
||||
# Wait until slave_received_heartbeats will be incremented
|
||||
let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
|
||||
let $status_var= slave_received_heartbeats;
|
||||
|
@ -470,7 +479,7 @@ let $status_var_comparsion= >;
|
|||
--echo Heartbeat event received
|
||||
--echo
|
||||
|
||||
# Circular replication
|
||||
# Circular replication: demonstrating bidirectional hearbeat flow
|
||||
--echo *** Circular replication ***
|
||||
# Configure circular replication
|
||||
--source include/master-slave-reset.inc
|
||||
|
@ -499,15 +508,16 @@ SELECT * FROM t1 ORDER BY a;
|
|||
let $master_rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
|
||||
--connection slave
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
# Wait heartbeat event on master
|
||||
|
||||
# Wait for heartbeat event on master
|
||||
--connection master
|
||||
let $status_var= slave_received_heartbeats;
|
||||
let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
|
||||
let $status_var_comparsion= >;
|
||||
--source include/wait_for_status_var.inc
|
||||
--echo Heartbeat event received on master
|
||||
let $master_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
|
||||
# Wait heartbeat event on slave
|
||||
|
||||
# Wait heartbeat events on slave
|
||||
--connection slave
|
||||
let $status_var= slave_received_heartbeats;
|
||||
let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
|
||||
|
@ -515,11 +525,6 @@ let $status_var_comparsion= >;
|
|||
--source include/wait_for_status_var.inc
|
||||
--echo Heartbeat event received on slave
|
||||
let $slave_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
|
||||
# Heartbeat period on slave less than on master therefore number of received events on slave
|
||||
# should be greater than on master
|
||||
let $result= query_get_value(SELECT ($slave_rcvd_heartbeats DIV $master_rcvd_heartbeats) > 1 AS Result, Result, 1);
|
||||
--echo Slave has received more events than master (1 means 'yes'): $result
|
||||
--echo
|
||||
|
||||
#
|
||||
# Clean up and restore system variables
|
||||
|
@ -533,5 +538,5 @@ DROP TABLE t1;
|
|||
SET @@global.slave_net_timeout=@restore_slave_net_timeout;
|
||||
--echo
|
||||
|
||||
# End of 6.0 test
|
||||
--echo End of 6.0 test
|
||||
# End of tests
|
||||
--echo End of tests
|
||||
|
|
|
@ -139,3 +139,36 @@ TRUNCATE t1;
|
|||
-- connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
#####################################################################
|
||||
#
|
||||
# BUG#51426
|
||||
#
|
||||
#####################################################################
|
||||
-- source include/master-slave-reset.inc
|
||||
-- connection master
|
||||
|
||||
CREATE TABLE t1 ( c INT, PRIMARY KEY (c)) Engine=MyISAM;
|
||||
|
||||
# offending trigger that would reset the unsigned flag for aux before
|
||||
# binlogging of User_var_log_event would take place.
|
||||
CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW SET @aux = -1 ;
|
||||
|
||||
SET @aux = 10294947273192243200;
|
||||
SET @aux1= @aux;
|
||||
-- error ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (@aux) , (@aux1);
|
||||
|
||||
-- sync_slave_with_master
|
||||
|
||||
-- echo ## assertion: master and slave tables are in sync
|
||||
-- let $diff_table_1=master:test.t1
|
||||
-- let $diff_table_2=slave:test.t1
|
||||
-- source include/diff_tables.inc
|
||||
|
||||
--connection master
|
||||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- sync_slave_with_master
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
--sync-relay-log-info=1 --relay-log-recovery=1
|
||||
--sync-relay-log-info=1 --relay-log-recovery=1 --innodb_file_format_check='ON'
|
||||
|
|
|
@ -1 +1 @@
|
|||
--default-collation=ucs2_unicode_ci --default-character-set=ucs2,latin1
|
||||
--collation-server=ucs2_unicode_ci --character-set-server=ucs2,latin1
|
||||
|
|
|
@ -14,9 +14,9 @@ SET @@global.sql_slave_skip_counter = 2147483648*2;
|
|||
Warnings:
|
||||
Warning 1292 Truncated incorrect sql_slave_skip_counter value: '4294967296'
|
||||
SET @@global.sql_slave_skip_counter = 2147483648*2-1;
|
||||
SET @@global.sql_slave_skip_counter = 4294967295*4294967295;
|
||||
SET @@global.sql_slave_skip_counter = 18446744065119617025;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect sql_slave_skip_counter value: '-8589934591'
|
||||
Warning 1292 Truncated incorrect sql_slave_skip_counter value: '18446744065119617025'
|
||||
'#--------------------FN_DYNVARS_165_03-------------------------#'
|
||||
SET @@global.sql_slave_skip_counter = '5';
|
||||
ERROR 42000: Incorrect argument type to variable 'sql_slave_skip_counter'
|
||||
|
|
|
@ -56,7 +56,7 @@ SET @@global.sql_slave_skip_counter = 1024;
|
|||
SET @@global.sql_slave_skip_counter = 2147483648;
|
||||
SET @@global.sql_slave_skip_counter = 2147483648*2;
|
||||
SET @@global.sql_slave_skip_counter = 2147483648*2-1;
|
||||
SET @@global.sql_slave_skip_counter = 4294967295*4294967295;
|
||||
SET @@global.sql_slave_skip_counter = 18446744065119617025;
|
||||
|
||||
--echo '#--------------------FN_DYNVARS_165_03-------------------------#'
|
||||
###################################################################
|
||||
|
|
|
@ -283,12 +283,20 @@ DROP TABLE t1;
|
|||
#
|
||||
# Bug #31236: Inconsistent division by zero behavior for floating point numbers
|
||||
#
|
||||
# After the fix for bug #8433 we throw an error in the below test cases
|
||||
# rather than just return a NULL value.
|
||||
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 1e308 + 1e308;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT -1e308 - 1e308;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 1e300 * 1e300;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 1e300 / 1e-300;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT EXP(750);
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT POW(10, 309);
|
||||
|
||||
--echo #
|
||||
|
@ -314,10 +322,139 @@ DROP TABLE t1;
|
|||
# DIV returns incorrect result with large decimal value
|
||||
# Bug #46606:Casting error for large numbers in 5.4 when 'div' is used
|
||||
|
||||
--error ER_WARN_DATA_OUT_OF_RANGE
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
select 123456789012345678901234567890.123456789012345678901234567890 div 1 as x;
|
||||
--error ER_WARN_DATA_OUT_OF_RANGE
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
select "123456789012345678901234567890.123456789012345678901234567890" div 1 as x;
|
||||
SHOW WARNINGS;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # Bug #8433: Overflow must be an error
|
||||
--echo #
|
||||
|
||||
# Floating point overflows
|
||||
# ========================
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 1e308 + 1e308;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT -1e308 - 1e308;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 1e300 * 1e300;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 1e300 / 1e-300;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT EXP(750);
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT POW(10, 309);
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT COT(0);
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT DEGREES(1e307);
|
||||
|
||||
# Integer overflows
|
||||
# =================
|
||||
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 9223372036854775808 + 9223372036854775808;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 18446744073709551615 + 1;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 1 + 18446744073709551615;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT -2 + CAST(1 AS UNSIGNED);
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT CAST(1 AS UNSIGNED) + -2;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT -9223372036854775808 + -9223372036854775808;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 9223372036854775807 + 9223372036854775807;
|
||||
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT CAST(0 AS UNSIGNED) - 9223372036854775809;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 9223372036854775808 - 9223372036854775809;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT CAST(1 AS UNSIGNED) - 2;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 18446744073709551615 - (-1);
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT -1 - 9223372036854775808;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT -1 - CAST(1 AS UNSIGNED);
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT -9223372036854775808 - 1;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 9223372036854775807 - -9223372036854775808;
|
||||
|
||||
# To test SIGNED overflow when subtraction arguments are both UNSIGNED
|
||||
set SQL_MODE='NO_UNSIGNED_SUBTRACTION';
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 18446744073709551615 - 1;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 18446744073709551615 - CAST(1 AS UNSIGNED);
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 18446744073709551614 - (-1);
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 9223372036854775807 - -1;
|
||||
set SQL_MODE=default;
|
||||
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 4294967296 * 4294967296;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 9223372036854775808 * 2;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 9223372036854775808 * 2;
|
||||
# The following one triggers condition #3 from the comments in
|
||||
# Item_func_mul::int_op()
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 7158278827 * 3221225472;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 9223372036854775807 * (-2);
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT CAST(1 as UNSIGNED) * (-1);
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 9223372036854775807 * 2;
|
||||
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT ABS(-9223372036854775808);
|
||||
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT -9223372036854775808 DIV -1;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT 18446744073709551615 DIV -1;
|
||||
|
||||
|
||||
# Have to create a table because the negation op may convert literals to DECIMAL
|
||||
CREATE TABLE t1(a BIGINT, b BIGINT UNSIGNED);
|
||||
INSERT INTO t1 VALUES(-9223372036854775808, 9223372036854775809);
|
||||
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT -a FROM t1;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT -b FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# Decimal overflows
|
||||
# =================
|
||||
|
||||
SET @a:=999999999999999999999999999999999999999999999999999999999999999999999999999999999;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT @a + @a;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT @a * @a;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT -@a - @a;
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
SELECT @a / 0.5;
|
||||
|
||||
# Non-overflow tests to improve code coverage
|
||||
# ===========================================
|
||||
SELECT COT(1/0);
|
||||
SELECT -1 + 9223372036854775808;
|
||||
SELECT 2 DIV -2;
|
||||
SELECT -(1 DIV 0);
|
||||
# Crashed the server with SIGFPE before the bugfix
|
||||
SELECT -9223372036854775808 MOD -1;
|
||||
|
|
|
@ -22,7 +22,7 @@ select length(uuid()), charset(uuid()), length(unhex(replace(uuid(),_utf8'-',_ut
|
|||
# between two calls should be -1
|
||||
set @a= uuid_short();
|
||||
set @b= uuid_short();
|
||||
select cast(@a - @b as signed);
|
||||
select @b - @a;
|
||||
|
||||
#
|
||||
# Test for core dump with nan
|
||||
|
|
|
@ -24,7 +24,7 @@ select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
|
|||
select 1 like 2 xor 2 like 1;
|
||||
select 10 % 7, 10 mod 7, 10 div 3;
|
||||
explain extended select 10 % 7, 10 mod 7, 10 div 3;
|
||||
select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
|
||||
select 18446744073709551615, 18446744073709551615 DIV 1, 18446744073709551615 DIV 2;
|
||||
explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
|
||||
|
||||
create table t1 (a int);
|
||||
|
|
|
@ -2277,17 +2277,32 @@ let $wait_condition=
|
|||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Table lock" and info = "insert into t2 values (1)";
|
||||
--source include/wait_condition.inc
|
||||
--echo # The below statement should not cause deadlock.
|
||||
alter table t1 drop column j;
|
||||
unlock tables;
|
||||
--echo # Sending 'alter table t1 drop column j'. It should not cause
|
||||
--echo # deadlock.
|
||||
send alter table t1 drop column j;
|
||||
--echo # Switching to connection 'handler_con2'.
|
||||
connection handler_con2;
|
||||
--echo # Wait until ALTER is blocked during upgrade.
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Waiting for table" and info = "alter table t1 drop column j";
|
||||
--source include/wait_condition.inc
|
||||
--echo #
|
||||
--echo # Switching to connection 'default'.
|
||||
connection default;
|
||||
--echo # Reap INSERT.
|
||||
--error ER_LOCK_ABORTED
|
||||
--reap
|
||||
handler t1 close;
|
||||
|
||||
--echo #
|
||||
--echo # Switching to connection 'handler_con1'.
|
||||
connection handler_con1;
|
||||
--echo # Reaping 'alter table t1 drop column j'
|
||||
--reap
|
||||
unlock tables;
|
||||
--echo # Switching to connection 'default'.
|
||||
connection default;
|
||||
|
||||
--echo # Then, check the scenario in which upgrade of SNRW lock to X
|
||||
--echo # lock is blocked by HANDLER which is open in connection currently
|
||||
--echo # waiting to get SW lock on the same table.
|
||||
|
@ -3220,6 +3235,8 @@ disconnect con2;
|
|||
--echo # failed in open_ltable()
|
||||
--echo #
|
||||
|
||||
--echo # Supress warnings written to the log file
|
||||
call mtr.add_suppression("Wait on a lock was aborted due to a pending exclusive lock");
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
--enable_warnings
|
||||
|
@ -3279,16 +3296,10 @@ let $wait_condition=
|
|||
# since the latter waits on a table-level lock while having a HANDLER
|
||||
# open. This will cause mysql_lock_tables() in con1 fail which before
|
||||
# triggered the assert.
|
||||
--echo # Sending:
|
||||
--send ALTER TABLE t1 ADD COLUMN j INT
|
||||
ALTER TABLE t1 ADD COLUMN j INT;
|
||||
|
||||
--echo # connection: default
|
||||
connection default;
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist
|
||||
WHERE state = "Waiting for table"
|
||||
AND info = "ALTER TABLE t1 ADD COLUMN j INT";
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC= 'now SIGNAL go';
|
||||
|
||||
--echo # connection: con1
|
||||
|
@ -3302,11 +3313,6 @@ connection con2;
|
|||
--echo # Reaping SELECT 1
|
||||
--reap
|
||||
|
||||
--echo # connection: con3
|
||||
connection con3;
|
||||
--echo # Reaping ALTER TABLE t1 ADD COLUMN j INT
|
||||
--reap
|
||||
|
||||
--echo # connection: default
|
||||
connection default;
|
||||
DROP TABLE t1, t2;
|
||||
|
|
|
@ -8,6 +8,59 @@
|
|||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug#51347: assertion with show create table + partition by columns
|
||||
# on decimal column
|
||||
#
|
||||
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
|
||||
CREATE TABLE t1 (a DECIMAL)
|
||||
PARTITION BY RANGE COLUMNS (a)
|
||||
(PARTITION p0 VALUES LESS THAN (0));
|
||||
|
||||
--error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
|
||||
CREATE TABLE t1 (a BLOB)
|
||||
PARTITION BY RANGE COLUMNS (a)
|
||||
(PARTITION p0 VALUES LESS THAN ("X"));
|
||||
|
||||
--error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
|
||||
CREATE TABLE t1 (a TEXT)
|
||||
PARTITION BY RANGE COLUMNS (a)
|
||||
(PARTITION p0 VALUES LESS THAN ("X"));
|
||||
|
||||
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
|
||||
CREATE TABLE t1 (a FLOAT)
|
||||
PARTITION BY RANGE COLUMNS (a)
|
||||
(PARTITION p0 VALUES LESS THAN (0.0));
|
||||
|
||||
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
|
||||
CREATE TABLE t1 (a DOUBLE)
|
||||
PARTITION BY RANGE COLUMNS (a)
|
||||
(PARTITION p0 VALUES LESS THAN (0.0));
|
||||
|
||||
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
|
||||
CREATE TABLE t1 (d TIMESTAMP)
|
||||
PARTITION BY RANGE COLUMNS(d)
|
||||
(PARTITION p0 VALUES LESS THAN ('2000-01-01'),
|
||||
PARTITION p1 VALUES LESS THAN ('2040-01-01'));
|
||||
|
||||
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
|
||||
CREATE TABLE t1 (d BIT(1))
|
||||
PARTITION BY RANGE COLUMNS(d)
|
||||
(PARTITION p0 VALUES LESS THAN (0),
|
||||
PARTITION p1 VALUES LESS THAN (1));
|
||||
|
||||
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
|
||||
CREATE TABLE t1 (d ENUM("YES","NO"))
|
||||
PARTITION BY RANGE COLUMNS(d)
|
||||
(PARTITION p0 VALUES LESS THAN ("NO"),
|
||||
PARTITION p1 VALUES LESS THAN (MAXVALUE));
|
||||
|
||||
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
|
||||
CREATE TABLE t1 (d SET("Car","MC"))
|
||||
PARTITION BY RANGE COLUMNS(d)
|
||||
(PARTITION p0 VALUES LESS THAN ("MC"),
|
||||
PARTITION p1 VALUES LESS THAN (MAXVALUE));
|
||||
|
||||
#
|
||||
# BUG#49180, Possible to define empty intervals for column list partitioning
|
||||
#
|
||||
|
@ -285,18 +338,6 @@ partition by range columns(d)
|
|||
( partition p0 values less than ('2000-01-01'),
|
||||
partition p1 values less than ('2040-01-01'));
|
||||
|
||||
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
|
||||
create table t1 (d timestamp)
|
||||
partition by range columns(d)
|
||||
( partition p0 values less than ('2000-01-01'),
|
||||
partition p1 values less than ('2040-01-01'));
|
||||
|
||||
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
|
||||
create table t1 (d bit(1))
|
||||
partition by range columns(d)
|
||||
( partition p0 values less than (0),
|
||||
partition p1 values less than (1));
|
||||
|
||||
create table t1 (a int, b int)
|
||||
partition by range columns(a,b)
|
||||
(partition p0 values less than (maxvalue, 10));
|
||||
|
|
|
@ -1989,7 +1989,7 @@ DROP TABLE t1;
|
|||
#
|
||||
|
||||
create table t1 (a int(11) unsigned, b int(11) unsigned);
|
||||
insert into t1 values (1,0), (1,1), (1,2);
|
||||
insert into t1 values (1,0), (1,1), (18446744073709551615,0);
|
||||
select a-b from t1 order by 1;
|
||||
select a-b , (a-b < 0) from t1 order by 1;
|
||||
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
|
||||
|
@ -2910,6 +2910,7 @@ DROP TABLE t1,t2;
|
|||
# cases to prevent fixing this accidently. It is intended behaviour)
|
||||
#
|
||||
|
||||
SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
|
||||
CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
|
||||
INSERT t1 SET i = 0;
|
||||
UPDATE t1 SET i = -1;
|
||||
|
@ -2919,6 +2920,7 @@ SELECT * FROM t1;
|
|||
UPDATE t1 SET i = i - 1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
SET SQL_MODE=default;
|
||||
|
||||
# BUG#17379
|
||||
|
||||
|
|
|
@ -7076,11 +7076,14 @@ select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
|
|||
select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
|
||||
select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
|
||||
select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
|
||||
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
select bug20777(0) as 'lower bounds unsigned bigint';
|
||||
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
|
||||
select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
|
||||
|
||||
create table examplebug20777 as select
|
||||
|
@ -7091,10 +7094,8 @@ create table examplebug20777 as select
|
|||
bug20777(9223372036854775809) as '2**63+1',
|
||||
bug20777(18446744073709551614) as '2**64-2',
|
||||
bug20777(18446744073709551615) as '2**64-1',
|
||||
bug20777(18446744073709551616) as '2**64',
|
||||
bug20777(0) as '0',
|
||||
bug20777(-1) as '-1';
|
||||
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
|
||||
bug20777(18446744073709551616) as '2**64';
|
||||
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616);
|
||||
show create table examplebug20777;
|
||||
select * from examplebug20777 order by i;
|
||||
|
||||
|
|
|
@ -822,6 +822,7 @@ INSERT INTO t1 (col2) VALUES (-1.1E-3);
|
|||
INSERT INTO t1 (col1) VALUES ('+1.8E+309');
|
||||
--error 1264
|
||||
INSERT INTO t1 (col2) VALUES ('-1.2E-3');
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
|
||||
--error 1365
|
||||
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
# Embedded server doesn't support external clients
|
||||
--source include/not_embedded.inc
|
||||
|
||||
# Don't run this test if $MYSQL_FIX_SYSTEM_TABLES isn't set
|
||||
# to the location of mysql_fix_privilege_tables.sql
|
||||
if (`SELECT LENGTH("$MYSQL_FIX_SYSTEM_TABLES") <= 0`)
|
||||
{
|
||||
skip Test need MYSQL_FIX_SYSTEM_TABLES;
|
||||
}
|
||||
# check that CSV engine was compiled in, as the test relies on the presence
|
||||
# of the log tables (which are CSV-based)
|
||||
--source include/have_csv.inc
|
||||
|
||||
#
|
||||
# This is the test for mysql_fix_privilege_tables
|
||||
# It checks that a system tables from mysql 3.20
|
||||
# can be upgraded to current system table format
|
||||
#
|
||||
# Note: If this test fails, don't be confused about the errors reported
|
||||
# by mysql-test-run This shows warnings generated by
|
||||
# mysql_fix_system_tables which should be ignored.
|
||||
# Instead, concentrate on the errors in r/system_mysql_db.reject
|
||||
|
||||
-- disable_result_log
|
||||
-- disable_query_log
|
||||
|
||||
use test;
|
||||
|
||||
# create system tables as in mysql-3.20
|
||||
|
||||
--disable_warnings
|
||||
CREATE TABLE db (
|
||||
Host char(60) binary DEFAULT '' NOT NULL,
|
||||
Db char(32) binary DEFAULT '' NOT NULL,
|
||||
User char(16) binary DEFAULT '' NOT NULL,
|
||||
Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
PRIMARY KEY Host (Host,Db,User),
|
||||
KEY User (User)
|
||||
)
|
||||
engine=MyISAM;
|
||||
--enable_warnings
|
||||
|
||||
INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y');
|
||||
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y');
|
||||
|
||||
--disable_warnings
|
||||
CREATE TABLE host (
|
||||
Host char(60) binary DEFAULT '' NOT NULL,
|
||||
Db char(32) binary DEFAULT '' NOT NULL,
|
||||
Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
PRIMARY KEY Host (Host,Db)
|
||||
)
|
||||
engine=MyISAM;
|
||||
--enable_warnings
|
||||
|
||||
--disable_warnings
|
||||
CREATE TABLE user (
|
||||
Host char(60) binary DEFAULT '' NOT NULL,
|
||||
User char(16) binary DEFAULT '' NOT NULL,
|
||||
Password char(16),
|
||||
Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
PRIMARY KEY Host (Host,User)
|
||||
)
|
||||
engine=MyISAM;
|
||||
--enable_warnings
|
||||
|
||||
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
|
||||
INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
|
||||
|
||||
# Call the "shell script" $MYSQL_FIX_SYSTEM_TABLES using system
|
||||
-- system $MYSQL_FIX_SYSTEM_TABLES --database=test > $MYSQLTEST_VARDIR/log/system_mysql_db_fix30020.log 2>&1
|
||||
-- enable_query_log
|
||||
-- enable_result_log
|
||||
|
||||
-- source include/system_db_struct.inc
|
||||
|
||||
-- disable_query_log
|
||||
|
||||
DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv,
|
||||
procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc,
|
||||
time_zone, time_zone_leap_second, time_zone_name, time_zone_transition,
|
||||
time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index;
|
||||
|
||||
-- enable_query_log
|
||||
|
||||
# check that we dropped all system tables
|
||||
show tables;
|
||||
|
||||
exit;
|
||||
# End of 4.1 tests
|
|
@ -1090,6 +1090,7 @@ create table t1 (c1 decimal(64));
|
|||
--disable_ps_protocol
|
||||
insert into t1 values(
|
||||
89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
|
||||
--error ER_DATA_OUT_OF_RANGE
|
||||
insert into t1 values(
|
||||
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 *
|
||||
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
|
||||
|
|
|
@ -65,7 +65,7 @@ ADD_CUSTOM_TARGET(GenFixPrivs
|
|||
|
||||
IF(UNIX)
|
||||
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/make_binary_distribution
|
||||
"cd ${CMAKE_BINARY_DIR} && ${CMAKE_CPACK_COMMAND} -G TGZ --config CPackConfig.cmake" )
|
||||
"cd ${CMAKE_BINARY_DIR} && '${CMAKE_CPACK_COMMAND}' -G TGZ --config CPackConfig.cmake" )
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/make_binary_distribution
|
||||
)
|
||||
|
@ -261,7 +261,8 @@ IF(WIN32)
|
|||
SET(PLIN_FILES mysql_config mysql_secure_installation)
|
||||
# Input files with .sh extension
|
||||
|
||||
SET(SH_FILES mysql_convert_table_format mysqld_multi)
|
||||
SET(SH_FILES mysql_convert_table_format mysqld_multi mysqldumpslow
|
||||
mysqlhotcopy)
|
||||
|
||||
FOREACH(file ${PLIN_FILES})
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.pl.in
|
||||
|
|
|
@ -23,7 +23,6 @@ EXTRA_PROGRAMS = comp_sql
|
|||
bin_SCRIPTS = @server_scripts@ \
|
||||
msql2mysql \
|
||||
mysql_config \
|
||||
mysql_fix_privilege_tables \
|
||||
mysql_fix_extensions \
|
||||
mysql_setpermission \
|
||||
mysql_secure_installation \
|
||||
|
@ -45,7 +44,6 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \
|
|||
msql2mysql.sh \
|
||||
mysql_config.sh \
|
||||
mysql_config.pl.in \
|
||||
mysql_fix_privilege_tables.sh \
|
||||
mysql_fix_extensions.sh \
|
||||
mysql_install_db.sh \
|
||||
mysql_install_db.pl.in \
|
||||
|
@ -82,7 +80,6 @@ CLEANFILES = @server_scripts@ \
|
|||
make_sharedlib_distribution \
|
||||
msql2mysql \
|
||||
mysql_config \
|
||||
mysql_fix_privilege_tables \
|
||||
mysql_fix_extensions \
|
||||
mysql_setpermission \
|
||||
mysql_secure_installation \
|
||||
|
|
|
@ -158,7 +158,6 @@ cp tests/$TARGET/*.exe $DESTDIR/bin/
|
|||
cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/
|
||||
|
||||
cp sql/$TARGET/mysqld.exe $DESTDIR/bin/mysqld$EXE_SUFFIX.exe
|
||||
cp sql/$TARGET/mysqld.map $DESTDIR/bin/mysqld$EXE_SUFFIX.map
|
||||
if [ x"$TARGET" != x"release" ] ; then
|
||||
cp sql/$TARGET/mysqld.pdb $DESTDIR/bin/mysqld$EXE_SUFFIX.pdb
|
||||
fi
|
||||
|
@ -167,7 +166,6 @@ if [ x"$PACK_DEBUG" = x"" -a -f "sql/debug/mysqld.exe" -o \
|
|||
x"$PACK_DEBUG" = x"yes" ] ; then
|
||||
cp sql/debug/mysqld.exe $DESTDIR/bin/mysqld-debug.exe
|
||||
cp sql/debug/mysqld.pdb $DESTDIR/bin/mysqld-debug.pdb
|
||||
cp sql/debug/mysqld.map $DESTDIR/bin/mysqld-debug.map
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
|
|
@ -1,223 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2000-2006 MySQL AB
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# This script is a wrapper to pipe the mysql_fix_privilege_tables.sql
|
||||
# through the mysql client program to the mysqld server
|
||||
|
||||
# Default values (Can be changed in my.cnf)
|
||||
password=""
|
||||
host="localhost"
|
||||
user="root"
|
||||
sql_only=0
|
||||
basedir="@prefix@"
|
||||
verbose=0
|
||||
args=""
|
||||
# no elaborate fallback here; with no argument, it will happen in "mysql"
|
||||
port=""
|
||||
socket=""
|
||||
database="mysql"
|
||||
bindir=""
|
||||
pkgdatadir="@pkgdatadir@"
|
||||
print_defaults_bindir="."
|
||||
|
||||
file=mysql_fix_privilege_tables.sql
|
||||
|
||||
# The following test is to make this script compatible with the 4.0 where
|
||||
# the single argument could be a password
|
||||
if test "$#" = 1
|
||||
then
|
||||
case "$1" in
|
||||
--*) ;;
|
||||
*) old_style_password="$1" ; shift ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# The following code is almost identical to the code in mysql_install_db.sh
|
||||
|
||||
case "$1" in
|
||||
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
|
||||
defaults="$1"; shift
|
||||
;;
|
||||
esac
|
||||
|
||||
parse_arguments() {
|
||||
# We only need to pass arguments through to the server if we don't
|
||||
# handle them here. So, we collect unrecognized options (passed on
|
||||
# the command line) into the args variable.
|
||||
pick_args=
|
||||
if test "$1" = PICK-ARGS-FROM-ARGV
|
||||
then
|
||||
pick_args=1
|
||||
shift
|
||||
fi
|
||||
|
||||
for arg do
|
||||
case "$arg" in
|
||||
--basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
||||
--user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
||||
--password=*) password=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
||||
--host=*) host=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
||||
--sql|--sql-only) sql_only=1 ;;
|
||||
--verbose) verbose=1 ;;
|
||||
--port=*) port=`echo "$arg" | sed -e "s;--port=;;"` ;;
|
||||
--socket=*) socket=`echo "$arg" | sed -e "s;--socket=;;"` ;;
|
||||
--database=*) database=`echo "$arg" | sed -e "s;--database=;;"` ;;
|
||||
--bindir=*) bindir=`echo "$arg" | sed -e "s;--bindir=;;"`
|
||||
print_defaults_bindir=$bindir
|
||||
;;
|
||||
*)
|
||||
if test -n "$pick_args"
|
||||
then
|
||||
# This sed command makes sure that any special chars are quoted,
|
||||
# so the arg gets passed exactly to the server.
|
||||
args="$args "`echo "$arg" | sed -e 's,\([^=a-zA-Z0-9_.-]\),\\\\\1,g'`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Get first arguments from the my.cfg file, groups [mysqld] and
|
||||
# [mysql_install_db], and then merge with the command line arguments
|
||||
|
||||
print_defaults=my_print_defaults
|
||||
for dir in ./bin @bindir@ @bindir@ extra $print_defaults_bindir/../bin $print_defaults_bindir/../extra
|
||||
do
|
||||
if test -x $dir/my_print_defaults
|
||||
then
|
||||
print_defaults="$dir/my_print_defaults"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
parse_arguments `$print_defaults $defaults mysql_install_db mysql_fix_privilege_tables`
|
||||
parse_arguments PICK-ARGS-FROM-ARGV "$@"
|
||||
|
||||
if test -z "$password"
|
||||
then
|
||||
password=$old_style_password
|
||||
fi
|
||||
|
||||
# Find where 'mysql' command is located
|
||||
|
||||
dirname=`dirname "$0"`
|
||||
|
||||
if test -z "$bindir"
|
||||
then
|
||||
for i in @bindir@ $basedir/bin "$dirname/../client"
|
||||
do
|
||||
if test -f $i/mysql
|
||||
then
|
||||
bindir=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$bindir"
|
||||
then
|
||||
echo "Could not find MySQL command-line client (mysql)."
|
||||
echo "Please use --basedir to specify the directory where MySQL is installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cmd="$bindir/mysql --no-defaults --default-character-set=latin1 --force --user=$user --host=$host"
|
||||
if test ! -z "$port"; then
|
||||
cmd="$cmd --port=$port"
|
||||
fi
|
||||
if test ! -z "$socket"; then
|
||||
cmd="$cmd --socket=$socket"
|
||||
fi
|
||||
cmd="$cmd --database=$database"
|
||||
|
||||
if test $sql_only = 1
|
||||
then
|
||||
cmd="cat"
|
||||
fi
|
||||
|
||||
# Find where first mysql_fix_privilege_tables.sql is located
|
||||
for i in $basedir/support-files $basedir/share $basedir/share/mysql \
|
||||
$basedir/scripts $pkgdatadir . "$dirname"
|
||||
do
|
||||
if test -f $i/$file
|
||||
then
|
||||
pkgdatadir=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
sql_file="$pkgdatadir/$file"
|
||||
if test ! -f $sql_file
|
||||
then
|
||||
echo "Could not find file '$file'."
|
||||
echo "Please use --basedir to specify the directory where MySQL is installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
s_echo()
|
||||
{
|
||||
if test $sql_only = 0
|
||||
then
|
||||
echo $1
|
||||
fi
|
||||
}
|
||||
|
||||
s_echo "This script updates all the mysql privilege tables to be usable by"
|
||||
s_echo "the current version of MySQL"
|
||||
s_echo ""
|
||||
|
||||
if test $verbose = 1
|
||||
then
|
||||
s_echo "You can safely ignore all 'Duplicate column' and 'Unknown column' errors"
|
||||
s_echo "because these just mean that your tables are already up to date."
|
||||
s_echo "This script is safe to run even if your tables are already up to date!"
|
||||
s_echo ""
|
||||
fi
|
||||
|
||||
run_cmd() {
|
||||
# Password argument is added here to allow for spaces in password.
|
||||
|
||||
if test ! -z "$password"
|
||||
then
|
||||
cat $sql_file | $cmd --password="$password"
|
||||
else
|
||||
cat $sql_file | $cmd
|
||||
fi
|
||||
}
|
||||
|
||||
if test $verbose = 0
|
||||
then
|
||||
run_cmd > /dev/null 2>&1
|
||||
else
|
||||
run_cmd > /dev/null
|
||||
fi
|
||||
if test $? = 0
|
||||
then
|
||||
s_echo "done"
|
||||
else
|
||||
s_echo "Got a failure from command:"
|
||||
s_echo "cat $sql_file | $cmd"
|
||||
s_echo "Please check the above output and try again."
|
||||
if test $verbose = 0
|
||||
then
|
||||
s_echo ""
|
||||
s_echo "Running the script with the --verbose option may give you some information"
|
||||
s_echo "of what went wrong."
|
||||
fi
|
||||
s_echo ""
|
||||
s_echo "If you get an 'Access denied' error, you should run this script again and"
|
||||
s_echo "give the MySQL root user password as an argument with the --password= option"
|
||||
fi
|
|
@ -5,10 +5,6 @@
|
|||
# because these just mean that your tables are already up to date.
|
||||
# This script is safe to run even if your tables are already up to date!
|
||||
|
||||
# On unix, you should use the mysql_fix_privilege_tables script to execute
|
||||
# this sql script.
|
||||
# On windows you should do 'mysql --force mysql < mysql_fix_privilege_tables.sql'
|
||||
|
||||
set sql_mode='';
|
||||
set storage_engine=MyISAM;
|
||||
|
||||
|
|
|
@ -699,7 +699,7 @@ fi
|
|||
|
||||
cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS"
|
||||
|
||||
plugin_dir="${PLUGIN_DIR:-@PLUGINDIR@}${PLUGIN_VARIANT}"
|
||||
plugin_dir="${PLUGIN_DIR:-@pkgplugindir@}${PLUGIN_VARIANT}"
|
||||
|
||||
for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
|
||||
"--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2004-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#include "mysql_priv.h"
|
||||
#include "events.h"
|
||||
|
@ -367,15 +367,14 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
|
|||
{
|
||||
sql_print_error("Event Error: An error occurred while creating query string, "
|
||||
"before writing it into binary log.");
|
||||
/* Restore the state of binlog format */
|
||||
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(TRUE);
|
||||
ret= TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the definer is not set or set to CURRENT_USER, the value of CURRENT_USER
|
||||
will be written into the binary log as the definer for the SQL thread. */
|
||||
ret= write_bin_log(thd, TRUE, log_query.c_ptr(), log_query.length());
|
||||
}
|
||||
/* If the definer is not set or set to CURRENT_USER, the value of CURRENT_USER
|
||||
will be written into the binary log as the definer for the SQL thread. */
|
||||
ret= write_bin_log(thd, TRUE, log_query.c_ptr(), log_query.length());
|
||||
}
|
||||
}
|
||||
mysql_mutex_unlock(&LOCK_event_metadata);
|
||||
|
@ -1017,7 +1016,11 @@ Events::dump_internal_status()
|
|||
puts("LLA = Last Locked At LUA = Last Unlocked At");
|
||||
puts("WOC = Waiting On Condition DL = Data Locked");
|
||||
|
||||
mysql_mutex_lock(&LOCK_event_metadata);
|
||||
/*
|
||||
opt_event_scheduler should only be accessed while
|
||||
holding LOCK_global_system_variables.
|
||||
*/
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
if (opt_event_scheduler == EVENTS_DISABLED)
|
||||
puts("The Event Scheduler is disabled");
|
||||
else
|
||||
|
@ -1026,7 +1029,7 @@ Events::dump_internal_status()
|
|||
event_queue->dump_internal_status();
|
||||
}
|
||||
|
||||
mysql_mutex_unlock(&LOCK_event_metadata);
|
||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef _EVENT_H_
|
||||
#define _EVENT_H_
|
||||
/* Copyright (C) 2004-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -13,7 +13,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/**
|
||||
@defgroup Event_Scheduler Event Scheduler
|
||||
|
@ -83,6 +83,7 @@ public:
|
|||
See sys_var.cc
|
||||
*/
|
||||
enum enum_opt_event_scheduler { EVENTS_OFF, EVENTS_ON, EVENTS_DISABLED };
|
||||
/* Protected using LOCK_global_system_variables only. */
|
||||
static uint opt_event_scheduler;
|
||||
static mysql_mutex_t LOCK_event_metadata;
|
||||
static bool check_if_system_tables_error();
|
||||
|
@ -106,9 +107,6 @@ public:
|
|||
static void
|
||||
destroy_mutexes();
|
||||
|
||||
static bool
|
||||
switch_event_scheduler_state(enum enum_opt_event_scheduler new_state);
|
||||
|
||||
static bool
|
||||
create_event(THD *thd, Event_parse_data *parse_data, bool if_exists);
|
||||
|
||||
|
|
|
@ -2346,7 +2346,6 @@ static int open_ndb_binlog_index(THD *thd, TABLE **ndb_binlog_index)
|
|||
thd->proc_info= "Opening " NDB_REP_DB "." NDB_REP_TABLE;
|
||||
|
||||
tables->required_type= FRMTYPE_TABLE;
|
||||
uint counter;
|
||||
thd->clear_error();
|
||||
if (open_and_lock_tables(thd, tables, FALSE, 0))
|
||||
{
|
||||
|
@ -2374,7 +2373,6 @@ int ndb_add_ndb_binlog_index(THD *thd, void *_row)
|
|||
{
|
||||
ndb_binlog_index_row &row= *(ndb_binlog_index_row *) _row;
|
||||
int error= 0;
|
||||
bool need_reopen;
|
||||
/*
|
||||
Turn of binlogging to prevent the table changes to be written to
|
||||
the binary log.
|
||||
|
|
|
@ -2946,9 +2946,7 @@ Create_func_cot Create_func_cot::s_singleton;
|
|||
Item*
|
||||
Create_func_cot::create(THD *thd, Item *arg1)
|
||||
{
|
||||
Item *i1= new (thd->mem_root) Item_int((char*) "1", 1, 1);
|
||||
Item *i2= new (thd->mem_root) Item_func_tan(arg1);
|
||||
return new (thd->mem_root) Item_func_div(i1, i2);
|
||||
return new (thd->mem_root) Item_func_cot(arg1);
|
||||
}
|
||||
|
||||
|
||||
|
|
329
sql/item_func.cc
329
sql/item_func.cc
|
@ -65,6 +65,14 @@ eval_const_cond(COND *cond)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Test if the sum of arguments overflows the ulonglong range.
|
||||
*/
|
||||
static inline bool test_if_sum_overflows_ull(ulonglong arg1, ulonglong arg2)
|
||||
{
|
||||
return ULONGLONG_MAX - arg1 < arg2;
|
||||
}
|
||||
|
||||
void Item_func::set_arguments(List<Item> &list)
|
||||
{
|
||||
allowed_arg_cols= 1;
|
||||
|
@ -1094,16 +1102,68 @@ double Item_func_plus::real_op()
|
|||
double value= args[0]->val_real() + args[1]->val_real();
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
return 0.0;
|
||||
return fix_result(value);
|
||||
return check_float_overflow(value);
|
||||
}
|
||||
|
||||
|
||||
longlong Item_func_plus::int_op()
|
||||
{
|
||||
longlong value=args[0]->val_int()+args[1]->val_int();
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
longlong val0= args[0]->val_int();
|
||||
longlong val1= args[1]->val_int();
|
||||
longlong res= val0 + val1;
|
||||
bool res_unsigned= FALSE;
|
||||
|
||||
if ((null_value= args[0]->null_value || args[1]->null_value))
|
||||
return 0;
|
||||
return value;
|
||||
|
||||
/*
|
||||
First check whether the result can be represented as a
|
||||
(bool unsigned_flag, longlong value) pair, then check if it is compatible
|
||||
with this Item's unsigned_flag by calling check_integer_overflow().
|
||||
*/
|
||||
if (args[0]->unsigned_flag)
|
||||
{
|
||||
if (args[1]->unsigned_flag || val1 >= 0)
|
||||
{
|
||||
if (test_if_sum_overflows_ull((ulonglong) val0, (ulonglong) val1))
|
||||
goto err;
|
||||
res_unsigned= TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* val1 is negative */
|
||||
if ((ulonglong) val0 > (ulonglong) LONGLONG_MAX)
|
||||
res_unsigned= TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args[1]->unsigned_flag)
|
||||
{
|
||||
if (val0 >= 0)
|
||||
{
|
||||
if (test_if_sum_overflows_ull((ulonglong) val0, (ulonglong) val1))
|
||||
goto err;
|
||||
res_unsigned= TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ulonglong) val1 > (ulonglong) LONGLONG_MAX)
|
||||
res_unsigned= TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (val0 >=0 && val1 >= 0)
|
||||
res_unsigned= TRUE;
|
||||
else if (val0 < 0 && val1 < 0 && res >= 0)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
return check_integer_overflow(res, res_unsigned);
|
||||
|
||||
err:
|
||||
return raise_integer_overflow();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1127,8 +1187,10 @@ my_decimal *Item_func_plus::decimal_op(my_decimal *decimal_value)
|
|||
return 0;
|
||||
val2= args[1]->val_decimal(&value2);
|
||||
if (!(null_value= (args[1]->null_value ||
|
||||
(my_decimal_add(E_DEC_FATAL_ERROR, decimal_value, val1,
|
||||
val2) > 3))))
|
||||
check_decimal_overflow(my_decimal_add(E_DEC_FATAL_ERROR &
|
||||
~E_DEC_OVERFLOW,
|
||||
decimal_value,
|
||||
val1, val2)) > 3)))
|
||||
return decimal_value;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1172,16 +1234,71 @@ double Item_func_minus::real_op()
|
|||
double value= args[0]->val_real() - args[1]->val_real();
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
return 0.0;
|
||||
return fix_result(value);
|
||||
return check_float_overflow(value);
|
||||
}
|
||||
|
||||
|
||||
longlong Item_func_minus::int_op()
|
||||
{
|
||||
longlong value=args[0]->val_int() - args[1]->val_int();
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
longlong val0= args[0]->val_int();
|
||||
longlong val1= args[1]->val_int();
|
||||
longlong res= val0 - val1;
|
||||
bool res_unsigned= FALSE;
|
||||
|
||||
if ((null_value= args[0]->null_value || args[1]->null_value))
|
||||
return 0;
|
||||
return value;
|
||||
|
||||
/*
|
||||
First check whether the result can be represented as a
|
||||
(bool unsigned_flag, longlong value) pair, then check if it is compatible
|
||||
with this Item's unsigned_flag by calling check_integer_overflow().
|
||||
*/
|
||||
if (args[0]->unsigned_flag)
|
||||
{
|
||||
if (args[1]->unsigned_flag)
|
||||
{
|
||||
if ((ulonglong) val0 < (ulonglong) val1)
|
||||
{
|
||||
if (res >= 0)
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
res_unsigned= TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (val1 >= 0)
|
||||
{
|
||||
if ((ulonglong) val0 > (ulonglong) val1)
|
||||
res_unsigned= TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (test_if_sum_overflows_ull((ulonglong) val0, (ulonglong) -val1))
|
||||
goto err;
|
||||
res_unsigned= TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args[1]->unsigned_flag)
|
||||
{
|
||||
if ((ulonglong) (val0 - LONGLONG_MIN) < (ulonglong) val1)
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (val0 > 0 && val1 < 0)
|
||||
res_unsigned= TRUE;
|
||||
else if (val0 < 0 && val1 > 0 && res >= 0)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
return check_integer_overflow(res, res_unsigned);
|
||||
|
||||
err:
|
||||
return raise_integer_overflow();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1199,8 +1316,10 @@ my_decimal *Item_func_minus::decimal_op(my_decimal *decimal_value)
|
|||
return 0;
|
||||
val2= args[1]->val_decimal(&value2);
|
||||
if (!(null_value= (args[1]->null_value ||
|
||||
(my_decimal_sub(E_DEC_FATAL_ERROR, decimal_value, val1,
|
||||
val2) > 3))))
|
||||
(check_decimal_overflow(my_decimal_sub(E_DEC_FATAL_ERROR &
|
||||
~E_DEC_OVERFLOW,
|
||||
decimal_value, val1,
|
||||
val2)) > 3))))
|
||||
return decimal_value;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1212,17 +1331,86 @@ double Item_func_mul::real_op()
|
|||
double value= args[0]->val_real() * args[1]->val_real();
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
return 0.0;
|
||||
return fix_result(value);
|
||||
return check_float_overflow(value);
|
||||
}
|
||||
|
||||
|
||||
longlong Item_func_mul::int_op()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
longlong value=args[0]->val_int()*args[1]->val_int();
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
longlong a= args[0]->val_int();
|
||||
longlong b= args[1]->val_int();
|
||||
longlong res;
|
||||
ulonglong res0, res1;
|
||||
ulong a0, a1, b0, b1;
|
||||
bool res_unsigned= FALSE;
|
||||
bool a_negative= FALSE, b_negative= FALSE;
|
||||
|
||||
if ((null_value= args[0]->null_value || args[1]->null_value))
|
||||
return 0;
|
||||
return value;
|
||||
|
||||
/*
|
||||
First check whether the result can be represented as a
|
||||
(bool unsigned_flag, longlong value) pair, then check if it is compatible
|
||||
with this Item's unsigned_flag by calling check_integer_overflow().
|
||||
|
||||
Let a = a1 * 2^32 + a0 and b = b1 * 2^32 + b0. Then
|
||||
a * b = (a1 * 2^32 + a0) * (b1 * 2^32 + b0) = a1 * b1 * 2^64 +
|
||||
+ (a1 * b0 + a0 * b1) * 2^32 + a0 * b0;
|
||||
We can determine if the above sum overflows the ulonglong range by
|
||||
sequentially checking the following conditions:
|
||||
1. If both a1 and b1 are non-zero.
|
||||
2. Otherwise, if (a1 * b0 + a0 * b1) is greater than ULONG_MAX.
|
||||
3. Otherwise, if (a1 * b0 + a0 * b1) * 2^32 + a0 * b0 is greater than
|
||||
ULONGLONG_MAX.
|
||||
|
||||
Since we also have to take the unsigned_flag for a and b into account,
|
||||
it is easier to first work with absolute values and set the
|
||||
correct sign later.
|
||||
*/
|
||||
if (!args[0]->unsigned_flag && a < 0)
|
||||
{
|
||||
a_negative= TRUE;
|
||||
a= -a;
|
||||
}
|
||||
if (!args[1]->unsigned_flag && b < 0)
|
||||
{
|
||||
b_negative= TRUE;
|
||||
b= -b;
|
||||
}
|
||||
|
||||
a0= 0xFFFFFFFFUL & a;
|
||||
a1= ((ulonglong) a) >> 32;
|
||||
b0= 0xFFFFFFFFUL & b;
|
||||
b1= ((ulonglong) b) >> 32;
|
||||
|
||||
if (a1 && b1)
|
||||
goto err;
|
||||
|
||||
res1= (ulonglong) a1 * b0 + (ulonglong) a0 * b1;
|
||||
if (res1 > 0xFFFFFFFFUL)
|
||||
goto err;
|
||||
|
||||
res1= res1 << 32;
|
||||
res0= (ulonglong) a0 * b0;
|
||||
|
||||
if (test_if_sum_overflows_ull(res1, res0))
|
||||
goto err;
|
||||
res= res1 + res0;
|
||||
|
||||
if (a_negative != b_negative)
|
||||
{
|
||||
if ((ulonglong) res > (ulonglong) LONGLONG_MIN + 1)
|
||||
goto err;
|
||||
res= -res;
|
||||
}
|
||||
else
|
||||
res_unsigned= TRUE;
|
||||
|
||||
return check_integer_overflow(res, res_unsigned);
|
||||
|
||||
err:
|
||||
return raise_integer_overflow();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1237,8 +1425,10 @@ my_decimal *Item_func_mul::decimal_op(my_decimal *decimal_value)
|
|||
return 0;
|
||||
val2= args[1]->val_decimal(&value2);
|
||||
if (!(null_value= (args[1]->null_value ||
|
||||
(my_decimal_mul(E_DEC_FATAL_ERROR, decimal_value, val1,
|
||||
val2) > 3))))
|
||||
(check_decimal_overflow(my_decimal_mul(E_DEC_FATAL_ERROR &
|
||||
~E_DEC_OVERFLOW,
|
||||
decimal_value, val1,
|
||||
val2)) > 3))))
|
||||
return decimal_value;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1271,7 +1461,7 @@ double Item_func_div::real_op()
|
|||
signal_divide_by_null();
|
||||
return 0.0;
|
||||
}
|
||||
return fix_result(value/val2);
|
||||
return check_float_overflow(value/val2);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1287,8 +1477,12 @@ my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value)
|
|||
val2= args[1]->val_decimal(&value2);
|
||||
if ((null_value= args[1]->null_value))
|
||||
return 0;
|
||||
if ((err= my_decimal_div(E_DEC_FATAL_ERROR & ~E_DEC_DIV_ZERO, decimal_value,
|
||||
val1, val2, prec_increment)) > 3)
|
||||
if ((err= check_decimal_overflow(my_decimal_div(E_DEC_FATAL_ERROR &
|
||||
~E_DEC_OVERFLOW &
|
||||
~E_DEC_DIV_ZERO,
|
||||
decimal_value,
|
||||
val1, val2,
|
||||
prec_increment))) > 3)
|
||||
{
|
||||
if (err == E_DEC_DIV_ZERO)
|
||||
signal_divide_by_null();
|
||||
|
@ -1379,22 +1573,35 @@ longlong Item_func_int_div::val_int()
|
|||
|
||||
if (my_decimal2int(E_DEC_FATAL_ERROR, &tmp, unsigned_flag, &res) &
|
||||
E_DEC_OVERFLOW)
|
||||
my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), name, 1);
|
||||
raise_integer_overflow();
|
||||
return res;
|
||||
}
|
||||
|
||||
longlong value=args[0]->val_int();
|
||||
longlong val2=args[1]->val_int();
|
||||
longlong val0=args[0]->val_int();
|
||||
longlong val1=args[1]->val_int();
|
||||
bool val0_negative, val1_negative, res_negative;
|
||||
ulonglong uval0, uval1, res;
|
||||
if ((null_value= (args[0]->null_value || args[1]->null_value)))
|
||||
return 0;
|
||||
if (val2 == 0)
|
||||
if (val1 == 0)
|
||||
{
|
||||
signal_divide_by_null();
|
||||
return 0;
|
||||
}
|
||||
return (unsigned_flag ?
|
||||
(ulonglong) value / (ulonglong) val2 :
|
||||
value / val2);
|
||||
|
||||
val0_negative= !args[0]->unsigned_flag && val0 < 0;
|
||||
val1_negative= !args[1]->unsigned_flag && val1 < 0;
|
||||
res_negative= val0_negative != val1_negative;
|
||||
uval0= (ulonglong) (val0_negative ? -val0 : val0);
|
||||
uval1= (ulonglong) (val1_negative ? -val1 : val1);
|
||||
res= uval0 / uval1;
|
||||
if (res_negative)
|
||||
{
|
||||
if (res > (ulonglong) LONGLONG_MAX)
|
||||
return raise_integer_overflow();
|
||||
res= (ulonglong) (-(longlong) res);
|
||||
}
|
||||
return check_integer_overflow(res, !res_negative);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1413,26 +1620,32 @@ void Item_func_int_div::fix_length_and_dec()
|
|||
longlong Item_func_mod::int_op()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
longlong value= args[0]->val_int();
|
||||
longlong val2= args[1]->val_int();
|
||||
longlong result;
|
||||
longlong val0= args[0]->val_int();
|
||||
longlong val1= args[1]->val_int();
|
||||
bool val0_negative, val1_negative;
|
||||
ulonglong uval0, uval1;
|
||||
ulonglong res;
|
||||
|
||||
if ((null_value= args[0]->null_value || args[1]->null_value))
|
||||
return 0; /* purecov: inspected */
|
||||
if (val2 == 0)
|
||||
if (val1 == 0)
|
||||
{
|
||||
signal_divide_by_null();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (args[0]->unsigned_flag)
|
||||
result= args[1]->unsigned_flag ?
|
||||
((ulonglong) value) % ((ulonglong) val2) : ((ulonglong) value) % val2;
|
||||
else
|
||||
result= args[1]->unsigned_flag ?
|
||||
value % ((ulonglong) val2) : value % val2;
|
||||
|
||||
return result;
|
||||
/*
|
||||
'%' is calculated by integer division internally. Since dividing
|
||||
LONGLONG_MIN by -1 generates SIGFPE, we calculate using unsigned values and
|
||||
then adjust the sign appropriately.
|
||||
*/
|
||||
val0_negative= !args[0]->unsigned_flag && val0 < 0;
|
||||
val1_negative= !args[1]->unsigned_flag && val1 < 0;
|
||||
uval0= (ulonglong) (val0_negative ? -val0 : val0);
|
||||
uval1= (ulonglong) (val1_negative ? -val1 : val1);
|
||||
res= uval0 % uval1;
|
||||
return check_integer_overflow(val0_negative ? -(longlong) res : res,
|
||||
!val0_negative);
|
||||
}
|
||||
|
||||
double Item_func_mod::real_op()
|
||||
|
@ -1502,8 +1715,12 @@ double Item_func_neg::real_op()
|
|||
longlong Item_func_neg::int_op()
|
||||
{
|
||||
longlong value= args[0]->val_int();
|
||||
null_value= args[0]->null_value;
|
||||
return -value;
|
||||
if ((null_value= args[0]->null_value))
|
||||
return 0;
|
||||
if (args[0]->unsigned_flag &&
|
||||
(ulonglong) value > (ulonglong) LONGLONG_MAX + 1)
|
||||
return raise_integer_overflow();
|
||||
return check_integer_overflow(-value, !args[0]->unsigned_flag && value < 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1572,7 +1789,12 @@ longlong Item_func_abs::int_op()
|
|||
longlong value= args[0]->val_int();
|
||||
if ((null_value= args[0]->null_value))
|
||||
return 0;
|
||||
return (value >= 0) || unsigned_flag ? value : -value;
|
||||
if (unsigned_flag)
|
||||
return value;
|
||||
/* -LONGLONG_MIN = LONGLONG_MAX + 1 => outside of signed longlong range */
|
||||
if (value == LONGLONG_MIN)
|
||||
return raise_integer_overflow();
|
||||
return (value >= 0) ? value : -value;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1679,7 +1901,7 @@ double Item_func_exp::val_real()
|
|||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0.0; /* purecov: inspected */
|
||||
return fix_result(exp(value));
|
||||
return check_float_overflow(exp(value));
|
||||
}
|
||||
|
||||
double Item_func_sqrt::val_real()
|
||||
|
@ -1698,7 +1920,7 @@ double Item_func_pow::val_real()
|
|||
double val2= args[1]->val_real();
|
||||
if ((null_value=(args[0]->null_value || args[1]->null_value)))
|
||||
return 0.0; /* purecov: inspected */
|
||||
return fix_result(pow(value,val2));
|
||||
return check_float_overflow(pow(value,val2));
|
||||
}
|
||||
|
||||
// Trigonometric functions
|
||||
|
@ -1734,7 +1956,7 @@ double Item_func_atan::val_real()
|
|||
double val2= args[1]->val_real();
|
||||
if ((null_value=args[1]->null_value))
|
||||
return 0.0;
|
||||
return fix_result(atan2(value,val2));
|
||||
return check_float_overflow(atan2(value,val2));
|
||||
}
|
||||
return atan(value);
|
||||
}
|
||||
|
@ -1763,7 +1985,17 @@ double Item_func_tan::val_real()
|
|||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0.0;
|
||||
return fix_result(tan(value));
|
||||
return check_float_overflow(tan(value));
|
||||
}
|
||||
|
||||
|
||||
double Item_func_cot::val_real()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0.0;
|
||||
return check_float_overflow(1.0 / tan(value));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2238,7 +2470,7 @@ double Item_func_units::val_real()
|
|||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0;
|
||||
return value*mul+add;
|
||||
return check_float_overflow(value * mul + add);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4766,6 +4998,7 @@ int get_var_with_binlog(THD *thd, enum_sql_command sql_command,
|
|||
user_var_event->user_var_event= var_entry;
|
||||
user_var_event->type= var_entry->type;
|
||||
user_var_event->charset_number= var_entry->collation.collation->number;
|
||||
user_var_event->unsigned_flag= var_entry->unsigned_flag;
|
||||
if (!var_entry->value)
|
||||
{
|
||||
/* NULL value*/
|
||||
|
|
|
@ -187,13 +187,56 @@ public:
|
|||
void * arg, traverse_order order);
|
||||
bool is_expensive_processor(uchar *arg);
|
||||
virtual bool is_expensive() { return 0; }
|
||||
inline double fix_result(double value)
|
||||
inline void raise_numeric_overflow(const char *type_name)
|
||||
{
|
||||
if (isfinite(value))
|
||||
return value;
|
||||
null_value=1;
|
||||
char buf[256];
|
||||
String str(buf, sizeof(buf), system_charset_info);
|
||||
str.length(0);
|
||||
print(&str, QT_ORDINARY);
|
||||
my_error(ER_DATA_OUT_OF_RANGE, MYF(0), type_name, str.c_ptr_safe());
|
||||
}
|
||||
inline double raise_float_overflow()
|
||||
{
|
||||
raise_numeric_overflow("DOUBLE");
|
||||
return 0.0;
|
||||
}
|
||||
inline longlong raise_integer_overflow()
|
||||
{
|
||||
raise_numeric_overflow(unsigned_flag ? "BIGINT UNSIGNED": "BIGINT");
|
||||
return 0;
|
||||
}
|
||||
inline int raise_decimal_overflow()
|
||||
{
|
||||
raise_numeric_overflow("DECIMAL");
|
||||
return E_DEC_OVERFLOW;
|
||||
}
|
||||
/**
|
||||
Throw an error if the input double number is not finite, i.e. is either
|
||||
+/-INF or NAN.
|
||||
*/
|
||||
inline double check_float_overflow(double value)
|
||||
{
|
||||
return isfinite(value) ? value : raise_float_overflow();
|
||||
}
|
||||
/**
|
||||
Throw an error if the input BIGINT value represented by the
|
||||
(longlong value, bool unsigned flag) pair cannot be returned by the
|
||||
function, i.e. is not compatible with this Item's unsigned_flag.
|
||||
*/
|
||||
inline longlong check_integer_overflow(longlong value, bool val_unsigned)
|
||||
{
|
||||
if ((unsigned_flag && !val_unsigned && value < 0) ||
|
||||
(!unsigned_flag && val_unsigned && (ulonglong) value > LONGLONG_MAX))
|
||||
return raise_integer_overflow();
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
Throw an error if the error code of a DECIMAL operation is E_DEC_OVERFLOW.
|
||||
*/
|
||||
inline int check_decimal_overflow(int error)
|
||||
{
|
||||
return (error == E_DEC_OVERFLOW) ? raise_decimal_overflow() : error;
|
||||
}
|
||||
bool has_timestamp_args()
|
||||
{
|
||||
DBUG_ASSERT(fixed == TRUE);
|
||||
|
@ -667,6 +710,14 @@ public:
|
|||
const char *func_name() const { return "tan"; }
|
||||
};
|
||||
|
||||
class Item_func_cot :public Item_dec_func
|
||||
{
|
||||
public:
|
||||
Item_func_cot(Item *a) :Item_dec_func(a) {}
|
||||
double val_real();
|
||||
const char *func_name() const { return "cot"; }
|
||||
};
|
||||
|
||||
class Item_func_integer :public Item_int_func
|
||||
{
|
||||
public:
|
||||
|
|
152
sql/lock.cc
152
sql/lock.cc
|
@ -97,7 +97,7 @@ static void print_lock_error(int error, const char *);
|
|||
|
||||
/* Map the return value of thr_lock to an error from errmsg.txt */
|
||||
static int thr_lock_errno_to_mysql[]=
|
||||
{ 0, 1, ER_LOCK_WAIT_TIMEOUT, ER_LOCK_DEADLOCK };
|
||||
{ 0, ER_LOCK_ABORTED, ER_LOCK_WAIT_TIMEOUT, ER_LOCK_DEADLOCK };
|
||||
|
||||
/**
|
||||
Perform semantic checks for mysql_lock_tables.
|
||||
|
@ -108,8 +108,7 @@ static int thr_lock_errno_to_mysql[]=
|
|||
@return 0 if all the check passed, non zero if a check failed.
|
||||
*/
|
||||
static int
|
||||
lock_tables_check(THD *thd, TABLE **tables, uint count,
|
||||
bool *write_lock_used, uint flags)
|
||||
lock_tables_check(THD *thd, TABLE **tables, uint count, uint flags)
|
||||
{
|
||||
uint system_count, i;
|
||||
bool is_superuser, log_table_write_query;
|
||||
|
@ -117,10 +116,9 @@ lock_tables_check(THD *thd, TABLE **tables, uint count,
|
|||
DBUG_ENTER("lock_tables_check");
|
||||
|
||||
system_count= 0;
|
||||
*write_lock_used= FALSE;
|
||||
is_superuser= thd->security_ctx->master_access & SUPER_ACL;
|
||||
log_table_write_query= (is_log_table_write_query(thd->lex->sql_command)
|
||||
|| ((flags & MYSQL_LOCK_PERF_SCHEMA) != 0));
|
||||
|| ((flags & MYSQL_LOCK_LOG_TABLE) != 0));
|
||||
|
||||
for (i=0 ; i<count; i++)
|
||||
{
|
||||
|
@ -153,8 +151,6 @@ lock_tables_check(THD *thd, TABLE **tables, uint count,
|
|||
|
||||
if (t->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||
{
|
||||
*write_lock_used= TRUE;
|
||||
|
||||
if (t->s->table_category == TABLE_CATEGORY_SYSTEM)
|
||||
system_count++;
|
||||
|
||||
|
@ -273,141 +269,69 @@ static void reset_lock_data_and_free(MYSQL_LOCK **mysql_lock)
|
|||
@param tables An array of pointers to the tables to lock.
|
||||
@param count The number of tables to lock.
|
||||
@param flags Options:
|
||||
MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK Ignore a global read lock
|
||||
MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY Ignore SET GLOBAL READ_ONLY
|
||||
MYSQL_LOCK_IGNORE_FLUSH Ignore a flush tables.
|
||||
MYSQL_LOCK_IGNORE_TIMEOUT Use maximum timeout value.
|
||||
@param need_reopen Out parameter, TRUE if some tables were altered
|
||||
or deleted and should be reopened by caller.
|
||||
|
||||
@note Caller of this function should always be ready to handle request to
|
||||
reopen table unless there are external invariants which guarantee
|
||||
that such thing won't be needed (for example we are obtaining lock
|
||||
on table on which we already have exclusive metadata lock).
|
||||
|
||||
@retval A lock structure pointer on success.
|
||||
@retval NULL on error or if some tables should be reopen.
|
||||
@retval NULL if an error or if wait on a lock was killed.
|
||||
*/
|
||||
|
||||
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
|
||||
uint flags, bool *need_reopen)
|
||||
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, uint flags)
|
||||
{
|
||||
int rc;
|
||||
MYSQL_LOCK *sql_lock;
|
||||
bool write_lock_used;
|
||||
|
||||
DBUG_ENTER("mysql_lock_tables");
|
||||
|
||||
*need_reopen= FALSE;
|
||||
|
||||
if (lock_tables_check(thd, tables, count, &write_lock_used, flags))
|
||||
DBUG_RETURN (NULL);
|
||||
|
||||
ulong timeout= (flags & MYSQL_LOCK_IGNORE_TIMEOUT) ?
|
||||
LONG_TIMEOUT : thd->variables.lock_wait_timeout;
|
||||
|
||||
for (;;)
|
||||
DBUG_ENTER("mysql_lock_tables");
|
||||
|
||||
if (lock_tables_check(thd, tables, count, flags))
|
||||
DBUG_RETURN(NULL);
|
||||
|
||||
if (! (sql_lock= get_lock_data(thd, tables, count, GET_LOCK_STORE_LOCKS)))
|
||||
DBUG_RETURN(NULL);
|
||||
|
||||
thd_proc_info(thd, "System lock");
|
||||
DBUG_PRINT("info", ("thd->proc_info %s", thd->proc_info));
|
||||
if (sql_lock->table_count && lock_external(thd, sql_lock->table,
|
||||
sql_lock->table_count))
|
||||
{
|
||||
if (! (sql_lock= get_lock_data(thd, tables, count, GET_LOCK_STORE_LOCKS)))
|
||||
break;
|
||||
|
||||
if (global_read_lock && write_lock_used &&
|
||||
! (flags & MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK))
|
||||
{
|
||||
/*
|
||||
Someone has issued LOCK ALL TABLES FOR READ and we want a write lock
|
||||
Wait until the lock is gone
|
||||
*/
|
||||
if (thd->global_read_lock.wait_if_global_read_lock(thd, 1, 1))
|
||||
{
|
||||
/* Clear the lock type of all lock data to avoid reusage. */
|
||||
reset_lock_data_and_free(&sql_lock);
|
||||
break;
|
||||
}
|
||||
if (thd->version != refresh_version)
|
||||
{
|
||||
/* Clear the lock type of all lock data to avoid reusage. */
|
||||
reset_lock_data_and_free(&sql_lock);
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
||||
thd_proc_info(thd, "System lock");
|
||||
DBUG_PRINT("info", ("thd->proc_info %s", thd->proc_info));
|
||||
if (sql_lock->table_count && lock_external(thd, sql_lock->table,
|
||||
sql_lock->table_count))
|
||||
{
|
||||
/* Clear the lock type of all lock data to avoid reusage. */
|
||||
reset_lock_data_and_free(&sql_lock);
|
||||
break;
|
||||
}
|
||||
DBUG_PRINT("info", ("thd->proc_info %s", thd->proc_info));
|
||||
/* Copy the lock data array. thr_multi_lock() reorders its contens. */
|
||||
memcpy(sql_lock->locks + sql_lock->lock_count, sql_lock->locks,
|
||||
sql_lock->lock_count * sizeof(*sql_lock->locks));
|
||||
/* Lock on the copied half of the lock data array. */
|
||||
rc= thr_lock_errno_to_mysql[(int) thr_multi_lock(sql_lock->locks +
|
||||
sql_lock->lock_count,
|
||||
sql_lock->lock_count,
|
||||
thd->lock_id, timeout)];
|
||||
if (rc > 1) /* a timeout or a deadlock */
|
||||
{
|
||||
if (sql_lock->table_count)
|
||||
(void) unlock_external(thd, sql_lock->table, sql_lock->table_count);
|
||||
reset_lock_data_and_free(&sql_lock);
|
||||
my_error(rc, MYF(0));
|
||||
break;
|
||||
}
|
||||
else if (rc == 1) /* aborted or killed */
|
||||
{
|
||||
/*
|
||||
reset_lock_data is required here. If thr_multi_lock fails it
|
||||
resets lock type for tables, which were locked before (and
|
||||
including) one that caused error. Lock type for other tables
|
||||
preserved.
|
||||
*/
|
||||
reset_lock_data(sql_lock);
|
||||
sql_lock->lock_count= 0; // Locks are already freed
|
||||
// Fall through: unlock, reset lock data, free and retry
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Success */
|
||||
break;
|
||||
}
|
||||
thd_proc_info(thd, 0);
|
||||
|
||||
/* going to retry, unlock all tables */
|
||||
if (sql_lock->lock_count)
|
||||
thr_multi_unlock(sql_lock->locks, sql_lock->lock_count);
|
||||
/* Clear the lock type of all lock data to avoid reusage. */
|
||||
reset_lock_data_and_free(&sql_lock);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Copy the lock data array. thr_multi_lock() reorders its contents. */
|
||||
memcpy(sql_lock->locks + sql_lock->lock_count, sql_lock->locks,
|
||||
sql_lock->lock_count * sizeof(*sql_lock->locks));
|
||||
/* Lock on the copied half of the lock data array. */
|
||||
rc= thr_lock_errno_to_mysql[(int) thr_multi_lock(sql_lock->locks +
|
||||
sql_lock->lock_count,
|
||||
sql_lock->lock_count,
|
||||
thd->lock_id, timeout)];
|
||||
if (rc)
|
||||
{
|
||||
if (sql_lock->table_count)
|
||||
(void) unlock_external(thd, sql_lock->table, sql_lock->table_count);
|
||||
|
||||
/*
|
||||
If thr_multi_lock fails it resets lock type for tables, which
|
||||
were locked before (and including) one that caused error. Lock
|
||||
type for other tables preserved.
|
||||
*/
|
||||
reset_lock_data_and_free(&sql_lock);
|
||||
retry:
|
||||
/* Let upper level close all used tables and retry or give error. */
|
||||
*need_reopen= TRUE;
|
||||
break;
|
||||
if (! thd->killed)
|
||||
my_error(rc, MYF(0));
|
||||
}
|
||||
end:
|
||||
thd_proc_info(thd, 0);
|
||||
|
||||
if (thd->killed)
|
||||
{
|
||||
thd->send_kill_message();
|
||||
if (sql_lock)
|
||||
{
|
||||
mysql_unlock_tables(thd,sql_lock);
|
||||
sql_lock=0;
|
||||
mysql_unlock_tables(thd, sql_lock);
|
||||
sql_lock= 0;
|
||||
}
|
||||
}
|
||||
|
||||
thd->set_time_after_lock();
|
||||
DBUG_RETURN (sql_lock);
|
||||
DBUG_RETURN(sql_lock);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4671,7 +4671,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
|
|||
|
||||
/* setting flags for user var log event */
|
||||
uchar flags= User_var_log_event::UNDEF_F;
|
||||
if (user_var_event->user_var_event->unsigned_flag)
|
||||
if (user_var_event->unsigned_flag)
|
||||
flags|= User_var_log_event::UNSIGNED_F;
|
||||
|
||||
User_var_log_event e(thd, user_var_event->user_var_event->name.str,
|
||||
|
|
|
@ -1455,8 +1455,6 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
|
|||
*/
|
||||
if (!thd->lock)
|
||||
{
|
||||
bool need_reopen= 1; /* To execute the first lap of the loop below */
|
||||
|
||||
/*
|
||||
lock_tables() reads the contents of thd->lex, so they must be
|
||||
initialized. Contrary to in
|
||||
|
@ -1465,80 +1463,31 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
|
|||
*/
|
||||
lex_start(thd);
|
||||
|
||||
while ((error= lock_tables(thd, rli->tables_to_lock,
|
||||
rli->tables_to_lock_count, 0,
|
||||
&need_reopen)))
|
||||
if ((error= lock_tables(thd, rli->tables_to_lock,
|
||||
rli->tables_to_lock_count, 0)))
|
||||
{
|
||||
if (!need_reopen)
|
||||
if (thd->is_slave_error || thd->is_fatal_error)
|
||||
{
|
||||
if (thd->is_slave_error || thd->is_fatal_error)
|
||||
{
|
||||
/*
|
||||
Error reporting borrowed from Query_log_event with many excessive
|
||||
simplifications (we don't honour --slave-skip-errors)
|
||||
*/
|
||||
uint actual_error= thd->net.last_errno;
|
||||
rli->report(ERROR_LEVEL, actual_error,
|
||||
"Error '%s' in %s event: when locking tables",
|
||||
(actual_error ? thd->net.last_error :
|
||||
"unexpected success or fatal error"),
|
||||
get_type_str());
|
||||
thd->is_fatal_error= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
rli->report(ERROR_LEVEL, error,
|
||||
"Error in %s event: when locking tables",
|
||||
get_type_str());
|
||||
}
|
||||
const_cast<Relay_log_info*>(rli)->slave_close_thread_tables(thd);
|
||||
DBUG_RETURN(error);
|
||||
/*
|
||||
Error reporting borrowed from Query_log_event with many excessive
|
||||
simplifications (we don't honour --slave-skip-errors)
|
||||
*/
|
||||
uint actual_error= thd->net.last_errno;
|
||||
rli->report(ERROR_LEVEL, actual_error,
|
||||
"Error '%s' in %s event: when locking tables",
|
||||
(actual_error ? thd->net.last_error :
|
||||
"unexpected success or fatal error"),
|
||||
get_type_str());
|
||||
thd->is_fatal_error= 1;
|
||||
}
|
||||
|
||||
/*
|
||||
So we need to reopen the tables.
|
||||
|
||||
We need to flush the pending RBR event, since it keeps a
|
||||
pointer to an open table.
|
||||
|
||||
ALTERNATIVE SOLUTION (not implemented): Extract a pointer to
|
||||
the pending RBR event and reset the table pointer after the
|
||||
tables has been reopened.
|
||||
|
||||
NOTE: For this new scheme there should be no pending event:
|
||||
need to add code to assert that is the case.
|
||||
*/
|
||||
error= thd->binlog_flush_pending_rows_event(FALSE);
|
||||
if (error)
|
||||
else
|
||||
{
|
||||
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
|
||||
ER(ER_SLAVE_FATAL_ERROR),
|
||||
"call to binlog_flush_pending_rows_event() failed");
|
||||
thd->is_slave_error= 1;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
TABLE_LIST *tables= rli->tables_to_lock;
|
||||
close_tables_for_reopen(thd, &tables, NULL);
|
||||
|
||||
uint tables_count= rli->tables_to_lock_count;
|
||||
if ((error= open_tables(thd, &tables, &tables_count, 0)))
|
||||
{
|
||||
if (thd->is_slave_error || thd->is_fatal_error)
|
||||
{
|
||||
/*
|
||||
Error reporting borrowed from Query_log_event with many excessive
|
||||
simplifications (we don't honour --slave-skip-errors)
|
||||
*/
|
||||
uint actual_error= thd->net.last_errno;
|
||||
rli->report(ERROR_LEVEL, actual_error,
|
||||
"Error '%s' on reopening tables",
|
||||
(actual_error ? thd->net.last_error :
|
||||
"unexpected success or fatal error"));
|
||||
thd->is_slave_error= 1;
|
||||
}
|
||||
const_cast<Relay_log_info*>(rli)->slave_close_thread_tables(thd);
|
||||
DBUG_RETURN(error);
|
||||
rli->report(ERROR_LEVEL, error,
|
||||
"Error in %s event: when locking tables",
|
||||
get_type_str());
|
||||
}
|
||||
const_cast<Relay_log_info*>(rli)->slave_close_thread_tables(thd);
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1590,8 +1590,7 @@ inline bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
|
|||
TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l,
|
||||
thr_lock_type lock_type, uint flags);
|
||||
bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags);
|
||||
bool lock_tables(THD *thd, TABLE_LIST *tables, uint counter, uint flags,
|
||||
bool *need_reopen);
|
||||
bool lock_tables(THD *thd, TABLE_LIST *tables, uint counter, uint flags);
|
||||
TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
|
||||
const char *table_name, bool link_in_list);
|
||||
bool rm_temporary_table(handlerton *base, char *path);
|
||||
|
@ -2145,14 +2144,13 @@ extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
|
|||
extern struct st_VioSSLFd * ssl_acceptor_fd;
|
||||
#endif /* HAVE_OPENSSL */
|
||||
|
||||
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count,
|
||||
uint flags, bool *need_reopen);
|
||||
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count, uint flags);
|
||||
/* mysql_lock_tables() and open_table() flags bits */
|
||||
#define MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK 0x0001
|
||||
#define MYSQL_LOCK_IGNORE_FLUSH 0x0002
|
||||
#define MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK 0x0001
|
||||
#define MYSQL_OPEN_IGNORE_FLUSH 0x0002
|
||||
#define MYSQL_OPEN_TEMPORARY_ONLY 0x0004
|
||||
#define MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY 0x0008
|
||||
#define MYSQL_LOCK_PERF_SCHEMA 0x0010
|
||||
#define MYSQL_LOCK_LOG_TABLE 0x0010
|
||||
#define MYSQL_OPEN_TAKE_UPGRADABLE_MDL 0x0020
|
||||
/**
|
||||
Do not try to acquire a metadata lock on the table: we
|
||||
|
@ -2182,8 +2180,8 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count,
|
|||
#define MYSQL_LOCK_IGNORE_TIMEOUT 0x1000
|
||||
|
||||
/** Please refer to the internals manual. */
|
||||
#define MYSQL_OPEN_REOPEN (MYSQL_LOCK_IGNORE_FLUSH |\
|
||||
MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK |\
|
||||
#define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\
|
||||
MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |\
|
||||
MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |\
|
||||
MYSQL_LOCK_IGNORE_TIMEOUT |\
|
||||
MYSQL_OPEN_GET_NEW_TABLE |\
|
||||
|
|
|
@ -6321,3 +6321,9 @@ ER_SPATIAL_MUST_HAVE_GEOM_COL 42000
|
|||
|
||||
ER_TOO_LONG_INDEX_COMMENT
|
||||
eng "Comment for index '%-.64s' is too long (max = %lu)"
|
||||
|
||||
ER_LOCK_ABORTED
|
||||
eng "Wait on a lock was aborted due to a pending exclusive lock"
|
||||
|
||||
ER_DATA_OUT_OF_RANGE 22003
|
||||
eng "%s value is out of range in '%s'"
|
||||
|
|
145
sql/sql_base.cc
145
sql/sql_base.cc
|
@ -2421,7 +2421,7 @@ open_table_get_mdl_lock(THD *thd, TABLE_LIST *table_list,
|
|||
required to remedy problem appeared during attempt
|
||||
to open table.
|
||||
flags Bitmap of flags to modify how open works:
|
||||
MYSQL_LOCK_IGNORE_FLUSH - Open table even if
|
||||
MYSQL_OPEN_IGNORE_FLUSH - Open table even if
|
||||
someone has done a flush or there is a pending
|
||||
exclusive metadata lock requests against it
|
||||
(i.e. request high priority metadata lock).
|
||||
|
@ -2479,6 +2479,31 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
|||
key_length= (create_table_def_key(thd, key, table_list, 1) -
|
||||
TMP_TABLE_KEY_EXTRA);
|
||||
|
||||
/*
|
||||
We need this to work for all tables, including temporary
|
||||
tables, for backwards compatibility. But not under LOCK
|
||||
TABLES, since under LOCK TABLES one can't use a non-prelocked
|
||||
table. This code only works for updates done inside DO/SELECT
|
||||
f1() statements, normal DML is handled by means of
|
||||
sql_command_flags.
|
||||
*/
|
||||
if (global_read_lock && table_list->lock_type >= TL_WRITE_ALLOW_WRITE &&
|
||||
! (flags & MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK) &&
|
||||
! thd->locked_tables_mode)
|
||||
{
|
||||
/*
|
||||
Someone has issued FLUSH TABLES WITH READ LOCK and we want
|
||||
a write lock. Wait until the lock is gone.
|
||||
*/
|
||||
if (thd->global_read_lock.wait_if_global_read_lock(thd, 1, 1))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (thd->version != refresh_version)
|
||||
{
|
||||
(void) ot_ctx->request_backoff_action(Open_table_context::OT_WAIT_TDC);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
/*
|
||||
Unless requested otherwise, try to resolve this table in the list
|
||||
of temporary tables of this thread. In MySQL temporary tables
|
||||
|
@ -2680,7 +2705,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
|||
if (!thd->open_tables)
|
||||
thd->version=refresh_version;
|
||||
else if ((thd->version != refresh_version) &&
|
||||
! (flags & MYSQL_LOCK_IGNORE_FLUSH))
|
||||
! (flags & MYSQL_OPEN_IGNORE_FLUSH))
|
||||
{
|
||||
/* Someone did a refresh while thread was opening tables */
|
||||
mysql_mutex_unlock(&LOCK_open);
|
||||
|
@ -2811,7 +2836,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
|||
|
||||
if (share->version != refresh_version)
|
||||
{
|
||||
if (!(flags & MYSQL_LOCK_IGNORE_FLUSH))
|
||||
if (!(flags & MYSQL_OPEN_IGNORE_FLUSH))
|
||||
{
|
||||
/*
|
||||
We already have an MDL lock. But we have encountered an old
|
||||
|
@ -3293,7 +3318,6 @@ bool
|
|||
Locked_tables_list::reopen_tables(THD *thd)
|
||||
{
|
||||
Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
|
||||
bool lt_refresh_unused;
|
||||
size_t reopen_count= 0;
|
||||
MYSQL_LOCK *lock;
|
||||
MYSQL_LOCK *merged_lock;
|
||||
|
@ -3333,7 +3357,7 @@ Locked_tables_list::reopen_tables(THD *thd)
|
|||
break something else.
|
||||
*/
|
||||
lock= mysql_lock_tables(thd, m_reopen_array, reopen_count,
|
||||
MYSQL_OPEN_REOPEN, <_refresh_unused);
|
||||
MYSQL_OPEN_REOPEN);
|
||||
thd->in_lock_tables= 0;
|
||||
if (lock == NULL || (merged_lock=
|
||||
mysql_lock_merge(thd->lock, lock)) == NULL)
|
||||
|
@ -5061,7 +5085,6 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type,
|
|||
TABLE *table;
|
||||
Open_table_context ot_ctx(thd, (lock_flags & MYSQL_LOCK_IGNORE_TIMEOUT) ?
|
||||
LONG_TIMEOUT : thd->variables.lock_wait_timeout);
|
||||
bool refresh;
|
||||
bool error;
|
||||
DBUG_ENTER("open_ltable");
|
||||
|
||||
|
@ -5073,8 +5096,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type,
|
|||
/* open_ltable can be used only for BASIC TABLEs */
|
||||
table_list->required_type= FRMTYPE_TABLE;
|
||||
|
||||
retry:
|
||||
while ((error= open_table(thd, table_list, thd->mem_root, &ot_ctx, 0)) &&
|
||||
while ((error= open_table(thd, table_list, thd->mem_root, &ot_ctx, lock_flags)) &&
|
||||
ot_ctx.can_recover_from_failed_open())
|
||||
{
|
||||
/*
|
||||
|
@ -5120,18 +5142,9 @@ retry:
|
|||
DBUG_ASSERT(thd->lock == 0); // You must lock everything at once
|
||||
if ((table->reginfo.lock_type= lock_type) != TL_UNLOCK)
|
||||
if (! (thd->lock= mysql_lock_tables(thd, &table_list->table, 1,
|
||||
lock_flags, &refresh)))
|
||||
lock_flags)))
|
||||
{
|
||||
if (refresh)
|
||||
{
|
||||
close_thread_tables(thd);
|
||||
table_list->table= NULL;
|
||||
table_list->mdl_request.ticket= NULL;
|
||||
thd->mdl_context.rollback_to_savepoint(ot_ctx.start_of_statement_svp());
|
||||
goto retry;
|
||||
}
|
||||
else
|
||||
table= 0;
|
||||
table= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5168,42 +5181,27 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
|
|||
Prelocking_strategy *prelocking_strategy)
|
||||
{
|
||||
uint counter;
|
||||
bool need_reopen;
|
||||
/*
|
||||
Remember the set of metadata locks which this connection
|
||||
managed to acquire before the start of the current statement.
|
||||
It can be either transaction-scope locks, or HANDLER locks,
|
||||
or LOCK TABLES locks. If mysql_lock_tables() fails with
|
||||
need_reopen request, we'll use it to instruct
|
||||
close_tables_for_reopen() to release all locks of this
|
||||
statement.
|
||||
*/
|
||||
MDL_ticket *start_of_statement_svp= thd->mdl_context.mdl_savepoint();
|
||||
DBUG_ENTER("open_and_lock_tables");
|
||||
DBUG_PRINT("enter", ("derived handling: %d", derived));
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
if (open_tables(thd, &tables, &counter, flags, prelocking_strategy))
|
||||
DBUG_RETURN(TRUE);
|
||||
DBUG_EXECUTE_IF("sleep_open_and_lock_after_open", {
|
||||
const char *old_proc_info= thd->proc_info;
|
||||
thd->proc_info= "DBUG sleep";
|
||||
my_sleep(6000000);
|
||||
thd->proc_info= old_proc_info;});
|
||||
if (open_tables(thd, &tables, &counter, flags, prelocking_strategy))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
DBUG_EXECUTE_IF("sleep_open_and_lock_after_open", {
|
||||
const char *old_proc_info= thd->proc_info;
|
||||
thd->proc_info= "DBUG sleep";
|
||||
my_sleep(6000000);
|
||||
thd->proc_info= old_proc_info;});
|
||||
|
||||
if (lock_tables(thd, tables, counter, flags))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (!lock_tables(thd, tables, counter, flags,
|
||||
&need_reopen))
|
||||
break;
|
||||
if (!need_reopen)
|
||||
DBUG_RETURN(TRUE);
|
||||
close_tables_for_reopen(thd, &tables, start_of_statement_svp);
|
||||
}
|
||||
if (derived &&
|
||||
(mysql_handle_derived(thd->lex, &mysql_derived_prepare) ||
|
||||
(thd->fill_derived_tables() &&
|
||||
mysql_handle_derived(thd->lex, &mysql_derived_filling))))
|
||||
DBUG_RETURN(TRUE); /* purecov: inspected */
|
||||
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
@ -5216,7 +5214,7 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables,
|
|||
thd - thread handler
|
||||
tables - list of tables for open
|
||||
flags - bitmap of flags to modify how the tables will be open:
|
||||
MYSQL_LOCK_IGNORE_FLUSH - open table even if someone has
|
||||
MYSQL_OPEN_IGNORE_FLUSH - open table even if someone has
|
||||
done a flush or namelock on it.
|
||||
|
||||
RETURN
|
||||
|
@ -5261,37 +5259,28 @@ static void mark_real_tables_as_free_for_reuse(TABLE_LIST *table)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
Lock all tables in list
|
||||
/**
|
||||
Lock all tables in a list.
|
||||
|
||||
SYNOPSIS
|
||||
lock_tables()
|
||||
thd Thread handler
|
||||
tables Tables to lock
|
||||
count Number of opened tables
|
||||
flags Options (see mysql_lock_tables() for details)
|
||||
need_reopen Out parameter which if TRUE indicates that some
|
||||
tables were dropped or altered during this call
|
||||
and therefore invoker should reopen tables and
|
||||
try to lock them once again (in this case
|
||||
lock_tables() will also return error).
|
||||
@param thd Thread handler
|
||||
@param tables Tables to lock
|
||||
@param count Number of opened tables
|
||||
@param flags Options (see mysql_lock_tables() for details)
|
||||
|
||||
NOTES
|
||||
You can't call lock_tables twice, as this would break the dead-lock-free
|
||||
handling thr_lock gives us. You most always get all needed locks at
|
||||
once.
|
||||
You can't call lock_tables() while holding thr_lock locks, as
|
||||
this would break the dead-lock-free handling thr_lock gives us.
|
||||
You must always get all needed locks at once.
|
||||
|
||||
If query for which we are calling this function marked as requiring
|
||||
prelocking, this function will change locked_tables_mode to
|
||||
LTM_PRELOCKED.
|
||||
If the query for which we are calling this function is marked as
|
||||
requiring prelocking, this function will change
|
||||
locked_tables_mode to LTM_PRELOCKED.
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
-1 Error
|
||||
@retval FALSE Success.
|
||||
@retval TRUE A lock wait timeout, deadlock or out of memory.
|
||||
*/
|
||||
|
||||
bool lock_tables(THD *thd, TABLE_LIST *tables, uint count,
|
||||
uint flags, bool *need_reopen)
|
||||
uint flags)
|
||||
{
|
||||
TABLE_LIST *table;
|
||||
|
||||
|
@ -5302,7 +5291,6 @@ bool lock_tables(THD *thd, TABLE_LIST *tables, uint count,
|
|||
*/
|
||||
DBUG_ASSERT(thd->locked_tables_mode <= LTM_LOCK_TABLES ||
|
||||
!thd->lex->requires_prelocking());
|
||||
*need_reopen= FALSE;
|
||||
|
||||
if (!tables && !thd->lex->requires_prelocking())
|
||||
DBUG_RETURN(thd->decide_logging_format(tables));
|
||||
|
@ -5347,7 +5335,7 @@ bool lock_tables(THD *thd, TABLE_LIST *tables, uint count,
|
|||
DEBUG_SYNC(thd, "before_lock_tables_takes_lock");
|
||||
|
||||
if (! (thd->lock= mysql_lock_tables(thd, start, (uint) (ptr - start),
|
||||
flags, need_reopen)))
|
||||
flags)))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
DEBUG_SYNC(thd, "after_lock_tables_takes_lock");
|
||||
|
@ -8869,7 +8857,7 @@ open_system_tables_for_read(THD *thd, TABLE_LIST *table_list,
|
|||
thd->reset_n_backup_open_tables_state(backup);
|
||||
|
||||
if (open_and_lock_tables(thd, table_list, FALSE,
|
||||
MYSQL_LOCK_IGNORE_FLUSH |
|
||||
MYSQL_OPEN_IGNORE_FLUSH |
|
||||
MYSQL_LOCK_IGNORE_TIMEOUT))
|
||||
{
|
||||
lex->restore_backup_query_tables_list(&query_tables_list_backup);
|
||||
|
@ -8957,11 +8945,11 @@ open_system_table_for_update(THD *thd, TABLE_LIST *one_table)
|
|||
TABLE *
|
||||
open_log_table(THD *thd, TABLE_LIST *one_table, Open_tables_backup *backup)
|
||||
{
|
||||
uint flags= ( MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK |
|
||||
uint flags= ( MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |
|
||||
MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |
|
||||
MYSQL_LOCK_IGNORE_FLUSH |
|
||||
MYSQL_OPEN_IGNORE_FLUSH |
|
||||
MYSQL_LOCK_IGNORE_TIMEOUT |
|
||||
MYSQL_LOCK_PERF_SCHEMA);
|
||||
MYSQL_LOCK_LOG_TABLE);
|
||||
TABLE *table;
|
||||
/* Save value that is changed in mysql_lock_tables() */
|
||||
ulonglong save_utime_after_lock= thd->utime_after_lock;
|
||||
|
@ -8989,8 +8977,7 @@ open_log_table(THD *thd, TABLE_LIST *one_table, Open_tables_backup *backup)
|
|||
open tables cannot be accepted when restoring the open tables
|
||||
state.
|
||||
*/
|
||||
if (thd->killed)
|
||||
close_thread_tables(thd);
|
||||
close_thread_tables(thd);
|
||||
thd->restore_backup_open_tables_state(backup);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ typedef struct st_user_var_events
|
|||
ulong length;
|
||||
Item_result type;
|
||||
uint charset_number;
|
||||
bool unsigned_flag;
|
||||
} BINLOG_USER_VAR_EVENT;
|
||||
|
||||
#define RP_LOCK_LOG_IS_ALREADY_LOCKED 1
|
||||
|
@ -1161,9 +1162,7 @@ public:
|
|||
class Drop_table_error_handler : public Internal_error_handler
|
||||
{
|
||||
public:
|
||||
Drop_table_error_handler(Internal_error_handler *err_handler)
|
||||
:m_err_handler(err_handler)
|
||||
{ }
|
||||
Drop_table_error_handler() {}
|
||||
|
||||
public:
|
||||
bool handle_condition(THD *thd,
|
||||
|
@ -1174,7 +1173,6 @@ public:
|
|||
MYSQL_ERROR ** cond_hdl);
|
||||
|
||||
private:
|
||||
Internal_error_handler *m_err_handler;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -934,7 +934,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
|
|||
}
|
||||
else
|
||||
{
|
||||
Drop_table_error_handler err_handler(thd->get_internal_handler());
|
||||
Drop_table_error_handler err_handler;
|
||||
thd->push_internal_handler(&err_handler);
|
||||
|
||||
error= -1;
|
||||
|
|
|
@ -405,6 +405,56 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
A helper class to process an error from mysql_lock_tables().
|
||||
HANDLER READ statement's attempt to lock the subject table
|
||||
may get aborted if there is a pending DDL. In that case
|
||||
we close the table, reopen it, and try to read again.
|
||||
This is implicit and obscure, since HANDLER position
|
||||
is lost in the process, but it's the legacy server
|
||||
behaviour we should preserve.
|
||||
*/
|
||||
|
||||
class Sql_handler_lock_error_handler: public Internal_error_handler
|
||||
{
|
||||
public:
|
||||
virtual
|
||||
bool handle_condition(THD *thd,
|
||||
uint sql_errno,
|
||||
const char *sqlstate,
|
||||
MYSQL_ERROR::enum_warning_level level,
|
||||
const char* msg,
|
||||
MYSQL_ERROR **cond_hdl);
|
||||
|
||||
bool need_reopen() const { return m_need_reopen; };
|
||||
void init() { m_need_reopen= FALSE; };
|
||||
private:
|
||||
bool m_need_reopen;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Handle an error from mysql_lock_tables().
|
||||
Ignore ER_LOCK_ABORTED errors.
|
||||
*/
|
||||
|
||||
bool
|
||||
Sql_handler_lock_error_handler::
|
||||
handle_condition(THD *thd,
|
||||
uint sql_errno,
|
||||
const char *sqlstate,
|
||||
MYSQL_ERROR::enum_warning_level level,
|
||||
const char* msg,
|
||||
MYSQL_ERROR **cond_hdl)
|
||||
{
|
||||
*cond_hdl= NULL;
|
||||
if (sql_errno == ER_LOCK_ABORTED)
|
||||
m_need_reopen= TRUE;
|
||||
|
||||
return m_need_reopen;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Read from a HANDLER table.
|
||||
|
||||
|
@ -442,7 +492,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|||
uint num_rows;
|
||||
uchar *UNINIT_VAR(key);
|
||||
uint UNINIT_VAR(key_len);
|
||||
bool need_reopen;
|
||||
Sql_handler_lock_error_handler sql_handler_lock_error;
|
||||
DBUG_ENTER("mysql_ha_read");
|
||||
DBUG_PRINT("enter",("'%s'.'%s' as '%s'",
|
||||
tables->db, tables->table_name, tables->alias));
|
||||
|
@ -506,8 +556,12 @@ retry:
|
|||
thd->open_tables= hash_tables->table;
|
||||
|
||||
|
||||
lock= mysql_lock_tables(thd, &thd->open_tables, 1, 0, &need_reopen);
|
||||
sql_handler_lock_error.init();
|
||||
thd->push_internal_handler(&sql_handler_lock_error);
|
||||
|
||||
lock= mysql_lock_tables(thd, &thd->open_tables, 1, 0);
|
||||
|
||||
thd->pop_internal_handler();
|
||||
/*
|
||||
In 5.1 and earlier, mysql_lock_tables() could replace the TABLE
|
||||
object with another one (reopen it). This is no longer the case
|
||||
|
@ -517,8 +571,9 @@ retry:
|
|||
/* Restore previous context. */
|
||||
thd->open_tables= backup_open_tables;
|
||||
|
||||
if (need_reopen)
|
||||
if (sql_handler_lock_error.need_reopen())
|
||||
{
|
||||
DBUG_ASSERT(!lock && !thd->is_error());
|
||||
mysql_ha_close_table(thd, hash_tables);
|
||||
goto retry;
|
||||
}
|
||||
|
|
|
@ -2396,7 +2396,8 @@ void kill_delayed_threads(void)
|
|||
bool Delayed_insert::open_and_lock_table()
|
||||
{
|
||||
if (!(table= open_n_lock_single_table(&thd, &table_list,
|
||||
TL_WRITE_DELAYED, 0)))
|
||||
TL_WRITE_DELAYED,
|
||||
MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK)))
|
||||
{
|
||||
thd.fatal_error(); // Abort waiting inserts
|
||||
return TRUE;
|
||||
|
@ -2557,7 +2558,6 @@ pthread_handler_t handle_delayed_insert(void *arg)
|
|||
|
||||
if (di->tables_in_use && ! thd->lock && !thd->killed)
|
||||
{
|
||||
bool need_reopen;
|
||||
/*
|
||||
Request for new delayed insert.
|
||||
Lock the table, but avoid to be blocked by a global read lock.
|
||||
|
@ -2568,30 +2568,10 @@ pthread_handler_t handle_delayed_insert(void *arg)
|
|||
handler will close the table and finish when the outstanding
|
||||
inserts are done.
|
||||
*/
|
||||
if (! (thd->lock= mysql_lock_tables(thd, &di->table, 1,
|
||||
MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK,
|
||||
&need_reopen)))
|
||||
if (! (thd->lock= mysql_lock_tables(thd, &di->table, 1, 0)))
|
||||
{
|
||||
if (need_reopen && !thd->killed)
|
||||
{
|
||||
/*
|
||||
We were waiting to obtain TL_WRITE_DELAYED (probably due to
|
||||
someone having or requesting TL_WRITE_ALLOW_READ) and got
|
||||
aborted. Try to reopen table and if it fails die.
|
||||
*/
|
||||
TABLE_LIST *tl_ptr = &di->table_list;
|
||||
close_tables_for_reopen(thd, &tl_ptr, NULL);
|
||||
di->table= 0;
|
||||
if (di->open_and_lock_table())
|
||||
{
|
||||
thd->killed= THD::KILL_CONNECTION;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fatal error */
|
||||
thd->killed= THD::KILL_CONNECTION;
|
||||
}
|
||||
/* Fatal error */
|
||||
thd->killed= THD::KILL_CONNECTION;
|
||||
}
|
||||
mysql_cond_broadcast(&di->cond_client);
|
||||
}
|
||||
|
@ -3542,7 +3522,6 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
|||
List_iterator_fast<Item> it(*items);
|
||||
Item *item;
|
||||
Field *tmp_field;
|
||||
bool not_used;
|
||||
DBUG_ENTER("create_table_from_items");
|
||||
|
||||
tmp_table.alias= 0;
|
||||
|
@ -3666,8 +3645,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
|||
since it won't wait for the table lock (we have exclusive metadata lock on
|
||||
the table) and thus can't get aborted.
|
||||
*/
|
||||
if (! ((*lock)= mysql_lock_tables(thd, &table, 1,
|
||||
MYSQL_LOCK_IGNORE_FLUSH, ¬_used)) ||
|
||||
if (! ((*lock)= mysql_lock_tables(thd, &table, 1, 0)) ||
|
||||
hooks->postlock(&table, 1))
|
||||
{
|
||||
if (*lock)
|
||||
|
|
|
@ -2128,8 +2128,6 @@ static int check_part_field(enum_field_types sql_type,
|
|||
}
|
||||
switch (sql_type)
|
||||
{
|
||||
case MYSQL_TYPE_NEWDECIMAL:
|
||||
case MYSQL_TYPE_DECIMAL:
|
||||
case MYSQL_TYPE_TINY:
|
||||
case MYSQL_TYPE_SHORT:
|
||||
case MYSQL_TYPE_LONG:
|
||||
|
@ -2151,6 +2149,8 @@ static int check_part_field(enum_field_types sql_type,
|
|||
*result_type= STRING_RESULT;
|
||||
*need_cs_check= TRUE;
|
||||
return FALSE;
|
||||
case MYSQL_TYPE_NEWDECIMAL:
|
||||
case MYSQL_TYPE_DECIMAL:
|
||||
case MYSQL_TYPE_TIMESTAMP:
|
||||
case MYSQL_TYPE_NULL:
|
||||
case MYSQL_TYPE_FLOAT:
|
||||
|
|
|
@ -2934,7 +2934,7 @@ fill_schema_show_cols_or_idxs(THD *thd, TABLE_LIST *tables,
|
|||
*/
|
||||
lex->sql_command= SQLCOM_SHOW_FIELDS;
|
||||
res= open_normal_and_derived_tables(thd, show_table_list,
|
||||
(MYSQL_LOCK_IGNORE_FLUSH |
|
||||
(MYSQL_OPEN_IGNORE_FLUSH |
|
||||
MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL |
|
||||
(can_deadlock ?
|
||||
MYSQL_OPEN_FAIL_ON_MDL_CONFLICT : 0)));
|
||||
|
@ -3516,7 +3516,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||
show_table_list->i_s_requested_object=
|
||||
schema_table->i_s_requested_object;
|
||||
res= open_normal_and_derived_tables(thd, show_table_list,
|
||||
(MYSQL_LOCK_IGNORE_FLUSH |
|
||||
(MYSQL_OPEN_IGNORE_FLUSH |
|
||||
MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL |
|
||||
(can_deadlock ? MYSQL_OPEN_FAIL_ON_MDL_CONFLICT : 0)));
|
||||
lex->sql_command= save_sql_command;
|
||||
|
|
|
@ -1811,7 +1811,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
|
|||
my_bool drop_temporary)
|
||||
{
|
||||
bool error;
|
||||
Drop_table_error_handler err_handler(thd->get_internal_handler());
|
||||
Drop_table_error_handler err_handler;
|
||||
|
||||
DBUG_ENTER("mysql_rm_table");
|
||||
|
||||
|
@ -4426,7 +4426,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
|
|||
MY_STAT stat_info;
|
||||
Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
|
||||
DBUG_ENTER("prepare_for_repair");
|
||||
uint reopen_for_repair_flags= (MYSQL_LOCK_IGNORE_FLUSH |
|
||||
uint reopen_for_repair_flags= (MYSQL_OPEN_IGNORE_FLUSH |
|
||||
MYSQL_OPEN_HAS_MDL_LOCK);
|
||||
|
||||
if (!(check_opt->sql_flags & TT_USEFRM))
|
||||
|
@ -7155,7 +7155,7 @@ view_err:
|
|||
tbl.table_name= tbl.alias= tmp_name;
|
||||
/* Table is in thd->temporary_tables */
|
||||
(void) open_table(thd, &tbl, thd->mem_root, &ot_ctx_unused,
|
||||
MYSQL_LOCK_IGNORE_FLUSH);
|
||||
MYSQL_OPEN_IGNORE_FLUSH);
|
||||
new_table= tbl.table;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -203,33 +203,26 @@ int mysql_update(THD *thd,
|
|||
SQL_SELECT *select;
|
||||
READ_RECORD info;
|
||||
SELECT_LEX *select_lex= &thd->lex->select_lex;
|
||||
bool need_reopen;
|
||||
ulonglong id;
|
||||
List<Item> all_fields;
|
||||
THD::killed_state killed_status= THD::NOT_KILLED;
|
||||
MDL_ticket *start_of_statement_svp= thd->mdl_context.mdl_savepoint();
|
||||
DBUG_ENTER("mysql_update");
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
if (open_tables(thd, &table_list, &table_count, 0))
|
||||
DBUG_RETURN(1);
|
||||
if (open_tables(thd, &table_list, &table_count, 0))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
if (table_list->multitable_view)
|
||||
{
|
||||
DBUG_ASSERT(table_list->view != 0);
|
||||
DBUG_PRINT("info", ("Switch to multi-update"));
|
||||
/* pass counter value */
|
||||
thd->lex->table_count= table_count;
|
||||
/* convert to multiupdate */
|
||||
DBUG_RETURN(2);
|
||||
}
|
||||
if (!lock_tables(thd, table_list, table_count, 0, &need_reopen))
|
||||
break;
|
||||
if (!need_reopen)
|
||||
DBUG_RETURN(1);
|
||||
close_tables_for_reopen(thd, &table_list, start_of_statement_svp);
|
||||
if (table_list->multitable_view)
|
||||
{
|
||||
DBUG_ASSERT(table_list->view != 0);
|
||||
DBUG_PRINT("info", ("Switch to multi-update"));
|
||||
/* pass counter value */
|
||||
thd->lex->table_count= table_count;
|
||||
/* convert to multiupdate */
|
||||
DBUG_RETURN(2);
|
||||
}
|
||||
if (lock_tables(thd, table_list, table_count, 0))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
if (mysql_handle_derived(thd->lex, &mysql_derived_prepare) ||
|
||||
(thd->fill_derived_tables() &&
|
||||
|
@ -963,17 +956,14 @@ int mysql_multi_update_prepare(THD *thd)
|
|||
uint table_count= lex->table_count;
|
||||
const bool using_lock_tables= thd->locked_tables_mode != LTM_NONE;
|
||||
bool original_multiupdate= (thd->lex->sql_command == SQLCOM_UPDATE_MULTI);
|
||||
bool need_reopen= FALSE;
|
||||
MDL_ticket *start_of_statement_svp= thd->mdl_context.mdl_savepoint();
|
||||
DBUG_ENTER("mysql_multi_update_prepare");
|
||||
|
||||
/* following need for prepared statements, to run next time multi-update */
|
||||
thd->lex->sql_command= SQLCOM_UPDATE_MULTI;
|
||||
|
||||
reopen_tables:
|
||||
|
||||
/* open tables and create derived ones, but do not lock and fill them */
|
||||
if (((original_multiupdate || need_reopen) &&
|
||||
if ((original_multiupdate &&
|
||||
open_tables(thd, &table_list, &table_count, 0)) ||
|
||||
mysql_handle_derived(lex, &mysql_derived_prepare))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
@ -1089,58 +1079,11 @@ reopen_tables:
|
|||
|
||||
/* now lock and fill tables */
|
||||
if (!thd->stmt_arena->is_stmt_prepare() &&
|
||||
lock_tables(thd, table_list, table_count, 0, &need_reopen))
|
||||
lock_tables(thd, table_list, table_count, 0))
|
||||
{
|
||||
if (!need_reopen)
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
DBUG_PRINT("info", ("lock_tables failed, reopening"));
|
||||
|
||||
/*
|
||||
We have to reopen tables since some of them were altered or dropped
|
||||
during lock_tables() or something was done with their triggers.
|
||||
Let us do some cleanups to be able do setup_table() and setup_fields()
|
||||
once again.
|
||||
*/
|
||||
List_iterator_fast<Item> it(*fields);
|
||||
Item *item;
|
||||
while ((item= it++))
|
||||
item->cleanup();
|
||||
|
||||
/*
|
||||
To not to hog memory (as a result of the
|
||||
unit->reinit_exec_mechanism() call below):
|
||||
*/
|
||||
lex->unit.cleanup();
|
||||
|
||||
for (SELECT_LEX *sl= lex->all_selects_list;
|
||||
sl;
|
||||
sl= sl->next_select_in_list())
|
||||
{
|
||||
SELECT_LEX_UNIT *unit= sl->master_unit();
|
||||
unit->reinit_exec_mechanism(); // reset unit->prepared flags
|
||||
/*
|
||||
Reset 'clean' flag back to force normal execution of
|
||||
unit->cleanup() in Prepared_statement::cleanup_stmt()
|
||||
(call to lex->unit.cleanup() above sets this flag to TRUE).
|
||||
*/
|
||||
unit->unclean();
|
||||
}
|
||||
|
||||
/*
|
||||
Also we need to cleanup Natural_join_column::table_field items.
|
||||
To not to traverse a join tree we will cleanup whole
|
||||
thd->free_list (in PS execution mode that list may not contain
|
||||
items from 'fields' list, so the cleanup above is necessary to.
|
||||
*/
|
||||
cleanup_items(thd->free_list);
|
||||
cleanup_items(thd->stmt_arena->free_list);
|
||||
close_tables_for_reopen(thd, &table_list, start_of_statement_svp);
|
||||
|
||||
DEBUG_SYNC(thd, "multi_update_reopen_tables");
|
||||
|
||||
goto reopen_tables;
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
/* @todo: downgrade the metadata locks here. */
|
||||
|
||||
/*
|
||||
Check that we are not using table that we are updating, but we should
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2002-2006 MySQL AB, 2009-2010 Sun Microsystems, Inc.
|
||||
/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/*
|
||||
How to add new variables:
|
||||
|
@ -647,32 +647,40 @@ static bool event_scheduler_check(sys_var *self, THD *thd, set_var *var)
|
|||
}
|
||||
static bool event_scheduler_update(sys_var *self, THD *thd, enum_var_type type)
|
||||
{
|
||||
uint opt_event_scheduler_value= Events::opt_event_scheduler;
|
||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||
/*
|
||||
Events::start() is heavyweight. In particular it creates a new THD,
|
||||
which takes LOCK_global_system_variables internally.
|
||||
Thus we have to release it here.
|
||||
We need to re-take it before returning, though.
|
||||
And we need to take it *without* holding Events::LOCK_event_metadata.
|
||||
|
||||
Note that since we release LOCK_global_system_variables before calling
|
||||
start/stop, there is a possibility that the server variable
|
||||
can become out of sync with the real event scheduler state.
|
||||
|
||||
This can happen with two concurrent statments if the first gets
|
||||
interrupted after start/stop but before retaking
|
||||
LOCK_global_system_variables. However, this problem should be quite
|
||||
rare and it's difficult to avoid it without opening up possibilities
|
||||
for deadlocks. See bug#51160.
|
||||
*/
|
||||
bool ret= Events::opt_event_scheduler == Events::EVENTS_ON
|
||||
bool ret= opt_event_scheduler_value == Events::EVENTS_ON
|
||||
? Events::start()
|
||||
: Events::stop();
|
||||
mysql_mutex_unlock(&Events::LOCK_event_metadata);
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
mysql_mutex_lock(&Events::LOCK_event_metadata);
|
||||
if (ret)
|
||||
my_error(ER_EVENT_SET_VAR_ERROR, MYF(0));
|
||||
return ret;
|
||||
}
|
||||
static PolyLock_mutex PLock_event_metadata(&Events::LOCK_event_metadata);
|
||||
|
||||
static Sys_var_enum Sys_event_scheduler(
|
||||
"event_scheduler", "Enable the event scheduler. Possible values are "
|
||||
"ON, OFF, and DISABLED (keep the event scheduler completely "
|
||||
"deactivated, it cannot be activated run-time)",
|
||||
GLOBAL_VAR(Events::opt_event_scheduler), CMD_LINE(OPT_ARG),
|
||||
event_scheduler_names, DEFAULT(Events::EVENTS_OFF),
|
||||
&PLock_event_metadata, NOT_IN_BINLOG,
|
||||
NO_MUTEX_GUARD, NOT_IN_BINLOG,
|
||||
ON_CHECK(event_scheduler_check), ON_UPDATE(event_scheduler_update));
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1668,7 +1668,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
|
|||
open all time zone tables to see if they exist.
|
||||
*/
|
||||
if (open_and_lock_tables(thd, tz_tables, FALSE,
|
||||
MYSQL_LOCK_IGNORE_FLUSH | MYSQL_LOCK_IGNORE_TIMEOUT))
|
||||
MYSQL_OPEN_IGNORE_FLUSH | MYSQL_LOCK_IGNORE_TIMEOUT))
|
||||
{
|
||||
sql_print_warning("Can't open and lock time zone table: %s "
|
||||
"trying to live without them", thd->stmt_da->message());
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
** option.
|
||||
**
|
||||
** If you can't get AGGREGATES to work, check that you have the column
|
||||
** 'type' in the mysql.func table. If not, run 'mysql_fix_privilege_tables'.
|
||||
** 'type' in the mysql.func table. If not, run 'mysql_upgrade'.
|
||||
**
|
||||
*/
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@ IF(UNIX)
|
|||
ADD_DEFINITIONS("-DUNIV_AIX -DUNIX_MUST_NOT_INLINE")
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
||||
ADD_DEFINITIONS("-DUNIV_SOLARIS")
|
||||
ELSE()
|
||||
ADD_DEFINITIONS("-DUNIV_MUST_NOT_INLINE")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
|
|
@ -849,7 +849,6 @@ fi
|
|||
%attr(755, root, root) %{_bindir}/myisampack
|
||||
%attr(755, root, root) %{_bindir}/mysql_convert_table_format
|
||||
%attr(755, root, root) %{_bindir}/mysql_fix_extensions
|
||||
%attr(755, root, root) %{_bindir}/mysql_fix_privilege_tables
|
||||
%attr(755, root, root) %{_bindir}/mysql_install_db
|
||||
%attr(755, root, root) %{_bindir}/mysql_secure_installation
|
||||
%attr(755, root, root) %{_bindir}/mysql_setpermission
|
||||
|
@ -1105,6 +1104,10 @@ fi
|
|||
- Fix some problems with the directives around "tcmalloc" (experimental),
|
||||
remove erroneous traces of the InnoDB plugin (that is 5.1 only).
|
||||
|
||||
* Fri Oct 06 2009 Magnus Blaudd <mvensson@mysql.com>
|
||||
|
||||
- Removed mysql_fix_privilege_tables
|
||||
|
||||
* Fri Oct 02 2009 Alexander Nozdrin <alexander.nozdrin@sun.com>
|
||||
|
||||
- "mysqlmanager" got removed from version 5.4, all references deleted.
|
||||
|
|
Loading…
Add table
Reference in a new issue