List:Commits« Previous MessageNext Message »
From:Marc Alff Date:February 14 2011 3:12pm
Subject:bzr commit into mysql-trunk branch (marc.alff:3207)
View as plain text  
#At file:///Users/malff/BZR_TREE/mysql-trunk-wl4813/ based on revid:marc.alff@stripped

 3207 Marc Alff	2011-02-14 [merge]
      Merge mysql-trunk --> mysql-trunk-wl4813

    removed:
      mysql-test/collections/test-bt
      mysql-test/collections/test-bt-debug
      mysql-test/collections/test-bt-debug-fast
      mysql-test/collections/test-bt-fast
      mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result
      mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result
      mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test
      mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test
      storage/perfschema/unittest/stub_server_misc.h.moved
    added:
      mysql-test/collections/default.release
      mysql-test/collections/disabled-daily.list
      mysql-test/suite/perfschema/r/all_tests.result
      mysql-test/suite/perfschema/r/ddl_threads.result
      mysql-test/suite/perfschema/r/dml_fs_by_event_name.result
      mysql-test/suite/perfschema/r/dml_fs_by_instance.result
      mysql-test/suite/perfschema/t/all_tests.test
      mysql-test/suite/perfschema/t/ddl_threads.test
      mysql-test/suite/perfschema/t/dml_fs_by_event_name.test
      mysql-test/suite/perfschema/t/dml_fs_by_instance.test
    modified:
      client/readline.cc
      cmake/cpack_source_ignore_files.cmake
      mysql-test/CMakeLists.txt
      mysql-test/collections/default.daily
      mysql-test/collections/default.experimental
      mysql-test/include/ctype_numconv.inc
      mysql-test/mysql-test-run.pl
      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/innodb_icp_all.result
      mysql-test/r/join_outer_jcl6.result
      mysql-test/r/myisam_icp_all.result
      mysql-test/r/range_all.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_jcl6.result
      mysql-test/r/subquery_nomat_nosj_jcl6.result
      mysql-test/r/subquery_none_jcl6.result
      mysql-test/r/variables.result
      mysql-test/r/xa.result
      mysql-test/suite/perfschema/include/event_aggregate_setup.inc
      mysql-test/suite/perfschema/t/start_server_no_cond_class-master.opt
      mysql-test/suite/perfschema/t/start_server_no_cond_inst-master.opt
      mysql-test/suite/perfschema/t/start_server_no_file_class-master.opt
      mysql-test/suite/perfschema/t/start_server_no_file_inst-master.opt
      mysql-test/suite/perfschema/t/start_server_no_mutex_class-master.opt
      mysql-test/suite/perfschema/t/start_server_no_mutex_inst-master.opt
      mysql-test/suite/perfschema/t/start_server_no_rwlock_class-master.opt
      mysql-test/suite/perfschema/t/start_server_no_rwlock_inst-master.opt
      mysql-test/suite/perfschema/t/start_server_no_table_hdl-master.opt
      mysql-test/suite/perfschema/t/start_server_no_table_inst-master.opt
      mysql-test/suite/perfschema/t/start_server_no_thread_class-master.opt
      mysql-test/suite/perfschema/t/start_server_no_thread_inst-master.opt
      mysql-test/suite/rpl/r/rpl_row_event_max_size.result
      mysql-test/t/variables.test
      mysql-test/t/xa.test
      mysys/charset.c
      plugin/auth/auth_socket.c
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/item_timefunc.cc
      sql/item_timefunc.h
      sql/sql_load.cc
      sql/transaction.cc
      support-files/mysql.spec.sh
=== modified file 'client/readline.cc'
--- a/client/readline.cc	2011-02-09 06:50:11 +0000
+++ b/client/readline.cc	2011-02-09 11:16:33 +0000
@@ -33,10 +33,12 @@ LINE_BUFFER *batch_readline_init(ulong m
   LINE_BUFFER *line_buff;
   MY_STAT input_file_stat;
 
+#ifndef __WIN__
   if (my_fstat(fileno(file), &input_file_stat, MYF(MY_WME)) ||
       MY_S_ISDIR(input_file_stat.st_mode) ||
       MY_S_ISBLK(input_file_stat.st_mode))
     return 0;
+#endif
 
   if (!(line_buff=(LINE_BUFFER*)
         my_malloc(sizeof(*line_buff),MYF(MY_WME | MY_ZEROFILL))))

=== modified file 'cmake/cpack_source_ignore_files.cmake'
--- a/cmake/cpack_source_ignore_files.cmake	2010-07-20 09:37:50 +0000
+++ b/cmake/cpack_source_ignore_files.cmake	2011-02-10 10:26:23 +0000
@@ -51,8 +51,5 @@ include/config\\\\.h$
 include/my_config\\\\.h$
 /autom4te\\\\.cache/
 errmsg\\\\.sys$
-run_collection_test-bt.cmake
-run_collection_test-bt-debug.cmake
-run_collection_test-bt-fast.cmake
 #
 )

=== modified file 'mysql-test/CMakeLists.txt'
--- a/mysql-test/CMakeLists.txt	2010-11-14 18:09:32 +0000
+++ b/mysql-test/CMakeLists.txt	2011-02-10 09:06:39 +0000
@@ -93,7 +93,7 @@ ADD_CUSTOM_TARGET(test-force
   COMMAND perl ./mysql-test-run.pl --force ${EXP}
 )
 
-FOREACH(collection test-bt test-bt-fast test-bt-debug)
+FOREACH(collection)
   IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/collections/${collection})
     MESSAGE(FATAL_ERROR 
       "${CMAKE_CURRENT_SOURCE_DIR}/collections/${collection} does not exist")

=== modified file 'mysql-test/collections/default.daily'
--- a/mysql-test/collections/default.daily	2011-02-08 13:56:25 +0000
+++ b/mysql-test/collections/default.daily	2011-02-11 12:10:00 +0000
@@ -1,9 +1,9 @@
-perl mysql-test-run.pl --force --timer  --debug-server --parallel=auto --experimental=collections/default.experimental --comment=normal               --vardir=var-normal                                                                  --report-features
-perl mysql-test-run.pl --force --timer  --debug-server --parallel=auto --experimental=collections/default.experimental --comment=n_mix                --vardir=var-n_mix                                  --mysqld=--binlog-format=mixed
-perl mysql-test-run.pl --force --timer  --debug-server --parallel=auto --experimental=collections/default.experimental --comment=row                --vardir=var-row                                  --mysqld=--binlog-format=row
-perl mysql-test-run.pl --force --timer  --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps_row               --vardir=var-ps_row                                 --mysqld=--binlog-format=row     --ps-protocol
+perl mysql-test-run.pl --force --timer  --debug-server --parallel=auto --experimental=collections/default.experimental --comment=normal               --vardir=var-normal                                                                  --report-features --skip-test-list=collections/disabled-daily.list
+perl mysql-test-run.pl --force --timer  --debug-server --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  --debug-server --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  --debug-server --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  --debug-server --parallel=auto --experimental=collections/default.experimental --comment=embedded             --vardir=var-embedded                                                                --embedded
-perl mysql-test-run.pl --force --timer  --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps                   --vardir=var-ps                                                                --ps-protocol
+perl mysql-test-run.pl --force --timer  --debug-server --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  --debug-server --parallel=auto --experimental=collections/default.experimental --comment=funcs_1              --vardir=var-funcs_1             --suite=funcs_1
 perl mysql-test-run.pl --force --timer  --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps_funcs1            --vardir=var-ps_funcs_1          --suite=funcs_1                                     --ps-protocol
 perl mysql-test-run.pl --force --timer  --debug-server --parallel=auto --experimental=collections/default.experimental --comment=funcs2               --vardir=var-funcs2              --suite=funcs_2
@@ -12,4 +12,4 @@ perl mysql-test-run.pl --force --timer -
 perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=jp                   --vardir=var-jp                  --suite=jp
 perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=nist                 --vardir=var-nist                --suite=nist
 perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=nist+ps              --vardir=var-ps_nist             --suite=nist                                        --ps-protocol
-perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_checksum  --vardir=var-rpl_binlog_checksum --suite=rpl,binlog --mysqld=--binlog-checksum=CRC32
+perl mysql-test-run.pl --force --timer --debug-server --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

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2011-02-08 15:54:12 +0000
+++ b/mysql-test/collections/default.experimental	2011-02-09 16:33:45 +0000
@@ -41,43 +41,3 @@ main.gis-rtree                          
 main.type_float                          # svoj: due to BUG#38965
 main.type_newdecimal                     # svoj: due to BUG#38965
 
-perfschema.ortho_iter                        # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.event_aggregate                   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_off               # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_global_2u_2t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_global_2u_3t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_global_4u_2t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_global_4u_3t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_hist_2u_2t        # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_hist_2u_3t        # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_hist_4u_2t        # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_hist_4u_3t        # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_thread_2u_2t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_thread_2u_3t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_thread_4u_2t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_aggregate_thread_4u_3t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_io_aggregate_global_2u_2t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_io_aggregate_global_2u_3t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_io_aggregate_global_4u_2t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_io_aggregate_global_4u_3t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_io_aggregate_hist_2u_2t     # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_io_aggregate_hist_2u_3t     # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_io_aggregate_hist_4u_2t     # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_io_aggregate_hist_4u_3t     # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_io_aggregate_thread_2u_2t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_io_aggregate_thread_2u_3t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_io_aggregate_thread_4u_2t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_io_aggregate_thread_4u_3t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_lock_aggregate_global_2u_2t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_lock_aggregate_global_2u_3t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_lock_aggregate_global_4u_2t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_lock_aggregate_global_4u_3t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_lock_aggregate_hist_2u_2t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_lock_aggregate_hist_2u_3t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_lock_aggregate_hist_4u_2t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_lock_aggregate_hist_4u_3t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_lock_aggregate_thread_2u_2t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_lock_aggregate_thread_2u_3t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_lock_aggregate_thread_4u_2t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-perfschema.table_lock_aggregate_thread_4u_3t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
-

=== added file 'mysql-test/collections/default.release'
--- a/mysql-test/collections/default.release	1970-01-01 00:00:00 +0000
+++ b/mysql-test/collections/default.release	2011-02-09 19:41:12 +0000
@@ -0,0 +1,11 @@
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=debug      --vardir=var-debug                       --skip-ndbcluster --skip-rpl --report-features --debug-server
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal     --vardir=var-normal                      --skip-ndbcluster --report-features
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=ps         --vardir=var-ps                          --skip-ndbcluster --ps-protocol
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=funcs1+ps  --vardir=var-funcs_1_ps --suite=funcs_1  --ps-protocol
+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=embedded   --vardir=var-embedded                    --embedded-server --skip-rpl --skip-ndbcluster
+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 --parallel=auto --experimental=collections/default.experimental --comment=nist+ps    --vardir=var-nist_ps    --suite=nist     --ps-protocol

=== added file 'mysql-test/collections/disabled-daily.list'
--- a/mysql-test/collections/disabled-daily.list	1970-01-01 00:00:00 +0000
+++ b/mysql-test/collections/disabled-daily.list	2011-02-14 12:41:46 +0000
@@ -0,0 +1,9 @@
+rpl.rpl_semi_sync_event : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+rpl.rpl_semi_sync : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.rpl_semi_sync_master_enabled_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.rpl_semi_sync_master_timeout_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.rpl_semi_sync_master_trace_level_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.rpl_semi_sync_master_wait_no_slave_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.rpl_semi_sync_slave_enabled_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.rpl_semi_sync_slave_trace_level_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.all_vars : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.

=== removed file 'mysql-test/collections/test-bt'
--- a/mysql-test/collections/test-bt	2010-12-03 14:43:49 +0000
+++ b/mysql-test/collections/test-bt	1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=normal  --skip-ndbcluster --report-features --experimental=collections/default.experimental
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=ps --skip-ndbcluster --ps-protocol --experimental=collections/default.experimental
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=funcs1+ps  --suite=funcs_1 --ps-protocol --experimental=collections/default.experimental
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=funcs2     --suite=funcs_2 --experimental=collections/default.experimental
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=partitions --suite=parts   --experimental=collections/default.experimental
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=stress     --suite=stress  --experimental=collections/default.experimental
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=jp         --suite=jp      --experimental=collections/default.experimental
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=embedded  --embedded-server --skip-rpl --skip-ndbcluster --experimental=collections/default.experimental
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=nist --suite=nist --experimental=collections/default.experimental
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=nist+ps --suite=nist --ps-protocol --experimental=collections/default.experimental

=== removed file 'mysql-test/collections/test-bt-debug'
--- a/mysql-test/collections/test-bt-debug	2010-12-03 14:43:49 +0000
+++ b/mysql-test/collections/test-bt-debug	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=debug --skip-ndbcluster --skip-rpl --report-features --experimental=collections/default.experimental

=== removed file 'mysql-test/collections/test-bt-debug-fast'

=== removed file 'mysql-test/collections/test-bt-fast'
--- a/mysql-test/collections/test-bt-fast	2010-12-03 14:43:49 +0000
+++ b/mysql-test/collections/test-bt-fast	1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=ps  --skip-ndbcluster --ps-protocol --report-features --experimental=collections/default.experimental
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=stress --suite=stress --experimental=collections/default.experimental

=== modified file 'mysql-test/include/ctype_numconv.inc'
--- a/mysql-test/include/ctype_numconv.inc	2010-12-02 13:44:21 +0000
+++ b/mysql-test/include/ctype_numconv.inc	2011-02-10 13:41:16 +0000
@@ -1750,6 +1750,35 @@ DROP TABLE t1;
 
 
 --echo #
+--echo # Bug #31384 	DATE_ADD() and DATE_SUB() return binary data
+--echo #
+SELECT @@collation_connection, @@character_set_results;
+CREATE TABLE t1 AS
+SELECT
+  DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1,
+  DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+  DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+  DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+--enable_metadata
+# PS protocol gives different "Max length" value for DATETIME.
+--disable_ps_protocol
+SELECT
+  DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1,
+  DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+  DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+  DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+--disable_metadata
+--enable_ps_protocol
+SELECT
+  HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1,
+  HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2,
+  HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date,
+  HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime;
+ 
+
+--echo #
 --echo # Bug#52159 returning time type from function and empty left join causes debug assertion
 --echo #
 CREATE FUNCTION f1() RETURNS TIME RETURN 1;

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-02-08 15:54:12 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-02-09 15:35:49 +0000
@@ -2024,7 +2024,7 @@ sub read_plugin_defs($)
 
   # Need to check if we will be running mysqld-debug
   if ($opt_debug_server) {
-    $running_debug= 1 if find_mysqld($basedir) =~ /-debug$/;
+    $running_debug= 1 if find_mysqld($basedir) =~ /mysqld-debug/;
   }
 
   while (<PLUGDEF>) {

=== modified file 'mysql-test/r/ctype_binary.result'
--- a/mysql-test/r/ctype_binary.result	2010-12-15 12:25:38 +0000
+++ b/mysql-test/r/ctype_binary.result	2011-02-10 08:47:05 +0000
@@ -2790,6 +2790,46 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t1	range	date_column	date_column	9	NULL	1	Using index condition
 DROP TABLE t1;
 #
+# Bug #31384 	DATE_ADD() and DATE_SUB() return binary data
+#
+SELECT @@collation_connection, @@character_set_results;
+@@collation_connection	@@character_set_results
+binary	binary
+CREATE TABLE t1 AS
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `field_str1` varbinary(29) DEFAULT NULL,
+  `field1_str2` varbinary(29) DEFAULT NULL,
+  `field_date` date DEFAULT NULL,
+  `field_datetime` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def					field_str1	254	29	10	Y	128	31	63
+def					field1_str2	254	29	19	Y	128	31	63
+def					field_date	10	29	10	Y	128	31	63
+def					field_datetime	12	29	19	Y	128	31	63
+field_str1	field1_str2	field_date	field_datetime
+2007-08-02	2007-08-03 17:32:00	2007-08-02	2007-08-03 17:32:00
+SELECT
+HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1,
+HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2,
+HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date,
+HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime;
+field_str1	field1_str2	field_date	field_datetime
+323030372D30382D30322032333A35393A3030	323030372D30382D30332031373A33323A3030	323030372D30382D3032	323030372D30382D30332031373A33323A3030
+#
 # Bug#52159 returning time type from function and empty left join causes debug assertion
 #
 CREATE FUNCTION f1() RETURNS TIME RETURN 1;

=== modified file 'mysql-test/r/ctype_cp1251.result'
--- a/mysql-test/r/ctype_cp1251.result	2010-12-15 12:25:38 +0000
+++ b/mysql-test/r/ctype_cp1251.result	2011-02-10 08:47:05 +0000
@@ -3180,6 +3180,46 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t1	range	date_column	date_column	9	NULL	1	Using index condition
 DROP TABLE t1;
 #
+# Bug #31384 	DATE_ADD() and DATE_SUB() return binary data
+#
+SELECT @@collation_connection, @@character_set_results;
+@@collation_connection	@@character_set_results
+cp1251_general_ci	cp1251
+CREATE TABLE t1 AS
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `field_str1` varchar(29) CHARACTER SET cp1251 DEFAULT NULL,
+  `field1_str2` varchar(29) CHARACTER SET cp1251 DEFAULT NULL,
+  `field_date` date DEFAULT NULL,
+  `field_datetime` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def					field_str1	254	29	10	Y	0	31	51
+def					field1_str2	254	29	19	Y	0	31	51
+def					field_date	10	29	10	Y	128	31	63
+def					field_datetime	12	29	19	Y	128	31	63
+field_str1	field1_str2	field_date	field_datetime
+2007-08-02	2007-08-03 17:32:00	2007-08-02	2007-08-03 17:32:00
+SELECT
+HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1,
+HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2,
+HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date,
+HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime;
+field_str1	field1_str2	field_date	field_datetime
+323030372D30382D30322032333A35393A3030	323030372D30382D30332031373A33323A3030	323030372D30382D3032	323030372D30382D30332031373A33323A3030
+#
 # Bug#52159 returning time type from function and empty left join causes debug assertion
 #
 CREATE FUNCTION f1() RETURNS TIME RETURN 1;

=== modified file 'mysql-test/r/ctype_latin1.result'
--- a/mysql-test/r/ctype_latin1.result	2011-01-03 14:50:58 +0000
+++ b/mysql-test/r/ctype_latin1.result	2011-02-10 08:47:05 +0000
@@ -3209,6 +3209,46 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t1	range	date_column	date_column	9	NULL	1	Using index condition
 DROP TABLE t1;
 #
+# Bug #31384 	DATE_ADD() and DATE_SUB() return binary data
+#
+SELECT @@collation_connection, @@character_set_results;
+@@collation_connection	@@character_set_results
+latin1_swedish_ci	latin1
+CREATE TABLE t1 AS
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `field_str1` varchar(29) DEFAULT NULL,
+  `field1_str2` varchar(29) DEFAULT NULL,
+  `field_date` date DEFAULT NULL,
+  `field_datetime` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def					field_str1	254	29	10	Y	0	31	8
+def					field1_str2	254	29	19	Y	0	31	8
+def					field_date	10	29	10	Y	128	31	63
+def					field_datetime	12	29	19	Y	128	31	63
+field_str1	field1_str2	field_date	field_datetime
+2007-08-02	2007-08-03 17:32:00	2007-08-02	2007-08-03 17:32:00
+SELECT
+HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1,
+HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2,
+HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date,
+HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime;
+field_str1	field1_str2	field_date	field_datetime
+323030372D30382D30322032333A35393A3030	323030372D30382D30332031373A33323A3030	323030372D30382D3032	323030372D30382D30332031373A33323A3030
+#
 # Bug#52159 returning time type from function and empty left join causes debug assertion
 #
 CREATE FUNCTION f1() RETURNS TIME RETURN 1;

=== modified file 'mysql-test/r/ctype_ucs.result'
--- a/mysql-test/r/ctype_ucs.result	2011-01-18 07:16:49 +0000
+++ b/mysql-test/r/ctype_ucs.result	2011-02-10 08:47:05 +0000
@@ -4098,6 +4098,46 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
 DROP TABLE t1;
 #
+# Bug #31384 	DATE_ADD() and DATE_SUB() return binary data
+#
+SELECT @@collation_connection, @@character_set_results;
+@@collation_connection	@@character_set_results
+ucs2_general_ci	latin1
+CREATE TABLE t1 AS
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `field_str1` varchar(29) CHARACTER SET ucs2 DEFAULT NULL,
+  `field1_str2` varchar(29) CHARACTER SET ucs2 DEFAULT NULL,
+  `field_date` date DEFAULT NULL,
+  `field_datetime` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def					field_str1	254	29	10	Y	0	31	8
+def					field1_str2	254	29	19	Y	0	31	8
+def					field_date	10	29	10	Y	128	31	63
+def					field_datetime	12	29	19	Y	128	31	63
+field_str1	field1_str2	field_date	field_datetime
+2007-08-02	2007-08-03 17:32:00	2007-08-02	2007-08-03 17:32:00
+SELECT
+HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1,
+HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2,
+HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date,
+HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime;
+field_str1	field1_str2	field_date	field_datetime
+0032003000300037002D00300038002D00300032002000320033003A00350039003A00300030	0032003000300037002D00300038002D00300033002000310037003A00330032003A00300030	323030372D30382D3032	323030372D30382D30332031373A33323A3030
+#
 # Bug#52159 returning time type from function and empty left join causes debug assertion
 #
 CREATE FUNCTION f1() RETURNS TIME RETURN 1;

=== modified file 'mysql-test/r/ctype_utf8.result'
--- a/mysql-test/r/ctype_utf8.result	2011-01-03 14:50:58 +0000
+++ b/mysql-test/r/ctype_utf8.result	2011-02-10 08:47:05 +0000
@@ -5012,6 +5012,46 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t1	range	date_column	date_column	9	NULL	1	Using index condition
 DROP TABLE t1;
 #
+# Bug #31384 	DATE_ADD() and DATE_SUB() return binary data
+#
+SELECT @@collation_connection, @@character_set_results;
+@@collation_connection	@@character_set_results
+utf8_general_ci	utf8
+CREATE TABLE t1 AS
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `field_str1` varchar(29) CHARACTER SET utf8 DEFAULT NULL,
+  `field1_str2` varchar(29) CHARACTER SET utf8 DEFAULT NULL,
+  `field_date` date DEFAULT NULL,
+  `field_datetime` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def					field_str1	254	87	10	Y	0	31	33
+def					field1_str2	254	87	19	Y	0	31	33
+def					field_date	10	29	10	Y	128	31	63
+def					field_datetime	12	29	19	Y	128	31	63
+field_str1	field1_str2	field_date	field_datetime
+2007-08-02	2007-08-03 17:32:00	2007-08-02	2007-08-03 17:32:00
+SELECT
+HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1,
+HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2,
+HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date,
+HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime;
+field_str1	field1_str2	field_date	field_datetime
+323030372D30382D30322032333A35393A3030	323030372D30382D30332031373A33323A3030	323030372D30382D3032	323030372D30382D30332031373A33323A3030
+#
 # Bug#52159 returning time type from function and empty left join causes debug assertion
 #
 CREATE FUNCTION f1() RETURNS TIME RETURN 1;

=== modified file 'mysql-test/r/innodb_icp_all.result'
--- a/mysql-test/r/innodb_icp_all.result	2011-02-02 13:23:58 +0000
+++ b/mysql-test/r/innodb_icp_all.result	2011-02-09 15:30:19 +0000
@@ -599,6 +599,23 @@ select 1 from t1 where b <= 1 and a <> '
 1
 drop table t1;
 #
+# Bug#59259 "Incorrect rows returned for a correlated subquery
+#            when ICP is on"
+#
+CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (11,0);
+INSERT INTO t1 VALUES (12,5);
+INSERT INTO t1 VALUES (15,0);
+CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (11,1);
+INSERT INTO t2 VALUES (12,2);
+INSERT INTO t2 VALUES (15,4);
+SELECT * FROM t1
+WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE t1.i);
+pk	i
+12	5
+DROP TABLE t1, t2;
+#
 # Bug #58816 "Extra temporary duplicate rows in result set when 
 #             switching ICP off"
 #
@@ -673,6 +690,33 @@ id	select_type	table	type	possible_keys	
 
 DROP TABLE t1,t2;
 #
+# Bug#59186 Wrong results of join when ICP is enabled
+#
+CREATE TABLE t1 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(3) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (1,'y'),(0,'or');
+CREATE TABLE t2 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(3) NOT NULL,
+c2 VARCHAR(6) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t2 VALUES (6,'y','RPOYT'),(10,'m','JINQE');
+EXPLAIN SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using index condition
+1	SIMPLE	t2	range	PRIMARY	PRIMARY	4	NULL	2	Using index condition; Using where; Using join buffer (BNL, incremental buffers)
+SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+c2
+DROP TABLE t1, t2;
+#
 # Bug#58838 "Wrong results with HAVING + LIMIT without GROUP BY when 
 #            ICP is enabled"
 # 

=== modified file 'mysql-test/r/join_outer_jcl6.result'
--- a/mysql-test/r/join_outer_jcl6.result	2011-01-13 15:37:54 +0000
+++ b/mysql-test/r/join_outer_jcl6.result	2011-02-02 15:05:14 +0000
@@ -1507,6 +1507,148 @@ WHERE 7;
 col_datetime_key
 NULL
 DROP TABLE BB;
+#
+# Bug#58490: Incorrect result in multi level OUTER JOIN
+# in combination with IS NULL
+#
+CREATE TABLE t1 (i INT NOT NULL);
+INSERT INTO t1 VALUES (0),    (2),(3),(4);
+CREATE TABLE t2 (i INT NOT NULL);
+INSERT INTO t2 VALUES (0),(1),    (3),(4);
+CREATE TABLE t3 (i INT NOT NULL);
+INSERT INTO t3 VALUES (0),(1),(2),    (4);
+CREATE TABLE t4 (i INT NOT NULL);
+INSERT INTO t4 VALUES (0),(1),(2),(3)   ;
+SELECT * FROM
+t1 LEFT JOIN
+( t2 LEFT JOIN
+( t3 LEFT JOIN
+t4
+ON t4.i = t3.i
+)
+ON t3.i = t2.i
+)
+ON t2.i = t1.i
+;
+i	i	i	i
+0	0	0	0
+2	NULL	NULL	NULL
+3	3	NULL	NULL
+4	4	4	NULL
+SELECT * FROM
+t1 LEFT JOIN
+( t2 LEFT JOIN
+( t3 LEFT JOIN
+t4
+ON t4.i = t3.i
+)
+ON t3.i = t2.i
+)
+ON t2.i = t1.i
+WHERE t4.i IS NULL;
+i	i	i	i
+2	NULL	NULL	NULL
+3	3	NULL	NULL
+4	4	4	NULL
+SELECT * FROM
+t1 LEFT JOIN
+( ( t2 LEFT JOIN
+t3
+ON t3.i = t2.i
+)
+)
+ON t2.i = t1.i
+WHERE t3.i IS NULL;
+i	i	i
+2	NULL	NULL
+3	3	NULL
+SELECT * FROM
+t1 LEFT JOIN
+( ( t2 LEFT JOIN
+t3
+ON t3.i = t2.i
+)
+JOIN t4
+ON t4.i=t2.i
+)
+ON t2.i = t1.i
+WHERE t3.i IS NULL;
+i	i	i	i
+2	NULL	NULL	NULL
+3	3	NULL	3
+4	NULL	NULL	NULL
+SELECT * FROM
+t1 LEFT JOIN
+( ( t2 LEFT JOIN
+t3
+ON t3.i = t2.i
+)
+JOIN (t4 AS t4a JOIN t4 AS t4b ON t4a.i=t4b.i)
+ON t4a.i=t2.i
+)
+ON t2.i = t1.i
+WHERE t3.i IS NULL;
+i	i	i	i	i
+2	NULL	NULL	NULL	NULL
+3	3	NULL	3	3
+4	NULL	NULL	NULL	NULL
+SELECT * FROM
+t1 LEFT JOIN
+( ( t2 LEFT JOIN
+t3
+ON t3.i = t2.i
+)
+JOIN (t4 AS t4a, t4 AS t4b)
+ON t4a.i=t2.i
+)
+ON t2.i = t1.i
+WHERE t3.i IS NULL;
+i	i	i	i	i
+2	NULL	NULL	NULL	NULL
+3	3	NULL	3	0
+3	3	NULL	3	1
+3	3	NULL	3	2
+3	3	NULL	3	3
+4	NULL	NULL	NULL	NULL
+DROP TABLE t1,t2,t3,t4;
+#
+# Bug#49322(Duplicate): Server is adding extra NULL row
+# on processing a WHERE clause
+#
+CREATE TABLE h (pk INT NOT NULL, col_int_key INT);
+INSERT INTO h VALUES (1,NULL),(4,2),(5,2),(3,4),(2,8);
+CREATE TABLE m (pk INT NOT NULL, col_int_key INT);
+INSERT INTO m VALUES (1,2),(2,7),(3,5),(4,7),(5,5),(6,NULL),(7,NULL),(8,9);
+CREATE TABLE k (pk INT NOT NULL, col_int_key INT);
+INSERT INTO k VALUES (1,9),(2,2),(3,5),(4,2),(5,7),(6,0),(7,5);
+SELECT TABLE1.pk FROM k TABLE1
+RIGHT JOIN h TABLE2 ON TABLE1.col_int_key=TABLE2.col_int_key
+RIGHT JOIN m TABLE4 ON TABLE2.col_int_key=TABLE4.col_int_key;
+pk
+2
+2
+4
+4
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+SELECT TABLE1.pk FROM k TABLE1
+RIGHT JOIN h TABLE2 ON TABLE1.col_int_key=TABLE2.col_int_key
+RIGHT JOIN m TABLE4 ON TABLE2.col_int_key=TABLE4.col_int_key
+WHERE TABLE1.pk IS NULL;
+pk
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+DROP TABLE h,m,k;
 End of 5.1 tests
 #
 # Bug#54235 Extra rows with join_cache_level=4,6,8 and two LEFT JOIN

=== modified file 'mysql-test/r/myisam_icp_all.result'
--- a/mysql-test/r/myisam_icp_all.result	2011-02-02 13:23:58 +0000
+++ b/mysql-test/r/myisam_icp_all.result	2011-02-09 15:30:19 +0000
@@ -597,6 +597,23 @@ select 1 from t1 where b <= 1 and a <> '
 1
 drop table t1;
 #
+# Bug#59259 "Incorrect rows returned for a correlated subquery
+#            when ICP is on"
+#
+CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (11,0);
+INSERT INTO t1 VALUES (12,5);
+INSERT INTO t1 VALUES (15,0);
+CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (11,1);
+INSERT INTO t2 VALUES (12,2);
+INSERT INTO t2 VALUES (15,4);
+SELECT * FROM t1
+WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE t1.i);
+pk	i
+12	5
+DROP TABLE t1, t2;
+#
 # Bug #58816 "Extra temporary duplicate rows in result set when 
 #             switching ICP off"
 #
@@ -671,6 +688,33 @@ id	select_type	table	type	possible_keys	
 
 DROP TABLE t1,t2;
 #
+# Bug#59186 Wrong results of join when ICP is enabled
+#
+CREATE TABLE t1 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(3) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (1,'y'),(0,'or');
+CREATE TABLE t2 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(3) NOT NULL,
+c2 VARCHAR(6) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t2 VALUES (6,'y','RPOYT'),(10,'m','JINQE');
+EXPLAIN SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	2	Using index condition
+1	SIMPLE	t2	range	PRIMARY	PRIMARY	4	NULL	2	Using index condition; Using where; Using join buffer (BNL, incremental buffers)
+SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+c2
+DROP TABLE t1, t2;
+#
 # Bug#58838 "Wrong results with HAVING + LIMIT without GROUP BY when 
 #            ICP is enabled"
 # 

=== modified file 'mysql-test/r/range_all.result'
--- a/mysql-test/r/range_all.result	2011-02-01 12:47:39 +0000
+++ b/mysql-test/r/range_all.result	2011-02-02 15:05:14 +0000
@@ -1690,7 +1690,7 @@ pk	i4
 EXPLAIN
 SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	i4_uq	i4_uq	5	NULL	3	Using where
+1	SIMPLE	t1	range	i4_uq	i4_uq	5	NULL	3	Using index condition; Using MRR
 SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
 pk	i4
 1	10
@@ -1699,7 +1699,7 @@ pk	i4
 EXPLAIN
 SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	i4_uq	i4_uq	5	NULL	1	Using where
+1	SIMPLE	t1	range	i4_uq	i4_uq	5	NULL	1	Using index condition; Using MRR
 SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
 pk	i4
 1	10
@@ -1733,7 +1733,7 @@ pk	i4
 EXPLAIN
 SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	i4_uq	i4_uq	5	NULL	2	Using where
+1	SIMPLE	t1	range	i4_uq	i4_uq	5	NULL	2	Using index condition; Using MRR
 SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
 pk	i4
 1	10
@@ -1748,7 +1748,7 @@ pk	i4
 EXPLAIN
 SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	i4_uq	i4_uq	5	NULL	1	Using where
+1	SIMPLE	t1	range	i4_uq	i4_uq	5	NULL	1	Using index condition; Using MRR
 SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
 pk	i4
 1	10
@@ -1757,14 +1757,14 @@ EXPLAIN
 SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	i4_uq	NULL	NULL	NULL	3	
-1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.i4	1	Using where
+1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.i4	1	Using index condition
 SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
 pk	i4	pk	i4
 EXPLAIN
 SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	i4_uq	NULL	NULL	NULL	3	
-1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.i4	1	Using where
+1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.i4	1	Using index condition
 SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
 pk	i4	pk	i4
 DROP TABLE t1;

=== modified file 'mysql-test/r/subquery_all.result'
--- a/mysql-test/r/subquery_all.result	2011-01-25 10:28:21 +0000
+++ b/mysql-test/r/subquery_all.result	2011-02-02 15:05:14 +0000
@@ -6152,6 +6152,32 @@ HAVING t2s.i = 999
 ) IS UNKNOWN;
 i
 DROP TABLE t1,t1s,t2s;
+#
+# Bug #56690  Wrong results with subquery with 
+# GROUP BY inside < ANY clause
+#
+CREATE TABLE t1 (
+pk INT NOT NULL PRIMARY KEY,
+number INT,
+KEY key_number (number)
+);
+INSERT INTO t1 VALUES (8,8);
+CREATE TABLE t2 (
+pk INT NOT NULL PRIMARY KEY,
+number INT,
+KEY key_number (number)
+);
+INSERT INTO t2 VALUES (1,2);
+INSERT INTO t2 VALUES (2,8);
+INSERT INTO t2 VALUES (3,NULL);
+INSERT INTO t2 VALUES (4,166);
+SELECT * FROM t1 WHERE t1.number < ANY(SELECT number FROM t2 GROUP BY number);
+pk	number
+8	8
+SELECT * FROM t1 WHERE t1.number < ANY(SELECT number FROM t2);
+pk	number
+8	8
+DROP TABLE t1,t2;
 End of 5.1 tests
 #
 # BUG#50257: Missing info in REF column of the EXPLAIN 

=== modified file 'mysql-test/r/subquery_all_jcl6.result'
--- a/mysql-test/r/subquery_all_jcl6.result	2011-01-25 10:28:21 +0000
+++ b/mysql-test/r/subquery_all_jcl6.result	2011-02-02 15:05:14 +0000
@@ -6156,6 +6156,32 @@ HAVING t2s.i = 999
 ) IS UNKNOWN;
 i
 DROP TABLE t1,t1s,t2s;
+#
+# Bug #56690  Wrong results with subquery with 
+# GROUP BY inside < ANY clause
+#
+CREATE TABLE t1 (
+pk INT NOT NULL PRIMARY KEY,
+number INT,
+KEY key_number (number)
+);
+INSERT INTO t1 VALUES (8,8);
+CREATE TABLE t2 (
+pk INT NOT NULL PRIMARY KEY,
+number INT,
+KEY key_number (number)
+);
+INSERT INTO t2 VALUES (1,2);
+INSERT INTO t2 VALUES (2,8);
+INSERT INTO t2 VALUES (3,NULL);
+INSERT INTO t2 VALUES (4,166);
+SELECT * FROM t1 WHERE t1.number < ANY(SELECT number FROM t2 GROUP BY number);
+pk	number
+8	8
+SELECT * FROM t1 WHERE t1.number < ANY(SELECT number FROM t2);
+pk	number
+8	8
+DROP TABLE t1,t2;
 End of 5.1 tests
 #
 # BUG#50257: Missing info in REF column of the EXPLAIN 

=== modified file 'mysql-test/r/subquery_nomat_nosj_jcl6.result'
--- a/mysql-test/r/subquery_nomat_nosj_jcl6.result	2011-01-25 10:28:21 +0000
+++ b/mysql-test/r/subquery_nomat_nosj_jcl6.result	2011-02-02 15:05:14 +0000
@@ -6156,6 +6156,32 @@ HAVING t2s.i = 999
 ) IS UNKNOWN;
 i
 DROP TABLE t1,t1s,t2s;
+#
+# Bug #56690  Wrong results with subquery with 
+# GROUP BY inside < ANY clause
+#
+CREATE TABLE t1 (
+pk INT NOT NULL PRIMARY KEY,
+number INT,
+KEY key_number (number)
+);
+INSERT INTO t1 VALUES (8,8);
+CREATE TABLE t2 (
+pk INT NOT NULL PRIMARY KEY,
+number INT,
+KEY key_number (number)
+);
+INSERT INTO t2 VALUES (1,2);
+INSERT INTO t2 VALUES (2,8);
+INSERT INTO t2 VALUES (3,NULL);
+INSERT INTO t2 VALUES (4,166);
+SELECT * FROM t1 WHERE t1.number < ANY(SELECT number FROM t2 GROUP BY number);
+pk	number
+8	8
+SELECT * FROM t1 WHERE t1.number < ANY(SELECT number FROM t2);
+pk	number
+8	8
+DROP TABLE t1,t2;
 End of 5.1 tests
 #
 # BUG#50257: Missing info in REF column of the EXPLAIN 

=== modified file 'mysql-test/r/subquery_none_jcl6.result'
--- a/mysql-test/r/subquery_none_jcl6.result	2011-01-25 10:28:21 +0000
+++ b/mysql-test/r/subquery_none_jcl6.result	2011-02-02 15:05:14 +0000
@@ -6155,6 +6155,32 @@ HAVING t2s.i = 999
 ) IS UNKNOWN;
 i
 DROP TABLE t1,t1s,t2s;
+#
+# Bug #56690  Wrong results with subquery with 
+# GROUP BY inside < ANY clause
+#
+CREATE TABLE t1 (
+pk INT NOT NULL PRIMARY KEY,
+number INT,
+KEY key_number (number)
+);
+INSERT INTO t1 VALUES (8,8);
+CREATE TABLE t2 (
+pk INT NOT NULL PRIMARY KEY,
+number INT,
+KEY key_number (number)
+);
+INSERT INTO t2 VALUES (1,2);
+INSERT INTO t2 VALUES (2,8);
+INSERT INTO t2 VALUES (3,NULL);
+INSERT INTO t2 VALUES (4,166);
+SELECT * FROM t1 WHERE t1.number < ANY(SELECT number FROM t2 GROUP BY number);
+pk	number
+8	8
+SELECT * FROM t1 WHERE t1.number < ANY(SELECT number FROM t2);
+pk	number
+8	8
+DROP TABLE t1,t2;
 End of 5.1 tests
 #
 # BUG#50257: Missing info in REF column of the EXPLAIN 

=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2010-11-29 16:27:58 +0000
+++ b/mysql-test/r/variables.result	2011-02-10 08:52:44 +0000
@@ -1723,6 +1723,28 @@ drop table t1;
 drop function t1_min;
 drop function t1_max;
 #
+# Bug #59884: setting charset to 2048 crashes
+#
+set session character_set_results = 2048;
+ERROR 42000: Unknown character set: '2048'
+set session character_set_client=2048;
+ERROR 42000: Unknown character set: '2048'
+set session character_set_connection=2048;
+ERROR 42000: Unknown character set: '2048'
+set session character_set_server=2048;
+ERROR 42000: Unknown character set: '2048'
+set session collation_server=2048;
+ERROR HY000: Unknown collation: '2048'
+set session character_set_filesystem=2048;
+ERROR 42000: Unknown character set: '2048'
+set session character_set_database=2048;
+ERROR 42000: Unknown character set: '2048'
+set session collation_connection=2048;
+ERROR HY000: Unknown collation: '2048'
+set session collation_database=2048;
+ERROR HY000: Unknown collation: '2048'
+End of 5.5 tests
+#
 # Bug#57035 'ulonglong sql_mode' stored into ulong, is risky and causes
 #           compiler warning
 #

=== modified file 'mysql-test/r/xa.result'
--- a/mysql-test/r/xa.result	2010-09-13 11:31:22 +0000
+++ b/mysql-test/r/xa.result	2011-02-14 13:16:31 +0000
@@ -142,3 +142,27 @@ XA PREPARE 'x';
 XA PREPARE 'x';
 ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the  PREPARED state
 XA ROLLBACK 'x';
+#
+# Bug#59986 Assert in Diagnostics_area::set_ok_status() for XA COMMIT
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a)) engine=InnoDB;
+INSERT INTO t1 VALUES (1, 1), (2, 2);
+# Connection con1
+XA START 'a';
+UPDATE t1 SET b= 3 WHERE a=1;
+# Connection default
+XA START 'b';
+UPDATE t1 SET b=4 WHERE a=2;
+# Sending:
+UPDATE t1 SET b=5 WHERE a=1;
+# Connection con1
+UPDATE t1 SET b=6 WHERE a=2;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+XA COMMIT 'a';
+ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
+# Connection default
+# Reaping: UPDATE t1 SET b=5 WHERE a=1
+XA END 'b';
+XA ROLLBACK 'b';
+DROP TABLE t1;

=== modified file 'mysql-test/suite/perfschema/include/event_aggregate_setup.inc'
--- a/mysql-test/suite/perfschema/include/event_aggregate_setup.inc	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/include/event_aggregate_setup.inc	2011-02-09 16:33:45 +0000
@@ -97,6 +97,9 @@ update performance_schema.setup_instrume
                  'wait/synch/rwlock/sql/LOCK_grant',
                  'wait/io/file/sql/query_log');
 
+# Start from a known clean state, to avoid noise from previous tests
+flush tables;
+flush status;
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;

=== added file 'mysql-test/suite/perfschema/r/all_tests.result'
--- a/mysql-test/suite/perfschema/r/all_tests.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/all_tests.result	2011-02-09 15:22:04 +0000
@@ -0,0 +1,21 @@
+drop table if exists t1;
+drop table if exists t2;
+create table t1 (test_name text);
+create table t2 (test_name text);
+load data infile "MYSQLTEST_VARDIR/tmp/perfschema-all_tests.txt" into table t1;
+insert into t2 select concat('ddl_', table_name, '.test') from information_schema.tables
+where table_schema='performance_schema';
+insert into t2 select concat('dml_', table_name, '.test') from information_schema.tables
+where table_schema='performance_schema';
+update t2 set test_name= replace(test_name, "events_waits_summary_", "ews_");
+update t2 set test_name= replace(test_name, "events_stages_summary_", "esgs_");
+update t2 set test_name= replace(test_name, "events_statements_summary_", "esms_");
+update t2 set test_name= replace(test_name, "file_summary_", "fs_");
+update t2 set test_name= replace(test_name, "objects_summary_", "os_");
+update t2 set test_name= replace(test_name, "table_io_waits_summary_", "tiws_");
+update t2 set test_name= replace(test_name, "table_lock_waits_summary_", "tlws_");
+delete from t2 where t2.test_name in (select t1.test_name from t1);
+select test_name as `MISSING DDL/DML TESTS` from t2;
+MISSING DDL/DML TESTS
+drop table t1;
+drop table t2;

=== added file 'mysql-test/suite/perfschema/r/ddl_threads.result'
--- a/mysql-test/suite/perfschema/r/ddl_threads.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/ddl_threads.result	2011-02-09 15:22:04 +0000
@@ -0,0 +1,8 @@
+alter table performance_schema.threads add column foo integer;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+truncate table performance_schema.threads;
+ERROR HY000: Invalid performance_schema usage.
+ALTER TABLE performance_schema.threads ADD INDEX test_index(PROCESSLIST_ID);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+CREATE UNIQUE INDEX test_index ON performance_schema.threads(PROCESSLIST_ID);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'

=== removed file 'mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result'
--- a/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result	2010-12-01 18:46:51 +0000
+++ b/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result	1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
-select * from performance_schema.file_summary_by_event_name
-where event_name like 'Wait/io/%' limit 1;
-select * from performance_schema.file_summary_by_event_name
-where event_name='FOO';
-insert into performance_schema.file_summary_by_event_name
-set event_name='FOO', count_read=1, count_write=2,
-sum_number_of_bytes_read=4, sum_number_of_bytes_write=5;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
-update performance_schema.file_summary_by_event_name
-set count_read=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
-update performance_schema.file_summary_by_event_name
-set count_write=12 where event_name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
-delete from performance_schema.file_summary_by_event_name
-where count_read=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
-delete from performance_schema.file_summary_by_event_name;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
-LOCK TABLES performance_schema.file_summary_by_event_name READ;
-ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
-UNLOCK TABLES;
-LOCK TABLES performance_schema.file_summary_by_event_name WRITE;
-ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
-UNLOCK TABLES;

=== removed file 'mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result'
--- a/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result	2010-12-01 18:46:51 +0000
+++ b/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result	1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
-select * from performance_schema.file_summary_by_instance
-where event_name like 'Wait/io/%' limit 1;
-select * from performance_schema.file_summary_by_instance
-where event_name='FOO';
-insert into performance_schema.file_summary_by_instance
-set event_name='FOO', count_read=1, count_write=2,
-sum_number_of_bytes_read=4, sum_number_of_bytes_write=5;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
-update performance_schema.file_summary_by_instance
-set count_read=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
-update performance_schema.file_summary_by_instance
-set count_write=12 where event_name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
-delete from performance_schema.file_summary_by_instance
-where count_read=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
-delete from performance_schema.file_summary_by_instance;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
-LOCK TABLES performance_schema.file_summary_by_instance READ;
-ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
-UNLOCK TABLES;
-LOCK TABLES performance_schema.file_summary_by_instance WRITE;
-ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
-UNLOCK TABLES;

=== added file 'mysql-test/suite/perfschema/r/dml_fs_by_event_name.result'
--- a/mysql-test/suite/perfschema/r/dml_fs_by_event_name.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/dml_fs_by_event_name.result	2011-02-09 15:22:04 +0000
@@ -0,0 +1,25 @@
+select * from performance_schema.file_summary_by_event_name
+where event_name like 'Wait/io/%' limit 1;
+select * from performance_schema.file_summary_by_event_name
+where event_name='FOO';
+insert into performance_schema.file_summary_by_event_name
+set event_name='FOO', count_read=1, count_write=2,
+sum_number_of_bytes_read=4, sum_number_of_bytes_write=5;
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
+update performance_schema.file_summary_by_event_name
+set count_read=12;
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
+update performance_schema.file_summary_by_event_name
+set count_write=12 where event_name like "FOO";
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
+delete from performance_schema.file_summary_by_event_name
+where count_read=1;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
+delete from performance_schema.file_summary_by_event_name;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
+LOCK TABLES performance_schema.file_summary_by_event_name READ;
+ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
+UNLOCK TABLES;
+LOCK TABLES performance_schema.file_summary_by_event_name WRITE;
+ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'file_summary_by_event_name'
+UNLOCK TABLES;

=== added file 'mysql-test/suite/perfschema/r/dml_fs_by_instance.result'
--- a/mysql-test/suite/perfschema/r/dml_fs_by_instance.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/dml_fs_by_instance.result	2011-02-09 15:22:04 +0000
@@ -0,0 +1,25 @@
+select * from performance_schema.file_summary_by_instance
+where event_name like 'Wait/io/%' limit 1;
+select * from performance_schema.file_summary_by_instance
+where event_name='FOO';
+insert into performance_schema.file_summary_by_instance
+set event_name='FOO', count_read=1, count_write=2,
+sum_number_of_bytes_read=4, sum_number_of_bytes_write=5;
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
+update performance_schema.file_summary_by_instance
+set count_read=12;
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
+update performance_schema.file_summary_by_instance
+set count_write=12 where event_name like "FOO";
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
+delete from performance_schema.file_summary_by_instance
+where count_read=1;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
+delete from performance_schema.file_summary_by_instance;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
+LOCK TABLES performance_schema.file_summary_by_instance READ;
+ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
+UNLOCK TABLES;
+LOCK TABLES performance_schema.file_summary_by_instance WRITE;
+ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'file_summary_by_instance'
+UNLOCK TABLES;

=== added file 'mysql-test/suite/perfschema/t/all_tests.test'
--- a/mysql-test/suite/perfschema/t/all_tests.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/all_tests.test	2011-02-09 15:22:04 +0000
@@ -0,0 +1,78 @@
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+--source include/not_embedded.inc
+
+#
+# Test based on mysql-test/suite/sys_vars/all_vars.test,
+# and adapted for the performance schema tables.
+#
+# This test verifies that *all* performance schema tables are tested
+# by the perfschema test suite.
+# In particular, every table there must be covered by:
+# - a ddl_<table_name>.test file.
+# - a dml_<table_name>.test file.
+#
+
+#
+# we can diff in perl or in sql, as it's my_SQL_test suite, do it in sql
+#
+
+perl;
+  use File::Basename;
+  my $dirname=dirname($ENV{MYSQLTEST_FILE});
+  my @all_tests=<$dirname/*.test>;
+  open(F, '>', "$ENV{MYSQLTEST_VARDIR}/tmp/perfschema-all_tests.txt") or die;
+  binmode F;
+  print F join "\n", sort map { basename $_ } @all_tests;
+EOF
+
+--disable_warnings
+drop table if exists t1;
+drop table if exists t2;
+--enable_warnings
+
+create table t1 (test_name text);
+create table t2 (test_name text);
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval load data infile "$MYSQLTEST_VARDIR/tmp/perfschema-all_tests.txt" into table t1;
+
+insert into t2 select concat('ddl_', table_name, '.test') from information_schema.tables
+  where table_schema='performance_schema';
+insert into t2 select concat('dml_', table_name, '.test') from information_schema.tables
+  where table_schema='performance_schema';
+
+# Abbreviations used for naming test files:
+update t2 set test_name= replace(test_name, "events_waits_summary_", "ews_");
+update t2 set test_name= replace(test_name, "events_stages_summary_", "esgs_");
+update t2 set test_name= replace(test_name, "events_statements_summary_", "esms_");
+update t2 set test_name= replace(test_name, "file_summary_", "fs_");
+update t2 set test_name= replace(test_name, "objects_summary_", "os_");
+update t2 set test_name= replace(test_name, "table_io_waits_summary_", "tiws_");
+update t2 set test_name= replace(test_name, "table_lock_waits_summary_", "tlws_");
+
+# Debug
+# select test_name as 'FOUND' from t1;
+# select test_name as 'EXPECTED' from t2;
+
+delete from t2 where t2.test_name in (select t1.test_name from t1);
+
+# If this fails, the test listed in the output is missing from the test suite.
+# The way to fix the failure is to implement the missing test, not silence this select.
+select test_name as `MISSING DDL/DML TESTS` from t2;
+
+drop table t1;
+drop table t2;
+

=== added file 'mysql-test/suite/perfschema/t/ddl_threads.test'
--- a/mysql-test/suite/perfschema/t/ddl_threads.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_threads.test	2011-02-09 15:22:04 +0000
@@ -0,0 +1,32 @@
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+-- error ER_DBACCESS_DENIED_ERROR
+alter table performance_schema.threads add column foo integer;
+
+-- error ER_WRONG_PERFSCHEMA_USAGE
+truncate table performance_schema.threads;
+
+-- error ER_DBACCESS_DENIED_ERROR
+ALTER TABLE performance_schema.threads ADD INDEX test_index(PROCESSLIST_ID);
+
+-- error ER_DBACCESS_DENIED_ERROR
+CREATE UNIQUE INDEX test_index ON performance_schema.threads(PROCESSLIST_ID);
+

=== removed file 'mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test'
--- a/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test	2010-12-01 18:46:51 +0000
+++ b/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test	1970-01-01 00:00:00 +0000
@@ -1,56 +0,0 @@
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# 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,
-# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
---disable_result_log
-select * from performance_schema.file_summary_by_event_name
-  where event_name like 'Wait/io/%' limit 1;
-
-select * from performance_schema.file_summary_by_event_name
-  where event_name='FOO';
---enable_result_log
-
---error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.file_summary_by_event_name
-  set event_name='FOO', count_read=1, count_write=2,
-  sum_number_of_bytes_read=4, sum_number_of_bytes_write=5;
-
---error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.file_summary_by_event_name
-  set count_read=12;
-
---error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.file_summary_by_event_name
-  set count_write=12 where event_name like "FOO";
-
---error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.file_summary_by_event_name
-  where count_read=1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.file_summary_by_event_name;
-
--- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.file_summary_by_event_name READ;
-UNLOCK TABLES;
-
--- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.file_summary_by_event_name WRITE;
-UNLOCK TABLES;
-

=== removed file 'mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test'
--- a/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test	2010-12-01 18:46:51 +0000
+++ b/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test	1970-01-01 00:00:00 +0000
@@ -1,56 +0,0 @@
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# 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,
-# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
---disable_result_log
-select * from performance_schema.file_summary_by_instance
-  where event_name like 'Wait/io/%' limit 1;
-
-select * from performance_schema.file_summary_by_instance
-  where event_name='FOO';
---enable_result_log
-
---error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.file_summary_by_instance
-  set event_name='FOO', count_read=1, count_write=2,
-  sum_number_of_bytes_read=4, sum_number_of_bytes_write=5;
-
---error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.file_summary_by_instance
-  set count_read=12;
-
---error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.file_summary_by_instance
-  set count_write=12 where event_name like "FOO";
-
---error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.file_summary_by_instance
-  where count_read=1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.file_summary_by_instance;
-
--- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.file_summary_by_instance READ;
-UNLOCK TABLES;
-
--- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.file_summary_by_instance WRITE;
-UNLOCK TABLES;
-

=== added file 'mysql-test/suite/perfschema/t/dml_fs_by_event_name.test'
--- a/mysql-test/suite/perfschema/t/dml_fs_by_event_name.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/dml_fs_by_event_name.test	2011-02-09 15:22:04 +0000
@@ -0,0 +1,56 @@
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+--disable_result_log
+select * from performance_schema.file_summary_by_event_name
+  where event_name like 'Wait/io/%' limit 1;
+
+select * from performance_schema.file_summary_by_event_name
+  where event_name='FOO';
+--enable_result_log
+
+--error ER_TABLEACCESS_DENIED_ERROR
+insert into performance_schema.file_summary_by_event_name
+  set event_name='FOO', count_read=1, count_write=2,
+  sum_number_of_bytes_read=4, sum_number_of_bytes_write=5;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+update performance_schema.file_summary_by_event_name
+  set count_read=12;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+update performance_schema.file_summary_by_event_name
+  set count_write=12 where event_name like "FOO";
+
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.file_summary_by_event_name
+  where count_read=1;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.file_summary_by_event_name;
+
+-- error ER_TABLEACCESS_DENIED_ERROR
+LOCK TABLES performance_schema.file_summary_by_event_name READ;
+UNLOCK TABLES;
+
+-- error ER_TABLEACCESS_DENIED_ERROR
+LOCK TABLES performance_schema.file_summary_by_event_name WRITE;
+UNLOCK TABLES;
+

=== added file 'mysql-test/suite/perfschema/t/dml_fs_by_instance.test'
--- a/mysql-test/suite/perfschema/t/dml_fs_by_instance.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/dml_fs_by_instance.test	2011-02-09 15:22:04 +0000
@@ -0,0 +1,56 @@
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+--disable_result_log
+select * from performance_schema.file_summary_by_instance
+  where event_name like 'Wait/io/%' limit 1;
+
+select * from performance_schema.file_summary_by_instance
+  where event_name='FOO';
+--enable_result_log
+
+--error ER_TABLEACCESS_DENIED_ERROR
+insert into performance_schema.file_summary_by_instance
+  set event_name='FOO', count_read=1, count_write=2,
+  sum_number_of_bytes_read=4, sum_number_of_bytes_write=5;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+update performance_schema.file_summary_by_instance
+  set count_read=12;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+update performance_schema.file_summary_by_instance
+  set count_write=12 where event_name like "FOO";
+
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.file_summary_by_instance
+  where count_read=1;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.file_summary_by_instance;
+
+-- error ER_TABLEACCESS_DENIED_ERROR
+LOCK TABLES performance_schema.file_summary_by_instance READ;
+UNLOCK TABLES;
+
+-- error ER_TABLEACCESS_DENIED_ERROR
+LOCK TABLES performance_schema.file_summary_by_instance WRITE;
+UNLOCK TABLES;
+

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_cond_class-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_cond_class-master.opt	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_cond_class-master.opt	2011-02-09 15:22:04 +0000
@@ -1 +1,2 @@
---loose-enable-performance-schema --loose-performance_schema_max_cond_classes=0
+--loose-enable-performance-schema
+--loose-performance_schema_max_cond_classes=0

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_cond_inst-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_cond_inst-master.opt	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_cond_inst-master.opt	2011-02-09 15:22:04 +0000
@@ -1 +1,2 @@
---loose-enable-performance-schema --loose-performance_schema_max_cond_instances=0
+--loose-enable-performance-schema
+--loose-performance_schema_max_cond_instances=0

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_file_class-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_file_class-master.opt	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_file_class-master.opt	2011-02-09 15:22:04 +0000
@@ -1 +1,2 @@
---loose-enable-performance-schema --loose-performance_schema_max_file_classes=0
+--loose-enable-performance-schema
+--loose-performance_schema_max_file_classes=0

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_file_inst-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_file_inst-master.opt	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_file_inst-master.opt	2011-02-09 15:22:04 +0000
@@ -1 +1,2 @@
---loose-enable-performance-schema --loose-performance_schema_max_file_instances=0
+--loose-enable-performance-schema
+--loose-performance_schema_max_file_instances=0

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_mutex_class-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_mutex_class-master.opt	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_class-master.opt	2011-02-09 15:22:04 +0000
@@ -1 +1,2 @@
---loose-enable-performance-schema --loose-performance_schema_max_mutex_classes=0
+--loose-enable-performance-schema
+--loose-performance_schema_max_mutex_classes=0

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_mutex_inst-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_mutex_inst-master.opt	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_mutex_inst-master.opt	2011-02-09 15:22:04 +0000
@@ -1 +1,2 @@
---loose-enable-performance-schema --loose-performance_schema_max_mutex_instances=0
+--loose-enable-performance-schema
+--loose-performance_schema_max_mutex_instances=0

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_rwlock_class-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_rwlock_class-master.opt	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_class-master.opt	2011-02-09 15:22:04 +0000
@@ -1 +1,2 @@
---loose-enable-performance-schema --loose-performance_schema_max_rwlock_classes=0
+--loose-enable-performance-schema
+--loose-performance_schema_max_rwlock_classes=0

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_rwlock_inst-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst-master.opt	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_rwlock_inst-master.opt	2011-02-09 15:22:04 +0000
@@ -1 +1,2 @@
---loose-enable-performance-schema --loose-performance_schema_max_rwlock_instances=0
+--loose-enable-performance-schema
+--loose-performance_schema_max_rwlock_instances=0

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_table_hdl-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_table_hdl-master.opt	2010-05-17 10:05:47 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_table_hdl-master.opt	2011-02-09 15:22:04 +0000
@@ -1 +1,2 @@
---loose-enable-performance-schema --loose-performance_schema_max_table_handles=0
+--loose-enable-performance-schema
+--loose-performance_schema_max_table_handles=0

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_table_inst-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_table_inst-master.opt	2010-05-17 10:05:47 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_table_inst-master.opt	2011-02-09 15:22:04 +0000
@@ -1 +1,2 @@
---loose-enable-performance-schema --loose-performance_schema_max_table_instances=0
+--loose-enable-performance-schema
+--loose-performance_schema_max_table_instances=0

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_thread_class-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_thread_class-master.opt	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_thread_class-master.opt	2011-02-09 15:22:04 +0000
@@ -1 +1,2 @@
---loose-enable-performance-schema --loose-performance_schema_max_thread_classes=0
+--loose-enable-performance-schema
+--loose-performance_schema_max_thread_classes=0

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_thread_inst-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_thread_inst-master.opt	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_thread_inst-master.opt	2011-02-09 15:22:04 +0000
@@ -1 +1,2 @@
---loose-enable-performance-schema --loose-performance_schema_max_thread_instances=0
+--loose-enable-performance-schema
+--loose-performance_schema_max_thread_instances=0

=== modified file 'mysql-test/suite/rpl/r/rpl_row_event_max_size.result'
--- a/mysql-test/suite/rpl/r/rpl_row_event_max_size.result	2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_event_max_size.result	2011-02-10 10:33:25 +0000
@@ -65,7 +65,5 @@ include/wait_for_slave_io_error.inc [err
 Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master''
 ==== clean up ====
 include/stop_slave_sql.inc
-Warnings:
-Note	1255	Slave already has been stopped
 RESET SLAVE;
 include/rpl_end.inc

=== modified file 'mysql-test/t/variables.test'
--- a/mysql-test/t/variables.test	2011-02-02 18:31:39 +0000
+++ b/mysql-test/t/variables.test	2011-02-10 08:52:44 +0000
@@ -1467,6 +1467,32 @@ drop function t1_max;
 
 
 --echo #
+--echo # Bug #59884: setting charset to 2048 crashes
+--echo #
+
+--error ER_UNKNOWN_CHARACTER_SET
+set session character_set_results = 2048;
+--error ER_UNKNOWN_CHARACTER_SET
+set session character_set_client=2048;
+--error ER_UNKNOWN_CHARACTER_SET
+set session character_set_connection=2048;
+--error ER_UNKNOWN_CHARACTER_SET
+set session character_set_server=2048;
+--error ER_UNKNOWN_COLLATION
+set session collation_server=2048;
+--error ER_UNKNOWN_CHARACTER_SET
+set session character_set_filesystem=2048;
+--error ER_UNKNOWN_CHARACTER_SET
+set session character_set_database=2048;
+--error ER_UNKNOWN_COLLATION
+set session collation_connection=2048;
+--error ER_UNKNOWN_COLLATION
+set session collation_database=2048;
+
+--echo End of 5.5 tests
+
+
+--echo #
 --echo # Bug#57035 'ulonglong sql_mode' stored into ulong, is risky and causes
 --echo #           compiler warning
 --echo #

=== modified file 'mysql-test/t/xa.test'
--- a/mysql-test/t/xa.test	2010-09-13 11:31:22 +0000
+++ b/mysql-test/t/xa.test	2011-02-14 13:16:31 +0000
@@ -245,6 +245,48 @@ XA PREPARE 'x';
 XA ROLLBACK 'x';
 
 
+--echo #
+--echo # Bug#59986 Assert in Diagnostics_area::set_ok_status() for XA COMMIT
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a)) engine=InnoDB;
+INSERT INTO t1 VALUES (1, 1), (2, 2);
+
+--echo # Connection con1
+connect (con1, localhost, root);
+XA START 'a';
+UPDATE t1 SET b= 3 WHERE a=1;
+
+--echo # Connection default
+connection default;
+XA START 'b';
+UPDATE t1 SET b=4 WHERE a=2;
+--echo # Sending:
+--send UPDATE t1 SET b=5 WHERE a=1
+
+--echo # Connection con1
+connection con1;
+--sleep 1
+--error ER_LOCK_DEADLOCK
+UPDATE t1 SET b=6 WHERE a=2;
+# This used to trigger the assert
+--error ER_XA_RBDEADLOCK
+XA COMMIT 'a';
+
+--echo # Connection default
+connection default;
+--echo # Reaping: UPDATE t1 SET b=5 WHERE a=1
+--reap
+XA END 'b';
+XA ROLLBACK 'b';
+DROP TABLE t1;
+disconnect con1;
+
+
 # Wait till all disconnects are completed
 --source include/wait_until_count_sessions.inc
 

=== modified file 'mysys/charset.c'
--- a/mysys/charset.c	2010-12-20 10:28:06 +0000
+++ b/mysys/charset.c	2011-02-10 08:52:44 +0000
@@ -472,6 +472,7 @@ CHARSET_INFO *default_charset_info = &my
 
 void add_compiled_collation(CHARSET_INFO *cs)
 {
+  DBUG_ASSERT(cs->number < array_elements(all_charsets));
   all_charsets[cs->number]= cs;
   cs->state|= MY_CS_AVAILABLE;
 }
@@ -579,14 +580,17 @@ uint get_charset_number(const char *char
 
 const char *get_charset_name(uint charset_number)
 {
-  CHARSET_INFO *cs;
   my_pthread_once(&charsets_initialized, init_available_charsets);
 
-  cs=all_charsets[charset_number];
-  if (cs && (cs->number == charset_number) && cs->name )
-    return (char*) cs->name;
+  if (charset_number < array_elements(all_charsets))
+  {
+    CHARSET_INFO *cs= all_charsets[charset_number];
+
+    if (cs && (cs->number == charset_number) && cs->name)
+      return (char*) cs->name;
+  }
   
-  return (char*) "?";   /* this mimics find_type() */
+  return "?";   /* this mimics find_type() */
 }
 
 
@@ -596,6 +600,8 @@ get_internal_charset(MY_CHARSET_LOADER *
   char  buf[FN_REFLEN];
   CHARSET_INFO *cs;
 
+  DBUG_ASSERT(cs_number < array_elements(all_charsets));
+
   if ((cs= all_charsets[cs_number]))
   {
     if (cs->state & MY_CS_READY)  /* if CS is already initialized */
@@ -646,8 +652,8 @@ CHARSET_INFO *get_charset(uint cs_number
     return default_charset_info;
 
   my_pthread_once(&charsets_initialized, init_available_charsets);
-  
-  if (!cs_number || cs_number > array_elements(all_charsets))
+ 
+  if (cs_number >= array_elements(all_charsets)) 
     return NULL;
 
   my_charset_loader_init_mysys(&loader);

=== modified file 'plugin/auth/auth_socket.c'
--- a/plugin/auth/auth_socket.c	2010-09-20 16:38:27 +0000
+++ b/plugin/auth/auth_socket.c	2011-01-11 14:53:14 +0000
@@ -79,7 +79,7 @@ mysql_declare_plugin(socket_auth)
 {
   MYSQL_AUTHENTICATION_PLUGIN,
   &socket_auth_handler,
-  "socket_peercred",
+  "auth_socket",
   "Sergei Golubchik",
   "Unix Socket based authentication",
   PLUGIN_LICENSE_GPL,

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2011-01-17 12:35:58 +0000
+++ b/sql/item_strfunc.cc	2011-02-10 08:47:05 +0000
@@ -71,7 +71,7 @@ String my_empty_string("",default_charse
   Normally conversion does not happen, and val_str_ascii() is immediately
   returned instead.
 */
-String *Item_str_ascii_func::val_str(String *str)
+String *Item_str_func::val_str_from_val_str_ascii(String *str, String *str2)
 {
   DBUG_ASSERT(fixed == 1);
 
@@ -83,19 +83,19 @@ String *Item_str_ascii_func::val_str(Str
     return res;
   }
   
-  DBUG_ASSERT(str != &ascii_buf);
+  DBUG_ASSERT(str != str2);
   
   uint errors;
-  String *res= val_str_ascii(&ascii_buf);
+  String *res= val_str_ascii(str);
   if (!res)
     return 0;
   
-  if ((null_value= str->copy(res->ptr(), res->length(),
-                             &my_charset_latin1, collation.collation,
-                             &errors)))
+  if ((null_value= str2->copy(res->ptr(), res->length(),
+                              &my_charset_latin1, collation.collation,
+                              &errors)))
     return 0;
   
-  return str;
+  return str2;
 }
 
 

=== modified file 'sql/item_strfunc.h'
--- a/sql/item_strfunc.h	2011-02-07 23:54:23 +0000
+++ b/sql/item_strfunc.h	2011-02-10 08:47:05 +0000
@@ -51,6 +51,7 @@ public:
   enum Item_result result_type () const { return STRING_RESULT; }
   void left_right_max_length();
   bool fix_fields(THD *thd, Item **ref);
+  String *val_str_from_val_str_ascii(String *str, String *str2);
 };
 
 
@@ -66,8 +67,10 @@ public:
   Item_str_ascii_func(Item *a) :Item_str_func(a) {}
   Item_str_ascii_func(Item *a,Item *b) :Item_str_func(a,b) {}
   Item_str_ascii_func(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
-  String *val_str_convert_from_ascii(String *str, String *ascii_buf);
-  String *val_str(String *str);
+  String *val_str(String *str)
+  {
+    return val_str_from_val_str_ascii(str, &ascii_buf);
+  }
   virtual String *val_str_ascii(String *)= 0;
 };
 

=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc	2010-12-16 18:18:20 +0000
+++ b/sql/item_timefunc.cc	2011-02-10 08:47:05 +0000
@@ -2205,8 +2205,6 @@ void Item_date_add_interval::fix_length_
   enum_field_types arg0_field_type;
 
   maybe_null=1;
-  fix_length_and_charset_datetime(MAX_DATETIME_FULL_WIDTH);
-  value.alloc(max_length);
 
   /*
     The field type for the result of an Item_date function is defined as
@@ -2231,6 +2229,21 @@ void Item_date_add_interval::fix_length_
     else
       cached_field_type= MYSQL_TYPE_DATETIME;
   }
+
+  if (cached_field_type == MYSQL_TYPE_STRING)
+  {
+    /* Behave as a usual string function when return type is VARCHAR. */
+    fix_length_and_charset(MAX_DATETIME_FULL_WIDTH, default_charset());
+  }
+  else
+  {
+    /*
+      Follow the "Number-to-string conversion" rules as in WorkLog 2649
+      when return type is DATE or DATETIME.
+    */
+    fix_length_and_charset_datetime(MAX_DATETIME_FULL_WIDTH);
+  }
+  value.alloc(max_length);
 }
 
 
@@ -2253,7 +2266,7 @@ bool Item_date_add_interval::get_date(MY
 }
 
 
-String *Item_date_add_interval::val_str(String *str)
+String *Item_date_add_interval::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
   MYSQL_TIME ltime;

=== modified file 'sql/item_timefunc.h'
--- a/sql/item_timefunc.h	2011-01-28 13:49:59 +0000
+++ b/sql/item_timefunc.h	2011-02-10 08:47:05 +0000
@@ -773,16 +773,32 @@ class Item_date_add_interval :public Ite
 {
   String value;
   enum_field_types cached_field_type;
-
+  String ascii_buf;
 public:
   const interval_type int_type; // keep it public
   const bool date_sub_interval; // keep it public
   Item_date_add_interval(Item *a,Item *b,interval_type type_arg,bool neg_arg)
     :Item_date_func(a,b),int_type(type_arg), date_sub_interval(neg_arg) {}
-  String *val_str(String *);
+  String *val_str_ascii(String *str);
+  String *val_str(String *str)
+  {
+    return val_str_from_val_str_ascii(str, &ascii_buf);
+  }
   const char *func_name() const { return "date_add_interval"; }
   void fix_length_and_dec();
   enum_field_types field_type() const { return cached_field_type; }
+  CHARSET_INFO *charset_for_protocol(void) const
+  {
+    /*
+      DATE_ADD() can return DATE, DATETIME or VARCHAR depending on arguments.
+      Send using "binary" when DATE or DATETIME,
+      or using collation.collation when VARCHAR
+      (which was fixed from @collation_connection in fix_length_and_dec).
+    */
+    DBUG_ASSERT(fixed == 1);
+    return cached_field_type == MYSQL_TYPE_STRING ?
+                                collation.collation : &my_charset_bin;
+  }
   longlong val_int();
   bool get_date(MYSQL_TIME *res, uint fuzzy_date);
   bool eq(const Item *item, bool binary_cmp) const;

=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc	2011-01-12 16:05:45 +0000
+++ b/sql/sql_load.cc	2011-02-10 10:52:39 +0000
@@ -402,10 +402,9 @@ int mysql_load(THD *thd,sql_exchange *ex
 
     // if we are not in slave thread, the file must be:
     if (!thd->slave_thread &&
-	      !((stat_info.st_mode & S_IROTH) == S_IROTH &&  // readable by others
-	        (stat_info.st_mode & S_IFLNK) != S_IFLNK && // and not a symlink
-	        ((stat_info.st_mode & S_IFREG) == S_IFREG ||
-	         (stat_info.st_mode & S_IFIFO) == S_IFIFO)))
+        !((stat_info.st_mode & S_IFLNK) != S_IFLNK &&   // symlink
+          ((stat_info.st_mode & S_IFREG) == S_IFREG ||  // regular file
+           (stat_info.st_mode & S_IFIFO) == S_IFIFO)))  // named pipe
     {
 	    my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), name);
 	    DBUG_RETURN(TRUE);

=== modified file 'sql/transaction.cc'
--- a/sql/transaction.cc	2010-11-18 16:34:56 +0000
+++ b/sql/transaction.cc	2011-02-14 14:15:28 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008 Sun/MySQL
+/* 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
@@ -635,8 +635,9 @@ bool trans_xa_commit(THD *thd)
 
   if (xa_trans_rolled_back(&thd->transaction.xid_state))
   {
-    if ((res= test(ha_rollback_trans(thd, TRUE))))
+    if (ha_rollback_trans(thd, TRUE))
       my_error(ER_XAER_RMERR, MYF(0));
+    res= thd->is_error();
   }
   else if (xa_state == XA_IDLE && thd->lex->xa_opt == XA_ONE_PHASE)
   {

=== removed file 'storage/perfschema/unittest/stub_server_misc.h.moved'
--- a/storage/perfschema/unittest/stub_server_misc.h.moved	2010-12-02 15:05:07 +0000
+++ b/storage/perfschema/unittest/stub_server_misc.h.moved	1970-01-01 00:00:00 +0000
@@ -1,21 +0,0 @@
-/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; version 2 of the License.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-/*
-  Minimal code to be able to link a unit test.
-*/
-
-volatile bool ready_to_exit= false;
-

=== modified file 'support-files/mysql.spec.sh'
--- a/support-files/mysql.spec.sh	2010-12-29 00:38:59 +0000
+++ b/support-files/mysql.spec.sh	2011-02-09 13:34:44 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -523,10 +523,27 @@ rm -f $RBR%{_mandir}/man1/make_win_bin_d
 ##############################################################################
 
 %pre -n MySQL-server%{product_suffix}
+# This is the code running at the beginning of a RPM upgrade action,
+# before replacing the old files with the new ones.
 
 # ATTENTION: Parts of this are duplicated in the "triggerpostun" !
 
-mysql_datadir=%{mysqldatadir}
+# There are users who deviate from the default file system layout.
+# Check local settings to support them.
+if [ -x %{_bindir}/my_print_defaults ]
+then
+  mysql_datadir=`%{_bindir}/my_print_defaults server mysqld | grep '^--datadir=' | sed -n 's/--datadir=//p'`
+  PID_FILE_PATT=`%{_bindir}/my_print_defaults server mysqld | grep '^--pid-file=' | sed -n 's/--pid-file=//p'`
+fi
+if [ -z "$mysql_datadir" ]
+then
+  mysql_datadir=%{mysqldatadir}
+fi
+if [ -z "$PID_FILE_PATT" ]
+then
+  PID_FILE_PATT="$mysql_datadir/*.pid"
+fi
+
 # Check if we can safely upgrade.  An upgrade is only safe if it's from one
 # of our RPMs in the same version family.
 
@@ -601,7 +618,7 @@ fi
 
 # We assume that if there is exactly one ".pid" file,
 # it contains the valid PID of a running MySQL server.
-NR_PID_FILES=`ls $mysql_datadir/*.pid 2>/dev/null | wc -l`
+NR_PID_FILES=`ls $PID_FILE_PATT 2>/dev/null | wc -l`
 case $NR_PID_FILES in
 	0 ) SERVER_TO_START=''  ;;  # No "*.pid" file == no running server
 	1 ) SERVER_TO_START='true' ;;
@@ -623,8 +640,8 @@ if [ -f $STATUS_FILE ]; then
 	echo "before repeating the MySQL upgrade."
 	exit 1
 elif [ -n "$SEVERAL_PID_FILES" ] ; then
-	echo "Your MySQL directory '$mysql_datadir' has more than one PID file:"
-	ls -ld $mysql_datadir/*.pid
+	echo "You have more than one PID file:"
+	ls -ld $PID_FILE_PATT
 	echo "Please check which one (if any) corresponds to a running server"
 	echo "and delete all others before repeating the MySQL upgrade."
 	exit 1
@@ -649,17 +666,17 @@ if [ -d $mysql_datadir ] ; then
 	if [ -n "$SERVER_TO_START" ] ; then
 		# There is only one PID file, race possibility ignored
 		echo "PID file:"                           >> $STATUS_FILE
-		ls -l   $mysql_datadir/*.pid               >> $STATUS_FILE
-		cat     $mysql_datadir/*.pid               >> $STATUS_FILE
+		ls -l   $PID_FILE_PATT                     >> $STATUS_FILE
+		cat     $PID_FILE_PATT                     >> $STATUS_FILE
 		echo                                       >> $STATUS_FILE
 		echo "Server process:"                     >> $STATUS_FILE
-		ps -fp `cat $mysql_datadir/*.pid`          >> $STATUS_FILE
+		ps -fp `cat $PID_FILE_PATT`                >> $STATUS_FILE
 		echo                                       >> $STATUS_FILE
 		echo "SERVER_TO_START=$SERVER_TO_START"    >> $STATUS_FILE
 	else
 		# Take a note we checked it ...
 		echo "PID file:"                           >> $STATUS_FILE
-		ls -l   $mysql_datadir/*.pid               >> $STATUS_FILE 2>&1
+		ls -l   $PID_FILE_PATT                     >> $STATUS_FILE 2>&1
 	fi
 fi
 
@@ -674,10 +691,22 @@ if [ -x %{_sysconfdir}/init.d/mysql ] ; 
 fi
 
 %post -n MySQL-server%{product_suffix}
+# This is the code running at the end of a RPM install or upgrade action,
+# after the (new) files have been written.
 
 # ATTENTION: Parts of this are duplicated in the "triggerpostun" !
 
-mysql_datadir=%{mysqldatadir}
+# There are users who deviate from the default file system layout.
+# Check local settings to support them.
+if [ -x %{_bindir}/my_print_defaults ]
+then
+  mysql_datadir=`%{_bindir}/my_print_defaults server mysqld | grep '^--datadir=' | sed -n 's/--datadir=//p'`
+fi
+if [ -z "$mysql_datadir" ]
+then
+  mysql_datadir=%{mysqldatadir}
+fi
+
 NEW_VERSION=%{mysql_version}-%{release}
 STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER
 
@@ -855,7 +884,17 @@ fi
 #   http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch10s02.html
 # For all details of this code, see the "pre" and "post" sections.
 
-mysql_datadir=%{mysqldatadir}
+# There are users who deviate from the default file system layout.
+# Check local settings to support them.
+if [ -x %{_bindir}/my_print_defaults ]
+then
+  mysql_datadir=`%{_bindir}/my_print_defaults server mysqld | grep '^--datadir=' | sed -n 's/--datadir=//p'`
+fi
+if [ -z "$mysql_datadir" ]
+then
+  mysql_datadir=%{mysqldatadir}
+fi
+
 NEW_VERSION=%{mysql_version}-%{release}
 STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER-LAST  # Note the difference!
 STATUS_HISTORY=$mysql_datadir/RPM_UPGRADE_HISTORY
@@ -1085,6 +1124,14 @@ echo "====="                            
 # merging BK trees)
 ##############################################################################
 %changelog
+
+* Thu Feb 09 2011 Joerg Bruehe <joerg.bruehe@stripped>
+
+- Fix bug#56581: If an installation deviates from the default file locations
+  ("datadir" and "pid-file"), the mechanism to detect a running server (on upgrade)
+  should still work, and use these locations.
+  The problem was that the fix for bug#27072 did not check for local settings.
+
 * Tue Nov 23 2010 Jonathan Perkin <jonathan.perkin@stripped>
 
 - EXCEPTIONS-CLIENT has been deleted, remove it from here too

No bundle (reason: revision is a merge).
Thread
bzr commit into mysql-trunk branch (marc.alff:3207) Marc Alff14 Feb