auto-merge
This commit is contained in:
commit
842039a1fb
@ -1280,21 +1280,35 @@ sig_handler handle_sigint(int sig)
|
|||||||
MYSQL *kill_mysql= NULL;
|
MYSQL *kill_mysql= NULL;
|
||||||
|
|
||||||
/* terminate if no query being executed, or we already tried interrupting */
|
/* terminate if no query being executed, or we already tried interrupting */
|
||||||
if (!executing_query || interrupted_query)
|
/* terminate if no query being executed, or we already tried interrupting */
|
||||||
|
if (!executing_query || (interrupted_query == 2))
|
||||||
|
{
|
||||||
|
tee_fprintf(stdout, "Ctrl-C -- exit!\n");
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
kill_mysql= mysql_init(kill_mysql);
|
kill_mysql= mysql_init(kill_mysql);
|
||||||
if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
|
if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
|
||||||
"", opt_mysql_port, opt_mysql_unix_port,0))
|
"", opt_mysql_port, opt_mysql_unix_port,0))
|
||||||
|
{
|
||||||
|
tee_fprintf(stdout, "Ctrl-C -- sorry, cannot connect to server to kill query, giving up ...\n");
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
interrupted_query++;
|
||||||
|
|
||||||
|
/* mysqld < 5 does not understand KILL QUERY, skip to KILL CONNECTION */
|
||||||
|
if ((interrupted_query == 1) && (mysql_get_server_version(&mysql) < 50000))
|
||||||
|
interrupted_query= 2;
|
||||||
|
|
||||||
/* kill_buffer is always big enough because max length of %lu is 15 */
|
/* kill_buffer is always big enough because max length of %lu is 15 */
|
||||||
sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
|
sprintf(kill_buffer, "KILL %s%lu",
|
||||||
mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
|
(interrupted_query == 1) ? "QUERY " : "",
|
||||||
|
mysql_thread_id(&mysql));
|
||||||
|
tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n", kill_buffer);
|
||||||
|
mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
|
||||||
mysql_close(kill_mysql);
|
mysql_close(kill_mysql);
|
||||||
tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
|
tee_fprintf(stdout, "Ctrl-C -- query aborted.\n");
|
||||||
|
|
||||||
interrupted_query= 1;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2863,7 +2877,7 @@ com_help(String *buffer __attribute__((unused)),
|
|||||||
"For developer information, including the MySQL Reference Manual, "
|
"For developer information, including the MySQL Reference Manual, "
|
||||||
"visit:\n"
|
"visit:\n"
|
||||||
" http://dev.mysql.com/\n"
|
" http://dev.mysql.com/\n"
|
||||||
"To buy MySQL Network Support, training, or other products, visit:\n"
|
"To buy MySQL Enterprise support, training, or other products, visit:\n"
|
||||||
" https://shop.mysql.com/\n", INFO_INFO);
|
" https://shop.mysql.com/\n", INFO_INFO);
|
||||||
put_info("List of all MySQL commands:", INFO_INFO);
|
put_info("List of all MySQL commands:", INFO_INFO);
|
||||||
if (!named_cmds)
|
if (!named_cmds)
|
||||||
|
@ -992,13 +992,11 @@ static struct my_option my_long_options[] =
|
|||||||
/* 'unspec' is not mentioned because it is just a placeholder. */
|
/* 'unspec' is not mentioned because it is just a placeholder. */
|
||||||
"Determine when the output statements should be base64-encoded BINLOG "
|
"Determine when the output statements should be base64-encoded BINLOG "
|
||||||
"statements: 'never' disables it and works only for binlogs without "
|
"statements: 'never' disables it and works only for binlogs without "
|
||||||
"row-based events; 'auto' is the default and prints base64 only when "
|
"row-based events; 'auto' prints base64 only when necessary (i.e., "
|
||||||
"necessary (i.e., for row-based events and format description events); "
|
"for row-based events and format description events); 'always' prints "
|
||||||
"'decode-rows' suppresses BINLOG statements for row events, but does "
|
"base64 whenever possible. 'always' is for debugging only and should "
|
||||||
"not exit as an error if a row event is found, unlike 'never'; "
|
"not be used in a production system. If this argument is not given, "
|
||||||
"'always' prints base64 whenever possible. 'always' is for debugging "
|
"the default is 'auto'; if it is given with no argument, 'always' is used."
|
||||||
"only and should not be used in a production system. The default is "
|
|
||||||
"'auto'. --base64-output is a short form for --base64-output=always."
|
|
||||||
,(uchar**) &opt_base64_output_mode_str,
|
,(uchar**) &opt_base64_output_mode_str,
|
||||||
(uchar**) &opt_base64_output_mode_str,
|
(uchar**) &opt_base64_output_mode_str,
|
||||||
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
@ -7720,6 +7720,7 @@ int main(int argc, char **argv)
|
|||||||
if (!ok_to_do)
|
if (!ok_to_do)
|
||||||
{
|
{
|
||||||
if (command->type == Q_SOURCE ||
|
if (command->type == Q_SOURCE ||
|
||||||
|
command->type == Q_ERROR ||
|
||||||
command->type == Q_WRITE_FILE ||
|
command->type == Q_WRITE_FILE ||
|
||||||
command->type == Q_APPEND_FILE ||
|
command->type == Q_APPEND_FILE ||
|
||||||
command->type == Q_PERL)
|
command->type == Q_PERL)
|
||||||
|
11
configure.in
11
configure.in
@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
|
|||||||
#
|
#
|
||||||
# When changing major version number please also check switch statement
|
# When changing major version number please also check switch statement
|
||||||
# in mysqlbinlog::check_master_version().
|
# in mysqlbinlog::check_master_version().
|
||||||
AM_INIT_AUTOMAKE(mysql, 5.1.40)
|
AM_INIT_AUTOMAKE(mysql, 5.1.41)
|
||||||
AM_CONFIG_HEADER([include/config.h:config.h.in])
|
AM_CONFIG_HEADER([include/config.h:config.h.in])
|
||||||
|
|
||||||
PROTOCOL_VERSION=10
|
PROTOCOL_VERSION=10
|
||||||
@ -2769,7 +2769,7 @@ server_scripts=
|
|||||||
|
|
||||||
dnl This probably should be cleaned up more - for now the threaded
|
dnl This probably should be cleaned up more - for now the threaded
|
||||||
dnl client is just using plain-old libs.
|
dnl client is just using plain-old libs.
|
||||||
sql_client_dirs="strings regex mysys dbug libmysql"
|
sql_client_dirs="strings mysys dbug extra regex libmysql"
|
||||||
|
|
||||||
AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no")
|
AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no")
|
||||||
|
|
||||||
@ -2835,9 +2835,10 @@ AC_SUBST(mysql_plugin_defs)
|
|||||||
|
|
||||||
|
|
||||||
# Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
|
# Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
|
||||||
# Start with the (longer) server list, add each client item not yet present.
|
# We support client-only builds by "--without-server", but not vice versa,
|
||||||
sql_union_dirs=" $sql_server_dirs "
|
# so we start with the client list, then add each server item not yet present.
|
||||||
for DIR in $sql_client_dirs
|
sql_union_dirs=" $sql_client_dirs "
|
||||||
|
for DIR in $sql_server_dirs
|
||||||
do
|
do
|
||||||
if echo " $sql_union_dirs " | grep " $DIR " >/dev/null
|
if echo " $sql_union_dirs " | grep " $DIR " >/dev/null
|
||||||
then
|
then
|
||||||
|
@ -1,10 +1,45 @@
|
|||||||
|
# For easier human reading (MTR doesn't care), please keep entries
|
||||||
|
# in alphabetical order. This also helps with merge conflict resolution.
|
||||||
|
|
||||||
|
binlog.binlog_multi_engine # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
|
||||||
funcs_1.charset_collation_1 # depends on compile-time decisions
|
funcs_1.charset_collation_1 # depends on compile-time decisions
|
||||||
main.plugin_load @solaris # Bug#42144
|
funcs_1.is_cml_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
binlog.binlog_tmp_table* # Bug#45578: Test binlog_tmp_table fails ramdonly on PB2: Unknown table 't2'
|
funcs_1.is_columns_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
funcs_1.is_engines_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
funcs_1.is_tables_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
funcs_1.ndb* # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
|
||||||
|
funcs_2.ndb_charset # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
|
||||||
main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
|
main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
|
||||||
rpl.rpl_row_create_table* # Bug#45576: rpl_row_create_table fails on PB2
|
|
||||||
rpl_ndb.rpl_ndb_log # Bug#38998
|
|
||||||
rpl.rpl_innodb_bug28430* @solaris # Bug#46029
|
|
||||||
rpl.rpl_get_master_version_and_clock* # Bug#46931 2009-08-26 alik rpl.rpl_get_master_version_and_clock fails on hpux11.31
|
|
||||||
main.innodb-autoinc* # Bug#47809 2009-10-04 joro innodb-autoinc.test fails with valgrind errors with the innodb plugin
|
main.innodb-autoinc* # Bug#47809 2009-10-04 joro innodb-autoinc.test fails with valgrind errors with the innodb plugin
|
||||||
|
main.plugin_load @solaris # Bug#42144
|
||||||
|
|
||||||
|
ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
|
||||||
|
rpl.rpl_cross_version* # Bug #43913 2009-10-26 joro rpl_cross_version can't pass on conflicts complainig clash with --slave-load-tm
|
||||||
|
rpl.rpl_get_master_version_and_clock* # Bug#46931 2009-08-26 alik rpl.rpl_get_master_version_and_clock fails on hpux11.31
|
||||||
|
rpl.rpl_innodb_bug28430* @solaris # Bug#46029
|
||||||
|
rpl.rpl_row_create_table* # Bug#45576: rpl_row_create_table fails on PB2
|
||||||
rpl.rpl_trigger* # Bug#47810 2009-10-04 joro rpl.rpl_trigger.test fails with valgrind errors with the innodb plugin
|
rpl.rpl_trigger* # Bug#47810 2009-10-04 joro rpl.rpl_trigger.test fails with valgrind errors with the innodb plugin
|
||||||
|
|
||||||
|
rpl_ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
rpl_ndb.rpl_ndb_log # Bug#38998
|
||||||
|
|
||||||
|
stress.ddl_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
|
||||||
|
parts.ndb_dd_backuprestore # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.part_supported_sql_func_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.partition_alter1_1_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.partition_alter1_1_2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.partition_alter1_2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.partition_auto_increment_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.partition_basic_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.partition_engine_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.partition_int_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.partition_mgm_lc0_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.partition_mgm_lc1_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.partition_mgm_lc2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.partition_syntax_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
parts.partition_value_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||||
|
@ -270,3 +270,42 @@ INSERT INTO test.t1 VALUES (1), (2);
|
|||||||
CREATE TABLE test.t2 SELECT * FROM test.t1;
|
CREATE TABLE test.t2 SELECT * FROM test.t1;
|
||||||
USE test;
|
USE test;
|
||||||
DROP TABLES t1, t2;
|
DROP TABLES t1, t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#46640
|
||||||
|
# This test verifies if the server_id stored in the "format
|
||||||
|
# description BINLOG statement" will override the server_id
|
||||||
|
# of the server executing the statements.
|
||||||
|
#
|
||||||
|
|
||||||
|
connect (fresh,localhost,root,,test);
|
||||||
|
connection fresh;
|
||||||
|
|
||||||
|
RESET MASTER;
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||||
|
|
||||||
|
# Format description event, with server_id = 10;
|
||||||
|
BINLOG '
|
||||||
|
3u9kSA8KAAAAZgAAAGoAAAABAAQANS4xLjM1LW1hcmlhLWJldGExLWRlYnVnLWxvZwAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAADe72RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
|
||||||
|
';
|
||||||
|
|
||||||
|
# What server_id is logged for a statement? Should be our own, not the
|
||||||
|
# one from the format description event.
|
||||||
|
INSERT INTO t1 VALUES (1);
|
||||||
|
|
||||||
|
# INSERT INTO t1 VALUES (2), with server_id=20. Check that this is logged
|
||||||
|
# with our own server id, not the 20 from the BINLOG statement.
|
||||||
|
BINLOG '
|
||||||
|
3u9kSBMUAAAAKQAAAJEBAAAAABoAAAAAAAAABHRlc3QAAnQxAAEDAAA=
|
||||||
|
3u9kSBcUAAAAIgAAALMBAAAQABoAAAAAAAEAAf/+AgAAAA==
|
||||||
|
';
|
||||||
|
|
||||||
|
# Show binlog events to check that server ids are correct.
|
||||||
|
--replace_column 1 # 2 # 5 #
|
||||||
|
--replace_regex /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
|
||||||
|
SHOW BINLOG EVENTS;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
disconnect fresh;
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ kill @id;
|
|||||||
# We don't drop t3 as this is a temporary table
|
# We don't drop t3 as this is a temporary table
|
||||||
drop table t2;
|
drop table t2;
|
||||||
connection master;
|
connection master;
|
||||||
--error 1053,2013
|
--error 1317,2013
|
||||||
reap;
|
reap;
|
||||||
connection slave;
|
connection slave;
|
||||||
# The SQL slave thread should now have stopped because the query was killed on
|
# The SQL slave thread should now have stopped because the query was killed on
|
||||||
|
@ -57,5 +57,5 @@ if (`select @result = 0`){
|
|||||||
skip OK;
|
skip OK;
|
||||||
}
|
}
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
echo ^ Found warnings!!;
|
echo ^ Found warnings in $log_error;
|
||||||
exit;
|
exit;
|
||||||
|
@ -162,7 +162,7 @@ INSERT INTO global_suppressions VALUES
|
|||||||
("Slave: Unknown column 'c7' in 't15' Error_code: 1054"),
|
("Slave: Unknown column 'c7' in 't15' Error_code: 1054"),
|
||||||
("Slave: Can't DROP 'c7'.* 1091"),
|
("Slave: Can't DROP 'c7'.* 1091"),
|
||||||
("Slave: Key column 'c6'.* 1072"),
|
("Slave: Key column 'c6'.* 1072"),
|
||||||
("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."),
|
("The slave I.O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."),
|
||||||
(".SELECT UNIX_TIMESTAMP... failed on master, do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"),
|
(".SELECT UNIX_TIMESTAMP... failed on master, do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"),
|
||||||
|
|
||||||
/* Test case for Bug#31590 in order_by.test produces the following error */
|
/* Test case for Bug#31590 in order_by.test produces the following error */
|
||||||
@ -210,7 +210,7 @@ BEGIN
|
|||||||
WHERE suspicious=1;
|
WHERE suspicious=1;
|
||||||
|
|
||||||
IF @num_warnings > 0 THEN
|
IF @num_warnings > 0 THEN
|
||||||
SELECT file_name, line
|
SELECT line
|
||||||
FROM error_log WHERE suspicious=1;
|
FROM error_log WHERE suspicious=1;
|
||||||
--SELECT * FROM test_suppressions;
|
--SELECT * FROM test_suppressions;
|
||||||
-- Return 2 -> check failed
|
-- Return 2 -> check failed
|
||||||
|
11
mysql-test/include/not_windows_embedded.inc
Normal file
11
mysql-test/include/not_windows_embedded.inc
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
let $is_win = `select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows")`;
|
||||||
|
let $is_embedded = `select version() like '%embedded%'`;
|
||||||
|
#echo is_win: $is_win;
|
||||||
|
#echo is_embedded: $is_embedded;
|
||||||
|
if ($is_win)
|
||||||
|
{
|
||||||
|
if ($is_embedded)
|
||||||
|
{
|
||||||
|
skip Not supported with embedded on windows;
|
||||||
|
}
|
||||||
|
}
|
@ -30,7 +30,7 @@ int main(int argc, const char** argv )
|
|||||||
DWORD pid= -1;
|
DWORD pid= -1;
|
||||||
HANDLE shutdown_event;
|
HANDLE shutdown_event;
|
||||||
char safe_process_name[32]= {0};
|
char safe_process_name[32]= {0};
|
||||||
int retry_open_event= 100;
|
int retry_open_event= 2;
|
||||||
/* Ignore any signals */
|
/* Ignore any signals */
|
||||||
signal(SIGINT, SIG_IGN);
|
signal(SIGINT, SIG_IGN);
|
||||||
signal(SIGBREAK, SIG_IGN);
|
signal(SIGBREAK, SIG_IGN);
|
||||||
@ -51,15 +51,31 @@ int main(int argc, const char** argv )
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Check if the process is alive, otherwise there is really
|
Check if the process is alive, otherwise there is really
|
||||||
no idea to retry the open of the event
|
no sense to retry the open of the event
|
||||||
*/
|
*/
|
||||||
HANDLE process;
|
HANDLE process;
|
||||||
if ((process= OpenProcess(SYNCHRONIZE, FALSE, pid)) == NULL)
|
DWORD exit_code;
|
||||||
|
process= OpenProcess(SYNCHRONIZE| PROCESS_QUERY_INFORMATION, FALSE, pid);
|
||||||
|
if (!process)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not open event or process %d, error: %d\n",
|
/* Already died */
|
||||||
pid, GetLastError());
|
exit(1);
|
||||||
exit(3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!GetExitCodeProcess(process,&exit_code))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "GetExitCodeProcess failed, pid= %d, err= %d\n",
|
||||||
|
pid, GetLastError());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exit_code != STILL_ACTIVE)
|
||||||
|
{
|
||||||
|
/* Already died */
|
||||||
|
CloseHandle(process);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
CloseHandle(process);
|
CloseHandle(process);
|
||||||
|
|
||||||
if (retry_open_event--)
|
if (retry_open_event--)
|
||||||
|
@ -69,6 +69,10 @@ require "mtr_misc.pl";
|
|||||||
my $do_test_reg;
|
my $do_test_reg;
|
||||||
my $skip_test_reg;
|
my $skip_test_reg;
|
||||||
|
|
||||||
|
# Related to adding InnoDB plugin combinations
|
||||||
|
my $lib_innodb_plugin;
|
||||||
|
my $do_innodb_plugin;
|
||||||
|
|
||||||
# If "Quick collect", set to 1 once a test to run has been found.
|
# If "Quick collect", set to 1 once a test to run has been found.
|
||||||
my $some_test_found;
|
my $some_test_found;
|
||||||
|
|
||||||
@ -103,6 +107,17 @@ sub collect_test_cases ($$) {
|
|||||||
$do_test_reg= init_pattern($do_test, "--do-test");
|
$do_test_reg= init_pattern($do_test, "--do-test");
|
||||||
$skip_test_reg= init_pattern($skip_test, "--skip-test");
|
$skip_test_reg= init_pattern($skip_test, "--skip-test");
|
||||||
|
|
||||||
|
$lib_innodb_plugin=
|
||||||
|
my_find_file($::basedir,
|
||||||
|
["storage/innodb_plugin", "storage/innodb_plugin/.libs",
|
||||||
|
"lib/mysql/plugin", "lib/plugin"],
|
||||||
|
["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
|
||||||
|
"ha_innodb_plugin.sl"],
|
||||||
|
NOT_REQUIRED);
|
||||||
|
$do_innodb_plugin= ($::mysql_version_id >= 50100 &&
|
||||||
|
!(IS_WINDOWS && $::opt_embedded_server) &&
|
||||||
|
$lib_innodb_plugin);
|
||||||
|
|
||||||
foreach my $suite (split(",", $suites))
|
foreach my $suite (split(",", $suites))
|
||||||
{
|
{
|
||||||
push(@$cases, collect_one_suite($suite, $opt_cases));
|
push(@$cases, collect_one_suite($suite, $opt_cases));
|
||||||
@ -484,20 +499,16 @@ sub collect_one_suite($)
|
|||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# Testing InnoDB plugin.
|
# Testing InnoDB plugin.
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
my $lib_innodb_plugin=
|
if ($do_innodb_plugin)
|
||||||
mtr_file_exists(::vs_config_dirs('storage/innodb_plugin', 'ha_innodb_plugin.dll'),
|
|
||||||
"$::basedir/storage/innodb_plugin/.libs/ha_innodb_plugin.so",
|
|
||||||
"$::basedir/lib/mysql/plugin/ha_innodb_plugin.so",
|
|
||||||
"$::basedir/lib/mysql/plugin/ha_innodb_plugin.dll");
|
|
||||||
if ($::mysql_version_id >= 50100 && !(IS_WINDOWS && $::opt_embedded_server) &&
|
|
||||||
$lib_innodb_plugin)
|
|
||||||
{
|
{
|
||||||
my @new_cases;
|
my @new_cases;
|
||||||
my $sep= (IS_WINDOWS) ? ';' : ':';
|
my $sep= (IS_WINDOWS) ? ';' : ':';
|
||||||
|
|
||||||
foreach my $test (@cases)
|
foreach my $test (@cases)
|
||||||
{
|
{
|
||||||
next if ($test->{'skip'} || !$test->{'innodb_test'});
|
next if (!$test->{'innodb_test'});
|
||||||
|
# If skipped due to no builtin innodb, we can still run it with plugin
|
||||||
|
next if ($test->{'skip'} && $test->{comment} ne "No innodb support");
|
||||||
# Exceptions
|
# Exceptions
|
||||||
next if ($test->{'name'} eq 'main.innodb'); # Failed with wrong errno (fk)
|
next if ($test->{'name'} eq 'main.innodb'); # Failed with wrong errno (fk)
|
||||||
next if ($test->{'name'} eq 'main.index_merge_innodb'); # Explain diff
|
next if ($test->{'name'} eq 'main.index_merge_innodb'); # Explain diff
|
||||||
@ -521,7 +532,7 @@ sub collect_one_suite($)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$new_test->{$key}= $value;
|
$new_test->{$key}= $value unless ($key eq 'skip');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
my $plugin_filename= basename($lib_innodb_plugin);
|
my $plugin_filename= basename($lib_innodb_plugin);
|
||||||
@ -534,11 +545,11 @@ sub collect_one_suite($)
|
|||||||
push(@{$new_test->{slave_opt}}, "--plugin_load=$plugin_list");
|
push(@{$new_test->{slave_opt}}, "--plugin_load=$plugin_list");
|
||||||
if ($new_test->{combination})
|
if ($new_test->{combination})
|
||||||
{
|
{
|
||||||
$new_test->{combination}.= ' + InnoDB plugin';
|
$new_test->{combination}.= '+innodb_plugin';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$new_test->{combination}= 'InnoDB plugin';
|
$new_test->{combination}= 'innodb_plugin';
|
||||||
}
|
}
|
||||||
push(@new_cases, $new_test);
|
push(@new_cases, $new_test);
|
||||||
}
|
}
|
||||||
@ -981,8 +992,11 @@ sub collect_one_test_case {
|
|||||||
{
|
{
|
||||||
# innodb is not supported, skip it
|
# innodb is not supported, skip it
|
||||||
$tinfo->{'skip'}= 1;
|
$tinfo->{'skip'}= 1;
|
||||||
|
# This comment is checked for running with innodb plugin (see above),
|
||||||
|
# please keep that in mind if changing the text.
|
||||||
$tinfo->{'comment'}= "No innodb support";
|
$tinfo->{'comment'}= "No innodb support";
|
||||||
return $tinfo;
|
# But continue processing if we may run it with innodb plugin
|
||||||
|
return $tinfo unless $do_innodb_plugin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1028,6 +1042,17 @@ sub collect_one_test_case {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $tinfo->{'need_ssl'} )
|
||||||
|
{
|
||||||
|
# This is a test that needs ssl
|
||||||
|
if ( ! $::opt_ssl_supported ) {
|
||||||
|
# SSL is not supported, skip it
|
||||||
|
$tinfo->{'skip'}= 1;
|
||||||
|
$tinfo->{'comment'}= "No SSL support";
|
||||||
|
return $tinfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# Find config file to use if not already selected in <testname>.opt file
|
# Find config file to use if not already selected in <testname>.opt file
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
@ -1108,6 +1133,7 @@ my @tags=
|
|||||||
["include/ndb_master-slave.inc", "ndb_test", 1],
|
["include/ndb_master-slave.inc", "ndb_test", 1],
|
||||||
["federated.inc", "federated_test", 1],
|
["federated.inc", "federated_test", 1],
|
||||||
["include/not_embedded.inc", "not_embedded", 1],
|
["include/not_embedded.inc", "not_embedded", 1],
|
||||||
|
["include/have_ssl.inc", "need_ssl", 1],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,6 +146,7 @@ sub mtr_report_test ($) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fail = "exp-fail";
|
$fail = "exp-fail";
|
||||||
|
$tinfo->{exp_fail}= 1;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ our @opt_extra_mysqld_opt;
|
|||||||
my $opt_compress;
|
my $opt_compress;
|
||||||
my $opt_ssl;
|
my $opt_ssl;
|
||||||
my $opt_skip_ssl;
|
my $opt_skip_ssl;
|
||||||
my $opt_ssl_supported;
|
our $opt_ssl_supported;
|
||||||
my $opt_ps_protocol;
|
my $opt_ps_protocol;
|
||||||
my $opt_sp_protocol;
|
my $opt_sp_protocol;
|
||||||
my $opt_cursor_protocol;
|
my $opt_cursor_protocol;
|
||||||
@ -323,7 +323,8 @@ sub main {
|
|||||||
for my $limit (2000, 1500, 1000, 500){
|
for my $limit (2000, 1500, 1000, 500){
|
||||||
$opt_parallel-- if ($sys_info->min_bogomips() < $limit);
|
$opt_parallel-- if ($sys_info->min_bogomips() < $limit);
|
||||||
}
|
}
|
||||||
$opt_parallel= 8 if ($opt_parallel > 8);
|
my $max_par= $ENV{MTR_MAX_PARALLEL} || 8;
|
||||||
|
$opt_parallel= $max_par if ($opt_parallel > $max_par);
|
||||||
$opt_parallel= $num_tests if ($opt_parallel > $num_tests);
|
$opt_parallel= $num_tests if ($opt_parallel > $num_tests);
|
||||||
$opt_parallel= 1 if (IS_WINDOWS and $sys_info->isvm());
|
$opt_parallel= 1 if (IS_WINDOWS and $sys_info->isvm());
|
||||||
$opt_parallel= 1 if ($opt_parallel < 1);
|
$opt_parallel= 1 if ($opt_parallel < 1);
|
||||||
@ -519,7 +520,8 @@ sub run_test_server ($$$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$num_saved_datadir++;
|
$num_saved_datadir++;
|
||||||
$num_failed_test++ unless $result->{retries};
|
$num_failed_test++ unless ($result->{retries} ||
|
||||||
|
$result->{exp_fail});
|
||||||
|
|
||||||
if ( !$opt_force ) {
|
if ( !$opt_force ) {
|
||||||
# Test has failed, force is off
|
# Test has failed, force is off
|
||||||
@ -738,6 +740,7 @@ sub run_worker ($) {
|
|||||||
}
|
}
|
||||||
elsif ($line eq 'BYE'){
|
elsif ($line eq 'BYE'){
|
||||||
mtr_report("Server said BYE");
|
mtr_report("Server said BYE");
|
||||||
|
stop_all_servers($opt_shutdown_timeout);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1337,6 +1340,9 @@ sub command_line_setup {
|
|||||||
push(@valgrind_args, @default_valgrind_args)
|
push(@valgrind_args, @default_valgrind_args)
|
||||||
unless @valgrind_args;
|
unless @valgrind_args;
|
||||||
|
|
||||||
|
# Make valgrind run in quiet mode so it only print errors
|
||||||
|
push(@valgrind_args, "--quiet" );
|
||||||
|
|
||||||
mtr_report("Running valgrind with options \"",
|
mtr_report("Running valgrind with options \"",
|
||||||
join(" ", @valgrind_args), "\"");
|
join(" ", @valgrind_args), "\"");
|
||||||
}
|
}
|
||||||
@ -1794,7 +1800,7 @@ sub environment_setup {
|
|||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Add the path where mysqld will find ha_example.so
|
# Add the path where mysqld will find ha_example.so
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
if ($mysql_version_id >= 50100 && !(IS_WINDOWS && $opt_embedded_server)) {
|
if ($mysql_version_id >= 50100) {
|
||||||
my $plugin_filename;
|
my $plugin_filename;
|
||||||
if (IS_WINDOWS)
|
if (IS_WINDOWS)
|
||||||
{
|
{
|
||||||
@ -3012,7 +3018,8 @@ test case was executed:\n";
|
|||||||
# Unknown process returned, most likley a crash, abort everything
|
# Unknown process returned, most likley a crash, abort everything
|
||||||
$tinfo->{comment}=
|
$tinfo->{comment}=
|
||||||
"The server $proc crashed while running ".
|
"The server $proc crashed while running ".
|
||||||
"'check testcase $mode test'";
|
"'check testcase $mode test'".
|
||||||
|
get_log_from_proc($proc, $tinfo->{name});
|
||||||
$result= 3;
|
$result= 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3130,7 +3137,8 @@ sub run_on_all($$)
|
|||||||
else {
|
else {
|
||||||
# Unknown process returned, most likley a crash, abort everything
|
# Unknown process returned, most likley a crash, abort everything
|
||||||
$tinfo->{comment}.=
|
$tinfo->{comment}.=
|
||||||
"The server $proc crashed while running '$run'";
|
"The server $proc crashed while running '$run'".
|
||||||
|
get_log_from_proc($proc, $tinfo->{name});
|
||||||
}
|
}
|
||||||
|
|
||||||
# Kill any check processes still running
|
# Kill any check processes still running
|
||||||
@ -3244,6 +3252,12 @@ sub run_testcase ($) {
|
|||||||
|
|
||||||
mtr_verbose("Running test:", $tinfo->{name});
|
mtr_verbose("Running test:", $tinfo->{name});
|
||||||
|
|
||||||
|
# Allow only alpanumerics pluss _ - + . in combination names
|
||||||
|
my $combination= $tinfo->{combination};
|
||||||
|
if ($combination && $combination !~ /^\w[-\w\.\+]+$/)
|
||||||
|
{
|
||||||
|
mtr_error("Combination '$combination' contains illegal characters");
|
||||||
|
}
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
# Init variables that can change between each test case
|
# Init variables that can change between each test case
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
@ -3436,14 +3450,14 @@ sub run_testcase ($) {
|
|||||||
my $check_res;
|
my $check_res;
|
||||||
if ( restart_forced_by_test() )
|
if ( restart_forced_by_test() )
|
||||||
{
|
{
|
||||||
stop_all_servers();
|
stop_all_servers($opt_shutdown_timeout);
|
||||||
}
|
}
|
||||||
elsif ( $opt_check_testcases and
|
elsif ( $opt_check_testcases and
|
||||||
$check_res= check_testcase($tinfo, "after"))
|
$check_res= check_testcase($tinfo, "after"))
|
||||||
{
|
{
|
||||||
if ($check_res == 1) {
|
if ($check_res == 1) {
|
||||||
# Test case had sideeffects, not fatal error, just continue
|
# Test case had sideeffects, not fatal error, just continue
|
||||||
stop_all_servers();
|
stop_all_servers($opt_shutdown_timeout);
|
||||||
mtr_report("Resuming tests...\n");
|
mtr_report("Resuming tests...\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -3524,7 +3538,8 @@ sub run_testcase ($) {
|
|||||||
{
|
{
|
||||||
# Server failed, probably crashed
|
# Server failed, probably crashed
|
||||||
$tinfo->{comment}=
|
$tinfo->{comment}=
|
||||||
"Server $proc failed during test run";
|
"Server $proc failed during test run" .
|
||||||
|
get_log_from_proc($proc, $tinfo->{name});
|
||||||
|
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
# It's not mysqltest that has exited, kill it
|
# It's not mysqltest that has exited, kill it
|
||||||
@ -3579,12 +3594,11 @@ sub run_testcase ($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Extract server log from after the last occurrence of named test
|
||||||
|
# Return as an array of lines
|
||||||
#
|
#
|
||||||
# Perform a rough examination of the servers
|
|
||||||
# error log and write all lines that look
|
sub extract_server_log ($$) {
|
||||||
# suspicious into $error_log.warnings
|
|
||||||
#
|
|
||||||
sub extract_warning_lines ($$) {
|
|
||||||
my ($error_log, $tname) = @_;
|
my ($error_log, $tname) = @_;
|
||||||
|
|
||||||
# Open the servers .err log file and read all lines
|
# Open the servers .err log file and read all lines
|
||||||
@ -3636,8 +3650,37 @@ sub extract_warning_lines ($$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return @lines;
|
||||||
|
}
|
||||||
|
|
||||||
# Write all suspicious lines to $error_log.warnings file
|
# Get log from server identified from its $proc object, from named test
|
||||||
|
# Return as a single string
|
||||||
|
#
|
||||||
|
|
||||||
|
sub get_log_from_proc ($$) {
|
||||||
|
my ($proc, $name)= @_;
|
||||||
|
my $srv_log= "";
|
||||||
|
|
||||||
|
foreach my $mysqld (mysqlds()) {
|
||||||
|
if ($mysqld->{proc} eq $proc) {
|
||||||
|
my @srv_lines= extract_server_log($mysqld->value('#log-error'), $name);
|
||||||
|
$srv_log= "\nServer log from this test:\n" . join ("", @srv_lines);
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $srv_log;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Perform a rough examination of the servers
|
||||||
|
# error log and write all lines that look
|
||||||
|
# suspicious into $error_log.warnings
|
||||||
|
#
|
||||||
|
sub extract_warning_lines ($$) {
|
||||||
|
my ($error_log, $tname) = @_;
|
||||||
|
|
||||||
|
my @lines= extract_server_log($error_log, $tname);
|
||||||
|
|
||||||
|
# Write all suspicious lines to $error_log.warnings file
|
||||||
my $warning_log = "$error_log.warnings";
|
my $warning_log = "$error_log.warnings";
|
||||||
my $Fwarn = IO::File->new($warning_log, "w")
|
my $Fwarn = IO::File->new($warning_log, "w")
|
||||||
or die("Could not open file '$warning_log' for writing: $!");
|
or die("Could not open file '$warning_log' for writing: $!");
|
||||||
@ -3645,14 +3688,9 @@ sub extract_warning_lines ($$) {
|
|||||||
|
|
||||||
my @patterns =
|
my @patterns =
|
||||||
(
|
(
|
||||||
# The patterns for detection of [Warning] and [ERROR]
|
|
||||||
# in the server log files have been faulty for a longer period
|
|
||||||
# and correcting them shows a few additional harmless warnings.
|
|
||||||
# Thus those patterns are temporarily removed from the list
|
|
||||||
# of patterns. For more info see BUG#42408
|
|
||||||
qr/^Warning:|mysqld: Warning|\[Warning\]/,
|
qr/^Warning:|mysqld: Warning|\[Warning\]/,
|
||||||
qr/^Error:|\[ERROR\]/,
|
qr/^Error:|\[ERROR\]/,
|
||||||
qr/^==.* at 0x/,
|
qr/^==\d*==/, # valgrind errors
|
||||||
qr/InnoDB: Warning|InnoDB: Error/,
|
qr/InnoDB: Warning|InnoDB: Error/,
|
||||||
qr/^safe_mutex:|allocated at line/,
|
qr/^safe_mutex:|allocated at line/,
|
||||||
qr/missing DBUG_RETURN/,
|
qr/missing DBUG_RETURN/,
|
||||||
@ -3825,7 +3863,8 @@ sub check_warnings ($) {
|
|||||||
else {
|
else {
|
||||||
# Unknown process returned, most likley a crash, abort everything
|
# Unknown process returned, most likley a crash, abort everything
|
||||||
$tinfo->{comment}=
|
$tinfo->{comment}=
|
||||||
"The server $proc crashed while running 'check warnings'";
|
"The server $proc crashed while running 'check warnings'".
|
||||||
|
get_log_from_proc($proc, $tinfo->{name});
|
||||||
$result= 3;
|
$result= 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4084,6 +4123,7 @@ sub mysqld_stop {
|
|||||||
mtr_init_args(\$args);
|
mtr_init_args(\$args);
|
||||||
|
|
||||||
mtr_add_arg($args, "--no-defaults");
|
mtr_add_arg($args, "--no-defaults");
|
||||||
|
mtr_add_arg($args, "--character-sets-dir=%s", $mysqld->value('character-sets-dir'));
|
||||||
mtr_add_arg($args, "--user=%s", $opt_user);
|
mtr_add_arg($args, "--user=%s", $opt_user);
|
||||||
mtr_add_arg($args, "--password=");
|
mtr_add_arg($args, "--password=");
|
||||||
mtr_add_arg($args, "--port=%d", $mysqld->value('port'));
|
mtr_add_arg($args, "--port=%d", $mysqld->value('port'));
|
||||||
@ -4281,7 +4321,8 @@ sub mysqld_start ($$) {
|
|||||||
$opt_start_timeout,
|
$opt_start_timeout,
|
||||||
$mysqld->{'proc'}))
|
$mysqld->{'proc'}))
|
||||||
{
|
{
|
||||||
mtr_error("Failed to start mysqld $mysqld->name()");
|
my $mname= $mysqld->name();
|
||||||
|
mtr_error("Failed to start mysqld $mname with command $exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remember options used when starting
|
# Remember options used when starting
|
||||||
@ -4292,11 +4333,12 @@ sub mysqld_start ($$) {
|
|||||||
|
|
||||||
|
|
||||||
sub stop_all_servers () {
|
sub stop_all_servers () {
|
||||||
|
my $shutdown_timeout = $_[0] or 0;
|
||||||
|
|
||||||
mtr_verbose("Stopping all servers...");
|
mtr_verbose("Stopping all servers...");
|
||||||
|
|
||||||
# Kill all started servers
|
# Kill all started servers
|
||||||
My::SafeProcess::shutdown(0, # shutdown timeout 0 => kill
|
My::SafeProcess::shutdown($shutdown_timeout,
|
||||||
started(all_servers()));
|
started(all_servers()));
|
||||||
|
|
||||||
# Remove pidfiles
|
# Remove pidfiles
|
||||||
@ -4667,7 +4709,8 @@ sub start_servers($) {
|
|||||||
my $logfile= $mysqld->value('#log-error');
|
my $logfile= $mysqld->value('#log-error');
|
||||||
if ( defined $logfile and -f $logfile )
|
if ( defined $logfile and -f $logfile )
|
||||||
{
|
{
|
||||||
$tinfo->{logfile}= mtr_fromfile($logfile);
|
my @srv_lines= extract_server_log($logfile, $tinfo->{name});
|
||||||
|
$tinfo->{logfile}= "Server log is:\n" . join ("", @srv_lines);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -5084,7 +5127,6 @@ sub valgrind_arguments {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
|
mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
|
||||||
mtr_add_arg($args, "--alignment=8");
|
|
||||||
mtr_add_arg($args, "--leak-check=yes");
|
mtr_add_arg($args, "--leak-check=yes");
|
||||||
mtr_add_arg($args, "--num-callers=16");
|
mtr_add_arg($args, "--num-callers=16");
|
||||||
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
|
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
|
||||||
|
@ -41,6 +41,14 @@ efgh efgh
|
|||||||
ijkl ijkl
|
ijkl ijkl
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
|
# Bug#45645 Mysql server close all connection and restart using lower function
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_test_ci;
|
||||||
|
INSERT INTO t1 (a) VALUES ('hello!');
|
||||||
|
SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
|
||||||
|
a
|
||||||
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
# Bug#43827 Server closes connections and restarts
|
# Bug#43827 Server closes connections and restarts
|
||||||
#
|
#
|
||||||
CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
|
CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
|
||||||
@ -321,3 +329,11 @@ Vv
|
|||||||
Xx
|
Xx
|
||||||
YyÝýỲỳỴỵỶỷỸỹ
|
YyÝýỲỳỴỵỶỷỸỹ
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20
|
||||||
|
set names latin1;
|
||||||
|
show collation like 'latin1_test';
|
||||||
|
Collation Charset Id Default Compiled Sortlen
|
||||||
|
latin1_test latin1 99 Yes 1
|
||||||
|
select "foo" = "foo " collate latin1_test;
|
||||||
|
"foo" = "foo " collate latin1_test
|
||||||
|
1
|
||||||
|
@ -1477,3 +1477,47 @@ COUNT(*)
|
|||||||
SET SQL_MODE=default;
|
SET SQL_MODE=default;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
|
#
|
||||||
|
# BUG#47280 - strange results from count(*) with order by multiple
|
||||||
|
# columns without where/group
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Initialize test
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
pk INT NOT NULL,
|
||||||
|
i INT,
|
||||||
|
PRIMARY KEY (pk)
|
||||||
|
);
|
||||||
|
INSERT INTO t1 VALUES (1,11),(2,12),(3,13);
|
||||||
|
#
|
||||||
|
# Start test
|
||||||
|
# All the following queries shall return 1 record
|
||||||
|
#
|
||||||
|
|
||||||
|
# Masking all correct values {11...13} for column i in this result.
|
||||||
|
SELECT MAX(pk) as max, i
|
||||||
|
FROM t1
|
||||||
|
ORDER BY max;
|
||||||
|
max i
|
||||||
|
3 #
|
||||||
|
|
||||||
|
EXPLAIN
|
||||||
|
SELECT MAX(pk) as max, i
|
||||||
|
FROM t1
|
||||||
|
ORDER BY max;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary
|
||||||
|
|
||||||
|
# Only 11 is correct for collumn i in this result
|
||||||
|
SELECT MAX(pk) as max, i
|
||||||
|
FROM t1
|
||||||
|
WHERE pk<2
|
||||||
|
ORDER BY max;
|
||||||
|
max i
|
||||||
|
1 11
|
||||||
|
#
|
||||||
|
# Cleanup
|
||||||
|
#
|
||||||
|
DROP TABLE t1;
|
||||||
|
End of 5.1 tests
|
||||||
|
@ -1487,4 +1487,43 @@ MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
|
|||||||
COUNT(*)
|
COUNT(*)
|
||||||
2
|
2
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# Bug #48258: Assertion failed when using a spatial index
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
|
||||||
|
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
|
||||||
|
EXPLAIN SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
|
||||||
|
SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
EXPLAIN SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
|
||||||
|
SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
1
|
||||||
|
EXPLAIN SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
|
||||||
|
SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
EXPLAIN SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
|
||||||
|
SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
1
|
||||||
|
EXPLAIN SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
|
||||||
|
SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
DROP TABLE t1;
|
||||||
End of 5.0 tests.
|
End of 5.0 tests.
|
||||||
|
@ -972,6 +972,18 @@ select min(`col002`) from t1 union select `col002` from t1;
|
|||||||
min(`col002`)
|
min(`col002`)
|
||||||
NULL
|
NULL
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# Bug #47780: crash when comparing GIS items from subquery
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a INT, b MULTIPOLYGON);
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(0,
|
||||||
|
GEOMFROMTEXT(
|
||||||
|
'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))'));
|
||||||
|
# must not crash
|
||||||
|
SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
|
||||||
|
1
|
||||||
|
DROP TABLE t1;
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
|
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
|
||||||
create view v1 as select * from t1;
|
create view v1 as select * from t1;
|
||||||
|
@ -154,4 +154,42 @@ SELECT * FROM mysqltest_1.t1;
|
|||||||
a
|
a
|
||||||
DROP USER 'mysqltest1'@'%';
|
DROP USER 'mysqltest1'@'%';
|
||||||
DROP DATABASE mysqltest_1;
|
DROP DATABASE mysqltest_1;
|
||||||
|
#
|
||||||
|
# Bug#41597 - After rename of user, there are additional grants
|
||||||
|
# when grants are reapplied.
|
||||||
|
#
|
||||||
|
CREATE DATABASE temp;
|
||||||
|
CREATE TABLE temp.t1(a INT, b VARCHAR(10));
|
||||||
|
INSERT INTO temp.t1 VALUES(1, 'name1');
|
||||||
|
INSERT INTO temp.t1 VALUES(2, 'name2');
|
||||||
|
INSERT INTO temp.t1 VALUES(3, 'name3');
|
||||||
|
CREATE USER 'user1'@'%';
|
||||||
|
RENAME USER 'user1'@'%' TO 'user2'@'%';
|
||||||
|
# Show privileges after rename and BEFORE grant
|
||||||
|
SHOW GRANTS FOR 'user2'@'%';
|
||||||
|
Grants for user2@%
|
||||||
|
GRANT USAGE ON *.* TO 'user2'@'%'
|
||||||
|
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%';
|
||||||
|
# Show privileges after rename and grant
|
||||||
|
SHOW GRANTS FOR 'user2'@'%';
|
||||||
|
Grants for user2@%
|
||||||
|
GRANT USAGE ON *.* TO 'user2'@'%'
|
||||||
|
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%'
|
||||||
|
# Connect as the renamed user
|
||||||
|
SHOW GRANTS;
|
||||||
|
Grants for user2@%
|
||||||
|
GRANT USAGE ON *.* TO 'user2'@'%'
|
||||||
|
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%'
|
||||||
|
SELECT a FROM temp.t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
# Check for additional privileges by accessing a
|
||||||
|
# non privileged column. We shouldn't be able to
|
||||||
|
# access this column.
|
||||||
|
SELECT b FROM temp.t1;
|
||||||
|
ERROR 42000: SELECT command denied to user 'user2'@'localhost' for column 'b' in table 't1'
|
||||||
|
DROP USER 'user2'@'%';
|
||||||
|
DROP DATABASE temp;
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
|
@ -876,10 +876,10 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
|
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
|
||||||
explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
|
explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
|
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
|
||||||
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
|
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
|
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
|
||||||
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
|
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
|
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
|
||||||
@ -924,7 +924,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
|
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
|
||||||
explain select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
|
explain select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
|
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
|
||||||
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
|
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
|
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
|
||||||
|
@ -2209,4 +2209,46 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a;
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using where
|
1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using where
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# Bug #47963: Wrong results when index is used
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(
|
||||||
|
a VARCHAR(5) NOT NULL,
|
||||||
|
b VARCHAR(5) NOT NULL,
|
||||||
|
c DATETIME NOT NULL,
|
||||||
|
KEY (c)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00');
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00';
|
||||||
|
a b c
|
||||||
|
TEST TEST 2009-10-09 00:00:00
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0';
|
||||||
|
a b c
|
||||||
|
TEST TEST 2009-10-09 00:00:00
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00';
|
||||||
|
a b c
|
||||||
|
TEST TEST 2009-10-09 00:00:00
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0';
|
||||||
|
a b c
|
||||||
|
TEST TEST 2009-10-09 00:00:00
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000';
|
||||||
|
a b c
|
||||||
|
TEST TEST 2009-10-09 00:00:00
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001';
|
||||||
|
a b c
|
||||||
|
TEST TEST 2009-10-09 00:00:00
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
|
||||||
|
a b c
|
||||||
|
EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
|
DROP TABLE t1;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
|
29
mysql-test/r/locale.result
Normal file
29
mysql-test/r/locale.result
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
Start of 5.4 tests
|
||||||
|
#
|
||||||
|
# Bug#43207 wrong LC_TIME names for romanian locale
|
||||||
|
#
|
||||||
|
SET NAMES utf8;
|
||||||
|
SET lc_time_names=ro_RO;
|
||||||
|
SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
|
||||||
|
DATE_FORMAT('2001-01-01', '%w %a %W')
|
||||||
|
1 Lu Luni
|
||||||
|
SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
|
||||||
|
DATE_FORMAT('2001-01-02', '%w %a %W')
|
||||||
|
2 Ma Marţi
|
||||||
|
SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
|
||||||
|
DATE_FORMAT('2001-01-03', '%w %a %W')
|
||||||
|
3 Mi Miercuri
|
||||||
|
SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
|
||||||
|
DATE_FORMAT('2001-01-04', '%w %a %W')
|
||||||
|
4 Jo Joi
|
||||||
|
SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
|
||||||
|
DATE_FORMAT('2001-01-05', '%w %a %W')
|
||||||
|
5 Vi Vineri
|
||||||
|
SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
|
||||||
|
DATE_FORMAT('2001-01-06', '%w %a %W')
|
||||||
|
6 Sâ Sâmbătă
|
||||||
|
SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
|
||||||
|
DATE_FORMAT('2001-01-07', '%w %a %W')
|
||||||
|
0 Du Duminică
|
||||||
|
End of 5.4 tests
|
@ -2271,4 +2271,25 @@ checksum table t3;
|
|||||||
Table Checksum
|
Table Checksum
|
||||||
test.t3 326284887
|
test.t3 326284887
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b));
|
||||||
|
INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'),
|
||||||
|
(6,'0'),(7,'0');
|
||||||
|
INSERT INTO t1 SELECT a+10,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+20,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+40,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+80,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+160,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+320,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+640,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+1280,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+2560,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+5120,b FROM t1;
|
||||||
|
SET myisam_sort_buffer_size=4;
|
||||||
|
REPAIR TABLE t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 repair error myisam_sort_buffer_size is too small
|
||||||
|
test.t1 repair warning Number of rows changed from 0 to 7168
|
||||||
|
test.t1 repair status OK
|
||||||
|
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||||
|
DROP TABLE t1;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
|
@ -15,31 +15,13 @@ SET SESSION debug="d,crash_before_flush_keys";
|
|||||||
# Run the crashing query
|
# Run the crashing query
|
||||||
FLUSH TABLE t1;
|
FLUSH TABLE t1;
|
||||||
ERROR HY000: Lost connection to MySQL server during query
|
ERROR HY000: Lost connection to MySQL server during query
|
||||||
# Run MYISAMCHK tool to check the table t1 and repair
|
|
||||||
myisamchk: MyISAM file MYSQLD_DATADIR/test/t1
|
|
||||||
myisamchk: warning: 1 client is using or hasn't closed the table properly
|
|
||||||
myisamchk: error: Size of indexfile is: 1024 Should be: 3072
|
|
||||||
MYISAMCHK: Unknown error 126
|
|
||||||
myisamchk: error: Can't read indexpage from filepos: 1024
|
|
||||||
MyISAM-table 'MYSQLD_DATADIR/test/t1' is corrupted
|
|
||||||
Fix it using switch "-r" or "-o"
|
|
||||||
# Write file to make mysql-test-run.pl start the server
|
# Write file to make mysql-test-run.pl start the server
|
||||||
# Turn on reconnect
|
# Turn on reconnect
|
||||||
# Call script that will poll the server waiting for
|
# Call script that will poll the server waiting for
|
||||||
# it to be back online again
|
# it to be back online again
|
||||||
SHOW CREATE TABLE t1;
|
CHECK TABLE t1;
|
||||||
Table Create Table
|
Table Op Msg_type Msg_text
|
||||||
t1 CREATE TABLE `t1` (
|
test.t1 check warning 1 client is using or hasn't closed the table properly
|
||||||
`a` int(11) NOT NULL DEFAULT '0',
|
test.t1 check error Size of indexfile is: 1024 Should be: 3072
|
||||||
`b` int(11) NOT NULL DEFAULT '0',
|
test.t1 check error Corrupt
|
||||||
PRIMARY KEY (`a`,`b`),
|
|
||||||
KEY `b` (`b`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
|
|
||||||
SELECT * FROM t1 FORCE INDEX (PRIMARY);
|
|
||||||
a b
|
|
||||||
1 2
|
|
||||||
2 3
|
|
||||||
3 4
|
|
||||||
4 5
|
|
||||||
5 6
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@ -317,6 +317,7 @@ here is the sourced script
|
|||||||
outer=2 ifval=0
|
outer=2 ifval=0
|
||||||
outer=1 ifval=1
|
outer=1 ifval=1
|
||||||
here is the sourced script
|
here is the sourced script
|
||||||
|
ERROR 42S02: Table 'test.nowhere' doesn't exist
|
||||||
|
|
||||||
In loop
|
In loop
|
||||||
here is the sourced script
|
here is the sourced script
|
||||||
|
@ -1272,10 +1272,9 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (2, NULL);
|
|||||||
# test with an invalid date, which lead to item->null_value is set.
|
# test with an invalid date, which lead to item->null_value is set.
|
||||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME);
|
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME);
|
||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 p20090401 ALL NULL NULL NULL NULL 2 Using where
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '2009-04-99'
|
Warning 1292 Incorrect datetime value: '2009-04-99'
|
||||||
Warning 1292 Incorrect datetime value: '2009-04-99'
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1
|
CREATE TABLE t1
|
||||||
(a INT NOT NULL AUTO_INCREMENT,
|
(a INT NOT NULL AUTO_INCREMENT,
|
||||||
|
@ -1219,3 +1219,191 @@ explain select * from t2 where a=1000 and b<11;
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t2 ref a a 5 const 502 Using where
|
1 SIMPLE t2 ref a a 5 const 502 Using where
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
CREATE TABLE t1( a INT, b INT, KEY( a, b ) );
|
||||||
|
CREATE TABLE t2( a INT, b INT, KEY( a, b ) );
|
||||||
|
CREATE TABLE t3( a INT, b INT, KEY( a, b ) );
|
||||||
|
INSERT INTO t1( a, b )
|
||||||
|
VALUES (0, 1), (1, 2), (1, 4), (2, 3), (5, 0), (9, 7);
|
||||||
|
INSERT INTO t2( a, b )
|
||||||
|
VALUES ( 1, 1), ( 2, 1), ( 3, 1), ( 4, 1), ( 5, 1),
|
||||||
|
( 6, 1), ( 7, 1), ( 8, 1), ( 9, 1), (10, 1),
|
||||||
|
(11, 1), (12, 1), (13, 1), (14, 1), (15, 1),
|
||||||
|
(16, 1), (17, 1), (18, 1), (19, 1), (20, 1);
|
||||||
|
INSERT INTO t2 SELECT a, 2 FROM t2 WHERE b = 1;
|
||||||
|
INSERT INTO t2 SELECT a, 3 FROM t2 WHERE b = 1;
|
||||||
|
INSERT INTO t2 SELECT -1, -1 FROM t2;
|
||||||
|
INSERT INTO t2 SELECT -1, -1 FROM t2;
|
||||||
|
INSERT INTO t2 SELECT -1, -1 FROM t2;
|
||||||
|
INSERT INTO t3
|
||||||
|
VALUES (1, 0), (2, 0), (3, 0), (4, 0), (5, 0),
|
||||||
|
(6, 0), (7, 0), (8, 0), (9, 0), (10, 0);
|
||||||
|
INSERT INTO t3 SELECT * FROM t3 WHERE a = 10;
|
||||||
|
INSERT INTO t3 SELECT * FROM t3 WHERE a = 10;
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a < 5 OR
|
||||||
|
5 < a AND b = 3 OR
|
||||||
|
3 <= a;
|
||||||
|
a b
|
||||||
|
5 0
|
||||||
|
9 7
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a < 5 OR
|
||||||
|
5 < a AND b = 3 OR
|
||||||
|
3 <= a;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 range a a 5 NULL 3 Using where; Using index
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a < 5 OR
|
||||||
|
5 <= a AND b = 3 OR
|
||||||
|
3 <= a;
|
||||||
|
a b
|
||||||
|
5 0
|
||||||
|
9 7
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a < 5 OR
|
||||||
|
5 <= a AND b = 3 OR
|
||||||
|
3 <= a;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a <= 5 OR
|
||||||
|
5 <= a AND b = 3 OR
|
||||||
|
3 <= a;
|
||||||
|
a b
|
||||||
|
5 0
|
||||||
|
9 7
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a <= 5 OR
|
||||||
|
5 <= a AND b = 3 OR
|
||||||
|
3 <= a;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 range a a 5 NULL 3 Using where; Using index
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a <= 5 OR
|
||||||
|
3 <= a;
|
||||||
|
a b
|
||||||
|
5 0
|
||||||
|
9 7
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a <= 5 OR
|
||||||
|
3 <= a;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 range a a 5 NULL 3 Using where; Using index
|
||||||
|
SELECT * FROM t2 WHERE
|
||||||
|
5 <= a AND a < 10 AND b = 1 OR
|
||||||
|
15 <= a AND a < 20 AND b = 3
|
||||||
|
OR
|
||||||
|
1 <= a AND b = 1;
|
||||||
|
a b
|
||||||
|
1 1
|
||||||
|
2 1
|
||||||
|
3 1
|
||||||
|
4 1
|
||||||
|
5 1
|
||||||
|
6 1
|
||||||
|
7 1
|
||||||
|
8 1
|
||||||
|
9 1
|
||||||
|
10 1
|
||||||
|
11 1
|
||||||
|
12 1
|
||||||
|
13 1
|
||||||
|
14 1
|
||||||
|
15 1
|
||||||
|
15 3
|
||||||
|
16 1
|
||||||
|
16 3
|
||||||
|
17 1
|
||||||
|
17 3
|
||||||
|
18 1
|
||||||
|
18 3
|
||||||
|
19 1
|
||||||
|
19 3
|
||||||
|
20 1
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t2 WHERE
|
||||||
|
5 <= a AND a < 10 AND b = 1 OR
|
||||||
|
15 <= a AND a < 20 AND b = 3
|
||||||
|
OR
|
||||||
|
1 <= a AND b = 1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t2 range a a 10 NULL 50 Using where; Using index
|
||||||
|
SELECT * FROM t2 WHERE
|
||||||
|
5 <= a AND a < 10 AND b = 2 OR
|
||||||
|
15 <= a AND a < 20 AND b = 3
|
||||||
|
OR
|
||||||
|
1 <= a AND b = 1;
|
||||||
|
a b
|
||||||
|
1 1
|
||||||
|
2 1
|
||||||
|
3 1
|
||||||
|
4 1
|
||||||
|
5 1
|
||||||
|
5 2
|
||||||
|
6 1
|
||||||
|
6 2
|
||||||
|
7 1
|
||||||
|
7 2
|
||||||
|
8 1
|
||||||
|
8 2
|
||||||
|
9 1
|
||||||
|
9 2
|
||||||
|
10 1
|
||||||
|
11 1
|
||||||
|
12 1
|
||||||
|
13 1
|
||||||
|
14 1
|
||||||
|
15 1
|
||||||
|
15 3
|
||||||
|
16 1
|
||||||
|
16 3
|
||||||
|
17 1
|
||||||
|
17 3
|
||||||
|
18 1
|
||||||
|
18 3
|
||||||
|
19 1
|
||||||
|
19 3
|
||||||
|
20 1
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t2 WHERE
|
||||||
|
5 <= a AND a < 10 AND b = 2 OR
|
||||||
|
15 <= a AND a < 20 AND b = 3
|
||||||
|
OR
|
||||||
|
1 <= a AND b = 1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t2 range a a 10 NULL 50 Using where; Using index
|
||||||
|
SELECT * FROM t3 WHERE
|
||||||
|
5 <= a AND a < 10 AND b = 3 OR
|
||||||
|
a < 5 OR
|
||||||
|
a < 10;
|
||||||
|
a b
|
||||||
|
1 0
|
||||||
|
2 0
|
||||||
|
3 0
|
||||||
|
4 0
|
||||||
|
5 0
|
||||||
|
6 0
|
||||||
|
7 0
|
||||||
|
8 0
|
||||||
|
9 0
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t3 WHERE
|
||||||
|
5 <= a AND a < 10 AND b = 3 OR
|
||||||
|
a < 5 OR
|
||||||
|
a < 10;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t3 range a a 5 NULL 8 Using where; Using index
|
||||||
|
DROP TABLE t1, t2, t3;
|
||||||
|
#
|
||||||
|
# Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a INT, KEY(a));
|
||||||
|
INSERT INTO t1 VALUES (1), (NULL);
|
||||||
|
SELECT * FROM t1 WHERE a <> NULL and (a <> NULL or a <= NULL);
|
||||||
|
a
|
||||||
|
DROP TABLE t1;
|
||||||
|
End of 5.1 tests
|
||||||
|
@ -4386,6 +4386,35 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` > 1)) limit 2
|
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` > 1)) limit 2
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when
|
||||||
|
# forcing a spatial index
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
|
||||||
|
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
|
||||||
|
EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||||
|
1 SIMPLE t2 ALL a NULL NULL NULL 2
|
||||||
|
SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||||
|
1 SIMPLE t2 ALL a NULL NULL NULL 2
|
||||||
|
SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
DROP TABLE t1;
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
create table t1(a INT, KEY (a));
|
create table t1(a INT, KEY (a));
|
||||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||||
|
47
mysql-test/r/sp-bugs.result
Normal file
47
mysql-test/r/sp-bugs.result
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#
|
||||||
|
# Bug #47412: Valgrind warnings / user can read uninitalized memory
|
||||||
|
# using SP variables
|
||||||
|
#
|
||||||
|
CREATE SCHEMA testdb;
|
||||||
|
USE testdb;
|
||||||
|
CREATE FUNCTION f2 () RETURNS INTEGER
|
||||||
|
BEGIN
|
||||||
|
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
|
||||||
|
RETURN f_not_exists () ;
|
||||||
|
END|
|
||||||
|
CREATE PROCEDURE p3 ( arg1 VARCHAR(32) )
|
||||||
|
BEGIN
|
||||||
|
CALL p_not_exists ( );
|
||||||
|
END|
|
||||||
|
# should not return valgrind warnings
|
||||||
|
CALL p3 ( f2 () );
|
||||||
|
ERROR 42000: PROCEDURE testdb.p_not_exists does not exist
|
||||||
|
DROP SCHEMA testdb;
|
||||||
|
CREATE SCHEMA testdb;
|
||||||
|
USE testdb;
|
||||||
|
CREATE FUNCTION f2 () RETURNS INTEGER
|
||||||
|
BEGIN
|
||||||
|
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
|
||||||
|
RETURN f_not_exists () ;
|
||||||
|
END|
|
||||||
|
CREATE PROCEDURE p3 ( arg2 INTEGER )
|
||||||
|
BEGIN
|
||||||
|
CALL p_not_exists ( );
|
||||||
|
END|
|
||||||
|
# should not return valgrind warnings
|
||||||
|
CALL p3 ( f2 () );
|
||||||
|
ERROR 42000: PROCEDURE testdb.p_not_exists does not exist
|
||||||
|
DROP SCHEMA testdb;
|
||||||
|
CREATE SCHEMA testdb;
|
||||||
|
USE testdb;
|
||||||
|
CREATE FUNCTION f2 () RETURNS INTEGER
|
||||||
|
BEGIN
|
||||||
|
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
|
||||||
|
RETURN f_not_exists () ;
|
||||||
|
END|
|
||||||
|
# should not return valgrind warnings
|
||||||
|
SELECT f2 ();
|
||||||
|
f2 ()
|
||||||
|
NULL
|
||||||
|
DROP SCHEMA testdb;
|
||||||
|
End of 5.1 tests
|
@ -1670,3 +1670,19 @@ NULL
|
|||||||
SELECT non_existent (a) FROM t1 WHERE b = 999999;
|
SELECT non_existent (a) FROM t1 WHERE b = 999999;
|
||||||
ERROR 42000: FUNCTION test.non_existent does not exist
|
ERROR 42000: FUNCTION test.non_existent does not exist
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# Bug #47788: Crash in TABLE_LIST::hide_view_error on UPDATE + VIEW +
|
||||||
|
# SP + MERGE + ALTER
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (pk INT, b INT, KEY (b));
|
||||||
|
CREATE ALGORITHM = TEMPTABLE VIEW v1 AS SELECT * FROM t1;
|
||||||
|
CREATE PROCEDURE p1 (a int) UPDATE IGNORE v1 SET b = a;
|
||||||
|
CALL p1(5);
|
||||||
|
ERROR HY000: The target table v1 of the UPDATE is not updatable
|
||||||
|
ALTER TABLE t1 CHANGE COLUMN b b2 INT;
|
||||||
|
CALL p1(7);
|
||||||
|
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||||
|
DROP PROCEDURE p1;
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
End of 5.1 tests
|
||||||
|
@ -4403,8 +4403,7 @@ FROM t1
|
|||||||
WHERE a = 230;
|
WHERE a = 230;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
2 DEPENDENT SUBQUERY st1 index NULL a 5 NULL 2 Using index
|
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
2 DEPENDENT SUBQUERY st2 index b b 5 NULL 2 Using where; Using index; Using join buffer
|
|
||||||
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
|
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
|
||||||
FROM t1
|
FROM t1
|
||||||
WHERE a = 230;
|
WHERE a = 230;
|
||||||
|
@ -503,3 +503,14 @@ ERROR HY000: Recursive stored functions and triggers are not allowed.
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP FUNCTION f1;
|
DROP FUNCTION f1;
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
|
#
|
||||||
|
# Bug #47919 assert in open_table during ALTER temporary table
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1));
|
||||||
|
CREATE TEMPORARY TABLE t2 LIKE t1;
|
||||||
|
INSERT INTO t1 VALUES (1);
|
||||||
|
INSERT INTO t2 VALUES (1);
|
||||||
|
ALTER TABLE t2 COMMENT = 'ABC';
|
||||||
|
UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
|
||||||
|
ALTER TABLE t2 COMMENT = 'DEF';
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
@ -1218,3 +1218,22 @@ Warnings:
|
|||||||
Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
|
Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP VIEW v1;
|
DROP VIEW v1;
|
||||||
|
#
|
||||||
|
# Bug #46019: ERROR 1356 When selecting from within another
|
||||||
|
# view that has Group By
|
||||||
|
#
|
||||||
|
CREATE DATABASE mysqltest1;
|
||||||
|
USE mysqltest1;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT a FROM t1 GROUP BY a;
|
||||||
|
CREATE SQL SECURITY INVOKER VIEW v2 AS SELECT a FROM v1;
|
||||||
|
CREATE USER mysqluser1;
|
||||||
|
GRANT SELECT ON TABLE t1 TO mysqluser1;
|
||||||
|
GRANT SELECT, SHOW VIEW ON TABLE v1 TO mysqluser1;
|
||||||
|
GRANT SELECT, SHOW VIEW ON TABLE v2 TO mysqluser1;
|
||||||
|
SELECT a FROM v1;
|
||||||
|
a
|
||||||
|
SELECT a FROM v2;
|
||||||
|
a
|
||||||
|
DROP USER mysqluser1;
|
||||||
|
DROP DATABASE mysqltest1;
|
||||||
|
@ -68,4 +68,17 @@
|
|||||||
|
|
||||||
</charset>
|
</charset>
|
||||||
|
|
||||||
|
<charset name="latin1">
|
||||||
|
<family>Western</family>
|
||||||
|
<description>cp1252 West European</description>
|
||||||
|
<alias>csisolatin1</alias>
|
||||||
|
<alias>iso-8859-1</alias>
|
||||||
|
<alias>iso-ir-100</alias>
|
||||||
|
<alias>iso_8859-1</alias>
|
||||||
|
<alias>iso_8859-1:1987</alias>
|
||||||
|
<alias>l1</alias>
|
||||||
|
<alias>latin1</alias>
|
||||||
|
<collation name="latin1_test" id="99" order="test"/>
|
||||||
|
</charset>
|
||||||
|
|
||||||
</charsets>
|
</charsets>
|
||||||
|
135
mysql-test/std_data/latin1.xml
Normal file
135
mysql-test/std_data/latin1.xml
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
<?xml version='1.0' encoding="utf-8"?>
|
||||||
|
|
||||||
|
<charsets>
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright (C) 2009 Sun Microsystems, Inc
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<charset name="latin1">
|
||||||
|
|
||||||
|
<ctype>
|
||||||
|
<map>
|
||||||
|
00
|
||||||
|
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
|
||||||
|
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
|
||||||
|
48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
|
||||||
|
84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
|
||||||
|
10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
|
||||||
|
01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
|
||||||
|
10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
|
||||||
|
02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
|
||||||
|
10 00 10 02 10 10 10 10 10 10 01 10 01 00 01 00
|
||||||
|
00 10 10 10 10 10 10 10 10 10 02 10 02 00 02 01
|
||||||
|
48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
|
||||||
|
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
|
||||||
|
01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
|
||||||
|
01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
|
||||||
|
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
|
||||||
|
02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02
|
||||||
|
</map>
|
||||||
|
</ctype>
|
||||||
|
|
||||||
|
|
||||||
|
<lower>
|
||||||
|
<map>
|
||||||
|
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
|
||||||
|
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
|
||||||
|
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
|
||||||
|
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
|
||||||
|
40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
|
||||||
|
70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
|
||||||
|
60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
|
||||||
|
70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
|
||||||
|
80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
|
||||||
|
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
|
||||||
|
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
|
||||||
|
B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
|
||||||
|
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
|
||||||
|
F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
|
||||||
|
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
|
||||||
|
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
|
||||||
|
</map>
|
||||||
|
</lower>
|
||||||
|
|
||||||
|
|
||||||
|
<upper>
|
||||||
|
<map>
|
||||||
|
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
|
||||||
|
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
|
||||||
|
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
|
||||||
|
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
|
||||||
|
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
|
||||||
|
50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
|
||||||
|
60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
|
||||||
|
50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
|
||||||
|
80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
|
||||||
|
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
|
||||||
|
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
|
||||||
|
B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
|
||||||
|
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
|
||||||
|
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
|
||||||
|
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
|
||||||
|
D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
|
||||||
|
</map>
|
||||||
|
</upper>
|
||||||
|
|
||||||
|
|
||||||
|
<unicode>
|
||||||
|
<map>
|
||||||
|
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
|
||||||
|
0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
|
||||||
|
0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
|
||||||
|
0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
|
||||||
|
0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
|
||||||
|
0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
|
||||||
|
0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
|
||||||
|
0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
|
||||||
|
20AC 0081 201A 0192 201E 2026 2020 2021 02C6 2030 0160 2039 0152 008D 017D 008F
|
||||||
|
0090 2018 2019 201C 201D 2022 2013 2014 02DC 2122 0161 203A 0153 009D 017E 0178
|
||||||
|
00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF
|
||||||
|
00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF
|
||||||
|
00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF
|
||||||
|
00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF
|
||||||
|
00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF
|
||||||
|
00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF
|
||||||
|
</map>
|
||||||
|
</unicode>
|
||||||
|
|
||||||
|
<collation name="latin1_test">
|
||||||
|
<map>
|
||||||
|
00 01 02 03 37 2D 2E 2F 16 05 25 0B 0C 0D 0E 0F
|
||||||
|
10 11 12 13 3C 3D 32 26 18 19 3F 27 1C 1D 1E 1F
|
||||||
|
40 4F 7F 7B 5B 6C 50 7D 4D 5D 5C 4E 6B 60 4B 61
|
||||||
|
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 7A 5E 4C 7E 6E 6F
|
||||||
|
7C C1 C2 C3 C4 C5 C6 C7 C8 C9 D1 D2 D3 D4 D5 D6
|
||||||
|
D7 D8 D9 E2 E3 E4 E5 E6 E7 E8 E9 4A E0 5A 5F 6D
|
||||||
|
79 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96
|
||||||
|
97 98 99 A2 A3 A4 A5 A6 A7 A8 A9 C0 6A D0 A1 07
|
||||||
|
20 21 22 23 24 15 06 17 28 29 2A 2B 2C 09 0A 1B
|
||||||
|
30 31 1A 33 34 35 36 08 38 39 3A 3B 04 14 3E E1
|
||||||
|
41 42 43 44 45 46 47 48 49 51 52 53 54 55 56 57
|
||||||
|
58 59 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
||||||
|
76 77 78 80 8A 8B 8C 8D 8E 8F 90 9A 9B 9C 9D 9E
|
||||||
|
9F A0 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7
|
||||||
|
B8 B9 BA BB BC BD BE BF CA CB CC CD CE CF DA DB
|
||||||
|
DC DD DE DF EA EB EC ED EE EF FA FB FC FD FE FF
|
||||||
|
</map>
|
||||||
|
</collation>
|
||||||
|
|
||||||
|
</charset>
|
||||||
|
|
||||||
|
</charsets>
|
@ -0,0 +1,50 @@
|
|||||||
|
RESET MASTER;
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
### assertion: index file contains regular entries
|
||||||
|
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
|
||||||
|
SELECT @index;
|
||||||
|
@index
|
||||||
|
master-bin.000001
|
||||||
|
|
||||||
|
### assertion: show original binlogs
|
||||||
|
show binary logs;
|
||||||
|
Log_name File_size
|
||||||
|
master-bin.000001 #
|
||||||
|
### assertion: binlog contents from regular entries
|
||||||
|
show binlog events from <binlog_start>;
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
|
||||||
|
FLUSH LOGS;
|
||||||
|
### assertion: index file contains renamed binlog and the new one
|
||||||
|
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
|
||||||
|
SELECT @index;
|
||||||
|
@index
|
||||||
|
master-bin-b34582.000001
|
||||||
|
master-bin.000002
|
||||||
|
|
||||||
|
### assertion: original binlog content still exists, despite we
|
||||||
|
### renamed and changed the index file
|
||||||
|
show binlog events from <binlog_start>;
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin-b34582.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
|
||||||
|
### assertion: user changed binlog index shows correct entries
|
||||||
|
show binary logs;
|
||||||
|
Log_name File_size
|
||||||
|
master-bin-b34582.000001 #
|
||||||
|
master-bin.000002 #
|
||||||
|
DROP TABLE t1;
|
||||||
|
### assertion: purging binlogs up to binlog created after instrumenting index file should work
|
||||||
|
PURGE BINARY LOGS TO 'master-bin.000002';
|
||||||
|
### assertion: show binary logs should only contain latest binlog
|
||||||
|
show binary logs;
|
||||||
|
Log_name File_size
|
||||||
|
master-bin.000002 #
|
||||||
|
### assertion: assert that binlog files were indeed purged (using file_exists calls)
|
||||||
|
### assertion: assert that not purged binlog file exists
|
||||||
|
### assertion: show index file contents and these should match show binary logs issued above
|
||||||
|
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
|
||||||
|
SELECT @index;
|
||||||
|
@index
|
||||||
|
master-bin.000002
|
||||||
|
|
||||||
|
RESET MASTER;
|
@ -1309,3 +1309,27 @@ INSERT INTO test.t1 VALUES (1), (2);
|
|||||||
CREATE TABLE test.t2 SELECT * FROM test.t1;
|
CREATE TABLE test.t2 SELECT * FROM test.t1;
|
||||||
USE test;
|
USE test;
|
||||||
DROP TABLES t1, t2;
|
DROP TABLES t1, t2;
|
||||||
|
RESET MASTER;
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||||
|
BINLOG '
|
||||||
|
3u9kSA8KAAAAZgAAAGoAAAABAAQANS4xLjM1LW1hcmlhLWJldGExLWRlYnVnLWxvZwAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAADe72RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
|
||||||
|
';
|
||||||
|
INSERT INTO t1 VALUES (1);
|
||||||
|
BINLOG '
|
||||||
|
3u9kSBMUAAAAKQAAAJEBAAAAABoAAAAAAAAABHRlc3QAAnQxAAEDAAA=
|
||||||
|
3u9kSBcUAAAAIgAAALMBAAAQABoAAAAAAAEAAf/+AgAAAA==
|
||||||
|
';
|
||||||
|
SHOW BINLOG EVENTS;
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
# # Format_desc 1 # Server ver: #, Binlog ver: #
|
||||||
|
# # Query 1 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY)
|
||||||
|
# # Query 1 # BEGIN
|
||||||
|
# # Table_map 1 # table_id: # (test.t1)
|
||||||
|
# # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
# # Query 1 # COMMIT
|
||||||
|
# # Query 1 # BEGIN
|
||||||
|
# # Table_map 1 # table_id: # (test.t1)
|
||||||
|
# # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
# # Query 1 # COMMIT
|
||||||
|
DROP TABLE t1;
|
||||||
|
161
mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result
Normal file
161
mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
Verbose statements from : write-partial-row.binlog
|
||||||
|
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
|
||||||
|
stmt
|
||||||
|
### INSERT INTO mysql.ndb_apply_status
|
||||||
|
### SET
|
||||||
|
### @1=1
|
||||||
|
### @2=25769803786
|
||||||
|
### @3=''
|
||||||
|
### @4=0
|
||||||
|
### @5=0
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=3
|
||||||
|
### @2=3
|
||||||
|
### @3=3
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=1
|
||||||
|
### @2=1
|
||||||
|
### @3=1
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=2
|
||||||
|
### @2=2
|
||||||
|
### @3=2
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=4
|
||||||
|
### @2=4
|
||||||
|
### @3=4
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=4
|
||||||
|
### @3=40
|
||||||
|
### DELETE FROM test.ba
|
||||||
|
### WHERE
|
||||||
|
### @1=2
|
||||||
|
drop table raw_binlog_rows;
|
||||||
|
Verbose statements from : write-full-row.binlog
|
||||||
|
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
|
||||||
|
stmt
|
||||||
|
### INSERT INTO mysql.ndb_apply_status
|
||||||
|
### SET
|
||||||
|
### @1=2
|
||||||
|
### @2=25769803786
|
||||||
|
### @3=''
|
||||||
|
### @4=0
|
||||||
|
### @5=0
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=3
|
||||||
|
### @2=3
|
||||||
|
### @3=3
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=1
|
||||||
|
### @2=1
|
||||||
|
### @3=1
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=2
|
||||||
|
### @2=2
|
||||||
|
### @3=2
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=4
|
||||||
|
### @2=4
|
||||||
|
### @3=4
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=4
|
||||||
|
### @2=4
|
||||||
|
### @3=40
|
||||||
|
### DELETE FROM test.ba
|
||||||
|
### WHERE
|
||||||
|
### @1=2
|
||||||
|
drop table raw_binlog_rows;
|
||||||
|
Verbose statements from : update-partial-row.binlog
|
||||||
|
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
|
||||||
|
stmt
|
||||||
|
### INSERT INTO mysql.ndb_apply_status
|
||||||
|
### SET
|
||||||
|
### @1=3
|
||||||
|
### @2=25769803786
|
||||||
|
### @3=''
|
||||||
|
### @4=0
|
||||||
|
### @5=0
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=3
|
||||||
|
### @2=3
|
||||||
|
### @3=3
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=1
|
||||||
|
### @2=1
|
||||||
|
### @3=1
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=2
|
||||||
|
### @2=2
|
||||||
|
### @3=2
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=4
|
||||||
|
### @2=4
|
||||||
|
### @3=4
|
||||||
|
### UPDATE test.ba
|
||||||
|
### WHERE
|
||||||
|
### @1=4
|
||||||
|
### @3=4
|
||||||
|
### SET
|
||||||
|
### @1=4
|
||||||
|
### @3=40
|
||||||
|
### DELETE FROM test.ba
|
||||||
|
### WHERE
|
||||||
|
### @1=2
|
||||||
|
drop table raw_binlog_rows;
|
||||||
|
Verbose statements from : update-full-row.binlog
|
||||||
|
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
|
||||||
|
stmt
|
||||||
|
### INSERT INTO mysql.ndb_apply_status
|
||||||
|
### SET
|
||||||
|
### @1=4
|
||||||
|
### @2=25769803786
|
||||||
|
### @3=''
|
||||||
|
### @4=0
|
||||||
|
### @5=0
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=3
|
||||||
|
### @2=3
|
||||||
|
### @3=3
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=1
|
||||||
|
### @2=1
|
||||||
|
### @3=1
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=2
|
||||||
|
### @2=2
|
||||||
|
### @3=2
|
||||||
|
### INSERT INTO test.ba
|
||||||
|
### SET
|
||||||
|
### @1=4
|
||||||
|
### @2=4
|
||||||
|
### @3=4
|
||||||
|
### UPDATE test.ba
|
||||||
|
### WHERE
|
||||||
|
### @1=4
|
||||||
|
### @2=4
|
||||||
|
### @3=4
|
||||||
|
### SET
|
||||||
|
### @1=4
|
||||||
|
### @2=4
|
||||||
|
### @3=40
|
||||||
|
### DELETE FROM test.ba
|
||||||
|
### WHERE
|
||||||
|
### @1=2
|
||||||
|
drop table raw_binlog_rows;
|
@ -784,3 +784,24 @@ INSERT INTO test.t1 VALUES (1), (2);
|
|||||||
CREATE TABLE test.t2 SELECT * FROM test.t1;
|
CREATE TABLE test.t2 SELECT * FROM test.t1;
|
||||||
USE test;
|
USE test;
|
||||||
DROP TABLES t1, t2;
|
DROP TABLES t1, t2;
|
||||||
|
RESET MASTER;
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||||
|
BINLOG '
|
||||||
|
3u9kSA8KAAAAZgAAAGoAAAABAAQANS4xLjM1LW1hcmlhLWJldGExLWRlYnVnLWxvZwAAAAAAAAAA
|
||||||
|
AAAAAAAAAAAAAAAAAADe72RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
|
||||||
|
';
|
||||||
|
INSERT INTO t1 VALUES (1);
|
||||||
|
BINLOG '
|
||||||
|
3u9kSBMUAAAAKQAAAJEBAAAAABoAAAAAAAAABHRlc3QAAnQxAAEDAAA=
|
||||||
|
3u9kSBcUAAAAIgAAALMBAAAQABoAAAAAAAEAAf/+AgAAAA==
|
||||||
|
';
|
||||||
|
SHOW BINLOG EVENTS;
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
# # Format_desc 1 # Server ver: #, Binlog ver: #
|
||||||
|
# # Query 1 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY)
|
||||||
|
# # Query 1 # use `test`; INSERT INTO t1 VALUES (1)
|
||||||
|
# # Query 1 # BEGIN
|
||||||
|
# # Table_map 1 # table_id: # (test.t1)
|
||||||
|
# # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
# # Query 1 # COMMIT
|
||||||
|
DROP TABLE t1;
|
||||||
|
BIN
mysql-test/suite/binlog/std_data/update-full-row.binlog
Normal file
BIN
mysql-test/suite/binlog/std_data/update-full-row.binlog
Normal file
Binary file not shown.
BIN
mysql-test/suite/binlog/std_data/update-partial-row.binlog
Normal file
BIN
mysql-test/suite/binlog/std_data/update-partial-row.binlog
Normal file
Binary file not shown.
BIN
mysql-test/suite/binlog/std_data/write-full-row.binlog
Normal file
BIN
mysql-test/suite/binlog/std_data/write-full-row.binlog
Normal file
Binary file not shown.
BIN
mysql-test/suite/binlog/std_data/write-partial-row.binlog
Normal file
BIN
mysql-test/suite/binlog/std_data/write-partial-row.binlog
Normal file
Binary file not shown.
114
mysql-test/suite/binlog/t/binlog_delete_and_flush_index.test
Normal file
114
mysql-test/suite/binlog/t/binlog_delete_and_flush_index.test
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
# BUG#34582: FLUSH LOGS does not close and reopen the binlog index
|
||||||
|
# file
|
||||||
|
#
|
||||||
|
# WHAT
|
||||||
|
# ====
|
||||||
|
#
|
||||||
|
# We want to test that FLUSH LOGS closes and reopens binlog index
|
||||||
|
# file.
|
||||||
|
#
|
||||||
|
# HOW
|
||||||
|
# ===
|
||||||
|
#
|
||||||
|
# PREPARE:
|
||||||
|
# 1. create some binlog events
|
||||||
|
# 2. show index content, binlog events and binlog contents
|
||||||
|
# for mysql-bin.000001
|
||||||
|
# 3. copy the mysql-bin.000001 to mysql-bin-b34582.000001
|
||||||
|
# 4. change the index file so that mysql-bin.000001 is replaced
|
||||||
|
# with mysql-bin-b34582.000001
|
||||||
|
# 5. FLUSH the logs so that new index is closed and reopened
|
||||||
|
#
|
||||||
|
# ASSERTIONS:
|
||||||
|
# 1. index file contents shows mysql-bin-b34582.000001 and
|
||||||
|
# mysql-bin.000002
|
||||||
|
# 1. show binary logs shows current index entries
|
||||||
|
# 2. binlog contents for mysql-bin-b34582.000001 are displayed
|
||||||
|
# 3. Purge binlogs up to the latest one succeeds
|
||||||
|
# 4. SHOW BINARY LOGS presents the latest one only after purging
|
||||||
|
# 5. Purged binlogs files don't exist in the filesystem
|
||||||
|
# 6. Not purged binlog file exists in the filesystem
|
||||||
|
#
|
||||||
|
# CLEAN UP:
|
||||||
|
# 1. RESET MASTER
|
||||||
|
#
|
||||||
|
|
||||||
|
-- source include/have_log_bin.inc
|
||||||
|
|
||||||
|
RESET MASTER;
|
||||||
|
|
||||||
|
-- let $datadir= `SELECT @@datadir`
|
||||||
|
-- let $index=$datadir/master-bin.index
|
||||||
|
-- chmod 0644 $index
|
||||||
|
|
||||||
|
# action: issue one command so that binlog gets some event
|
||||||
|
CREATE TABLE t1 (a int);
|
||||||
|
|
||||||
|
-- echo ### assertion: index file contains regular entries
|
||||||
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
|
-- eval SET @index=LOAD_FILE('$index')
|
||||||
|
-- replace_regex /\.[\\\/]master/master/
|
||||||
|
SELECT @index;
|
||||||
|
|
||||||
|
--echo ### assertion: show original binlogs
|
||||||
|
-- source include/show_binary_logs.inc
|
||||||
|
|
||||||
|
--echo ### assertion: binlog contents from regular entries
|
||||||
|
-- source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
# action: copy binlogs to other names and change entries in index file
|
||||||
|
-- copy_file $datadir/master-bin.000001 $datadir/master-bin-b34582.000001
|
||||||
|
let INDEX_FILE=$index;
|
||||||
|
perl;
|
||||||
|
$file= $ENV{'INDEX_FILE'};
|
||||||
|
open(FILE, ">$file") || die "Unable to open $file.";
|
||||||
|
truncate(FILE,0);
|
||||||
|
close ($file);
|
||||||
|
EOF
|
||||||
|
|
||||||
|
-- append_file $index
|
||||||
|
master-bin-b34582.000001
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# action: should cause rotation, and creation of new binlogs
|
||||||
|
FLUSH LOGS;
|
||||||
|
|
||||||
|
# file is not used anymore - remove it (mysql closed on flush logs).
|
||||||
|
-- remove_file $datadir/master-bin.000001
|
||||||
|
|
||||||
|
-- echo ### assertion: index file contains renamed binlog and the new one
|
||||||
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
|
-- eval SET @index=LOAD_FILE('$index')
|
||||||
|
-- replace_regex /\.[\\\/]master/master/
|
||||||
|
SELECT @index;
|
||||||
|
|
||||||
|
-- echo ### assertion: original binlog content still exists, despite we
|
||||||
|
-- echo ### renamed and changed the index file
|
||||||
|
-- source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
-- echo ### assertion: user changed binlog index shows correct entries
|
||||||
|
-- source include/show_binary_logs.inc
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
-- echo ### assertion: purging binlogs up to binlog created after instrumenting index file should work
|
||||||
|
-- let $current_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||||
|
-- eval PURGE BINARY LOGS TO '$current_binlog'
|
||||||
|
|
||||||
|
-- echo ### assertion: show binary logs should only contain latest binlog
|
||||||
|
-- source include/show_binary_logs.inc
|
||||||
|
|
||||||
|
-- echo ### assertion: assert that binlog files were indeed purged (using file_exists calls)
|
||||||
|
-- error 1
|
||||||
|
-- file_exists $datadir/master-bin-b34852.000001
|
||||||
|
|
||||||
|
-- echo ### assertion: assert that not purged binlog file exists
|
||||||
|
-- file_exists $datadir/$current_binlog
|
||||||
|
|
||||||
|
-- echo ### assertion: show index file contents and these should match show binary logs issued above
|
||||||
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
|
-- eval SET @index=LOAD_FILE('$index')
|
||||||
|
-- replace_regex /\.[\\\/]master/master/
|
||||||
|
SELECT @index;
|
||||||
|
|
||||||
|
RESET MASTER;
|
@ -0,0 +1,86 @@
|
|||||||
|
########################################################
|
||||||
|
# Test mysqlbinlog command with Ndb produced Binlog
|
||||||
|
# variants
|
||||||
|
#
|
||||||
|
# WHAT
|
||||||
|
# ====
|
||||||
|
# This test aims to check that the mysqlbinlog --verbose
|
||||||
|
# command can output binlogs in 4 format variants, currently
|
||||||
|
# used by Ndb
|
||||||
|
#
|
||||||
|
# 1) Updates logged as write_row events
|
||||||
|
# Only primary key and updated columns included in the
|
||||||
|
# event
|
||||||
|
# 2) Updates logged as write_row_events
|
||||||
|
# All columns included in the event
|
||||||
|
# 3) Updates logged as update_row events
|
||||||
|
# Only primary key and updated columns included in the
|
||||||
|
# event
|
||||||
|
# 4) Updates logged as update_row events
|
||||||
|
# All columns included in the event
|
||||||
|
#
|
||||||
|
# Format variant (1) is the Ndb default.
|
||||||
|
# Bug#47323 resulted in binlogs generated in format (1)
|
||||||
|
# being incorrectly parsed by the mysqlbinlog --verbose
|
||||||
|
# option
|
||||||
|
#
|
||||||
|
# HOW
|
||||||
|
# ===
|
||||||
|
# Row-based binlog files in each format have been
|
||||||
|
# captured from an Ndb cluster
|
||||||
|
# These are output using the mysqlbinlog --verbose
|
||||||
|
# tool and the output is checked.
|
||||||
|
#
|
||||||
|
########################################################
|
||||||
|
|
||||||
|
# We require binlog_format_row as we're independent of binlog format
|
||||||
|
# and there's no point running the same test 3 times
|
||||||
|
-- source include/have_binlog_format_row.inc
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
--let $binlog_file=write-partial-row.binlog
|
||||||
|
--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||||
|
create table raw_binlog_rows (txt varchar(1000));
|
||||||
|
--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
|
||||||
|
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||||
|
--enable_query_log
|
||||||
|
--echo Verbose statements from : $binlog_file
|
||||||
|
# Output --verbose lines, with extra Windows CR's trimmed
|
||||||
|
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
|
||||||
|
drop table raw_binlog_rows;
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
--let $binlog_file=write-full-row.binlog
|
||||||
|
--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||||
|
create table raw_binlog_rows (txt varchar(1000));
|
||||||
|
--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
|
||||||
|
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||||
|
--enable_query_log
|
||||||
|
--echo Verbose statements from : $binlog_file
|
||||||
|
# Output --verbose lines, with extra Windows CR's trimmed
|
||||||
|
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
|
||||||
|
drop table raw_binlog_rows;
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
--let $binlog_file=update-partial-row.binlog
|
||||||
|
--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||||
|
create table raw_binlog_rows (txt varchar(1000));
|
||||||
|
--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
|
||||||
|
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||||
|
--enable_query_log
|
||||||
|
--echo Verbose statements from : $binlog_file
|
||||||
|
# Output --verbose lines, with extra Windows CR's trimmed
|
||||||
|
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
|
||||||
|
drop table raw_binlog_rows;
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
--let $binlog_file=update-full-row.binlog
|
||||||
|
--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||||
|
create table raw_binlog_rows (txt varchar(1000));
|
||||||
|
--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
|
||||||
|
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||||
|
--enable_query_log
|
||||||
|
--echo Verbose statements from : $binlog_file
|
||||||
|
# Output --verbose lines, with extra Windows CR's trimmed
|
||||||
|
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
|
||||||
|
drop table raw_binlog_rows;
|
35
mysql-test/suite/innodb/r/innodb-consistent.result
Normal file
35
mysql-test/suite/innodb/r/innodb-consistent.result
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
drop table if exists t1;
|
||||||
|
set session transaction isolation level read committed;
|
||||||
|
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||||
|
create table t2 like t1;
|
||||||
|
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
|
||||||
|
set autocommit=0;
|
||||||
|
begin;
|
||||||
|
replace into t1 select * from t2;
|
||||||
|
set session transaction isolation level read committed;
|
||||||
|
set autocommit=0;
|
||||||
|
delete from t2 where a=5;
|
||||||
|
commit;
|
||||||
|
delete from t2;
|
||||||
|
commit;
|
||||||
|
commit;
|
||||||
|
begin;
|
||||||
|
insert into t1 select * from t2;
|
||||||
|
set session transaction isolation level read committed;
|
||||||
|
set autocommit=0;
|
||||||
|
delete from t2 where a=5;
|
||||||
|
commit;
|
||||||
|
delete from t2;
|
||||||
|
commit;
|
||||||
|
commit;
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
drop table t1;
|
||||||
|
drop table t2;
|
@ -141,7 +141,7 @@ drop table t1;
|
|||||||
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
|
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
|
||||||
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
|
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
|
||||||
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
|
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
|
||||||
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439)))
|
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
|
||||||
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
|
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
|
||||||
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
|
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
9
mysql-test/suite/innodb/r/innodb_bug44571.result
Normal file
9
mysql-test/suite/innodb/r/innodb_bug44571.result
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
|
||||||
|
ALTER TABLE bug44571 CHANGE foo bar INT;
|
||||||
|
ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
|
||||||
|
ERROR 42000: Key column 'foo' doesn't exist in table
|
||||||
|
ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
|
||||||
|
ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
|
||||||
|
CREATE INDEX bug44571b ON bug44571 (bar);
|
||||||
|
ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
|
||||||
|
DROP TABLE bug44571;
|
1
mysql-test/suite/innodb/t/innodb-consistent-master.opt
Normal file
1
mysql-test/suite/innodb/t/innodb-consistent-master.opt
Normal file
@ -0,0 +1 @@
|
|||||||
|
--innodb_lock_wait_timeout=2
|
59
mysql-test/suite/innodb/t/innodb-consistent.test
Normal file
59
mysql-test/suite/innodb/t/innodb-consistent.test
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
-- source include/not_embedded.inc
|
||||||
|
-- source include/have_innodb.inc
|
||||||
|
-- source suite/innodb/include/have_innodb_plugin.inc
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
drop table if exists t1;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
|
||||||
|
# a consistent read of the source table.
|
||||||
|
|
||||||
|
connect (a,localhost,root,,);
|
||||||
|
connect (b,localhost,root,,);
|
||||||
|
connection a;
|
||||||
|
set session transaction isolation level read committed;
|
||||||
|
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
|
||||||
|
create table t2 like t1;
|
||||||
|
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
|
||||||
|
set autocommit=0;
|
||||||
|
|
||||||
|
# REPLACE INTO ... SELECT case
|
||||||
|
begin;
|
||||||
|
# this should not result in any locks on t2.
|
||||||
|
replace into t1 select * from t2;
|
||||||
|
|
||||||
|
connection b;
|
||||||
|
set session transaction isolation level read committed;
|
||||||
|
set autocommit=0;
|
||||||
|
# should not cuase a lock wait.
|
||||||
|
delete from t2 where a=5;
|
||||||
|
commit;
|
||||||
|
delete from t2;
|
||||||
|
commit;
|
||||||
|
connection a;
|
||||||
|
commit;
|
||||||
|
|
||||||
|
# INSERT INTO ... SELECT case
|
||||||
|
begin;
|
||||||
|
# this should not result in any locks on t2.
|
||||||
|
insert into t1 select * from t2;
|
||||||
|
|
||||||
|
connection b;
|
||||||
|
set session transaction isolation level read committed;
|
||||||
|
set autocommit=0;
|
||||||
|
# should not cuase a lock wait.
|
||||||
|
delete from t2 where a=5;
|
||||||
|
commit;
|
||||||
|
delete from t2;
|
||||||
|
commit;
|
||||||
|
connection a;
|
||||||
|
commit;
|
||||||
|
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
drop table t2;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
disconnect a;
|
||||||
|
disconnect b;
|
@ -106,7 +106,7 @@ drop table t1;
|
|||||||
--error ER_TOO_BIG_ROWSIZE
|
--error ER_TOO_BIG_ROWSIZE
|
||||||
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
|
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
|
||||||
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
|
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
|
||||||
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439)))
|
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
|
||||||
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
|
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
|
||||||
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
|
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
18
mysql-test/suite/innodb/t/innodb_bug44571.test
Normal file
18
mysql-test/suite/innodb/t/innodb_bug44571.test
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# Bug#44571 InnoDB Plugin crashes on ADD INDEX
|
||||||
|
# http://bugs.mysql.com/44571
|
||||||
|
#
|
||||||
|
-- source include/have_innodb.inc
|
||||||
|
-- source suite/innodb/include/have_innodb_plugin.inc
|
||||||
|
|
||||||
|
CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
|
||||||
|
ALTER TABLE bug44571 CHANGE foo bar INT;
|
||||||
|
-- error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||||
|
ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
|
||||||
|
# The following will fail, because the CHANGE foo bar was
|
||||||
|
# not communicated to InnoDB.
|
||||||
|
--error ER_NOT_KEYFILE
|
||||||
|
ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
|
||||||
|
--error ER_NOT_KEYFILE
|
||||||
|
CREATE INDEX bug44571b ON bug44571 (bar);
|
||||||
|
DROP TABLE bug44571;
|
@ -50,7 +50,7 @@ kill @id;
|
|||||||
drop table t2,t3;
|
drop table t2,t3;
|
||||||
insert into t4 values (3),(4);
|
insert into t4 values (3),(4);
|
||||||
connection master;
|
connection master;
|
||||||
--error 0,1053,2013
|
--error 0,1317,2013
|
||||||
reap;
|
reap;
|
||||||
connection master1;
|
connection master1;
|
||||||
save_master_pos;
|
save_master_pos;
|
||||||
|
@ -37,6 +37,14 @@ UPDATE t1 SET col2=col1;
|
|||||||
SELECT * FROM t1 WHERE col1=col2 ORDER BY col1;
|
SELECT * FROM t1 WHERE col1=col2 ORDER BY col1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#45645 Mysql server close all connection and restart using lower function
|
||||||
|
--echo #
|
||||||
|
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_test_ci;
|
||||||
|
INSERT INTO t1 (a) VALUES ('hello!');
|
||||||
|
SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Bug#43827 Server closes connections and restarts
|
--echo # Bug#43827 Server closes connections and restarts
|
||||||
--echo #
|
--echo #
|
||||||
@ -86,3 +94,8 @@ select hex(c1) as h, c1 from t1 order by c1, h;
|
|||||||
select group_concat(hex(c1) order by hex(c1)) from t1 group by c1;
|
select group_concat(hex(c1) order by hex(c1)) from t1 group by c1;
|
||||||
select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1;
|
select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20
|
||||||
|
set names latin1;
|
||||||
|
show collation like 'latin1_test';
|
||||||
|
select "foo" = "foo " collate latin1_test;
|
||||||
|
@ -57,7 +57,7 @@ connection con1;
|
|||||||
# debug build running without our --debug=make_global..., will be
|
# debug build running without our --debug=make_global..., will be
|
||||||
# error 0 (no error). The only important thing to test is that on
|
# error 0 (no error). The only important thing to test is that on
|
||||||
# debug builds with our --debug=make_global... we don't hang forever.
|
# debug builds with our --debug=make_global... we don't hang forever.
|
||||||
--error 0,1053,2013
|
--error 0,1317,2013
|
||||||
reap;
|
reap;
|
||||||
|
|
||||||
connection con2;
|
connection con2;
|
||||||
|
@ -1006,3 +1006,51 @@ DROP TABLE t1;
|
|||||||
|
|
||||||
###
|
###
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # BUG#47280 - strange results from count(*) with order by multiple
|
||||||
|
--echo # columns without where/group
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Initialize test
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
pk INT NOT NULL,
|
||||||
|
i INT,
|
||||||
|
PRIMARY KEY (pk)
|
||||||
|
);
|
||||||
|
INSERT INTO t1 VALUES (1,11),(2,12),(3,13);
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Start test
|
||||||
|
--echo # All the following queries shall return 1 record
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo # Masking all correct values {11...13} for column i in this result.
|
||||||
|
--replace_column 2 #
|
||||||
|
SELECT MAX(pk) as max, i
|
||||||
|
FROM t1
|
||||||
|
ORDER BY max;
|
||||||
|
|
||||||
|
--echo
|
||||||
|
EXPLAIN
|
||||||
|
SELECT MAX(pk) as max, i
|
||||||
|
FROM t1
|
||||||
|
ORDER BY max;
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo # Only 11 is correct for collumn i in this result
|
||||||
|
SELECT MAX(pk) as max, i
|
||||||
|
FROM t1
|
||||||
|
WHERE pk<2
|
||||||
|
ORDER BY max;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Cleanup
|
||||||
|
--echo #
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo End of 5.1 tests
|
||||||
|
@ -881,4 +881,25 @@ SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
|
|||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #48258: Assertion failed when using a spatial index
|
||||||
|
--echo #
|
||||||
|
CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
|
||||||
|
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
|
||||||
|
EXPLAIN SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
EXPLAIN SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
EXPLAIN SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
EXPLAIN SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
EXPLAIN SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.0 tests.
|
--echo End of 5.0 tests.
|
||||||
|
@ -655,6 +655,22 @@ insert into t1 values (),(),();
|
|||||||
select min(`col002`) from t1 union select `col002` from t1;
|
select min(`col002`) from t1 union select `col002` from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #47780: crash when comparing GIS items from subquery
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1(a INT, b MULTIPOLYGON);
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(0,
|
||||||
|
GEOMFROMTEXT(
|
||||||
|
'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))'));
|
||||||
|
|
||||||
|
--echo # must not crash
|
||||||
|
SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,6 +163,41 @@ connection default;
|
|||||||
DROP USER 'mysqltest1'@'%';
|
DROP USER 'mysqltest1'@'%';
|
||||||
DROP DATABASE mysqltest_1;
|
DROP DATABASE mysqltest_1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#41597 - After rename of user, there are additional grants
|
||||||
|
--echo # when grants are reapplied.
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE DATABASE temp;
|
||||||
|
CREATE TABLE temp.t1(a INT, b VARCHAR(10));
|
||||||
|
INSERT INTO temp.t1 VALUES(1, 'name1');
|
||||||
|
INSERT INTO temp.t1 VALUES(2, 'name2');
|
||||||
|
INSERT INTO temp.t1 VALUES(3, 'name3');
|
||||||
|
|
||||||
|
|
||||||
|
CREATE USER 'user1'@'%';
|
||||||
|
RENAME USER 'user1'@'%' TO 'user2'@'%';
|
||||||
|
--echo # Show privileges after rename and BEFORE grant
|
||||||
|
SHOW GRANTS FOR 'user2'@'%';
|
||||||
|
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%';
|
||||||
|
--echo # Show privileges after rename and grant
|
||||||
|
SHOW GRANTS FOR 'user2'@'%';
|
||||||
|
|
||||||
|
--echo # Connect as the renamed user
|
||||||
|
connect (conn1, localhost, user2,,);
|
||||||
|
connection conn1;
|
||||||
|
SHOW GRANTS;
|
||||||
|
SELECT a FROM temp.t1;
|
||||||
|
--echo # Check for additional privileges by accessing a
|
||||||
|
--echo # non privileged column. We shouldn't be able to
|
||||||
|
--echo # access this column.
|
||||||
|
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||||
|
SELECT b FROM temp.t1;
|
||||||
|
disconnect conn1;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
DROP USER 'user2'@'%';
|
||||||
|
DROP DATABASE temp;
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
-- disable_result_log
|
-- disable_result_log
|
||||||
|
|
||||||
# set packet size and reconnect
|
# set packet size and reconnect
|
||||||
|
let $max_packet=`select @@global.max_allowed_packet`;
|
||||||
SET @@global.max_allowed_packet=16777216;
|
SET @@global.max_allowed_packet=16777216;
|
||||||
--connect (newconn, localhost, root,,)
|
--connect (newconn, localhost, root,,)
|
||||||
|
|
||||||
|
@ -461,4 +461,33 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a;
|
|||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #47963: Wrong results when index is used
|
||||||
|
--echo #
|
||||||
|
CREATE TABLE t1(
|
||||||
|
a VARCHAR(5) NOT NULL,
|
||||||
|
b VARCHAR(5) NOT NULL,
|
||||||
|
c DATETIME NOT NULL,
|
||||||
|
KEY (c)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00');
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00';
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0';
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00';
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0';
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000';
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001';
|
||||||
|
SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
|
||||||
|
EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND
|
||||||
|
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
@ -97,7 +97,7 @@ select ((@id := kill_id) - kill_id) from t3;
|
|||||||
kill @id;
|
kill @id;
|
||||||
|
|
||||||
connection conn1;
|
connection conn1;
|
||||||
-- error 1053,2013
|
-- error 1317,2013
|
||||||
reap;
|
reap;
|
||||||
|
|
||||||
connection default;
|
connection default;
|
||||||
|
18
mysql-test/t/locale.test
Normal file
18
mysql-test/t/locale.test
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS t1;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
--echo Start of 5.4 tests
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#43207 wrong LC_TIME names for romanian locale
|
||||||
|
--echo #
|
||||||
|
SET NAMES utf8;
|
||||||
|
SET lc_time_names=ro_RO;
|
||||||
|
SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
|
||||||
|
SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
|
||||||
|
SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
|
||||||
|
SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
|
||||||
|
SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
|
||||||
|
SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
|
||||||
|
SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
|
||||||
|
--echo End of 5.4 tests
|
@ -1518,5 +1518,36 @@ CREATE TABLE t3 select * from t1;
|
|||||||
checksum table t3;
|
checksum table t3;
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#47073 - valgrind errs, corruption,failed repair of partition,
|
||||||
|
# low myisam_sort_buffer_size
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b));
|
||||||
|
INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'),
|
||||||
|
(6,'0'),(7,'0');
|
||||||
|
INSERT INTO t1 SELECT a+10,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+20,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+40,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+80,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+160,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+320,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+640,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+1280,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+2560,b FROM t1;
|
||||||
|
INSERT INTO t1 SELECT a+5120,b FROM t1;
|
||||||
|
SET myisam_sort_buffer_size=4;
|
||||||
|
REPAIR TABLE t1;
|
||||||
|
|
||||||
|
# !!! Disabled until additional fix for BUG#47073 is pushed.
|
||||||
|
#SET myisam_repair_threads=2;
|
||||||
|
# May report different values depending on threads activity.
|
||||||
|
#--replace_regex /changed from [0-9]+/changed from #/
|
||||||
|
#REPAIR TABLE t1;
|
||||||
|
#SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||||
|
|
||||||
|
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
|
||||||
|
@ -26,12 +26,6 @@ SET SESSION debug="d,crash_before_flush_keys";
|
|||||||
--error 2013
|
--error 2013
|
||||||
FLUSH TABLE t1;
|
FLUSH TABLE t1;
|
||||||
|
|
||||||
--echo # Run MYISAMCHK tool to check the table t1 and repair
|
|
||||||
--replace_result $MYISAMCHK MYISAMCHK $MYSQLD_DATADIR MYSQLD_DATADIR
|
|
||||||
--error 255
|
|
||||||
--exec $MYISAMCHK -cs $MYSQLD_DATADIR/test/t1 2>&1
|
|
||||||
--exec $MYISAMCHK -rs $MYSQLD_DATADIR/test/t1
|
|
||||||
|
|
||||||
--echo # Write file to make mysql-test-run.pl start the server
|
--echo # Write file to make mysql-test-run.pl start the server
|
||||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||||
|
|
||||||
@ -42,8 +36,6 @@ FLUSH TABLE t1;
|
|||||||
--echo # it to be back online again
|
--echo # it to be back online again
|
||||||
--source include/wait_until_connected_again.inc
|
--source include/wait_until_connected_again.inc
|
||||||
|
|
||||||
SHOW CREATE TABLE t1;
|
# Must report that the table wasn't closed properly
|
||||||
|
CHECK TABLE t1;
|
||||||
SELECT * FROM t1 FORCE INDEX (PRIMARY);
|
|
||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@ -854,6 +854,7 @@ while ($outer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Test source in an if in a while which is false on 1st iteration
|
# Test source in an if in a while which is false on 1st iteration
|
||||||
|
# Also test --error in same context
|
||||||
let $outer= 2; # Number of outer loops
|
let $outer= 2; # Number of outer loops
|
||||||
let $ifval= 0; # false 1st time
|
let $ifval= 0; # false 1st time
|
||||||
while ($outer)
|
while ($outer)
|
||||||
@ -862,6 +863,8 @@ while ($outer)
|
|||||||
|
|
||||||
if ($ifval) {
|
if ($ifval) {
|
||||||
--source $MYSQLTEST_VARDIR/tmp/sourced.inc
|
--source $MYSQLTEST_VARDIR/tmp/sourced.inc
|
||||||
|
--error ER_NO_SUCH_TABLE
|
||||||
|
SELECT * from nowhere;
|
||||||
}
|
}
|
||||||
dec $outer;
|
dec $outer;
|
||||||
inc $ifval;
|
inc $ifval;
|
||||||
|
@ -4,6 +4,13 @@
|
|||||||
DROP TABLE IF EXISTS `t1`;
|
DROP TABLE IF EXISTS `t1`;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
|
# On some platforms the lowest possible open_files_limit is too high...
|
||||||
|
let $max_open_files_limit= `SELECT @@open_files_limit > 511`;
|
||||||
|
if ($max_open_files_limit)
|
||||||
|
{
|
||||||
|
skip Need open_files_limit to be lower than 512;
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
--echo # Bug#46922: crash when adding partitions and open_files_limit is reached
|
--echo # Bug#46922: crash when adding partitions and open_files_limit is reached
|
||||||
#
|
#
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
--source include/not_windows_embedded.inc
|
||||||
--source include/have_example_plugin.inc
|
--source include/have_example_plugin.inc
|
||||||
|
|
||||||
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
|
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
--source include/not_windows_embedded.inc
|
||||||
--source include/have_example_plugin.inc
|
--source include/have_example_plugin.inc
|
||||||
|
|
||||||
SELECT @@global.example_enum_var = 'e2';
|
SELECT @@global.example_enum_var = 'e2';
|
||||||
|
@ -1046,3 +1046,139 @@ explain select * from t2 where a=1000 and b<11;
|
|||||||
|
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#42846: wrong result returned for range scan when using covering index
|
||||||
|
#
|
||||||
|
CREATE TABLE t1( a INT, b INT, KEY( a, b ) );
|
||||||
|
|
||||||
|
CREATE TABLE t2( a INT, b INT, KEY( a, b ) );
|
||||||
|
|
||||||
|
CREATE TABLE t3( a INT, b INT, KEY( a, b ) );
|
||||||
|
|
||||||
|
INSERT INTO t1( a, b )
|
||||||
|
VALUES (0, 1), (1, 2), (1, 4), (2, 3), (5, 0), (9, 7);
|
||||||
|
|
||||||
|
INSERT INTO t2( a, b )
|
||||||
|
VALUES ( 1, 1), ( 2, 1), ( 3, 1), ( 4, 1), ( 5, 1),
|
||||||
|
( 6, 1), ( 7, 1), ( 8, 1), ( 9, 1), (10, 1),
|
||||||
|
(11, 1), (12, 1), (13, 1), (14, 1), (15, 1),
|
||||||
|
(16, 1), (17, 1), (18, 1), (19, 1), (20, 1);
|
||||||
|
|
||||||
|
INSERT INTO t2 SELECT a, 2 FROM t2 WHERE b = 1;
|
||||||
|
INSERT INTO t2 SELECT a, 3 FROM t2 WHERE b = 1;
|
||||||
|
|
||||||
|
# To make range scan compelling to the optimizer
|
||||||
|
INSERT INTO t2 SELECT -1, -1 FROM t2;
|
||||||
|
INSERT INTO t2 SELECT -1, -1 FROM t2;
|
||||||
|
INSERT INTO t2 SELECT -1, -1 FROM t2;
|
||||||
|
|
||||||
|
INSERT INTO t3
|
||||||
|
VALUES (1, 0), (2, 0), (3, 0), (4, 0), (5, 0),
|
||||||
|
(6, 0), (7, 0), (8, 0), (9, 0), (10, 0);
|
||||||
|
|
||||||
|
# To make range scan compelling to the optimizer
|
||||||
|
INSERT INTO t3 SELECT * FROM t3 WHERE a = 10;
|
||||||
|
INSERT INTO t3 SELECT * FROM t3 WHERE a = 10;
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Problem#1 Test queries. Will give missing results unless Problem#1 is fixed.
|
||||||
|
# With one exception, they are independent of Problem#2.
|
||||||
|
#
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a < 5 OR
|
||||||
|
5 < a AND b = 3 OR
|
||||||
|
3 <= a;
|
||||||
|
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a < 5 OR
|
||||||
|
5 < a AND b = 3 OR
|
||||||
|
3 <= a;
|
||||||
|
|
||||||
|
# Query below: Tests both Problem#1 and Problem#2 (EXPLAIN differs as well)
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a < 5 OR
|
||||||
|
5 <= a AND b = 3 OR
|
||||||
|
3 <= a;
|
||||||
|
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a < 5 OR
|
||||||
|
5 <= a AND b = 3 OR
|
||||||
|
3 <= a;
|
||||||
|
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a <= 5 OR
|
||||||
|
5 <= a AND b = 3 OR
|
||||||
|
3 <= a;
|
||||||
|
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a <= 5 OR
|
||||||
|
5 <= a AND b = 3 OR
|
||||||
|
3 <= a;
|
||||||
|
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a <= 5 OR
|
||||||
|
3 <= a;
|
||||||
|
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t1 WHERE
|
||||||
|
3 <= a AND a <= 5 OR
|
||||||
|
3 <= a;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Problem#2 Test queries.
|
||||||
|
# These queries will give missing results if Problem#1 is fixed.
|
||||||
|
# But Problem#1 also hides this bug.
|
||||||
|
#
|
||||||
|
SELECT * FROM t2 WHERE
|
||||||
|
5 <= a AND a < 10 AND b = 1 OR
|
||||||
|
15 <= a AND a < 20 AND b = 3
|
||||||
|
OR
|
||||||
|
1 <= a AND b = 1;
|
||||||
|
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t2 WHERE
|
||||||
|
5 <= a AND a < 10 AND b = 1 OR
|
||||||
|
15 <= a AND a < 20 AND b = 3
|
||||||
|
OR
|
||||||
|
1 <= a AND b = 1;
|
||||||
|
|
||||||
|
SELECT * FROM t2 WHERE
|
||||||
|
5 <= a AND a < 10 AND b = 2 OR
|
||||||
|
15 <= a AND a < 20 AND b = 3
|
||||||
|
OR
|
||||||
|
1 <= a AND b = 1;
|
||||||
|
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t2 WHERE
|
||||||
|
5 <= a AND a < 10 AND b = 2 OR
|
||||||
|
15 <= a AND a < 20 AND b = 3
|
||||||
|
OR
|
||||||
|
1 <= a AND b = 1;
|
||||||
|
|
||||||
|
SELECT * FROM t3 WHERE
|
||||||
|
5 <= a AND a < 10 AND b = 3 OR
|
||||||
|
a < 5 OR
|
||||||
|
a < 10;
|
||||||
|
|
||||||
|
EXPLAIN
|
||||||
|
SELECT * FROM t3 WHERE
|
||||||
|
5 <= a AND a < 10 AND b = 3 OR
|
||||||
|
a < 5 OR
|
||||||
|
a < 10;
|
||||||
|
|
||||||
|
DROP TABLE t1, t2, t3;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1(a INT, KEY(a));
|
||||||
|
INSERT INTO t1 VALUES (1), (NULL);
|
||||||
|
SELECT * FROM t1 WHERE a <> NULL and (a <> NULL or a <= NULL);
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo End of 5.1 tests
|
||||||
|
@ -3739,6 +3739,22 @@ EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
|
|||||||
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
|
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
|
||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when
|
||||||
|
--echo # forcing a spatial index
|
||||||
|
--echo #
|
||||||
|
CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
|
||||||
|
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
|
||||||
|
EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
|
||||||
|
SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
|
||||||
|
EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
|
||||||
|
SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
61
mysql-test/t/sp-bugs.test
Normal file
61
mysql-test/t/sp-bugs.test
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# Test file for stored procedure bugfixes
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #47412: Valgrind warnings / user can read uninitalized memory
|
||||||
|
--echo # using SP variables
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE SCHEMA testdb;
|
||||||
|
USE testdb;
|
||||||
|
DELIMITER |;
|
||||||
|
CREATE FUNCTION f2 () RETURNS INTEGER
|
||||||
|
BEGIN
|
||||||
|
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
|
||||||
|
RETURN f_not_exists () ;
|
||||||
|
END|
|
||||||
|
CREATE PROCEDURE p3 ( arg1 VARCHAR(32) )
|
||||||
|
BEGIN
|
||||||
|
CALL p_not_exists ( );
|
||||||
|
END|
|
||||||
|
DELIMITER ;|
|
||||||
|
--echo # should not return valgrind warnings
|
||||||
|
--error ER_SP_DOES_NOT_EXIST
|
||||||
|
CALL p3 ( f2 () );
|
||||||
|
|
||||||
|
DROP SCHEMA testdb;
|
||||||
|
|
||||||
|
CREATE SCHEMA testdb;
|
||||||
|
USE testdb;
|
||||||
|
DELIMITER |;
|
||||||
|
CREATE FUNCTION f2 () RETURNS INTEGER
|
||||||
|
BEGIN
|
||||||
|
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
|
||||||
|
RETURN f_not_exists () ;
|
||||||
|
END|
|
||||||
|
CREATE PROCEDURE p3 ( arg2 INTEGER )
|
||||||
|
BEGIN
|
||||||
|
CALL p_not_exists ( );
|
||||||
|
END|
|
||||||
|
DELIMITER ;|
|
||||||
|
--echo # should not return valgrind warnings
|
||||||
|
--error ER_SP_DOES_NOT_EXIST
|
||||||
|
CALL p3 ( f2 () );
|
||||||
|
|
||||||
|
DROP SCHEMA testdb;
|
||||||
|
|
||||||
|
CREATE SCHEMA testdb;
|
||||||
|
USE testdb;
|
||||||
|
DELIMITER |;
|
||||||
|
CREATE FUNCTION f2 () RETURNS INTEGER
|
||||||
|
BEGIN
|
||||||
|
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
|
||||||
|
RETURN f_not_exists () ;
|
||||||
|
END|
|
||||||
|
DELIMITER ;|
|
||||||
|
--echo # should not return valgrind warnings
|
||||||
|
SELECT f2 ();
|
||||||
|
|
||||||
|
DROP SCHEMA testdb;
|
||||||
|
|
||||||
|
|
||||||
|
--echo End of 5.1 tests
|
@ -2448,3 +2448,27 @@ SELECT AVG (a) FROM t1 WHERE b = 999999;
|
|||||||
--error ER_SP_DOES_NOT_EXIST
|
--error ER_SP_DOES_NOT_EXIST
|
||||||
SELECT non_existent (a) FROM t1 WHERE b = 999999;
|
SELECT non_existent (a) FROM t1 WHERE b = 999999;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #47788: Crash in TABLE_LIST::hide_view_error on UPDATE + VIEW +
|
||||||
|
--echo # SP + MERGE + ALTER
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (pk INT, b INT, KEY (b));
|
||||||
|
CREATE ALGORITHM = TEMPTABLE VIEW v1 AS SELECT * FROM t1;
|
||||||
|
|
||||||
|
CREATE PROCEDURE p1 (a int) UPDATE IGNORE v1 SET b = a;
|
||||||
|
|
||||||
|
--error ER_NON_UPDATABLE_TABLE
|
||||||
|
CALL p1(5);
|
||||||
|
|
||||||
|
ALTER TABLE t1 CHANGE COLUMN b b2 INT;
|
||||||
|
|
||||||
|
--error ER_VIEW_INVALID
|
||||||
|
CALL p1(7);
|
||||||
|
|
||||||
|
DROP PROCEDURE p1;
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo End of 5.1 tests
|
||||||
|
@ -452,3 +452,18 @@ DROP TABLE t1;
|
|||||||
DROP FUNCTION f1;
|
DROP FUNCTION f1;
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #47919 assert in open_table during ALTER temporary table
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1));
|
||||||
|
CREATE TEMPORARY TABLE t2 LIKE t1;
|
||||||
|
INSERT INTO t1 VALUES (1);
|
||||||
|
INSERT INTO t2 VALUES (1);
|
||||||
|
|
||||||
|
ALTER TABLE t2 COMMENT = 'ABC';
|
||||||
|
UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
|
||||||
|
ALTER TABLE t2 COMMENT = 'DEF';
|
||||||
|
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
@ -1506,3 +1506,29 @@ DROP VIEW v1;
|
|||||||
# Wait till we reached the initial number of concurrent sessions
|
# Wait till we reached the initial number of concurrent sessions
|
||||||
--source include/wait_until_count_sessions.inc
|
--source include/wait_until_count_sessions.inc
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #46019: ERROR 1356 When selecting from within another
|
||||||
|
--echo # view that has Group By
|
||||||
|
--echo #
|
||||||
|
CREATE DATABASE mysqltest1;
|
||||||
|
USE mysqltest1;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
|
||||||
|
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT a FROM t1 GROUP BY a;
|
||||||
|
CREATE SQL SECURITY INVOKER VIEW v2 AS SELECT a FROM v1;
|
||||||
|
|
||||||
|
CREATE USER mysqluser1;
|
||||||
|
|
||||||
|
GRANT SELECT ON TABLE t1 TO mysqluser1;
|
||||||
|
GRANT SELECT, SHOW VIEW ON TABLE v1 TO mysqluser1;
|
||||||
|
GRANT SELECT, SHOW VIEW ON TABLE v2 TO mysqluser1;
|
||||||
|
|
||||||
|
--connect (mysqluser1, localhost, mysqluser1,,mysqltest1)
|
||||||
|
SELECT a FROM v1;
|
||||||
|
SELECT a FROM v2;
|
||||||
|
|
||||||
|
--connection default
|
||||||
|
--disconnect mysqluser1
|
||||||
|
DROP USER mysqluser1;
|
||||||
|
DROP DATABASE mysqltest1;
|
||||||
|
@ -1729,6 +1729,7 @@ restart:
|
|||||||
- block assigned but not yet read from file (invalid data).
|
- block assigned but not yet read from file (invalid data).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef THREAD
|
||||||
if (keycache->in_resize)
|
if (keycache->in_resize)
|
||||||
{
|
{
|
||||||
/* This is a request during a resize operation */
|
/* This is a request during a resize operation */
|
||||||
@ -1970,6 +1971,9 @@ restart:
|
|||||||
}
|
}
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
#else /* THREAD */
|
||||||
|
DBUG_ASSERT(!keycache->in_resize);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (page_status == PAGE_READ &&
|
if (page_status == PAGE_READ &&
|
||||||
(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH |
|
(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH |
|
||||||
|
@ -1433,7 +1433,7 @@ Event_job_data::execute(THD *thd, bool drop)
|
|||||||
thd->set_query(sp_sql.c_ptr_safe(), sp_sql.length());
|
thd->set_query(sp_sql.c_ptr_safe(), sp_sql.length());
|
||||||
|
|
||||||
{
|
{
|
||||||
Parser_state parser_state(thd, thd->query, thd->query_length);
|
Parser_state parser_state(thd, thd->query(), thd->query_length());
|
||||||
lex_start(thd);
|
lex_start(thd);
|
||||||
|
|
||||||
if (parse_sql(thd, & parser_state, creation_ctx))
|
if (parse_sql(thd, & parser_state, creation_ctx))
|
||||||
|
@ -465,7 +465,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
|
|||||||
if (!dropped)
|
if (!dropped)
|
||||||
{
|
{
|
||||||
/* Binlog the create event. */
|
/* Binlog the create event. */
|
||||||
DBUG_ASSERT(thd->query && thd->query_length);
|
DBUG_ASSERT(thd->query() && thd->query_length());
|
||||||
String log_query;
|
String log_query;
|
||||||
if (create_query_string(thd, &log_query))
|
if (create_query_string(thd, &log_query))
|
||||||
{
|
{
|
||||||
@ -595,8 +595,8 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
|
|||||||
event_queue->update_event(thd, parse_data->dbname, parse_data->name,
|
event_queue->update_event(thd, parse_data->dbname, parse_data->name,
|
||||||
new_element);
|
new_element);
|
||||||
/* Binlog the alter event. */
|
/* Binlog the alter event. */
|
||||||
DBUG_ASSERT(thd->query && thd->query_length);
|
DBUG_ASSERT(thd->query() && thd->query_length());
|
||||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&LOCK_event_metadata);
|
pthread_mutex_unlock(&LOCK_event_metadata);
|
||||||
@ -670,8 +670,8 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
|
|||||||
if (event_queue)
|
if (event_queue)
|
||||||
event_queue->drop_event(thd, dbname, name);
|
event_queue->drop_event(thd, dbname, name);
|
||||||
/* Binlog the drop event. */
|
/* Binlog the drop event. */
|
||||||
DBUG_ASSERT(thd->query && thd->query_length);
|
DBUG_ASSERT(thd->query() && thd->query_length());
|
||||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&LOCK_event_metadata);
|
pthread_mutex_unlock(&LOCK_event_metadata);
|
||||||
DBUG_RETURN(ret);
|
DBUG_RETURN(ret);
|
||||||
|
@ -5525,7 +5525,7 @@ int ha_ndbcluster::create(const char *name,
|
|||||||
if (share && !do_event_op)
|
if (share && !do_event_op)
|
||||||
share->flags|= NSF_NO_BINLOG;
|
share->flags|= NSF_NO_BINLOG;
|
||||||
ndbcluster_log_schema_op(thd, share,
|
ndbcluster_log_schema_op(thd, share,
|
||||||
thd->query, thd->query_length,
|
thd->query(), thd->query_length(),
|
||||||
share->db, share->table_name,
|
share->db, share->table_name,
|
||||||
m_table->getObjectId(),
|
m_table->getObjectId(),
|
||||||
m_table->getObjectVersion(),
|
m_table->getObjectVersion(),
|
||||||
@ -5967,7 +5967,8 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
|
|||||||
*/
|
*/
|
||||||
if (!is_old_table_tmpfile)
|
if (!is_old_table_tmpfile)
|
||||||
ndbcluster_log_schema_op(current_thd, share,
|
ndbcluster_log_schema_op(current_thd, share,
|
||||||
current_thd->query, current_thd->query_length,
|
current_thd->query(),
|
||||||
|
current_thd->query_length(),
|
||||||
old_dbname, m_tabname,
|
old_dbname, m_tabname,
|
||||||
ndb_table_id, ndb_table_version,
|
ndb_table_id, ndb_table_version,
|
||||||
SOT_RENAME_TABLE,
|
SOT_RENAME_TABLE,
|
||||||
@ -6162,7 +6163,7 @@ retry_temporary_error1:
|
|||||||
current_thd->lex->sql_command != SQLCOM_TRUNCATE)
|
current_thd->lex->sql_command != SQLCOM_TRUNCATE)
|
||||||
{
|
{
|
||||||
ndbcluster_log_schema_op(thd, share,
|
ndbcluster_log_schema_op(thd, share,
|
||||||
thd->query, thd->query_length,
|
thd->query(), thd->query_length(),
|
||||||
share->db, share->table_name,
|
share->db, share->table_name,
|
||||||
ndb_table_id, ndb_table_version,
|
ndb_table_id, ndb_table_version,
|
||||||
SOT_DROP_TABLE, 0, 0, 1);
|
SOT_DROP_TABLE, 0, 0, 1);
|
||||||
@ -6884,7 +6885,7 @@ static void ndbcluster_drop_database(handlerton *hton, char *path)
|
|||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
ha_ndbcluster::set_dbname(path, db);
|
ha_ndbcluster::set_dbname(path, db);
|
||||||
ndbcluster_log_schema_op(thd, 0,
|
ndbcluster_log_schema_op(thd, 0,
|
||||||
thd->query, thd->query_length,
|
thd->query(), thd->query_length(),
|
||||||
db, "", 0, 0, SOT_DROP_DB, 0, 0, 0);
|
db, "", 0, 0, SOT_DROP_DB, 0, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@ -10251,13 +10252,13 @@ int ndbcluster_alter_tablespace(handlerton *hton,
|
|||||||
#ifdef HAVE_NDB_BINLOG
|
#ifdef HAVE_NDB_BINLOG
|
||||||
if (is_tablespace)
|
if (is_tablespace)
|
||||||
ndbcluster_log_schema_op(thd, 0,
|
ndbcluster_log_schema_op(thd, 0,
|
||||||
thd->query, thd->query_length,
|
thd->query(), thd->query_length(),
|
||||||
"", alter_info->tablespace_name,
|
"", alter_info->tablespace_name,
|
||||||
0, 0,
|
0, 0,
|
||||||
SOT_TABLESPACE, 0, 0, 0);
|
SOT_TABLESPACE, 0, 0, 0);
|
||||||
else
|
else
|
||||||
ndbcluster_log_schema_op(thd, 0,
|
ndbcluster_log_schema_op(thd, 0,
|
||||||
thd->query, thd->query_length,
|
thd->query(), thd->query_length(),
|
||||||
"", alter_info->logfile_group_name,
|
"", alter_info->logfile_group_name,
|
||||||
0, 0,
|
0, 0,
|
||||||
SOT_LOGFILE_GROUP, 0, 0, 0);
|
SOT_LOGFILE_GROUP, 0, 0, 0);
|
||||||
|
@ -241,8 +241,8 @@ static void dbug_print_table(const char *info, TABLE *table)
|
|||||||
static void run_query(THD *thd, char *buf, char *end,
|
static void run_query(THD *thd, char *buf, char *end,
|
||||||
const int *no_print_error, my_bool disable_binlog)
|
const int *no_print_error, my_bool disable_binlog)
|
||||||
{
|
{
|
||||||
ulong save_thd_query_length= thd->query_length;
|
ulong save_thd_query_length= thd->query_length();
|
||||||
char *save_thd_query= thd->query;
|
char *save_thd_query= thd->query();
|
||||||
ulong save_thread_id= thd->variables.pseudo_thread_id;
|
ulong save_thread_id= thd->variables.pseudo_thread_id;
|
||||||
struct system_status_var save_thd_status_var= thd->status_var;
|
struct system_status_var save_thd_status_var= thd->status_var;
|
||||||
THD_TRANS save_thd_transaction_all= thd->transaction.all;
|
THD_TRANS save_thd_transaction_all= thd->transaction.all;
|
||||||
@ -259,12 +259,12 @@ static void run_query(THD *thd, char *buf, char *end,
|
|||||||
if (disable_binlog)
|
if (disable_binlog)
|
||||||
thd->options&= ~OPTION_BIN_LOG;
|
thd->options&= ~OPTION_BIN_LOG;
|
||||||
|
|
||||||
DBUG_PRINT("query", ("%s", thd->query));
|
DBUG_PRINT("query", ("%s", thd->query()));
|
||||||
|
|
||||||
DBUG_ASSERT(!thd->in_sub_stmt);
|
DBUG_ASSERT(!thd->in_sub_stmt);
|
||||||
DBUG_ASSERT(!thd->prelocked_mode);
|
DBUG_ASSERT(!thd->prelocked_mode);
|
||||||
|
|
||||||
mysql_parse(thd, thd->query, thd->query_length, &found_semicolon);
|
mysql_parse(thd, thd->query(), thd->query_length(), &found_semicolon);
|
||||||
|
|
||||||
if (no_print_error && thd->is_slave_error)
|
if (no_print_error && thd->is_slave_error)
|
||||||
{
|
{
|
||||||
|
@ -398,7 +398,6 @@ struct xid_t {
|
|||||||
my_xid get_my_xid()
|
my_xid get_my_xid()
|
||||||
{
|
{
|
||||||
return gtrid_length == MYSQL_XID_GTRID_LEN && bqual_length == 0 &&
|
return gtrid_length == MYSQL_XID_GTRID_LEN && bqual_length == 0 &&
|
||||||
!memcmp(data+MYSQL_XID_PREFIX_LEN, &server_id, sizeof(server_id)) &&
|
|
||||||
!memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ?
|
!memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ?
|
||||||
quick_get_my_xid() : 0;
|
quick_get_my_xid() : 0;
|
||||||
}
|
}
|
||||||
|
34
sql/item.cc
34
sql/item.cc
@ -6900,17 +6900,37 @@ int stored_field_cmp_to_item(Field *field, Item *item)
|
|||||||
/*
|
/*
|
||||||
If comparing DATE with DATETIME, append the time-part to the DATE.
|
If comparing DATE with DATETIME, append the time-part to the DATE.
|
||||||
So that the strings are equally formatted.
|
So that the strings are equally formatted.
|
||||||
A DATE converted to string is 10 characters, and a DATETIME converted
|
A DATE converted to string is 10 (MAX_DATE_WIDTH) characters,
|
||||||
to string is 19 characters.
|
and a DATETIME converted to string is 19 (MAX_DATETIME_WIDTH) characters.
|
||||||
*/
|
*/
|
||||||
field_type= field->type();
|
field_type= field->type();
|
||||||
|
uint32 item_length= item_result->length();
|
||||||
if (field_type == MYSQL_TYPE_DATE &&
|
if (field_type == MYSQL_TYPE_DATE &&
|
||||||
item_result->length() == 19)
|
item_length == MAX_DATETIME_WIDTH)
|
||||||
field_tmp.append(" 00:00:00");
|
field_tmp.append(" 00:00:00");
|
||||||
else if (field_type == MYSQL_TYPE_DATETIME &&
|
else if (field_type == MYSQL_TYPE_DATETIME)
|
||||||
item_result->length() == 10)
|
{
|
||||||
item_result->append(" 00:00:00");
|
if (item_length == MAX_DATE_WIDTH)
|
||||||
|
item_result->append(" 00:00:00");
|
||||||
|
else if (item_length > MAX_DATETIME_WIDTH)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
We don't store microsecond part of DATETIME in field
|
||||||
|
but item_result contains it. As we compare DATETIMEs as strings
|
||||||
|
we must trim trailing 0's in item_result's microsecond part
|
||||||
|
to ensure "YYYY-MM-DD HH:MM:SS" == "YYYY-MM-DD HH:MM:SS.0000"
|
||||||
|
*/
|
||||||
|
char *end= (char *) item_result->ptr() + item_length - 1;
|
||||||
|
/* Trim trailing 0's */
|
||||||
|
while (*end == '0')
|
||||||
|
end--;
|
||||||
|
/* Trim '.' if no microseconds */
|
||||||
|
if (*end == '.')
|
||||||
|
end--;
|
||||||
|
DBUG_ASSERT(end - item_result->ptr() + 1 >= MAX_DATETIME_WIDTH);
|
||||||
|
item_result->length(end - item_result->ptr() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
return stringcmp(&field_tmp,item_result);
|
return stringcmp(&field_tmp,item_result);
|
||||||
}
|
}
|
||||||
if (res_type == INT_RESULT)
|
if (res_type == INT_RESULT)
|
||||||
|
@ -84,7 +84,9 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
|
|||||||
|
|
||||||
if (args[0]->field_type() == MYSQL_TYPE_GEOMETRY)
|
if (args[0]->field_type() == MYSQL_TYPE_GEOMETRY)
|
||||||
{
|
{
|
||||||
return args[0]->val_str(str);
|
String *str_ret= args[0]->val_str(str);
|
||||||
|
null_value= args[0]->null_value;
|
||||||
|
return str_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
wkb= args[0]->val_str(&arg_val);
|
wkb= args[0]->val_str(&arg_val);
|
||||||
@ -94,7 +96,10 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
|
|||||||
|
|
||||||
str->set_charset(&my_charset_bin);
|
str->set_charset(&my_charset_bin);
|
||||||
if (str->reserve(SRID_SIZE, 512))
|
if (str->reserve(SRID_SIZE, 512))
|
||||||
return 0;
|
{
|
||||||
|
null_value= TRUE; /* purecov: inspected */
|
||||||
|
return 0; /* purecov: inspected */
|
||||||
|
}
|
||||||
str->length(0);
|
str->length(0);
|
||||||
str->q_append(srid);
|
str->q_append(srid);
|
||||||
if ((null_value=
|
if ((null_value=
|
||||||
|
13
sql/log.cc
13
sql/log.cc
@ -1549,7 +1549,6 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all)
|
|||||||
|
|
||||||
trx_data->at_least_one_stmt_committed = my_b_tell(&trx_data->trans_log) > 0;
|
trx_data->at_least_one_stmt_committed = my_b_tell(&trx_data->trans_log) > 0;
|
||||||
|
|
||||||
end:
|
|
||||||
if (!all)
|
if (!all)
|
||||||
trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt commit
|
trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt commit
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
@ -1717,7 +1716,7 @@ static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv)
|
|||||||
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
|
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
|
||||||
int const error=
|
int const error=
|
||||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||||
thd->query, thd->query_length, TRUE, FALSE, errcode);
|
thd->query(), thd->query_length(), TRUE, FALSE, errcode);
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1736,7 +1735,7 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
|
|||||||
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
|
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
|
||||||
int error=
|
int error=
|
||||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||||
thd->query, thd->query_length, TRUE, FALSE, errcode);
|
thd->query(), thd->query_length(), TRUE, FALSE, errcode);
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
binlog_trans_log_truncate(thd, *(my_off_t*)sv);
|
binlog_trans_log_truncate(thd, *(my_off_t*)sv);
|
||||||
@ -3603,7 +3602,7 @@ void MYSQL_BIN_LOG::new_file_impl(bool need_lock)
|
|||||||
}
|
}
|
||||||
old_name=name;
|
old_name=name;
|
||||||
name=0; // Don't free name
|
name=0; // Don't free name
|
||||||
close(LOG_CLOSE_TO_BE_OPENED);
|
close(LOG_CLOSE_TO_BE_OPENED | LOG_CLOSE_INDEX);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Note that at this point, log_state != LOG_CLOSED (important for is_open()).
|
Note that at this point, log_state != LOG_CLOSED (important for is_open()).
|
||||||
@ -3618,8 +3617,10 @@ void MYSQL_BIN_LOG::new_file_impl(bool need_lock)
|
|||||||
trigger temp tables deletion on slaves.
|
trigger temp tables deletion on slaves.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
open(old_name, log_type, new_name_ptr,
|
/* reopen index binlog file, BUG#34582 */
|
||||||
io_cache_type, no_auto_events, max_size, 1);
|
if (!open_index_file(index_file_name, 0))
|
||||||
|
open(old_name, log_type, new_name_ptr,
|
||||||
|
io_cache_type, no_auto_events, max_size, 1);
|
||||||
my_free(old_name,MYF(0));
|
my_free(old_name,MYF(0));
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
@ -1852,6 +1852,7 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td,
|
|||||||
{
|
{
|
||||||
const uchar *value0= value;
|
const uchar *value0= value;
|
||||||
const uchar *null_bits= value;
|
const uchar *null_bits= value;
|
||||||
|
uint null_bit_index= 0;
|
||||||
char typestr[64]= "";
|
char typestr[64]= "";
|
||||||
|
|
||||||
value+= (m_width + 7) / 8;
|
value+= (m_width + 7) / 8;
|
||||||
@ -1860,7 +1861,8 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td,
|
|||||||
|
|
||||||
for (size_t i= 0; i < td->size(); i ++)
|
for (size_t i= 0; i < td->size(); i ++)
|
||||||
{
|
{
|
||||||
int is_null= (null_bits[i / 8] >> (i % 8)) & 0x01;
|
int is_null= (null_bits[null_bit_index / 8]
|
||||||
|
>> (null_bit_index % 8)) & 0x01;
|
||||||
|
|
||||||
if (bitmap_is_set(cols_bitmap, i) == 0)
|
if (bitmap_is_set(cols_bitmap, i) == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -1897,6 +1899,8 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td,
|
|||||||
}
|
}
|
||||||
|
|
||||||
my_b_printf(file, "\n");
|
my_b_printf(file, "\n");
|
||||||
|
|
||||||
|
null_bit_index++;
|
||||||
}
|
}
|
||||||
return value - value0;
|
return value - value0;
|
||||||
}
|
}
|
||||||
@ -3039,7 +3043,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
|
|||||||
thd->query_id = next_query_id();
|
thd->query_id = next_query_id();
|
||||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||||
thd->variables.pseudo_thread_id= thread_id; // for temp tables
|
thd->variables.pseudo_thread_id= thread_id; // for temp tables
|
||||||
DBUG_PRINT("query",("%s",thd->query));
|
DBUG_PRINT("query",("%s", thd->query()));
|
||||||
|
|
||||||
if (ignored_error_code((expected_error= error_code)) ||
|
if (ignored_error_code((expected_error= error_code)) ||
|
||||||
!unexpected_error_code(expected_error))
|
!unexpected_error_code(expected_error))
|
||||||
@ -3133,7 +3137,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
|
|||||||
|
|
||||||
/* Execute the query (note that we bypass dispatch_command()) */
|
/* Execute the query (note that we bypass dispatch_command()) */
|
||||||
const char* found_semicolon= NULL;
|
const char* found_semicolon= NULL;
|
||||||
mysql_parse(thd, thd->query, thd->query_length, &found_semicolon);
|
mysql_parse(thd, thd->query(), thd->query_length(), &found_semicolon);
|
||||||
log_slow_statement(thd);
|
log_slow_statement(thd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3145,7 +3149,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
|
|||||||
we exit gracefully; otherwise we warn about the bad error and tell DBA
|
we exit gracefully; otherwise we warn about the bad error and tell DBA
|
||||||
to check/fix it.
|
to check/fix it.
|
||||||
*/
|
*/
|
||||||
if (mysql_test_parse_for_slave(thd, thd->query, thd->query_length))
|
if (mysql_test_parse_for_slave(thd, thd->query(), thd->query_length()))
|
||||||
clear_all_errors(thd, const_cast<Relay_log_info*>(rli)); /* Can ignore query */
|
clear_all_errors(thd, const_cast<Relay_log_info*>(rli)); /* Can ignore query */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3155,7 +3159,7 @@ Query partially completed on the master (error on master: %d) \
|
|||||||
and was aborted. There is a chance that your master is inconsistent at this \
|
and was aborted. There is a chance that your master is inconsistent at this \
|
||||||
point. If you are sure that your master is ok, run this query manually on the \
|
point. If you are sure that your master is ok, run this query manually on the \
|
||||||
slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; \
|
slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; \
|
||||||
START SLAVE; . Query: '%s'", expected_error, thd->query);
|
START SLAVE; . Query: '%s'", expected_error, thd->query());
|
||||||
thd->is_slave_error= 1;
|
thd->is_slave_error= 1;
|
||||||
}
|
}
|
||||||
goto end;
|
goto end;
|
||||||
@ -3163,7 +3167,7 @@ START SLAVE; . Query: '%s'", expected_error, thd->query);
|
|||||||
|
|
||||||
/* If the query was not ignored, it is printed to the general log */
|
/* If the query was not ignored, it is printed to the general log */
|
||||||
if (!thd->is_error() || thd->main_da.sql_errno() != ER_SLAVE_IGNORED_TABLE)
|
if (!thd->is_error() || thd->main_da.sql_errno() != ER_SLAVE_IGNORED_TABLE)
|
||||||
general_log_write(thd, COM_QUERY, thd->query, thd->query_length);
|
general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
|
||||||
|
|
||||||
compare_errors:
|
compare_errors:
|
||||||
|
|
||||||
@ -3855,6 +3859,7 @@ bool Format_description_log_event::write(IO_CACHE* file)
|
|||||||
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
|
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
|
||||||
int Format_description_log_event::do_apply_event(Relay_log_info const *rli)
|
int Format_description_log_event::do_apply_event(Relay_log_info const *rli)
|
||||||
{
|
{
|
||||||
|
int ret= 0;
|
||||||
DBUG_ENTER("Format_description_log_event::do_apply_event");
|
DBUG_ENTER("Format_description_log_event::do_apply_event");
|
||||||
|
|
||||||
#ifdef USING_TRANSACTIONS
|
#ifdef USING_TRANSACTIONS
|
||||||
@ -3896,17 +3901,21 @@ int Format_description_log_event::do_apply_event(Relay_log_info const *rli)
|
|||||||
0, then 96, then jump to first really asked event (which is
|
0, then 96, then jump to first really asked event (which is
|
||||||
>96). So this is ok.
|
>96). So this is ok.
|
||||||
*/
|
*/
|
||||||
DBUG_RETURN(Start_log_event_v3::do_apply_event(rli));
|
ret= Start_log_event_v3::do_apply_event(rli);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(0);
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
/* Save the information describing this binlog */
|
||||||
|
delete rli->relay_log.description_event_for_exec;
|
||||||
|
const_cast<Relay_log_info *>(rli)->relay_log.description_event_for_exec= this;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBUG_RETURN(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Format_description_log_event::do_update_pos(Relay_log_info *rli)
|
int Format_description_log_event::do_update_pos(Relay_log_info *rli)
|
||||||
{
|
{
|
||||||
/* save the information describing this binlog */
|
|
||||||
delete rli->relay_log.description_event_for_exec;
|
|
||||||
rli->relay_log.description_event_for_exec= this;
|
|
||||||
|
|
||||||
if (server_id == (uint32) ::server_id)
|
if (server_id == (uint32) ::server_id)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -4489,8 +4498,8 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
|
|||||||
new_db.length= db_len;
|
new_db.length= db_len;
|
||||||
new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
|
new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
|
||||||
thd->set_db(new_db.str, new_db.length);
|
thd->set_db(new_db.str, new_db.length);
|
||||||
DBUG_ASSERT(thd->query == 0);
|
DBUG_ASSERT(thd->query() == 0);
|
||||||
thd->query_length= 0; // Should not be needed
|
thd->set_query_inner(NULL, 0); // Should not be needed
|
||||||
thd->is_slave_error= 0;
|
thd->is_slave_error= 0;
|
||||||
clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
|
clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
|
||||||
|
|
||||||
@ -7502,6 +7511,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
|
|||||||
thd->reset_current_stmt_binlog_row_based();
|
thd->reset_current_stmt_binlog_row_based();
|
||||||
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, error);
|
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, error);
|
||||||
thd->is_slave_error= 1;
|
thd->is_slave_error= 1;
|
||||||
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
This code would ideally be placed in do_update_pos() instead, but
|
This code would ideally be placed in do_update_pos() instead, but
|
||||||
@ -7530,6 +7540,14 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
|
|||||||
const_cast<Relay_log_info*>(rli)->last_event_start_time= my_time(0);
|
const_cast<Relay_log_info*>(rli)->last_event_start_time= my_time(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (get_flags(STMT_END_F))
|
||||||
|
if ((error= rows_event_stmt_cleanup(rli, thd)))
|
||||||
|
rli->report(ERROR_LEVEL, error,
|
||||||
|
"Error in %s event: commit of row events failed, "
|
||||||
|
"table `%s`.`%s`",
|
||||||
|
get_type_str(), m_table->s->db.str,
|
||||||
|
m_table->s->table_name.str);
|
||||||
|
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7628,33 +7646,19 @@ Rows_log_event::do_update_pos(Relay_log_info *rli)
|
|||||||
|
|
||||||
if (get_flags(STMT_END_F))
|
if (get_flags(STMT_END_F))
|
||||||
{
|
{
|
||||||
if ((error= rows_event_stmt_cleanup(rli, thd)) == 0)
|
/*
|
||||||
{
|
Indicate that a statement is finished.
|
||||||
/*
|
Step the group log position if we are not in a transaction,
|
||||||
Indicate that a statement is finished.
|
otherwise increase the event log position.
|
||||||
Step the group log position if we are not in a transaction,
|
*/
|
||||||
otherwise increase the event log position.
|
rli->stmt_done(log_pos, when);
|
||||||
*/
|
/*
|
||||||
rli->stmt_done(log_pos, when);
|
Clear any errors in thd->net.last_err*. It is not known if this is
|
||||||
|
needed or not. It is believed that any errors that may exist in
|
||||||
/*
|
thd->net.last_err* are allowed. Examples of errors are "key not
|
||||||
Clear any errors pushed in thd->net.last_err* if for example "no key
|
found", which is produced in the test case rpl_row_conflicts.test
|
||||||
found" (as this is allowed). This is a safety measure; apparently
|
*/
|
||||||
those errors (e.g. when executing a Delete_rows_log_event of a
|
thd->clear_error();
|
||||||
non-existing row, like in rpl_row_mystery22.test,
|
|
||||||
thd->net.last_error = "Can't find record in 't1'" and last_errno=1032)
|
|
||||||
do not become visible. We still prefer to wipe them out.
|
|
||||||
*/
|
|
||||||
thd->clear_error();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rli->report(ERROR_LEVEL, error,
|
|
||||||
"Error in %s event: commit of row events failed, "
|
|
||||||
"table `%s`.`%s`",
|
|
||||||
get_type_str(), m_table->s->db.str,
|
|
||||||
m_table->s->table_name.str);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1814,7 +1814,56 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli)
|
|||||||
const_cast<Relay_log_info*>(rli)->last_event_start_time= my_time(0);
|
const_cast<Relay_log_info*>(rli)->last_event_start_time= my_time(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_RETURN(0);
|
if (get_flags(STMT_END_F))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
This is the end of a statement or transaction, so close (and
|
||||||
|
unlock) the tables we opened when processing the
|
||||||
|
Table_map_log_event starting the statement.
|
||||||
|
|
||||||
|
OBSERVER. This will clear *all* mappings, not only those that
|
||||||
|
are open for the table. There is not good handle for on-close
|
||||||
|
actions for tables.
|
||||||
|
|
||||||
|
NOTE. Even if we have no table ('table' == 0) we still need to be
|
||||||
|
here, so that we increase the group relay log position. If we didn't, we
|
||||||
|
could have a group relay log position which lags behind "forever"
|
||||||
|
(assume the last master's transaction is ignored by the slave because of
|
||||||
|
replicate-ignore rules).
|
||||||
|
*/
|
||||||
|
thd->binlog_flush_pending_rows_event(true);
|
||||||
|
|
||||||
|
/*
|
||||||
|
If this event is not in a transaction, the call below will, if some
|
||||||
|
transactional storage engines are involved, commit the statement into
|
||||||
|
them and flush the pending event to binlog.
|
||||||
|
If this event is in a transaction, the call will do nothing, but a
|
||||||
|
Xid_log_event will come next which will, if some transactional engines
|
||||||
|
are involved, commit the transaction and flush the pending event to the
|
||||||
|
binlog.
|
||||||
|
*/
|
||||||
|
if ((error= ha_autocommit_or_rollback(thd, 0)))
|
||||||
|
rli->report(ERROR_LEVEL, error,
|
||||||
|
"Error in %s event: commit of row events failed, "
|
||||||
|
"table `%s`.`%s`",
|
||||||
|
get_type_str(), m_table->s->db.str,
|
||||||
|
m_table->s->table_name.str);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Now what if this is not a transactional engine? we still need to
|
||||||
|
flush the pending event to the binlog; we did it with
|
||||||
|
thd->binlog_flush_pending_rows_event(). Note that we imitate
|
||||||
|
what is done for real queries: a call to
|
||||||
|
ha_autocommit_or_rollback() (sometimes only if involves a
|
||||||
|
transactional engine), and a call to be sure to have the pending
|
||||||
|
event flushed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
thd->reset_current_stmt_binlog_row_based();
|
||||||
|
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1844,71 +1893,18 @@ Old_rows_log_event::do_update_pos(Relay_log_info *rli)
|
|||||||
if (get_flags(STMT_END_F))
|
if (get_flags(STMT_END_F))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
This is the end of a statement or transaction, so close (and
|
Indicate that a statement is finished.
|
||||||
unlock) the tables we opened when processing the
|
Step the group log position if we are not in a transaction,
|
||||||
Table_map_log_event starting the statement.
|
otherwise increase the event log position.
|
||||||
|
*/
|
||||||
OBSERVER. This will clear *all* mappings, not only those that
|
rli->stmt_done(log_pos, when);
|
||||||
are open for the table. There is not good handle for on-close
|
|
||||||
actions for tables.
|
|
||||||
|
|
||||||
NOTE. Even if we have no table ('table' == 0) we still need to be
|
|
||||||
here, so that we increase the group relay log position. If we didn't, we
|
|
||||||
could have a group relay log position which lags behind "forever"
|
|
||||||
(assume the last master's transaction is ignored by the slave because of
|
|
||||||
replicate-ignore rules).
|
|
||||||
*/
|
|
||||||
thd->binlog_flush_pending_rows_event(true);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If this event is not in a transaction, the call below will, if some
|
Clear any errors in thd->net.last_err*. It is not known if this is
|
||||||
transactional storage engines are involved, commit the statement into
|
needed or not. It is believed that any errors that may exist in
|
||||||
them and flush the pending event to binlog.
|
thd->net.last_err* are allowed. Examples of errors are "key not
|
||||||
If this event is in a transaction, the call will do nothing, but a
|
found", which is produced in the test case rpl_row_conflicts.test
|
||||||
Xid_log_event will come next which will, if some transactional engines
|
|
||||||
are involved, commit the transaction and flush the pending event to the
|
|
||||||
binlog.
|
|
||||||
*/
|
*/
|
||||||
error= ha_autocommit_or_rollback(thd, 0);
|
thd->clear_error();
|
||||||
|
|
||||||
/*
|
|
||||||
Now what if this is not a transactional engine? we still need to
|
|
||||||
flush the pending event to the binlog; we did it with
|
|
||||||
thd->binlog_flush_pending_rows_event(). Note that we imitate
|
|
||||||
what is done for real queries: a call to
|
|
||||||
ha_autocommit_or_rollback() (sometimes only if involves a
|
|
||||||
transactional engine), and a call to be sure to have the pending
|
|
||||||
event flushed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
thd->reset_current_stmt_binlog_row_based();
|
|
||||||
rli->cleanup_context(thd, 0);
|
|
||||||
if (error == 0)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Indicate that a statement is finished.
|
|
||||||
Step the group log position if we are not in a transaction,
|
|
||||||
otherwise increase the event log position.
|
|
||||||
*/
|
|
||||||
rli->stmt_done(log_pos, when);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Clear any errors pushed in thd->net.client_last_err* if for
|
|
||||||
example "no key found" (as this is allowed). This is a safety
|
|
||||||
measure; apparently those errors (e.g. when executing a
|
|
||||||
Delete_rows_log_event_old of a non-existing row, like in
|
|
||||||
rpl_row_mystery22.test, thd->net.last_error = "Can't
|
|
||||||
find record in 't1'" and last_errno=1032) do not become
|
|
||||||
visible. We still prefer to wipe them out.
|
|
||||||
*/
|
|
||||||
thd->clear_error();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
rli->report(ERROR_LEVEL, error,
|
|
||||||
"Error in %s event: commit of row events failed, "
|
|
||||||
"table `%s`.`%s`",
|
|
||||||
get_type_str(), m_table->s->db.str,
|
|
||||||
m_table->s->table_name.str);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2520,7 +2520,7 @@ terribly wrong...\n");
|
|||||||
}
|
}
|
||||||
fprintf(stderr, "Trying to get some variables.\n\
|
fprintf(stderr, "Trying to get some variables.\n\
|
||||||
Some pointers may be invalid and cause the dump to abort...\n");
|
Some pointers may be invalid and cause the dump to abort...\n");
|
||||||
my_safe_print_str("thd->query", thd->query, 1024);
|
my_safe_print_str("thd->query", thd->query(), 1024);
|
||||||
fprintf(stderr, "thd->thread_id=%lu\n", (ulong) thd->thread_id);
|
fprintf(stderr, "thd->thread_id=%lu\n", (ulong) thd->thread_id);
|
||||||
fprintf(stderr, "thd->killed=%s\n", kreason);
|
fprintf(stderr, "thd->killed=%s\n", kreason);
|
||||||
}
|
}
|
||||||
|
107
sql/opt_range.cc
107
sql/opt_range.cc
@ -5709,6 +5709,27 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
|
|||||||
!(conf_func->compare_collation()->state & MY_CS_BINSORT))
|
!(conf_func->compare_collation()->state & MY_CS_BINSORT))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
if (key_part->image_type == Field::itMBR)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case Item_func::SP_EQUALS_FUNC:
|
||||||
|
case Item_func::SP_DISJOINT_FUNC:
|
||||||
|
case Item_func::SP_INTERSECTS_FUNC:
|
||||||
|
case Item_func::SP_TOUCHES_FUNC:
|
||||||
|
case Item_func::SP_CROSSES_FUNC:
|
||||||
|
case Item_func::SP_WITHIN_FUNC:
|
||||||
|
case Item_func::SP_CONTAINS_FUNC:
|
||||||
|
case Item_func::SP_OVERLAPS_FUNC:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/*
|
||||||
|
We cannot involve spatial indexes for queries that
|
||||||
|
don't use MBREQUALS(), MBRDISJOINT(), etc. functions.
|
||||||
|
*/
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (param->using_real_indexes)
|
if (param->using_real_indexes)
|
||||||
optimize_range= field->optimize_range(param->real_keynr[key_part->key],
|
optimize_range= field->optimize_range(param->real_keynr[key_part->key],
|
||||||
key_part->part);
|
key_part->part);
|
||||||
@ -5891,6 +5912,17 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
field->table->in_use->variables.sql_mode= orig_sql_mode;
|
field->table->in_use->variables.sql_mode= orig_sql_mode;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Any sargable predicate except "<=>" involving NULL as a constant is always
|
||||||
|
FALSE
|
||||||
|
*/
|
||||||
|
if (type != Item_func::EQUAL_FUNC && field->is_real_null())
|
||||||
|
{
|
||||||
|
tree= &null_element;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
str= (uchar*) alloc_root(alloc, key_part->store_length+1);
|
str= (uchar*) alloc_root(alloc, key_part->store_length+1);
|
||||||
if (!str)
|
if (!str)
|
||||||
goto end;
|
goto end;
|
||||||
@ -6512,6 +6544,63 @@ get_range(SEL_ARG **e1,SEL_ARG **e2,SEL_ARG *root1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Combine two range expression under a common OR. On a logical level, the
|
||||||
|
transformation is key_or( expr1, expr2 ) => expr1 OR expr2.
|
||||||
|
|
||||||
|
Both expressions are assumed to be in the SEL_ARG format. In a logic sense,
|
||||||
|
theformat is reminiscent of DNF, since an expression such as the following
|
||||||
|
|
||||||
|
( 1 < kp1 < 10 AND p1 ) OR ( 10 <= kp2 < 20 AND p2 )
|
||||||
|
|
||||||
|
where there is a key consisting of keyparts ( kp1, kp2, ..., kpn ) and p1
|
||||||
|
and p2 are valid SEL_ARG expressions over keyparts kp2 ... kpn, is a valid
|
||||||
|
SEL_ARG condition. The disjuncts appear ordered by the minimum endpoint of
|
||||||
|
the first range and ranges must not overlap. It follows that they are also
|
||||||
|
ordered by maximum endpoints. Thus
|
||||||
|
|
||||||
|
( 1 < kp1 <= 2 AND ( kp2 = 2 OR kp2 = 3 ) ) OR kp1 = 3
|
||||||
|
|
||||||
|
Is a a valid SER_ARG expression for a key of at least 2 keyparts.
|
||||||
|
|
||||||
|
For simplicity, we will assume that expr2 is a single range predicate,
|
||||||
|
i.e. on the form ( a < x < b AND ... ). It is easy to generalize to a
|
||||||
|
disjunction of several predicates by subsequently call key_or for each
|
||||||
|
disjunct.
|
||||||
|
|
||||||
|
The algorithm iterates over each disjunct of expr1, and for each disjunct
|
||||||
|
where the first keypart's range overlaps with the first keypart's range in
|
||||||
|
expr2:
|
||||||
|
|
||||||
|
If the predicates are equal for the rest of the keyparts, or if there are
|
||||||
|
no more, the range in expr2 has its endpoints copied in, and the SEL_ARG
|
||||||
|
node in expr2 is deallocated. If more ranges became connected in expr1, the
|
||||||
|
surplus is also dealocated. If they differ, two ranges are created.
|
||||||
|
|
||||||
|
- The range leading up to the overlap. Empty if endpoints are equal.
|
||||||
|
|
||||||
|
- The overlapping sub-range. May be the entire range if they are equal.
|
||||||
|
|
||||||
|
Finally, there may be one more range if expr2's first keypart's range has a
|
||||||
|
greater maximum endpoint than the last range in expr1.
|
||||||
|
|
||||||
|
For the overlapping sub-range, we recursively call key_or. Thus in order to
|
||||||
|
compute key_or of
|
||||||
|
|
||||||
|
(1) ( 1 < kp1 < 10 AND 1 < kp2 < 10 )
|
||||||
|
|
||||||
|
(2) ( 2 < kp1 < 20 AND 4 < kp2 < 20 )
|
||||||
|
|
||||||
|
We create the ranges 1 < kp <= 2, 2 < kp1 < 10, 10 <= kp1 < 20. For the
|
||||||
|
first one, we simply hook on the condition for the second keypart from (1)
|
||||||
|
: 1 < kp2 < 10. For the second range 2 < kp1 < 10, key_or( 1 < kp2 < 10, 4
|
||||||
|
< kp2 < 20 ) is called, yielding 1 < kp2 < 20. For the last range, we reuse
|
||||||
|
the range 4 < kp2 < 20 from (2) for the second keypart. The result is thus
|
||||||
|
|
||||||
|
( 1 < kp1 <= 2 AND 1 < kp2 < 10 ) OR
|
||||||
|
( 2 < kp1 < 10 AND 1 < kp2 < 20 ) OR
|
||||||
|
( 10 <= kp1 < 20 AND 4 < kp2 < 20 )
|
||||||
|
*/
|
||||||
static SEL_ARG *
|
static SEL_ARG *
|
||||||
key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
|
key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
|
||||||
{
|
{
|
||||||
@ -6663,7 +6752,21 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
|
|||||||
key1=key1->tree_delete(save);
|
key1=key1->tree_delete(save);
|
||||||
}
|
}
|
||||||
last->copy_min(tmp);
|
last->copy_min(tmp);
|
||||||
if (last->copy_min(key2) || last->copy_max(key2))
|
bool full_range= last->copy_min(key2);
|
||||||
|
if (!full_range)
|
||||||
|
{
|
||||||
|
if (last->next && key2->cmp_max_to_min(last->next) >= 0)
|
||||||
|
{
|
||||||
|
last->max_value= last->next->min_value;
|
||||||
|
if (last->next->min_flag & NEAR_MIN)
|
||||||
|
last->max_flag&= ~NEAR_MAX;
|
||||||
|
else
|
||||||
|
last->max_flag|= NEAR_MAX;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
full_range= last->copy_max(key2);
|
||||||
|
}
|
||||||
|
if (full_range)
|
||||||
{ // Full range
|
{ // Full range
|
||||||
key1->free_tree();
|
key1->free_tree();
|
||||||
for (; key2 ; key2=key2->next)
|
for (; key2 ; key2=key2->next)
|
||||||
@ -6673,8 +6776,6 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
key2=key2->next;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmp >= 0 && tmp->cmp_min_to_min(key2) < 0)
|
if (cmp >= 0 && tmp->cmp_min_to_min(key2) < 0)
|
||||||
|
@ -97,7 +97,8 @@ static ulonglong get_exact_record_count(TABLE_LIST *tables)
|
|||||||
|
|
||||||
@note
|
@note
|
||||||
This function is only called for queries with sum functions and no
|
This function is only called for queries with sum functions and no
|
||||||
GROUP BY part.
|
GROUP BY part. This means that the result set shall contain a single
|
||||||
|
row only
|
||||||
|
|
||||||
@retval
|
@retval
|
||||||
0 no errors
|
0 no errors
|
||||||
|
@ -57,6 +57,7 @@ void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
|
|||||||
{
|
{
|
||||||
empty_record(table);
|
empty_record(table);
|
||||||
bzero((char*) info,sizeof(*info));
|
bzero((char*) info,sizeof(*info));
|
||||||
|
info->thd= thd;
|
||||||
info->table= table;
|
info->table= table;
|
||||||
info->file= table->file;
|
info->file= table->file;
|
||||||
info->record= table->record[0];
|
info->record= table->record[0];
|
||||||
@ -292,6 +293,12 @@ void end_read_record(READ_RECORD *info)
|
|||||||
|
|
||||||
static int rr_handle_error(READ_RECORD *info, int error)
|
static int rr_handle_error(READ_RECORD *info, int error)
|
||||||
{
|
{
|
||||||
|
if (info->thd->killed)
|
||||||
|
{
|
||||||
|
info->thd->send_kill_message();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (error == HA_ERR_END_OF_FILE)
|
if (error == HA_ERR_END_OF_FILE)
|
||||||
error= -1;
|
error= -1;
|
||||||
else
|
else
|
||||||
@ -312,12 +319,7 @@ static int rr_quick(READ_RECORD *info)
|
|||||||
int tmp;
|
int tmp;
|
||||||
while ((tmp= info->select->quick->get_next()))
|
while ((tmp= info->select->quick->get_next()))
|
||||||
{
|
{
|
||||||
if (info->thd->killed)
|
if (info->thd->killed || (tmp != HA_ERR_RECORD_DELETED))
|
||||||
{
|
|
||||||
my_error(ER_SERVER_SHUTDOWN, MYF(0));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (tmp != HA_ERR_RECORD_DELETED)
|
|
||||||
{
|
{
|
||||||
tmp= rr_handle_error(info, tmp);
|
tmp= rr_handle_error(info, tmp);
|
||||||
break;
|
break;
|
||||||
@ -380,16 +382,11 @@ int rr_sequential(READ_RECORD *info)
|
|||||||
int tmp;
|
int tmp;
|
||||||
while ((tmp=info->file->rnd_next(info->record)))
|
while ((tmp=info->file->rnd_next(info->record)))
|
||||||
{
|
{
|
||||||
if (info->thd->killed)
|
|
||||||
{
|
|
||||||
info->thd->send_kill_message();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
rnd_next can return RECORD_DELETED for MyISAM when one thread is
|
rnd_next can return RECORD_DELETED for MyISAM when one thread is
|
||||||
reading and another deleting without locks.
|
reading and another deleting without locks.
|
||||||
*/
|
*/
|
||||||
if (tmp != HA_ERR_RECORD_DELETED)
|
if (info->thd->killed || (tmp != HA_ERR_RECORD_DELETED))
|
||||||
{
|
{
|
||||||
tmp= rr_handle_error(info, tmp);
|
tmp= rr_handle_error(info, tmp);
|
||||||
break;
|
break;
|
||||||
|
64
sql/slave.cc
64
sql/slave.cc
@ -1288,7 +1288,8 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
|
|||||||
thd->db = (char*)db;
|
thd->db = (char*)db;
|
||||||
DBUG_ASSERT(thd->db != 0);
|
DBUG_ASSERT(thd->db != 0);
|
||||||
thd->db_length= strlen(thd->db);
|
thd->db_length= strlen(thd->db);
|
||||||
mysql_parse(thd, thd->query, packet_len, &found_semicolon); // run create table
|
/* run create table */
|
||||||
|
mysql_parse(thd, thd->query(), packet_len, &found_semicolon);
|
||||||
thd->db = save_db; // leave things the way the were before
|
thd->db = save_db; // leave things the way the were before
|
||||||
thd->db_length= save_db_length;
|
thd->db_length= save_db_length;
|
||||||
thd->options = save_options;
|
thd->options = save_options;
|
||||||
@ -2082,8 +2083,7 @@ static int has_temporary_error(THD *thd)
|
|||||||
@retval 2 No error calling ev->apply_event(), but error calling
|
@retval 2 No error calling ev->apply_event(), but error calling
|
||||||
ev->update_pos().
|
ev->update_pos().
|
||||||
*/
|
*/
|
||||||
int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli,
|
int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli)
|
||||||
bool skip)
|
|
||||||
{
|
{
|
||||||
int exec_res= 0;
|
int exec_res= 0;
|
||||||
|
|
||||||
@ -2128,38 +2128,34 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli,
|
|||||||
ev->when= my_time(0);
|
ev->when= my_time(0);
|
||||||
ev->thd = thd; // because up to this point, ev->thd == 0
|
ev->thd = thd; // because up to this point, ev->thd == 0
|
||||||
|
|
||||||
if (skip)
|
int reason= ev->shall_skip(rli);
|
||||||
{
|
if (reason == Log_event::EVENT_SKIP_COUNT)
|
||||||
int reason= ev->shall_skip(rli);
|
--rli->slave_skip_counter;
|
||||||
if (reason == Log_event::EVENT_SKIP_COUNT)
|
pthread_mutex_unlock(&rli->data_lock);
|
||||||
--rli->slave_skip_counter;
|
if (reason == Log_event::EVENT_SKIP_NOT)
|
||||||
pthread_mutex_unlock(&rli->data_lock);
|
|
||||||
if (reason == Log_event::EVENT_SKIP_NOT)
|
|
||||||
exec_res= ev->apply_event(rli);
|
|
||||||
#ifndef DBUG_OFF
|
|
||||||
/*
|
|
||||||
This only prints information to the debug trace.
|
|
||||||
|
|
||||||
TODO: Print an informational message to the error log?
|
|
||||||
*/
|
|
||||||
static const char *const explain[] = {
|
|
||||||
// EVENT_SKIP_NOT,
|
|
||||||
"not skipped",
|
|
||||||
// EVENT_SKIP_IGNORE,
|
|
||||||
"skipped because event should be ignored",
|
|
||||||
// EVENT_SKIP_COUNT
|
|
||||||
"skipped because event skip counter was non-zero"
|
|
||||||
};
|
|
||||||
DBUG_PRINT("info", ("OPTION_BEGIN: %d; IN_STMT: %d",
|
|
||||||
thd->options & OPTION_BEGIN ? 1 : 0,
|
|
||||||
rli->get_flag(Relay_log_info::IN_STMT)));
|
|
||||||
DBUG_PRINT("skip_event", ("%s event was %s",
|
|
||||||
ev->get_type_str(), explain[reason]));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
exec_res= ev->apply_event(rli);
|
exec_res= ev->apply_event(rli);
|
||||||
|
|
||||||
|
#ifndef DBUG_OFF
|
||||||
|
/*
|
||||||
|
This only prints information to the debug trace.
|
||||||
|
|
||||||
|
TODO: Print an informational message to the error log?
|
||||||
|
*/
|
||||||
|
static const char *const explain[] = {
|
||||||
|
// EVENT_SKIP_NOT,
|
||||||
|
"not skipped",
|
||||||
|
// EVENT_SKIP_IGNORE,
|
||||||
|
"skipped because event should be ignored",
|
||||||
|
// EVENT_SKIP_COUNT
|
||||||
|
"skipped because event skip counter was non-zero"
|
||||||
|
};
|
||||||
|
DBUG_PRINT("info", ("OPTION_BEGIN: %d; IN_STMT: %d",
|
||||||
|
thd->options & OPTION_BEGIN ? 1 : 0,
|
||||||
|
rli->get_flag(Relay_log_info::IN_STMT)));
|
||||||
|
DBUG_PRINT("skip_event", ("%s event was %s",
|
||||||
|
ev->get_type_str(), explain[reason]));
|
||||||
|
#endif
|
||||||
|
|
||||||
DBUG_PRINT("info", ("apply_event error = %d", exec_res));
|
DBUG_PRINT("info", ("apply_event error = %d", exec_res));
|
||||||
if (exec_res == 0)
|
if (exec_res == 0)
|
||||||
{
|
{
|
||||||
@ -2278,7 +2274,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
|
|||||||
delete ev;
|
delete ev;
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
exec_res= apply_event_and_update_pos(ev, thd, rli, TRUE);
|
exec_res= apply_event_and_update_pos(ev, thd, rli);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Format_description_log_event should not be deleted because it will be
|
Format_description_log_event should not be deleted because it will be
|
||||||
|
@ -190,8 +190,7 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
|
|||||||
void set_slave_thread_options(THD* thd);
|
void set_slave_thread_options(THD* thd);
|
||||||
void set_slave_thread_default_charset(THD *thd, Relay_log_info const *rli);
|
void set_slave_thread_default_charset(THD *thd, Relay_log_info const *rli);
|
||||||
void rotate_relay_log(Master_info* mi);
|
void rotate_relay_log(Master_info* mi);
|
||||||
int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli,
|
int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli);
|
||||||
bool skip);
|
|
||||||
|
|
||||||
pthread_handler_t handle_slave_io(void *arg);
|
pthread_handler_t handle_slave_io(void *arg);
|
||||||
pthread_handler_t handle_slave_sql(void *arg);
|
pthread_handler_t handle_slave_sql(void *arg);
|
||||||
|
@ -997,7 +997,7 @@ sp_drop_routine(THD *thd, int type, sp_name *name)
|
|||||||
|
|
||||||
if (ret == SP_OK)
|
if (ret == SP_OK)
|
||||||
{
|
{
|
||||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||||
sp_cache_invalidate();
|
sp_cache_invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1067,7 +1067,7 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
|
|||||||
|
|
||||||
if (ret == SP_OK)
|
if (ret == SP_OK)
|
||||||
{
|
{
|
||||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||||
sp_cache_invalidate();
|
sp_cache_invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,16 +334,18 @@ bool
|
|||||||
sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
|
sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
|
||||||
{
|
{
|
||||||
Item *expr_item;
|
Item *expr_item;
|
||||||
|
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
|
||||||
|
bool save_abort_on_warning= thd->abort_on_warning;
|
||||||
|
bool save_stmt_modified_non_trans_table=
|
||||||
|
thd->transaction.stmt.modified_non_trans_table;
|
||||||
|
|
||||||
DBUG_ENTER("sp_eval_expr");
|
DBUG_ENTER("sp_eval_expr");
|
||||||
|
|
||||||
if (!*expr_item_ptr)
|
if (!*expr_item_ptr)
|
||||||
DBUG_RETURN(TRUE);
|
goto error;
|
||||||
|
|
||||||
if (!(expr_item= sp_prepare_func_item(thd, expr_item_ptr)))
|
if (!(expr_item= sp_prepare_func_item(thd, expr_item_ptr)))
|
||||||
DBUG_RETURN(TRUE);
|
goto error;
|
||||||
|
|
||||||
bool err_status= FALSE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set THD flags to emit warnings/errors in case of overflow/type errors
|
Set THD flags to emit warnings/errors in case of overflow/type errors
|
||||||
@ -352,10 +354,6 @@ sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
|
|||||||
Save original values and restore them after save.
|
Save original values and restore them after save.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
|
|
||||||
bool save_abort_on_warning= thd->abort_on_warning;
|
|
||||||
bool save_stmt_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table;
|
|
||||||
|
|
||||||
thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
|
thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
|
||||||
thd->abort_on_warning=
|
thd->abort_on_warning=
|
||||||
thd->variables.sql_mode &
|
thd->variables.sql_mode &
|
||||||
@ -370,13 +368,18 @@ sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
|
|||||||
thd->abort_on_warning= save_abort_on_warning;
|
thd->abort_on_warning= save_abort_on_warning;
|
||||||
thd->transaction.stmt.modified_non_trans_table= save_stmt_modified_non_trans_table;
|
thd->transaction.stmt.modified_non_trans_table= save_stmt_modified_non_trans_table;
|
||||||
|
|
||||||
if (thd->is_error())
|
if (!thd->is_error())
|
||||||
{
|
DBUG_RETURN(FALSE);
|
||||||
/* Return error status if something went wrong. */
|
|
||||||
err_status= TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
DBUG_RETURN(err_status);
|
error:
|
||||||
|
/*
|
||||||
|
In case of error during evaluation, leave the result field set to NULL.
|
||||||
|
Sic: we can't do it in the beginning of the function because the
|
||||||
|
result field might be needed for its own re-evaluation, e.g. case of
|
||||||
|
set x = x + 1;
|
||||||
|
*/
|
||||||
|
result_field->set_null();
|
||||||
|
DBUG_RETURN (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2826,8 +2829,8 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_ENTER("sp_instr_stmt::execute");
|
DBUG_ENTER("sp_instr_stmt::execute");
|
||||||
DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));
|
DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));
|
||||||
|
|
||||||
query= thd->query;
|
query= thd->query();
|
||||||
query_length= thd->query_length;
|
query_length= thd->query_length();
|
||||||
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||||
/* This s-p instr is profilable and will be captured. */
|
/* This s-p instr is profilable and will be captured. */
|
||||||
thd->profiling.set_query_source(m_query.str, m_query.length);
|
thd->profiling.set_query_source(m_query.str, m_query.length);
|
||||||
@ -2840,10 +2843,11 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
|
|||||||
queries with SP vars can't be cached)
|
queries with SP vars can't be cached)
|
||||||
*/
|
*/
|
||||||
if (unlikely((thd->options & OPTION_LOG_OFF)==0))
|
if (unlikely((thd->options & OPTION_LOG_OFF)==0))
|
||||||
general_log_write(thd, COM_QUERY, thd->query, thd->query_length);
|
general_log_write(thd, COM_QUERY, thd->query(), thd->query_length());
|
||||||
|
|
||||||
if (query_cache_send_result_to_client(thd,
|
if (query_cache_send_result_to_client(thd,
|
||||||
thd->query, thd->query_length) <= 0)
|
thd->query(),
|
||||||
|
thd->query_length()) <= 0)
|
||||||
{
|
{
|
||||||
res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this);
|
res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this);
|
||||||
|
|
||||||
|
@ -2255,6 +2255,8 @@ public:
|
|||||||
GRANT_NAME (TABLE *form);
|
GRANT_NAME (TABLE *form);
|
||||||
virtual ~GRANT_NAME() {};
|
virtual ~GRANT_NAME() {};
|
||||||
virtual bool ok() { return privs != 0; }
|
virtual bool ok() { return privs != 0; }
|
||||||
|
void set_user_details(const char *h, const char *d,
|
||||||
|
const char *u, const char *t);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -2272,27 +2274,36 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void GRANT_NAME::set_user_details(const char *h, const char *d,
|
||||||
GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u,
|
const char *u, const char *t)
|
||||||
const char *t, ulong p)
|
|
||||||
:privs(p)
|
|
||||||
{
|
{
|
||||||
/* Host given by user */
|
/* Host given by user */
|
||||||
update_hostname(&host, strdup_root(&memex, h));
|
update_hostname(&host, strdup_root(&memex, h));
|
||||||
db = strdup_root(&memex,d);
|
if (db != d)
|
||||||
|
{
|
||||||
|
db= strdup_root(&memex, d);
|
||||||
|
if (lower_case_table_names)
|
||||||
|
my_casedn_str(files_charset_info, db);
|
||||||
|
}
|
||||||
user = strdup_root(&memex,u);
|
user = strdup_root(&memex,u);
|
||||||
sort= get_sort(3,host.hostname,db,user);
|
sort= get_sort(3,host.hostname,db,user);
|
||||||
tname= strdup_root(&memex,t);
|
if (tname != t)
|
||||||
if (lower_case_table_names)
|
|
||||||
{
|
{
|
||||||
my_casedn_str(files_charset_info, db);
|
tname= strdup_root(&memex, t);
|
||||||
my_casedn_str(files_charset_info, tname);
|
if (lower_case_table_names)
|
||||||
|
my_casedn_str(files_charset_info, tname);
|
||||||
}
|
}
|
||||||
key_length= strlen(d) + strlen(u)+ strlen(t)+3;
|
key_length= strlen(d) + strlen(u)+ strlen(t)+3;
|
||||||
hash_key= (char*) alloc_root(&memex,key_length);
|
hash_key= (char*) alloc_root(&memex,key_length);
|
||||||
strmov(strmov(strmov(hash_key,user)+1,db)+1,tname);
|
strmov(strmov(strmov(hash_key,user)+1,db)+1,tname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u,
|
||||||
|
const char *t, ulong p)
|
||||||
|
:db(0), tname(0), privs(p)
|
||||||
|
{
|
||||||
|
set_user_details(h, d, u, t);
|
||||||
|
}
|
||||||
|
|
||||||
GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u,
|
GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u,
|
||||||
const char *t, ulong p, ulong c)
|
const char *t, ulong p, ulong c)
|
||||||
@ -3184,7 +3195,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||||||
|
|
||||||
if (!result) /* success */
|
if (!result) /* success */
|
||||||
{
|
{
|
||||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||||
}
|
}
|
||||||
|
|
||||||
rw_unlock(&LOCK_grant);
|
rw_unlock(&LOCK_grant);
|
||||||
@ -3349,7 +3360,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
|
|||||||
|
|
||||||
if (write_to_binlog)
|
if (write_to_binlog)
|
||||||
{
|
{
|
||||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||||
}
|
}
|
||||||
|
|
||||||
rw_unlock(&LOCK_grant);
|
rw_unlock(&LOCK_grant);
|
||||||
@ -3461,7 +3472,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
|||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||||
}
|
}
|
||||||
|
|
||||||
rw_unlock(&LOCK_grant);
|
rw_unlock(&LOCK_grant);
|
||||||
@ -5436,9 +5447,20 @@ static int handle_grant_struct(uint struct_no, bool drop,
|
|||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
grant_name->user= strdup_root(&mem, user_to->user.str);
|
/*
|
||||||
update_hostname(&grant_name->host,
|
Update the grant structure with the new user name and
|
||||||
strdup_root(&mem, user_to->host.str));
|
host name
|
||||||
|
*/
|
||||||
|
grant_name->set_user_details(user_to->host.str, grant_name->db,
|
||||||
|
user_to->user.str, grant_name->tname);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Since username is part of the hash key, when the user name
|
||||||
|
is renamed, the hash key is changed. Update the hash to
|
||||||
|
ensure that the position matches the new hash key value
|
||||||
|
*/
|
||||||
|
hash_update(&column_priv_hash, (uchar*) grant_name,
|
||||||
|
(uchar*) grant_name->hash_key, grant_name->key_length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5663,7 +5685,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
|
|||||||
my_error(ER_CANNOT_USER, MYF(0), "CREATE USER", wrong_users.c_ptr_safe());
|
my_error(ER_CANNOT_USER, MYF(0), "CREATE USER", wrong_users.c_ptr_safe());
|
||||||
|
|
||||||
if (some_users_created)
|
if (some_users_created)
|
||||||
write_bin_log(thd, FALSE, thd->query, thd->query_length);
|
write_bin_log(thd, FALSE, thd->query(), thd->query_length());
|
||||||
|
|
||||||
rw_unlock(&LOCK_grant);
|
rw_unlock(&LOCK_grant);
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
@ -5736,7 +5758,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
|
|||||||
my_error(ER_CANNOT_USER, MYF(0), "DROP USER", wrong_users.c_ptr_safe());
|
my_error(ER_CANNOT_USER, MYF(0), "DROP USER", wrong_users.c_ptr_safe());
|
||||||
|
|
||||||
if (some_users_deleted)
|
if (some_users_deleted)
|
||||||
write_bin_log(thd, FALSE, thd->query, thd->query_length);
|
write_bin_log(thd, FALSE, thd->query(), thd->query_length());
|
||||||
|
|
||||||
rw_unlock(&LOCK_grant);
|
rw_unlock(&LOCK_grant);
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
@ -5821,7 +5843,7 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
|
|||||||
my_error(ER_CANNOT_USER, MYF(0), "RENAME USER", wrong_users.c_ptr_safe());
|
my_error(ER_CANNOT_USER, MYF(0), "RENAME USER", wrong_users.c_ptr_safe());
|
||||||
|
|
||||||
if (some_users_renamed && mysql_bin_log.is_open())
|
if (some_users_renamed && mysql_bin_log.is_open())
|
||||||
write_bin_log(thd, FALSE, thd->query, thd->query_length);
|
write_bin_log(thd, FALSE, thd->query(), thd->query_length());
|
||||||
|
|
||||||
rw_unlock(&LOCK_grant);
|
rw_unlock(&LOCK_grant);
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
@ -6003,7 +6025,7 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
|||||||
|
|
||||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||||
|
|
||||||
write_bin_log(thd, FALSE, thd->query, thd->query_length);
|
write_bin_log(thd, FALSE, thd->query(), thd->query_length());
|
||||||
|
|
||||||
rw_unlock(&LOCK_grant);
|
rw_unlock(&LOCK_grant);
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
|
@ -56,17 +56,20 @@ void mysql_client_binlog_statement(THD* thd)
|
|||||||
Format_description_event.
|
Format_description_event.
|
||||||
*/
|
*/
|
||||||
my_bool have_fd_event= TRUE;
|
my_bool have_fd_event= TRUE;
|
||||||
if (!thd->rli_fake)
|
int err;
|
||||||
|
Relay_log_info *rli;
|
||||||
|
rli= thd->rli_fake;
|
||||||
|
if (!rli)
|
||||||
{
|
{
|
||||||
thd->rli_fake= new Relay_log_info;
|
rli= thd->rli_fake= new Relay_log_info;
|
||||||
#ifdef HAVE_purify
|
#ifdef HAVE_purify
|
||||||
thd->rli_fake->is_fake= TRUE;
|
rli->is_fake= TRUE;
|
||||||
#endif
|
#endif
|
||||||
have_fd_event= FALSE;
|
have_fd_event= FALSE;
|
||||||
}
|
}
|
||||||
if (thd->rli_fake && !thd->rli_fake->relay_log.description_event_for_exec)
|
if (rli && !rli->relay_log.description_event_for_exec)
|
||||||
{
|
{
|
||||||
thd->rli_fake->relay_log.description_event_for_exec=
|
rli->relay_log.description_event_for_exec=
|
||||||
new Format_description_log_event(4);
|
new Format_description_log_event(4);
|
||||||
have_fd_event= FALSE;
|
have_fd_event= FALSE;
|
||||||
}
|
}
|
||||||
@ -78,16 +81,16 @@ void mysql_client_binlog_statement(THD* thd)
|
|||||||
/*
|
/*
|
||||||
Out of memory check
|
Out of memory check
|
||||||
*/
|
*/
|
||||||
if (!(thd->rli_fake &&
|
if (!(rli &&
|
||||||
thd->rli_fake->relay_log.description_event_for_exec &&
|
rli->relay_log.description_event_for_exec &&
|
||||||
buf))
|
buf))
|
||||||
{
|
{
|
||||||
my_error(ER_OUTOFMEMORY, MYF(0), 1); /* needed 1 bytes */
|
my_error(ER_OUTOFMEMORY, MYF(0), 1); /* needed 1 bytes */
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
thd->rli_fake->sql_thd= thd;
|
rli->sql_thd= thd;
|
||||||
thd->rli_fake->no_storage= TRUE;
|
rli->no_storage= TRUE;
|
||||||
|
|
||||||
for (char const *strptr= thd->lex->comment.str ;
|
for (char const *strptr= thd->lex->comment.str ;
|
||||||
strptr < thd->lex->comment.str + thd->lex->comment.length ; )
|
strptr < thd->lex->comment.str + thd->lex->comment.length ; )
|
||||||
@ -170,8 +173,7 @@ void mysql_client_binlog_statement(THD* thd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ev= Log_event::read_log_event(bufptr, event_len, &error,
|
ev= Log_event::read_log_event(bufptr, event_len, &error,
|
||||||
thd->rli_fake->relay_log.
|
rli->relay_log.description_event_for_exec);
|
||||||
description_event_for_exec);
|
|
||||||
|
|
||||||
DBUG_PRINT("info",("binlog base64 err=%s", error));
|
DBUG_PRINT("info",("binlog base64 err=%s", error));
|
||||||
if (!ev)
|
if (!ev)
|
||||||
@ -209,18 +211,10 @@ void mysql_client_binlog_statement(THD* thd)
|
|||||||
reporting.
|
reporting.
|
||||||
*/
|
*/
|
||||||
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
|
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
|
||||||
if (apply_event_and_update_pos(ev, thd, thd->rli_fake, FALSE))
|
err= ev->apply_event(rli);
|
||||||
{
|
#else
|
||||||
delete ev;
|
err= 0;
|
||||||
/*
|
|
||||||
TODO: Maybe a better error message since the BINLOG statement
|
|
||||||
now contains several events.
|
|
||||||
*/
|
|
||||||
my_error(ER_UNKNOWN_ERROR, MYF(0), "Error executing BINLOG statement");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Format_description_log_event should not be deleted because it
|
Format_description_log_event should not be deleted because it
|
||||||
will be used to read info about the relay log's format; it
|
will be used to read info about the relay log's format; it
|
||||||
@ -228,8 +222,17 @@ void mysql_client_binlog_statement(THD* thd)
|
|||||||
i.e. when this thread terminates.
|
i.e. when this thread terminates.
|
||||||
*/
|
*/
|
||||||
if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT)
|
if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT)
|
||||||
delete ev;
|
delete ev;
|
||||||
ev= 0;
|
ev= 0;
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
TODO: Maybe a better error message since the BINLOG statement
|
||||||
|
now contains several events.
|
||||||
|
*/
|
||||||
|
my_error(ER_UNKNOWN_ERROR, MYF(0), "Error executing BINLOG statement");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +241,7 @@ void mysql_client_binlog_statement(THD* thd)
|
|||||||
my_ok(thd);
|
my_ok(thd);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
thd->rli_fake->clear_tables_to_lock();
|
rli->clear_tables_to_lock();
|
||||||
my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
|
my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
@ -1119,8 +1119,8 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
uint8 tables_type= 0;
|
uint8 tables_type= 0;
|
||||||
|
|
||||||
if ((local_tables= is_cacheable(thd, thd->query_length,
|
if ((local_tables= is_cacheable(thd, thd->query_length(),
|
||||||
thd->query, thd->lex, tables_used,
|
thd->query(), thd->lex, tables_used,
|
||||||
&tables_type)))
|
&tables_type)))
|
||||||
{
|
{
|
||||||
NET *net= &thd->net;
|
NET *net= &thd->net;
|
||||||
@ -1210,7 +1210,8 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
|
|||||||
/* Key is query + database + flag */
|
/* Key is query + database + flag */
|
||||||
if (thd->db_length)
|
if (thd->db_length)
|
||||||
{
|
{
|
||||||
memcpy(thd->query+thd->query_length+1, thd->db, thd->db_length);
|
memcpy(thd->query() + thd->query_length() + 1, thd->db,
|
||||||
|
thd->db_length);
|
||||||
DBUG_PRINT("qcache", ("database: %s length: %u",
|
DBUG_PRINT("qcache", ("database: %s length: %u",
|
||||||
thd->db, (unsigned) thd->db_length));
|
thd->db, (unsigned) thd->db_length));
|
||||||
}
|
}
|
||||||
@ -1218,24 +1219,24 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
|
|||||||
{
|
{
|
||||||
DBUG_PRINT("qcache", ("No active database"));
|
DBUG_PRINT("qcache", ("No active database"));
|
||||||
}
|
}
|
||||||
tot_length= thd->query_length + thd->db_length + 1 +
|
tot_length= thd->query_length() + thd->db_length + 1 +
|
||||||
QUERY_CACHE_FLAGS_SIZE;
|
QUERY_CACHE_FLAGS_SIZE;
|
||||||
/*
|
/*
|
||||||
We should only copy structure (don't use it location directly)
|
We should only copy structure (don't use it location directly)
|
||||||
because of alignment issue
|
because of alignment issue
|
||||||
*/
|
*/
|
||||||
memcpy((void *)(thd->query + (tot_length - QUERY_CACHE_FLAGS_SIZE)),
|
memcpy((void*) (thd->query() + (tot_length - QUERY_CACHE_FLAGS_SIZE)),
|
||||||
&flags, QUERY_CACHE_FLAGS_SIZE);
|
&flags, QUERY_CACHE_FLAGS_SIZE);
|
||||||
|
|
||||||
/* Check if another thread is processing the same query? */
|
/* Check if another thread is processing the same query? */
|
||||||
Query_cache_block *competitor = (Query_cache_block *)
|
Query_cache_block *competitor = (Query_cache_block *)
|
||||||
hash_search(&queries, (uchar*) thd->query, tot_length);
|
hash_search(&queries, (uchar*) thd->query(), tot_length);
|
||||||
DBUG_PRINT("qcache", ("competitor 0x%lx", (ulong) competitor));
|
DBUG_PRINT("qcache", ("competitor 0x%lx", (ulong) competitor));
|
||||||
if (competitor == 0)
|
if (competitor == 0)
|
||||||
{
|
{
|
||||||
/* Query is not in cache and no one is working with it; Store it */
|
/* Query is not in cache and no one is working with it; Store it */
|
||||||
Query_cache_block *query_block;
|
Query_cache_block *query_block;
|
||||||
query_block= write_block_data(tot_length, (uchar*) thd->query,
|
query_block= write_block_data(tot_length, (uchar*) thd->query(),
|
||||||
ALIGN_SIZE(sizeof(Query_cache_query)),
|
ALIGN_SIZE(sizeof(Query_cache_query)),
|
||||||
Query_cache_block::QUERY, local_tables);
|
Query_cache_block::QUERY, local_tables);
|
||||||
if (query_block != 0)
|
if (query_block != 0)
|
||||||
|
@ -376,14 +376,14 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
|
|||||||
str.append(proc_info);
|
str.append(proc_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thd->query)
|
if (thd->query())
|
||||||
{
|
{
|
||||||
if (max_query_len < 1)
|
if (max_query_len < 1)
|
||||||
len= thd->query_length;
|
len= thd->query_length();
|
||||||
else
|
else
|
||||||
len= min(thd->query_length, max_query_len);
|
len= min(thd->query_length(), max_query_len);
|
||||||
str.append('\n');
|
str.append('\n');
|
||||||
str.append(thd->query, len);
|
str.append(thd->query(), len);
|
||||||
}
|
}
|
||||||
if (str.c_ptr_safe() == buffer)
|
if (str.c_ptr_safe() == buffer)
|
||||||
return buffer;
|
return buffer;
|
||||||
@ -2434,12 +2434,12 @@ Statement::Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg,
|
|||||||
id(id_arg),
|
id(id_arg),
|
||||||
mark_used_columns(MARK_COLUMNS_READ),
|
mark_used_columns(MARK_COLUMNS_READ),
|
||||||
lex(lex_arg),
|
lex(lex_arg),
|
||||||
query(0),
|
|
||||||
query_length(0),
|
|
||||||
cursor(0),
|
cursor(0),
|
||||||
db(NULL),
|
db(NULL),
|
||||||
db_length(0)
|
db_length(0)
|
||||||
{
|
{
|
||||||
|
query_string.length= 0;
|
||||||
|
query_string.str= NULL;
|
||||||
name.str= NULL;
|
name.str= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2455,8 +2455,7 @@ void Statement::set_statement(Statement *stmt)
|
|||||||
id= stmt->id;
|
id= stmt->id;
|
||||||
mark_used_columns= stmt->mark_used_columns;
|
mark_used_columns= stmt->mark_used_columns;
|
||||||
lex= stmt->lex;
|
lex= stmt->lex;
|
||||||
query= stmt->query;
|
query_string= stmt->query_string;
|
||||||
query_length= stmt->query_length;
|
|
||||||
cursor= stmt->cursor;
|
cursor= stmt->cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2480,6 +2479,15 @@ void Statement::restore_backup_statement(Statement *stmt, Statement *backup)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Assign a new value to thd->query. */
|
||||||
|
|
||||||
|
void Statement::set_query_inner(char *query_arg, uint32 query_length_arg)
|
||||||
|
{
|
||||||
|
query_string.str= query_arg;
|
||||||
|
query_string.length= query_length_arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void THD::end_statement()
|
void THD::end_statement()
|
||||||
{
|
{
|
||||||
/* Cleanup SQL processing state to reuse this statement in next query. */
|
/* Cleanup SQL processing state to reuse this statement in next query. */
|
||||||
@ -2993,9 +3001,24 @@ extern "C" struct charset_info_st *thd_charset(MYSQL_THD thd)
|
|||||||
return(thd->charset());
|
return(thd->charset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
OBSOLETE : there's no way to ensure the string is null terminated.
|
||||||
|
Use thd_query_string instead()
|
||||||
|
*/
|
||||||
extern "C" char **thd_query(MYSQL_THD thd)
|
extern "C" char **thd_query(MYSQL_THD thd)
|
||||||
{
|
{
|
||||||
return(&thd->query);
|
return(&thd->query_string.str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the current query string for the thread.
|
||||||
|
|
||||||
|
@param The MySQL internal thread pointer
|
||||||
|
@return query string and length. May be non-null-terminated.
|
||||||
|
*/
|
||||||
|
extern "C" LEX_STRING * thd_query_string (MYSQL_THD thd)
|
||||||
|
{
|
||||||
|
return(&thd->query_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int thd_slave_thread(const MYSQL_THD thd)
|
extern "C" int thd_slave_thread(const MYSQL_THD thd)
|
||||||
@ -3174,8 +3197,7 @@ void THD::set_statement(Statement *stmt)
|
|||||||
void THD::set_query(char *query_arg, uint32 query_length_arg)
|
void THD::set_query(char *query_arg, uint32 query_length_arg)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&LOCK_thd_data);
|
pthread_mutex_lock(&LOCK_thd_data);
|
||||||
query= query_arg;
|
set_query_inner(query_arg, query_length_arg);
|
||||||
query_length= query_length_arg;
|
|
||||||
pthread_mutex_unlock(&LOCK_thd_data);
|
pthread_mutex_unlock(&LOCK_thd_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +93,8 @@ extern char internal_table_name[2];
|
|||||||
extern char empty_c_string[1];
|
extern char empty_c_string[1];
|
||||||
extern MYSQL_PLUGIN_IMPORT const char **errmesg;
|
extern MYSQL_PLUGIN_IMPORT const char **errmesg;
|
||||||
|
|
||||||
|
extern bool volatile shutdown_in_progress;
|
||||||
|
|
||||||
#define TC_LOG_PAGE_SIZE 8192
|
#define TC_LOG_PAGE_SIZE 8192
|
||||||
#define TC_LOG_MIN_SIZE (3*TC_LOG_PAGE_SIZE)
|
#define TC_LOG_MIN_SIZE (3*TC_LOG_PAGE_SIZE)
|
||||||
|
|
||||||
@ -642,10 +644,13 @@ public:
|
|||||||
This printing is needed at least in SHOW PROCESSLIST and SHOW
|
This printing is needed at least in SHOW PROCESSLIST and SHOW
|
||||||
ENGINE INNODB STATUS.
|
ENGINE INNODB STATUS.
|
||||||
*/
|
*/
|
||||||
char *query;
|
LEX_STRING query_string;
|
||||||
uint32 query_length; // current query length
|
|
||||||
Server_side_cursor *cursor;
|
Server_side_cursor *cursor;
|
||||||
|
|
||||||
|
inline char *query() { return query_string.str; }
|
||||||
|
inline uint32 query_length() { return query_string.length; }
|
||||||
|
void set_query_inner(char *query_arg, uint32 query_length_arg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Name of the current (default) database.
|
Name of the current (default) database.
|
||||||
|
|
||||||
@ -2137,7 +2142,11 @@ public:
|
|||||||
{
|
{
|
||||||
int err= killed_errno();
|
int err= killed_errno();
|
||||||
if (err)
|
if (err)
|
||||||
|
{
|
||||||
|
if ((err == KILL_CONNECTION) && !shutdown_in_progress)
|
||||||
|
err = KILL_QUERY;
|
||||||
my_message(err, ER(err), MYF(0));
|
my_message(err, ER(err), MYF(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* return TRUE if we will abort query if we make a warning now */
|
/* return TRUE if we will abort query if we make a warning now */
|
||||||
inline bool really_abort_on_warning()
|
inline bool really_abort_on_warning()
|
||||||
@ -2647,7 +2656,32 @@ public:
|
|||||||
MI_COLUMNDEF *recinfo,*start_recinfo;
|
MI_COLUMNDEF *recinfo,*start_recinfo;
|
||||||
KEY *keyinfo;
|
KEY *keyinfo;
|
||||||
ha_rows end_write_records;
|
ha_rows end_write_records;
|
||||||
uint field_count,sum_func_count,func_count;
|
/**
|
||||||
|
Number of normal fields in the query, including those referred to
|
||||||
|
from aggregate functions. Hence, "SELECT `field1`,
|
||||||
|
SUM(`field2`) from t1" sets this counter to 2.
|
||||||
|
|
||||||
|
@see count_field_types
|
||||||
|
*/
|
||||||
|
uint field_count;
|
||||||
|
/**
|
||||||
|
Number of fields in the query that have functions. Includes both
|
||||||
|
aggregate functions (e.g., SUM) and non-aggregates (e.g., RAND).
|
||||||
|
Also counts functions referred to from aggregate functions, i.e.,
|
||||||
|
"SELECT SUM(RAND())" sets this counter to 2.
|
||||||
|
|
||||||
|
@see count_field_types
|
||||||
|
*/
|
||||||
|
uint func_count;
|
||||||
|
/**
|
||||||
|
Number of fields in the query that have aggregate functions. Note
|
||||||
|
that the optimizer may choose to optimize away these fields by
|
||||||
|
replacing them with constants, in which case sum_func_count will
|
||||||
|
need to be updated.
|
||||||
|
|
||||||
|
@see opt_sum_query, count_field_types
|
||||||
|
*/
|
||||||
|
uint sum_func_count;
|
||||||
uint hidden_field_count;
|
uint hidden_field_count;
|
||||||
uint group_parts,group_length,group_null_parts;
|
uint group_parts,group_length,group_null_parts;
|
||||||
uint quick_group;
|
uint quick_group;
|
||||||
|
@ -703,7 +703,7 @@ not_silent:
|
|||||||
char *query;
|
char *query;
|
||||||
uint query_length;
|
uint query_length;
|
||||||
|
|
||||||
if (!thd->query) // Only in replication
|
if (!thd->query()) // Only in replication
|
||||||
{
|
{
|
||||||
query= tmp_query;
|
query= tmp_query;
|
||||||
query_length= (uint) (strxmov(tmp_query,"create database `",
|
query_length= (uint) (strxmov(tmp_query,"create database `",
|
||||||
@ -711,8 +711,8 @@ not_silent:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
query= thd->query;
|
query= thd->query();
|
||||||
query_length= thd->query_length;
|
query_length= thd->query_length();
|
||||||
}
|
}
|
||||||
|
|
||||||
ha_binlog_log_query(thd, 0, LOGCOM_CREATE_DB,
|
ha_binlog_log_query(thd, 0, LOGCOM_CREATE_DB,
|
||||||
@ -805,13 +805,13 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ha_binlog_log_query(thd, 0, LOGCOM_ALTER_DB,
|
ha_binlog_log_query(thd, 0, LOGCOM_ALTER_DB,
|
||||||
thd->query, thd->query_length,
|
thd->query(), thd->query_length(),
|
||||||
db, "");
|
db, "");
|
||||||
|
|
||||||
if (mysql_bin_log.is_open())
|
if (mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
int errcode= query_error_code(thd, TRUE);
|
int errcode= query_error_code(thd, TRUE);
|
||||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0,
|
Query_log_event qinfo(thd, thd->query(), thd->query_length(), 0,
|
||||||
/* suppress_use */ TRUE, errcode);
|
/* suppress_use */ TRUE, errcode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -948,7 +948,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
|
|||||||
{
|
{
|
||||||
const char *query;
|
const char *query;
|
||||||
ulong query_length;
|
ulong query_length;
|
||||||
if (!thd->query)
|
if (!thd->query())
|
||||||
{
|
{
|
||||||
/* The client used the old obsolete mysql_drop_db() call */
|
/* The client used the old obsolete mysql_drop_db() call */
|
||||||
query= path;
|
query= path;
|
||||||
@ -957,8 +957,8 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
query =thd->query;
|
query= thd->query();
|
||||||
query_length= thd->query_length;
|
query_length= thd->query_length();
|
||||||
}
|
}
|
||||||
if (mysql_bin_log.is_open())
|
if (mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
@ -1964,7 +1964,7 @@ bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db)
|
|||||||
if (mysql_bin_log.is_open())
|
if (mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
int errcode= query_error_code(thd, TRUE);
|
int errcode= query_error_code(thd, TRUE);
|
||||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
Query_log_event qinfo(thd, thd->query(), thd->query_length(),
|
||||||
0, TRUE, errcode);
|
0, TRUE, errcode);
|
||||||
thd->clear_error();
|
thd->clear_error();
|
||||||
mysql_bin_log.write(&qinfo);
|
mysql_bin_log.write(&qinfo);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user