List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:February 17 2011 11:41am
Subject:bzr commit into mysql-trunk-mtr branch (bjorn.munch:3027)
View as plain text  
#At file:///home/bm136801/my/mtr-tr/ based on revid:bjorn.munch@stripped

 3027 Bjorn Munch	2011-02-17 [merge]
      merge from trunk

    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:
      cmake/info_bin.cmake
      cmake/info_macros.cmake.in
      cmake/info_src.cmake
      mysql-test/collections/default.release
      mysql-test/collections/disabled-daily.list
      mysql-test/r/file_contents.result
      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
      mysql-test/t/file_contents.test
    modified:
      CMakeLists.txt
      README
      client/mysql.cc
      client/readline.cc
      client/sql_string.cc
      client/sql_string.h
      cmake/cpack_source_ignore_files.cmake
      cmake/make_dist.cmake.in
      extra/comp_err.c
      include/m_ctype.h
      include/my_bit.h
      include/my_bitmap.h
      mysql-test/CMakeLists.txt
      mysql-test/collections/default.daily
      mysql-test/collections/default.experimental
      mysql-test/extra/rpl_tests/rpl_conflicts.test
      mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
      mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
      mysql-test/include/check-testcase.test
      mysql-test/include/ctype_numconv.inc
      mysql-test/include/wait_for_slave_io_error.inc
      mysql-test/include/wait_for_slave_sql_error.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/gis.result
      mysql-test/r/innodb_icp_all.result
      mysql-test/r/insert_select.result
      mysql-test/r/join_outer_jcl6.result
      mysql-test/r/myisam_icp_all.result
      mysql-test/r/ps.result
      mysql-test/r/range_all.result
      mysql-test/r/select_safe.result
      mysql-test/r/signal_code.result
      mysql-test/r/sp-code.result
      mysql-test/r/sp-error.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/trigger.result
      mysql-test/r/variables.result
      mysql-test/r/xa.result
      mysql-test/suite/perfschema/include/event_aggregate_setup.inc
      mysql-test/suite/perfschema/include/table_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_binlog_corruption.result
      mysql-test/suite/rpl/r/rpl_checksum.result
      mysql-test/suite/rpl/r/rpl_row_conflicts.result
      mysql-test/suite/rpl/r/rpl_row_event_max_size.result
      mysql-test/suite/rpl/r/rpl_show_errors.result
      mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
      mysql-test/suite/rpl/r/rpl_stm_conflicts.result
      mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
      mysql-test/suite/rpl/t/disabled.def
      mysql-test/suite/rpl/t/rpl_binlog_corruption.test
      mysql-test/suite/rpl/t/rpl_checksum.test
      mysql-test/suite/rpl/t/rpl_show_errors.test
      mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
      mysql-test/suite/sys_vars/r/max_join_size_func.result
      mysql-test/suite/sys_vars/r/sql_big_selects_func.result
      mysql-test/t/gis.test
      mysql-test/t/insert_select.test
      mysql-test/t/ps.test
      mysql-test/t/sp-error.test
      mysql-test/t/trigger.test
      mysql-test/t/variables.test
      mysql-test/t/xa.test
      mysys/charset.c
      mysys/my_bitmap.c
      plugin/auth/auth_socket.c
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/item_timefunc.cc
      sql/item_timefunc.h
      sql/log.cc
      sql/mysqld.cc
      sql/rpl_master.cc
      sql/rpl_slave.cc
      sql/rpl_slave.h
      sql/share/errmsg-utf8.txt
      sql/sp_head.cc
      sql/sql_cmd.h
      sql/sql_lex.h
      sql/sql_load.cc
      sql/sql_parse.cc
      sql/sql_string.cc
      sql/sql_string.h
      sql/sql_yacc.yy
      sql/transaction.cc
      storage/myisam/mi_create.c
      strings/ctype.c
      support-files/mysql.spec.sh
      unittest/mysys/bitmap-t.c
=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt	2010-12-15 23:10:37 +0000
+++ b/CMakeLists.txt	2011-02-14 12:28:39 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 
+# Copyright (c) 2006, 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
@@ -329,6 +329,24 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/inclu
                ${CMAKE_BINARY_DIR}/include/mysql_version.h )
 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
     ${CMAKE_BINARY_DIR}/sql/sql_builtin.cc)
+CONFIGURE_FILE(
+    ${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in ${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)
+
+# Handle the "INFO_*" files.
+INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)
+# Source: This can be done during the cmake phase, all information is
+# available, but should be repeated on each "make" just in case someone
+# does "cmake ; make ; bzr pull ; make".
+CREATE_INFO_SRC(${CMAKE_BINARY_DIR}/Docs)
+ADD_CUSTOM_TARGET(INFO_SRC ALL
+  COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/info_src.cmake
+  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+)
+# Build flags: This must be postponed to the make phase.
+ADD_CUSTOM_TARGET(INFO_BIN ALL
+  COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/info_bin.cmake
+  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+)
 
 # Packaging
 IF(WIN32)
@@ -356,6 +374,7 @@ IF(NOT INSTALL_LAYOUT MATCHES "RPM")
   OPTIONAL
   )
   INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme)
+  INSTALL(FILES ${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN DESTINATION ${INSTALL_DOCDIR})
   IF(UNIX)
     INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme)
   ENDIF()

=== modified file 'README'
--- a/README	2011-02-08 15:54:12 +0000
+++ b/README	2011-02-16 22:48:13 +0000
@@ -3,18 +3,29 @@ MySQL Server
 This is a release of MySQL, a dual-license SQL database server.
 For the avoidance of doubt, this particular copy of the software 
 is released under the version 2 of the GNU General Public License. 
-MySQL is brought to you by the MySQL team at Oracle.
+MySQL is brought to you by Oracle.
 
 Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
 License information can be found in the COPYING file.
 
+MySQL FOSS License Exception
+We want free and open source software applications under certain
+licenses to be able to use specified GPL-licensed MySQL client
+libraries despite the fact that not all such FOSS licenses are
+compatible with version 2 of the GNU General Public License.  
+Therefore there are special exceptions to the terms and conditions 
+of the GPLv2 as applied to these client libraries, which are 
+identified and described in more detail in the FOSS License 
+Exception at 
+<http://www.mysql.com/about/legal/licensing/foss-exception.html>.
+
 This distribution may include materials developed by third
 parties. For license and attribution notices for these
 materials, please refer to the documentation that accompanies
-this distribution (see the Licenses for Third-Party Components
-appendix). A copy of the license/notices is also reproduced 
-below. 
+this distribution (see the "Licenses for Third-Party Components"
+appendix) or view the online documentation at 
+<http://dev.mysql.com/doc/>.
 
 GPLv2 Disclaimer
 For the avoidance of doubt, except that if any license choice
@@ -38,8 +49,6 @@ Some Reference Manual sections of specia
   chapter.
 - For the new features/bugfix history, see the MySQL Change History 
   appendix.
-- For currently known bugs, see the Errors and Common Problems
-  appendix.
 
 You can browse the MySQL Reference Manual online or download it 
 in any of several formats at the URL given earlier in this file.

=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	2011-02-05 05:06:29 +0000
+++ b/client/mysql.cc	2011-02-15 12:38:39 +0000
@@ -1128,6 +1128,8 @@ int main(int argc,char *argv[])
   if (status.batch && !status.line_buff &&
       !(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin)))
   {
+    put_info("Can't initialize batch_readline - may be the input source is "
+             "a directory or a block device.", INFO_ERROR, 0);
     free_defaults(defaults_argv);
     my_end(0);
     exit(1);
@@ -4310,7 +4312,7 @@ sql_real_connect(char *host,char *databa
   {
     char init_command[100];
     sprintf(init_command,
-	    "SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=%lu,SQL_MAX_JOIN_SIZE=%lu",
+	    "SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=%lu,MAX_JOIN_SIZE=%lu",
 	    select_limit,max_join_size);
     mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command);
   }

=== modified file 'client/readline.cc'
--- a/client/readline.cc	2011-02-05 05:04:15 +0000
+++ b/client/readline.cc	2011-02-09 11:16:33 +0000
@@ -18,6 +18,7 @@
 #include <my_global.h>
 #include <my_sys.h>
 #include <m_string.h>
+#include <my_dir.h>
 #include "my_readline.h"
 
 static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,
@@ -30,6 +31,15 @@ static char *intern_read_line(LINE_BUFFE
 LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
 {
   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))))
     return 0;

=== modified file 'client/sql_string.cc'
--- a/client/sql_string.cc	2010-09-13 09:58:11 +0000
+++ b/client/sql_string.cc	2011-02-15 11:30:56 +0000
@@ -707,80 +707,6 @@ String *copy_if_not_alloced(String *to,S
   Help functions
 ****************************************************************************/
 
-/*
-  copy a string from one character set to another
-  
-  SYNOPSIS
-    copy_and_convert()
-    to			Store result here
-    to_cs		Character set of result string
-    from		Copy from here
-    from_length		Length of from string
-    from_cs		From character set
-
-  NOTES
-    'to' must be big enough as form_length * to_cs->mbmaxlen
-
-  RETURN
-    length of bytes copied to 'to'
-*/
-
-
-uint32
-copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, 
-                 const char *from, uint32 from_length, CHARSET_INFO *from_cs,
-                 uint *errors)
-{
-  int         cnvres;
-  my_wc_t     wc;
-  const uchar *from_end= (const uchar*) from+from_length;
-  char *to_start= to;
-  uchar *to_end= (uchar*) to+to_length;
-  my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
-  my_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb;
-  uint error_count= 0;
-
-  while (1)
-  {
-    if ((cnvres= (*mb_wc)(from_cs, &wc, (uchar*) from,
-				      from_end)) > 0)
-      from+= cnvres;
-    else if (cnvres == MY_CS_ILSEQ)
-    {
-      error_count++;
-      from++;
-      wc= '?';
-    }
-    else if (cnvres > MY_CS_TOOSMALL)
-    {
-      /*
-        A correct multibyte sequence detected
-        But it doesn't have Unicode mapping.
-      */
-      error_count++;
-      from+= (-cnvres);
-      wc= '?';
-    }
-    else
-      break;  // Not enough characters
-
-outp:
-    if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0)
-      to+= cnvres;
-    else if (cnvres == MY_CS_ILUNI && wc != '?')
-    {
-      error_count++;
-      wc= '?';
-      goto outp;
-    }
-    else
-      break;
-  }
-  *errors= error_count;
-  return (uint32) (to - to_start);
-}
-
-
 void String::print(String *str)
 {
   char *st= (char*)Ptr, *end= st+str_length;

=== modified file 'client/sql_string.h'
--- a/client/sql_string.h	2010-10-19 22:51:34 +0000
+++ b/client/sql_string.h	2011-02-15 11:30:56 +0000
@@ -25,9 +25,12 @@
 class String;
 int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
 String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
-uint32 copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
-			const char *from, uint32 from_length,
-			CHARSET_INFO *from_cs, uint *errors);
+inline uint32 copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+                               const char *from, uint32 from_length,
+                               CHARSET_INFO *from_cs, uint *errors)
+{
+  return my_convert(to, to_length, to_cs, from, from_length, from_cs, errors);
+}
 
 class String
 {

=== 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
 #
 )

=== added file 'cmake/info_bin.cmake'
--- a/cmake/info_bin.cmake	1970-01-01 00:00:00 +0000
+++ b/cmake/info_bin.cmake	2011-02-11 14:55:25 +0000
@@ -0,0 +1,30 @@
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+
+# The sole purpose of this cmake control file is to create the "INFO_BIN" file.
+
+# By having a separate cmake file for this, it is ensured this happens
+# only in the build (Unix: "make") phase, not when cmake runs.
+# This, in turn, avoids creating stuff in the source directory -
+# it should get into the binary directory only.
+
+
+# Get the macros which the "INFO_*" files.
+INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)
+
+# Here is where the action is.
+CREATE_INFO_BIN()
+

=== added file 'cmake/info_macros.cmake.in'
--- a/cmake/info_macros.cmake.in	1970-01-01 00:00:00 +0000
+++ b/cmake/info_macros.cmake.in	2011-02-11 14:55:25 +0000
@@ -0,0 +1,132 @@
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
+
+
+# Handle/create the "INFO_*" files describing a MySQL (server) binary.
+# This is part of the fix for bug#42969.
+
+
+# Several of cmake's variables need to be translated from '@' notation
+# to '${}', this is done by the "configure" call in top level "CMakeLists.txt".
+# If further variables are used in this file, add them to this list.
+
+SET(VERSION "@VERSION@")
+SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@")
+SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
+SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@")
+SET(CMAKE_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@")
+SET(BZR_EXECUTABLE "@BZR_EXECUTABLE@")
+SET(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@")
+SET(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@")
+SET(CMAKE_HOST_SYSTEM_PROCESSOR "@CMAKE_HOST_SYSTEM_PROCESSOR@")
+SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@")
+SET(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@")
+ 
+ 
+# Create an "INFO_SRC" file with information about the source (only).
+# We use "bzr version-info", if possible, and the "VERSION" contents.
+#
+# Outside development (BZR tree), the "INFO_SRC" file will not be modified
+# provided it exists (from "make dist" or a source tarball creation).
+
+MACRO(CREATE_INFO_SRC target_dir)
+  SET(INFO_SRC "${target_dir}/INFO_SRC")
+
+  IF(EXISTS ${CMAKE_SOURCE_DIR}/.bzr)
+    # Sources are in a BZR repository: Always update.
+    EXECUTE_PROCESS(
+      COMMAND ${BZR_EXECUTABLE} version-info ${CMAKE_SOURCE_DIR}
+      OUTPUT_VARIABLE VERSION_INFO
+      RESULT_VARIABLE RESULT
+    )
+    FILE(WRITE ${INFO_SRC} "${VERSION_INFO}\n")
+    # to debug, add: FILE(APPEND ${INFO_SRC} "\nResult ${RESULT}\n")
+    # For better readability ...
+    FILE(APPEND ${INFO_SRC} "\nMySQL source ${VERSION}\n")
+  ELSEIF(EXISTS ${INFO_SRC})
+    # Outside a BZR tree, there is no need to change an existing "INFO_SRC",
+    # it cannot be improved.
+  ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/Docs/INFO_SRC)
+    # If we are building from a source distribution, it also contains "INFO_SRC".
+    # Similar, the export used for a release build already has the file.
+    FILE(READ ${CMAKE_SOURCE_DIR}/Docs/INFO_SRC SOURCE_INFO)
+    FILE(WRITE ${INFO_SRC} "${SOURCE_INFO}\n")
+  ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/INFO_SRC)
+    # This is not the proper location, but who knows ...
+    FILE(READ ${CMAKE_SOURCE_DIR}/INFO_SRC SOURCE_INFO)
+    FILE(WRITE ${INFO_SRC} "${SOURCE_INFO}\n")
+  ELSE()
+    # This is a fall-back.
+    FILE(WRITE ${INFO_SRC} "\nMySQL source ${VERSION}\n")
+  ENDIF()
+ENDMACRO(CREATE_INFO_SRC)
+
+
+# This is for the "real" build, must be run again with each cmake run
+# to make sure we report the current flags (not those of some previous run).
+
+MACRO(CREATE_INFO_BIN)
+  SET(INFO_BIN "Docs/INFO_BIN")
+
+  FILE(WRITE ${INFO_BIN} "===== Information about the build process: =====\n")
+  IF (WIN32)
+    EXECUTE_PROCESS(COMMAND cmd /c date /T OUTPUT_VARIABLE TMP_DATE)
+  ELSEIF(UNIX)
+    EXECUTE_PROCESS(COMMAND date "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
+  ELSE()
+    SET(TMP_DATE "(no date command known for this platform)")
+  ENDIF()
+  SITE_NAME(HOSTNAME)
+  FILE(APPEND ${INFO_BIN} "Build was run at ${TMP_DATE} on host '${HOSTNAME}'\n\n")
+
+  # According to the cmake docs, these variables should always be set.
+  # However, they are empty in my tests, using cmake 2.6.4 on Linux, various Unix, and Windows.
+  # Still, include this code, so we will profit if a build environment does provide that info.
+  IF(CMAKE_HOST_SYSTEM)
+    FILE(APPEND ${INFO_BIN} "Build was done on  ${CMAKE_HOST_SYSTEM} using ${CMAKE_HOST_SYSTEM_PROCESSOR}\n")
+  ENDIF()
+  IF(CMAKE_CROSSCOMPILING)
+    FILE(APPEND ${INFO_BIN} "Build was done for ${CMAKE_SYSTEM} using ${CMAKE_SYSTEM_PROCESSOR}\n")
+  ENDIF()
+
+  # ${CMAKE_VERSION} doesn't work in 2.6.0, use the separate components.
+  FILE(APPEND ${INFO_BIN} "Build was done using cmake ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} \n\n")
+
+  IF (WIN32)
+    FILE(APPEND ${INFO_BIN} "===== Compiler / generator used: =====\n")
+    FILE(APPEND ${INFO_BIN} ${CMAKE_GENERATOR} "\n\n")
+  ELSEIF(UNIX)
+    FILE(APPEND ${INFO_BIN} "===== Compiler flags used (from the 'sql/' subdirectory): =====\n")
+    IF(EXISTS sql/CMakeFiles/sql.dir/flags.make)
+      EXECUTE_PROCESS(COMMAND egrep "^# compile|^C_|^CXX_" sql/CMakeFiles/sql.dir/flags.make OUTPUT_VARIABLE COMPILE_FLAGS)
+      FILE(APPEND ${INFO_BIN} ${COMPILE_FLAGS} "\n")
+    ELSE()
+      FILE(APPEND ${INFO_BIN} "File 'sql/CMakeFiles/sql.dir/flags.make' is not yet found.\n\n")
+    ENDIF()
+  ENDIF()
+  FILE(APPEND ${INFO_BIN} "Pointer size: ${CMAKE_SIZEOF_VOID_P}\n\n")
+
+  FILE(APPEND ${INFO_BIN} "===== Feature flags used: =====\n")
+  IF(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
+    # Attention: "-N" prevents cmake from entering a recursion, and it must be a separate flag from "-L".
+    EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -N -L ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE FEATURE_FLAGS)
+    FILE(APPEND ${INFO_BIN} ${FEATURE_FLAGS} "\n")
+  ELSE()
+    FILE(APPEND ${INFO_BIN} "File 'CMakeCache.txt' is not yet found.\n\n")
+  ENDIF()
+
+  FILE(APPEND ${INFO_BIN} "===== EOF =====\n")
+ENDMACRO(CREATE_INFO_BIN)
+

=== added file 'cmake/info_src.cmake'
--- a/cmake/info_src.cmake	1970-01-01 00:00:00 +0000
+++ b/cmake/info_src.cmake	2011-02-11 14:55:25 +0000
@@ -0,0 +1,31 @@
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+
+# The sole purpose of this cmake control file is to create the "INFO_SRC" file.
+
+# As long as and "bzr pull" (or "bzr commit") is followed by a "cmake",
+# the call in top level "CMakeLists.txt" is sufficient.
+# This file is to provide a separate target for the "make" phase,
+# to ensure the BZR revision-id is correct even after a sequence
+#   cmake ; make ; bzr pull ; make
+
+
+# Get the macros which handle the "INFO_*" files.
+INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)
+
+# Here is where the action is.
+CREATE_INFO_SRC(${CMAKE_BINARY_DIR}/Docs)
+

=== modified file 'cmake/make_dist.cmake.in'
--- a/cmake/make_dist.cmake.in	2010-11-21 13:48:44 +0000
+++ b/cmake/make_dist.cmake.in	2011-02-14 12:28:39 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 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
@@ -106,6 +106,12 @@ IF(MYSQL_DOCS_LOCATION)
   EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_directory "${MYSQL_DOCS_LOCATION}" "${PACKAGE_DIR}")
 ENDIF()
 
+# Ensure there is an "INFO_SRC" file.
+INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)
+IF(NOT EXISTS ${PACKAGE_DIR}/Docs/INFO_SRC)
+  CREATE_INFO_SRC(${PACKAGE_DIR}/Docs)
+ENDIF()
+
 # In case we used CPack, it could have copied some
 # extra files that are not usable on different machines.
 FILE(REMOVE ${PACKAGE_DIR}/CMakeCache.txt)

=== modified file 'extra/comp_err.c'
--- a/extra/comp_err.c	2010-11-05 22:14:29 +0000
+++ b/extra/comp_err.c	2011-02-16 13:49:26 +0000
@@ -219,14 +219,13 @@ static void print_escaped_string(FILE *f
 
 static int create_header_files(struct errors *error_head)
 {
-  uint er_last;
+  uint er_last= 0;
   FILE *er_definef, *sql_statef, *er_namef;
   struct errors *tmp_error;
   struct message *er_msg;
   const char *er_text;
 
   DBUG_ENTER("create_header_files");
-  LINT_INIT(er_last);
 
   if (!(er_definef= my_fopen(HEADERFILE, O_WRONLY, MYF(MY_WME))))
   {

=== modified file 'include/m_ctype.h'
--- a/include/m_ctype.h	2010-12-20 10:28:06 +0000
+++ b/include/m_ctype.h	2011-02-15 11:30:56 +0000
@@ -686,6 +686,10 @@ my_bool my_charset_is_ascii_compatible(C
 extern size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
                               const char* fmt, va_list ap);
 
+uint32 my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, 
+                  const char *from, uint32 from_length, CHARSET_INFO *from_cs,
+                  uint *errors);
+
 #define	_MY_U	01	/* Upper case */
 #define	_MY_L	02	/* Lower case */
 #define	_MY_NMR	04	/* Numeral (digit) */

=== modified file 'include/my_bit.h'
--- a/include/my_bit.h	2010-07-23 20:18:36 +0000
+++ b/include/my_bit.h	2011-02-16 15:33:02 +0000
@@ -1,3 +1,18 @@
+/* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
+
 #ifndef MY_BIT_INCLUDED
 #define MY_BIT_INCLUDED
 
@@ -44,9 +59,12 @@ static inline uint my_count_bits(ulonglo
 #endif
 }
 
-static inline uint my_count_bits_ushort(ushort v)
+static inline uint my_count_bits_uint32(uint32 v)
 {
-  return _my_bits_nbits[v];
+  return (uint) (uchar) (_my_bits_nbits[(uchar)  v] +
+                         _my_bits_nbits[(uchar) (v >> 8)] +
+                         _my_bits_nbits[(uchar) (v >> 16)] +
+                         _my_bits_nbits[(uchar) (v >> 24)]);
 }
 
 

=== modified file 'include/my_bitmap.h'
--- a/include/my_bitmap.h	2011-01-11 09:09:21 +0000
+++ b/include/my_bitmap.h	2011-02-16 16:19:28 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB, 2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -125,9 +125,10 @@ bitmap_is_set(const MY_BITMAP *map,uint
 
 static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
 {
-  *(map1)->last_word_ptr|= (map1)->last_word_mask;
-  *(map2)->last_word_ptr|= (map2)->last_word_mask;
-  return memcmp((map1)->bitmap, (map2)->bitmap, 4*no_words_in_map((map1)))==0;
+  if (memcmp(map1->bitmap, map2->bitmap, 4*(no_words_in_map(map1)-1)) != 0)
+    return FALSE;
+  return ((*map1->last_word_ptr | map1->last_word_mask) ==
+          (*map2->last_word_ptr | map2->last_word_mask));
 }
 
 #define bitmap_clear_all(MAP) \

=== 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/extra/rpl_tests/rpl_conflicts.test'
--- a/mysql-test/extra/rpl_tests/rpl_conflicts.test	2010-12-19 17:22:30 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_conflicts.test	2011-02-07 15:31:01 +0000
@@ -93,7 +93,6 @@ if (`SELECT @@global.binlog_format != 'R
   source include/wait_for_slave_sql_error.inc;
 
   --let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
-  --let $err= `SELECT SUBSTRING("$err" FROM 17)`
   --replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/
   --disable_query_log
   --eval SELECT "$err" as 'Last_SQL_Error (expected "duplicate key" error)'
@@ -109,9 +108,7 @@ if (`SELECT @@global.binlog_format != 'R
 
 --echo ---- Sync slave and verify that there is no error ----
 sync_with_master;
-let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
-let $err= `SELECT SUBSTRING("$err" FROM 17)`;
---echo Last_SQL_Error = '$err' (expected no error)
+--source include/check_slave_no_error.inc
 SELECT * FROM t1;
 
 
@@ -148,7 +145,6 @@ if (`SELECT @@global.binlog_format = 'RO
   source include/wait_for_slave_sql_error.inc;
 
   --let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
-  --let $err= `SELECT SUBSTRING("$err" FROM 17)`
   --replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/
   --disable_query_log
   --eval SELECT "$err" as 'Last_SQL_Error (expected "duplicate key" error)'
@@ -166,9 +162,7 @@ if (`SELECT @@global.binlog_format = 'RO
 # The slave should sync ok, and SHOW SLAVE STATUS should give no
 # error.
 sync_with_master;
-let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
-let $err= `SELECT SUBSTRING("$err" FROM 17)`;
---echo Last_SQL_Error = $err (expected no error)
+--source include/check_slave_no_error.inc
 SELECT * FROM t1;
 
 

=== modified file 'mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test'
--- a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test	2010-12-19 17:22:30 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test	2011-02-07 15:31:01 +0000
@@ -24,12 +24,10 @@ insert into t1 values(1),(2);
 drop table t1;
 
 connection slave;
---source include/wait_for_slave_sql_to_stop.inc
-let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
-let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
-let $error= `SELECT SUBSTRING("$error" FROM 17)`;
---echo Error: "$error" (expected different error codes on master and slave)
---echo Errno: "$errno" (expected 0)
+--echo (expect different error codes on master and slave)
+--let $slave_sql_errno= 0
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 drop table t1;
 --source include/stop_slave.inc
 # Clear error messages.

=== modified file 'mysql-test/extra/rpl_tests/rpl_stop_middle_group.test'
--- a/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test	2010-12-19 17:22:30 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test	2011-02-14 16:32:36 +0000
@@ -31,16 +31,19 @@ source include/wait_for_slave_sql_to_sto
 
 # checking: no error and the group is finished
 
-let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
-let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
-let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
---disable_query_log
-eval SELECT $read = $exec into @check;
-let $error= `SELECT SUBSTRING("$error" FROM 17)`;
---enable_query_log
-eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`;
-select count(*) as one from tm;
-select count(*) as one from ti;
+--source include/check_slave_no_error.inc
+
+--let $assert_text= Everything that was read, was executed
+--let $assert_cond= [SHOW SLAVE STATUS, Read_Master_Log_Pos, 1] = [SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1]
+--source include/assert.inc
+
+--let $assert_text= There is one row in table tm
+--let $assert_cond= [SELECT COUNT(*) AS Val FROM tm, Val, 1] = 1
+--source include/assert.inc
+
+--let $assert_text= There is one row in table ti
+--let $assert_cond= [SELECT COUNT(*) AS Val FROM ti, Val, 1] = 1
+--source include/assert.inc
 
 set @@global.debug="-d";
 
@@ -81,20 +84,23 @@ connection slave;
 # slave will catch the killed status, won't shut down immediately
 # but does it eventually having the whole group unfinished (not committed)
 
-source include/wait_for_slave_sql_to_stop.inc;
+let $slave_sql_errno= 1593; # ER_SLAVE_FATAL_ERROR
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 
 # checking: the error and group unfinished
 
-let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
-let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
-let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
---disable_query_log
-eval SELECT $read - $exec > 0 into @check;
-let $error= `SELECT SUBSTRING("$error" FROM 17)`;
---enable_query_log
-eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
-select count(*) as one  from tm;
-select count(*) as zero from ti;
+--let $assert_text= Not everything that was read, was executed
+--let $assert_cond= [SHOW SLAVE STATUS, Read_Master_Log_Pos, 1] > [SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1]
+--source include/assert.inc
+
+--let $assert_text= There is one row in table tm
+--let $assert_cond= [SELECT COUNT(*) AS Val FROM tm, Val, 1] = 1
+--source include/assert.inc
+
+--let $assert_text= There is no row in table ti
+--let $assert_cond= [SELECT COUNT(*) AS Val FROM ti, Val, 1] = 0
+--source include/assert.inc
 
 set @@global.debug="-d";
 
@@ -121,20 +127,22 @@ connection slave;
 # but does it eventually having the whole group unfinished (not committed)
 # 
 
-source include/wait_for_slave_sql_to_stop.inc;
-
 # checking: the error and group unfinished 
-
-let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
-let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
-let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
---disable_query_log
-eval SELECT $read - $exec > 0 into @check;
-let $error= `SELECT SUBSTRING("$error" FROM 17)`;
---enable_query_log
-eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
-select max(a) as two from tm;
-select max(a) as one from ti;
+let $slave_sql_errno= 1593; # ER_SLAVE_FATAL_ERROR
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
+
+--let $assert_text= Not everything that was read, was executed
+--let $assert_cond= [SHOW SLAVE STATUS, Read_Master_Log_Pos, 1] > [SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1]
+--source include/assert.inc
+
+--let $assert_text= The max value for field 'a' is 2
+--let $assert_cond= [SELECT MAX(a) AS Val FROM tm, Val, 1] = 2
+--source include/assert.inc
+
+--let $assert_text= The max value for field 'a' is 1
+--let $assert_cond= [SELECT MAX(a) AS Val FROM ti, Val, 1] = 1
+--source include/assert.inc
 
 set @@global.debug="-d";
 

=== modified file 'mysql-test/include/check-testcase.test'
--- a/mysql-test/include/check-testcase.test	2010-12-19 17:22:30 +0000
+++ b/mysql-test/include/check-testcase.test	2011-02-07 15:31:01 +0000
@@ -67,6 +67,8 @@ if ($tmp)
   --echo Slave_SQL_Running_State	
   --echo Master_Retry_Count	#
   --echo Master_Bind	
+  --echo Last_IO_Error_Timestamp	
+  --echo Last_SQL_Error_Timestamp	
 }
 if (!$tmp) {
   # Note: after WL#5177, fields 13-18 shall not be filtered-out.

=== 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/include/wait_for_slave_io_error.inc'
--- a/mysql-test/include/wait_for_slave_io_error.inc	2010-12-19 17:22:30 +0000
+++ b/mysql-test/include/wait_for_slave_io_error.inc	2011-02-07 15:31:01 +0000
@@ -72,7 +72,7 @@ if ($show_slave_io_error)
 {
   --let $_wait_for_slave_io_error_error= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1)
   # remove timestamp and mask absolute path
-  --let $_wait_for_slave_io_error_error= `SELECT REPLACE(SUBSTR("$_wait_for_slave_io_error_error", 17), '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
+  --let $_wait_for_slave_io_error_error= `SELECT REPLACE("$_wait_for_slave_io_error_error", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
   --echo Last_IO_Error = '$_wait_for_slave_io_error_error'
 }
 

=== modified file 'mysql-test/include/wait_for_slave_sql_error.inc'
--- a/mysql-test/include/wait_for_slave_sql_error.inc	2010-12-19 17:22:30 +0000
+++ b/mysql-test/include/wait_for_slave_sql_error.inc	2011-02-07 15:31:01 +0000
@@ -61,7 +61,7 @@ if ($show_slave_sql_error)
 {
   --let $_wait_for_slave_sql_error_error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
   # remove timestamp and mask absolute path
-  --let $_wait_for_slave_sql_error_error= `SELECT REPLACE(SUBSTR("$_wait_for_slave_sql_error_error", 17), '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
+  --let $_wait_for_slave_sql_error_error= `SELECT REPLACE("$_wait_for_slave_sql_error_error", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
   --echo Last_SQL_Error = '$_wait_for_slave_sql_error_error'
 }
 

=== 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-16 12:58:45 +0000
@@ -1562,12 +1562,6 @@ sub command_line_setup {
     $debug_d= "d,query,info,error,enter,exit";
   }
 
-  if ($opt_debug && $opt_debug ne "1")
-  {
-    $debug_d= "d,$opt_debug";
-    $debug_d= "d,query,info,error,enter,exit" if $opt_debug eq "std";
-  }
-
   mtr_report("Checking supported features...");
 
   check_ndbcluster_support(\%mysqld_variables);
@@ -2024,7 +2018,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>) {
@@ -2168,6 +2162,7 @@ sub environment_setup {
   $ENV{'MYSQL_TMP_DIR'}=      $opt_tmpdir;
   $ENV{'MYSQLTEST_VARDIR'}=   $opt_vardir;
   $ENV{'MYSQL_LIBDIR'}=       "$basedir/lib";
+  $ENV{'MYSQL_BINDIR'}=       "$bindir";
   $ENV{'MYSQL_SHAREDIR'}=     $path_language;
   $ENV{'MYSQL_CHARSETSDIR'}=  $path_charsetsdir;
   

=== 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;

=== added file 'mysql-test/r/file_contents.result'
--- a/mysql-test/r/file_contents.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/file_contents.result	2011-02-11 14:55:25 +0000
@@ -0,0 +1,6 @@
+
+Checking 'INFO_SRC' and 'INFO_BIN'
+INFO_SRC: Found MySQL version number / Found BZR revision id
+INFO_BIN: Found 'Compiler ... used' line / Found 'Feature flags' line
+
+End of tests

=== modified file 'mysql-test/r/gis.result'
--- a/mysql-test/r/gis.result	2011-02-08 15:49:51 +0000
+++ b/mysql-test/r/gis.result	2011-02-15 13:33:27 +0000
@@ -1034,6 +1034,14 @@ p
 NULL
 NULL
 drop table t1;
+#
+# Test for bug #59888 "debug assertion when attempt to create spatial index
+#                      on char > 31 bytes".
+#
+create table t1(a char(32) not null) engine=myisam;
+create spatial index i on t1 (a);
+ERROR 42000: A SPATIAL index may only contain a geometrical type column
+drop table t1;
 End of 5.1 tests
 CREATE TABLE t1(
 col0 BINARY NOT NULL,

=== 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/insert_select.result'
--- a/mysql-test/r/insert_select.result	2010-08-25 19:00:38 +0000
+++ b/mysql-test/r/insert_select.result	2011-02-16 20:45:52 +0000
@@ -842,7 +842,7 @@ SET max_heap_table_size = 16384;
 SET @old_myisam_data_pointer_size = @@myisam_data_pointer_size;
 SET GLOBAL myisam_data_pointer_size = 2;
 INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
-call mtr.add_suppression("mysqld: The table '.*#sql.*' is full");
+call mtr.add_suppression("mysqld.*: The table '.*#sql.*' is full");
 INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
 Got one of the listed errors
 SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;

=== 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/ps.result'
--- a/mysql-test/r/ps.result	2010-11-29 13:30:18 +0000
+++ b/mysql-test/r/ps.result	2011-02-15 11:47:33 +0000
@@ -2245,32 +2245,6 @@ execute abc;
 execute abc;
 execute abc;
 deallocate prepare abc;
-create procedure proc_1() flush slave;
-call proc_1();
-call proc_1();
-call proc_1();
-create function func_1() returns int begin flush slave; return 1; end|
-ERROR 0A000: FLUSH is not allowed in stored function or trigger
-create function func_1() returns int begin call proc_1(); return 1; end|
-select func_1(), func_1(), func_1() from dual;
-ERROR 0A000: FLUSH is not allowed in stored function or trigger
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush slave";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-create procedure proc_1() flush master;
-create function func_1() returns int begin flush master; return 1; end|
-ERROR 0A000: FLUSH is not allowed in stored function or trigger
-create function func_1() returns int begin call proc_1(); return 1; end|
-select func_1(), func_1(), func_1() from dual;
-ERROR 0A000: FLUSH is not allowed in stored function or trigger
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush master";
-deallocate prepare abc;
 create procedure proc_1() flush des_key_file;
 call proc_1();
 call proc_1();

=== 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/select_safe.result'
--- a/mysql-test/r/select_safe.result	2010-05-12 16:03:52 +0000
+++ b/mysql-test/r/select_safe.result	2011-02-15 12:38:39 +0000
@@ -30,7 +30,7 @@ ERROR HY000: You are using safe update m
 delete from t1 where a+0=1;
 ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
 select 1 from t1,t1 as t2,t1 as t3,t1 as t4,t1 as t5;
-ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
 update t1 set b="a" limit 1;
 update t1 set b="a" where b="b" limit 2;
 delete from t1 where b="test" limit 1;
@@ -42,7 +42,7 @@ SELECT @@MAX_JOIN_SIZE, @@SQL_BIG_SELECT
 2	0
 insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
 SELECT * from t1 order by a;
-ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
 SET SQL_BIG_SELECTS=1;
 SELECT * from t1 order by a;
 a	b
@@ -52,7 +52,7 @@ a	b
 5	a
 SET MAX_JOIN_SIZE=2;
 SELECT * from t1;
-ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
 SET MAX_JOIN_SIZE=DEFAULT;
 SELECT * from t1;
 a	b
@@ -82,12 +82,12 @@ insert into t1 select * from t1;
 insert into t1 select * from t1;
 set local  max_join_size=8;
 select * from (select * from t1) x;
-ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
 set local  max_join_size=1;
 select * from (select a.a as aa, b.a as ba from t1 a, t1 b) x;
-ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
 set local  max_join_size=1;
 select * from (select 1 union select 2 union select 3) x;
-ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
 drop table t1;
 SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, MAX_JOIN_SIZE=DEFAULT;

=== modified file 'mysql-test/r/signal_code.result'
--- a/mysql-test/r/signal_code.result	2009-12-01 19:07:18 +0000
+++ b/mysql-test/r/signal_code.result	2011-02-16 16:27:35 +0000
@@ -20,16 +20,16 @@ return 0;
 end $$
 show procedure code signal_proc;
 Pos	Instruction
-0	stmt 131 "SIGNAL foo"
-1	stmt 131 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
-2	stmt 132 "RESIGNAL foo"
-3	stmt 132 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
+0	stmt 130 "SIGNAL foo"
+1	stmt 130 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
+2	stmt 131 "RESIGNAL foo"
+3	stmt 131 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
 drop procedure signal_proc;
 show function code signal_func;
 Pos	Instruction
-0	stmt 131 "SIGNAL foo"
-1	stmt 131 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
-2	stmt 132 "RESIGNAL foo"
-3	stmt 132 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
+0	stmt 130 "SIGNAL foo"
+1	stmt 130 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
+2	stmt 131 "RESIGNAL foo"
+3	stmt 131 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
 4	freturn 3 0
 drop function signal_func;

=== modified file 'mysql-test/r/sp-code.result'
--- a/mysql-test/r/sp-code.result	2010-07-30 15:28:36 +0000
+++ b/mysql-test/r/sp-code.result	2011-02-16 16:27:35 +0000
@@ -155,11 +155,11 @@ Pos	Instruction
 0	stmt 9 "drop temporary table if exists sudoku..."
 1	stmt 1 "create temporary table sudoku_work ( ..."
 2	stmt 1 "create temporary table sudoku_schedul..."
-3	stmt 89 "call sudoku_init()"
+3	stmt 88 "call sudoku_init()"
 4	jump_if_not 7(8) p_naive@0
 5	stmt 4 "update sudoku_work set cnt = 0 where ..."
 6	jump 8
-7	stmt 89 "call sudoku_count()"
+7	stmt 88 "call sudoku_count()"
 8	stmt 6 "insert into sudoku_schedule (row,col)..."
 9	set v_scounter@2 0
 10	set v_i@3 1

=== modified file 'mysql-test/r/sp-error.result'
--- a/mysql-test/r/sp-error.result	2010-10-27 10:28:09 +0000
+++ b/mysql-test/r/sp-error.result	2011-02-15 11:47:33 +0000
@@ -665,12 +665,6 @@ ERROR 0A000: FLUSH is not allowed in sto
 create function bug8409() returns int begin flush status;
 return 1; end|
 ERROR 0A000: FLUSH is not allowed in stored function or trigger
-create function bug8409() returns int begin flush slave;
-return 1; end|
-ERROR 0A000: FLUSH is not allowed in stored function or trigger
-create function bug8409() returns int begin flush master;
-return 1; end|
-ERROR 0A000: FLUSH is not allowed in stored function or trigger
 create function bug8409() returns int begin flush des_key_file;
 return 1; end|
 ERROR 0A000: FLUSH is not allowed in stored function or trigger

=== 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/trigger.result'
--- a/mysql-test/r/trigger.result	2010-11-10 11:26:45 +0000
+++ b/mysql-test/r/trigger.result	2011-02-15 11:47:33 +0000
@@ -640,10 +640,6 @@ create trigger t1_ai after insert on t1
 ERROR 0A000: FLUSH is not allowed in stored function or trigger
 create trigger t1_ai after insert on t1 for each row flush status;
 ERROR 0A000: FLUSH is not allowed in stored function or trigger
-create trigger t1_ai after insert on t1 for each row flush slave;
-ERROR 0A000: FLUSH is not allowed in stored function or trigger
-create trigger t1_ai after insert on t1 for each row flush master;
-ERROR 0A000: FLUSH is not allowed in stored function or trigger
 create trigger t1_ai after insert on t1 for each row flush des_key_file;
 ERROR 0A000: FLUSH is not allowed in stored function or trigger
 create trigger t1_ai after insert on t1 for each row flush user_resources;
@@ -694,14 +690,6 @@ create procedure p1() flush status;
 insert into t1 values (0);
 ERROR 0A000: FLUSH is not allowed in stored function or trigger
 drop procedure p1;
-create procedure p1() flush slave;
-insert into t1 values (0);
-ERROR 0A000: FLUSH is not allowed in stored function or trigger
-drop procedure p1;
-create procedure p1() flush master;
-insert into t1 values (0);
-ERROR 0A000: FLUSH is not allowed in stored function or trigger
-drop procedure p1;
 create procedure p1() flush des_key_file;
 insert into t1 values (0);
 ERROR 0A000: FLUSH is not allowed in stored function or trigger

=== 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;

=== modified file 'mysql-test/suite/perfschema/include/table_aggregate_setup.inc'
--- a/mysql-test/suite/perfschema/include/table_aggregate_setup.inc	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/include/table_aggregate_setup.inc	2011-02-16 14:38:29 +0000
@@ -132,6 +132,10 @@ update performance_schema.setup_instrume
 # Enable all consumers (by default)
 update performance_schema.setup_consumers set enabled='YES';
 
+# Start from a known clean state, to avoid noise from previous tests
+flush tables;
+flush status;
+
 create table test.t1(a int, b int, c int, d int default 0,
   primary key(a),
   index index_b(b),

=== 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_binlog_corruption.result'
--- a/mysql-test/suite/rpl/r/rpl_binlog_corruption.result	2010-12-19 17:07:28 +0000
+++ b/mysql-test/suite/rpl/r/rpl_binlog_corruption.result	2011-02-07 15:31:01 +0000
@@ -9,7 +9,7 @@ Setting up fake replication from MYSQL_T
 ==== Test ====
 START SLAVE SQL_THREAD;
 include/wait_for_slave_sql_error.inc [errno=1594]
-Last_SQL_Error = Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.
+Last_SQL_Error = 'Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.'
 ==== Clean up ====
 include/cleanup_fake_relay_log.inc
 include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/r/rpl_checksum.result'
--- a/mysql-test/suite/rpl/r/rpl_checksum.result	2010-12-21 10:53:10 +0000
+++ b/mysql-test/suite/rpl/r/rpl_checksum.result	2011-02-07 15:31:01 +0000
@@ -61,8 +61,8 @@ set @@global.binlog_checksum = CRC32;
 insert into t1 values (1) /* will not be applied on slave due to simulation */;
 set @@global.debug='d,simulate_slave_unaware_checksum';
 start slave;
-include/wait_for_slave_io_to_stop.inc
-*** Got IO thread error code: 1236, text: Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log' ***
+include/wait_for_slave_io_error.inc [errno=1236]
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log''
 select count(*) as zero from t1;
 zero
 0
@@ -78,16 +78,16 @@ include/stop_slave.inc
 create table t2 (a int);
 set @@global.debug='d,simulate_checksum_test_failure';
 start slave io_thread;
-include/wait_for_slave_io_to_stop.inc
-*** Got IO thread error code: 1595, text: Relay log write failure: could not queue event from master ***
+include/wait_for_slave_io_error.inc [errno=1595]
+Last_IO_Error = 'Relay log write failure: could not queue event from master'
 set @@global.debug='';
 start slave io_thread;
 include/wait_for_slave_param.inc [Read_Master_Log_Pos]
 set @@global.slave_sql_verify_checksum = 1;
 set @@global.debug='d,simulate_checksum_test_failure';
 start slave sql_thread;
-include/wait_for_slave_sql_to_stop.inc
-*** Got SQL thread error code: 1593, text: Error initializing relay log position: I/O error reading event at position 4 ***
+include/wait_for_slave_sql_error.inc [errno=1593]
+Last_SQL_Error = 'Error initializing relay log position: I/O error reading event at position 4'
 set @@global.debug='';
 include/start_slave.inc
 select count(*) as 'must be zero' from t2;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_conflicts.result'
--- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result	2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result	2011-02-07 15:31:01 +0000
@@ -31,7 +31,7 @@ DELETE FROM t1 WHERE a = 1;
 START SLAVE SQL_THREAD;
 include/wait_for_slave_sql_to_start.inc
 ---- Sync slave and verify that there is no error ----
-Last_SQL_Error = '' (expected no error)
+include/check_slave_no_error.inc
 SELECT * FROM t1;
 a
 1
@@ -59,7 +59,7 @@ INSERT INTO t1 VALUES (1);
 START SLAVE SQL_THREAD;
 include/wait_for_slave_sql_to_start.inc
 ---- Sync slave and verify that there is no error ----
-Last_SQL_Error =  (expected no error)
+include/check_slave_no_error.inc
 SELECT * FROM t1;
 a
 ==== Clean up ====
@@ -84,7 +84,7 @@ a
 1
 [on slave]
 ---- Sync slave and verify that there is no error ----
-Last_SQL_Error = '' (expected no error)
+include/check_slave_no_error.inc
 SELECT * FROM t1;
 a
 1
@@ -102,7 +102,7 @@ SELECT * FROM t1;
 a
 [on slave]
 ---- Sync slave and verify that there is no error ----
-Last_SQL_Error =  (expected no error)
+include/check_slave_no_error.inc
 SELECT * FROM t1;
 a
 ==== Clean up ====

=== 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/suite/rpl/r/rpl_show_errors.result'
--- a/mysql-test/suite/rpl/r/rpl_show_errors.result	2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/r/rpl_show_errors.result	2011-02-07 15:31:01 +0000
@@ -3,10 +3,10 @@ include/master-slave.inc
 CREATE TABLE t1 (a INT, b blob, PRIMARY KEY(b(512)));
 DROP TABLE t1;
 DROP TABLE t1;
-include/wait_for_slave_sql_to_stop.inc
-# assertion: timestamp should be filled
+include/wait_for_slave_sql_error.inc [errno=1051]
+include/assert.inc [Last_SQL_Error_Timestamp is not null and matches the expected format]
 include/stop_slave.inc
-# assertion: show that error is preserved after stop slave as well as the timestamp
+include/assert.inc [Last_SQL_Error_Timestamp matches the one reported before stopping slave threads]
 CREATE TABLE  t1 (a INT, b blob, PRIMARY KEY(b(512)));
 Last_SQL_Errno: 1051
 include/start_slave.inc
@@ -19,9 +19,9 @@ change master to master_port=SLAVE_PORT;
 START SLAVE;
 include/wait_for_slave_param.inc [Last_IO_Errno]
 *** must be having the replicate-same-server-id IO thread error ***
-# assertion: assert that error has been reported as well as a timestamp
+include/assert.inc [Last_IO_Error_Timestamp is not null and matches the expected format]
 include/stop_slave.inc
-# assertion: show that error is preserved after stop slave as well as the timestamp
+include/assert.inc [Last_IO_Error_Timestamp matches the one reported before stopping slave threads]
 change master to master_port=MASTER_PORT;
 Last_IO_Errno: 1593
 include/start_slave.inc

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_EE_err2.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result	2010-12-19 17:07:28 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result	2011-02-07 15:31:01 +0000
@@ -7,9 +7,9 @@ set sql_log_bin=1;
 insert into t1 values(1),(2);
 ERROR 23000: Duplicate entry '2' for key 'a'
 drop table t1;
-include/wait_for_slave_sql_to_stop.inc
-Error: "Query caused different errors on master and slave.     Error on master: message (format)='Duplicate entry '%-.192s' for key %d' error code=1062 ; Error on slave: actual message='no error', error code=0. Default database: 'test'. Query: 'insert into t1 values(1),(2)'" (expected different error codes on master and slave)
-Errno: "0" (expected 0)
+(expect different error codes on master and slave)
+include/wait_for_slave_sql_error.inc [errno=0]
+Last_SQL_Error = 'Query caused different errors on master and slave.     Error on master: message (format)='Duplicate entry '%-.192s' for key %d' error code=1062 ; Error on slave: actual message='no error', error code=0. Default database: 'test'. Query: 'insert into t1 values(1),(2)''
 drop table t1;
 include/stop_slave.inc
 RESET SLAVE;

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_conflicts.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result	2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result	2011-02-07 15:31:01 +0000
@@ -26,7 +26,7 @@ DELETE FROM t1 WHERE a = 1;
 START SLAVE SQL_THREAD;
 include/wait_for_slave_sql_to_start.inc
 ---- Sync slave and verify that there is no error ----
-Last_SQL_Error = '' (expected no error)
+include/check_slave_no_error.inc
 SELECT * FROM t1;
 a
 1
@@ -44,7 +44,7 @@ SELECT * FROM t1;
 a
 [on slave]
 ---- Sync slave and verify that there is no error ----
-Last_SQL_Error =  (expected no error)
+include/check_slave_no_error.inc
 SELECT * FROM t1;
 a
 ==== Clean up ====

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result	2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result	2011-02-07 15:31:01 +0000
@@ -12,15 +12,10 @@ Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 commit;
 include/wait_for_slave_sql_to_stop.inc
-SELECT "NO" AS Last_SQL_Error, @check as `true`;
-Last_SQL_Error	true
-NO	1
-select count(*) as one from tm;
-one
-1
-select count(*) as one from ti;
-one
-1
+include/check_slave_no_error.inc
+include/assert.inc [Everything that was read, was executed]
+include/assert.inc [There is one row in table tm]
+include/assert.inc [There is one row in table ti]
 set @@global.debug="-d";
 include/start_slave.inc
 truncate table tm;
@@ -33,16 +28,11 @@ insert into tm set a=null;
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 commit;
-include/wait_for_slave_sql_to_stop.inc
-SELECT "Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`;
-Last_SQL_Error	true
-Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details).	1
-select count(*) as one  from tm;
-one
-1
-select count(*) as zero from ti;
-zero
-0
+include/wait_for_slave_sql_error.inc [errno=1593]
+Last_SQL_Error = 'Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details).'
+include/assert.inc [Not everything that was read, was executed]
+include/assert.inc [There is one row in table tm]
+include/assert.inc [There is no row in table ti]
 set @@global.debug="-d";
 stop slave;
 truncate table tm;
@@ -50,16 +40,11 @@ include/start_slave.inc
 set @@global.debug="+d,stop_slave_middle_group";
 set @@global.debug="+d,incomplete_group_in_relay_log";
 update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
-include/wait_for_slave_sql_to_stop.inc
-SELECT "Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`;
-Last_SQL_Error	true
-Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details).	1
-select max(a) as two from tm;
-two
-2
-select max(a) as one from ti;
-one
-1
+include/wait_for_slave_sql_error.inc [errno=1593]
+Last_SQL_Error = 'Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details).'
+include/assert.inc [Not everything that was read, was executed]
+include/assert.inc [The max value for field 'a' is 2]
+include/assert.inc [The max value for field 'a' is 1]
 set @@global.debug="-d";
 include/rpl_reset.inc
 drop table tm, ti;

=== modified file 'mysql-test/suite/rpl/t/disabled.def'
--- a/mysql-test/suite/rpl/t/disabled.def	2011-01-31 13:44:38 +0000
+++ b/mysql-test/suite/rpl/t/disabled.def	2011-02-15 12:12:30 +0000
@@ -12,7 +12,6 @@
 
 rpl_row_create_table      : Bug#51574 2010-02-27 andrei failed different way than earlier with bug#45576
 rpl_spec_variables        : BUG#47661 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux
-rpl_row_event_max_size    : Bug#55675 2010-10-25 andrei mysql_binlog_send attempts to read events partly
 rpl_delayed_slave         : Bug#57514 2010-11-09 andrei rpl_delayed_slave fails sporadically in pb
 rpl_row_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
 rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out

=== modified file 'mysql-test/suite/rpl/t/rpl_binlog_corruption.test'
--- a/mysql-test/suite/rpl/t/rpl_binlog_corruption.test	2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test	2011-02-07 15:31:01 +0000
@@ -40,10 +40,8 @@ source include/setup_fake_relay_log.inc;
 --echo ==== Test ====
 START SLAVE SQL_THREAD;
 let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE
+let $show_slave_sql_error= 1;
 source include/wait_for_slave_sql_error.inc;
-let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
-let $error= `SELECT SUBSTRING("$error" FROM 17)`;
---echo Last_SQL_Error = $error
 
 --echo ==== Clean up ====
 source include/cleanup_fake_relay_log.inc;

=== modified file 'mysql-test/suite/rpl/t/rpl_checksum.test'
--- a/mysql-test/suite/rpl/t/rpl_checksum.test	2010-12-21 10:53:10 +0000
+++ b/mysql-test/suite/rpl/t/rpl_checksum.test	2011-02-14 16:32:36 +0000
@@ -99,14 +99,9 @@ insert into t1 values (1) /* will not be
 connection slave;
 set @@global.debug='d,simulate_slave_unaware_checksum';
 start slave;
-source include/wait_for_slave_io_to_stop.inc;
-
-let $slave_error_date_col= 17;
-let $errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
-let $error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
-let $error= `select substring("$error", $slave_error_date_col)`;
-
---echo *** Got IO thread error code: $errno, text: $error ***
+let $slave_io_errno= 1236; # ER_MASTER_FATAL_ERROR_READING_BINLOG
+--let $show_slave_io_error= 1
+source include/wait_for_slave_io_error.inc;
 
 select count(*) as zero from t1;
 
@@ -145,11 +140,9 @@ connection slave;
 # instruction to io thread
 set @@global.debug='d,simulate_checksum_test_failure';
 start slave io_thread;
-source include/wait_for_slave_io_to_stop.inc;
-let $errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
-let $error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
-let $error= `select substring("$error", 17)`;
---echo *** Got IO thread error code: $errno, text: $error ***
+let $slave_io_errno= 1595; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE
+--let $show_slave_io_error= 1
+source include/wait_for_slave_io_error.inc;
 set @@global.debug='';
 
 # to make IO thread re-read it again w/o the failure
@@ -165,11 +158,9 @@ set @@global.slave_sql_verify_checksum =
 set @@global.debug='d,simulate_checksum_test_failure';
 
 start slave sql_thread;
-source include/wait_for_slave_sql_to_stop.inc;
-let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
-let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
-let $error= `select substring("$error", 17)`;
---echo *** Got SQL thread error code: $errno, text: $error ***
+let $slave_sql_errno= 1593; # ER_SLAVE_FATAL_ERROR
+--let $show_slave_sql_error= 1
+source include/wait_for_slave_sql_error.inc;
 
 # resuming SQL thread to parse out the event w/o the failure
 

=== modified file 'mysql-test/suite/rpl/t/rpl_show_errors.test'
--- a/mysql-test/suite/rpl/t/rpl_show_errors.test	2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/t/rpl_show_errors.test	2011-02-14 16:32:36 +0000
@@ -8,7 +8,12 @@
 # BUG#43535: last_io_error in show slave status is confusing
 #
 
+--let $ts_regexp= [0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]
+
 ############# CHECKS SQL ERRORS #############
+
+--let $field= Last_SQL_Error_Timestamp
+
 -- connection master
 CREATE TABLE t1 (a INT, b blob, PRIMARY KEY(b(512)));
 -- sync_slave_with_master
@@ -22,27 +27,19 @@ DROP TABLE t1;
 -- connection slave
 # action: now  wait for the slave to stop because it cannot
 #         remove a table that does not exist
--- source include/wait_for_slave_sql_to_stop.inc
+let $slave_sql_errno=1051; # ER_BAD_TABLE_ERROR
+-- source include/wait_for_slave_sql_error.inc
 
--- echo # assertion: timestamp should be filled
--- let $errmsg0= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
--- let $errts0= `SELECT SUBSTRING("$errmsg0" FROM 1 FOR 15)`
-if (`SELECT (NOT STRCMP("$errts0", "") OR NOT ("$errts0" REGEXP "[0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]"))`)
-{
-  -- echo Timestamp does not match the expected one: expected '#### ##:##:##', got: '$errts0' 
-  -- die
-}
+--let $errts0= query_get_value("SHOW SLAVE STATUS", $field, 1)
+--let $assert_text= $field is not null and matches the expected format
+--let $assert_cond= `SELECT ("$errts0" REGEXP "$ts_regexp")`
+--source include/assert.inc
 
 # action: stop the slave (this should preserve the error)
 -- source include/stop_slave.inc
--- let $errmsg1= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
--- echo # assertion: show that error is preserved after stop slave as well as the timestamp
-if (`SELECT (STRCMP("$errmsg0", "$errmsg1"))`)
-{
-  -- let $errts1= `SELECT SUBSTRING("$errmsg1" FROM 1 FOR 15)`
-  -- echo timestamp { got: "$errts1", expected: "$errts0" }, message { got: "$errmsg1", expected: "$errmsg0" }
-  -- die
-}
+--let $assert_cond= "$errts0" = "[SHOW SLAVE STATUS, $field, 1]"
+--let $assert_text= $field matches the one reported before stopping slave threads
+--source include/assert.inc
 
 -- connection slave
 # action: create the table again on the slave so that it resumes replication
@@ -65,6 +62,7 @@ source include/wait_for_slave_param.inc;
 
 --let $rpl_only_running_threads= 1
 --source include/rpl_reset.inc
+--let $field= Last_IO_Error_Timestamp
 
 # mostly copied and extended from rpl_server_id1.test
 -- connection slave
@@ -80,26 +78,17 @@ START SLAVE;
 -- source include/wait_for_slave_param.inc
 -- echo *** must be having the replicate-same-server-id IO thread error ***
 
--- echo # assertion: assert that error has been reported as well as a timestamp
--- let $errmsg0= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1)
--- let $errts0= `SELECT SUBSTRING("$errmsg0" FROM 1 FOR 15)`
-if (`SELECT (NOT STRCMP("$errts0", "") OR NOT ("$errts0" REGEXP "[0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]"))`)
-{
-  -- echo Timestamp does not match the expected one: expected '#### ##:##:##', got: '$errts0' 
-  -- die
-}
+--let $errts0= query_get_value("SHOW SLAVE STATUS", $field, 1)
+--let $assert_text= $field is not null and matches the expected format
+--let $assert_cond= `SELECT ("$errts0" REGEXP "$ts_regexp")`
+--source include/assert.inc
 
 # action: stop the slave
 -- source include/stop_slave.inc
 
--- let $errmsg1= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1)
--- echo # assertion: show that error is preserved after stop slave as well as the timestamp
-if (`SELECT (STRCMP("$errmsg0", "$errmsg1"))`)
-{
-  -- let $errts1= `SELECT SUBSTRING("$errmsg1" FROM 1 FOR 15)`
-  -- echo timestamp { got: "$errts1", expected: "$errts0" }, message { got: "$errmsg1", expected: "$errmsg0" }
-  -- die
-}
+--let $assert_cond= "$errts0" = "[SHOW SLAVE STATUS, $field, 1]"
+--let $assert_text= $field matches the one reported before stopping slave threads
+--source include/assert.inc
 
 # action: restore correct settings
 -- replace_result $MASTER_MYPORT MASTER_PORT

=== modified file 'mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test'
--- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test	2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test	2011-02-17 07:36:05 +0000
@@ -13,6 +13,7 @@
 --source include/have_debug.inc
 --source include/master-slave.inc
 --source include/not_embedded.inc
+--source include/not_var_link.inc
 
 ##########################################################################
 #                            Loading data

=== modified file 'mysql-test/suite/sys_vars/r/max_join_size_func.result'
--- a/mysql-test/suite/sys_vars/r/max_join_size_func.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/max_join_size_func.result	2011-02-15 12:38:39 +0000
@@ -41,7 +41,7 @@ id	name	id	name
 SET @@session.max_join_size=8;
 ## Since total joins are more than max_join_size value so error will occur ##
 SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
-ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
 '#--------------------FN_DYNVARS_079_03-------------------------#'
 ## Setting global value of variable ##
 SET @@global.max_join_size=8;
@@ -52,7 +52,7 @@ SELECT @@global.max_join_size;
 8
 ## Since total joins are more than max_join_size value so error will occur ## 
 SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
-ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
 ## Dropping both the tables ##
 Drop table t1, t2;
 ## Restoring values ##

=== modified file 'mysql-test/suite/sys_vars/r/sql_big_selects_func.result'
--- a/mysql-test/suite/sys_vars/r/sql_big_selects_func.result	2010-11-02 11:53:54 +0000
+++ b/mysql-test/suite/sys_vars/r/sql_big_selects_func.result	2011-02-15 12:38:39 +0000
@@ -19,7 +19,7 @@ INSERT INTO t2 VALUES('aa4','bb');
 '#--------------------FN_DYNVARS_154_01-------------------------#'
 Expected error "Too big select"
 SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
-ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
 Expected error The SELECT would examine more than MAX_JOIN_SIZE rows.
 '#--------------------FN_DYNVARS_154_02-------------------------#'
 SET SESSION SQL_BIG_SELECTS = 1;

=== added file 'mysql-test/t/file_contents.test'
--- a/mysql-test/t/file_contents.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/file_contents.test	2011-02-16 12:44:28 +0000
@@ -0,0 +1,56 @@
+#
+# Testing files that were built to be packaged, both for existence and for contents
+#
+
+#
+# Bug #42969: Create MANIFEST files
+#
+# Use a Perl script to verify that files "docs/INFO_BIN" and "docs/INFO_SRC" do exist
+# and have the expected contents.
+
+--perl
+print "\nChecking 'INFO_SRC' and 'INFO_BIN'\n";
+$dir_docs = $ENV{'MYSQL_BINDIR'};
+if($dir_docs =~ m|/usr/|) {
+  # RPM package
+  $dir_docs =~ s|/lib|/share/doc|;
+  if(-d "$dir_docs/packages/MySQL-server") {
+    # SuSE
+    $dir_docs = "$dir_docs/packages/MySQL-server";
+  } else {
+    # RedHat: version number in directory name
+    $dir_docs = glob "$dir_docs/MySQL-server*";
+  }
+} else {
+  # tar.gz package, Windows, or developer work (in BZR)
+  $dir_docs =~ s|/lib||;
+  if(-d "$dir_docs/docs") {
+    $dir_docs = "$dir_docs/docs"; # package
+  } else {
+    $dir_docs = "$dir_docs/Docs"; # development tree
+  }
+}
+$found_version = "No line 'MySQL source #.#.#'";
+$found_revision = "No line 'revision-id: .....'";
+open(I_SRC,"<","$dir_docs/INFO_SRC") or print "Cannot open 'INFO_SRC' in '$dir_docs'\n";
+while(defined ($line = <I_SRC>)) {
+  if ($line =~ m|^MySQL source \d\.\d\.\d+|) {$found_version = "Found MySQL version number";}
+  if ($line =~ m|^revision-id: .*@.*-2\d{13}-\w+$|) {$found_revision = "Found BZR revision id";}
+}
+close I_SRC;
+print "INFO_SRC: $found_version / $found_revision\n";
+$found_compiler = "No line about compiler information";
+$found_features = "No line 'Feature flags'";
+open(I_BIN,"<","$dir_docs/INFO_BIN") or print "Cannot open 'INFO_BIN' in '$dir_docs'\n";
+while(defined ($line = <I_BIN>)) {
+  # "generator" on Windows, "flags" on Unix:
+  if (($line =~ m| Compiler / generator used: |) ||
+      ($line =~ m| Compiler flags used |))   {$found_compiler = "Found 'Compiler ... used' line";}
+  if  ($line =~ m| Feature flags used:|)     {$found_features = "Found 'Feature flags' line";}
+}
+close I_BIN;
+print "INFO_BIN: $found_compiler / $found_features\n";
+EOF
+
+--echo
+--echo End of tests

=== modified file 'mysql-test/t/gis.test'
--- a/mysql-test/t/gis.test	2011-02-08 15:49:51 +0000
+++ b/mysql-test/t/gis.test	2011-02-15 13:33:27 +0000
@@ -757,6 +757,17 @@ insert into t1 values (geomfromtext("poi
 select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
 drop table t1;
 
+
+--echo #
+--echo # Test for bug #59888 "debug assertion when attempt to create spatial index
+--echo #                      on char > 31 bytes".
+--echo #
+create table t1(a char(32) not null) engine=myisam;
+--error ER_SPATIAL_MUST_HAVE_GEOM_COL
+create spatial index i on t1 (a);
+drop table t1;
+
+
 --echo End of 5.1 tests
 
 #

=== modified file 'mysql-test/t/insert_select.test'
--- a/mysql-test/t/insert_select.test	2009-09-22 21:41:37 +0000
+++ b/mysql-test/t/insert_select.test	2011-02-16 20:45:52 +0000
@@ -407,7 +407,7 @@ SET GLOBAL myisam_data_pointer_size = 2;
 
 INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
 
-call mtr.add_suppression("mysqld: The table '.*#sql.*' is full");
+call mtr.add_suppression("mysqld.*: The table '.*#sql.*' is full");
 --error ER_RECORD_FILE_FULL,ER_RECORD_FILE_FULL
 INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
 

=== modified file 'mysql-test/t/ps.test'
--- a/mysql-test/t/ps.test	2010-11-13 15:05:02 +0000
+++ b/mysql-test/t/ps.test	2011-02-15 11:47:33 +0000
@@ -2305,40 +2305,6 @@ execute abc;
 deallocate prepare abc;
 
 
-create procedure proc_1() flush slave;
-call proc_1();
-call proc_1();
-call proc_1();
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush slave; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush slave";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1() flush master;
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush master; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush master";
-deallocate prepare abc;
-
-
 create procedure proc_1() flush des_key_file;
 call proc_1();
 call proc_1();

=== modified file 'mysql-test/t/sp-error.test'
--- a/mysql-test/t/sp-error.test	2010-10-26 11:48:08 +0000
+++ b/mysql-test/t/sp-error.test	2011-02-15 11:47:33 +0000
@@ -931,12 +931,6 @@ return 1; end|
 create function bug8409() returns int begin flush status;
 return 1; end|
 --error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin flush slave;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin flush master;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
 create function bug8409() returns int begin flush des_key_file;
 return 1; end|
 --error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG

=== modified file 'mysql-test/t/trigger.test'
--- a/mysql-test/t/trigger.test	2010-08-18 10:18:27 +0000
+++ b/mysql-test/t/trigger.test	2011-02-15 11:47:33 +0000
@@ -669,10 +669,6 @@ create trigger t1_ai after insert on t1
 --error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
 create trigger t1_ai after insert on t1 for each row flush status;
 --error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row flush slave;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row flush master;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
 create trigger t1_ai after insert on t1 for each row flush des_key_file;
 --error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
 create trigger t1_ai after insert on t1 for each row flush user_resources;
@@ -734,16 +730,6 @@ create procedure p1() flush status;
 --error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
 insert into t1 values (0);
 
-drop procedure p1;
-create procedure p1() flush slave;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() flush master;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
 drop procedure p1;
 create procedure p1() flush des_key_file;
 --error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG

=== 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 'mysys/my_bitmap.c'
--- a/mysys/my_bitmap.c	2011-01-11 09:09:21 +0000
+++ b/mysys/my_bitmap.c	2011-02-16 16:19:28 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -86,6 +86,7 @@ static inline void bitmap_lock(MY_BITMAP
     mysql_mutex_lock(map->mutex);
 }
 
+
 static inline void bitmap_unlock(MY_BITMAP *map __attribute__((unused)))
 {
   if (map->mutex)
@@ -93,6 +94,46 @@ static inline void bitmap_unlock(MY_BITM
 }
 
 
+static inline uint get_first_set(uint32 value, uint word_pos)
+{
+  uchar *byte_ptr= (uchar*)&value;
+  uchar byte_value;
+  uint byte_pos, bit_pos;
+
+  for (byte_pos=0; byte_pos < 4; byte_pos++, byte_ptr++)
+  {
+    byte_value= *byte_ptr;
+    if (byte_value)
+    {
+      for (bit_pos=0; ; bit_pos++)
+        if (byte_value & (1 << bit_pos))
+          return (word_pos*32) + (byte_pos*8) + bit_pos;
+    }
+  }
+  return MY_BIT_NONE;
+}
+
+
+static inline uint get_first_not_set(uint32 value, uint word_pos)
+{
+  uchar *byte_ptr= (uchar*)&value;
+  uchar byte_value;
+  uint byte_pos, bit_pos;
+
+  for (byte_pos=0; byte_pos < 4; byte_pos++, byte_ptr++)
+  {
+    byte_value= *byte_ptr;
+    if (byte_value != 0xFF)
+    {
+      for (bit_pos=0; ; bit_pos++)
+        if (!(byte_value & (1 << bit_pos)))
+          return (word_pos*32) + (byte_pos*8) + bit_pos;
+    }
+  }
+  return MY_BIT_NONE;
+}
+
+
 my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
 		    my_bool thread_safe __attribute__((unused)))
 {
@@ -251,7 +292,7 @@ void bitmap_set_prefix(MY_BITMAP *map, u
     memset(m, 0xff, prefix_bytes);
   m+= prefix_bytes;
   if ((prefix_bits= prefix_size & 7))
-    *m++= (1 << prefix_bits)-1;
+    *(m++)= (1 << prefix_bits)-1;
   if ((d= no_bytes_in_map(map)-prefix_bytes))
     bzero(m, d);
 }
@@ -259,28 +300,43 @@ void bitmap_set_prefix(MY_BITMAP *map, u
 
 my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size)
 {
-  uint prefix_bits= prefix_size & 0x7, res;
-  uchar *m= (uchar*)map->bitmap;
-  uchar *end_prefix= m+prefix_size/8;
-  uchar *end;
-  DBUG_ASSERT(m && prefix_size <= map->n_bits);
-  end= m+no_bytes_in_map(map);
-
-  while (m < end_prefix)
-    if (*m++ != 0xff)
-      return 0;
-
-  *map->last_word_ptr&= ~map->last_word_mask; /*Clear bits*/
-  res= 0;
-  if (prefix_bits && *m++ != (1 << prefix_bits)-1)
-    goto ret;
-
-  while (m < end)
-    if (*m++ != 0)
-      goto ret;
-  res= 1;
-ret:
-  return res; 
+  uint prefix_bits= prefix_size % 32;
+  my_bitmap_map *word_ptr= map->bitmap, last_word;
+  my_bitmap_map *end_prefix= word_ptr + prefix_size / 32;
+  DBUG_ASSERT(word_ptr && prefix_size <= map->n_bits);
+
+  /* 1: Words that should be filled with 1 */
+  for (; word_ptr < end_prefix; word_ptr++)
+    if (*word_ptr != 0xFFFFFFFF)
+      return FALSE;
+
+  last_word= *map->last_word_ptr & ~map->last_word_mask;
+
+  /* 2: Word which contains the end of the prefix (if any) */
+  if (prefix_bits)
+  {
+    if (word_ptr == map->last_word_ptr)
+      return uint4korr((uchar*)&last_word) == (uint32)((1 << prefix_bits) - 1);
+    else if (uint4korr((uchar*)word_ptr) != (uint32)((1 << prefix_bits) - 1))
+      return FALSE;
+    word_ptr++;
+  }
+
+  /* 3: Words that should be filled with 0 */
+  for (; word_ptr < map->last_word_ptr; word_ptr++)
+    if (*word_ptr != 0)
+      return FALSE;
+
+  /*
+    We can end up here in two situations:
+    1) We went through the whole bitmap in step 1. This will happen if the
+       whole bitmap is filled with 1 and prefix_size is a multiple of 32
+       (i.e. the prefix does not end in the middle of a word).
+       In this case word_ptr will be larger than map->last_word_ptr.
+    2) We have gone through steps 1-3 and just need to check that also
+       the last word is 0.
+  */
+  return word_ptr > map->last_word_ptr || last_word == 0;
 }
 
 
@@ -288,10 +344,12 @@ my_bool bitmap_is_set_all(const MY_BITMA
 {
   my_bitmap_map *data_ptr= map->bitmap;
   my_bitmap_map *end= map->last_word_ptr;
-  *map->last_word_ptr |= map->last_word_mask;
-  for (; data_ptr <= end; data_ptr++)
+
+  for (; data_ptr < end; data_ptr++)
     if (*data_ptr != 0xFFFFFFFF)
       return FALSE;
+  if ((*map->last_word_ptr | map->last_word_mask) != 0xFFFFFFFF)
+    return FALSE;
   return TRUE;
 }
 
@@ -299,13 +357,13 @@ my_bool bitmap_is_set_all(const MY_BITMA
 my_bool bitmap_is_clear_all(const MY_BITMAP *map)
 {
   my_bitmap_map *data_ptr= map->bitmap;
-  my_bitmap_map *end;
-  if (*map->last_word_ptr & ~map->last_word_mask)
-    return FALSE;
-  end= map->last_word_ptr;
+  my_bitmap_map *end= map->last_word_ptr;
+
   for (; data_ptr < end; data_ptr++)
     if (*data_ptr)
       return FALSE;
+  if (*map->last_word_ptr & ~map->last_word_mask)
+    return FALSE;
   return TRUE;
 }
 
@@ -319,14 +377,14 @@ my_bool bitmap_is_subset(const MY_BITMAP
               map1->n_bits==map2->n_bits);
 
   end= map1->last_word_ptr;
-  *map1->last_word_ptr &= ~map1->last_word_mask;
-  *map2->last_word_ptr &= ~map2->last_word_mask;
-  while (m1 <= end)
-  {
-    if ((*m1++) & ~(*m2++))
-      return 0;
-  }
-  return 1;
+  for (; m1 < end; m1++, m2++)
+    if (*m1 & ~(*m2))
+      return FALSE;
+
+  if ((*map1->last_word_ptr & ~map1->last_word_mask) &
+      ~(*map2->last_word_ptr & ~map2->last_word_mask))
+    return FALSE;
+  return TRUE;
 }
 
 /* True if bitmaps has any common bits */
@@ -339,14 +397,14 @@ my_bool bitmap_is_overlapping(const MY_B
               map1->n_bits==map2->n_bits);
 
   end= map1->last_word_ptr;
-  *map1->last_word_ptr &= ~map1->last_word_mask;
-  *map2->last_word_ptr &= ~map2->last_word_mask;
-  while (m1 <= end)
-  {
-    if ((*m1++) & (*m2++))
-      return 1;
-  }
-  return 0;
+  for (; m1 < end; m1++, m2++)
+    if (*m1 & *m2)
+      return TRUE;
+
+  if ((*map1->last_word_ptr & ~map1->last_word_mask) &
+      (*map2->last_word_ptr & ~map2->last_word_mask))
+    return TRUE;
+  return FALSE;
 }
 
 
@@ -358,15 +416,17 @@ void bitmap_intersect(MY_BITMAP *map, co
   DBUG_ASSERT(map->bitmap && map2->bitmap);
 
   end= to+min(len,len2);
-  *map2->last_word_ptr&= ~map2->last_word_mask; /*Clear last bits in map2*/
-  while (to < end)
-    *to++ &= *from++;
+  for (; to < end; to++, from++)
+    *to &= *from;
+
+  if (len >= len2)
+    map->bitmap[len2 - 1] &= ~map2->last_word_mask;
 
   if (len2 < len)
   {
     end+=len-len2;
-    while (to < end)
-      *to++=0;
+    for (; to < end; to++)
+      *to= 0;
   }
 }
 
@@ -397,8 +457,8 @@ void bitmap_set_above(MY_BITMAP *map, ui
   uchar *to= (uchar *)map->bitmap + from_byte;
   uchar *end= (uchar *)map->bitmap + (map->n_bits+7)/8;
 
-  while (to < end)
-    *to++= use_byte;
+  for (; to < end; to++)
+    *to= use_byte;
 }
 
 
@@ -407,59 +467,60 @@ void bitmap_subtract(MY_BITMAP *map, con
   my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
   DBUG_ASSERT(map->bitmap && map2->bitmap &&
               map->n_bits==map2->n_bits);
-
   end= map->last_word_ptr;
 
-  while (to <= end)
-    *to++ &= ~(*from++);
+  for (; to <= end; to++, from++)
+    *to &= ~(*from);
 }
 
 
 void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
 {
   my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
-
   DBUG_ASSERT(map->bitmap && map2->bitmap &&
               map->n_bits==map2->n_bits);
   end= map->last_word_ptr;
 
-  while (to <= end)
-    *to++ |= *from++;
+  for (; to <= end; to++, from++)
+    *to |= *from;
 }
 
 
 void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2)
 {
-  my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end= map->last_word_ptr;
+  my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
   DBUG_ASSERT(map->bitmap && map2->bitmap &&
               map->n_bits==map2->n_bits);
-  while (to <= end)
-    *to++ ^= *from++;
+  end= map->last_word_ptr;
+
+  for (; to <= end; to++, from++)
+    *to ^= *from;
 }
 
 
 void bitmap_invert(MY_BITMAP *map)
 {
   my_bitmap_map *to= map->bitmap, *end;
-
   DBUG_ASSERT(map->bitmap);
   end= map->last_word_ptr;
 
-  while (to <= end)
-    *to++ ^= 0xFFFFFFFF;
+  for (; to <= end; to++)
+    *to ^= 0xFFFFFFFF;
 }
 
 
 uint bitmap_bits_set(const MY_BITMAP *map)
-{  
-  uchar *m= (uchar*)map->bitmap;
-  uchar *end= m + no_bytes_in_map(map);
+{
+  my_bitmap_map *data_ptr= map->bitmap;
+  my_bitmap_map *end= map->last_word_ptr;
   uint res= 0;
-
   DBUG_ASSERT(map->bitmap);
-  *map->last_word_ptr&= ~map->last_word_mask; /*Reset last bits to zero*/
-  while (m < end)
-    res+= my_count_bits_ushort(*m++);
+
+  for (; data_ptr < end; data_ptr++)
+    res+= my_count_bits_uint32(*data_ptr);
+
+  /*Reset last bits to zero*/
+  res+= my_count_bits_uint32(*map->last_word_ptr & ~map->last_word_mask);
   return res;
 }
 
@@ -467,76 +528,44 @@ uint bitmap_bits_set(const MY_BITMAP *ma
 void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2)
 {
   my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
-
   DBUG_ASSERT(map->bitmap && map2->bitmap &&
               map->n_bits==map2->n_bits);
   end= map->last_word_ptr;
-  while (to <= end)
-    *to++ = *from++;
+
+  for (; to <= end; to++, from++)
+    *to = *from;
 }
 
 
 uint bitmap_get_first_set(const MY_BITMAP *map)
 {
-  uchar *byte_ptr;
-  uint i,j,k;
+  uint word_pos;
   my_bitmap_map *data_ptr, *end= map->last_word_ptr;
 
   DBUG_ASSERT(map->bitmap);
   data_ptr= map->bitmap;
-  *map->last_word_ptr &= ~map->last_word_mask;
 
-  for (i=0; data_ptr <= end; data_ptr++, i++)
-  {
+  for (word_pos=0; data_ptr < end; data_ptr++, word_pos++)
     if (*data_ptr)
-    {
-      byte_ptr= (uchar*)data_ptr;
-      for (j=0; ; j++, byte_ptr++)
-      {
-        if (*byte_ptr)
-        {
-          for (k=0; ; k++)
-          {
-            if (*byte_ptr & (1 << k))
-              return (i*32) + (j*8) + k;
-          }
-        }
-      }
-    }
-  }
-  return MY_BIT_NONE;
+      return get_first_set(*data_ptr, word_pos);
+
+  return get_first_set(*map->last_word_ptr & ~map->last_word_mask, word_pos);
 }
 
 
 uint bitmap_get_first(const MY_BITMAP *map)
 {
-  uchar *byte_ptr;
-  uint i,j,k;
+  uint word_pos;
   my_bitmap_map *data_ptr, *end= map->last_word_ptr;
 
   DBUG_ASSERT(map->bitmap);
   data_ptr= map->bitmap;
-  *map->last_word_ptr|= map->last_word_mask;
 
-  for (i=0; data_ptr <= end; data_ptr++, i++)
-  {
+  for (word_pos=0; data_ptr < end; data_ptr++, word_pos++)
     if (*data_ptr != 0xFFFFFFFF)
-    {
-      byte_ptr= (uchar*)data_ptr;
-      for (j=0; ; j++, byte_ptr++)
-      {
-        if (*byte_ptr != 0xFF)
-        {
-          for (k=0; ; k++)
-          {
-            if (!(*byte_ptr & (1 << k)))
-              return (i*32) + (j*8) + k;
-          }
-        }
-      }
-    }
-  }
-  return MY_BIT_NONE;
+      return get_first_not_set(*data_ptr, word_pos);
+
+  return get_first_not_set(*map->last_word_ptr | map->last_word_mask, word_pos);
 }
 
 
@@ -557,376 +586,3 @@ void bitmap_lock_clear_bit(MY_BITMAP *ma
   bitmap_clear_bit(map, bitmap_bit);
   bitmap_unlock(map);
 }
-
-#ifdef MAIN
-
-uint get_rand_bit(uint bitsize)
-{
-  return (rand() % bitsize);
-}
-
-bool test_set_get_clear_bit(MY_BITMAP *map, uint bitsize)
-{
-  uint i, test_bit;
-  uint no_loops= bitsize > 128 ? 128 : bitsize;
-  for (i=0; i < no_loops; i++)
-  {
-    test_bit= get_rand_bit(bitsize);
-    bitmap_set_bit(map, test_bit);
-    if (!bitmap_is_set(map, test_bit))
-      goto error1;
-    bitmap_clear_bit(map, test_bit);
-    if (bitmap_is_set(map, test_bit))
-      goto error2;
-  }
-  return FALSE;
-error1:
-  printf("Error in set bit, bit %u, bitsize = %u", test_bit, bitsize);
-  return TRUE;
-error2:
-  printf("Error in clear bit, bit %u, bitsize = %u", test_bit, bitsize);
-  return TRUE;
-}
-
-bool test_flip_bit(MY_BITMAP *map, uint bitsize)
-{
-  uint i, test_bit;
-  uint no_loops= bitsize > 128 ? 128 : bitsize;
-  for (i=0; i < no_loops; i++)
-  {
-    test_bit= get_rand_bit(bitsize);
-    bitmap_flip_bit(map, test_bit);
-    if (!bitmap_is_set(map, test_bit))
-      goto error1;
-    bitmap_flip_bit(map, test_bit);
-    if (bitmap_is_set(map, test_bit))
-      goto error2;
-  }
-  return FALSE;
-error1:
-  printf("Error in flip bit 1, bit %u, bitsize = %u", test_bit, bitsize);
-  return TRUE;
-error2:
-  printf("Error in flip bit 2, bit %u, bitsize = %u", test_bit, bitsize);
-  return TRUE;
-}
-
-bool test_operators(MY_BITMAP *map __attribute__((unused)),
-                    uint bitsize __attribute__((unused)))
-{
-  return FALSE;
-}
-
-bool test_get_all_bits(MY_BITMAP *map, uint bitsize)
-{
-  uint i;
-  bitmap_set_all(map);
-  if (!bitmap_is_set_all(map))
-    goto error1;
-  if (!bitmap_is_prefix(map, bitsize))
-    goto error5;
-  bitmap_clear_all(map);
-  if (!bitmap_is_clear_all(map))
-    goto error2;
-  if (!bitmap_is_prefix(map, 0))
-    goto error6;
-  for (i=0; i<bitsize;i++)
-    bitmap_set_bit(map, i);
-  if (!bitmap_is_set_all(map))
-    goto error3;
-  for (i=0; i<bitsize;i++)
-    bitmap_clear_bit(map, i);
-  if (!bitmap_is_clear_all(map))
-    goto error4;
-  return FALSE;
-error1:
-  printf("Error in set_all, bitsize = %u", bitsize);
-  return TRUE;
-error2:
-  printf("Error in clear_all, bitsize = %u", bitsize);
-  return TRUE;
-error3:
-  printf("Error in bitmap_is_set_all, bitsize = %u", bitsize);
-  return TRUE;
-error4:
-  printf("Error in bitmap_is_clear_all, bitsize = %u", bitsize);
-  return TRUE;
-error5:
-  printf("Error in set_all through set_prefix, bitsize = %u", bitsize);
-  return TRUE;
-error6:
-  printf("Error in clear_all through set_prefix, bitsize = %u", bitsize);
-  return TRUE;
-}
-
-bool test_compare_operators(MY_BITMAP *map, uint bitsize)
-{
-  uint i, j, test_bit1, test_bit2, test_bit3,test_bit4;
-  uint no_loops= bitsize > 128 ? 128 : bitsize;
-  MY_BITMAP map2_obj, map3_obj;
-  MY_BITMAP *map2= &map2_obj, *map3= &map3_obj;
-  my_bitmap_map map2buf[1024];
-  my_bitmap_map map3buf[1024];
-  bitmap_init(&map2_obj, map2buf, bitsize, FALSE);
-  bitmap_init(&map3_obj, map3buf, bitsize, FALSE);
-  bitmap_clear_all(map2);
-  bitmap_clear_all(map3);
-  for (i=0; i < no_loops; i++)
-  {
-    test_bit1=get_rand_bit(bitsize);
-    bitmap_set_prefix(map, test_bit1);
-    test_bit2=get_rand_bit(bitsize);
-    bitmap_set_prefix(map2, test_bit2);
-    bitmap_intersect(map, map2);
-    test_bit3= test_bit2 < test_bit1 ? test_bit2 : test_bit1;
-    bitmap_set_prefix(map3, test_bit3);
-    if (!bitmap_cmp(map, map3))
-      goto error1;
-    bitmap_clear_all(map);
-    bitmap_clear_all(map2);
-    bitmap_clear_all(map3);
-    test_bit1=get_rand_bit(bitsize);
-    test_bit2=get_rand_bit(bitsize);
-    test_bit3=get_rand_bit(bitsize);
-    bitmap_set_prefix(map, test_bit1);
-    bitmap_set_prefix(map2, test_bit2);
-    test_bit3= test_bit2 > test_bit1 ? test_bit2 : test_bit1;
-    bitmap_set_prefix(map3, test_bit3);
-    bitmap_union(map, map2);
-    if (!bitmap_cmp(map, map3))
-      goto error2;
-    bitmap_clear_all(map);
-    bitmap_clear_all(map2);
-    bitmap_clear_all(map3);
-    test_bit1=get_rand_bit(bitsize);
-    test_bit2=get_rand_bit(bitsize);
-    test_bit3=get_rand_bit(bitsize);
-    bitmap_set_prefix(map, test_bit1);
-    bitmap_set_prefix(map2, test_bit2);
-    bitmap_xor(map, map2);
-    test_bit3= test_bit2 > test_bit1 ? test_bit2 : test_bit1;
-    test_bit4= test_bit2 < test_bit1 ? test_bit2 : test_bit1;
-    bitmap_set_prefix(map3, test_bit3);
-    for (j=0; j < test_bit4; j++)
-      bitmap_clear_bit(map3, j);
-    if (!bitmap_cmp(map, map3))
-      goto error3;
-    bitmap_clear_all(map);
-    bitmap_clear_all(map2);
-    bitmap_clear_all(map3);
-    test_bit1=get_rand_bit(bitsize);
-    test_bit2=get_rand_bit(bitsize);
-    test_bit3=get_rand_bit(bitsize);
-    bitmap_set_prefix(map, test_bit1);
-    bitmap_set_prefix(map2, test_bit2);
-    bitmap_subtract(map, map2);
-    if (test_bit2 < test_bit1)
-    {
-      bitmap_set_prefix(map3, test_bit1);
-      for (j=0; j < test_bit2; j++)
-        bitmap_clear_bit(map3, j);
-    }
-    if (!bitmap_cmp(map, map3))
-      goto error4;
-    bitmap_clear_all(map);
-    bitmap_clear_all(map2);
-    bitmap_clear_all(map3);
-    test_bit1=get_rand_bit(bitsize);
-    bitmap_set_prefix(map, test_bit1);
-    bitmap_invert(map);
-    bitmap_set_all(map3);
-    for (j=0; j < test_bit1; j++)
-      bitmap_clear_bit(map3, j);
-    if (!bitmap_cmp(map, map3))
-      goto error5;
-    bitmap_clear_all(map);
-    bitmap_clear_all(map3);
-  }
-  return FALSE;
-error1:
-  printf("intersect error  bitsize=%u,size1=%u,size2=%u", bitsize,
-  test_bit1,test_bit2);
-  return TRUE;
-error2:
-  printf("union error  bitsize=%u,size1=%u,size2=%u", bitsize,
-  test_bit1,test_bit2);
-  return TRUE;
-error3:
-  printf("xor error  bitsize=%u,size1=%u,size2=%u", bitsize,
-  test_bit1,test_bit2);
-  return TRUE;
-error4:
-  printf("subtract error  bitsize=%u,size1=%u,size2=%u", bitsize,
-  test_bit1,test_bit2);
-  return TRUE;
-error5:
-  printf("invert error  bitsize=%u,size=%u", bitsize,
-  test_bit1);
-  return TRUE;
-}
-
-bool test_count_bits_set(MY_BITMAP *map, uint bitsize)
-{
-  uint i, bit_count=0, test_bit;
-  uint no_loops= bitsize > 128 ? 128 : bitsize;
-  for (i=0; i < no_loops; i++)
-  {
-    test_bit=get_rand_bit(bitsize);
-    if (!bitmap_is_set(map, test_bit))
-    {
-      bitmap_set_bit(map, test_bit);
-      bit_count++;
-    }
-  }
-  if (bit_count==0 && bitsize > 0)
-    goto error1;
-  if (bitmap_bits_set(map) != bit_count)
-    goto error2;
-  return FALSE;
-error1:
-  printf("No bits set  bitsize = %u", bitsize);
-  return TRUE;
-error2:
-  printf("Wrong count of bits set, bitsize = %u", bitsize);
-  return TRUE;
-}
-
-bool test_get_first_bit(MY_BITMAP *map, uint bitsize)
-{
-  uint i, test_bit;
-  uint no_loops= bitsize > 128 ? 128 : bitsize;
-  for (i=0; i < no_loops; i++)
-  {
-    test_bit=get_rand_bit(bitsize);
-    bitmap_set_bit(map, test_bit);
-    if (bitmap_get_first_set(map) != test_bit)
-      goto error1;
-    bitmap_set_all(map);
-    bitmap_clear_bit(map, test_bit);
-    if (bitmap_get_first(map) != test_bit)
-      goto error2;
-    bitmap_clear_all(map);
-  }
-  return FALSE;
-error1:
-  printf("get_first_set error bitsize=%u,prefix_size=%u",bitsize,test_bit);
-  return TRUE;
-error2:
-  printf("get_first error bitsize= %u, prefix_size= %u",bitsize,test_bit);
-  return TRUE;
-}
-
-bool test_get_next_bit(MY_BITMAP *map, uint bitsize)
-{
-  uint i, j, test_bit;
-  uint no_loops= bitsize > 128 ? 128 : bitsize;
-  for (i=0; i < no_loops; i++)
-  {
-    test_bit=get_rand_bit(bitsize);
-    for (j=0; j < test_bit; j++)
-      bitmap_set_next(map);
-    if (!bitmap_is_prefix(map, test_bit))
-      goto error1;
-    bitmap_clear_all(map);
-  }
-  return FALSE;
-error1:
-  printf("get_next error  bitsize= %u, prefix_size= %u", bitsize,test_bit);
-  return TRUE;
-}
-
-bool test_prefix(MY_BITMAP *map, uint bitsize)
-{
-  uint i, j, test_bit;
-  uint no_loops= bitsize > 128 ? 128 : bitsize;
-  for (i=0; i < no_loops; i++)
-  {
-    test_bit=get_rand_bit(bitsize);
-    bitmap_set_prefix(map, test_bit);
-    if (!bitmap_is_prefix(map, test_bit))
-      goto error1;
-    bitmap_clear_all(map);
-    for (j=0; j < test_bit; j++)
-      bitmap_set_bit(map, j);
-    if (!bitmap_is_prefix(map, test_bit))
-      goto error2;
-    bitmap_set_all(map);
-    for (j=bitsize - 1; ~(j-test_bit); j--)
-      bitmap_clear_bit(map, j);
-    if (!bitmap_is_prefix(map, test_bit))
-      goto error3;
-    bitmap_clear_all(map);
-  }
-  return FALSE;
-error1:
-  printf("prefix1 error  bitsize = %u, prefix_size = %u", bitsize,test_bit);
-  return TRUE;
-error2:
-  printf("prefix2 error  bitsize = %u, prefix_size = %u", bitsize,test_bit);
-  return TRUE;
-error3:
-  printf("prefix3 error  bitsize = %u, prefix_size = %u", bitsize,test_bit);
-  return TRUE;
-}
-
-
-bool do_test(uint bitsize)
-{
-  MY_BITMAP map;
-  my_bitmap_map buf[1024];
-  if (bitmap_init(&map, buf, bitsize, FALSE))
-  {
-    printf("init error for bitsize %d", bitsize);
-    goto error;
-  }
-  if (test_set_get_clear_bit(&map,bitsize))
-    goto error;
-  bitmap_clear_all(&map);
-  if (test_flip_bit(&map,bitsize))
-    goto error;
-  bitmap_clear_all(&map);
-  if (test_operators(&map,bitsize))
-    goto error;
-  bitmap_clear_all(&map);
-  if (test_get_all_bits(&map, bitsize))
-    goto error;
-  bitmap_clear_all(&map);
-  if (test_compare_operators(&map,bitsize))
-    goto error;
-  bitmap_clear_all(&map);
-  if (test_count_bits_set(&map,bitsize))
-    goto error;
-  bitmap_clear_all(&map);
-  if (test_get_first_bit(&map,bitsize))
-    goto error;
-  bitmap_clear_all(&map);
-  if (test_get_next_bit(&map,bitsize))
-    goto error;
-  if (test_prefix(&map,bitsize))
-    goto error;
-  return FALSE;
-error:
-  printf("\n");
-  return TRUE;
-}
-
-int main()
-{
-  int i;
-  for (i= 1; i < 4096; i++)
-  {
-    printf("Start test for bitsize=%u\n",i);
-    if (do_test(i))
-      return -1;
-  }
-  printf("OK\n");
-  return 0;
-}
-
-/*
-  In directory mysys:
-  make test_bitmap
-  will build the bitmap tests and ./test_bitmap will execute it
-*/
-
-#endif

=== 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/log.cc'
--- a/sql/log.cc	2011-02-08 17:48:20 +0000
+++ b/sql/log.cc	2011-02-09 07:31:17 +0000
@@ -2209,7 +2209,7 @@ int my_plugin_log_message(MYSQL_PLUGIN *
   struct st_plugin_int *plugin = (st_plugin_int *) plugin_ptr;
   va_list args;
 
-  DBUG_ASSERT(lvl >= ERROR_LEVEL || lvl <= INFORMATION_LEVEL);
+  DBUG_ASSERT(level >= MY_ERROR_LEVEL || level <= MY_INFORMATION_LEVEL);
 
   switch (level)
   {

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-02-04 05:11:09 +0000
+++ b/sql/mysqld.cc	2011-02-16 17:13:30 +0000
@@ -3035,7 +3035,6 @@ SHOW_VAR com_status_vars[]= {
   {"show_grants",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_GRANTS]), SHOW_LONG_STATUS},
   {"show_keys",            (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
   {"show_master_status",   (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS},
-  {"show_new_master",      (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_NEW_MASTER]), SHOW_LONG_STATUS},
   {"show_open_tables",     (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS},
   {"show_plugins",         (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PLUGINS]), SHOW_LONG_STATUS},
   {"show_privileges",      (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PRIVILEGES]), SHOW_LONG_STATUS},

=== modified file 'sql/rpl_master.cc'
--- a/sql/rpl_master.cc	2011-01-31 13:44:38 +0000
+++ b/sql/rpl_master.cc	2011-02-16 17:13:30 +0000
@@ -1395,23 +1395,6 @@ int reset_master(THD* thd)
   return 0;
 }
 
-int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
-		   const char* log_file_name2, ulonglong log_pos2)
-{
-  int res;
-  size_t log_file_name1_len=  strlen(log_file_name1);
-  size_t log_file_name2_len=  strlen(log_file_name2);
-
-  //  We assume that both log names match up to '.'
-  if (log_file_name1_len == log_file_name2_len)
-  {
-    if ((res= strcmp(log_file_name1, log_file_name2)))
-      return res;
-    return (log_pos1 < log_pos2) ? -1 : (log_pos1 == log_pos2) ? 0 : 1;
-  }
-  return ((log_file_name1_len < log_file_name2_len) ? -1 : 1);
-}
-
 
 /**
   Execute a SHOW MASTER STATUS statement.

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2011-02-03 10:13:06 +0000
+++ b/sql/rpl_slave.cc	2011-02-14 16:07:38 +0000
@@ -2067,6 +2067,9 @@ bool show_master_info(THD* thd, Master_i
                                            MYSQL_TYPE_LONGLONG));
   field_list.push_back(new Item_empty_string("Master_Bind",
                                              sizeof(mi->bind_addr)));
+  field_list.push_back(new Item_empty_string("Last_IO_Error_Timestamp", 20));
+  field_list.push_back(new Item_empty_string("Last_SQL_Error_Timestamp", 20));
+
 
   if (protocol->send_result_set_metadata(&field_list,
                             Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -2185,30 +2188,11 @@ bool show_master_info(THD* thd, Master_i
     // Last_IO_Errno
     protocol->store(mi->last_error().number);
     // Last_IO_Error
-    if (*mi->last_error().message != '\0')
-    {
-      String msg_buf;
-      msg_buf.append(mi->last_error().timestamp);
-      msg_buf.append(" ");
-      msg_buf.append(mi->last_error().message);
-      protocol->store(msg_buf.c_ptr_safe(), &my_charset_bin);
-    }
-    else
-      protocol->store(mi->last_error().message, &my_charset_bin);
+    protocol->store(mi->last_error().message, &my_charset_bin);
     // Last_SQL_Errno
     protocol->store(mi->rli->last_error().number);
     // Last_SQL_Error
-    if (*mi->rli->last_error().message != '\0')
-    {
-      String msg_buf;
-      msg_buf.append(mi->rli->last_error().timestamp);
-      msg_buf.append(" ");
-      msg_buf.append(mi->rli->last_error().message);
-      protocol->store(msg_buf.c_ptr_safe(), &my_charset_bin);
-    }
-    else
-      protocol->store(mi->rli->last_error().message, &my_charset_bin);
-
+    protocol->store(mi->rli->last_error().message, &my_charset_bin);
     // Replicate_Ignore_Server_Ids
     {
       char buff[FN_REFLEN];
@@ -2257,6 +2241,10 @@ bool show_master_info(THD* thd, Master_i
     protocol->store((ulonglong) mi->retry_count);
     // Master_Bind
     protocol->store(mi->bind_addr, &my_charset_bin);
+    // Last_IO_Error_Timestamp
+    protocol->store(mi->last_error().timestamp, &my_charset_bin);
+    // Last_SQL_Error_Timestamp
+    protocol->store(mi->rli->last_error().timestamp, &my_charset_bin);
 
     mysql_mutex_unlock(&mi->rli->err_lock);
     mysql_mutex_unlock(&mi->err_lock);

=== modified file 'sql/rpl_slave.h'
--- a/sql/rpl_slave.h	2010-12-10 16:55:50 +0000
+++ b/sql/rpl_slave.h	2011-02-16 17:13:30 +0000
@@ -158,8 +158,6 @@ extern const char *relay_log_basename;
 int start_slave(THD* thd, Master_info* mi, bool net_report);
 int stop_slave(THD* thd, Master_info* mi, bool net_report);
 bool change_master(THD* thd, Master_info* mi);
-int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
-		   const char* log_file_name2, ulonglong log_pos2);
 int reset_slave(THD *thd, Master_info* mi);
 int init_slave();
 int init_recovery(Master_info* mi, const char** errmsg);

=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt	2011-02-08 17:48:20 +0000
+++ b/sql/share/errmsg-utf8.txt	2011-02-15 12:38:39 +0000
@@ -2494,10 +2494,10 @@ ER_TOO_BIG_SELECT 42000
         cze "Zadan-B�� SELECT by proch��zel p����li�� mnoho z�E a je-li SELECT v po����dku, pou��ijte SET SQL_BIG_SELECTS=1"
         dan "SELECT ville unders��ge for mange poster og ville sandsynligvis tage meget lang tid. Unders��g WHERE delen og brug SET SQL_BIG_SELECTS=1 hvis udtrykket er korrekt"
         nla "Het SELECT-statement zou te veel records analyseren en dus veel tijd in beslagnemen. Kijk het WHERE-gedeelte van de query na en kies SET SQL_BIG_SELECTS=1 als het stament in orde is."
-        eng "The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay"
+        eng "The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay"
         est "SELECT lause peab l��bi vaatama suure hulga kirjeid ja v��taks t��en��oliselt liiga kaua aega. Tasub kontrollida WHERE klauslit ja vajadusel kasutada kevoir examiner beaucoup d'enregistrements ce qui va prendre du temps. V��rifiez la clause WHERE et utilisez SET SQL_BIG_SELECTS=1 si SELECT se passe bien"
-        ger "Die Ausf��hrung des SELECT w��rde zu viele Datens��tze untersuchen und wahrscheinlich sehr lange dauern. Bitte WHERE-Klausel ��berpr��fen und gegebenenfalls SET SQL_BIG_SELECTS=1 oder SET SQL_MAX_JOIN_SIZE=# verwenden"
+        ger "Die Ausf��hrung des SELECT w��rde zu viele Datens��tze untersuchen und wahrscheinlich sehr lange dauern. Bitte WHERE-Klausel ��berpr��fen und gegebenenfalls SET SQL_BIG_SELECTS=1 oder SET MAX_JOIN_SIZE=# verwenden"
         greek "����������������������. ���������������� ���������������� ���S=1 ���� ���� SELECT ������A SELECT tul sok rekordot fog megvizsgalni es nagyon sokaig fog tartani. Ellenorizze a WHERE-t es hasznalja a SET SQL_BIG_SELECTS=1 beallitast, ha a SELECT okay"
         ita "La SELECT dovrebbe esaminare troppi record e usare troppo tempo. Controllare la WHERE e usa SET SQL_BIG_SELECTS=1 se e` tutto a posto."

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2010-12-17 11:28:59 +0000
+++ b/sql/sp_head.cc	2011-02-16 17:13:30 +0000
@@ -237,7 +237,6 @@ sp_get_flags_for_command(LEX *lex)
   case SQLCOM_SHOW_EVENTS:
   case SQLCOM_SHOW_KEYS:
   case SQLCOM_SHOW_MASTER_STAT:
-  case SQLCOM_SHOW_NEW_MASTER:
   case SQLCOM_SHOW_OPEN_TABLES:
   case SQLCOM_SHOW_PRIVILEGES:
   case SQLCOM_SHOW_PROCESSLIST:

=== modified file 'sql/sql_cmd.h'
--- a/sql/sql_cmd.h	2010-04-16 09:07:23 +0000
+++ b/sql/sql_cmd.h	2011-02-16 17:13:30 +0000
@@ -60,7 +60,7 @@ enum enum_sql_command {
   SQLCOM_SHOW_OPEN_TABLES,
   SQLCOM_HA_OPEN, SQLCOM_HA_CLOSE, SQLCOM_HA_READ,
   SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI,
-  SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_NEW_MASTER, SQLCOM_DO,
+  SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_DO,
   SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS,
   SQLCOM_SHOW_STORAGE_ENGINES, SQLCOM_SHOW_PRIVILEGES,
   SQLCOM_HELP, SQLCOM_CREATE_USER, SQLCOM_DROP_USER, SQLCOM_RENAME_USER,

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2011-01-26 07:37:18 +0000
+++ b/sql/sql_lex.h	2011-02-16 17:13:30 +0000
@@ -196,8 +196,7 @@ typedef struct st_lex_server_options
 
 
 /**
-  Structure to hold parameters for CHANGE MASTER or START/STOP SLAVE
-  or SHOW NEW MASTER.
+  Structure to hold parameters for CHANGE MASTER, START SLAVE, and STOP SLAVE.
 
   Remark: this should not be confused with Master_info (and perhaps
   would better be renamed to st_lex_replication_info).  Some fields,

=== 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/sql_parse.cc'
--- a/sql/sql_parse.cc	2011-02-07 11:49:18 +0000
+++ b/sql/sql_parse.cc	2011-02-16 17:13:30 +0000
@@ -354,7 +354,6 @@ void init_update_queries(void)
   sql_command_flags[SQLCOM_SHOW_VARIABLES]=   CF_STATUS_COMMAND | CF_REEXECUTION_FRAGILE;
   sql_command_flags[SQLCOM_SHOW_CHARSETS]=    CF_STATUS_COMMAND | CF_REEXECUTION_FRAGILE;
   sql_command_flags[SQLCOM_SHOW_COLLATIONS]=  CF_STATUS_COMMAND | CF_REEXECUTION_FRAGILE;
-  sql_command_flags[SQLCOM_SHOW_NEW_MASTER]=  CF_STATUS_COMMAND;
   sql_command_flags[SQLCOM_SHOW_BINLOGS]=     CF_STATUS_COMMAND;
   sql_command_flags[SQLCOM_SHOW_SLAVE_HOSTS]= CF_STATUS_COMMAND;
   sql_command_flags[SQLCOM_SHOW_BINLOG_EVENTS]= CF_STATUS_COMMAND;
@@ -2187,14 +2186,6 @@ case SQLCOM_PREPARE:
 #endif
     break;
   }
-  case SQLCOM_SHOW_NEW_MASTER:
-  {
-    if (check_global_access(thd, REPL_SLAVE_ACL))
-      goto error;
-    /* This query don't work now.*/
-    my_error(ER_NOT_SUPPORTED_YET, MYF(0), "SHOW NEW MASTER");
-    goto error;
-  }
 
 #ifdef HAVE_REPLICATION
   case SQLCOM_SHOW_SLAVE_HOSTS:

=== modified file 'sql/sql_string.cc'
--- a/sql/sql_string.cc	2011-01-13 08:19:52 +0000
+++ b/sql/sql_string.cc	2011-02-15 11:30:56 +0000
@@ -750,140 +750,6 @@ String *copy_if_not_alloced(String *to,S
   Help functions
 ****************************************************************************/
 
-/*
-  copy a string from one character set to another
-  
-  SYNOPSIS
-    copy_and_convert()
-    to			Store result here
-    to_cs		Character set of result string
-    from		Copy from here
-    from_length		Length of from string
-    from_cs		From character set
-
-  NOTES
-    'to' must be big enough as form_length * to_cs->mbmaxlen
-
-  RETURN
-    length of bytes copied to 'to'
-*/
-
-
-static uint32
-copy_and_convert_extended(char *to, uint32 to_length, CHARSET_INFO *to_cs, 
-                          const char *from, uint32 from_length,
-                          CHARSET_INFO *from_cs,
-                          uint *errors)
-{
-  int         cnvres;
-  my_wc_t     wc;
-  const uchar *from_end= (const uchar*) from+from_length;
-  char *to_start= to;
-  uchar *to_end= (uchar*) to+to_length;
-  my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
-  my_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb;
-  uint error_count= 0;
-
-  while (1)
-  {
-    if ((cnvres= (*mb_wc)(from_cs, &wc, (uchar*) from,
-				      from_end)) > 0)
-      from+= cnvres;
-    else if (cnvres == MY_CS_ILSEQ)
-    {
-      error_count++;
-      from++;
-      wc= '?';
-    }
-    else if (cnvres > MY_CS_TOOSMALL)
-    {
-      /*
-        A correct multibyte sequence detected
-        But it doesn't have Unicode mapping.
-      */
-      error_count++;
-      from+= (-cnvres);
-      wc= '?';
-    }
-    else
-      break;  // Not enough characters
-
-outp:
-    if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0)
-      to+= cnvres;
-    else if (cnvres == MY_CS_ILUNI && wc != '?')
-    {
-      error_count++;
-      wc= '?';
-      goto outp;
-    }
-    else
-      break;
-  }
-  *errors= error_count;
-  return (uint32) (to - to_start);
-}
-
-
-/*
-  Optimized for quick copying of ASCII characters in the range 0x00..0x7F.
-*/
-uint32
-copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, 
-                 const char *from, uint32 from_length, CHARSET_INFO *from_cs,
-                 uint *errors)
-{
-  /*
-    If any of the character sets is not ASCII compatible,
-    immediately switch to slow mb_wc->wc_mb method.
-  */
-  if ((to_cs->state | from_cs->state) & MY_CS_NONASCII)
-    return copy_and_convert_extended(to, to_length, to_cs,
-                                     from, from_length, from_cs, errors);
-
-  uint32 length= min(to_length, from_length), length2= length;
-
-#if defined(__i386__)
-  /*
-    Special loop for i386, it allows to refer to a
-    non-aligned memory block as UINT32, which makes
-    it possible to copy four bytes at once. This
-    gives about 10% performance improvement comparing
-    to byte-by-byte loop.
-  */
-  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
-  {
-    if ((*(uint32*)from) & 0x80808080)
-      break;
-    *((uint32*) to)= *((const uint32*) from);
-  }
-#endif
-
-  for (; ; *to++= *from++, length--)
-  {
-    if (!length)
-    {
-      *errors= 0;
-      return length2;
-    }
-    if (*((unsigned char*) from) > 0x7F) /* A non-ASCII character */
-    {
-      uint32 copied_length= length2 - length;
-      to_length-= copied_length;
-      from_length-= copied_length;
-      return copied_length + copy_and_convert_extended(to, to_length,
-                                                       to_cs,
-                                                       from, from_length,
-                                                       from_cs,
-                                                       errors);
-    }
-  }
-
-  DBUG_ASSERT(FALSE); // Should never get to here
-  return 0;           // Make compiler happy
-}
-
-
 /**
   Copy string with HEX-encoding of "bad" characters.
 

=== modified file 'sql/sql_string.h'
--- a/sql/sql_string.h	2011-01-13 08:19:52 +0000
+++ b/sql/sql_string.h	2011-02-15 11:30:56 +0000
@@ -33,9 +33,12 @@ typedef struct st_mem_root MEM_ROOT;
 
 int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
 String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
-uint32 copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
-			const char *from, uint32 from_length,
-			CHARSET_INFO *from_cs, uint *errors);
+inline uint32 copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+                               const char *from, uint32 from_length,
+                               CHARSET_INFO *from_cs, uint *errors)
+{
+  return my_convert(to, to_length, to_cs, from, from_length, from_cs, errors);
+}
 uint32 well_formed_copy_nchars(CHARSET_INFO *to_cs,
                                char *to, uint to_length,
                                CHARSET_INFO *from_cs,

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2011-02-03 10:13:06 +0000
+++ b/sql/sql_yacc.yy	2011-02-16 17:13:30 +0000
@@ -11066,19 +11066,6 @@ show_param:
             if (prepare_schema_table(YYTHD, lex, $4, SCH_COLUMNS))
               MYSQL_YYABORT;
           }
-        | NEW_SYM MASTER_SYM FOR_SYM SLAVE
-          WITH MASTER_LOG_FILE_SYM EQ
-          TEXT_STRING_sys /* $8 */
-          AND_SYM MASTER_LOG_POS_SYM EQ
-          ulonglong_num /* $12 */
-          AND_SYM MASTER_SERVER_ID_SYM EQ
-          ulong_num /* $16 */
-          {
-            Lex->sql_command = SQLCOM_SHOW_NEW_MASTER;
-            Lex->mi.log_file_name = $8.str;
-            Lex->mi.pos = $12;
-            Lex->mi.server_id = $16;
-          }
         | master_or_binary LOGS_SYM
           {
             Lex->sql_command = SQLCOM_SHOW_BINLOGS;
@@ -11459,10 +11446,6 @@ flush_option:
           { Lex->type|= REFRESH_LOG; }
         | STATUS_SYM
           { Lex->type|= REFRESH_STATUS; }
-        | SLAVE
-          { Lex->type|= REFRESH_SLAVE; }
-        | MASTER_SYM
-          { Lex->type|= REFRESH_MASTER; }
         | DES_KEY_FILE
           { Lex->type|= REFRESH_DES_KEY_FILE; }
         | RESOURCES

=== 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)
   {

=== modified file 'storage/myisam/mi_create.c'
--- a/storage/myisam/mi_create.c	2010-11-16 09:45:07 +0000
+++ b/storage/myisam/mi_create.c	2011-02-15 12:04:52 +0000
@@ -269,7 +269,7 @@ int mi_create(const char *name,uint keys
             keyseg->type != HA_KEYTYPE_VARBINARY2)
         {
           my_errno=HA_WRONG_CREATE_OPTION;
-          goto err;
+          goto err_no_lock;
         }
       }
       keydef->keysegs+=sp_segs;
@@ -278,7 +278,7 @@ int mi_create(const char *name,uint keys
       min_key_length_skip+=SPLEN*2*SPDIMS;
 #else
       my_errno= HA_ERR_UNSUPPORTED;
-      goto err;
+      goto err_no_lock;
 #endif /*HAVE_SPATIAL*/
     }
     else if (keydef->flag & HA_FULLTEXT)
@@ -294,7 +294,7 @@ int mi_create(const char *name,uint keys
             keyseg->type != HA_KEYTYPE_VARTEXT2)
         {
           my_errno=HA_WRONG_CREATE_OPTION;
-          goto err;
+          goto err_no_lock;
         }
         if (!(keyseg->flag & HA_BLOB_PART) &&
 	    (keyseg->type == HA_KEYTYPE_VARTEXT1 ||
@@ -419,7 +419,7 @@ int mi_create(const char *name,uint keys
     if (keydef->keysegs > MI_MAX_KEY_SEG)
     {
       my_errno=HA_WRONG_CREATE_OPTION;
-      goto err;
+      goto err_no_lock;
     }
     /*
       key_segs may be 0 in the case when we only want to be able to
@@ -444,7 +444,7 @@ int mi_create(const char *name,uint keys
         length >= MI_MAX_KEY_BUFF)
     {
       my_errno=HA_WRONG_CREATE_OPTION;
-      goto err;
+      goto err_no_lock;
     }
     set_if_bigger(max_key_block_length,keydef->block_length);
     keydef->keylength= (uint16) key_length;
@@ -491,7 +491,7 @@ int mi_create(const char *name,uint keys
                     "indexes and/or unique constraints.",
                     MYF(0), name + dirname_length(name));
     my_errno= HA_WRONG_CREATE_OPTION;
-    goto err;
+    goto err_no_lock;
   }
 
   bmove(share.state.header.file_version,(uchar*) myisam_file_magic,4);
@@ -810,12 +810,14 @@ int mi_create(const char *name,uint keys
   errpos=0;
   mysql_mutex_unlock(&THR_LOCK_myisam);
   if (mysql_file_close(file, MYF(0)))
-    goto err;
+    goto err_no_lock;
   my_free(rec_per_key_part);
   DBUG_RETURN(0);
 
 err:
   mysql_mutex_unlock(&THR_LOCK_myisam);
+
+err_no_lock:
   save_errno=my_errno;
   switch (errpos) {
   case 3:

=== 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 'strings/ctype.c'
--- a/strings/ctype.c	2011-01-19 13:35:54 +0000
+++ b/strings/ctype.c	2011-02-15 11:30:56 +0000
@@ -927,3 +927,143 @@ my_charset_is_ascii_compatible(CHARSET_I
   }
   return 1;
 }
+
+
+/*
+  Convert a string between two character sets.
+  'to' must be large enough to store (form_length * to_cs->mbmaxlen) bytes.
+
+  @param  to[OUT]       Store result here
+  @param  to_length     Size of "to" buffer
+  @param  to_cs         Character set of result string
+  @param  from          Copy from here
+  @param  from_length   Length of the "from" string
+  @param  from_cs       Character set of the "from" string
+  @param  errors[OUT]   Number of conversion errors
+
+  @return Number of bytes copied to 'to' string
+*/
+
+static uint32
+my_convert_internal(char *to, uint32 to_length, CHARSET_INFO *to_cs, 
+                    const char *from, uint32 from_length,CHARSET_INFO *from_cs,
+                    uint *errors)
+{
+  int         cnvres;
+  my_wc_t     wc;
+  const uchar *from_end= (const uchar*) from + from_length;
+  char *to_start= to;
+  uchar *to_end= (uchar*) to + to_length;
+  my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
+  my_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb;
+  uint error_count= 0;
+
+  while (1)
+  {
+    if ((cnvres= (*mb_wc)(from_cs, &wc, (uchar*) from, from_end)) > 0)
+      from+= cnvres;
+    else if (cnvres == MY_CS_ILSEQ)
+    {
+      error_count++;
+      from++;
+      wc= '?';
+    }
+    else if (cnvres > MY_CS_TOOSMALL)
+    {
+      /*
+        A correct multibyte sequence detected
+        But it doesn't have Unicode mapping.
+      */
+      error_count++;
+      from+= (-cnvres);
+      wc= '?';
+    }
+    else
+      break;  // Not enough characters
+
+outp:
+    if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0)
+      to+= cnvres;
+    else if (cnvres == MY_CS_ILUNI && wc != '?')
+    {
+      error_count++;
+      wc= '?';
+      goto outp;
+    }
+    else
+      break;
+  }
+  *errors= error_count;
+  return (uint32) (to - to_start);
+}
+
+
+/*
+  Convert a string between two character sets.
+   Optimized for quick copying of ASCII characters in the range 0x00..0x7F.
+  'to' must be large enough to store (form_length * to_cs->mbmaxlen) bytes.
+
+  @param  to[OUT]       Store result here
+  @param  to_length     Size of "to" buffer
+  @param  to_cs         Character set of result string
+  @param  from          Copy from here
+  @param  from_length   Length of the "from" string
+  @param  from_cs       Character set of the "from" string
+  @param  errors[OUT]   Number of conversion errors
+
+  @return Number of bytes copied to 'to' string
+*/
+
+uint32
+my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, 
+           const char *from, uint32 from_length, CHARSET_INFO *from_cs,
+           uint *errors)
+{
+  uint32 length, length2;
+  /*
+    If any of the character sets is not ASCII compatible,
+    immediately switch to slow mb_wc->wc_mb method.
+  */
+  if ((to_cs->state | from_cs->state) & MY_CS_NONASCII)
+    return my_convert_internal(to, to_length, to_cs,
+                               from, from_length, from_cs, errors);
+
+  length= length2= min(to_length, from_length);
+
+#if defined(__i386__)
+  /*
+    Special loop for i386, it allows to refer to a
+    non-aligned memory block as UINT32, which makes
+    it possible to copy four bytes at once. This
+    gives about 10% performance improvement comparing
+    to byte-by-byte loop.
+  */
+  for ( ; length >= 4; length-= 4, from+= 4, to+= 4)
+  {
+    if ((*(uint32*)from) & 0x80808080)
+      break;
+    *((uint32*) to)= *((const uint32*) from);
+  }
+#endif /* __i386__ */
+
+  for (; ; *to++= *from++, length--)
+  {
+    if (!length)
+    {
+      *errors= 0;
+      return length2;
+    }
+    if (*((unsigned char*) from) > 0x7F) /* A non-ASCII character */
+    {
+      uint32 copied_length= length2 - length;
+      to_length-= copied_length;
+      from_length-= copied_length;
+      return copied_length + my_convert_internal(to, to_length, to_cs,
+                                                 from, from_length, from_cs,
+                                                 errors);
+    }
+  }
+
+  DBUG_ASSERT(FALSE); // Should never get to here
+  return 0;           // Make compiler happy
+}

=== 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-14 14:57:10 +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
@@ -908,6 +947,8 @@ echo "====="
 %doc %{license_files_server}
 %endif
 %doc %{src_dir}/Docs/ChangeLog
+%doc %{src_dir}/Docs/INFO_SRC*
+%doc release/Docs/INFO_BIN*
 %doc release/support-files/my-*.cnf
 
 %doc %attr(644, root, root) %{_infodir}/mysql.info*
@@ -1085,6 +1126,17 @@ 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.
+  
+* Mon Jan 31 2011 Joerg Bruehe <joerg.bruehe@oracle.com>
+
+- Install the new "manifest" files: "INFO_SRC" and "INFO_BIN".
+
 * Tue Nov 23 2010 Jonathan Perkin <jonathan.perkin@stripped>
 
 - EXCEPTIONS-CLIENT has been deleted, remove it from here too

=== modified file 'unittest/mysys/bitmap-t.c'
--- a/unittest/mysys/bitmap-t.c	2008-02-18 22:29:39 +0000
+++ b/unittest/mysys/bitmap-t.c	2011-02-16 17:19:10 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@
 #include <tap.h>
 #include <m_string.h>
 
+#define MAX_TESTED_BITMAP_SIZE 1024
+
 uint get_rand_bit(uint bitsize)
 {
   return (rand() % bitsize);
@@ -75,12 +77,6 @@ error2:
   return TRUE;
 }
 
-my_bool test_operators(MY_BITMAP *map __attribute__((unused)),
-                       uint bitsize __attribute__((unused)))
-{
-  return FALSE;
-}
-
 my_bool test_get_all_bits(MY_BITMAP *map, uint bitsize)
 {
   uint i;
@@ -129,8 +125,8 @@ my_bool test_compare_operators(MY_BITMAP
   uint no_loops= bitsize > 128 ? 128 : bitsize;
   MY_BITMAP map2_obj, map3_obj;
   MY_BITMAP *map2= &map2_obj, *map3= &map3_obj;
-  uint32 map2buf[1024];
-  uint32 map3buf[1024];
+  uint32 map2buf[MAX_TESTED_BITMAP_SIZE];
+  uint32 map3buf[MAX_TESTED_BITMAP_SIZE];
   bitmap_init(&map2_obj, map2buf, bitsize, FALSE);
   bitmap_init(&map3_obj, map3buf, bitsize, FALSE);
   bitmap_clear_all(map2);
@@ -257,8 +253,21 @@ error2:
 
 my_bool test_get_first_bit(MY_BITMAP *map, uint bitsize)
 {
-  uint i, test_bit;
+  uint i, test_bit= 0;
   uint no_loops= bitsize > 128 ? 128 : bitsize;
+
+  bitmap_set_all(map);
+  for (i=0; i < bitsize; i++)
+    bitmap_clear_bit(map, i);
+  if (bitmap_get_first_set(map) != MY_BIT_NONE)
+    goto error1;
+  bitmap_clear_all(map);
+  for (i=0; i < bitsize; i++)
+    bitmap_set_bit(map, i);
+  if (bitmap_get_first(map) != MY_BIT_NONE)
+    goto error2;
+  bitmap_clear_all(map);
+
   for (i=0; i < no_loops; i++)
   {
     test_bit=get_rand_bit(bitsize);
@@ -321,6 +330,24 @@ my_bool test_prefix(MY_BITMAP *map, uint
       goto error3;
     bitmap_clear_all(map);
   }
+  for (i=0; i < bitsize; i++)
+  {
+    if (bitmap_is_prefix(map, i + 1))
+      goto error4;
+    bitmap_set_bit(map, i);
+    if (!bitmap_is_prefix(map, i + 1))
+      goto error5;
+    test_bit=get_rand_bit(bitsize);
+    bitmap_set_bit(map, test_bit);
+    if (test_bit <= i && !bitmap_is_prefix(map, i + 1))
+      goto error5;
+    else if (test_bit > i)
+    {
+      if (bitmap_is_prefix(map, i + 1))
+        goto error4;
+      bitmap_clear_bit(map, test_bit);
+    }
+  }
   return FALSE;
 error1:
   diag("prefix1 error  bitsize = %u, prefix_size = %u", bitsize,test_bit);
@@ -331,13 +358,127 @@ error2:
 error3:
   diag("prefix3 error  bitsize = %u, prefix_size = %u", bitsize,test_bit);
   return TRUE;
+error4:
+  diag("prefix4 error  bitsize = %u, i = %u", bitsize,i);
+  return TRUE;
+error5:
+  diag("prefix5 error  bitsize = %u, i = %u", bitsize,i);
+  return TRUE;
 }
 
+my_bool test_compare(MY_BITMAP *map, uint bitsize)
+{
+  MY_BITMAP map2;
+  uint32 map2buf[MAX_TESTED_BITMAP_SIZE];
+  uint i, test_bit;
+  uint no_loops= bitsize > 128 ? 128 : bitsize;
+  if (bitmap_init(&map2, map2buf, bitsize, FALSE))
+  {
+    diag("init error for bitsize %d", bitsize);
+    return TRUE;
+  }
+  /* Test all 4 possible combinations of set/unset bits. */
+  for (i=0; i < no_loops; i++)
+  {
+    test_bit=get_rand_bit(bitsize);
+    bitmap_clear_bit(map, test_bit);
+    bitmap_clear_bit(&map2, test_bit);
+    if (!bitmap_is_subset(map, &map2))
+      goto error_is_subset;
+    bitmap_set_bit(map, test_bit);
+    if (bitmap_is_subset(map, &map2))
+      goto error_is_subset;
+    bitmap_set_bit(&map2, test_bit);
+    if (!bitmap_is_subset(map, &map2))
+      goto error_is_subset;
+    bitmap_clear_bit(map, test_bit);
+    if (!bitmap_is_subset(map, &map2))
+      goto error_is_subset;
+    /* Note that test_bit is not cleared i map2. */
+  }
+  bitmap_clear_all(map);
+  bitmap_clear_all(&map2);
+  /* Test all 4 possible combinations of set/unset bits. */
+  for (i=0; i < no_loops; i++)
+  {
+    test_bit=get_rand_bit(bitsize);
+    if (bitmap_is_overlapping(map, &map2))
+      goto error_is_overlapping;
+    bitmap_set_bit(map, test_bit);
+    if (bitmap_is_overlapping(map, &map2))
+      goto error_is_overlapping;
+    bitmap_set_bit(&map2, test_bit);
+    if (!bitmap_is_overlapping(map, &map2))
+      goto error_is_overlapping;
+    bitmap_clear_bit(map, test_bit);
+    if (bitmap_is_overlapping(map, &map2))
+      goto error_is_overlapping;
+    bitmap_clear_bit(&map2, test_bit);
+    /* Note that test_bit is not cleared i map2. */
+  }
+  return FALSE;
+error_is_subset:
+  diag("is_subset error  bitsize = %u", bitsize);
+  return TRUE;
+error_is_overlapping:
+  diag("is_overlapping error  bitsize = %u", bitsize);
+  return TRUE;
+}
+
+my_bool test_intersect(MY_BITMAP *map, uint bitsize)
+{
+  uint bitsize2 = 1 + get_rand_bit(MAX_TESTED_BITMAP_SIZE - 1);
+  MY_BITMAP map2;
+  uint32 map2buf[bitsize2];
+  uint i, test_bit1, test_bit2, test_bit3;
+  if (bitmap_init(&map2, map2buf, bitsize2, FALSE))
+  {
+    diag("init error for bitsize %d", bitsize2);
+    return TRUE;
+  }
+  test_bit1= get_rand_bit(bitsize);
+  test_bit2= get_rand_bit(bitsize);
+  bitmap_set_bit(map, test_bit1);
+  bitmap_set_bit(map, test_bit2);
+  test_bit3= get_rand_bit(bitsize2);
+  bitmap_set_bit(&map2, test_bit3);
+  if (test_bit2 < bitsize2)
+    bitmap_set_bit(&map2, test_bit2);
+
+  bitmap_intersect(map, &map2);
+  if (test_bit2 < bitsize2)
+  {
+    if (!bitmap_is_set(map, test_bit2))
+      goto error;
+    bitmap_clear_bit(map, test_bit2);
+  }
+  if (test_bit1 == test_bit3)
+  {
+    if (!bitmap_is_set(map, test_bit1))
+      goto error;
+    bitmap_clear_bit(map, test_bit1);
+  }
+  if (!bitmap_is_clear_all(map))
+    goto error;
+
+  bitmap_set_all(map);
+  bitmap_set_all(&map2);
+  for (i=0; i < bitsize2; i++)
+    bitmap_clear_bit(&map2, i);
+  bitmap_intersect(map, &map2);
+  if (!bitmap_is_clear_all(map))
+    goto error;
+  return FALSE;
+error:
+  diag("intersect error  bitsize = %u, bit1 = %u, bit2 = %u, bit3 = %u",
+       bitsize, test_bit1, test_bit2, test_bit3);
+  return TRUE;
+}
 
 my_bool do_test(uint bitsize)
 {
   MY_BITMAP map;
-  uint32 buf[1024];
+  uint32 buf[MAX_TESTED_BITMAP_SIZE];
   if (bitmap_init(&map, buf, bitsize, FALSE))
   {
     diag("init error for bitsize %d", bitsize);
@@ -349,9 +490,6 @@ my_bool do_test(uint bitsize)
   if (test_flip_bit(&map,bitsize))
     goto error;
   bitmap_clear_all(&map);
-  if (test_operators(&map,bitsize))
-    goto error;
-  bitmap_clear_all(&map);
   if (test_get_all_bits(&map, bitsize))
     goto error;
   bitmap_clear_all(&map);
@@ -366,8 +504,15 @@ my_bool do_test(uint bitsize)
   bitmap_clear_all(&map);
   if (test_get_next_bit(&map,bitsize))
     goto error;
+  bitmap_clear_all(&map);
   if (test_prefix(&map,bitsize))
     goto error;
+  bitmap_clear_all(&map);
+  if (test_compare(&map,bitsize))
+    goto error;
+  bitmap_clear_all(&map);
+  if (test_intersect(&map,bitsize))
+    goto error;
   return FALSE;
 error:
   return TRUE;
@@ -377,7 +522,7 @@ int main()
 {
   int i;
   int const min_size = 1;
-  int const max_size = 1024;
+  int const max_size = MAX_TESTED_BITMAP_SIZE;
   MY_INIT("bitmap-t");
 
   plan(max_size - min_size);

No bundle (reason: revision is a merge).
Thread
bzr commit into mysql-trunk-mtr branch (bjorn.munch:3027) Bjorn Munch17 Feb