#At file:///home/bm136801/my/mtr-55/ based on revid:bjorn.munch@stripped
3199 Bjorn Munch 2011-04-15 [merge]
merge from 5.5 main
removed:
mysql-test/suite/bugs/
mysql-test/suite/bugs/combinations
mysql-test/suite/bugs/data/
mysql-test/suite/bugs/data/rpl_bug12691.dat
mysql-test/suite/bugs/r/
mysql-test/suite/bugs/r/bug57108.result
mysql-test/suite/bugs/r/rpl_bug12691.result
mysql-test/suite/bugs/r/rpl_bug31582.result
mysql-test/suite/bugs/r/rpl_bug31583.result
mysql-test/suite/bugs/r/rpl_bug33029.result
mysql-test/suite/bugs/r/rpl_bug38205.result
mysql-test/suite/bugs/t/
mysql-test/suite/bugs/t/bug57108-master.opt
mysql-test/suite/bugs/t/bug57108.test
mysql-test/suite/bugs/t/rpl_bug12691.test
mysql-test/suite/bugs/t/rpl_bug31582.test
mysql-test/suite/bugs/t/rpl_bug31583.test
mysql-test/suite/bugs/t/rpl_bug33029.test
mysql-test/suite/bugs/t/rpl_bug38205.test
renamed:
mysql-test/suite/bugs/r/rpl_bug23533.result => mysql-test/suite/binlog/r/binlog_bug23533.result
mysql-test/suite/bugs/r/rpl_bug36391.result => mysql-test/suite/binlog/r/binlog_bug36391.result
mysql-test/suite/bugs/r/rpl_bug37426.result => mysql-test/suite/rpl/r/rpl_bug37426.result
mysql-test/suite/bugs/t/rpl_bug23533.test => mysql-test/suite/binlog/t/binlog_bug23533.test
mysql-test/suite/bugs/t/rpl_bug36391-master.opt => mysql-test/suite/binlog/t/binlog_bug36391-master.opt
mysql-test/suite/bugs/t/rpl_bug36391.test => mysql-test/suite/binlog/t/binlog_bug36391.test
mysql-test/suite/bugs/t/rpl_bug37426.test => mysql-test/suite/rpl/t/rpl_bug37426.test
modified:
VERSION
client/client_priv.h
client/mysqlslap.c
cmake/os/Windows.cmake
cmake/os/WindowsCache.cmake
config.h.cmake
configure.cmake
include/my_global.h
include/violite.h
mysql-test/collections/default.experimental
mysql-test/include/ctype_numconv.inc
mysql-test/r/alter_table.result
mysql-test/r/ctype_binary.result
mysql-test/r/ctype_cp1251.result
mysql-test/r/ctype_latin1.result
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_utf8.result
mysql-test/r/func_analyse.result
mysql-test/r/func_group.result
mysql-test/r/func_in.result
mysql-test/r/loaddata.result
mysql-test/r/mysqlslap.result
mysql-test/r/subselect.result
mysql-test/r/view.result
mysql-test/r/warnings.result
mysql-test/r/xa.result
mysql-test/t/alter_table.test
mysql-test/t/func_analyse.test
mysql-test/t/func_group.test
mysql-test/t/func_in.test
mysql-test/t/loaddata.test
mysql-test/t/mysqlslap.test
mysql-test/t/subselect.test
mysql-test/t/view.test
mysql-test/t/warnings.test
mysql-test/t/xa.test
mysys/my_init.c
mysys/my_thr_init.c
mysys/mysys_priv.h
sql/field.cc
sql/hostname.cc
sql/item.cc
sql/item.h
sql/item_cmpfunc.cc
sql/item_func.cc
sql/item_func.h
sql/item_strfunc.cc
sql/item_sum.cc
sql/mdl.h
sql/mysqld.cc
sql/opt_sum.cc
sql/sp_head.cc
sql/sql_admin.cc
sql/sql_base.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_error.cc
sql/sql_error.h
sql/sql_load.cc
sql/sql_parse.cc
sql/sql_plist.h
sql/sql_prepare.cc
sql/sql_select.cc
sql/sql_select.h
sql/sql_show.cc
sql/sql_table.cc
sql/sql_trigger.cc
sql/transaction.cc
vio/viosocket.c
mysql-test/suite/binlog/r/binlog_bug23533.result
mysql-test/suite/binlog/r/binlog_bug36391.result
mysql-test/suite/rpl/r/rpl_bug37426.result
mysql-test/suite/binlog/t/binlog_bug23533.test
mysql-test/suite/binlog/t/binlog_bug36391.test
mysql-test/suite/rpl/t/rpl_bug37426.test
=== modified file 'VERSION'
--- a/VERSION 2011-03-21 07:22:44 +0000
+++ b/VERSION 2011-04-11 09:49:05 +0000
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5
-MYSQL_VERSION_PATCH=12
+MYSQL_VERSION_PATCH=13
MYSQL_VERSION_EXTRA=
=== modified file 'client/client_priv.h'
--- a/client/client_priv.h 2011-02-21 10:15:29 +0000
+++ b/client/client_priv.h 2011-04-08 06:55:59 +0000
@@ -75,6 +75,7 @@ enum options_client
OPT_SLAP_POST_SYSTEM,
OPT_SLAP_COMMIT,
OPT_SLAP_DETACH,
+ OPT_SLAP_NO_DROP,
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT_MODE, OPT_SERVER_ID,
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
OPT_AUTO_VERTICAL_OUTPUT,
=== modified file 'client/mysqlslap.c'
--- a/client/mysqlslap.c 2011-01-16 03:59:05 +0000
+++ b/client/mysqlslap.c 2011-04-08 06:55:59 +0000
@@ -128,7 +128,7 @@ const char *delimiter= "\n";
const char *create_schema_string= "mysqlslap";
-static my_bool opt_preserve= TRUE;
+static my_bool opt_preserve= TRUE, opt_no_drop= FALSE;
static my_bool debug_info_flag= 0, debug_check_flag= 0;
static my_bool opt_only_print= FALSE;
static my_bool opt_compress= FALSE, tty_password= FALSE,
@@ -607,6 +607,8 @@ static struct my_option my_long_options[
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"iterations", 'i', "Number of times to run the tests.", &iterations,
&iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
+ {"no-drop", OPT_SLAP_NO_DROP, "Do not drop the schema after the test.",
+ &opt_no_drop, &opt_no_drop, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"number-char-cols", 'x',
"Number of VARCHAR columns to create in table if specifying --auto-generate-sql.",
&num_char_cols_opt, &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
@@ -1149,8 +1151,11 @@ get_options(int *argc,char ***argv)
if (!user)
user= (char *)"root";
- /* If something is created we clean it up, otherwise we leave schemas alone */
- if (create_string || auto_generate_sql)
+ /*
+ If something is created and --no-drop is not specified, we drop the
+ schema.
+ */
+ if (!opt_no_drop && (create_string || auto_generate_sql))
opt_preserve= FALSE;
if (auto_generate_sql && (create_string || user_supplied_query))
=== modified file 'cmake/os/Windows.cmake'
--- a/cmake/os/Windows.cmake 2010-11-19 23:20:18 +0000
+++ b/cmake/os/Windows.cmake 2011-04-14 08:08:12 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Sun Microsystems, Inc
+# Copyright (C) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -192,3 +192,4 @@ IF(NOT HAVE_SIZE_OF_SSIZE_T)
ENDIF()
SET(FN_NO_CASE_SENSE 1)
+SET(USE_SYMDIR 1)
=== modified file 'cmake/os/WindowsCache.cmake'
--- a/cmake/os/WindowsCache.cmake 2010-11-19 23:56:07 +0000
+++ b/cmake/os/WindowsCache.cmake 2011-04-13 19:05:26 +0000
@@ -76,9 +76,6 @@ SET(HAVE_FTRUNCATE CACHE INTERNAL "")
SET(HAVE_GETADDRINFO 1 CACHE INTERNAL "")
SET(HAVE_GETCWD 1 CACHE INTERNAL "")
SET(HAVE_GETHOSTBYADDR_R CACHE INTERNAL "")
-SET(HAVE_GETHOSTBYNAME_R CACHE INTERNAL "")
-SET(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE CACHE INTERNAL "")
-SET(HAVE_GETHOSTBYNAME_R_RETURN_INT CACHE INTERNAL "")
SET(HAVE_GETHRTIME CACHE INTERNAL "")
SET(HAVE_GETLINE CACHE INTERNAL "")
SET(HAVE_GETNAMEINFO CACHE INTERNAL "")
=== modified file 'config.h.cmake'
--- a/config.h.cmake 2011-02-02 18:13:28 +0000
+++ b/config.h.cmake 2011-04-14 08:08:12 +0000
@@ -157,7 +157,6 @@
#cmakedefine HAVE_GETADDRINFO 1
#cmakedefine HAVE_GETCWD 1
#cmakedefine HAVE_GETHOSTBYADDR_R 1
-#cmakedefine HAVE_GETHOSTBYNAME_R 1
#cmakedefine HAVE_GETHRTIME 1
#cmakedefine HAVE_GETLINE 1
#cmakedefine HAVE_GETNAMEINFO 1
@@ -448,8 +447,6 @@
#cmakedefine HAVE_SOLARIS_STYLE_GETHOST 1
-#cmakedefine HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE 1
-#cmakedefine HAVE_GETHOSTBYNAME_R_RETURN_INT 1
#cmakedefine MY_ATOMIC_MODE_DUMMY 1
#cmakedefine MY_ATOMIC_MODE_RWLOCKS 1
@@ -513,6 +510,7 @@
#cmakedefine EXTRA_DEBUG 1
#cmakedefine BACKUP_TEST 1
#cmakedefine CYBOZU 1
+#cmakedefine USE_SYMDIR 1
/* Character sets and collations */
#cmakedefine MYSQL_DEFAULT_CHARSET_NAME "@MYSQL_DEFAULT_CHARSET_NAME@"
=== modified file 'configure.cmake'
--- a/configure.cmake 2011-02-02 18:13:28 +0000
+++ b/configure.cmake 2011-04-13 19:05:26 +0000
@@ -350,7 +350,6 @@ CHECK_FUNCTION_EXISTS (fseeko HAVE_FSEEK
CHECK_FUNCTION_EXISTS (fsync HAVE_FSYNC)
CHECK_FUNCTION_EXISTS (getcwd HAVE_GETCWD)
CHECK_FUNCTION_EXISTS (gethostbyaddr_r HAVE_GETHOSTBYADDR_R)
-CHECK_FUNCTION_EXISTS (gethostbyname_r HAVE_GETHOSTBYNAME_R)
CHECK_FUNCTION_EXISTS (gethrtime HAVE_GETHRTIME)
CHECK_FUNCTION_EXISTS (getnameinfo HAVE_GETNAMEINFO)
CHECK_FUNCTION_EXISTS (getpass HAVE_GETPASS)
@@ -921,44 +920,6 @@ CHECK_CXX_SOURCE_COMPILES("
"
HAVE_SOLARIS_STYLE_GETHOST)
-CHECK_CXX_SOURCE_COMPILES("
- #undef inline
- #if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
- #define _REENTRANT
- #endif
- #include <pthread.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <netdb.h>
- int main()
- {
- int ret = gethostbyname_r((const char *) 0,
- (struct hostent*) 0, (char*) 0, 0, (struct hostent **) 0, (int *) 0);
- return 0;
- }"
- HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
-
-CHECK_CXX_SOURCE_COMPILES("
- #undef inline
- #if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
- #define _REENTRANT
- #endif
- #include <pthread.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <netdb.h>
- int main()
- {
- int ret = gethostbyname_r((const char *) 0, (struct hostent*) 0, (struct hostent_data*) 0);
- return 0;
- }"
- HAVE_GETHOSTBYNAME_R_RETURN_INT)
-
-
# Use of ALARMs to wakeup on timeout on sockets
#
# This feature makes use of a mutex and is a scalability hog we
=== modified file 'include/my_global.h'
--- a/include/my_global.h 2011-03-29 12:43:49 +0000
+++ b/include/my_global.h 2011-04-13 19:05:26 +0000
@@ -301,9 +301,6 @@ C_MODE_END
#undef HAVE_PWRITE
#endif
-#ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */
-#undef HAVE_GETHOSTBYNAME_R
-#endif
#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */
#undef HAVE_INITGROUPS
#endif
=== modified file 'include/violite.h'
--- a/include/violite.h 2010-06-07 14:01:39 +0000
+++ b/include/violite.h 2011-04-08 10:23:36 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -93,6 +93,8 @@ ssize_t vio_pending(Vio *vio);
my_bool vio_get_normalized_ip_string(const struct sockaddr *addr, int addr_length,
char *ip_string, size_t ip_string_size);
+my_bool vio_is_no_name_error(int err_code);
+
int vio_getnameinfo(const struct sockaddr *sa,
char *hostname, size_t hostname_size,
char *port, size_t port_size,
=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental 2011-03-16 14:11:20 +0000
+++ b/mysql-test/collections/default.experimental 2011-04-13 20:48:09 +0000
@@ -2,6 +2,9 @@
# in alphabetical order. This also helps with merge conflict resolution.
binlog.binlog_multi_engine # joro : NDB tests marked as experimental as agreed with bochklin
+binlog.binlog_bug23533 # WL#5867: skozlov: test case moved from unused bugs suite
+binlog.binlog_bug36391 # WL#5867: skozlov: test case moved from unused bugs suite
+
funcs_1.charset_collation_1 # depends on compile-time decisions
@@ -15,18 +18,11 @@ main.type_float @freebsd
main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris
rpl.rpl_innodb_bug28430 # Bug#46029
+rpl.rpl_bug37426 # WL#5867: skozlov: test case moved from unused bugs suite
sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
sys_vars.plugin_dir_basic # Bug#52223 2010-11-24 alik Test "plugin_dir_basic" does not support RPM build (test) directory structure
-sys_vars.slow_query_log_func @solaris # Bug#54819 2010-06-26 alik sys_vars.slow_query_log_func fails sporadically on Solaris 10
sys_vars.wait_timeout_func # Bug#41255 2010-04-26 alik wait_timeout_func fails
-sys_vars.sys_vars # Bug #59148 2011-01-10 joro 'INSTALL PLUGIN rpl_semi_sync_master' fails in release build with debug binaries
-sys_vars.rpl_semi_sync_master_enabled_basic # Bug #59148 2011-01-10 joro 'INSTALL PLUGIN rpl_semi_sync_master' fails in release build with debug binaries
-sys_vars.rpl_semi_sync_master_timeout_basic # Bug #59148 2011-01-10 joro 'INSTALL PLUGIN rpl_semi_sync_master' fails in release build with debug binaries
-sys_vars.rpl_semi_sync_master_trace_level_basic # Bug #59148 2011-01-10 joro 'INSTALL PLUGIN rpl_semi_sync_master' fails in release build with debug binaries
-sys_vars.rpl_semi_sync_master_wait_no_slave_basic # Bug #59148 2011-01-10 joro 'INSTALL PLUGIN rpl_semi_sync_master' fails in release build with debug binaries
-rpl.rpl_semi_sync_event # Bug #59148 2011-02-02 svoj 'INSTALL PLUGIN rpl_semi_sync_master' fails in release build with debug binaries
-rpl.rpl_semi_sync # Bug #59148 2011-02-02 svoj 'INSTALL PLUGIN rpl_semi_sync_master' fails in release build with debug binaries
# BUG #59055 : All ndb tests should be removed from the repository
# Leaving the sys_vars tests for now. sys_vars.all_vars.test fails on removing ndb tests
=== modified file 'mysql-test/include/ctype_numconv.inc'
--- a/mysql-test/include/ctype_numconv.inc 2011-02-10 13:38:18 +0000
+++ b/mysql-test/include/ctype_numconv.inc 2011-04-08 13:15:23 +0000
@@ -1765,6 +1765,22 @@ SELECT
HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date,
HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime;
+--echo #
+--echo # Bug#11926811 / Bug#60625 Illegal mix of collations
+--echo #
+SELECT @@collation_connection;
+DELIMITER //;
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE v_LastPaymentDate DATETIME DEFAULT NULL;
+ SELECT v_LastPaymentDate < NOW();
+ EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW();
+ SHOW WARNINGS;
+ EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW());
+END//
+DELIMITER ;//
+CALL p1;
+DROP PROCEDURE p1;
--echo #
--echo # Bug#52159 returning time type from function and empty left join causes debug assertion
=== modified file 'mysql-test/r/alter_table.result'
--- a/mysql-test/r/alter_table.result 2011-02-21 11:30:08 +0000
+++ b/mysql-test/r/alter_table.result 2011-04-13 06:16:40 +0000
@@ -1391,3 +1391,16 @@ CREATE DATABASE db1 CHARACTER SET utf8;
CREATE TABLE db1.t1 (bar TINYTEXT, KEY (bar(100)));
ALTER TABLE db1.t1 ADD baz INT;
DROP DATABASE db1;
+#
+# Bug#11938039 RE-EXECUTION OF FRM-ONLY ALTER TABLE WITH RENAME
+# CLAUSE FAILS OR ABORTS SERVER.
+#
+drop table if exists t1;
+create table t1 (a int);
+prepare stmt1 from 'alter table t1 alter column a set default 1, rename to t2';
+execute stmt1;
+rename table t2 to t1;
+# The below statement should succeed and not emit error or abort server.
+execute stmt1;
+deallocate prepare stmt1;
+drop table t2;
=== modified file 'mysql-test/r/ctype_binary.result'
--- a/mysql-test/r/ctype_binary.result 2011-02-10 08:18:08 +0000
+++ b/mysql-test/r/ctype_binary.result 2011-04-08 13:15:23 +0000
@@ -2807,6 +2807,32 @@ HEX(DATE_SUB(CAST('2007-08-03 17:33:00'
field_str1 field1_str2 field_date field_datetime
323030372D30382D30322032333A35393A3030 323030372D30382D30332031373A33323A3030 323030372D30382D3032 323030372D30382D30332031373A33323A3030
#
+# Bug#11926811 / Bug#60625 Illegal mix of collations
+#
+SELECT @@collation_connection;
+@@collation_connection
+binary
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE v_LastPaymentDate DATETIME DEFAULT NULL;
+SELECT v_LastPaymentDate < NOW();
+EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW();
+SHOW WARNINGS;
+EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW());
+END//
+CALL p1;
+v_LastPaymentDate < NOW()
+NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select concat(v_LastPaymentDate@0,now()) AS `CONCAT(v_LastPaymentDate, NOW())`
+DROP PROCEDURE p1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
=== modified file 'mysql-test/r/ctype_cp1251.result'
--- a/mysql-test/r/ctype_cp1251.result 2011-02-18 07:32:40 +0000
+++ b/mysql-test/r/ctype_cp1251.result 2011-04-08 13:15:23 +0000
@@ -3199,6 +3199,32 @@ HEX(DATE_SUB(CAST('2007-08-03 17:33:00'
field_str1 field1_str2 field_date field_datetime
323030372D30382D30322032333A35393A3030 323030372D30382D30332031373A33323A3030 323030372D30382D3032 323030372D30382D30332031373A33323A3030
#
+# Bug#11926811 / Bug#60625 Illegal mix of collations
+#
+SELECT @@collation_connection;
+@@collation_connection
+cp1251_general_ci
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE v_LastPaymentDate DATETIME DEFAULT NULL;
+SELECT v_LastPaymentDate < NOW();
+EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW();
+SHOW WARNINGS;
+EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW());
+END//
+CALL p1;
+v_LastPaymentDate < NOW()
+NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select concat(convert(v_LastPaymentDate@0 using cp1251),now()) AS `CONCAT(v_LastPaymentDate, NOW())`
+DROP PROCEDURE p1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
=== modified file 'mysql-test/r/ctype_latin1.result'
--- a/mysql-test/r/ctype_latin1.result 2011-03-04 15:43:28 +0000
+++ b/mysql-test/r/ctype_latin1.result 2011-04-08 13:15:23 +0000
@@ -3226,6 +3226,32 @@ HEX(DATE_SUB(CAST('2007-08-03 17:33:00'
field_str1 field1_str2 field_date field_datetime
323030372D30382D30322032333A35393A3030 323030372D30382D30332031373A33323A3030 323030372D30382D3032 323030372D30382D30332031373A33323A3030
#
+# Bug#11926811 / Bug#60625 Illegal mix of collations
+#
+SELECT @@collation_connection;
+@@collation_connection
+latin1_swedish_ci
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE v_LastPaymentDate DATETIME DEFAULT NULL;
+SELECT v_LastPaymentDate < NOW();
+EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW();
+SHOW WARNINGS;
+EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW());
+END//
+CALL p1;
+v_LastPaymentDate < NOW()
+NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select concat(v_LastPaymentDate@0,now()) AS `CONCAT(v_LastPaymentDate, NOW())`
+DROP PROCEDURE p1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
=== modified file 'mysql-test/r/ctype_ucs.result'
--- a/mysql-test/r/ctype_ucs.result 2011-03-03 15:46:30 +0000
+++ b/mysql-test/r/ctype_ucs.result 2011-04-08 13:15:23 +0000
@@ -4060,6 +4060,32 @@ HEX(DATE_SUB(CAST('2007-08-03 17:33:00'
field_str1 field1_str2 field_date field_datetime
0032003000300037002D00300038002D00300032002000320033003A00350039003A00300030 0032003000300037002D00300038002D00300033002000310037003A00330032003A00300030 323030372D30382D3032 323030372D30382D30332031373A33323A3030
#
+# Bug#11926811 / Bug#60625 Illegal mix of collations
+#
+SELECT @@collation_connection;
+@@collation_connection
+ucs2_general_ci
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE v_LastPaymentDate DATETIME DEFAULT NULL;
+SELECT v_LastPaymentDate < NOW();
+EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW();
+SHOW WARNINGS;
+EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW());
+END//
+CALL p1;
+v_LastPaymentDate < NOW()
+NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select concat(convert(v_LastPaymentDate@0 using ucs2),convert(now() using ucs2)) AS `CONCAT(v_LastPaymentDate, NOW())`
+DROP PROCEDURE p1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
=== modified file 'mysql-test/r/ctype_utf8.result'
--- a/mysql-test/r/ctype_utf8.result 2011-03-04 15:43:28 +0000
+++ b/mysql-test/r/ctype_utf8.result 2011-04-08 13:15:23 +0000
@@ -4938,6 +4938,32 @@ HEX(DATE_SUB(CAST('2007-08-03 17:33:00'
field_str1 field1_str2 field_date field_datetime
323030372D30382D30322032333A35393A3030 323030372D30382D30332031373A33323A3030 323030372D30382D3032 323030372D30382D30332031373A33323A3030
#
+# Bug#11926811 / Bug#60625 Illegal mix of collations
+#
+SELECT @@collation_connection;
+@@collation_connection
+utf8_general_ci
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE v_LastPaymentDate DATETIME DEFAULT NULL;
+SELECT v_LastPaymentDate < NOW();
+EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW();
+SHOW WARNINGS;
+EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW());
+END//
+CALL p1;
+v_LastPaymentDate < NOW()
+NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select concat(convert(v_LastPaymentDate@0 using utf8),now()) AS `CONCAT(v_LastPaymentDate, NOW())`
+DROP PROCEDURE p1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
=== modified file 'mysql-test/r/func_analyse.result'
--- a/mysql-test/r/func_analyse.result 2011-03-14 18:06:44 +0000
+++ b/mysql-test/r/func_analyse.result 2011-04-14 09:10:11 +0000
@@ -135,4 +135,17 @@ SELECT * FROM t1 PROCEDURE ANALYSE();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.a e e- 1 2 0 0 1.3333 NULL ENUM('e','e-') NOT NULL
DROP TABLE t1;
+#
+# Bug#11756242 48137: PROCEDURE ANALYSE() LEAKS MEMORY WHEN RETURNING NULL
+#
+CREATE TABLE t1(f1 INT) ENGINE=MYISAM;
+CREATE TABLE t2(f2 INT) ENGINE=INNODB;
+INSERT INTO t2 VALUES (1);
+SELECT DISTINCTROW f1 FROM t1 NATURAL RIGHT OUTER JOIN t2 PROCEDURE ANALYSE();
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+test.t1.f1 NULL NULL 0 0 0 1 0.0 0.0 CHAR(0)
+SELECT * FROM t2 LIMIT 1 PROCEDURE ANALYSE();
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+test.t2.f2 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
+DROP TABLE t1, t2;
End of 5.1 tests
=== modified file 'mysql-test/r/func_group.result'
--- a/mysql-test/r/func_group.result 2011-04-02 19:41:10 +0000
+++ b/mysql-test/r/func_group.result 2011-04-12 10:13:15 +0000
@@ -1746,6 +1746,17 @@ MAX(LENGTH(a)) LENGTH(MAX(a)) MIN(a) MAX
20 20 18446668621106209655 18446668621106209655 18446668621106209655 18446668621106209655
DROP TABLE t1;
#
+# Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION
+#
+CREATE TABLE t1(f1 YEAR(4));
+INSERT INTO t1 VALUES (0000),(2001);
+(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1);
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def MAX(f1) MAX(f1) 13 4 4 Y 32864 0 63
+MAX(f1)
+2001
+DROP TABLE t1;
+#
End of 5.1 tests
#
# Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
=== modified file 'mysql-test/r/func_in.result'
--- a/mysql-test/r/func_in.result 2010-06-22 18:53:08 +0000
+++ b/mysql-test/r/func_in.result 2011-04-12 09:51:36 +0000
@@ -770,4 +770,10 @@ CASE a WHEN a THEN a END
NULL
DROP TABLE t1;
#
+# Bug #11766212 59270: NOT IN (YEAR( ... ), ... ) PRODUCES MANY VALGRIND WARNINGS
+#
+SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1);
+1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1)
+1
+#
End of 5.1 tests
=== modified file 'mysql-test/r/loaddata.result'
--- a/mysql-test/r/loaddata.result 2010-07-14 12:05:20 +0000
+++ b/mysql-test/r/loaddata.result 2011-04-15 08:55:21 +0000
@@ -532,4 +532,11 @@ a
0
1
DROP TABLE t1;
+#
+# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
+#
+CREATE TABLE t1(f1 INT);
+SELECT 0xE1BB30 INTO OUTFILE 't1.dat';
+LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
+DROP TABLE t1;
End of 5.1 tests
=== modified file 'mysql-test/r/mysqlslap.result'
--- a/mysql-test/r/mysqlslap.result 2007-12-20 20:32:16 +0000
+++ b/mysql-test/r/mysqlslap.result 2011-04-08 07:04:54 +0000
@@ -225,3 +225,25 @@ DROP SCHEMA IF EXISTS `mysqlslap`;
DROP PROCEDURE IF EXISTS p1;
CREATE PROCEDURE p1() SELECT 1;
DROP PROCEDURE p1;
+#
+# Bug #11765157 - 58090: mysqlslap drops schema specified in
+# create_schema if auto-generate-sql also set.
+#
+# 'bug58090' database should not be present.
+SHOW DATABASES;
+Database
+information_schema
+mtr
+mysql
+performance_schema
+test
+# 'bug58090' database should be present.
+SHOW DATABASES;
+Database
+information_schema
+bug58090
+mtr
+mysql
+performance_schema
+test
+DROP DATABASE bug58090;
=== modified file 'mysql-test/r/subselect.result'
--- a/mysql-test/r/subselect.result 2011-01-12 12:15:22 +0000
+++ b/mysql-test/r/subselect.result 2011-04-15 06:54:05 +0000
@@ -5058,6 +5058,24 @@ i
DROP TABLE t1,t1s,t2s;
End of 5.1 tests
#
+# Bug #11765713 58705:
+# OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
+# CREATED BY OPT_SUM_QUERY
+#
+CREATE TABLE t1(a INT NOT NULL, KEY (a));
+INSERT INTO t1 VALUES (0), (1);
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1)
+);
+ERROR 21000: Subquery returns more than 1 row
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1 where a is null)
+);
+foo
+DROP TABLE t1;
+#
# Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool):
# Assertion `file' failed.
#
=== modified file 'mysql-test/r/view.result'
--- a/mysql-test/r/view.result 2011-03-08 17:39:25 +0000
+++ b/mysql-test/r/view.result 2011-04-08 08:09:24 +0000
@@ -4012,6 +4012,15 @@ DROP TABLE t1;
#
CREATE VIEW v1 AS SELECT 1 IN (1 LIKE 2,0) AS f;
DROP VIEW v1;
+#
+# Bug 11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
+#
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT s.* FROM t1 s, t1 b HAVING a;
+SELECT * FROM v1;
+a
+DROP VIEW v1;
+DROP TABLE t1;
# -----------------------------------------------------------------
# -- End of 5.1 tests.
# -----------------------------------------------------------------
=== modified file 'mysql-test/r/warnings.result'
--- a/mysql-test/r/warnings.result 2010-02-24 13:52:27 +0000
+++ b/mysql-test/r/warnings.result 2011-04-15 12:02:22 +0000
@@ -316,3 +316,25 @@ SHOW ERRORS;
Level Code Message
Error 1051 Unknown table 't1'
End of 5.0 tests
+
+-- Bug#55847
+
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+CREATE TABLE t1(a INT UNIQUE);
+CREATE FUNCTION f1(x INT) RETURNS INT
+BEGIN
+INSERT INTO t1 VALUES(x);
+INSERT INTO t1 VALUES(x);
+RETURN x;
+END|
+
+SHOW TABLES WHERE f1(11) = 11;
+ERROR 23000: Duplicate entry '11' for key 'a'
+
+SHOW WARNINGS;
+Level Code Message
+Error 1062 Duplicate entry '11' for key 'a'
+
+DROP TABLE t1;
+DROP FUNCTION f1;
=== modified file 'mysql-test/r/xa.result'
--- a/mysql-test/r/xa.result 2011-02-14 13:16:31 +0000
+++ b/mysql-test/r/xa.result 2011-04-14 08:13:28 +0000
@@ -166,3 +166,66 @@ ERROR XA102: XA_RBDEADLOCK: Transaction
XA END 'b';
XA ROLLBACK 'b';
DROP TABLE t1;
+#
+# Bug#11766752 59936: multiple xa assertions - transactional
+# statement fuzzer
+#
+CREATE TABLE t1 (a INT) engine=InnoDB;
+XA START 'a';
+INSERT INTO t1 VALUES (1);
+SAVEPOINT savep;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
+XA END 'a';
+SELECT * FROM t1;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+INSERT INTO t1 VALUES (2);
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+SAVEPOINT savep;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+SET @a=(SELECT * FROM t1);
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+XA PREPARE 'a';
+SELECT * FROM t1;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+INSERT INTO t1 VALUES (2);
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+SAVEPOINT savep;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+SET @a=(SELECT * FROM t1);
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+UPDATE t1 SET a=1 WHERE a=2;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+XA COMMIT 'a';
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+#
+# Bug#12352846 - TRANS_XA_START(THD*):
+# ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL()
+# FAILED
+#
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+# Connection con2
+XA START 'xid1';
+# Sending:
+INSERT INTO t2 SELECT a FROM t1;
+# Connection default
+# Waiting until INSERT ... is blocked
+DELETE FROM t1;
+COMMIT;
+# Connection con2
+# Reaping: INSERT INTO t2 SELECT a FROM t1
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+XA COMMIT 'xid1';
+ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
+XA START 'xid1';
+XA END 'xid1';
+XA PREPARE 'xid1';
+XA ROLLBACK 'xid1';
+# Connection default
+DROP TABLE t1, t2;
=== renamed file 'mysql-test/suite/bugs/r/rpl_bug23533.result' => 'mysql-test/suite/binlog/r/binlog_bug23533.result'
--- a/mysql-test/suite/bugs/r/rpl_bug23533.result 2008-02-28 21:50:15 +0000
+++ b/mysql-test/suite/binlog/r/binlog_bug23533.result 2011-04-14 11:24:11 +0000
@@ -1,23 +1,16 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-DROP TABLE IF EXISTS t1,t2;
SET AUTOCOMMIT=0;
-SET GLOBAL max_binlog_cache_size=4096;
-SHOW VARIABLES LIKE 'max_binlog_cache_size';
-Variable_name Value
-max_binlog_cache_size 4096
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b TEXT, PRIMARY KEY(a)) ENGINE=InnoDB;
SELECT COUNT(*) FROM t1;
COUNT(*)
1000
+SET @saved_max_binlog_cache_size=@@max_binlog_cache_size;
+SET GLOBAL max_binlog_cache_size=4096;
START TRANSACTION;
CREATE TABLE t2 SELECT * FROM t1;
-ERROR HY000: Writing one row to the row-based binary log failed
+ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again
COMMIT;
SHOW TABLES LIKE 't%';
Tables_in_test (t%)
t1
+SET GLOBAL max_binlog_cache_size=@saved_max_binlog_cache_size;
+DROP TABLE t1;
=== renamed file 'mysql-test/suite/bugs/r/rpl_bug36391.result' => 'mysql-test/suite/binlog/r/binlog_bug36391.result'
--- a/mysql-test/suite/bugs/r/rpl_bug36391.result 2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/binlog/r/binlog_bug36391.result 2011-04-13 20:18:08 +0000
@@ -1,18 +1,10 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-drop table if exists t1;
-Warnings:
-Note 1051 Unknown table 't1'
-create table t1(id int);
-show tables;
+CREATE TABLE t1(id INT);
+SHOW TABLES;
Tables_in_test
t1
-show master status;
-File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
-flush logs;
-drop table t1;
+FLUSH LOGS;
+DROP TABLE t1;
+SHOW TABLES;
+Tables_in_test
+t1
+DROP TABLE t1;
=== renamed file 'mysql-test/suite/bugs/t/rpl_bug23533.test' => 'mysql-test/suite/binlog/t/binlog_bug23533.test'
--- a/mysql-test/suite/bugs/t/rpl_bug23533.test 2010-12-19 17:07:28 +0000
+++ b/mysql-test/suite/binlog/t/binlog_bug23533.test 2011-04-14 11:24:11 +0000
@@ -4,15 +4,13 @@
#############################################################
--source include/have_innodb.inc
+--source include/have_log_bin.inc
--source include/have_binlog_format_row.inc
---source include/master-slave.inc
SET AUTOCOMMIT=0;
-SET GLOBAL max_binlog_cache_size=4096;
-SHOW VARIABLES LIKE 'max_binlog_cache_size';
+# Create 1st table
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b TEXT, PRIMARY KEY(a)) ENGINE=InnoDB;
-
--disable_query_log
let $i= 1000;
while ($i)
@@ -21,16 +19,19 @@ while ($i)
dec $i;
}
--enable_query_log
-
SELECT COUNT(*) FROM t1;
+# Set small value for max_binlog_cache_size
+SET @saved_max_binlog_cache_size=@@max_binlog_cache_size;
+SET GLOBAL max_binlog_cache_size=4096;
+
# Copied data from t1 into t2 large than max_binlog_cache_size
START TRANSACTION;
---error 1534
+--error 1197
CREATE TABLE t2 SELECT * FROM t1;
COMMIT;
SHOW TABLES LIKE 't%';
-
# 5.1 End of Test
---source include/rpl_end.inc
+SET GLOBAL max_binlog_cache_size=@saved_max_binlog_cache_size;
+DROP TABLE t1;
=== renamed file 'mysql-test/suite/bugs/t/rpl_bug36391-master.opt' => 'mysql-test/suite/binlog/t/binlog_bug36391-master.opt'
=== renamed file 'mysql-test/suite/bugs/t/rpl_bug36391.test' => 'mysql-test/suite/binlog/t/binlog_bug36391.test'
--- a/mysql-test/suite/bugs/t/rpl_bug36391.test 2010-12-19 17:07:28 +0000
+++ b/mysql-test/suite/binlog/t/binlog_bug36391.test 2011-04-13 20:18:08 +0000
@@ -13,17 +13,18 @@
#
#
---source include/master-slave.inc
+--source include/have_log_bin.inc
+--source include/have_binlog_format_mixed.inc
-create table t1(id int);
+CREATE TABLE t1(id INT);
+let $binlog= query_get_value(SHOW MASTER STATUS, File, 1);
+let $binlog_path= `SELECT CONCAT(@@DATADIR, '$binlog')`;
+SHOW TABLES;
+FLUSH LOGS;
+DROP TABLE t1;
-show tables;
+--exec $MYSQL_BINLOG $binlog_path | $MYSQL test
+SHOW TABLES;
---source include/show_master_status.inc
-
-flush logs;
-
---exec $MYSQL_BINLOG $MYSQL_TEST_DIR/var/log/master-bin.000001 | $MYSQL test
-
-drop table t1;
---source include/rpl_end.inc
+# Clean up
+DROP TABLE t1;
=== removed directory 'mysql-test/suite/bugs'
=== removed file 'mysql-test/suite/bugs/combinations'
--- a/mysql-test/suite/bugs/combinations 2008-09-05 13:31:09 +0000
+++ b/mysql-test/suite/bugs/combinations 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-[row]
-binlog-format=row
-
-[stmt]
-binlog-format=statement
-
-[mix]
-binlog-format=mixed
=== removed directory 'mysql-test/suite/bugs/data'
=== removed file 'mysql-test/suite/bugs/data/rpl_bug12691.dat'
--- a/mysql-test/suite/bugs/data/rpl_bug12691.dat 2008-01-31 13:23:27 +0000
+++ b/mysql-test/suite/bugs/data/rpl_bug12691.dat 1970-01-01 00:00:00 +0000
@@ -1,3 +0,0 @@
-a
-b
-c
=== removed directory 'mysql-test/suite/bugs/r'
=== removed file 'mysql-test/suite/bugs/r/bug57108.result'
--- a/mysql-test/suite/bugs/r/bug57108.result 2010-11-04 10:00:59 +0000
+++ b/mysql-test/suite/bugs/r/bug57108.result 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
-INSTALL PLUGIN example SONAME 'ha_example.so';
-SELECT @@global.connect_timeout AS connect_timeout, @@global.local_infile AS local_infile;
-connect_timeout 4711
-local_infile 1
-UNINSTALL PLUGIN example;
=== removed file 'mysql-test/suite/bugs/r/rpl_bug12691.result'
--- a/mysql-test/suite/bugs/r/rpl_bug12691.result 2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/bugs/r/rpl_bug12691.result 1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-
-**** On Master ****
-CREATE TABLE t1 (b CHAR(10));
-
-**** On Slave ****
-STOP SLAVE;
-
-**** On Master ****
-LOAD DATA INFILE FILENAME
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-3
-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 (b CHAR(10))
-master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
-master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/rpl_bug12691.dat' INTO TABLE `t1` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`b`) ;file_id=#
-
-**** On Slave ****
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-0
-
-**** On Master ****
-DROP TABLE t1;
=== removed file 'mysql-test/suite/bugs/r/rpl_bug31582.result'
--- a/mysql-test/suite/bugs/r/rpl_bug31582.result 2007-12-05 19:49:50 +0000
+++ b/mysql-test/suite/bugs/r/rpl_bug31582.result 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('a');
-UPDATE t1 SET a = 'MyISAM';
-SELECT * FROM t1 ORDER BY a;
-a
-MyISAM
-SELECT * FROM t1 ORDER BY a;
-a
-MyISAM
-DROP TABLE t1;
=== removed file 'mysql-test/suite/bugs/r/rpl_bug31583.result'
--- a/mysql-test/suite/bugs/r/rpl_bug31583.result 2008-02-18 14:48:17 +0000
+++ b/mysql-test/suite/bugs/r/rpl_bug31583.result 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-CREATE TABLE t1 ( a INT, b INT DEFAULT -3 );
-INSERT INTO t1 VALUES (1, DEFAULT);
-UPDATE t1 SET a = 3;
-SELECT * FROM t1 ORDER BY a;
-a b
-3 -3
-SELECT * FROM t1 ORDER BY a;
-a b
-3 -3
-DROP TABLE t1;
=== removed file 'mysql-test/suite/bugs/r/rpl_bug33029.result'
--- a/mysql-test/suite/bugs/r/rpl_bug33029.result 2008-06-19 18:47:59 +0000
+++ b/mysql-test/suite/bugs/r/rpl_bug33029.result 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-create table `t1` (`id` int not null auto_increment primary key);
-create trigger `trg` before insert on `t1` for each row begin end;
-set @@global.debug="+d,simulate_bug33029";
-stop slave;
-start slave;
-insert into `t1` values ();
-select * from t1;
-id
-1
=== removed file 'mysql-test/suite/bugs/r/rpl_bug38205.result'
--- a/mysql-test/suite/bugs/r/rpl_bug38205.result 2009-04-09 13:05:41 +0000
+++ b/mysql-test/suite/bugs/r/rpl_bug38205.result 1970-01-01 00:00:00 +0000
@@ -1,56 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-create table t1i(n int primary key) engine=innodb;
-create table t2m(n int primary key) engine=myisam;
-begin;
-insert into t1i values (1);
-insert into t1i values (2);
-insert into t1i values (3);
-commit;
-begin;
-insert into t1i values (5);
-begin;
-insert into t1i values (4);
-insert into t2m values (1);
-update t1i set n = 5 where n = 4;
-commit;
-zero
-0
-*** kill sql thread ***
-rollback;
-*** sql thread is *not* running: No ***
-*** the prove: the killed slave has not finished the current transaction ***
-three
-3
-one
-1
-zero
-0
-delete from t2m;
-start slave sql_thread;
-delete from t1i;
-delete from t2m;
-begin;
-insert into t1i values (5);
-begin;
-insert into t1i values (4);
-update t1i set n = 5 where n = 4;
-commit;
-zero
-0
-stop slave sql_thread;
-rollback;
-*** sql thread is *not* running: No ***
-*** the prove: the stopped slave has rolled back the current transaction ***
-zero
-0
-zero
-0
-one
-1
-start slave sql_thread;
-drop table t1i, t2m;
=== removed directory 'mysql-test/suite/bugs/t'
=== removed file 'mysql-test/suite/bugs/t/bug57108-master.opt'
--- a/mysql-test/suite/bugs/t/bug57108-master.opt 2010-11-04 10:00:59 +0000
+++ b/mysql-test/suite/bugs/t/bug57108-master.opt 1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
---defaults-file=std_data/bug57108.cnf
-$EXAMPLE_PLUGIN_OPT
=== removed file 'mysql-test/suite/bugs/t/bug57108.test'
--- a/mysql-test/suite/bugs/t/bug57108.test 2011-01-11 13:27:03 +0000
+++ b/mysql-test/suite/bugs/t/bug57108.test 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
---source include/not_windows_embedded.inc
---source include/have_example_plugin.inc
-
-# Test that we can install a plugin despite the fact that we have
-# switched directory after starting the server and am using a relative
-# --defaults-file.
---replace_regex /\.dll/.so/
-eval INSTALL PLUGIN example SONAME '$EXAMPLE_PLUGIN';
-
---query_vertical SELECT @@global.connect_timeout AS connect_timeout, @@global.local_infile AS local_infile
-
-UNINSTALL PLUGIN example;
=== removed file 'mysql-test/suite/bugs/t/rpl_bug12691.test'
--- a/mysql-test/suite/bugs/t/rpl_bug12691.test 2010-12-19 17:15:12 +0000
+++ b/mysql-test/suite/bugs/t/rpl_bug12691.test 1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
-# Bug#12691: Exec_master_log_pos corrupted with SQL_SLAVE_SKIP_COUNTER
-
---source include/master-slave.inc
---source include/have_binlog_format_mixed_or_statement.inc
-
---echo
---echo **** On Master ****
-CREATE TABLE t1 (b CHAR(10));
---echo
---echo **** On Slave ****
---sync_slave_with_master
-STOP SLAVE;
---source include/wait_for_slave_to_stop.inc
-
---connection master
-
---echo
---echo **** On Master ****
---exec cp $MYSQL_TEST_DIR/suite/bugs/data/rpl_bug12691.dat $MYSQLTEST_VARDIR/tmp/
---echo LOAD DATA INFILE FILENAME
---disable_query_log
---eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/rpl_bug12691.dat' INTO TABLE t1 FIELDS TERMINATED BY '|'
---enable_query_log
---remove_file $MYSQLTEST_VARDIR/tmp/rpl_bug12691.dat
-
-SELECT COUNT(*) FROM t1;
-
-source include/show_binlog_events.inc;
-
---save_master_pos
-
---connection slave
---echo
---echo **** On Slave ****
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
---source include/wait_for_slave_to_start.inc
---sync_with_master
-
-SELECT COUNT(*) FROM t1;
-
-# Clean up
---connection master
---echo
---echo **** On Master ****
-DROP TABLE t1;
-
---source include/rpl_end.inc
=== removed file 'mysql-test/suite/bugs/t/rpl_bug31582.test'
--- a/mysql-test/suite/bugs/t/rpl_bug31582.test 2010-12-19 17:07:28 +0000
+++ b/mysql-test/suite/bugs/t/rpl_bug31582.test 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
-
-# BUG#31582: 5.1-telco-6.1 -> 5.1.22. Slave crashes when reading
-# UPDATE for VARCHAR
-
-# This is a problem for any update statement replicating from an old
-# server to a new server. The bug consisted of a new slave trying to
-# read two column bitmaps, but there is only one available in the old
-# format.
-
-# This test case should be executed replicating from an old server to
-# a new server, so make sure you have one handy.
-
-source include/master-slave.inc;
-
-CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('a');
-UPDATE t1 SET a = 'MyISAM';
-SELECT * FROM t1 ORDER BY a;
-sync_slave_with_master;
-SELECT * FROM t1 ORDER BY a;
-
-connection master;
-DROP TABLE t1;
-
---source include/rpl_end.inc
=== removed file 'mysql-test/suite/bugs/t/rpl_bug31583.test'
--- a/mysql-test/suite/bugs/t/rpl_bug31583.test 2010-12-19 17:07:28 +0000
+++ b/mysql-test/suite/bugs/t/rpl_bug31583.test 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
-#
-# BUG#31583: 5.1-telco-6.1 -> 5.1.22. Slave returns Error in unknown event
-
-# This is a problem for any update statement replicating from an old
-# server to a new server. The bug consisted of a new slave trying to
-# read two column bitmaps, but there is only one available in the old
-# format.
-
-# This test case should be executed replicating from an old server to
-# a new server, so make sure you have one handy.
-
-source include/master-slave.inc;
-
-CREATE TABLE t1 ( a INT, b INT DEFAULT -3 );
-
-INSERT INTO t1 VALUES (1, DEFAULT);
-UPDATE t1 SET a = 3;
-SELECT * FROM t1 ORDER BY a;
-sync_slave_with_master;
-SELECT * FROM t1 ORDER BY a;
-
-connection master;
-DROP TABLE t1;
-
---source include/rpl_end.inc
=== removed file 'mysql-test/suite/bugs/t/rpl_bug33029.test'
--- a/mysql-test/suite/bugs/t/rpl_bug33029.test 2010-12-19 17:07:28 +0000
+++ b/mysql-test/suite/bugs/t/rpl_bug33029.test 1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-#
-# Bug #36443 Server crashes when executing insert when insert trigger on table
-#
-# Emulating the former bug#33029 situation to see that there is no crash anymore.
-#
-
-
-source include/master-slave.inc;
-
-create table `t1` (`id` int not null auto_increment primary key);
-create trigger `trg` before insert on `t1` for each row begin end;
-
-sync_slave_with_master;
-set @@global.debug="+d,simulate_bug33029";
-
-stop slave;
-start slave;
-
-connection master;
-
-insert into `t1` values ();
-
-sync_slave_with_master;
-select * from t1;
-
---source include/rpl_end.inc
=== removed file 'mysql-test/suite/bugs/t/rpl_bug38205.test'
--- a/mysql-test/suite/bugs/t/rpl_bug38205.test 2010-12-19 17:07:28 +0000
+++ b/mysql-test/suite/bugs/t/rpl_bug38205.test 1970-01-01 00:00:00 +0000
@@ -1,166 +0,0 @@
-#
-# Bug #38205 Row-based Replication (RBR) causes inconsistencies: HA_ERR_FOUND_DUPP_KEY
-# Bug#319 if while a non-transactional slave is replicating a transaction possible problem
-#
-# Verifying the fact that STOP SLAVE in the middle of a group execution waits
-# for the end of the group before the slave sql thread will stop.
-# The patch refines STOP SLAVE to not interrupt a transaction or other type of
-# the replication events group (the part I).
-# Killing the sql thread continues to provide a "hard" stop (the part II).
-#
-# Non-deterministic tests
-#
-
-source include/master-slave.inc;
-source include/have_innodb.inc;
-
-
-#
-# Part II, killed sql slave leaves instantly
-#
-
-# A. multi-statement transaction as the replication group
-
-connection master;
-
-create table t1i(n int primary key) engine=innodb;
-create table t2m(n int primary key) engine=myisam;
-
-sync_slave_with_master;
-
-connection master;
-
-begin;
-insert into t1i values (1);
-insert into t1i values (2);
-insert into t1i values (3);
-commit;
-
-sync_slave_with_master;
-
-#
-# todo: first challenge is to find out the SQL thread id
-# the following is not fully reliable
-#
-
-let $id=`SELECT id from information_schema.processlist where user like 'system user' and state like '%Has read all relay log%' or user like 'system user' and state like '%Reading event from the relay log%'`;
-connection slave;
-begin;
-insert into t1i values (5);
-
-connection master;
-let $pos0_master= query_get_value(SHOW MASTER STATUS, Position, 1);
-begin;
-insert into t1i values (4);
-insert into t2m values (1); # non-ta update
-update t1i set n = 5 where n = 4; # to block at. can't be played with killed
-commit;
-let $pos1_master= query_get_value(SHOW MASTER STATUS, Position, 1);
-
-connection slave;
-# slave sql thread must be locked out by the conn `slave' explicit lock
-let $pos0_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
---disable_query_log
-eval select $pos0_master - $pos0_slave as zero;
---enable_query_log
-
-connection slave1;
-
-let $count= 1;
-let $table= t2m;
-source include/wait_until_rows_count.inc;
-#
-# todo: may fail as said above
-#
---echo *** kill sql thread ***
---disable_query_log
-eval kill connection $id;
---enable_query_log
-
-connection slave;
-rollback; # release the sql thread
-
-connection slave1;
-
-source include/wait_for_slave_sql_to_stop.inc;
-let $sql_status= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1);
---echo *** sql thread is *not* running: $sql_status ***
-let $pos1_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
-
-connection slave;
---echo *** the prove: the killed slave has not finished the current transaction ***
-
---disable_query_log
-select count(*) as three from t1i;
-eval select $pos1_master > $pos1_slave as one;
-eval select $pos1_slave - $pos0_slave as zero;
---enable_query_log
-
-delete from t2m; # remove the row to be able to replay
-start slave sql_thread;
-
-#
-# Part I: B The homogenous transaction remains interuptable in between
-#
-
-connection master;
-delete from t1i;
-delete from t2m;
-
-sync_slave_with_master;
-begin;
-insert into t1i values (5);
-
-connection master;
-let $pos0_master= query_get_value(SHOW MASTER STATUS, Position, 1);
-begin;
-insert into t1i values (4);
-update t1i set n = 5 where n = 4; # to block at. not to be played
-commit;
-let $pos1_master= query_get_value(SHOW MASTER STATUS, Position, 1);
-
-
-connection slave1;
-# slave sql can't advance as must be locked by the conn `slave' trans
-let $pos0_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
---disable_query_log
-eval select $pos0_master - $pos0_slave as zero;
---enable_query_log
-
-#
-# the replicated trans is blocked by the slave's local.
-# However, it's not easy to catch the exact moment when it happens.
-# The test issues sleep which makes the test either non-deterministic or
-# wasting too much time.
-#
---sleep 3
-
-send stop slave sql_thread;
-
-connection slave;
-rollback; # release the sql thread
-
-connection slave1;
-reap;
-source include/wait_for_slave_sql_to_stop.inc;
-let $sql_status= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1);
---echo *** sql thread is *not* running: $sql_status ***
-
-let $pos1_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
-
---echo *** the prove: the stopped slave has rolled back the current transaction ***
-
---disable_query_log
-select count(*) as zero from t1i;
-eval select $pos0_master - $pos0_slave as zero;
-eval select $pos1_master > $pos0_slave as one;
---enable_query_log
-
-start slave sql_thread;
-
-# clean-up
-
-connection master;
-drop table t1i, t2m;
-
---source include/rpl_end.inc
=== renamed file 'mysql-test/suite/bugs/r/rpl_bug37426.result' => 'mysql-test/suite/rpl/r/rpl_bug37426.result'
--- a/mysql-test/suite/bugs/r/rpl_bug37426.result 2008-06-30 20:11:18 +0000
+++ b/mysql-test/suite/rpl/r/rpl_bug37426.result 2011-04-13 20:18:08 +0000
@@ -1,13 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-CREATE TABLE char128_utf8 (
-i1 INT NOT NULL,
-c CHAR(128) CHARACTER SET utf8 NOT NULL,
-i2 INT NOT NULL);
+include/master-slave.inc
+[connection master]
+CREATE TABLE char128_utf8 (i1 INT NOT NULL, c CHAR(128) CHARACTER SET utf8 NOT NULL, i2 INT NOT NULL);
INSERT INTO char128_utf8 VALUES ( 1, "123", 1 );
SELECT * FROM char128_utf8;
i1 c i2
@@ -15,3 +8,5 @@ i1 c i2
SELECT * FROM char128_utf8;
i1 c i2
1 123 1
+DROP TABLE char128_utf8;
+include/rpl_end.inc
=== renamed file 'mysql-test/suite/bugs/t/rpl_bug37426.test' => 'mysql-test/suite/rpl/t/rpl_bug37426.test'
--- a/mysql-test/suite/bugs/t/rpl_bug37426.test 2010-12-19 17:07:28 +0000
+++ b/mysql-test/suite/rpl/t/rpl_bug37426.test 2011-04-13 20:18:08 +0000
@@ -7,15 +7,16 @@ source include/master-slave.inc;
source include/have_binlog_format_row.inc;
connection master;
-CREATE TABLE char128_utf8 (
- i1 INT NOT NULL,
- c CHAR(128) CHARACTER SET utf8 NOT NULL,
- i2 INT NOT NULL);
-
+CREATE TABLE char128_utf8 (i1 INT NOT NULL, c CHAR(128) CHARACTER SET utf8 NOT NULL, i2 INT NOT NULL);
INSERT INTO char128_utf8 VALUES ( 1, "123", 1 );
SELECT * FROM char128_utf8;
sync_slave_with_master;
SELECT * FROM char128_utf8;
+
+# Clean up
+connection master;
+DROP TABLE char128_utf8;
+sync_slave_with_master;
--source include/rpl_end.inc
=== modified file 'mysql-test/t/alter_table.test'
--- a/mysql-test/t/alter_table.test 2011-02-21 11:30:08 +0000
+++ b/mysql-test/t/alter_table.test 2011-04-13 06:16:40 +0000
@@ -1159,3 +1159,20 @@ CREATE TABLE db1.t1 (bar TINYTEXT, KEY (
ALTER TABLE db1.t1 ADD baz INT;
DROP DATABASE db1;
+
+
+--echo #
+--echo # Bug#11938039 RE-EXECUTION OF FRM-ONLY ALTER TABLE WITH RENAME
+--echo # CLAUSE FAILS OR ABORTS SERVER.
+--echo #
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int);
+prepare stmt1 from 'alter table t1 alter column a set default 1, rename to t2';
+execute stmt1;
+rename table t2 to t1;
+--echo # The below statement should succeed and not emit error or abort server.
+execute stmt1;
+deallocate prepare stmt1;
+drop table t2;
=== modified file 'mysql-test/t/func_analyse.test'
--- a/mysql-test/t/func_analyse.test 2011-03-14 18:06:44 +0000
+++ b/mysql-test/t/func_analyse.test 2011-04-14 09:10:11 +0000
@@ -1,6 +1,7 @@
#
# Test of procedure analyse
#
+-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1,t2;
@@ -144,4 +145,15 @@ INSERT INTO t1 VALUES ('e'),('e'),('e-')
SELECT * FROM t1 PROCEDURE ANALYSE();
DROP TABLE t1;
+--echo #
+--echo # Bug#11756242 48137: PROCEDURE ANALYSE() LEAKS MEMORY WHEN RETURNING NULL
+--echo #
+
+CREATE TABLE t1(f1 INT) ENGINE=MYISAM;
+CREATE TABLE t2(f2 INT) ENGINE=INNODB;
+INSERT INTO t2 VALUES (1);
+SELECT DISTINCTROW f1 FROM t1 NATURAL RIGHT OUTER JOIN t2 PROCEDURE ANALYSE();
+SELECT * FROM t2 LIMIT 1 PROCEDURE ANALYSE();
+DROP TABLE t1, t2;
+
--echo End of 5.1 tests
=== modified file 'mysql-test/t/func_group.test'
--- a/mysql-test/t/func_group.test 2011-04-02 19:41:10 +0000
+++ b/mysql-test/t/func_group.test 2011-04-12 10:13:15 +0000
@@ -1128,6 +1128,18 @@ SELECT MAX(LENGTH(a)), LENGTH(MAX(a)), M
DROP TABLE t1;
--echo #
+--echo # Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION
+--echo #
+
+CREATE TABLE t1(f1 YEAR(4));
+INSERT INTO t1 VALUES (0000),(2001);
+--enable_metadata
+(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1);
+--disable_metadata
+DROP TABLE t1;
+
+
+--echo #
--echo End of 5.1 tests
###
=== modified file 'mysql-test/t/func_in.test'
--- a/mysql-test/t/func_in.test 2010-06-22 18:53:08 +0000
+++ b/mysql-test/t/func_in.test 2011-04-12 09:51:36 +0000
@@ -555,5 +555,11 @@ SELECT CASE a WHEN a THEN a END FROM t1
DROP TABLE t1;
--echo #
+--echo # Bug #11766212 59270: NOT IN (YEAR( ... ), ... ) PRODUCES MANY VALGRIND WARNINGS
+--echo #
+
+SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1);
+
+--echo #
--echo End of 5.1 tests
=== modified file 'mysql-test/t/loaddata.test'
--- a/mysql-test/t/loaddata.test 2010-07-14 12:05:20 +0000
+++ b/mysql-test/t/loaddata.test 2011-04-15 08:55:21 +0000
@@ -601,5 +601,18 @@ DROP TABLE t1;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
+--echo #
+--echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
+--echo #
+
+CREATE TABLE t1(f1 INT);
+EVAL SELECT 0xE1BB30 INTO OUTFILE 't1.dat';
+--disable_warnings
+LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
+--enable_warnings
+
+DROP TABLE t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/t1.dat;
--echo End of 5.1 tests
=== modified file 'mysql-test/t/mysqlslap.test'
--- a/mysql-test/t/mysqlslap.test 2007-09-27 08:15:15 +0000
+++ b/mysql-test/t/mysqlslap.test 2011-04-08 06:52:44 +0000
@@ -53,3 +53,18 @@ CREATE PROCEDURE p1() SELECT 1;
--exec $MYSQL_SLAP --create-schema=test --delimiter=";" --query="CALL p1; SELECT 1;" --silent 2>&1
DROP PROCEDURE p1;
+
+
+--echo #
+--echo # Bug #11765157 - 58090: mysqlslap drops schema specified in
+--echo # create_schema if auto-generate-sql also set.
+--echo #
+
+--exec $MYSQL_SLAP --silent --create-schema=bug58090 --concurrency=5 --iterations=20 --auto-generate-sql
+--echo # 'bug58090' database should not be present.
+SHOW DATABASES;
+--exec $MYSQL_SLAP --silent --create-schema=bug58090 --no-drop --auto-generate-sql
+--echo # 'bug58090' database should be present.
+SHOW DATABASES;
+DROP DATABASE bug58090;
+
=== modified file 'mysql-test/t/subselect.test'
--- a/mysql-test/t/subselect.test 2011-01-12 12:15:22 +0000
+++ b/mysql-test/t/subselect.test 2011-04-15 06:54:05 +0000
@@ -3997,6 +3997,28 @@ DROP TABLE t1,t1s,t2s;
--echo End of 5.1 tests
--echo #
+--echo # Bug #11765713 58705:
+--echo # OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
+--echo # CREATED BY OPT_SUM_QUERY
+--echo #
+
+CREATE TABLE t1(a INT NOT NULL, KEY (a));
+INSERT INTO t1 VALUES (0), (1);
+
+--error ER_SUBQUERY_NO_1_ROW
+SELECT 1 as foo FROM t1 WHERE a < SOME
+ (SELECT a FROM t1 WHERE a <=>
+ (SELECT a FROM t1)
+ );
+
+SELECT 1 as foo FROM t1 WHERE a < SOME
+ (SELECT a FROM t1 WHERE a <=>
+ (SELECT a FROM t1 where a is null)
+ );
+
+DROP TABLE t1;
+
+--echo #
--echo # Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool):
--echo # Assertion `file' failed.
--echo #
=== modified file 'mysql-test/t/view.test'
--- a/mysql-test/t/view.test 2011-03-08 17:39:25 +0000
+++ b/mysql-test/t/view.test 2011-04-08 08:09:24 +0000
@@ -3979,6 +3979,18 @@ DROP TABLE t1;
CREATE VIEW v1 AS SELECT 1 IN (1 LIKE 2,0) AS f;
DROP VIEW v1;
+--echo #
+--echo # Bug 11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
+--echo #
+
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT s.* FROM t1 s, t1 b HAVING a;
+
+SELECT * FROM v1;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.1 tests.
--echo # -----------------------------------------------------------------
=== modified file 'mysql-test/t/warnings.test'
--- a/mysql-test/t/warnings.test 2009-11-13 10:17:53 +0000
+++ b/mysql-test/t/warnings.test 2011-04-15 12:02:22 +0000
@@ -228,3 +228,43 @@ DROP TABLE t1;
SHOW ERRORS;
--echo End of 5.0 tests
+
+#
+# Bug#55847: SHOW WARNINGS returns empty result set when SQLEXCEPTION is active
+#
+
+--echo
+--echo -- Bug#55847
+--echo
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+CREATE TABLE t1(a INT UNIQUE);
+
+delimiter |;
+
+CREATE FUNCTION f1(x INT) RETURNS INT
+BEGIN
+ INSERT INTO t1 VALUES(x);
+ INSERT INTO t1 VALUES(x);
+ RETURN x;
+END|
+
+delimiter ;|
+
+--echo
+
+--error ER_DUP_ENTRY
+SHOW TABLES WHERE f1(11) = 11;
+
+--echo
+
+SHOW WARNINGS;
+
+--echo
+
+DROP TABLE t1;
+DROP FUNCTION f1;
=== modified file 'mysql-test/t/xa.test'
--- a/mysql-test/t/xa.test 2011-02-14 13:16:31 +0000
+++ b/mysql-test/t/xa.test 2011-04-14 08:13:28 +0000
@@ -3,6 +3,8 @@
#
-- source include/have_innodb.inc
+--source include/not_embedded.inc
+
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
@@ -287,6 +289,98 @@ DROP TABLE t1;
disconnect con1;
+--echo #
+--echo # Bug#11766752 59936: multiple xa assertions - transactional
+--echo # statement fuzzer
+--echo #
+
+CREATE TABLE t1 (a INT) engine=InnoDB;
+XA START 'a';
+INSERT INTO t1 VALUES (1);
+
+--error ER_XAER_RMFAIL
+SAVEPOINT savep;
+
+XA END 'a';
+--error ER_XAER_RMFAIL
+SELECT * FROM t1;
+--error ER_XAER_RMFAIL
+INSERT INTO t1 VALUES (2);
+--error ER_XAER_RMFAIL
+SAVEPOINT savep;
+--error ER_XAER_RMFAIL
+SET @a=(SELECT * FROM t1);
+
+XA PREPARE 'a';
+--error ER_XAER_RMFAIL
+SELECT * FROM t1; # used to cause InnoDB assert
+--error ER_XAER_RMFAIL
+INSERT INTO t1 VALUES (2); # used to cause InnoDB assert
+--error ER_XAER_RMFAIL
+SAVEPOINT savep;
+--error ER_XAER_RMFAIL
+SET @a=(SELECT * FROM t1); # used to cause InnoDB assert
+--error ER_XAER_RMFAIL
+UPDATE t1 SET a=1 WHERE a=2;
+
+XA COMMIT 'a';
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#12352846 - TRANS_XA_START(THD*):
+--echo # ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL()
+--echo # FAILED
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+
+--echo # Connection con2
+--connect (con2,localhost,root)
+XA START 'xid1';
+--echo # Sending:
+--send INSERT INTO t2 SELECT a FROM t1
+
+--echo # Connection default
+--connection default
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE state = "Sending data"
+ AND info = "INSERT INTO t2 SELECT a FROM t1";
+--echo # Waiting until INSERT ... is blocked
+--source include/wait_condition.inc
+DELETE FROM t1;
+COMMIT;
+
+--echo # Connection con2
+--connection con2
+--echo # Reaping: INSERT INTO t2 SELECT a FROM t1
+--error ER_LOCK_DEADLOCK
+--reap
+--error ER_XA_RBDEADLOCK
+XA COMMIT 'xid1';
+# This caused the assert to be triggered
+XA START 'xid1';
+
+XA END 'xid1';
+XA PREPARE 'xid1';
+XA ROLLBACK 'xid1';
+
+--echo # Connection default
+connection default;
+DROP TABLE t1, t2;
+disconnect con2;
+
+
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c 2011-03-01 13:36:47 +0000
+++ b/mysys/my_init.c 2011-04-13 19:05:26 +0000
@@ -467,10 +467,6 @@ PSI_mutex_key key_my_file_info_mutex;
PSI_mutex_key key_LOCK_localtime_r;
#endif /* !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) */
-#ifndef HAVE_GETHOSTBYNAME_R
-PSI_mutex_key key_LOCK_gethostbyname_r;
-#endif /* HAVE_GETHOSTBYNAME_R */
-
PSI_mutex_key key_BITMAP_mutex, key_IO_CACHE_append_buffer_lock,
key_IO_CACHE_SHARE_mutex, key_KEY_CACHE_cache_lock, key_LOCK_alarm,
key_my_thread_var_mutex, key_THR_LOCK_charset, key_THR_LOCK_heap,
@@ -487,9 +483,6 @@ static PSI_mutex_info all_mysys_mutexes[
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
{ &key_LOCK_localtime_r, "LOCK_localtime_r", PSI_FLAG_GLOBAL},
#endif /* !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) */
-#ifndef HAVE_GETHOSTBYNAME_R
- { &key_LOCK_gethostbyname_r, "LOCK_gethostbyname_r", PSI_FLAG_GLOBAL},
-#endif /* HAVE_GETHOSTBYNAME_R */
{ &key_BITMAP_mutex, "BITMAP::mutex", 0},
{ &key_IO_CACHE_append_buffer_lock, "IO_CACHE::append_buffer_lock", 0},
{ &key_IO_CACHE_SHARE_mutex, "IO_CACHE::SHARE_mutex", 0},
=== modified file 'mysys/my_thr_init.c'
--- a/mysys/my_thr_init.c 2011-03-01 13:36:47 +0000
+++ b/mysys/my_thr_init.c 2011-04-13 19:05:26 +0000
@@ -34,9 +34,6 @@ uint my_thread_end_wait_time= 5;
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
mysql_mutex_t LOCK_localtime_r;
#endif
-#ifndef HAVE_GETHOSTBYNAME_R
-mysql_mutex_t LOCK_gethostbyname_r;
-#endif
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
pthread_mutexattr_t my_fast_mutexattr;
#endif
@@ -222,10 +219,6 @@ my_bool my_thread_global_init(void)
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
mysql_mutex_init(key_LOCK_localtime_r, &LOCK_localtime_r, MY_MUTEX_INIT_SLOW);
#endif
-#ifndef HAVE_GETHOSTBYNAME_R
- mysql_mutex_init(key_LOCK_gethostbyname_r,
- &LOCK_gethostbyname_r, MY_MUTEX_INIT_SLOW);
-#endif
#ifdef _MSC_VER
install_sigabrt_handler();
@@ -289,9 +282,6 @@ void my_thread_global_end(void)
#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
mysql_mutex_destroy(&LOCK_localtime_r);
#endif
-#ifndef HAVE_GETHOSTBYNAME_R
- mysql_mutex_destroy(&LOCK_gethostbyname_r);
-#endif
my_thread_global_init_done= 0;
}
=== modified file 'mysys/mysys_priv.h'
--- a/mysys/mysys_priv.h 2011-01-12 20:36:39 +0000
+++ b/mysys/mysys_priv.h 2011-04-13 19:05:26 +0000
@@ -36,10 +36,6 @@ extern PSI_mutex_key key_my_file_info_mu
extern PSI_mutex_key key_LOCK_localtime_r;
#endif /* !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) */
-#ifndef HAVE_GETHOSTBYNAME_R
-extern PSI_mutex_key key_LOCK_gethostbyname_r;
-#endif /* HAVE_GETHOSTBYNAME_R */
-
extern PSI_mutex_key key_BITMAP_mutex, key_IO_CACHE_append_buffer_lock,
key_IO_CACHE_SHARE_mutex, key_KEY_CACHE_cache_lock, key_LOCK_alarm,
key_my_thread_var_mutex, key_THR_LOCK_charset, key_THR_LOCK_heap,
=== modified file 'sql/field.cc'
--- a/sql/field.cc 2011-02-08 15:47:33 +0000
+++ b/sql/field.cc 2011-04-12 10:13:15 +0000
@@ -5382,6 +5382,7 @@ double Field_year::val_real(void)
longlong Field_year::val_int(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
+ DBUG_ASSERT(field_length == 2 || field_length == 4);
int tmp= (int) ptr[0];
if (field_length != 4)
tmp%=100; // Return last 2 char
@@ -5394,6 +5395,7 @@ longlong Field_year::val_int(void)
String *Field_year::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
+ DBUG_ASSERT(field_length < 5);
val_buffer->alloc(5);
val_buffer->length(field_length);
char *to=(char*) val_buffer->ptr();
=== modified file 'sql/hostname.cc'
--- a/sql/hostname.cc 2010-07-23 20:17:55 +0000
+++ b/sql/hostname.cc 2011-04-08 10:23:36 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -366,41 +366,35 @@ bool ip_to_hostname(struct sockaddr_stor
err_code= vio_getnameinfo(ip, hostname_buffer, NI_MAXHOST, NULL, 0,
NI_NAMEREQD);
- if (err_code == EAI_NONAME)
+ if (err_code)
{
- /*
- There is no reverse address mapping for the IP address. A host name
- can not be resolved.
- */
+ // NOTE: gai_strerror() returns a string ending by a dot.
- DBUG_PRINT("error", ("IP address '%s' could not be resolved: "
- "no reverse address mapping.",
- (const char *) ip_key));
+ DBUG_PRINT("error", ("IP address '%s' could not be resolved: %s",
+ (const char *) ip_key,
+ (const char *) gai_strerror(err_code)));
- sql_print_warning("IP address '%s' could not be resolved: "
- "no reverse address mapping.",
- (const char *) ip_key);
+ sql_print_warning("IP address '%s' could not be resolved: %s",
+ (const char *) ip_key,
+ (const char *) gai_strerror(err_code));
- err_status= add_hostname(ip_key, NULL);
+ if (vio_is_no_name_error(err_code))
+ {
+ /*
+ The no-name error means that there is no reverse address mapping
+ for the IP address. A host name can not be resolved.
+
+ If it is not the no-name error, we should not cache the hostname
+ (or rather its absence), because the failure might be transient.
+ */
- *hostname= NULL;
- *connect_errors= 0; /* New IP added to the cache. */
+ add_hostname(ip_key, NULL);
- DBUG_RETURN(err_status);
- }
- else if (err_code)
- {
- DBUG_PRINT("error", ("IP address '%s' could not be resolved: "
- "getnameinfo() returned %d.",
- (const char *) ip_key,
- (int) err_code));
-
- sql_print_warning("IP address '%s' could not be resolved: "
- "getnameinfo() returned error (code: %d).",
- (const char *) ip_key,
- (int) err_code);
+ *hostname= NULL;
+ *connect_errors= 0; /* New IP added to the cache. */
+ }
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(FALSE);
}
DBUG_PRINT("info", ("IP '%s' resolved to '%s'.",
=== modified file 'sql/item.cc'
--- a/sql/item.cc 2011-04-02 19:41:10 +0000
+++ b/sql/item.cc 2011-04-08 13:15:23 +0000
@@ -1746,7 +1746,8 @@ bool agg_item_collations(DTCollation &c,
}
/* If all arguments where numbers, reset to @@collation_connection */
- if (c.derivation == DERIVATION_NUMERIC)
+ if (flags & MY_COLL_ALLOW_NUMERIC_CONV &&
+ c.derivation == DERIVATION_NUMERIC)
c.set(Item::default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_NUMERIC);
return FALSE;
@@ -6479,7 +6480,7 @@ void Item_ref::print(String *str, enum_q
{
THD *thd= current_thd;
append_identifier(thd, str, (*ref)->real_item()->name,
- (*ref)->real_item()->name_length);
+ strlen((*ref)->real_item()->name));
}
else
(*ref)->print(str, query_type);
=== modified file 'sql/item.h'
--- a/sql/item.h 2011-03-16 14:11:20 +0000
+++ b/sql/item.h 2011-04-08 13:15:23 +0000
@@ -53,6 +53,8 @@ char_to_byte_length_safe(uint32 char_len
(i.e. constant).
MY_COLL_ALLOW_CONV - allow any kind of conversion
(combination of the above two)
+ MY_COLL_ALLOW_NUMERIC_CONV - if all items were numbers, convert to
+ @@character_set_connection
MY_COLL_DISALLOW_NONE - don't allow return DERIVATION_NONE
(e.g. when aggregating for comparison)
MY_COLL_CMP_CONV - combination of MY_COLL_ALLOW_CONV
@@ -62,6 +64,7 @@ char_to_byte_length_safe(uint32 char_len
#define MY_COLL_ALLOW_SUPERSET_CONV 1
#define MY_COLL_ALLOW_COERCIBLE_CONV 2
#define MY_COLL_DISALLOW_NONE 4
+#define MY_COLL_ALLOW_NUMERIC_CONV 8
#define MY_COLL_ALLOW_CONV (MY_COLL_ALLOW_SUPERSET_CONV | MY_COLL_ALLOW_COERCIBLE_CONV)
#define MY_COLL_CMP_CONV (MY_COLL_ALLOW_CONV | MY_COLL_DISALLOW_NONE)
@@ -548,6 +551,10 @@ public:
*/
Item *next;
uint32 max_length; /* Maximum length, in bytes */
+ /*
+ TODO: convert name and name_length fields into String to keep them in sync
+ (see bug #11829681/60295 etc).
+ */
uint name_length; /* Length of name */
int8 marker;
uint8 decimals;
@@ -1557,7 +1564,8 @@ agg_item_charsets_for_string_result(DTCo
int item_sep= 1)
{
uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
- MY_COLL_ALLOW_COERCIBLE_CONV;
+ MY_COLL_ALLOW_COERCIBLE_CONV |
+ MY_COLL_ALLOW_NUMERIC_CONV;
return agg_item_charsets(c, name, items, nitems, flags, item_sep);
}
inline bool
@@ -1570,6 +1578,19 @@ agg_item_charsets_for_comparison(DTColla
MY_COLL_DISALLOW_NONE;
return agg_item_charsets(c, name, items, nitems, flags, item_sep);
}
+inline bool
+agg_item_charsets_for_string_result_with_comparison(DTCollation &c,
+ const char *name,
+ Item **items, uint nitems,
+ int item_sep= 1)
+{
+ uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
+ MY_COLL_ALLOW_COERCIBLE_CONV |
+ MY_COLL_ALLOW_NUMERIC_CONV |
+ MY_COLL_DISALLOW_NONE;
+ return agg_item_charsets(c, name, items, nitems, flags, item_sep);
+}
+
class Item_num: public Item_basic_constant
{
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc 2011-03-16 14:11:20 +0000
+++ b/sql/item_cmpfunc.cc 2011-04-12 10:13:15 +0000
@@ -4069,13 +4069,11 @@ void Item_func_in::fix_length_and_dec()
uint j=0;
for (uint i=1 ; i < arg_count ; i++)
{
- if (!args[i]->null_value) // Skip NULL values
- {
- array->set(j,args[i]);
- j++;
- }
- else
- have_null= 1;
+ array->set(j,args[i]);
+ if (!args[i]->null_value) // Skip NULL values
+ j++;
+ else
+ have_null= 1;
}
if ((array->used_count= j))
array->sort();
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2011-03-28 13:33:35 +0000
+++ b/sql/item_func.cc 2011-04-08 13:15:23 +0000
@@ -2537,7 +2537,8 @@ void Item_func_min_max::fix_length_and_d
}
if (cmp_type == STRING_RESULT)
{
- agg_arg_charsets_for_comparison(collation, args, arg_count);
+ agg_arg_charsets_for_string_result_with_comparison(collation,
+ args, arg_count);
if (datetime_found)
{
thd= current_thd;
=== modified file 'sql/item_func.h'
--- a/sql/item_func.h 2011-03-08 17:39:25 +0000
+++ b/sql/item_func.h 2011-04-08 13:15:23 +0000
@@ -165,6 +165,11 @@ public:
{
return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
}
+ /*
+ Aggregate arguments for string result, e.g: CONCAT(a,b)
+ - convert to @@character_set_connection if all arguments are numbers
+ - allow DERIVATION_NONE
+ */
bool agg_arg_charsets_for_string_result(DTCollation &c,
Item **items, uint nitems,
int item_sep= 1)
@@ -172,6 +177,11 @@ public:
return agg_item_charsets_for_string_result(c, func_name(),
items, nitems, item_sep);
}
+ /*
+ Aggregate arguments for comparison, e.g: a=b, a LIKE b, a RLIKE b
+ - don't convert to @@character_set_connection if all arguments are numbers
+ - don't allow DERIVATION_NONE
+ */
bool agg_arg_charsets_for_comparison(DTCollation &c,
Item **items, uint nitems,
int item_sep= 1)
@@ -179,6 +189,21 @@ public:
return agg_item_charsets_for_comparison(c, func_name(),
items, nitems, item_sep);
}
+ /*
+ Aggregate arguments for string result, when some comparison
+ is involved internally, e.g: REPLACE(a,b,c)
+ - convert to @@character_set_connection if all arguments are numbers
+ - disallow DERIVATION_NONE
+ */
+ bool agg_arg_charsets_for_string_result_with_comparison(DTCollation &c,
+ Item **items,
+ uint nitems,
+ int item_sep= 1)
+ {
+ return agg_item_charsets_for_string_result_with_comparison(c, func_name(),
+ items, nitems,
+ item_sep);
+ }
bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
Item *transform(Item_transformer transformer, uchar *arg);
Item* compile(Item_analyzer analyzer, uchar **arg_p,
=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc 2011-03-03 15:46:30 +0000
+++ b/sql/item_strfunc.cc 2011-04-08 13:15:23 +0000
@@ -1168,7 +1168,7 @@ void Item_func_replace::fix_length_and_d
char_length+= max_substrs * (uint) diff;
}
- if (agg_arg_charsets_for_comparison(collation, args, 3))
+ if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 3))
return;
fix_char_length_ulonglong(char_length);
}
@@ -1458,7 +1458,7 @@ void Item_func_substr::fix_length_and_de
void Item_func_substr_index::fix_length_and_dec()
{
- if (agg_arg_charsets_for_comparison(collation, args, 2))
+ if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 2))
return;
fix_char_length(args[0]->max_char_length());
}
@@ -1797,7 +1797,8 @@ void Item_func_trim::fix_length_and_dec(
{
// Handle character set for args[1] and args[0].
// Note that we pass args[1] as the first item, and args[0] as the second.
- if (agg_arg_charsets_for_comparison(collation, &args[1], 2, -1))
+ if (agg_arg_charsets_for_string_result_with_comparison(collation,
+ &args[1], 2, -1))
return;
}
fix_char_length(args[0]->max_char_length());
=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc 2011-03-16 14:11:20 +0000
+++ b/sql/item_sum.cc 2011-04-12 10:13:15 +0000
@@ -1145,17 +1145,13 @@ Item_sum_hybrid::fix_fields(THD *thd, It
switch (hybrid_type= item->result_type()) {
case INT_RESULT:
- max_length= 20;
- break;
case DECIMAL_RESULT:
+ case STRING_RESULT:
max_length= item->max_length;
break;
case REAL_RESULT:
max_length= float_length(decimals);
break;
- case STRING_RESULT:
- max_length= item->max_length;
- break;
case ROW_RESULT:
default:
DBUG_ASSERT(0);
=== modified file 'sql/mdl.h'
--- a/sql/mdl.h 2010-11-22 10:50:20 +0000
+++ b/sql/mdl.h 2011-04-11 11:39:15 +0000
@@ -286,21 +286,6 @@ private:
};
-
-/**
- Hook class which via its methods specifies which members
- of T should be used for participating in MDL lists.
-*/
-
-template <typename T, T* T::*next, T** T::*prev>
-struct I_P_List_adapter
-{
- static inline T **next_ptr(T *el) { return &(el->*next); }
-
- static inline T ***prev_ptr(T *el) { return &(el->*prev); }
-};
-
-
/**
A pending metadata lock request.
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2011-03-25 12:55:22 +0000
+++ b/sql/mysqld.cc 2011-04-13 19:05:26 +0000
@@ -245,11 +245,7 @@ inline void setup_fpu()
#define MYSQL_KILL_SIGNAL SIGTERM
-#ifdef HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R
-#include <sys/types.h>
-#else
#include <my_pthread.h> // For thr_setconcurency()
-#endif
#ifdef SOLARIS
extern "C" int gethostname(char *name, int namelen);
=== modified file 'sql/opt_sum.cc'
--- a/sql/opt_sum.cc 2010-12-08 12:28:06 +0000
+++ b/sql/opt_sum.cc 2011-04-15 06:54:05 +0000
@@ -212,6 +212,7 @@ static int get_index_max_value(TABLE *ta
/**
Substitutes constants for some COUNT(), MIN() and MAX() functions.
+ @param thd thread handler
@param tables list of leaves of join table tree
@param all_fields All fields to be returned
@param conds WHERE clause
@@ -229,9 +230,12 @@ static int get_index_max_value(TABLE *ta
HA_ERR_KEY_NOT_FOUND on impossible conditions
@retval
HA_ERR_... if a deadlock or a lock wait timeout happens, for example
+ @retval
+ ER_... e.g. ER_SUBQUERY_NO_1_ROW
*/
-int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
+int opt_sum_query(THD *thd,
+ TABLE_LIST *tables, List<Item> &all_fields, COND *conds)
{
List_iterator_fast<Item> it(all_fields);
int const_result= 1;
@@ -243,6 +247,8 @@ int opt_sum_query(TABLE_LIST *tables, Li
Item *item;
int error;
+ DBUG_ENTER("opt_sum_query");
+
if (conds)
where_tables= conds->used_tables();
@@ -270,7 +276,7 @@ int opt_sum_query(TABLE_LIST *tables, Li
WHERE t2.field IS NULL;
*/
if (tl->table->map & where_tables)
- return 0;
+ DBUG_RETURN(0);
}
else
used_tables|= tl->table->map;
@@ -297,7 +303,7 @@ int opt_sum_query(TABLE_LIST *tables, Li
if(error)
{
tl->table->file->print_error(error, MYF(ME_FATALERROR));
- return error;
+ DBUG_RETURN(error);
}
count*= tl->table->file->stats.records;
}
@@ -390,10 +396,10 @@ int opt_sum_query(TABLE_LIST *tables, Li
if (error)
{
if (error == HA_ERR_KEY_NOT_FOUND || error == HA_ERR_END_OF_FILE)
- return HA_ERR_KEY_NOT_FOUND; // No rows matching WHERE
+ DBUG_RETURN(HA_ERR_KEY_NOT_FOUND); // No rows matching WHERE
/* HA_ERR_LOCK_DEADLOCK or some other error */
table->file->print_error(error, MYF(0));
- return(error);
+ DBUG_RETURN(error);
}
removed_tables|= table->map;
}
@@ -442,6 +448,10 @@ int opt_sum_query(TABLE_LIST *tables, Li
const_result= 0;
}
}
+
+ if (thd->is_error())
+ DBUG_RETURN(thd->stmt_da->sql_errno());
+
/*
If we have a where clause, we can only ignore searching in the
tables if MIN/MAX optimisation replaced all used tables
@@ -451,7 +461,7 @@ int opt_sum_query(TABLE_LIST *tables, Li
*/
if (removed_tables && used_tables != removed_tables)
const_result= 0; // We didn't remove all tables
- return const_result;
+ DBUG_RETURN(const_result);
}
@@ -737,6 +747,12 @@ static bool matching_cond(bool max_fl, T
if (is_null || (is_null_safe_eq && args[1]->is_null()))
{
+ /*
+ If we have a non-nullable index, we cannot use it,
+ since set_null will be ignored, and we will compare uninitialized data.
+ */
+ if (!part->field->real_maybe_null())
+ DBUG_RETURN(false);
part->field->set_null();
*key_ptr= (uchar) 1;
}
@@ -807,8 +823,9 @@ static bool matching_cond(bool max_fl, T
@param[out] prefix_len Length of prefix for the search range
@note
- This function may set table->key_read to 1, which must be reset after
- index is used! (This can only happen when function returns 1)
+ This function may set field->table->key_read to true,
+ which must be reset after index is used!
+ (This can only happen when function returns 1)
@retval
0 Index can not be used to optimize MIN(field)/MAX(field)
@@ -823,7 +840,9 @@ static bool find_key_for_maxmin(bool max
uint *range_fl, uint *prefix_len)
{
if (!(field->flags & PART_KEY_FLAG))
- return 0; // Not key field
+ return false; // Not key field
+
+ DBUG_ENTER("find_key_for_maxmin");
TABLE *table= field->table;
uint idx= 0;
@@ -848,7 +867,7 @@ static bool find_key_for_maxmin(bool max
part++, jdx++, key_part_to_use= (key_part_to_use << 1) | 1)
{
if (!(table->file->index_flags(idx, jdx, 0) & HA_READ_ORDER))
- return 0;
+ DBUG_RETURN(false);
/* Check whether the index component is partial */
Field *part_field= table->field[part->fieldnr-1];
@@ -897,12 +916,12 @@ static bool find_key_for_maxmin(bool max
*/
if (field->part_of_key.is_set(idx))
table->set_keyread(TRUE);
- return 1;
+ DBUG_RETURN(true);
}
}
}
}
- return 0;
+ DBUG_RETURN(false);
}
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2011-02-16 16:27:35 +0000
+++ b/sql/sp_head.cc 2011-04-15 12:02:22 +0000
@@ -1,4 +1,4 @@
-/* Copyright 2002-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
+/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
@@ -1217,7 +1217,8 @@ sp_head::execute(THD *thd, bool merge_da
String old_packet;
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
Object_creation_ctx *saved_creation_ctx;
- Warning_info *saved_warning_info, warning_info(thd->warning_info->warn_id());
+ Warning_info *saved_warning_info;
+ Warning_info warning_info(thd->warning_info->warn_id(), false);
/*
Just reporting a stack overrun error
=== modified file 'sql/sql_admin.cc'
--- a/sql/sql_admin.cc 2011-03-08 08:41:57 +0000
+++ b/sql/sql_admin.cc 2011-04-15 12:02:22 +0000
@@ -263,7 +263,7 @@ static bool mysql_admin_table(THD* thd,
const char *operator_name,
thr_lock_type lock_type,
bool open_for_modify,
- bool no_warnings_for_error,
+ bool repair_table_use_frm,
uint extra_open_options,
int (*prepare_func)(THD *, TABLE_LIST *,
HA_CHECK_OPT *),
@@ -331,18 +331,43 @@ static bool mysql_admin_table(THD* thd,
lex->query_tables= table;
lex->query_tables_last= &table->next_global;
lex->query_tables_own_last= 0;
- /*
- Under locked tables, we know that the table can be opened,
- so any errors opening the table are logical errors.
- In these cases it makes sense to report them.
- */
- if (!thd->locked_tables_mode)
- thd->no_warnings_for_error= no_warnings_for_error;
+
if (view_operator_func == NULL)
table->required_type=FRMTYPE_TABLE;
- open_error= open_and_lock_tables(thd, table, TRUE, 0);
- thd->no_warnings_for_error= 0;
+ if (!thd->locked_tables_mode && repair_table_use_frm)
+ {
+ /*
+ If we're not under LOCK TABLES and we're executing REPAIR TABLE
+ USE_FRM, we need to ignore errors from open_and_lock_tables().
+ REPAIR TABLE USE_FRM is a heavy weapon used when a table is
+ critically damaged, so open_and_lock_tables() will most likely
+ report errors. Those errors are not interesting for the user
+ because it's already known that the table is badly damaged.
+ */
+
+ Warning_info wi(thd->query_id, false);
+ Warning_info *wi_saved= thd->warning_info;
+
+ thd->warning_info= &wi;
+
+ open_error= open_and_lock_tables(thd, table, TRUE, 0);
+
+ thd->warning_info= wi_saved;
+ }
+ else
+ {
+ /*
+ It's assumed that even if it is REPAIR TABLE USE_FRM, the table
+ can be opened if we're under LOCK TABLES (otherwise LOCK TABLES
+ would fail). Thus, the only errors we could have from
+ open_and_lock_tables() are logical ones, like incorrect locking
+ mode. It does make sense for the user to see such errors.
+ */
+
+ open_error= open_and_lock_tables(thd, table, TRUE, 0);
+ }
+
table->next_global= save_next_global;
table->next_local= save_next_local;
thd->open_options&= ~extra_open_options;
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2011-03-29 08:38:26 +0000
+++ b/sql/sql_base.cc 2011-04-12 10:57:02 +0000
@@ -4724,6 +4724,14 @@ bool open_tables(THD *thd, TABLE_LIST **
bool has_prelocking_list;
DBUG_ENTER("open_tables");
+ /* Accessing data in XA_IDLE or XA_PREPARED is not allowed. */
+ enum xa_states xa_state= thd->transaction.xid_state.xa_state;
+ if (*start && (xa_state == XA_IDLE || xa_state == XA_PREPARED))
+ {
+ my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]);
+ DBUG_RETURN(true);
+ }
+
/*
temporary mem_root for new .frm parsing.
TODO: variables for size
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2011-01-27 13:25:27 +0000
+++ b/sql/sql_class.cc 2011-04-15 12:02:22 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,8 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
**
@@ -522,7 +521,7 @@ THD::THD()
#if defined(ENABLED_DEBUG_SYNC)
debug_sync_control(0),
#endif /* defined(ENABLED_DEBUG_SYNC) */
- main_warning_info(0)
+ main_warning_info(0, false)
{
ulong tmp;
@@ -581,7 +580,7 @@ THD::THD()
client_capabilities= 0; // minimalistic client
ull=0;
system_thread= NON_SYSTEM_THREAD;
- cleanup_done= abort_on_warning= no_warnings_for_error= 0;
+ cleanup_done= abort_on_warning= 0;
peer_port= 0; // For SHOW PROCESSLIST
transaction.m_pending_rows_event= 0;
transaction.on= 1;
@@ -854,10 +853,6 @@ MYSQL_ERROR* THD::raise_condition(uint s
query_cache_abort(&query_cache_tls);
- /* FIXME: broken special case */
- if (no_warnings_for_error && (level == MYSQL_ERROR::WARN_LEVEL_ERROR))
- DBUG_RETURN(NULL);
-
/* When simulating OOM, skip writing to error log to avoid mtr errors */
DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_RETURN(NULL););
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2011-03-08 17:39:25 +0000
+++ b/sql/sql_class.h 2011-04-15 12:02:22 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -2089,7 +2089,6 @@ public:
bool enable_slow_log; /* enable slow log for current statement */
bool abort_on_warning;
bool got_warning; /* Set on call to push_warning() */
- bool no_warnings_for_error; /* no warnings on call to my_error() */
/* set during loop of derived table processing */
bool derived_tables_processing;
my_bool tablespace_op; /* This is TRUE in DISCARD/IMPORT TABLESPACE */
@@ -2807,6 +2806,7 @@ private:
/** The current internal error handler for this thread, or NULL. */
Internal_error_handler *m_internal_handler;
+
/**
The lex to hold the parsed tree of conventional (non-prepared) queries.
Whereas for prepared and stored procedure statements we use an own lex
=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc 2010-11-12 14:20:12 +0000
+++ b/sql/sql_error.cc 2011-04-15 12:02:22 +0000
@@ -1,5 +1,4 @@
-/* Copyright (C) 1995-2002 MySQL AB,
- Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -458,10 +457,11 @@ Diagnostics_area::disable_status()
m_status= DA_DISABLED;
}
-Warning_info::Warning_info(ulonglong warn_id_arg)
+Warning_info::Warning_info(ulonglong warn_id_arg, bool allow_unlimited_warnings)
:m_statement_warn_count(0),
m_current_row_for_warning(1),
m_warn_id(warn_id_arg),
+ m_allow_unlimited_warnings(allow_unlimited_warnings),
m_read_only(FALSE)
{
/* Initialize sub structures */
@@ -543,7 +543,8 @@ MYSQL_ERROR *Warning_info::push_warning(
if (! m_read_only)
{
- if (m_warn_list.elements < thd->variables.max_error_count)
+ if (m_allow_unlimited_warnings ||
+ m_warn_list.elements < thd->variables.max_error_count)
{
cond= new (& m_warn_root) MYSQL_ERROR(& m_warn_root);
if (cond)
@@ -559,6 +560,20 @@ MYSQL_ERROR *Warning_info::push_warning(
return cond;
}
+MYSQL_ERROR *Warning_info::push_warning(THD *thd, const MYSQL_ERROR *sql_condition)
+{
+ MYSQL_ERROR *new_condition= push_warning(thd,
+ sql_condition->get_sql_errno(),
+ sql_condition->get_sqlstate(),
+ sql_condition->get_level(),
+ sql_condition->get_message_text());
+
+ if (new_condition)
+ new_condition->copy_opt_attributes(sql_condition);
+
+ return new_condition;
+}
+
/*
Push the warning to error list if there is still room in the list
=== modified file 'sql/sql_error.h'
--- a/sql/sql_error.h 2010-11-12 12:56:21 +0000
+++ b/sql/sql_error.h 2011-04-15 12:02:22 +0000
@@ -1,5 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB,
- Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef SQL_ERROR_H
#define SQL_ERROR_H
@@ -323,10 +322,13 @@ class Warning_info
{
/** A memory root to allocate warnings and errors */
MEM_ROOT m_warn_root;
+
/** List of warnings of all severities (levels). */
List <MYSQL_ERROR> m_warn_list;
+
/** A break down of the number of warnings per severity (level). */
uint m_warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
+
/**
The number of warnings of the current statement. Warning_info
life cycle differs from statement life cycle -- it may span
@@ -334,20 +336,25 @@ class Warning_info
m_statement_warn_count 0, whereas m_warn_list is not empty.
*/
uint m_statement_warn_count;
+
/*
Row counter, to print in errors and warnings. Not increased in
create_sort_index(); may differ from examined_row_count.
*/
ulong m_current_row_for_warning;
- /** Used to optionally clear warnings only once per statement. */
+
+ /** Used to optionally clear warnings only once per statement. */
ulonglong m_warn_id;
+ /** Indicates if push_warning() allows unlimited number of warnings. */
+ bool m_allow_unlimited_warnings;
+
private:
Warning_info(const Warning_info &rhs); /* Not implemented */
Warning_info& operator=(const Warning_info &rhs); /* Not implemented */
public:
- Warning_info(ulonglong warn_id_arg);
+ Warning_info(ulonglong warn_id_arg, bool allow_unlimited_warnings);
~Warning_info();
/**
@@ -384,19 +391,13 @@ public:
void append_warnings(THD *thd, List<MYSQL_ERROR> *src)
{
MYSQL_ERROR *err;
- MYSQL_ERROR *copy;
List_iterator_fast<MYSQL_ERROR> it(*src);
/*
Don't use ::push_warning() to avoid invocation of condition
handlers or escalation of warnings to errors.
*/
while ((err= it++))
- {
- copy= Warning_info::push_warning(thd, err->get_sql_errno(), err->get_sqlstate(),
- err->get_level(), err->get_message_text());
- if (copy)
- copy->copy_opt_attributes(err);
- }
+ Warning_info::push_warning(thd, err);
}
/**
@@ -462,6 +463,9 @@ public:
MYSQL_ERROR::enum_warning_level level,
const char* msg);
+ /** Add a new condition to the current list. */
+ MYSQL_ERROR *push_warning(THD *thd, const MYSQL_ERROR *sql_condition);
+
/**
Set the read only status for this statement area.
This is a privileged operation, reserved for the implementation of
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc 2011-02-10 10:50:53 +0000
+++ b/sql/sql_load.cc 2011-04-15 08:55:21 +0000
@@ -1337,7 +1337,7 @@ READ_INFO::READ_INFO(File file_par, uint
/* Set of a stack for unget if long terminators */
- uint length=max(field_term_length,line_term_length)+1;
+ uint length= max(cs->mbmaxlen, max(field_term_length, line_term_length)) + 1;
set_if_bigger(length,line_start.length());
stack=stack_pos=(int*) sql_alloc(sizeof(int)*length);
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2011-03-08 17:39:25 +0000
+++ b/sql/sql_parse.cc 2011-04-15 12:02:22 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -7223,10 +7223,20 @@ bool parse_sql(THD *thd,
bool mysql_parse_status= MYSQLparse(thd) != 0;
- /* Check that if MYSQLparse() failed, thd->is_error() is set. */
+ /*
+ Check that if MYSQLparse() failed either thd->is_error() is set, or an
+ internal error handler is set.
+
+ The assert will not catch a situation where parsing fails without an
+ error reported if an error handler exists. The problem is that the
+ error handler might have intercepted the error, so thd->is_error() is
+ not set. However, there is no way to be 100% sure here (the error
+ handler might be for other errors than parsing one).
+ */
DBUG_ASSERT(!mysql_parse_status ||
- (mysql_parse_status && thd->is_error()));
+ (mysql_parse_status && thd->is_error()) ||
+ (mysql_parse_status && thd->get_internal_handler()));
/* Reset parser state. */
=== modified file 'sql/sql_plist.h'
--- a/sql/sql_plist.h 2010-06-07 13:40:52 +0000
+++ b/sql/sql_plist.h 2011-04-13 11:23:10 +0000
@@ -95,6 +95,7 @@ public:
*last= a;
*B::prev_ptr(a)= last;
I::set_last(B::next_ptr(a));
+ C::inc();
}
inline void insert_after(T *pos, T *a)
{
@@ -112,6 +113,7 @@ public:
}
else
I::set_last(B::next_ptr(a));
+ C::inc();
}
}
inline void remove(T *a)
@@ -187,6 +189,20 @@ public:
};
+/**
+ Hook class which via its methods specifies which members
+ of T should be used for participating in a intrusive list.
+*/
+
+template <typename T, T* T::*next, T** T::*prev>
+struct I_P_List_adapter
+{
+ static inline T **next_ptr(T *el) { return &(el->*next); }
+
+ static inline T ***prev_ptr(T *el) { return &(el->*prev); }
+};
+
+
/**
Element counting policy class for I_P_List to be used in
cases when no element counting should be done.
=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc 2011-03-15 12:57:36 +0000
+++ b/sql/sql_prepare.cc 2011-04-15 12:02:22 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -2842,7 +2842,8 @@ void mysql_stmt_get_longdata(THD *thd, c
param= stmt->param_array[param_number];
Diagnostics_area new_stmt_da, *save_stmt_da= thd->stmt_da;
- Warning_info new_warnning_info(thd->query_id), *save_warinig_info= thd->warning_info;
+ Warning_info new_warnning_info(thd->query_id, false);
+ Warning_info *save_warinig_info= thd->warning_info;
thd->stmt_da= &new_stmt_da;
thd->warning_info= &new_warnning_info;
@@ -3900,7 +3901,7 @@ Ed_result_set::Ed_result_set(List<Ed_row
*/
Ed_connection::Ed_connection(THD *thd)
- :m_warning_info(thd->query_id),
+ :m_warning_info(thd->query_id, false),
m_thd(thd),
m_rsets(0),
m_current_rset(0)
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2011-03-16 14:11:20 +0000
+++ b/sql/sql_select.cc 2011-04-15 06:54:05 +0000
@@ -991,7 +991,7 @@ JOIN::optimize()
If all items were resolved by opt_sum_query, there is no need to
open any tables.
*/
- if ((res=opt_sum_query(select_lex->leaf_tables, all_fields, conds)))
+ if ((res=opt_sum_query(thd, select_lex->leaf_tables, all_fields, conds)))
{
if (res == HA_ERR_KEY_NOT_FOUND)
{
@@ -1972,7 +1972,11 @@ JOIN::exec()
if (!curr_join->sort_and_group &&
curr_join->const_tables != curr_join->tables)
curr_join->join_tab[curr_join->const_tables].sorted= 0;
- if ((tmp_error= do_select(curr_join, (List<Item> *) 0, curr_tmp_table, 0)))
+
+ Procedure *save_proc= curr_join->procedure;
+ tmp_error= do_select(curr_join, (List<Item> *) 0, curr_tmp_table, 0);
+ curr_join->procedure= save_proc;
+ if (tmp_error)
{
error= tmp_error;
DBUG_VOID_RETURN;
@@ -12620,10 +12624,14 @@ end_send(JOIN *join, JOIN_TAB *join_tab
}
if (join->having && join->having->val_int() == 0)
DBUG_RETURN(NESTED_LOOP_OK); // Didn't match having
- error=0;
if (join->procedure)
- error=join->procedure->send_row(join->procedure_fields_list);
- else if (join->do_send_rows)
+ {
+ if (join->procedure->send_row(join->procedure_fields_list))
+ DBUG_RETURN(NESTED_LOOP_ERROR);
+ DBUG_RETURN(NESTED_LOOP_OK);
+ }
+ error=0;
+ if (join->do_send_rows)
error=join->result->send_data(*join->fields);
if (error)
DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h 2011-01-07 14:29:17 +0000
+++ b/sql/sql_select.h 2011-04-15 06:54:05 +0000
@@ -619,7 +619,8 @@ bool is_indexed_agg_distinct(JOIN *join,
/* functions from opt_sum.cc */
bool simple_pred(Item_func *func_item, Item **args, bool *inv_order);
-int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds);
+int opt_sum_query(THD* thd,
+ TABLE_LIST *tables, List<Item> &all_fields, COND *conds);
/* from sql_delete.cc, used by opt_range.cc */
extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b);
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2011-04-06 15:11:43 +0000
+++ b/sql/sql_show.cc 2011-04-15 12:02:22 +0000
@@ -3416,6 +3416,45 @@ end:
/**
+ Trigger_error_handler is intended to intercept and silence SQL conditions
+ that might happen during trigger loading for SHOW statements.
+ The potential SQL conditions are:
+
+ - ER_PARSE_ERROR -- this error is thrown if a trigger definition file
+ is damaged or contains invalid CREATE TRIGGER statement. That should
+ not happen in normal life.
+
+ - ER_TRG_NO_DEFINER -- this warning is thrown when we're loading a
+ trigger created/imported in/from the version of MySQL, which does not
+ support trigger definers.
+
+ - ER_TRG_NO_CREATION_CTX -- this warning is thrown when we're loading a
+ trigger created/imported in/from the version of MySQL, which does not
+ support trigger creation contexts.
+*/
+
+class Trigger_error_handler : public Internal_error_handler
+{
+public:
+ bool handle_condition(THD *thd,
+ uint sql_errno,
+ const char* sqlstate,
+ MYSQL_ERROR::enum_warning_level level,
+ const char* msg,
+ MYSQL_ERROR ** cond_hdl)
+ {
+ if (sql_errno == ER_PARSE_ERROR ||
+ sql_errno == ER_TRG_NO_DEFINER ||
+ sql_errno == ER_TRG_NO_CREATION_CTX)
+ return true;
+
+ return false;
+ }
+};
+
+
+
+/**
@brief Fill I_S tables whose data are retrieved
from frm files and storage engine
@@ -3570,7 +3609,6 @@ int get_all_tables(THD *thd, TABLE_LIST
acl_get(sctx->host, sctx->ip, sctx->priv_user, db_name->str, 0))
#endif
{
- thd->no_warnings_for_error= 1;
List<LEX_STRING> table_names;
int res= make_table_name_list(thd, &table_names, lex,
&lookup_field_vals,
@@ -3619,9 +3657,24 @@ int get_all_tables(THD *thd, TABLE_LIST
if (!(table_open_method & ~OPEN_FRM_ONLY) &&
!with_i_schema)
{
- if (!fill_schema_table_from_frm(thd, tables, schema_table, db_name,
- table_name, schema_table_idx,
- can_deadlock))
+ /*
+ Here we need to filter out warnings, which can happen
+ during loading of triggers in fill_schema_table_from_frm(),
+ because we don't need those warnings to pollute output of
+ SELECT from I_S / SHOW-statements.
+ */
+
+ Trigger_error_handler err_handler;
+ thd->push_internal_handler(&err_handler);
+
+ int res= fill_schema_table_from_frm(thd, tables, schema_table,
+ db_name, table_name,
+ schema_table_idx,
+ can_deadlock);
+
+ thd->pop_internal_handler();
+
+ if (!res)
continue;
}
@@ -3631,7 +3684,6 @@ int get_all_tables(THD *thd, TABLE_LIST
Set the parent lex of 'sel' because it is needed by
sel.init_query() which is called inside make_table_list.
*/
- thd->no_warnings_for_error= 1;
sel.parent_lex= lex;
if (make_table_list(thd, &sel, db_name, table_name))
goto err;
@@ -6675,6 +6727,92 @@ int make_schema_select(THD *thd, SELECT_
}
+/**
+ Fill INFORMATION_SCHEMA-table, leave correct Diagnostics_area /
+ Warning_info state after itself.
+
+ This function is a wrapper around ST_SCHEMA_TABLE::fill_table(), which
+ may "partially silence" some errors. The thing is that during
+ fill_table() many errors might be emitted. These errors stem from the
+ nature of fill_table().
+
+ For example, SELECT ... FROM INFORMATION_SCHEMA.xxx WHERE TABLE_NAME = 'xxx'
+ results in a number of 'Table <db name>.xxx does not exist' errors,
+ because fill_table() tries to open the 'xxx' table in every possible
+ database.
+
+ Those errors are cleared (the error status is cleared from
+ Diagnostics_area) inside fill_table(), but they remain in Warning_info
+ (Warning_info is not cleared because it may contain useful warnings).
+
+ This function is responsible for making sure that Warning_info does not
+ contain warnings corresponding to the cleared errors.
+
+ @note: THD::no_warnings_for_error used to be set before calling
+ fill_table(), thus those errors didn't go to Warning_info. This is not
+ the case now (THD::no_warnings_for_error was eliminated as a hack), so we
+ need to take care of those warnings here.
+
+ @param thd Thread context.
+ @param table_list I_S table.
+ @param join_table JOIN/SELECT table.
+
+ @return Error status.
+ @retval TRUE Error.
+ @retval FALSE Success.
+*/
+static bool do_fill_table(THD *thd,
+ TABLE_LIST *table_list,
+ JOIN_TAB *join_table)
+{
+ // NOTE: fill_table() may generate many "useless" warnings, which will be
+ // ignored afterwards. On the other hand, there might be "useful"
+ // warnings, which should be presented to the user. Warning_info usually
+ // stores no more than THD::variables.max_error_count warnings.
+ // The problem is that "useless warnings" may occupy all the slots in the
+ // Warning_info, so "useful warnings" get rejected. In order to avoid
+ // that problem we create a Warning_info instance, which is capable of
+ // storing "unlimited" number of warnings.
+ Warning_info wi(thd->query_id, true);
+ Warning_info *wi_saved= thd->warning_info;
+
+ thd->warning_info= &wi;
+
+ bool res= table_list->schema_table->fill_table(
+ thd, table_list, join_table->select_cond);
+
+ thd->warning_info= wi_saved;
+
+ // Pass an error if any.
+
+ if (thd->stmt_da->is_error())
+ {
+ thd->warning_info->push_warning(thd,
+ thd->stmt_da->sql_errno(),
+ thd->stmt_da->get_sqlstate(),
+ MYSQL_ERROR::WARN_LEVEL_ERROR,
+ thd->stmt_da->message());
+ }
+
+ // Pass warnings (if any).
+ //
+ // Filter out warnings with WARN_LEVEL_ERROR level, because they
+ // correspond to the errors which were filtered out in fill_table().
+
+
+ List_iterator_fast<MYSQL_ERROR> it(wi.warn_list());
+ MYSQL_ERROR *err;
+
+ while ((err= it++))
+ {
+ if (err->get_level() != MYSQL_ERROR::WARN_LEVEL_ERROR)
+ thd->warning_info->push_warning(thd, err);
+ }
+
+ return res;
+}
+
+
/*
Fill temporary schema tables before SELECT
@@ -6697,7 +6835,6 @@ bool get_schema_tables_result(JOIN *join
bool result= 0;
DBUG_ENTER("get_schema_tables_result");
- thd->no_warnings_for_error= 1;
for (JOIN_TAB *tab= join->join_tab; tab < tmp_join_tab; tab++)
{
if (!tab->table || !tab->table->pos_in_table_list)
@@ -6748,8 +6885,7 @@ bool get_schema_tables_result(JOIN *join
else
table_list->table->file->stats.records= 0;
- if (table_list->schema_table->fill_table(thd, table_list,
- tab->select_cond))
+ if (do_fill_table(thd, table_list, tab))
{
result= 1;
join->error= 1;
@@ -6761,7 +6897,6 @@ bool get_schema_tables_result(JOIN *join
table_list->schema_table_state= executed_place;
}
}
- thd->no_warnings_for_error= 0;
DBUG_RETURN(result);
}
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2011-03-25 14:03:44 +0000
+++ b/sql/sql_table.cc 2011-04-13 06:16:40 +0000
@@ -6660,15 +6660,15 @@ bool mysql_alter_table(THD *thd,char *ne
NO need to tamper with MERGE tables. The real open is done later.
*/
Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
- TABLE *t_table;
+ TABLE_LIST temp_table_list;
+ TABLE_LIST *t_table_list;
if (new_name != table_name || new_db != db)
{
- table_list->alias= new_name;
- table_list->table_name= new_name;
- table_list->table_name_length= strlen(new_name);
- table_list->db= new_db;
- table_list->db_length= strlen(new_db);
- table_list->mdl_request.ticket= target_mdl_request.ticket;
+ temp_table_list.init_one_table(new_db, strlen(new_db),
+ new_name, strlen(new_name),
+ new_name, TL_READ_NO_INSERT);
+ temp_table_list.mdl_request.ticket= target_mdl_request.ticket;
+ t_table_list= &temp_table_list;
}
else
{
@@ -6678,20 +6678,21 @@ bool mysql_alter_table(THD *thd,char *ne
to request the lock.
*/
table_list->mdl_request.ticket= mdl_ticket;
+ t_table_list= table_list;
}
- if (open_table(thd, table_list, thd->mem_root, &ot_ctx))
+ if (open_table(thd, t_table_list, thd->mem_root, &ot_ctx))
{
goto err_with_mdl;
}
- t_table= table_list->table;
/* Tell the handler that a new frm file is in place. */
- error= t_table->file->ha_create_handler_files(path, NULL, CHF_INDEX_FLAG,
- create_info);
+ error= t_table_list->table->file->ha_create_handler_files(path, NULL,
+ CHF_INDEX_FLAG,
+ create_info);
- DBUG_ASSERT(thd->open_tables == t_table);
+ DBUG_ASSERT(thd->open_tables == t_table_list->table);
close_thread_table(thd, &thd->open_tables);
- table_list->table= 0;
+ t_table_list->table= NULL;
if (error)
goto err_with_mdl;
=== modified file 'sql/sql_trigger.cc'
--- a/sql/sql_trigger.cc 2011-03-10 08:07:57 +0000
+++ b/sql/sql_trigger.cc 2011-04-15 12:02:22 +0000
@@ -1225,13 +1225,12 @@ bool Table_triggers_list::check_n_load(T
DBUG_RETURN(1); // EOM
}
-
- if (!thd->no_warnings_for_error)
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_TRG_NO_CREATION_CTX,
- ER(ER_TRG_NO_CREATION_CTX),
- (const char*) db,
- (const char*) table_name);
+
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_TRG_NO_CREATION_CTX,
+ ER(ER_TRG_NO_CREATION_CTX),
+ (const char*) db,
+ (const char*) table_name);
if (!(trg_client_cs_name= alloc_lex_string(&table->mem_root)) ||
!(trg_connection_cl_name= alloc_lex_string(&table->mem_root)) ||
@@ -1362,12 +1361,12 @@ bool Table_triggers_list::check_n_load(T
MySQL, which does not support triggers definers. We should emit
warning here.
*/
- if (!thd->no_warnings_for_error)
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_TRG_NO_DEFINER, ER(ER_TRG_NO_DEFINER),
- (const char*) db,
- (const char*) sp->m_name.str);
-
+
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_TRG_NO_DEFINER, ER(ER_TRG_NO_DEFINER),
+ (const char*) db,
+ (const char*) sp->m_name.str);
+
/*
Set definer to the '' to correct displaying in the information
schema.
=== modified file 'sql/transaction.cc'
--- a/sql/transaction.cc 2011-02-14 13:16:31 +0000
+++ b/sql/transaction.cc 2011-04-14 08:13:28 +0000
@@ -79,6 +79,33 @@ static bool xa_trans_rolled_back(XID_STA
/**
+ Rollback the active XA transaction.
+
+ @note Resets rm_error before calling ha_rollback(), so
+ the thd->transaction.xid structure gets reset
+ by ha_rollback() / THD::transaction::cleanup().
+
+ @return TRUE if the rollback failed, FALSE otherwise.
+*/
+
+static bool xa_trans_force_rollback(THD *thd)
+{
+ /*
+ We must reset rm_error before calling ha_rollback(),
+ so thd->transaction.xid structure gets reset
+ by ha_rollback()/THD::transaction::cleanup().
+ */
+ thd->transaction.xid_state.rm_error= 0;
+ if (ha_rollback_trans(thd, true))
+ {
+ my_error(ER_XAER_RMERR, MYF(0));
+ return true;
+ }
+ return false;
+}
+
+
+/**
Begin a new transaction.
@note Beginning a transaction implicitly commits any current
@@ -362,6 +389,13 @@ bool trans_savepoint(THD *thd, LEX_STRIN
!opt_using_transactions)
DBUG_RETURN(FALSE);
+ enum xa_states xa_state= thd->transaction.xid_state.xa_state;
+ if (xa_state != XA_NOTR)
+ {
+ my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]);
+ DBUG_RETURN(TRUE);
+ }
+
sv= find_savepoint(thd, name);
if (*sv) /* old savepoint of the same name exists */
@@ -435,6 +469,13 @@ bool trans_rollback_to_savepoint(THD *th
DBUG_RETURN(TRUE);
}
+ enum xa_states xa_state= thd->transaction.xid_state.xa_state;
+ if (xa_state != XA_NOTR)
+ {
+ my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]);
+ DBUG_RETURN(TRUE);
+ }
+
if (ha_rollback_to_savepoint(thd, sv))
res= TRUE;
else if (((thd->variables.option_bits & OPTION_KEEP_LOG) ||
@@ -635,8 +676,7 @@ bool trans_xa_commit(THD *thd)
if (xa_trans_rolled_back(&thd->transaction.xid_state))
{
- if (ha_rollback_trans(thd, TRUE))
- my_error(ER_XAER_RMERR, MYF(0));
+ xa_trans_force_rollback(thd);
res= thd->is_error();
}
else if (xa_state == XA_IDLE && thd->lex->xa_opt == XA_ONE_PHASE)
@@ -725,15 +765,7 @@ bool trans_xa_rollback(THD *thd)
DBUG_RETURN(TRUE);
}
- /*
- Resource Manager error is meaningless at this point, as we perform
- explicit rollback request by user. We must reset rm_error before
- calling ha_rollback(), so thd->transaction.xid structure gets reset
- by ha_rollback()/THD::transaction::cleanup().
- */
- thd->transaction.xid_state.rm_error= 0;
- if ((res= test(ha_rollback_trans(thd, TRUE))))
- my_error(ER_XAER_RMERR, MYF(0));
+ res= xa_trans_force_rollback(thd);
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
=== modified file 'vio/viosocket.c'
--- a/vio/viosocket.c 2010-08-16 12:50:27 +0000
+++ b/vio/viosocket.c 2011-04-08 10:23:36 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1059,6 +1059,34 @@ ssize_t vio_pending(Vio *vio)
}
+/**
+ Checks if the error code, returned by vio_getnameinfo(), means it was the
+ "No-name" error.
+
+ Windows-specific note: getnameinfo() returns WSANO_DATA instead of
+ EAI_NODATA or EAI_NONAME when no reverse mapping is available at the host
+ (i.e. Windows can't get hostname by IP-address). This error should be
+ treated as EAI_NONAME.
+
+ @return if the error code is actually EAI_NONAME.
+ @retval true if the error code is EAI_NONAME.
+ @retval false otherwise.
+*/
+
+my_bool vio_is_no_name_error(int err_code)
+{
+#ifdef _WIN32
+
+ return err_code == WSANO_DATA || err_code == EAI_NONAME;
+
+#else
+
+ return err_code == EAI_NONAME;
+
+#endif
+}
+
+
/**
This is a wrapper for the system getnameinfo(), because different OS
differ in the getnameinfo() implementation:
No bundle (reason: revision is a merge).
| Thread |
|---|
| • bzr commit into mysql-5.5-mtr branch (bjorn.munch:3199) | Bjorn Munch | 15 Apr |