List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:April 19 2011 4:22pm
Subject:bzr push into mysql-trunk branch (chris.powers:3280 to 3282) WL#4896
View as plain text  
 3282 cpowers	2011-04-19
      WL#4896 "Performance Schema Net IO"
      
      - Updated unit test to handle socket with no thread owner

    modified:
      storage/perfschema/unittest/pfs-t.cc
 3281 cpowers	2011-04-19 [merge]
      merge with mysql-trunk

    added:
      sql/item_inetfunc.cc
      sql/item_inetfunc.h
    modified:
      cmake/os/Windows.cmake
      config.h.cmake
      include/my_net.h
      libmysql/libmysql.c
      libmysqld/libmysqld.c
      mysql-test/collections/default.experimental
      mysql-test/collections/default.weekly
      mysql-test/include/subquery.inc
      mysql-test/lib/My/Find.pm
      mysql-test/lib/mtr_gcov.pl
      mysql-test/mysql-test-run.pl
      mysql-test/r/func_analyse.result
      mysql-test/r/loaddata.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_none.result
      mysql-test/r/type_timestamp.result
      mysql-test/r/warnings.result
      mysql-test/r/xa.result
      mysql-test/suite/binlog/r/binlog_bug23533.result
      mysql-test/suite/binlog/t/binlog_bug23533.test
      mysql-test/t/func_analyse.test
      mysql-test/t/loaddata.test
      mysql-test/t/type_timestamp.test
      mysql-test/t/warnings.test
      mysql-test/t/xa.test
      sql-common/client.c
      sql/CMakeLists.txt
      sql/hostname.cc
      sql/item_create.cc
      sql/item_func.cc
      sql/item_func.h
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/mysqld.cc
      sql/opt_sum.cc
      sql/rpl_info_factory.h
      sql/sp_head.cc
      sql/sql_admin.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_connect.cc
      sql/sql_error.cc
      sql/sql_error.h
      sql/sql_load.cc
      sql/sql_parse.cc
      sql/sql_prepare.cc
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_show.cc
      sql/sql_trigger.cc
      sql/transaction.cc
      storage/myisam/myisamdef.h
      vio/vio_priv.h
 3280 cpowers	2011-04-13 [merge]
      WL#4896 "Performance Schema Net IO"
      
      Merge with mysql-trunk

    removed:
      extra/yassl/src/template_instnt.cpp
      extra/yassl/taocrypt/src/template_instnt.cpp
      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
      mysql-test/suite/sys_vars/r/max_long_data_size_basic.result
      mysql-test/suite/sys_vars/t/max_long_data_size_basic.test
    added:
      unittest/gunit/sql_plist-t.cc
    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:
      client/client_priv.h
      client/mysqlslap.c
      cmake/os/WindowsCache.cmake
      cmake/ssl.cmake
      config.h.cmake
      configure.cmake
      extra/yassl/CMakeLists.txt
      extra/yassl/src/crypto_wrapper.cpp
      extra/yassl/src/yassl_int.cpp
      extra/yassl/taocrypt/CMakeLists.txt
      extra/yassl/taocrypt/src/algebra.cpp
      extra/yassl/taocrypt/src/integer.cpp
      include/my_global.h
      include/violite.h
      mysql-test/collections/default.experimental
      mysql-test/collections/default.weekly
      mysql-test/extra/rpl_tests/rpl_extra_col_master.test
      mysql-test/include/ctype_numconv.inc
      mysql-test/include/func_in.inc
      mysql-test/include/mix1.inc
      mysql-test/include/mtr_warnings.sql
      mysql-test/include/order_by.inc
      mysql-test/include/subquery_mat.inc
      mysql-test/lib/mtr_misc.pl
      mysql-test/mysql-test-run.pl
      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_group.result
      mysql-test/r/func_in_icp.result
      mysql-test/r/func_in_icp_mrr.result
      mysql-test/r/func_in_mrr.result
      mysql-test/r/func_in_mrr_cost.result
      mysql-test/r/func_in_none.result
      mysql-test/r/innodb_icp_all.result
      mysql-test/r/innodb_mysql_lock.result
      mysql-test/r/innodb_mysql_sync.result
      mysql-test/r/lowercase_table2.result
      mysql-test/r/myisam_icp_all.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/mysqlslap.result
      mysql-test/r/order_by_all.result
      mysql-test/r/order_by_icp_mrr.result
      mysql-test/r/order_by_none.result
      mysql-test/r/plugin_auth.result
      mysql-test/r/show_check.result
      mysql-test/r/sp-destruct.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_jcl6.result
      mysql-test/r/subquery_mat.result
      mysql-test/r/subquery_mat_all.result
      mysql-test/r/subquery_mat_none.result
      mysql-test/r/subquery_nomat_nosj_jcl6.result
      mysql-test/r/variables-big.result
      mysql-test/r/variables.result
      mysql-test/r/view.result
      mysql-test/r/xa.result
      mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result
      mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result
      mysql-test/suite/rpl/r/rpl_migration_crash_safe.result
      mysql-test/suite/rpl/r/rpl_rotate_logs.result
      mysql-test/suite/rpl/t/rpl_migration_crash_safe.test
      mysql-test/suite/rpl/t/rpl_rotate_logs.test
      mysql-test/suite/sys_vars/r/master_info_repository_basic.result
      mysql-test/suite/sys_vars/r/relay_log_info_repository_basic.result
      mysql-test/suite/sys_vars/t/master_info_repository_basic.test
      mysql-test/suite/sys_vars/t/relay_log_info_repository_basic.test
      mysql-test/t/alter_table.test
      mysql-test/t/func_group.test
      mysql-test/t/innodb_mysql_lock.test
      mysql-test/t/innodb_mysql_sync.test
      mysql-test/t/lowercase_table2.test
      mysql-test/t/mysqlslap.test
      mysql-test/t/plugin_auth.test
      mysql-test/t/show_check.test
      mysql-test/t/sp-destruct.test
      mysql-test/t/variables.test
      mysql-test/t/view.test
      mysql-test/t/xa.test
      mysys/charset.c
      mysys/my_init.c
      mysys/my_thr_init.c
      mysys/mysys_priv.h
      plugin/auth/auth_socket.c
      scripts/mysql_install_db.pl.in
      scripts/mysql_install_db.sh
      scripts/mysql_system_tables_fix.sql
      sql/binlog.cc
      sql/field.cc
      sql/filesort.cc
      sql/hostname.cc
      sql/item.cc
      sql/item.h
      sql/item_buff.cc
      sql/item_cmpfunc.cc
      sql/item_func.cc
      sql/item_func.h
      sql/item_strfunc.cc
      sql/item_sum.cc
      sql/keycaches.cc
      sql/mdl.h
      sql/mysqld.cc
      sql/opt_range.cc
      sql/rpl_info.cc
      sql/rpl_info.h
      sql/rpl_info_factory.cc
      sql/rpl_info_factory.h
      sql/rpl_info_file.cc
      sql/rpl_info_file.h
      sql/rpl_info_handler.cc
      sql/rpl_info_handler.h
      sql/rpl_info_table.cc
      sql/rpl_info_table.h
      sql/rpl_info_table_access.cc
      sql/rpl_info_values.cc
      sql/rpl_mi.cc
      sql/rpl_mi.h
      sql/rpl_reporting.cc
      sql/rpl_rli.cc
      sql/rpl_rli.h
      sql/rpl_slave.cc
      sql/rpl_slave.h
      sql/share/errmsg-utf8.txt
      sql/sql_acl.cc
      sql/sql_base.h
      sql/sql_binlog.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_insert.cc
      sql/sql_join_cache.cc
      sql/sql_plist.h
      sql/sql_select.cc
      sql/sql_show.cc
      sql/sql_table.cc
      sql/sql_update.cc
      sql/sys_vars.cc
      sql/sys_vars.h
      sql/table.cc
      sql/table.h
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/handler0alter.cc
      storage/innobase/include/sync0arr.h
      storage/innobase/include/trx0roll.h
      storage/innobase/row/row0merge.c
      storage/innobase/row/row0mysql.c
      storage/innobase/srv/srv0srv.c
      storage/innobase/sync/sync0arr.c
      storage/innobase/trx/trx0roll.c
      storage/perfschema/ha_perfschema.h
      storage/perfschema/pfs.h
      storage/perfschema/pfs_atomic.h
      storage/perfschema/pfs_column_types.h
      storage/perfschema/pfs_column_values.h
      storage/perfschema/pfs_con_slice.h
      storage/perfschema/pfs_defaults.h
      storage/perfschema/pfs_engine_table.h
      storage/perfschema/pfs_events_statements.h
      storage/perfschema/pfs_global.h
      storage/perfschema/pfs_instr.h
      storage/perfschema/pfs_server.h
      storage/perfschema/pfs_setup_actor.cc
      storage/perfschema/pfs_timer.h
      unittest/gunit/CMakeLists.txt
      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 'cmake/os/Windows.cmake'
--- a/cmake/os/Windows.cmake	2010-11-19 23:41:00 +0000
+++ b/cmake/os/Windows.cmake	2011-04-14 08:09:49 +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
@@ -191,3 +191,4 @@ IF(NOT HAVE_SIZE_OF_SSIZE_T)
 ENDIF()
 
 SET(FN_NO_CASE_SENSE 1)
+SET(USE_SYMDIR 1)

=== modified file 'config.h.cmake'
--- a/config.h.cmake	2011-04-14 01:36:24 +0000
+++ b/config.h.cmake	2011-04-19 15:24:55 +0000
@@ -509,6 +509,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 'include/my_net.h'
--- a/include/my_net.h	2011-03-29 12:43:49 +0000
+++ b/include/my_net.h	2011-04-15 09:33:58 +0000
@@ -11,7 +11,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
 /*
   This file is also used to make handling of sockets and ioctl()
@@ -27,18 +27,23 @@
 C_MODE_START
 
 #include <errno.h>
+
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
+
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
+
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #endif
+
 #ifdef HAVE_POLL
 #include <sys/poll.h>
 #endif
+
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
@@ -47,9 +52,9 @@ C_MODE_START
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <netinet/ip.h>
-#if !defined(alpha_linux_port)
-#include <netinet/tcp.h>
-#endif
+# if !defined(alpha_linux_port)
+#   include <netinet/tcp.h>
+# endif
 #endif
 
 #if defined(__WIN__)
@@ -61,7 +66,8 @@ C_MODE_START
   #define SD_BOTH 0x02
 */
 #define SHUT_RDWR 0x02
-
+#else
+#include <netdb.h>     /* getaddrinfo() & co */
 #endif
 
 /*

=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c	2011-03-08 19:14:42 +0000
+++ b/libmysql/libmysql.c	2011-04-15 09:33:58 +0000
@@ -1,11 +1,8 @@
-/* Copyright (C) 2000-2004 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
-   the Free Software Foundation.
-
-   There are special exceptions to the terms and conditions of the GPL as it
-   is applied to this software.
+   the Free Software Foundation; version 2 of the License.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,7 +11,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
 #include <my_global.h>
 #include <my_sys.h>
@@ -34,10 +31,6 @@
 #include <pwd.h>
 #endif
 #if !defined(__WIN__)
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
 #ifdef HAVE_SELECT_H
 #include <select.h>
 #endif

=== modified file 'libmysqld/libmysqld.c'
--- a/libmysqld/libmysqld.c	2010-08-09 08:32:50 +0000
+++ b/libmysqld/libmysqld.c	2011-04-15 09:33:58 +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
@@ -11,7 +11,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
 #include <my_global.h>
 #include <mysql.h>
@@ -33,10 +33,6 @@
 #include <pwd.h>
 #endif
 #if !defined(__WIN__)
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
 #ifdef HAVE_SELECT_H
 #  include <select.h>
 #endif

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2011-04-13 21:03:10 +0000
+++ b/mysql-test/collections/default.experimental	2011-04-18 20:23:04 +0000
@@ -2,8 +2,7 @@
 # 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
+binlog.binlog_bug23533                   # skozlov: BUG#12371924
 
 funcs_1.charset_collation_1              # depends on compile-time decisions
 
@@ -19,12 +18,12 @@ main.subquery_sj_none @solaris
 main.type_float @freebsd                 # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
 main.wait_timeout @solaris               # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris
 
+rpl.rpl_checksum                         # BUG#12370830 2011-04-18 sven rpl_checksum failed on pb2 (server crash)
 rpl.rpl_innodb_bug28430                  # Bug#46029
 rpl.rpl_row_sp011  @solaris              # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
 rpl.rpl_delayed_slave                    # BUG#57514 rpl_delayed_slave fails sporadically in pb
 rpl.rpl_seconds_behind_master            # BUG#58053 2010-11-24 luis fails sporadically on pb2
 rpl.rpl_show_slave_running               # BUG#12346048 2011-04-11 sven fails sporadically on pb2
-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

=== modified file 'mysql-test/collections/default.weekly'
--- a/mysql-test/collections/default.weekly	2011-04-06 04:31:38 +0000
+++ b/mysql-test/collections/default.weekly	2011-04-14 05:33:57 +0000
@@ -11,17 +11,17 @@ perl mysql-test-run.pl --timer --force -
 
 # Non debug runs of all the tests run in the daily and weekly collections
 
-perl mysql-test-run.pl --force --timer  --parallel=auto --experimental=collections/default.experimental --comment=normal               --vardir=var-normal                                                                  --report-features --skip-test-list=collections/disabled-daily.list --unit-tests
+perl mysql-test-run.pl --force --timer  --big-test --testcase-timeout=60  --parallel=auto --experimental=collections/default.experimental --comment=normal   --vardir=var-normal   --report-features --skip-test-list=collections/disabled-daily.list --unit-tests
 perl mysql-test-run.pl --force --timer  --parallel=auto --experimental=collections/default.experimental --comment=n_mix                --vardir=var-n_mix                                  --mysqld=--binlog-format=mixed --skip-test-list=collections/disabled-daily.list
 perl mysql-test-run.pl --force --timer  --parallel=auto --experimental=collections/default.experimental --comment=row                --vardir=var-row                                  --mysqld=--binlog-format=row --skip-test-list=collections/disabled-daily.list
 perl mysql-test-run.pl --force --timer  --parallel=auto --experimental=collections/default.experimental --comment=ps_row               --vardir=var-ps_row                                 --mysqld=--binlog-format=row     --ps-protocol --skip-test-list=collections/disabled-daily.list
 perl mysql-test-run.pl --force --timer  --parallel=auto --experimental=collections/default.experimental --comment=embedded             --vardir=var-embedded                                                                --embedded
 perl mysql-test-run.pl --force --timer  --parallel=auto --experimental=collections/default.experimental --comment=ps                   --vardir=var-ps                                                                --ps-protocol --skip-test-list=collections/disabled-daily.list
-perl mysql-test-run.pl --force --timer  --parallel=auto --experimental=collections/default.experimental --comment=funcs2               --vardir=var-funcs2              --suite=funcs_2
-perl mysql-test-run.pl --force --timer  --parallel=auto --experimental=collections/default.experimental --comment=partitions           --vardir=var-parts               --suite=parts
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=stress               --vardir=var-stress              --suite=stress
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=jp                   --vardir=var-jp                  --suite=jp
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=nist                 --vardir=var-nist                --suite=nist
+perl mysql-test-run.pl --force --timer   --big-test --testcase-timeout=60  --parallel=auto --experimental=collections/default.experimental --comment=funcs2               --vardir=var-funcs2              --suite=funcs_2
+perl mysql-test-run.pl --force --timer  --big-test --testcase-timeout=60  --parallel=auto --experimental=collections/default.experimental --comment=partitions           --vardir=var-parts               --suite=parts
+perl mysql-test-run.pl --force --timer --big-test --testcase-timeout=60  --parallel=auto --experimental=collections/default.experimental --comment=stress               --vardir=var-stress              --suite=stress
+perl mysql-test-run.pl --force --timer --big-test --testcase-timeout=60  --parallel=auto --experimental=collections/default.experimental --comment=jp                   --vardir=var-jp                  --suite=jp
+perl mysql-test-run.pl --force --timer --big-test --testcase-timeout=60  --parallel=auto --experimental=collections/default.experimental --comment=nist                 --vardir=var-nist                --suite=nist
 perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=nist+ps              --vardir=var-ps_nist             --suite=nist                                        --ps-protocol
 perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_checksum  --vardir=var-rpl_binlog_checksum --suite=rpl,binlog --mysqld=--binlog-checksum=CRC32 --skip-test-list=collections/disabled-daily.list
 perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=rpl_crash_safe_relay --vardir=var-rpl_crash_safe_relay --suite=rpl --mysqld=--relay-log-info-repository=TABLE --skip-test-list=collections/disabled-daily.list

=== modified file 'mysql-test/include/subquery.inc'
--- a/mysql-test/include/subquery.inc	2011-02-02 09:04:55 +0000
+++ b/mysql-test/include/subquery.inc	2011-04-15 08:11:49 +0000
@@ -5064,6 +5064,28 @@ DROP TABLE t1;
 
 
 --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/lib/My/Find.pm'
--- a/mysql-test/lib/My/Find.pm	2011-02-24 14:11:05 +0000
+++ b/mysql-test/lib/My/Find.pm	2011-04-15 08:37:20 +0000
@@ -1,5 +1,5 @@
 # -*- cperl -*-
-# Copyright (C) 2008 MySQL AB
+# Copyright (c) 2004, 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
@@ -156,8 +156,7 @@ sub my_find_paths {
   # User can select to look in a special build dir
   # which is a subdirectory of any of the paths
   my @extra_dirs;
-  my $build_dir= $::opt_config_dir || $ENV{MTR_VS_CONFIG}
-                                   || $ENV{MTR_BUILD_DIR};
+  my $build_dir= $::opt_vs_config || $ENV{MTR_VS_CONFIG} || $ENV{MTR_BUILD_DIR};
   push(@extra_dirs, $build_dir) if defined $build_dir;
 
   if (defined $extension){

=== modified file 'mysql-test/lib/mtr_gcov.pl'
--- a/mysql-test/lib/mtr_gcov.pl	2011-01-18 11:01:40 +0000
+++ b/mysql-test/lib/mtr_gcov.pl	2011-04-14 12:25:15 +0000
@@ -1,5 +1,5 @@
 # -*- cperl -*-
-# Copyright (C) 2004, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
+# Copyright (c) 2004, 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
@@ -31,7 +31,7 @@ sub gcov_prepare ($) {
 #
 # Collect gcov statistics.
 # Arguments:
-#   $dir       basedir, normally source directory
+#   $dir       basedir, normally build directory
 #   $gcov      gcov utility program [path] name
 #   $gcov_msg  message file name
 #   $gcov_err  error file name
@@ -43,29 +43,25 @@ sub gcov_collect ($$$) {
   my $start_dir= cwd();
 
   print "Collecting source coverage info using '$gcov'...\n";
-  -f "$start_dir/$gcov_msg" and unlink("$start_dir/$gcov_msg");
-  -f "$start_dir/$gcov_err" and unlink("$start_dir/$gcov_err");
+  -f "$dir/$gcov_msg" and unlink("$dir/$gcov_msg");
+  -f "$dir/$gcov_err" and unlink("$dir/$gcov_err");
 
   my @dirs= `find "$dir" -type d -print | sort`;
   #print "List of directories:\n@dirs\n";
 
   foreach my $d ( @dirs ) {
-    my $dir_reported= 0;
     chomp($d);
     chdir($d) or next;
 
-    foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) ) {
-      $f =~ /(.*)\.[ch]c?/;
-      -f "$1.gcno" or next;
-      if (!$dir_reported) {
-	print "Collecting in '$d'...\n";
-	$dir_reported= 1;
-      }
-      system("$gcov $f 2>>$start_dir/$gcov_err >>$start_dir/$gcov_msg");
+    my @flist= glob("*.*.gcno");
+    print ("Collecting in '$d'...\n") if @flist;
+
+    foreach my $f (@flist) {
+      system("$gcov $f 2>>$dir/$gcov_err >>$dir/$gcov_msg");
     }
     chdir($start_dir);
   }
-  print "gcov info in $gcov_msg, errors in $gcov_err\n";
+  print "gcov info in $dir/$gcov_msg, errors in $dir/$gcov_err\n";
 }
 
 

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-04-07 08:39:10 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-04-15 08:39:02 +0000
@@ -211,8 +211,8 @@ our $opt_clean_vardir= $ENV{'MTR_CLEAN_V
 
 our $opt_gcov;
 our $opt_gcov_exe= "gcov";
-our $opt_gcov_err= "mysql-test-gcov.msg";
-our $opt_gcov_msg= "mysql-test-gcov.err";
+our $opt_gcov_err= "mysql-test-gcov.err";
+our $opt_gcov_msg= "mysql-test-gcov.msg";
 
 our $opt_gprof;
 our %gprof_dirs;
@@ -508,7 +508,7 @@ sub main {
   mtr_print_line();
 
   if ( $opt_gcov ) {
-    gcov_collect($basedir, $opt_gcov_exe,
+    gcov_collect($bindir, $opt_gcov_exe,
 		 $opt_gcov_msg, $opt_gcov_err);
   }
 
@@ -1200,7 +1200,7 @@ sub command_line_setup {
 	chomp;
 	# remove comments (# foo) at the beginning of the line, or after a 
 	# blank at the end of the line
-	s/( +|^)#.*$//;
+	s/(\s+|^)#.*$//;
 	# If @ platform specifier given, use this entry only if it contains
 	# @<platform> or @!<xxx> where xxx != platform
 	if (/\@.*/)
@@ -1211,8 +1211,8 @@ sub command_line_setup {
 	  s/\@.*$//;
 	}
 	# remove whitespace
-	s/^ +//;              
-	s/ +$//;
+	s/^\s+//;
+	s/\s+$//;
 	# if nothing left, don't need to remember this line
 	if ( $_ eq "" ) {
 	  next;

=== modified file 'mysql-test/r/func_analyse.result'
--- a/mysql-test/r/func_analyse.result	2011-03-14 18:11:41 +0000
+++ b/mysql-test/r/func_analyse.result	2011-04-14 09:32:17 +0000
@@ -135,6 +135,19 @@ 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
 #
 # Bug #47338 assertion in handler::ha_external_lock

=== 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/subquery_all.result'
--- a/mysql-test/r/subquery_all.result	2011-03-29 08:10:26 +0000
+++ b/mysql-test/r/subquery_all.result	2011-04-15 08:11:49 +0000
@@ -6213,6 +6213,24 @@ id	select_type	table	type	possible_keys
 DROP TABLE t2;
 DROP TABLE t1;
 #
+# 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/subquery_nomat_nosj.result'
--- a/mysql-test/r/subquery_nomat_nosj.result	2011-03-24 13:16:36 +0000
+++ b/mysql-test/r/subquery_nomat_nosj.result	2011-04-15 08:11:49 +0000
@@ -6213,6 +6213,24 @@ id	select_type	table	type	possible_keys
 DROP TABLE t2;
 DROP TABLE t1;
 #
+# 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/subquery_none.result'
--- a/mysql-test/r/subquery_none.result	2011-02-14 11:21:26 +0000
+++ b/mysql-test/r/subquery_none.result	2011-04-15 08:11:49 +0000
@@ -6212,6 +6212,24 @@ id	select_type	table	type	possible_keys
 DROP TABLE t2;
 DROP TABLE t1;
 #
+# 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/type_timestamp.result'
--- a/mysql-test/r/type_timestamp.result	2011-01-12 17:24:53 +0000
+++ b/mysql-test/r/type_timestamp.result	2011-04-18 08:47:41 +0000
@@ -523,6 +523,69 @@ a
 2000-01-01 00:00:01
 2000-01-01 00:00:01
 DROP TABLE t1;
+#
+# Bug#50774: failed to get the correct resultset when timestamp values 
+# are appended with .0
+#
+CREATE TABLE t1 ( a TIMESTAMP, KEY ( a ) );
+INSERT INTO t1 VALUES( '2010-02-01 09:31:01' );
+INSERT INTO t1 VALUES( '2010-02-01 09:31:02' );
+INSERT INTO t1 VALUES( '2010-02-01 09:31:03' );
+INSERT INTO t1 VALUES( '2010-02-01 09:31:04' );
+SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
+a
+2010-02-01 09:31:02
+2010-02-01 09:31:03
+2010-02-01 09:31:04
+SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' <= a;
+a
+2010-02-01 09:31:02
+2010-02-01 09:31:03
+2010-02-01 09:31:04
+SELECT * FROM t1 WHERE a <= '2010-02-01 09:31:02.0';
+a
+2010-02-01 09:31:01
+2010-02-01 09:31:02
+SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' >= a;
+a
+2010-02-01 09:31:01
+2010-02-01 09:31:02
+EXPLAIN
+SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+x	x	x	range	x	x	x	x	x	x
+SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
+a
+2010-02-01 09:31:02
+2010-02-01 09:31:03
+2010-02-01 09:31:04
+CREATE TABLE t2 ( a TIMESTAMP, KEY ( a DESC ) );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:01' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:02' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:03' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:04' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:05' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:06' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:07' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:08' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:09' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:10' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:11' );
+# The bug would cause the range optimizer's comparison to use an open
+# interval here. This reveals itself only in the number of reads 
+# performed.
+FLUSH STATUS;
+EXPLAIN
+SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0';
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+x	x	x	range	x	x	x	x	x	x
+SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0';
+a
+2010-02-01 09:31:01
+SHOW STATUS LIKE 'Handler_read_next';
+Variable_name	Value
+Handler_read_next	1
+DROP TABLE t1, t2;
 End of 5.1 tests
 
 Bug#50888 valgrind warnings in Field_timestamp::val_str

=== modified file 'mysql-test/r/warnings.result'
--- a/mysql-test/r/warnings.result	2010-08-30 06:38:09 +0000
+++ b/mysql-test/r/warnings.result	2011-04-15 12:14:35 +0000
@@ -316,3 +316,25 @@ SHOW ERRORS;
 Level	Code	Message
 Error	1051	Unknown table 'test.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-04-12 10:59:59 +0000
+++ b/mysql-test/r/xa.result	2011-04-14 08:47:14 +0000
@@ -200,3 +200,32 @@ 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;

=== modified file 'mysql-test/suite/binlog/r/binlog_bug23533.result'
--- a/mysql-test/suite/binlog/r/binlog_bug23533.result	2011-04-13 20:18:08 +0000
+++ b/mysql-test/suite/binlog/r/binlog_bug23533.result	2011-04-18 19:59:15 +0000
@@ -3,10 +3,9 @@ CREATE TABLE t1 (a INT NOT NULL AUTO_INC
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 1000
-SHOW VARIABLES LIKE 'max_binlog_cache_size';
-Variable_name	Value
-max_binlog_cache_size	4294963200
+SET @saved_binlog_cache_size=@@binlog_cache_size;
 SET @saved_max_binlog_cache_size=@@max_binlog_cache_size;
+SET GLOBAL binlog_cache_size=4096;
 SET GLOBAL max_binlog_cache_size=4096;
 START TRANSACTION;
 CREATE TABLE t2 SELECT * FROM t1;
@@ -16,4 +15,5 @@ SHOW TABLES LIKE 't%';
 Tables_in_test (t%)
 t1
 SET GLOBAL max_binlog_cache_size=@saved_max_binlog_cache_size;
+SET GLOBAL binlog_cache_size=@saved_binlog_cache_size;
 DROP TABLE t1;

=== modified file 'mysql-test/suite/binlog/t/binlog_bug23533.test'
--- a/mysql-test/suite/binlog/t/binlog_bug23533.test	2011-04-13 20:18:08 +0000
+++ b/mysql-test/suite/binlog/t/binlog_bug23533.test	2011-04-18 19:59:15 +0000
@@ -15,15 +15,18 @@ CREATE TABLE t1 (a INT NOT NULL AUTO_INC
 let $i= 1000;
 while ($i)
 {
+  BEGIN;
   eval INSERT INTO t1 VALUES($i, REPEAT('x', 4096));
+  COMMIT;
   dec $i;
 }
 --enable_query_log
 SELECT COUNT(*) FROM t1;
 
 # Set small value for max_binlog_cache_size
-SHOW VARIABLES LIKE 'max_binlog_cache_size';
+SET @saved_binlog_cache_size=@@binlog_cache_size;
 SET @saved_max_binlog_cache_size=@@max_binlog_cache_size;
+SET GLOBAL binlog_cache_size=4096;
 SET GLOBAL max_binlog_cache_size=4096;
 
 # Copied data from t1 into t2 large than max_binlog_cache_size
@@ -35,4 +38,5 @@ SHOW TABLES LIKE 't%';
 
 # 5.1 End of Test
 SET GLOBAL max_binlog_cache_size=@saved_max_binlog_cache_size;
+SET GLOBAL binlog_cache_size=@saved_binlog_cache_size;
 DROP TABLE t1;

=== modified file 'mysql-test/t/func_analyse.test'
--- a/mysql-test/t/func_analyse.test	2011-03-14 18:11:41 +0000
+++ b/mysql-test/t/func_analyse.test	2011-04-14 09:32:17 +0000
@@ -1,6 +1,7 @@
 #
 # Test of procedure analyse
 #
+-- source include/have_innodb.inc
 
 --disable_warnings
 drop table if exists t1,t2;
@@ -144,6 +145,17 @@ 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
 
 --echo #

=== 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/type_timestamp.test'
--- a/mysql-test/t/type_timestamp.test	2011-01-12 12:58:47 +0000
+++ b/mysql-test/t/type_timestamp.test	2011-04-18 08:46:17 +0000
@@ -362,6 +362,53 @@ SELECT a FROM t1 WHERE a >= '20000101000
 
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#50774: failed to get the correct resultset when timestamp values 
+--echo # are appended with .0
+--echo #
+CREATE TABLE t1 ( a TIMESTAMP, KEY ( a ) );
+
+INSERT INTO t1 VALUES( '2010-02-01 09:31:01' );
+INSERT INTO t1 VALUES( '2010-02-01 09:31:02' );
+INSERT INTO t1 VALUES( '2010-02-01 09:31:03' );
+INSERT INTO t1 VALUES( '2010-02-01 09:31:04' );
+
+SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
+SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' <= a;
+SELECT * FROM t1 WHERE a <= '2010-02-01 09:31:02.0';
+SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' >= a;
+
+--replace_column 1 x 2 x 3 x 5 x 6 x 7 x 8 x 9 x 10 x
+EXPLAIN
+SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
+SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
+
+CREATE TABLE t2 ( a TIMESTAMP, KEY ( a DESC ) );
+
+INSERT INTO t2 VALUES( '2010-02-01 09:31:01' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:02' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:03' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:04' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:05' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:06' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:07' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:08' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:09' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:10' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:11' );
+
+--echo # The bug would cause the range optimizer's comparison to use an open
+--echo # interval here. This reveals itself only in the number of reads 
+--echo # performed.
+FLUSH STATUS;
+--replace_column 1 x 2 x 3 x 5 x 6 x 7 x 8 x 9 x 10 x
+EXPLAIN
+SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0';
+SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0';
+SHOW STATUS LIKE 'Handler_read_next';
+
+DROP TABLE t1, t2;
+
 --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-04-12 10:59:59 +0000
+++ b/mysql-test/t/xa.test	2011-04-14 08:47:14 +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
 
@@ -326,6 +328,59 @@ 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 'sql-common/client.c'
--- a/sql-common/client.c	2011-03-21 02:16:39 +0000
+++ b/sql-common/client.c	2011-04-19 15:24:55 +0000
@@ -37,10 +37,6 @@
 
 #include "mysql.h"
 
-#ifndef __WIN__
-#include <netdb.h>
-#endif
-
 /* Remove client convenience wrappers */
 #undef max_allowed_packet
 #undef net_buffer_length
@@ -61,6 +57,7 @@ my_bool	net_flush(NET *net);
 #else  /*EMBEDDED_LIBRARY*/
 #define CLI_MYSQL_REAL_CONNECT STDCALL mysql_real_connect
 #endif /*EMBEDDED_LIBRARY*/
+
 #include <my_sys.h>
 #include <mysys_err.h>
 #include <m_string.h>
@@ -69,6 +66,7 @@ my_bool	net_flush(NET *net);
 #include "mysqld_error.h"
 #include "errmsg.h"
 #include <violite.h>
+
 #if !defined(__WIN__)
 #include <my_pthread.h>				/* because of signal()	*/
 #endif /* !defined(__WIN__) */
@@ -76,21 +74,20 @@ my_bool	net_flush(NET *net);
 #include <sys/stat.h>
 #include <signal.h>
 #include <time.h>
+
 #ifdef	 HAVE_PWD_H
 #include <pwd.h>
 #endif
+
 #if !defined(__WIN__)
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
 #ifdef HAVE_SELECT_H
 #  include <select.h>
 #endif
 #ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
+#  include <sys/select.h>
 #endif
 #endif /* !defined(__WIN__) */
+
 #ifdef HAVE_SYS_UN_H
 #  include <sys/un.h>
 #endif
@@ -111,6 +108,7 @@ my_bool	net_flush(NET *net);
 #include "client_settings.h"
 #include <sql_common.h>
 #include <mysql/client_plugin.h>
+
 #define native_password_plugin_name "mysql_native_password"
 #define old_password_plugin_name    "mysql_old_password"
 

=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt	2011-02-02 08:30:13 +0000
+++ b/sql/CMakeLists.txt	2011-04-15 09:04:21 +0000
@@ -64,6 +64,7 @@ SET(SQL_SHARED_SOURCES
   item_sum.cc
   item_timefunc.cc 
   item_xmlfunc.cc 
+  item_inetfunc.cc
   key.cc
   keycaches.cc
   lock.cc

=== modified file 'sql/hostname.cc'
--- a/sql/hostname.cc	2011-04-08 10:32:40 +0000
+++ b/sql/hostname.cc	2011-04-15 09:33:58 +0000
@@ -26,10 +26,6 @@
 
 #include "sql_priv.h"
 #include "hostname.h"
-#include "my_global.h"
-#ifndef __WIN__
-#include <netdb.h>        // getservbyname, servent
-#endif
 #include "hash_filo.h"
 #include <m_ctype.h>
 #include "log.h"                                // sql_print_warning,

=== modified file 'sql/item_create.cc'
--- a/sql/item_create.cc	2011-03-09 20:54:55 +0000
+++ b/sql/item_create.cc	2011-04-15 09:04:21 +0000
@@ -30,6 +30,7 @@
 #include "set_var.h"
 #include "sp_head.h"
 #include "sp.h"
+#include "item_inetfunc.h"
 
 /*
 =============================================================================

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2011-04-08 13:41:38 +0000
+++ b/sql/item_func.cc	2011-04-15 09:04:21 +0000
@@ -5711,61 +5711,6 @@ void Item_func_get_system_var::cleanup()
 }
 
 
-longlong Item_func_inet_aton::val_int()
-{
-  DBUG_ASSERT(fixed == 1);
-  uint byte_result = 0;
-  ulonglong result = 0;			// We are ready for 64 bit addresses
-  const char *p,* end;
-  char c = '.'; // we mark c to indicate invalid IP in case length is 0
-  char buff[36];
-  int dot_count= 0;
-
-  String *s, tmp(buff, sizeof(buff), &my_charset_latin1);
-  if (!(s = args[0]->val_str_ascii(&tmp)))       // If null value
-    goto err;
-  null_value=0;
-
-  end= (p = s->ptr()) + s->length();
-  while (p < end)
-  {
-    c = *p++;
-    int digit = (int) (c - '0');
-    if (digit >= 0 && digit <= 9)
-    {
-      if ((byte_result = byte_result * 10 + digit) > 255)
-	goto err;				// Wrong address
-    }
-    else if (c == '.')
-    {
-      dot_count++;
-      result= (result << 8) + (ulonglong) byte_result;
-      byte_result = 0;
-    }
-    else
-      goto err;					// Invalid character
-  }
-  if (c != '.')					// IP number can't end on '.'
-  {
-    /*
-      Handle short-forms addresses according to standard. Examples:
-      127		-> 0.0.0.127
-      127.1		-> 127.0.0.1
-      127.2.1		-> 127.2.0.1
-    */
-    switch (dot_count) {
-    case 1: result<<= 8; /* Fall through */
-    case 2: result<<= 8; /* Fall through */
-    }
-    return (result << 8) + (ulonglong) byte_result;
-  }
-
-err:
-  null_value=1;
-  return 0;
-}
-
-
 void Item_func_match::init_search(bool no_order)
 {
   DBUG_ENTER("Item_func_match::init_search");

=== modified file 'sql/item_func.h'
--- a/sql/item_func.h	2011-04-08 13:41:38 +0000
+++ b/sql/item_func.h	2011-04-15 09:04:21 +0000
@@ -1635,17 +1635,6 @@ public:
 };
 
 
-class Item_func_inet_aton : public Item_int_func
-{
-public:
-  Item_func_inet_aton(Item *a) :Item_int_func(a) {}
-  longlong val_int();
-  const char *func_name() const { return "inet_aton"; }
-  void fix_length_and_dec()
-    { decimals= 0; max_length= 21; maybe_null= 1; unsigned_flag= 1;}
-};
-
-
 /* for fulltext search */
 #include <ft_global.h>
 

=== added file 'sql/item_inetfunc.cc'
--- a/sql/item_inetfunc.cc	1970-01-01 00:00:00 +0000
+++ b/sql/item_inetfunc.cc	2011-04-15 09:42:59 +0000
@@ -0,0 +1,133 @@
+/* Copyright (c) 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
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
+
+#include "item_inetfunc.h"
+
+#include "violite.h"  // vio_getnameinfo()
+
+///////////////////////////////////////////////////////////////////////////
+
+longlong Item_func_inet_aton::val_int()
+{
+  DBUG_ASSERT(fixed);
+
+  uint byte_result= 0;
+  ulonglong result= 0;
+  const char *p,* end;
+  char c= '.'; // we mark c to indicate invalid IP in case length is 0
+  char buff[36];
+  int dot_count= 0;
+
+  String tmp(buff, sizeof (buff), &my_charset_latin1);
+  String *s= args[0]->val_str_ascii(&tmp);
+
+  if (!s)       // If null value
+    goto err;
+
+  null_value= 0;
+
+  p= s->ptr();
+  end= p + s->length();
+  while (p < end)
+  {
+    c= *p++;
+    int digit= (int) (c - '0');
+    if (digit >= 0 && digit <= 9)
+    {
+      byte_result= byte_result * 10 + digit;
+      if (byte_result > 255)
+        goto err;                               // Wrong address
+    }
+    else if (c == '.')
+    {
+      dot_count++;
+      result= (result << 8) + (ulonglong) byte_result;
+      byte_result= 0;
+    }
+    else
+      goto err;                                 // Invalid character
+  }
+  if (c != '.')                                 // IP number can't end on '.'
+  {
+    /*
+      Attempt to support short-form addresses (i.e. classful addresses).
+      The current code does not support full range of classful addresses.
+      Examples:
+        127     -> 0.0.0.127
+        127.255 -> 127.0.0.255
+        127.256 -> NULL (should have been 127.0.1.0)
+        127.2.1 -> 127.2.0.1
+    */
+    switch (dot_count) {
+    case 1: result<<= 8; /* Fall through */
+    case 2: result<<= 8; /* Fall through */
+    }
+    return (result << 8) + (ulonglong) byte_result;
+  }
+
+err:
+  null_value=1;
+  return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////
+
+String* Item_func_inet_ntoa::val_str(String* str)
+{
+  DBUG_ASSERT(fixed);
+
+  ulonglong n= (ulonglong) args[0]->val_int();
+
+  /*
+    We do not know if args[0] is NULL until we have called
+    some val function on it if args[0] is not a constant!
+
+    Also return null if n > 255.255.255.255
+  */
+  null_value= args[0]->null_value || n > (ulonglong) LL(4294967295);
+
+  if (null_value)
+    return 0;                                   // Null value
+
+  str->set_charset(collation.collation);
+  str->length(0);
+
+  uchar buf[8];
+  int4store(buf, n);
+
+  /* Now we can assume little endian. */
+
+  char num[4];
+  num[3]= '.';
+
+  for (uchar *p= buf + 4; p-- > buf;)
+  {
+    uint c= *p;
+    uint n1, n2;                                // Try to avoid divisions
+    n1= c / 100;                                // 100 digits
+    c -= n1 * 100;
+    n2= c / 10;                                 // 10 digits
+    c -= n2 * 10;                               // last digit
+    num[0]= (char) n1 + '0';
+    num[1]= (char) n2 + '0';
+    num[2]= (char) c + '0';
+    uint length= (n1 ? 4 : n2 ? 3 : 2);         // Remove pre-zero
+    uint dot_length= (p <= buf) ? 1 : 0;
+
+    str->append(num + 4 - length, length - dot_length, &my_charset_latin1);
+  }
+
+  return str;
+}

=== added file 'sql/item_inetfunc.h'
--- a/sql/item_inetfunc.h	1970-01-01 00:00:00 +0000
+++ b/sql/item_inetfunc.h	2011-04-15 09:39:46 +0000
@@ -0,0 +1,74 @@
+#ifndef ITEM_INETFUNC_INCLUDED
+#define ITEM_INETFUNC_INCLUDED
+
+/* Copyright (c) 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
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
+
+
+#include "item.h"
+
+/*************************************************************************
+  Item_func_inet_aton implements INET_ATON() SQL-function.
+*************************************************************************/
+
+class Item_func_inet_aton : public Item_int_func
+{
+public:
+  inline Item_func_inet_aton(Item *arg)
+    : Item_int_func(arg)
+  {}
+
+public:
+  virtual longlong val_int();
+
+  virtual const char *func_name() const
+  { return "inet_aton"; }
+
+  virtual void fix_length_and_dec()
+  {
+    decimals= 0;
+    max_length= 21;
+    maybe_null= 1;
+    unsigned_flag= 1;
+  }
+};
+
+
+/*************************************************************************
+  Item_func_inet_ntoa implements INET_NTOA() SQL-function.
+*************************************************************************/
+
+class Item_func_inet_ntoa : public Item_str_func
+{
+public:
+  inline Item_func_inet_ntoa(Item *arg)
+    : Item_str_func(arg)
+  { }
+
+public:
+  virtual String* val_str(String* str);
+
+  virtual const char *func_name() const
+  { return "inet_ntoa"; }
+
+  virtual void fix_length_and_dec()
+  {
+    decimals= 0;
+    fix_length_and_charset(3 * 8 + 7, default_charset());
+    maybe_null= 1;
+  }
+};
+
+#endif // ITEM_INETFUNC_INCLUDED

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2011-04-08 13:41:38 +0000
+++ b/sql/item_strfunc.cc	2011-04-15 09:04:21 +0000
@@ -3513,48 +3513,6 @@ void Item_func_export_set::fix_length_an
   fix_char_length(length * 64 + sep_length * 63);
 }
 
-String* Item_func_inet_ntoa::val_str(String* str)
-{
-  DBUG_ASSERT(fixed == 1);
-  uchar buf[8], *p;
-  ulonglong n = (ulonglong) args[0]->val_int();
-  char num[4];
-
-  /*
-    We do not know if args[0] is NULL until we have called
-    some val function on it if args[0] is not a constant!
-
-    Also return null if n > 255.255.255.255
-  */
-  if ((null_value= (args[0]->null_value || n > (ulonglong) LL(4294967295))))
-    return 0;					// Null value
-
-  str->set_charset(collation.collation);
-  str->length(0);
-  int4store(buf,n);
-
-  /* Now we can assume little endian. */
-
-  num[3]='.';
-  for (p=buf+4 ; p-- > buf ; )
-  {
-    uint c = *p;
-    uint n1,n2;					// Try to avoid divisions
-    n1= c / 100;				// 100 digits
-    c-= n1*100;
-    n2= c / 10;					// 10 digits
-    c-=n2*10;					// last digit
-    num[0]=(char) n1+'0';
-    num[1]=(char) n2+'0';
-    num[2]=(char) c+'0';
-    uint length= (n1 ? 4 : n2 ? 3 : 2);         // Remove pre-zero
-    uint dot_length= (p <= buf) ? 1 : 0;
-    (void) str->append(num + 4 - length, length - dot_length,
-                       &my_charset_latin1);
-  }
-  return str;
-}
-
 
 #define get_esc_bit(mask, num) (1 & (*((mask) + ((num) >> 3))) >> ((num) & 7))
 

=== modified file 'sql/item_strfunc.h'
--- a/sql/item_strfunc.h	2011-03-22 11:44:40 +0000
+++ b/sql/item_strfunc.h	2011-04-15 09:04:21 +0000
@@ -780,22 +780,6 @@ class Item_func_export_set: public Item_
   const char *func_name() const { return "export_set"; }
 };
 
-class Item_func_inet_ntoa : public Item_str_func
-{
-public:
-  Item_func_inet_ntoa(Item *a) :Item_str_func(a)
-    {
-    }
-  String* val_str(String* str);
-  const char *func_name() const { return "inet_ntoa"; }
-  void fix_length_and_dec() 
-  { 
-    decimals= 0; 
-    fix_length_and_charset(3 * 8 + 7, default_charset()); 
-    maybe_null= 1;
-  }
-};
-
 class Item_func_quote :public Item_str_func
 {
   String tmp_value;

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-04-14 01:36:24 +0000
+++ b/sql/mysqld.cc	2011-04-19 15:24:55 +0000
@@ -17,9 +17,6 @@
 #include "sql_priv.h"
 #include "unireg.h"
 #include <signal.h>
-#ifndef __WIN__
-#include <netdb.h>        // getservbyname, servent
-#endif
 #include "sql_parse.h"    // test_if_data_home_dir
 #include "sql_cache.h"    // query_cache, query_cache_*
 #include "sql_locale.h"   // MY_LOCALES, my_locales, my_locale_by_name

=== modified file 'sql/opt_sum.cc'
--- a/sql/opt_sum.cc	2010-12-08 12:55:40 +0000
+++ b/sql/opt_sum.cc	2011-04-15 08:11:49 +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,Item *conds)
+int opt_sum_query(THD *thd,
+                  TABLE_LIST *tables, List<Item> &all_fields, Item *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/rpl_info_factory.h'
--- a/sql/rpl_info_factory.h	2011-03-23 23:28:49 +0000
+++ b/sql/rpl_info_factory.h	2011-04-14 12:25:14 +0000
@@ -36,10 +36,10 @@ public:
   static bool create(uint mi_option, Master_info **mi,
                      uint rli_option, Relay_log_info **rli);
   static Master_info *create_mi(uint rli_option);
-  static bool change_mi_repository(Master_info *mi, uint mi_option,
+  static bool change_mi_repository(Master_info *mi, const uint mi_option,
                                    const char **msg);
   static Relay_log_info *create_rli(uint rli_option, bool is_slave_recovery);
-  static bool change_rli_repository(Relay_log_info *mi, uint mi_option,
+  static bool change_rli_repository(Relay_log_info *mi, const uint mi_option,
                                     const char **msg);
 private:
   static bool decide_repository(Rpl_info *info,

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2011-03-22 11:44:40 +0000
+++ b/sql/sp_head.cc	2011-04-15 12:14:35 +0000
@@ -1214,7 +1214,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 09:21:39 +0000
+++ b/sql/sql_admin.cc	2011-04-15 12:14:35 +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_class.cc'
--- a/sql/sql_class.cc	2011-04-04 08:47:25 +0000
+++ b/sql/sql_class.cc	2011-04-15 12:14:35 +0000
@@ -13,7 +13,6 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
-
 /*****************************************************************************
 **
 ** This file implements classes defined in sql_class.h
@@ -510,7 +509,7 @@ THD::THD(bool enable_plugins)
    debug_sync_control(0),
 #endif /* defined(ENABLED_DEBUG_SYNC) */
    m_enable_plugins(enable_plugins),
-   main_warning_info(0)
+   main_warning_info(0, false)
 {
   ulong tmp;
 
@@ -569,7 +568,7 @@ THD::THD(bool enable_plugins)
   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;
@@ -842,10 +841,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-04-04 10:06:13 +0000
+++ b/sql/sql_class.h	2011-04-15 12:14:35 +0000
@@ -2180,7 +2180,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 */
@@ -2974,6 +2973,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_connect.cc'
--- a/sql/sql_connect.cc	2011-03-21 02:16:39 +0000
+++ b/sql/sql_connect.cc	2011-04-19 15:24:55 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2007, 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
@@ -20,9 +20,6 @@
 
 #include "my_global.h"
 #include "sql_priv.h"
-#ifndef __WIN__
-#include <netdb.h>        // getservbyname, servent
-#endif
 #include "sql_audit.h"
 #include "sql_connect.h"
 #include "my_global.h"

=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc	2011-03-09 20:54:55 +0000
+++ b/sql/sql_error.cc	2011-04-15 12:14:35 +0000
@@ -457,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 */
@@ -542,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)
@@ -558,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	2011-03-09 20:54:55 +0000
+++ b/sql/sql_error.h	2011-04-15 12:14:35 +0000
@@ -322,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
@@ -333,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();
 
   /**
@@ -383,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);
   }
 
   /**
@@ -461,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-03-09 20:54:55 +0000
+++ b/sql/sql_load.cc	2011-04-15 09:02:16 +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-04-01 23:01:38 +0000
+++ b/sql/sql_parse.cc	2011-04-19 15:24:55 +0000
@@ -7351,10 +7351,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_prepare.cc'
--- a/sql/sql_prepare.cc	2011-03-17 17:39:31 +0000
+++ b/sql/sql_prepare.cc	2011-04-15 12:14:35 +0000
@@ -2843,7 +2843,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;
@@ -3909,7 +3910,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-04-07 14:24:47 +0000
+++ b/sql/sql_select.cc	2011-04-15 08:11:49 +0000
@@ -1893,7 +1893,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)
       {
@@ -2936,7 +2936,11 @@ JOIN::exec()
         curr_join->best_positions[curr_join->const_tables].sj_strategy 
           != SJ_OPT_LOOSE_SCAN)
       disable_sorted_access(&curr_join->join_tab[curr_join->const_tables]);
-    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;
@@ -18625,10 +18629,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-04-06 11:13:33 +0000
+++ b/sql/sql_select.h	2011-04-15 08:11:49 +0000
@@ -2062,7 +2062,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,Item *conds);
+int opt_sum_query(THD* thd,
+                  TABLE_LIST *tables, List<Item> &all_fields, Item *conds);
 
 /* from sql_delete.cc, used by opt_range.cc */
 extern "C" int refpos_order_cmp(const void* arg, const void *a,const void *b);

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2011-04-06 15:21:05 +0000
+++ b/sql/sql_show.cc	2011-04-15 12:14:35 +0000
@@ -3417,6 +3417,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
 
@@ -3571,7 +3610,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,
@@ -3620,9 +3658,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;
             }
 
@@ -3632,7 +3685,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;
@@ -6667,6 +6719,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
 
@@ -6689,7 +6827,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)
@@ -6740,8 +6877,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;
@@ -6753,7 +6889,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_trigger.cc'
--- a/sql/sql_trigger.cc	2011-03-10 08:33:54 +0000
+++ b/sql/sql_trigger.cc	2011-04-15 12:14:35 +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-04-12 10:59:59 +0000
+++ b/sql/transaction.cc	2011-04-14 08:47:14 +0000
@@ -75,6 +75,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
@@ -645,8 +672,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)
@@ -735,15 +761,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 'storage/myisam/myisamdef.h'
--- a/storage/myisam/myisamdef.h	2011-03-28 08:51:35 +0000
+++ b/storage/myisam/myisamdef.h	2011-04-14 12:04:53 +0000
@@ -226,8 +226,9 @@ typedef struct st_mi_bit_buff {		/* Used
   uint error;
 } MI_BIT_BUFF;
 
-
+C_MODE_START
 typedef ICP_RESULT (*index_cond_func_t)(void *param);
+C_MODE_END
 
 struct st_myisam_info {
   MYISAM_SHARE *s;			/* Shared between open:s */

=== modified file 'storage/perfschema/unittest/pfs-t.cc'
--- a/storage/perfschema/unittest/pfs-t.cc	2011-04-02 21:08:06 +0000
+++ b/storage/perfschema/unittest/pfs-t.cc	2011-04-19 16:20:29 +0000
@@ -877,7 +877,6 @@ void test_init_disabled()
   /* disabled S-A + enabled T-1: no instrumentation */
 
   socket_class_A->m_enabled= false;
-  socket_A1= psi->init_socket(socket_key_A, NULL);
   ok(socket_A1 == NULL, "not instrumented");
 
   /* enabled S-A + enabled T-1: instrumentation */
@@ -1120,6 +1119,9 @@ void test_locker_disabled()
   socket_A1= psi->init_socket(socket_key_A, NULL);
   ok(socket_A1 != NULL, "instrumented");
 
+  /* Socket lockers require a thread owner */
+  psi->set_socket_thread_owner(socket_A1);
+
   PSI_mutex_locker *mutex_locker;
   PSI_mutex_locker_state mutex_state;
   PSI_rwlock_locker *rwlock_locker;
@@ -1298,6 +1300,16 @@ void test_locker_disabled()
   psi->start_socket_wait(socket_locker, 10, __FILE__, __LINE__);
   psi->end_socket_wait(socket_locker, 10);
 
+  /* Pretend the socket does not have a thread owner */
+  /* ---------------------------------------------- */
+
+  socket_class_A->m_enabled= true;
+  socket_A1= psi->init_socket(socket_key_A, NULL);
+  ok(socket_A1 != NULL, "instrumented");
+  /* Socket thread owner has not been set */
+  socket_locker= psi->get_thread_socket_locker(&socket_state, socket_A1, PSI_SOCKET_SEND);
+  ok(socket_locker == NULL, "no locker (no thread owner)");
+  
   /* Pretend the running thread is not instrumented */
   /* ---------------------------------------------- */
 
@@ -1604,7 +1616,7 @@ void do_all_tests()
 
 int main(int, char **)
 {
-  plan(214);
+  plan(216);
   MY_INIT("pfs-t");
   do_all_tests();
   return 0;

=== modified file 'vio/vio_priv.h'
--- a/vio/vio_priv.h	2010-06-07 14:01:39 +0000
+++ b/vio/vio_priv.h	2011-04-15 09:33:58 +0000
@@ -1,7 +1,7 @@
 #ifndef VIO_PRIV_INCLUDED
 #define VIO_PRIV_INCLUDED
 
-/* Copyright (C) 2003 MySQL AB
+/* Copyright (c) 2003, 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
@@ -14,7 +14,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
 /* Structures and functions private to the vio package */
 
@@ -25,11 +25,6 @@
 #include <m_string.h>
 #include <violite.h>
 
-#ifndef __WIN__
-#include <sys/socket.h>
-#include <netdb.h>
-#endif
-
 #ifdef _WIN32
 void	vio_win32_timeout(Vio *vio, uint which, uint timeout);
 #endif


Attachment: [text/bzr-bundle] bzr/cpowers@tma-1-20110419162029-ju5nyvss7x6w33lc.bundle
Thread
bzr push into mysql-trunk branch (chris.powers:3280 to 3282) WL#4896Christopher Powers19 Apr