List:Commits« Previous MessageNext Message »
From:Marc Alff Date:May 20 2010 4:01pm
Subject:bzr commit into mysql-next-mr branch (marc.alff:3147)
View as plain text  
#At file:///Users/malff/BZR_TREE/mysql-next-mr-wl4674/ based on revid:marc.alff@stripped

 3147 Marc Alff	2010-05-20 [merge]
      Merge mysql-next-mr --> mysql-next-mr-wl4674

    added:
      include/waiting_threads.h
      mysql-test/suite/funcs_1/r/row_count_func.result
      mysql-test/suite/funcs_1/t/row_count_func-master.opt
      mysql-test/suite/funcs_1/t/row_count_func.test
      mysql-test/suite/rpl/r/rpl_show_master_info_file.result
      mysql-test/suite/rpl/t/rpl_show_master_info_file-master.opt
      mysql-test/suite/rpl/t/rpl_show_master_info_file.test
      mysys/waiting_threads.c
      unittest/mysys/waiting_threads-t.c
    modified:
      BUILD/Makefile.am
      CMakeLists.txt
      Docs/Makefile.am
      Makefile.am
      client/Makefile.am
      cmake/build_configurations/mysql_release.cmake
      cmake/install_layout.cmake
      cmake/install_macros.cmake
      cmake/mysql_version.cmake
      cmake/plugin.cmake
      cmd-line-utils/Makefile.am
      cmd-line-utils/readline/Makefile.am
      config.h.cmake
      extra/Makefile.am
      extra/yassl/Makefile.am
      extra/yassl/src/Makefile.am
      extra/yassl/taocrypt/Makefile.am
      extra/yassl/taocrypt/benchmark/Makefile.am
      extra/yassl/taocrypt/src/Makefile.am
      extra/yassl/taocrypt/test/Makefile.am
      extra/yassl/testsuite/Makefile.am
      include/Makefile.am
      include/my_global.h
      include/my_pthread.h
      libmysql/CMakeLists.txt
      libmysql/Makefile.am
      libmysql/Makefile.shared
      libmysql_r/Makefile.am
      libmysqld/CMakeLists.txt
      libmysqld/Makefile.am
      libmysqld/examples/CMakeLists.txt
      libmysqld/examples/Makefile.am
      man/CMakeLists.txt
      man/Makefile.am
      mysql-test/CMakeLists.txt
      mysql-test/Makefile.am
      mysql-test/collections/default.experimental
      mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
      mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
      mysql-test/include/ctype_numconv.inc
      mysql-test/include/mysqld--help.inc
      mysql-test/include/show_slave_status.inc
      mysql-test/include/show_slave_status2.inc
      mysql-test/include/test_fieldsize.inc
      mysql-test/lib/My/SafeProcess/Makefile.am
      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/information_schema.result
      mysql-test/r/mysql_client_test.result
      mysql-test/r/partition.result
      mysql-test/r/sp.result
      mysql-test/r/trigger.result
      mysql-test/r/variables_debug.result
      mysql-test/suite/funcs_1/r/innodb_storedproc_10.result
      mysql-test/suite/funcs_1/r/memory_storedproc_10.result
      mysql-test/suite/funcs_1/r/myisam_storedproc_10.result
      mysql-test/suite/funcs_1/r/ndb_storedproc_10.result
      mysql-test/suite/parts/r/rpl_partition.result
      mysql-test/suite/parts/t/rpl_partition.test
      mysql-test/suite/rpl/r/rpl_000015.result
      mysql-test/suite/rpl/r/rpl_bug33931.result
      mysql-test/suite/rpl/r/rpl_change_master.result
      mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
      mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
      mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
      mysql-test/suite/rpl/r/rpl_flushlog_loop.result
      mysql-test/suite/rpl/r/rpl_grant.result
      mysql-test/suite/rpl/r/rpl_heartbeat.result
      mysql-test/suite/rpl/r/rpl_incident.result
      mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
      mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
      mysql-test/suite/rpl/r/rpl_log_pos.result
      mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
      mysql-test/suite/rpl/r/rpl_replicate_do.result
      mysql-test/suite/rpl/r/rpl_rotate_logs.result
      mysql-test/suite/rpl/r/rpl_row_colSize.result
      mysql-test/suite/rpl/r/rpl_row_log.result
      mysql-test/suite/rpl/r/rpl_row_log_innodb.result
      mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
      mysql-test/suite/rpl/r/rpl_row_reset_slave.result
      mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
      mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
      mysql-test/suite/rpl/r/rpl_row_until.result
      mysql-test/suite/rpl/r/rpl_skip_error.result
      mysql-test/suite/rpl/r/rpl_slave_skip.result
      mysql-test/suite/rpl/r/rpl_ssl.result
      mysql-test/suite/rpl/r/rpl_ssl1.result
      mysql-test/suite/rpl/r/rpl_stm_log.result
      mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
      mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
      mysql-test/suite/rpl/r/rpl_stm_until.result
      mysql-test/suite/rpl/r/rpl_temporary_errors.result
      mysql-test/suite/rpl/t/disabled.def
      mysql-test/suite/rpl/t/rpl_bug33931.test
      mysql-test/suite/rpl/t/rpl_flushlog_loop.test
      mysql-test/suite/rpl/t/rpl_incident.test
      mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
      mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
      mysql-test/suite/rpl/t/rpl_replicate_do.test
      mysql-test/suite/rpl/t/rpl_row_until.test
      mysql-test/suite/rpl/t/rpl_slave_skip.test
      mysql-test/suite/rpl/t/rpl_ssl.test
      mysql-test/suite/rpl/t/rpl_ssl1.test
      mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
      mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
      mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
      mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result
      mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
      mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
      mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
      mysql-test/t/information_schema.test
      mysql-test/t/mysql_client_test.test
      mysql-test/t/parser_stack.test
      mysql-test/t/partition.test
      mysql-test/t/trigger.test
      mysql-test/t/variables_debug.test
      mysys/CMakeLists.txt
      mysys/Makefile.am
      netware/Makefile.am
      plugin/Makefile.am
      plugin/audit_null/CMakeLists.txt
      plugin/daemon_example/Makefile.am
      plugin/fulltext/CMakeLists.txt
      plugin/fulltext/Makefile.am
      pstack/Makefile.am
      pstack/aout/Makefile.am
      regex/Makefile.am
      scripts/CMakeLists.txt
      scripts/Makefile.am
      scripts/mysqld_safe.sh
      sql-bench/CMakeLists.txt
      sql-bench/Makefile.am
      sql-common/Makefile.am
      sql/Makefile.am
      sql/ha_ndbcluster_binlog.cc
      sql/item_func.cc
      sql/log_event.cc
      sql/protocol.cc
      sql/rpl_mi.cc
      sql/rpl_mi.h
      sql/share/Makefile.am
      sql/slave.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_delete.cc
      sql/sql_insert.cc
      sql/sql_lex.cc
      sql/sql_lex.h
      sql/sql_parse.cc
      sql/sql_parse.h
      sql/sql_signal.cc
      sql/sql_update.cc
      storage/Makefile.am
      storage/archive/Makefile.am
      storage/blackhole/Makefile.am
      storage/csv/Makefile.am
      storage/example/Makefile.am
      storage/federated/Makefile.am
      storage/heap/Makefile.am
      storage/ibmdb2i/Makefile.am
      storage/innobase/Makefile.am
      storage/myisam/Makefile.am
      storage/myisammrg/Makefile.am
      storage/ndb/Makefile.am
      storage/ndb/docs/Makefile.am
      storage/ndb/include/Makefile.am
      storage/ndb/src/Makefile.am
      storage/ndb/src/common/Makefile.am
      storage/ndb/src/common/debugger/Makefile.am
      storage/ndb/src/common/debugger/signaldata/Makefile.am
      storage/ndb/src/common/logger/Makefile.am
      storage/ndb/src/common/mgmcommon/Makefile.am
      storage/ndb/src/common/portlib/Makefile.am
      storage/ndb/src/common/transporter/Makefile.am
      storage/ndb/src/common/util/Makefile.am
      storage/ndb/src/cw/Makefile.am
      storage/ndb/src/cw/cpcd/Makefile.am
      storage/ndb/src/kernel/Makefile.am
      storage/ndb/src/kernel/blocks/Makefile.am
      storage/ndb/src/kernel/blocks/backup/Makefile.am
      storage/ndb/src/kernel/blocks/dbdict/Makefile.am
      storage/ndb/src/kernel/blocks/dbdih/Makefile.am
      storage/ndb/src/kernel/blocks/dblqh/Makefile.am
      storage/ndb/src/kernel/blocks/dbtup/Makefile.am
      storage/ndb/src/kernel/error/Makefile.am
      storage/ndb/src/kernel/vm/Makefile.am
      storage/ndb/src/mgmapi/Makefile.am
      storage/ndb/src/mgmclient/Makefile.am
      storage/ndb/src/mgmsrv/Makefile.am
      storage/ndb/src/ndbapi/Makefile.am
      storage/ndb/test/Makefile.am
      storage/ndb/test/ndbapi/Makefile.am
      storage/ndb/test/ndbapi/bank/Makefile.am
      storage/ndb/test/run-test/Makefile.am
      storage/ndb/test/src/Makefile.am
      storage/ndb/test/tools/Makefile.am
      storage/ndb/tools/Makefile.am
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_global.cc
      storage/perfschema/pfs_global.h
      strings/Makefile.am
      support-files/CMakeLists.txt
      support-files/MacOSX/Makefile.am
      support-files/Makefile.am
      support-files/RHEL4-SElinux/Makefile.am
      support-files/mysql.spec.sh
      tests/Makefile.am
      unittest/Makefile.am
      unittest/examples/Makefile.am
      unittest/mysys/CMakeLists.txt
      unittest/mysys/Makefile.am
      unittest/mytap/t/Makefile.am
      vio/Makefile.am
      win/Makefile.am
      zlib/Makefile.am
=== modified file 'BUILD/Makefile.am'
--- a/BUILD/Makefile.am	2009-11-09 11:32:48 +0000
+++ b/BUILD/Makefile.am	2010-05-19 13:00:23 +0000
@@ -78,6 +78,3 @@ EXTRA_DIST =		FINISH.sh \
 			compile-solaris-sparc-debug \
 			compile-solaris-sparc-forte \
 			compile-solaris-sparc-purify
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt	2010-04-28 12:43:01 +0000
+++ b/CMakeLists.txt	2010-05-12 21:20:24 +0000
@@ -189,8 +189,11 @@ ELSE()
 ENDIF()
 
 SET(DEFAULT_BASEDIR "${DEFAULT_MYSQL_HOME}")
-SET(MYSQL_DATADIR "${DEFAULT_MYSQL_HOME}/${INSTALL_MYSQLDATADIR}" CACHE PATH 
-  "default MySQL data directory")
+IF(INSTALL_MYSQLDATADIR MATCHES "^/.*")
+  SET(MYSQL_DATADIR ${INSTALL_MYSQLDATADIR} CACHE PATH "default MySQL data directory")
+ELSE()
+  SET(MYSQL_DATADIR "${DEFAULT_MYSQL_HOME}/${INSTALL_MYSQLDATADIR}" CACHE PATH "default MySQL data directory")
+ENDIF()
 SET(DEFAULT_CHARSET_HOME "${DEFAULT_MYSQL_HOME}")
 SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}")
 IF(SYSCONFDIR)
@@ -275,20 +278,28 @@ ELSE()
   SET(CPACK_GENERATOR "TGZ")
 ENDIF() 
 INCLUDE(CPack)
-INSTALL(FILES COPYING EXCEPTIONS-CLIENT LICENSE.mysql DESTINATION ${INSTALL_DOCREADMEDIR} OPTIONAL)
-INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR})
 IF(UNIX)
-  INSTALL(FILES Docs/INSTALL-BINARY DESTINATION 
-  ${INSTALL_DOCREADMEDIR})
+  INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL)
+ENDIF()
+#
+# RPM installs documentation directly from the source tree
+#
+IF(NOT INSTALL_LAYOUT MATCHES "RPM")
+  INSTALL(FILES COPYING EXCEPTIONS-CLIENT LICENSE.mysql DESTINATION ${INSTALL_DOCREADMEDIR} OPTIONAL)
+  INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR})
+  IF(UNIX)
+    INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR})
+  ENDIF()
+  # MYSQL_DOCS_LOCATON is used in "make dist", points to the documentation directory
+  SET(MYSQL_DOCS_LOCATION "" CACHE PATH "Location from where documentation is copied")
+  MARK_AS_ADVANCED(MYSQL_DOCS_LOCATION)
+  INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR}
+    PATTERN "INSTALL-BINARY" EXCLUDE
+    PATTERN "Makefile.*" EXCLUDE
+    PATTERN "glibc*" EXCLUDE
+    PATTERN "linuxthreads.txt" EXCLUDE
+    PATTERN "myisam.txt" EXCLUDE
+    PATTERN "mysql.info" EXCLUDE
+    PATTERN "sp-imp-spec.txt" EXCLUDE
+  )
 ENDIF()
-# MYSQL_DOCS_LOCATON is used in "make dist", points to the documentation directory
-SET(MYSQL_DOCS_LOCATION "" CACHE PATH "Location from where documentation is copied")
-MARK_AS_ADVANCED(MYSQL_DOCS_LOCATION)
-INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR}
-  PATTERN "INSTALL-BINARY" EXCLUDE
-  PATTERN "Makefile.*" EXCLUDE
-  PATTERN "myisam.txt" EXCLUDE
-  PATTERN "glibc*" EXCLUDE
-  PATTERN "sp-imp-spec.txt" EXCLUDE
-  PATTERN "linuxthreads.txt" EXCLUDE
-)

=== modified file 'Docs/Makefile.am'
--- a/Docs/Makefile.am	2008-04-08 09:44:18 +0000
+++ b/Docs/Makefile.am	2010-05-19 13:00:23 +0000
@@ -37,6 +37,3 @@ uninstall-local:
 	  @RM@ -f $(DESTDIR)$(infodir)/mysql.info ; \
 	  @RM@ -f $(DESTDIR)$(pkgdatadir)/ChangeLog ; \
 	fi
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'Makefile.am'
--- a/Makefile.am	2010-04-21 06:24:49 +0000
+++ b/Makefile.am	2010-05-19 13:01:45 +0000
@@ -328,6 +328,3 @@ do_abi_check:
 	                  @DIFF@ -w $$file.pp $(top_builddir)/abi_check.out; \
 	                  @RM@ $(top_builddir)/abi_check.out; \
 	done
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'client/Makefile.am'
--- a/client/Makefile.am	2010-04-11 06:52:42 +0000
+++ b/client/Makefile.am	2010-05-19 13:00:23 +0000
@@ -124,6 +124,3 @@ link_sources:
 	rm -f $(srcdir)/my_user.c; \
 	@LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c;
 	echo timestamp > link_sources;
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'cmake/build_configurations/mysql_release.cmake'
--- a/cmake/build_configurations/mysql_release.cmake	2010-03-07 23:31:06 +0000
+++ b/cmake/build_configurations/mysql_release.cmake	2010-05-12 11:51:23 +0000
@@ -80,9 +80,6 @@ IF(FEATURE_SET)
   ENDFOREACH()
 ENDIF()
 
-SET(WITHOUT_AUDIT_NULL ON CACHE BOOL "")
-SET(WITHOUT_DAEMON_EXAMPLE ON CACHE BOOL "")
-
 OPTION(ENABLE_LOCAL_INFILE "" ON)
 SET(WITH_SSL bundled CACHE STRING "")
 SET(WITH_ZLIB bundled CACHE STRING "")
@@ -122,8 +119,12 @@ IF(UNIX)  
   IF(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
     IF(CMAKE_C_COMPILER_ID MATCHES "HP")
       IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64")
-        SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g +O2 +DD64 +DSitanium2 -mt -AC99")
-        SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g +O2 +DD64 +DSitanium2 -mt -Aa")
+        SET(CMAKE_C_FLAGS 
+          "${CMAKE_C_FLAGS} +DD64 +DSitanium2 -mt -AC99")
+        SET(CMAKE_CXX_FLAGS 
+          "${CMAKE_CXX_FLAGS} +DD64 +DSitanium2 -mt -Aa")
+        SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} +O2")
+        SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} +O2")
       ENDIF()
     ENDIF()
     SET(WITH_SSL)
@@ -132,15 +133,16 @@ IF(UNIX)  
   # Linux flags
   IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
     IF(CMAKE_C_COMPILER_ID MATCHES "Intel")
-      SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-static-intel -g -O3 -unroll2 -ip -mp -restrict")
-      SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-static-intel -g -O3 -unroll2 -ip -mp -restrict")
+      SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-static-intel -static-libgcc -g -O3 -unroll2 -ip -mp -restrict -no-ftz -no-prefetch")
+      SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-static-intel -static-libgcc -g -O3 -unroll2 -ip -mp -restrict -no-ftz -no-prefetch")
+      SET(WITH_SSL no)
     ENDIF()
   ENDIF()
   
   # OSX flags
   IF(APPLE)
-   SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
-   SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+   SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -Os -fno-common")
+   SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -Os -felide-constructors -fno-common")
   ENDIF()
   
   # Solaris flags

=== modified file 'cmake/install_layout.cmake'
--- a/cmake/install_layout.cmake	2010-03-17 18:56:22 +0000
+++ b/cmake/install_layout.cmake	2010-05-12 11:51:23 +0000
@@ -14,99 +14,184 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
 
 # The purpose of this file is to set the default installation layout.
-# Currently, there are 2 different installation layouts ,
-# one is used in tar.gz packages (Windows zip is about the same), another one 
-# in RPMs.
-
-# There are currently 2 layouts defines, named STANDALONE (tar.gz layout)
-# and UNIX (rpm layout). To force a directory layout when invoking cmake use
-# -DINSTALL_LAYOUT=[STANDALONE|UNIX].
-# This wil use a predefined layout. There is a possibility to further fine-tune 
-# installation directories. Several variables are can be overwritten
-#
-# - INSTALL_BINDIR     (directory with client executables and Unix shell scripts)
-# - INSTALL_SBINDIR    (directory with mysqld)
-# - INSTALL_LIBDIR     (directory with client end embedded libraries)
-# - INSTALL_PLUGINDIR  (directory for plugins)
-# - INSTALL_INCLUDEDIR (directory for MySQL headers)
-# - INSTALL_DOCDIR     (documentation)
-# - INSTALL_MANDIR     (man pages)
-# - INSTALL_SCRIPTDIR  (several scripts, rarely used)
-# - INSTALL_MYSQLSHAREDIR (MySQL character sets and localized error messages)
-# - INSTALL_SHAREDIR  (location of aclocal/mysql.m4)
-# - INSTALL_SQLBENCHDIR (sql-bench)
-# - INSTALL_MYSQLTESTDIR (mysql-test)
-# - INSTALL_DOCREADMEDIR (readme and similar)
-# - INSTALL_SUPPORTFILESDIR (used only in standalone installer)
+#
+# The current choices of installation layout are:
+#
+#  STANDALONE
+#    Build with prefix=/usr/local/mysql, create tarball with install prefix="."
+#    and relative links.  Windows zip uses the same tarball layout but without
+#    the build prefix.
+#
+#  RPM
+#    Build as per default RPM layout, with prefix=/usr
+#
+#  DEB
+#    Build as per STANDALONE, prefix=/opt/mysql-$major.$minor
+#
+#  SVR4
+#    Solaris package layout suitable for pkg* tools, prefix=/opt/mysql/mysql
+#
+# To force a directory layout, use -DINSTALL_LAYOUT=<layout>.
+#
+# The default is STANDALONE.
+#
+# There is the possibility to further fine-tune installation directories.
+# Several variables can be overwritten:
+#
+# - INSTALL_BINDIR          (directory with client executables and scripts)
+# - INSTALL_SBINDIR         (directory with mysqld)
+# - INSTALL_SCRIPTDIR       (several scripts, rarely used)
+#
+# - INSTALL_LIBDIR          (directory with client end embedded libraries)
+# - INSTALL_PLUGINDIR       (directory for plugins)
+#
+# - INSTALL_INCLUDEDIR      (directory for MySQL headers)
+#
+# - INSTALL_DOCDIR          (documentation)
+# - INSTALL_DOCREADMEDIR    (readme and similar)
+# - INSTALL_MANDIR          (man pages)
+# - INSTALL_INFODIR         (info pages)
+#
+# - INSTALL_SHAREDIR        (location of aclocal/mysql.m4)
+# - INSTALL_MYSQLSHAREDIR   (MySQL character sets and localized error messages)
+# - INSTALL_MYSQLTESTDIR    (mysql-test)
+# - INSTALL_SQLBENCHDIR     (sql-bench)
+# - INSTALL_SUPPORTFILESDIR (various extra support files)
+#
+# - INSTALL_MYSQLDATADIR    (data directory)
 
-# Default installation layout on Unix is UNIX (kent wants it so)
 IF(NOT INSTALL_LAYOUT)
-  IF(WIN32)
-    SET(DEFAULT_INSTALL_LAYOUT "STANDALONE")
-  ELSE()
-    SET(DEFAULT_INSTALL_LAYOUT "UNIX")
-  ENDIF()
+  SET(DEFAULT_INSTALL_LAYOUT "STANDALONE")
 ENDIF()
 
-SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}" 
-CACHE STRING  "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer) or UNIX")
-
-IF(NOT INSTALL_LAYOUT MATCHES "STANDALONE")
-  IF(NOT INSTALL_LAYOUT MATCHES "UNIX")
-    SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}")
-  ENDIF()
-ENDIF()
+SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}"
+CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer) or UNIX")
 
 IF(UNIX)
-  IF(INSTALL_LAYOUT MATCHES "UNIX")  
+  IF(INSTALL_LAYOUT MATCHES "RPM")
     SET(default_prefix "/usr")
+  ELSEIF(INSTALL_LAYOUT MATCHES "DEB")
+    SET(default_prefix "/opt/${MYSQL_BASE_VERSION}")
+    # This is required to avoid "cpack -GDEB" default of prefix=/usr
+    SET(CPACK_SET_DESTDIR ON)
+  ELSEIF(INSTALL_LAYOUT MATCHES "SVR4")
+    SET(default_prefix "/opt/mysql/mysql")
   ELSE()
     SET(default_prefix "/usr/local/mysql")
   ENDIF()
   IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
-    SET(CMAKE_INSTALL_PREFIX ${default_prefix} 
+    SET(CMAKE_INSTALL_PREFIX ${default_prefix}
       CACHE PATH "install prefix" FORCE)
   ENDIF()
-  SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc" 
+  SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc"
     CACHE PATH "config directory (for my.cnf)")
   MARK_AS_ADVANCED(SYSCONFDIR)
 ENDIF()
 
- 
- 
- # STANDALONE layout
- SET(INSTALL_BINDIR_STANDALONE "bin")
- SET(INSTALL_SBINDIR_STANDALONE "bin")
- SET(INSTALL_LIBDIR_STANDALONE "lib")
- SET(INSTALL_INCLUDEDIR_STANDALONE "include")
- SET(INSTALL_PLUGINDIR_STANDALONE "lib/plugin")
- SET(INSTALL_DOCDIR_STANDALONE "docs")
- SET(INSTALL_MANDIR_STANDALONE "man")
- SET(INSTALL_MYSQLSHAREDIR_STANDALONE "share")
- SET(INSTALL_SHAREDIR_STANDALONE "share")
- SET(INSTALL_SCRIPTDIR_STANDALONE "scripts")
- SET(INSTALL_MYSQLTESTDIR_STANDALONE "mysql-test")
- SET(INSTALL_SQLBENCHROOTDIR_STANDALONE ".")
- SET(INSTALL_DOCREADMEDIR_STANDALONE ".")
- SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files")
- SET(INSTALL_MYSQLDATADIR_STANDALONE "data")
- 
- # UNIX layout
- SET(INSTALL_BINDIR_UNIX "bin")
- SET(INSTALL_SBINDIR_UNIX "sbin")
- SET(INSTALL_LIBDIR_UNIX "lib/mysql")
- SET(INSTALL_PLUGINDIR_UNIX "lib/mysql/plugin")
- SET(INSTALL_DOCDIR_UNIX "share/mysql/doc/MySQL-server-${MYSQL_NO_DASH_VERSION}")
- SET(INSTALL_MANDIR_UNIX "share/mysql/man")
- SET(INSTALL_INCLUDEDIR_UNIX "include/mysql")
- SET(INSTALL_MYSQLSHAREDIR_UNIX "share/mysql")
- SET(INSTALL_SHAREDIR_UNIX "share")
- SET(INSTALL_SCRIPTDIR_UNIX "bin")
- SET(INSTALL_MYSQLTESTDIR_UNIX "mysql-test")
- SET(INSTALL_SQLBENCHROOTDIR_UNIX "")
- SET(INSTALL_DOCREADMEDIR_UNIX "share/mysql/doc/MySQL-server-${MYSQL_NO_DASH_VERSION}")
- SET(INSTALL_SUPPORTFILESDIR_UNIX "")
- SET(INSTALL_MYSQLDATADIR_UNIX "var")
+#
+# STANDALONE layout
+#
+SET(INSTALL_BINDIR_STANDALONE           "bin")
+SET(INSTALL_SBINDIR_STANDALONE          "bin")
+SET(INSTALL_SCRIPTDIR_STANDALONE        "scripts")
+#
+SET(INSTALL_LIBDIR_STANDALONE           "lib")
+SET(INSTALL_PLUGINDIR_STANDALONE        "lib/plugin")
+#
+SET(INSTALL_INCLUDEDIR_STANDALONE       "include")
+#
+SET(INSTALL_DOCDIR_STANDALONE           "docs")
+SET(INSTALL_DOCREADMEDIR_STANDALONE     ".")
+SET(INSTALL_MANDIR_STANDALONE           "man")
+SET(INSTALL_INFODIR_STANDALONE          "docs")
+#
+SET(INSTALL_SHAREDIR_STANDALONE         "share")
+SET(INSTALL_MYSQLSHAREDIR_STANDALONE    "share")
+SET(INSTALL_MYSQLTESTDIR_STANDALONE     "mysql-test")
+SET(INSTALL_SQLBENCHDIR_STANDALONE      ".")
+SET(INSTALL_SUPPORTFILESDIR_STANDALONE  "support-files")
+#
+SET(INSTALL_MYSQLDATADIR_STANDALONE     "data")
+
+#
+# RPM layout
+#
+SET(INSTALL_BINDIR_RPM                  "bin")
+SET(INSTALL_SBINDIR_RPM                 "sbin")
+SET(INSTALL_SCRIPTDIR_RPM               "bin")
+#
+IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+  SET(INSTALL_LIBDIR_RPM                "lib64")
+  SET(INSTALL_PLUGINDIR_RPM             "lib64/mysql/plugin")
+ELSE()
+  SET(INSTALL_LIBDIR_RPM                "lib")
+  SET(INSTALL_PLUGINDIR_RPM             "lib/mysql/plugin")
+ENDIF()
+#
+SET(INSTALL_INCLUDEDIR_RPM              "include/mysql")
+#
+#SET(INSTALL_DOCDIR_RPM                 unset - installed directly by RPM)
+#SET(INSTALL_DOCREADMEDIR_RPM           unset - installed directly by RPM)
+SET(INSTALL_INFODIR_RPM                 "share/info")
+SET(INSTALL_MANDIR_RPM                  "share/man")
+#
+SET(INSTALL_SHAREDIR_RPM                "share")
+SET(INSTALL_MYSQLSHAREDIR_RPM           "share/mysql")
+SET(INSTALL_MYSQLTESTDIR_RPM            "share/mysql-test")
+SET(INSTALL_SQLBENCHDIR_RPM             "")
+SET(INSTALL_SUPPORTFILESDIR_RPM         "share/mysql")
+#
+SET(INSTALL_MYSQLDATADIR_RPM            "/var/lib/mysql")
+
+#
+# DEB layout
+#
+SET(INSTALL_BINDIR_DEB                  "bin")
+SET(INSTALL_SBINDIR_DEB                 "bin")
+SET(INSTALL_SCRIPTDIR_DEB               "scripts")
+#
+SET(INSTALL_LIBDIR_DEB                  "lib")
+SET(INSTALL_PLUGINDIR_DEB               "lib/plugin")
+#
+SET(INSTALL_INCLUDEDIR_DEB              "include")
+#
+SET(INSTALL_DOCDIR_DEB                  "docs")
+SET(INSTALL_DOCREADMEDIR_DEB            ".")
+SET(INSTALL_MANDIR_DEB                  "man")
+SET(INSTALL_INFODIR_DEB                 "docs")
+#
+SET(INSTALL_SHAREDIR_DEB                "share")
+SET(INSTALL_MYSQLSHAREDIR_DEB           "share")
+SET(INSTALL_MYSQLTESTDIR_DEB            "mysql-test")
+SET(INSTALL_SQLBENCHDIR_DEB             ".")
+SET(INSTALL_SUPPORTFILESDIR_DEB         "support-files")
+#
+SET(INSTALL_MYSQLDATADIR_DEB            "data")
+
+#
+# SVR4 layout
+#
+SET(INSTALL_BINDIR_SVR4                 "bin")
+SET(INSTALL_SBINDIR_SVR4                "bin")
+SET(INSTALL_SCRIPTDIR_SVR4              "scripts")
+#
+SET(INSTALL_LIBDIR_SVR4                 "lib")
+SET(INSTALL_PLUGINDIR_SVR4              "lib/plugin")
+#
+SET(INSTALL_INCLUDEDIR_SVR4             "include")
+#
+SET(INSTALL_DOCDIR_SVR4                 "docs")
+SET(INSTALL_DOCREADMEDIR_SVR4           ".")
+SET(INSTALL_MANDIR_SVR4                 "man")
+SET(INSTALL_INFODIR_SVR4                "docs")
+#
+SET(INSTALL_SHAREDIR_SVR4               "share")
+SET(INSTALL_MYSQLSHAREDIR_SVR4          "share")
+SET(INSTALL_MYSQLTESTDIR_SVR4           "mysql-test")
+SET(INSTALL_SQLBENCHDIR_SVR4            ".")
+SET(INSTALL_SUPPORTFILESDIR_SVR4        "support-files")
+#
+SET(INSTALL_MYSQLDATADIR_SVR4           "/var/lib/mysql")
 
 
 # Clear cached variables if install layout was changed
@@ -117,12 +202,12 @@ IF(OLD_INSTALL_LAYOUT)
 ENDIF()
 SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "")
 
-# Set INSTALL_FOODIR variables for chosen  layout
-# (for example,  INSTALL_BINDIR will be defined  as 
-# ${INSTALL_BINDIR_STANDALONE} by  default if STANDALONE layout is chosen)
-FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN 
-  MYSQLTEST SQLBENCHROOT DOCREADME SUPPORTFILES MYSQLDATA)
-  SET(INSTALL_${var}DIR  ${INSTALL_${var}DIR_${INSTALL_LAYOUT}} 
+# Set INSTALL_FOODIR variables for chosen layout (for example, INSTALL_BINDIR
+# will be defined  as ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE
+# layout is chosen)
+FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN
+  INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA)
+  SET(INSTALL_${var}DIR  ${INSTALL_${var}DIR_${INSTALL_LAYOUT}}
   CACHE STRING "${var} installation directory" ${FORCE})
   MARK_AS_ADVANCED(INSTALL_${var}DIR)
 ENDFOREACH()

=== modified file 'cmake/install_macros.cmake'
--- a/cmake/install_macros.cmake	2010-04-22 16:53:50 +0000
+++ b/cmake/install_macros.cmake	2010-05-12 21:20:24 +0000
@@ -172,7 +172,7 @@ FUNCTION(INSTALL_DEBUG_TARGET target)
   ""
   ${ARGN}
   )
-  GET_TARGET_PROPERTY(target_type  ${target} TYPE)
+  GET_TARGET_PROPERTY(target_type ${target} TYPE)
   IF(ARG_RENAME)
     SET(RENAME_PARAM RENAME ${ARG_RENAME}${CMAKE_${target_type}_SUFFIX})
   ELSE()
@@ -188,9 +188,40 @@ FUNCTION(INSTALL_DEBUG_TARGET target)
    STRING(REPLACE "${CMAKE_CFG_INTDIR}" "Debug"  debug_target_location "${target_location}" )
   ENDIF()
   
+  # Define permissions
+  # For executable files
+  SET(PERMISSIONS_EXECUTABLE
+      PERMISSIONS
+      OWNER_READ OWNER_WRITE OWNER_EXECUTE
+      GROUP_READ GROUP_EXECUTE
+      WORLD_READ WORLD_EXECUTE)
+
+  # Permissions for shared library (honors CMAKE_INSTALL_NO_EXE which is 
+  # typically set on Debian)
+  IF(CMAKE_INSTALL_SO_NO_EXE)
+    SET(PERMISSIONS_SHARED_LIBRARY
+      PERMISSIONS
+      OWNER_READ OWNER_WRITE 
+      GROUP_READ
+      WORLD_READ)
+  ELSE()
+    SET(PERMISSIONS_SHARED_LIBRARY ${PERMISSIONS_EXECUTABLE})
+  ENDIF()
+
+  # Shared modules get the same permissions as shared libraries
+  SET(PERMISSIONS_MODULE_LIBRARY ${PERMISSIONS_SHARED_LIBRARY})
+
+  #  Define permissions for static library
+  SET(PERMISSIONS_STATIC_LIBRARY
+      PERMISSIONS
+      OWNER_READ OWNER_WRITE 
+      GROUP_READ
+      WORLD_READ)
+
   INSTALL(FILES ${debug_target_location}
     DESTINATION ${ARG_DESTINATION}
     ${RENAME_PARAM}
+    ${PERMISSIONS_${target_type}}
     CONFIGURATIONS Release RelWithDebInfo
     OPTIONAL)
 

=== modified file 'cmake/mysql_version.cmake'
--- a/cmake/mysql_version.cmake	2010-04-22 16:53:50 +0000
+++ b/cmake/mysql_version.cmake	2010-05-12 21:20:24 +0000
@@ -55,6 +55,7 @@ MACRO(GET_MYSQL_VERSION)
   ENDIF()
   
   SET(VERSION ${VERSION_STRING})
+  STRING(REPLACE "-" "_" MYSQL_U_SCORE_VERSION "${VERSION_STRING}")
   
   # Remove trailing (non-numeric) part of the version string
   STRING(REGEX REPLACE "[^\\.0-9].*" "" VERSION_STRING ${VERSION_STRING})
@@ -106,6 +107,7 @@ ENDIF()
 IF(NOT CPACK_SOURCE_PACKAGE_FILE_NAME)
   SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mysql-${VERSION}")
 ENDIF()
+SET(CPACK_PACKAGE_CONTACT "MySQL Build Team <build@stripped>")
 SET(CPACK_PACKAGE_VENDOR "Sun Microsystems, Inc")
 SET(CPACK_SOURCE_GENERATOR "TGZ")
 INCLUDE(cpack_source_ignore_files)
@@ -114,6 +116,16 @@ INCLUDE(cpack_source_ignore_files)
 SET(PRODUCTNAME "MySQL Server")
 SET(COMPANYNAME ${CPACK_PACKAGE_VENDOR})
 
+# Windows 'date' command has unpredictable output, so cannot rely on it to
+# set MYSQL_COPYRIGHT_YEAR - if someone finds a portable way to do so then
+# it might be useful
+#IF (WIN32)
+#  EXECUTE_PROCESS(COMMAND "date" "/T" OUTPUT_VARIABLE TMP_DATE)
+#  STRING(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" MYSQL_COPYRIGHT_YEAR ${TMP_DATE})
+IF(UNIX)
+  EXECUTE_PROCESS(COMMAND "date" "+%Y" OUTPUT_VARIABLE MYSQL_COPYRIGHT_YEAR OUTPUT_STRIP_TRAILING_WHITESPACE)
+ENDIF()
+
 # Add version information to the exe and dll files
 # Refer to http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx
 # for more info.

=== modified file 'cmake/plugin.cmake'
--- a/cmake/plugin.cmake	2010-04-22 16:53:50 +0000
+++ b/cmake/plugin.cmake	2010-05-12 21:20:24 +0000
@@ -175,6 +175,7 @@ MACRO(MYSQL_ADD_PLUGIN)
       OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}")  
     # Install dynamic library
     MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR})
+    INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug)
   ENDIF()
 ENDMACRO()
 

=== modified file 'cmd-line-utils/Makefile.am'
--- a/cmd-line-utils/Makefile.am	2006-12-23 19:17:15 +0000
+++ b/cmd-line-utils/Makefile.am	2010-05-19 13:00:23 +0000
@@ -19,6 +19,3 @@
 
 SUBDIRS= @readline_basedir@
 DIST_SUBDIRS= libedit readline
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'cmd-line-utils/readline/Makefile.am'
--- a/cmd-line-utils/readline/Makefile.am	2009-11-09 11:32:48 +0000
+++ b/cmd-line-utils/readline/Makefile.am	2010-05-19 13:00:23 +0000
@@ -32,6 +32,3 @@ noinst_HEADERS =	readline.h chardefs.h k
 EXTRA_DIST=		emacs_keymap.c vi_keymap.c CMakeLists.txt
 
 DEFS =			-DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'config.h.cmake'
--- a/config.h.cmake	2010-02-28 04:35:09 +0000
+++ b/config.h.cmake	2010-05-12 11:51:23 +0000
@@ -38,6 +38,7 @@
 #cmakedefine HAVE_FPU_CONTROL_H 1
 #cmakedefine HAVE_GRP_H 1
 #cmakedefine HAVE_EXPLICIT_TEMPLATE_INSTANTIATION 1
+#cmakedefine HAVE_IA64INTRIN_H 1
 #cmakedefine HAVE_IEEEFP_H 1
 #cmakedefine HAVE_INTTYPES_H 1
 #cmakedefine HAVE_LIMITS_H 1

=== modified file 'extra/Makefile.am'
--- a/extra/Makefile.am	2009-10-15 12:23:43 +0000
+++ b/extra/Makefile.am	2010-05-19 13:00:23 +0000
@@ -55,6 +55,3 @@ EXTRA_DIST =		CMakeLists.txt
 
 perror.o: perror.c 
 	$(COMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'extra/yassl/Makefile.am'
--- a/extra/yassl/Makefile.am	2008-09-01 21:27:14 +0000
+++ b/extra/yassl/Makefile.am	2010-05-19 13:00:23 +0000
@@ -1,5 +1,2 @@
 SUBDIRS = taocrypt src testsuite
 EXTRA_DIST = CMakeLists.txt
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'extra/yassl/src/Makefile.am'
--- a/extra/yassl/src/Makefile.am	2006-11-27 22:12:05 +0000
+++ b/extra/yassl/src/Makefile.am	2010-05-19 13:00:23 +0000
@@ -6,7 +6,3 @@ libyassl_la_SOURCES = buffer.cpp cert_wr
 	template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp
 EXTRA_DIST = $(wildcard ../include/*.hpp) $(wildcard ../include/openssl/*.h)
 AM_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-

=== modified file 'extra/yassl/taocrypt/Makefile.am'
--- a/extra/yassl/taocrypt/Makefile.am	2008-09-01 21:27:14 +0000
+++ b/extra/yassl/taocrypt/Makefile.am	2010-05-19 13:00:23 +0000
@@ -1,5 +1,2 @@
 SUBDIRS = src test benchmark
 EXTRA_DIST = CMakeLists.txt $(wildcard mySTL/*.hpp)
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'extra/yassl/taocrypt/benchmark/Makefile.am'
--- a/extra/yassl/taocrypt/benchmark/Makefile.am	2007-03-22 15:58:46 +0000
+++ b/extra/yassl/taocrypt/benchmark/Makefile.am	2010-05-19 13:00:23 +0000
@@ -4,6 +4,3 @@ benchmark_SOURCES  = benchmark.cpp
 benchmark_LDADD    = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
 benchmark_CXXFLAGS = -DYASSL_PURE_C
 EXTRA_DIST = benchmark.dsp rsa1024.der dh1024.der dsa1024.der make.bat
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'extra/yassl/taocrypt/src/Makefile.am'
--- a/extra/yassl/taocrypt/src/Makefile.am	2006-11-27 22:12:05 +0000
+++ b/extra/yassl/taocrypt/src/Makefile.am	2010-05-19 13:00:23 +0000
@@ -11,7 +11,3 @@ libtaocrypt_la_SOURCES  = aes.cpp aestab
 libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C
 
 EXTRA_DIST = $(wildcard ../include/*.hpp)
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-

=== modified file 'extra/yassl/taocrypt/test/Makefile.am'
--- a/extra/yassl/taocrypt/test/Makefile.am	2007-01-29 17:48:20 +0000
+++ b/extra/yassl/taocrypt/test/Makefile.am	2010-05-19 13:00:23 +0000
@@ -4,6 +4,3 @@ test_SOURCES = test.cpp
 test_LDADD    = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
 test_CXXFLAGS = -DYASSL_PURE_C
 EXTRA_DIST = make.bat
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'extra/yassl/testsuite/Makefile.am'
--- a/extra/yassl/testsuite/Makefile.am	2007-01-29 17:48:20 +0000
+++ b/extra/yassl/testsuite/Makefile.am	2010-05-19 13:00:23 +0000
@@ -8,7 +8,3 @@ testsuite_CXXFLAGS = -DYASSL_PURE_C -DYA
 testsuite_LDADD    = $(top_builddir)/extra/yassl/src/libyassl.la \
                      $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
 EXTRA_DIST = testsuite.dsp test.hpp input quit make.bat
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-

=== modified file 'include/Makefile.am'
--- a/include/Makefile.am	2010-05-04 15:45:18 +0000
+++ b/include/Makefile.am	2010-05-19 13:01:45 +0000
@@ -99,6 +99,3 @@ endif
 
 probes_mysql_nodtrace.h: $(DTRACEPROVIDER)
 	@PERL@ $(top_srcdir)/scripts/dheadgen.pl -f $(DTRACEPROVIDER) > $@
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'include/my_global.h'
--- a/include/my_global.h	2010-04-18 13:32:05 +0000
+++ b/include/my_global.h	2010-05-19 13:50:12 +0000
@@ -551,7 +551,7 @@ C_MODE_END
 #include <assert.h>
 
 /* an assert that works at compile-time. only for constant expression */
-#ifndef __GNUC__
+#ifdef _some_old_compiler_that_does_not_understand_the_construct_below_
 #define compile_time_assert(X)  do { } while(0)
 #else
 #define compile_time_assert(X)                                  \
@@ -1703,6 +1703,15 @@ inline void  operator delete[](void*, vo
 */
 #ifdef TARGET_OS_LINUX
 #define NEED_EXPLICIT_SYNC_DIR 1
+#else
+/*
+  On linux default rwlock scheduling policy is good enough for
+  waiting_threads.c, on other systems use our special implementation
+  (which is slower).
+
+  QQ perhaps this should be tested in configure ? how ?
+*/
+#define WT_RWLOCKS_USE_MUTEXES 1
 #endif
 
 #if !defined(__cplusplus) && !defined(bool)

=== modified file 'include/my_pthread.h'
--- a/include/my_pthread.h	2010-03-31 14:05:33 +0000
+++ b/include/my_pthread.h	2010-05-19 13:50:12 +0000
@@ -93,16 +93,16 @@ struct timespec {
   /* The max timeout value in millisecond for pthread_cond_timedwait */
   long max_timeout_msec;
 };
-#define set_timespec(ABSTIME,SEC) { \
-  GetSystemTimeAsFileTime(&((ABSTIME).tv.ft)); \
-  (ABSTIME).tv.i64+= (__int64)(SEC)*10000000; \
-  (ABSTIME).max_timeout_msec= (long)((SEC)*1000); \
-}
-#define set_timespec_nsec(ABSTIME,NSEC) { \
-  GetSystemTimeAsFileTime(&((ABSTIME).tv.ft)); \
-  (ABSTIME).tv.i64+= (__int64)(NSEC)/100; \
-  (ABSTIME).max_timeout_msec= (long)((NSEC)/1000000); \
-}
+#define set_timespec_time_nsec(ABSTIME,TIME,NSEC) do {          \
+  (ABSTIME).tv.i64= (TIME)+(__int64)(NSEC)/100;                 \
+  (ABSTIME).max_timeout_msec= (long)((NSEC)/1000000);           \
+} while(0)
+
+#define set_timespec_nsec(ABSTIME,NSEC) do {                    \
+  union ft64 tv;                                                \
+  GetSystemTimeAsFileTime(&tv.ft);                              \
+  set_timespec_time_nsec((ABSTIME), tv.i64, (NSEC));            \
+} while(0)
 
 /**
    Compare two timespec structs.
@@ -396,42 +396,31 @@ int my_pthread_mutex_trylock(pthread_mut
   for calculating an absolute time at which
   pthread_cond_timedwait should timeout
 */
-#ifdef HAVE_TIMESPEC_TS_SEC
-#ifndef set_timespec
-#define set_timespec(ABSTIME,SEC) \
-{ \
-  (ABSTIME).ts_sec=time(0) + (time_t) (SEC); \
-  (ABSTIME).ts_nsec=0; \
-}
-#endif /* !set_timespec */
+#define set_timespec(ABSTIME,SEC) set_timespec_nsec((ABSTIME),(SEC)*1000000000ULL)
+
 #ifndef set_timespec_nsec
-#define set_timespec_nsec(ABSTIME,NSEC) \
-{ \
-  ulonglong now= my_getsystime() + (NSEC/100); \
-  (ABSTIME).ts_sec=  (now / ULL(10000000)); \
-  (ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
-}
+#define set_timespec_nsec(ABSTIME,NSEC)                                 \
+  set_timespec_time_nsec((ABSTIME),my_getsystime(),(NSEC))
 #endif /* !set_timespec_nsec */
+
+/* adapt for two different flavors of struct timespec */
+#ifdef HAVE_TIMESPEC_TS_SEC
+#define MY_tv_sec  ts_sec
+#define MY_tv_nsec ts_nsec
 #else
-#ifndef set_timespec
-#define set_timespec(ABSTIME,SEC) \
-{\
-  struct timeval tv;\
-  gettimeofday(&tv,0);\
-  (ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\
-  (ABSTIME).tv_nsec=tv.tv_usec*1000;\
-}
-#endif /* !set_timespec */
-#ifndef set_timespec_nsec
-#define set_timespec_nsec(ABSTIME,NSEC) \
-{\
-  ulonglong now= my_getsystime() + (NSEC/100); \
-  (ABSTIME).tv_sec=  (time_t) (now / ULL(10000000));                  \
-  (ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
-}
-#endif /* !set_timespec_nsec */
+#define MY_tv_sec  tv_sec
+#define MY_tv_nsec tv_nsec
 #endif /* HAVE_TIMESPEC_TS_SEC */
 
+#ifndef set_timespec_time_nsec
+#define set_timespec_time_nsec(ABSTIME,TIME,NSEC) do {                  \
+  ulonglong nsec= (NSEC);                                               \
+  ulonglong now= (TIME) + (nsec/100);                                   \
+  (ABSTIME).MY_tv_sec=  (now / 10000000ULL);                          \
+  (ABSTIME).MY_tv_nsec= (now % 10000000ULL * 100 + (nsec % 100));     \
+} while(0)
+#endif /* !set_timespec_time_nsec */
+
 /**
    Compare two timespec structs.
 

=== added file 'include/waiting_threads.h'
--- a/include/waiting_threads.h	1970-01-01 00:00:00 +0000
+++ b/include/waiting_threads.h	2010-05-19 13:50:12 +0000
@@ -0,0 +1,130 @@
+/* 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
+
+#ifndef _waiting_threads_h
+#define _waiting_threads_h
+
+#include <my_global.h>
+#include <my_sys.h>
+
+#include <lf.h>
+
+C_MODE_START
+
+typedef struct st_wt_resource_id WT_RESOURCE_ID;
+typedef struct st_wt_resource WT_RESOURCE;
+
+typedef struct st_wt_resource_type {
+  my_bool (*compare)(const void *a, const void *b);
+  const void *(*make_key)(const WT_RESOURCE_ID *id, uint *len); /* not used */
+} WT_RESOURCE_TYPE;
+
+struct st_wt_resource_id {
+  ulonglong value;
+  const WT_RESOURCE_TYPE *type;
+};
+/* the below differs from sizeof(WT_RESOURCE_ID) by the amount of padding */
+#define sizeof_WT_RESOURCE_ID (sizeof(ulonglong)+sizeof(void*))
+
+#define WT_WAIT_STATS  24
+#define WT_CYCLE_STATS 32
+extern ulonglong wt_wait_table[WT_WAIT_STATS];
+extern uint32    wt_wait_stats[WT_WAIT_STATS+1];
+extern uint32    wt_cycle_stats[2][WT_CYCLE_STATS+1];
+extern uint32    wt_success_stats;
+
+typedef struct st_wt_thd {
+  /*
+    XXX
+    there's no protection (mutex) against concurrent access of the
+    dynarray below. it is assumed that a caller will have it anyway
+    (not to protect this array but to protect its own - caller's -
+    data structures), and we'll get it for free. A caller needs to
+    ensure that a blocker won't release a resource before a blocked
+    thread starts waiting, which is usually done with a mutex.
+    
+    If the above assumption is wrong, we'll need to add a mutex here.
+  */
+  DYNAMIC_ARRAY   my_resources;
+  /*
+    'waiting_for' is modified under waiting_for->lock, and only by thd itself
+    'waiting_for' is read lock-free (using pinning protocol), but a thd object
+    can read its own 'waiting_for' without any locks or tricks.
+  */
+  WT_RESOURCE    *waiting_for;
+  LF_PINS        *pins;
+
+  /* pointers to values */
+  const ulong *timeout_short;
+  const ulong *deadlock_search_depth_short;
+  const ulong *timeout_long;
+  const ulong *deadlock_search_depth_long;
+
+  /*
+    weight relates to the desirability of a transaction being killed if it's
+    part of a deadlock. In a deadlock situation transactions with lower weights
+    are killed first.
+
+    Examples of using the weight to implement different selection strategies:
+
+    1. Latest
+        Keep all weights equal.
+    2. Random
+        Assight weights at random.
+        (variant: modify a weight randomly before every lock request)
+    3. Youngest
+        Set weight to -NOW()
+    4. Minimum locks
+        count locks granted in your lock manager, store the value as a weight
+    5. Minimum work
+        depends on the definition of "work". For example, store the number
+        of rows modifies in this transaction (or a length of REDO log for a
+        transaction) as a weight.
+
+    It is only statistically relevant and is not protected by any locks.
+  */
+  ulong volatile weight;
+  /*
+    'killed' is indirectly protected by waiting_for->lock because
+    a killed thread needs to clear its 'waiting_for' and thus needs a lock.
+    That is a thread needs an exclusive lock to read 'killed' reliably.
+    But other threads may change 'killed' from 0 to 1, a shared
+    lock is enough for that.
+   */
+  my_bool killed;
+#ifndef DBUG_OFF
+  const char     *name;
+#endif
+} WT_THD;
+
+#define WT_TIMEOUT              ETIMEDOUT
+#define WT_OK                   0
+#define WT_DEADLOCK             -1
+#define WT_DEPTH_EXCEEDED       -2
+#define WT_FREE_TO_GO           -3
+
+void wt_init(void);
+void wt_end(void);
+void wt_thd_lazy_init(WT_THD *, const ulong *, const ulong *, const ulong *, const ulong *);
+void wt_thd_destroy(WT_THD *);
+int wt_thd_will_wait_for(WT_THD *, WT_THD *, const WT_RESOURCE_ID *);
+int wt_thd_cond_timedwait(WT_THD *, pthread_mutex_t *);
+void wt_thd_release(WT_THD *, const WT_RESOURCE_ID *);
+#define wt_thd_release_all(THD) wt_thd_release((THD), 0)
+my_bool wt_resource_id_memcmp(const void *, const void *);
+
+C_MODE_END
+
+#endif

=== modified file 'libmysql/CMakeLists.txt'
--- a/libmysql/CMakeLists.txt	2010-03-17 18:56:22 +0000
+++ b/libmysql/CMakeLists.txt	2010-05-12 11:51:23 +0000
@@ -171,15 +171,24 @@ IF(UNIX)
       SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION})
     ENDIF() 
   ENDMACRO()
+  INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR})
 ENDIF()
 
 IF(NOT DISABLE_SHARED)
   MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS})
   IF(UNIX)
+    # libtool compatability
+    IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE)
+      SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}")
+    ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
+      SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}.0")
+    ELSE()
+      SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}.0.0")
+    ENDIF()
     # Name of shared library is mysqlclient on Unix
     SET_TARGET_PROPERTIES(libmysql PROPERTIES 
       OUTPUT_NAME mysqlclient 
-      VERSION "${SHARED_LIB_MAJOR_VERSION}.0.0" 
+      VERSION "${OS_SHARED_LIB_VERSION}" 
       SOVERSION "${SHARED_LIB_MAJOR_VERSION}")
     IF(LINK_FLAG_NO_UNDEFINED)
       GET_TARGET_PROPERTY(libmysql_link_flags libmysql LINK_FLAGS)
@@ -194,14 +203,21 @@ IF(NOT DISABLE_SHARED)
     SET_TARGET_PROPERTIES(mysqlclient PROPERTIES CLEAN_DIRECT_OUTPUT 1)
     SET_TARGET_PROPERTIES(libmysql PROPERTIES CLEAN_DIRECT_OUTPUT 1)
 
-    # Install 3 links to libmysqlclient.so (client_r)
-    FOREACH(ver "" "${SHARED_LIB_MAJOR_VERSION}"
-                "${SHARED_LIB_MAJOR_VERSION}.0.0")
-       GET_VERSIONED_LIBNAME(
-         "${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r"
-         "${CMAKE_SHARED_LIBRARY_SUFFIX}"
-         "${ver}"
-         linkname)
+    # Install links to libmysqlclient.so (client_r)
+    GET_VERSIONED_LIBNAME(
+      "${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r"
+      "${CMAKE_SHARED_LIBRARY_SUFFIX}"
+      ""
+      linkname)
+    INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR})
+    SET(OS_SHARED_LIB_SYMLINKS "${SHARED_LIB_MAJOR_VERSION}" "${OS_SHARED_LIB_VERSION}")
+    LIST(REMOVE_DUPLICATES OS_SHARED_LIB_SYMLINKS)
+    FOREACH(ver ${OS_SHARED_LIB_SYMLINKS})
+      GET_VERSIONED_LIBNAME(
+        "${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r"
+        "${CMAKE_SHARED_LIBRARY_SUFFIX}"
+        "${ver}"
+        linkname)
       INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR})
     ENDFOREACH()
   ENDIF()

=== modified file 'libmysql/Makefile.am'
--- a/libmysql/Makefile.am	2010-03-31 14:05:33 +0000
+++ b/libmysql/Makefile.am	2010-05-19 13:00:23 +0000
@@ -113,6 +113,3 @@ do-lib-dist:
 	echo '	$$(AR) r $$@ $$?'  >>$$dir/Makefile; \
 	gtar cvzf $$dir.tar.gz $$dir; \
 	cd $$dir; gmake
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'libmysql/Makefile.shared'
--- a/libmysql/Makefile.shared	2010-04-11 06:52:42 +0000
+++ b/libmysql/Makefile.shared	2010-05-19 13:00:23 +0000
@@ -116,6 +116,3 @@ conf_to_src_LDADD=
 #force static linking of conf_to_src - essential when linking against
 #custom installation of libc
 conf_to_src_LDFLAGS=@NOINST_LDFLAGS@
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'libmysql_r/Makefile.am'
--- a/libmysql_r/Makefile.am	2010-03-09 18:03:02 +0000
+++ b/libmysql_r/Makefile.am	2010-05-19 13:00:23 +0000
@@ -44,6 +44,3 @@ link_sources:
 	  done; \
 	done
 	echo timestamp > link_sources
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'libmysqld/CMakeLists.txt'
--- a/libmysqld/CMakeLists.txt	2010-04-13 15:04:45 +0000
+++ b/libmysqld/CMakeLists.txt	2010-05-12 11:51:23 +0000
@@ -133,7 +133,7 @@ ENDIF()
 
 IF(UNIX)
  INSTALL_DEBUG_TARGET(mysqlserver DESTINATION ${INSTALL_LIBDIR} RENAME
-  ${CMAKE_STATIC_LIBRARY_PREFIX}/mysqld-debug)
+  ${CMAKE_STATIC_LIBRARY_PREFIX}mysqld-debug)
 ENDIF()
 
 IF(MSVC AND NOT DISABLE_SHARED)

=== modified file 'libmysqld/Makefile.am'
--- a/libmysqld/Makefile.am	2010-04-13 15:04:45 +0000
+++ b/libmysqld/Makefile.am	2010-05-19 13:00:23 +0000
@@ -234,6 +234,3 @@ link_sources:
 clean-local:
 	rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlstoragesources) $(storagesources) | sed "s;\.lo;.c;g"`; \
 	rm -f client_settings.h
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'libmysqld/examples/CMakeLists.txt'
--- a/libmysqld/examples/CMakeLists.txt	2010-02-20 07:58:18 +0000
+++ b/libmysqld/examples/CMakeLists.txt	2010-05-12 11:51:23 +0000
@@ -23,7 +23,9 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/
 ADD_DEFINITIONS(-DEMBEDDED_LIBRARY -UMYSQL_CLIENT)
 
 
-MYSQL_ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
+# We never use "mysql_embedded", is more of a linktest, so we don't
+# use MYSQL_ADD_EXECUTABLE as that would install it and package it
+ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
                ../../client/mysql.cc ../../client/readline.cc)
 TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver)
 IF(UNIX)

=== modified file 'libmysqld/examples/Makefile.am'
--- a/libmysqld/examples/Makefile.am	2010-04-13 15:04:45 +0000
+++ b/libmysqld/examples/Makefile.am	2010-05-19 13:00:23 +0000
@@ -50,6 +50,3 @@ mysql_LDADD = @readline_link@ @TERMCAP_L
 
 mysql_client_test_embedded_LINK = $(CXXLINK)
 nodist_mysql_client_test_embedded_SOURCES = mysql_client_test.c
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'man/CMakeLists.txt'
--- a/man/CMakeLists.txt	2010-01-24 15:23:16 +0000
+++ b/man/CMakeLists.txt	2010-05-12 11:51:23 +0000
@@ -15,8 +15,12 @@
 
 # Copy man pages
 FILE(GLOB MAN1_FILES *.1)
+FILE(GLOB MAN1_EXCLUDE make_win_bin_dist.1)
 FILE(GLOB MAN8_FILES *.8)
 IF(MAN1_FILES)
+  IF(MAN1_EXCLUDE)
+    LIST(REMOVE_ITEM MAN1_FILES ${MAN1_EXCLUDE})
+  ENDIF()
   INSTALL(FILES ${MAN1_FILES} DESTINATION ${INSTALL_MANDIR}/man1)
 ENDIF()
 IF(MAN8_FILES)

=== modified file 'man/Makefile.am'
--- a/man/Makefile.am	2009-11-09 11:32:48 +0000
+++ b/man/Makefile.am	2010-05-19 13:00:23 +0000
@@ -24,6 +24,3 @@ EXTRA_DIST =  $(man1_MANS) $(man8_MANS) 
 # "make_win_*" are not needed in Unix binary packages,
 install-data-hook:
 	rm -f $(DESTDIR)$(mandir)/man1/make_win_*
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'mysql-test/CMakeLists.txt'
--- a/mysql-test/CMakeLists.txt	2010-03-17 19:31:04 +0000
+++ b/mysql-test/CMakeLists.txt	2010-05-12 21:20:24 +0000
@@ -18,6 +18,7 @@ INSTALL(
   DESTINATION ${INSTALL_MYSQLTESTDIR}
   PATTERN "var/" EXCLUDE
   PATTERN "lib/My/SafeProcess" EXCLUDE
+  PATTERN "lib/t*" EXCLUDE
   PATTERN "CPack" EXCLUDE
   PATTERN "CMake*" EXCLUDE
   PATTERN "mtr.out*" EXCLUDE

=== modified file 'mysql-test/Makefile.am'
--- a/mysql-test/Makefile.am	2010-03-25 07:26:12 +0000
+++ b/mysql-test/Makefile.am	2010-05-19 13:01:45 +0000
@@ -148,6 +148,3 @@ mtr:
 mysql-test-run:
 	$(RM) -f mysql-test-run
 	$(LN_S) mysql-test-run.pl mysql-test-run
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2010-05-04 12:20:06 +0000
+++ b/mysql-test/collections/default.experimental	2010-05-11 12:02:02 +0000
@@ -6,6 +6,8 @@ binlog.binlog_multi_engine              
 funcs_1.charset_collation_1              # depends on compile-time decisions
 funcs_1.myisam_views @solaris            # Bug#50595 2010-03-05 alik funcs_1.myisam_views takes longer time on 6.0 branch than 5.1 branch
 
+innodb.innodb_information_schema         # Bug#48883 2010-05-11 alik Test "innodb_information_schema" takes fewer locks than expected
+
 main.func_math @freebsd                  # Bug#43020 2010-05-04 alik main.func_math fails on FreeBSD in PB2
 main.gis @solaris                        # Bug#52208 2010-04-26 alik gis fails on some platforms (Solaris, HP-UX, Linux)
 main.gis-rtree @freebsd                  # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server

=== modified file 'mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test'
--- a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test	2009-02-05 09:49:32 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test	2010-05-18 15:35:14 +0000
@@ -149,7 +149,7 @@ SELECT * FROM t1 ORDER BY f3 LIMIT 20;
 --echo
 --echo * Show Slave Status *
 --echo
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 --query_vertical show slave status;
 --echo
 
@@ -439,7 +439,7 @@ connection master;
    select * from t31;
 
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 --query_vertical show slave status;
 
 #### Clean Up ####
@@ -499,7 +499,7 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,
 connection slave;
 source include/wait_for_slave_sql_to_stop.inc;
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 --query_vertical SHOW SLAVE STATUS
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
@@ -556,7 +556,7 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing
 connection slave;
 source include/wait_for_slave_sql_to_stop.inc;
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 --query_vertical SHOW SLAVE STATUS
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
@@ -699,7 +699,7 @@ SELECT c1,c3,hex(c4),c5,c6 FROM t14 ORDE
 connection slave;
 source include/wait_for_slave_sql_to_stop.inc;
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 --query_vertical SHOW SLAVE STATUS
 #***************************
 
@@ -765,7 +765,7 @@ SELECT c1,hex(c4),c5,c6,c7,c2 FROM t15 O
 connection slave;
 source include/wait_for_slave_sql_to_stop.inc;
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 --query_vertical SHOW SLAVE STATUS
 STOP SLAVE;
 RESET SLAVE;
@@ -842,7 +842,7 @@ SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDE
 connection slave;
 source include/wait_for_slave_sql_to_stop.inc;
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 --query_vertical SHOW SLAVE STATUS
 STOP SLAVE;
 RESET SLAVE;

=== modified file 'mysql-test/extra/rpl_tests/rpl_row_tabledefs.test'
--- a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test	2010-01-07 15:39:11 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test	2010-05-18 15:35:14 +0000
@@ -139,7 +139,7 @@ sync_slave_with_master;
 --echo **** On Slave ****
 SELECT * FROM t2;
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
+--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> 41 <Master-Info-File>
 --query_vertical SHOW SLAVE STATUS
 
 connection master;
@@ -151,7 +151,7 @@ INSERT INTO t4 VALUES (4);
 connection slave;
 --source include/wait_for_slave_sql_to_stop.inc
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
+--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> 41 <Master-Info-File>
 --query_vertical SHOW SLAVE STATUS
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
@@ -165,7 +165,7 @@ INSERT INTO t5 VALUES (5,10,25);
 connection slave;
 --source include/wait_for_slave_sql_to_stop.inc
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
+--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> 41 <Master-Info-File>
 --query_vertical SHOW SLAVE STATUS
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
@@ -179,7 +179,7 @@ INSERT INTO t6 VALUES (6,12,36);
 connection slave;
 --source include/wait_for_slave_sql_to_stop.inc
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
+--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> 41 <Master-Info-File>
 --query_vertical SHOW SLAVE STATUS
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
@@ -188,7 +188,7 @@ connection master;
 INSERT INTO t9 VALUES (6);
 sync_slave_with_master;
 --replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
+--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> 41 <Master-Info-File>
 --query_vertical SHOW SLAVE STATUS
 
 # Testing some tables extra field that can be null and cannot be null

=== modified file 'mysql-test/include/ctype_numconv.inc'
--- a/mysql-test/include/ctype_numconv.inc	2010-02-11 14:28:28 +0000
+++ b/mysql-test/include/ctype_numconv.inc	2010-05-14 05:28:51 +0000
@@ -457,6 +457,8 @@ select * from t1;
 show create table t1;
 drop table t1;
 
+# Ensure that row_count() value is reset after drop table.
+select 1;
 select hex(concat(row_count()));
 create table t1 as select concat(row_count()) as c1;
 show create table t1;

=== modified file 'mysql-test/include/mysqld--help.inc'
--- a/mysql-test/include/mysqld--help.inc	2010-01-26 21:05:41 +0000
+++ b/mysql-test/include/mysqld--help.inc	2010-05-17 15:28:50 +0000
@@ -23,7 +23,7 @@ perl;
   while (<F>) {
     next if 1../The following groups are read/;
     # formatting, skip line consisting entirely of dashes and blanks
-    next if /^[\- ]+$/;
+    next if /^[\- ]+\s?$/;
     next if /Value \(after reading options\)/; # skip table header
     next if /^($re1) /;
     next if /^($re2)-/;

=== modified file 'mysql-test/include/show_slave_status.inc'
--- a/mysql-test/include/show_slave_status.inc	2007-06-11 20:15:39 +0000
+++ b/mysql-test/include/show_slave_status.inc	2010-05-18 15:35:14 +0000
@@ -2,5 +2,5 @@
 # that varies depending on where the test is executed.
 
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 # 35 # 36 # 41 #
 query_vertical SHOW SLAVE STATUS;

=== modified file 'mysql-test/include/show_slave_status2.inc'
--- a/mysql-test/include/show_slave_status2.inc	2009-12-22 09:35:56 +0000
+++ b/mysql-test/include/show_slave_status2.inc	2010-05-18 15:35:14 +0000
@@ -4,5 +4,5 @@
 # masked out log positions
 
 --replace_result $MASTER_MYPORT MASTER_PORT $DEFAULT_MASTER_PORT 3306
---replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # 41 #
 query_vertical SHOW SLAVE STATUS;

=== modified file 'mysql-test/include/test_fieldsize.inc'
--- a/mysql-test/include/test_fieldsize.inc	2010-03-07 16:40:59 +0000
+++ b/mysql-test/include/test_fieldsize.inc	2010-05-18 15:35:14 +0000
@@ -24,7 +24,7 @@ connection slave;
 START SLAVE;
 --source include/wait_for_slave_sql_to_stop.inc
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # 41 #
 --query_vertical SHOW SLAVE STATUS
 
 # The following should be 0

=== modified file 'mysql-test/lib/My/SafeProcess/Makefile.am'
--- a/mysql-test/lib/My/SafeProcess/Makefile.am	2009-10-13 18:21:42 +0000
+++ b/mysql-test/lib/My/SafeProcess/Makefile.am	2010-05-19 13:00:23 +0000
@@ -23,7 +23,3 @@ my_safe_process_SOURCES = safe_process.c
 EXTRA_DIST = 	safe_kill_win.cc \
 		safe_process_win.cc \
 		CMakeLists.txt
-
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'mysql-test/r/ctype_binary.result'
--- a/mysql-test/r/ctype_binary.result	2010-02-11 14:28:28 +0000
+++ b/mysql-test/r/ctype_binary.result	2010-05-14 05:28:51 +0000
@@ -772,6 +772,9 @@ t1	CREATE TABLE `t1` (
   `c1` varbinary(31) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
+select 1;
+1
+1
 select hex(concat(row_count()));
 hex(concat(row_count()))
 2D31

=== modified file 'mysql-test/r/ctype_cp1251.result'
--- a/mysql-test/r/ctype_cp1251.result	2010-02-11 14:28:28 +0000
+++ b/mysql-test/r/ctype_cp1251.result	2010-05-14 05:28:51 +0000
@@ -854,6 +854,9 @@ t1	CREATE TABLE `t1` (
   `c1` varchar(31) CHARACTER SET cp1251 DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
+select 1;
+1
+1
 select hex(concat(row_count()));
 hex(concat(row_count()))
 2D31

=== modified file 'mysql-test/r/ctype_latin1.result'
--- a/mysql-test/r/ctype_latin1.result	2010-02-11 14:28:28 +0000
+++ b/mysql-test/r/ctype_latin1.result	2010-05-14 05:28:51 +0000
@@ -1182,6 +1182,9 @@ t1	CREATE TABLE `t1` (
   `c1` varchar(31) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
+select 1;
+1
+1
 select hex(concat(row_count()));
 hex(concat(row_count()))
 2D31

=== modified file 'mysql-test/r/ctype_ucs.result'
--- a/mysql-test/r/ctype_ucs.result	2010-02-11 14:28:28 +0000
+++ b/mysql-test/r/ctype_ucs.result	2010-05-14 05:28:51 +0000
@@ -2006,6 +2006,9 @@ t1	CREATE TABLE `t1` (
   `c1` varchar(31) CHARACTER SET ucs2 DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
+select 1;
+1
+1
 select hex(concat(row_count()));
 hex(concat(row_count()))
 002D0031

=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result	2010-02-20 10:07:32 +0000
+++ b/mysql-test/r/information_schema.result	2010-05-20 08:54:19 +0000
@@ -1682,6 +1682,34 @@ DROP USER nonpriv;
 DROP TABLE db1.t1;
 DROP DATABASE db1;
 End of 5.1 tests.
+create function f1 (p1 int, p2 datetime, p3 decimal(10,2))
+returns char(10) return null;
+create procedure p1 (p1 float(8,5), p2 char(32), p3 varchar(10)) begin end;
+create procedure p2 (p1 enum('c', 's'), p2 blob, p3 text) begin end;
+select * from information_schema.parameters where specific_schema='test';
+SPECIFIC_CATALOG	SPECIFIC_SCHEMA	SPECIFIC_NAME	ORDINAL_POSITION	PARAMETER_MODE	PARAMETER_NAME	DATA_TYPE	CHARACTER_MAXIMUM_LENGTH	CHARACTER_OCTET_LENGTH	NUMERIC_PRECISION	NUMERIC_SCALE	CHARACTER_SET_NAME	COLLATION_NAME	DTD_IDENTIFIER	ROUTINE_TYPE
+def	test	f1	0	NULL	NULL	char	10	10	NULL	NULL	latin1	latin1_swedish_ci	char(10)	FUNCTION
+def	test	f1	1	IN	p1	int	NULL	NULL	10	0	NULL	NULL	int(11)	FUNCTION
+def	test	f1	2	IN	p2	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime	FUNCTION
+def	test	f1	3	IN	p3	decimal	NULL	NULL	10	2	NULL	NULL	decimal(10,2)	FUNCTION
+def	test	p1	1	IN	p1	float	NULL	NULL	8	5	NULL	NULL	float(8,5)	PROCEDURE
+def	test	p1	2	IN	p2	char	32	32	NULL	NULL	latin1	latin1_swedish_ci	char(32)	PROCEDURE
+def	test	p1	3	IN	p3	varchar	10	10	NULL	NULL	latin1	latin1_swedish_ci	varchar(10)	PROCEDURE
+def	test	p2	1	IN	p1	enum	1	1	NULL	NULL	latin1	latin1_swedish_ci	enum('c','s')	PROCEDURE
+def	test	p2	2	IN	p2	blob	65535	65535	NULL	NULL	NULL	NULL	blob	PROCEDURE
+def	test	p2	3	IN	p3	text	65535	65535	NULL	NULL	latin1	latin1_swedish_ci	text	PROCEDURE
+select data_type, character_maximum_length,
+character_octet_length, numeric_precision,
+numeric_scale, character_set_name,
+collation_name, dtd_identifier
+from information_schema.routines where routine_schema='test';
+data_type	character_maximum_length	character_octet_length	numeric_precision	numeric_scale	character_set_name	collation_name	dtd_identifier
+char	10	10	NULL	NULL	latin1	latin1_swedish_ci	char(10)
+	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+drop procedure p1;
+drop procedure p2;
+drop function f1;
 #
 # Additional test for WL#3726 "DDL locking for all metadata objects"
 # To avoid possible deadlocks process of filling of I_S tables should
@@ -1771,6 +1799,12 @@ ERROR 42000: Access denied for user 'roo
 LOCK TABLES t1 READ, information_schema.tables READ;
 ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 DROP TABLE t1;
+create function f1() returns int return 1;
+select routine_name, routine_type from information_schema.routines
+where routine_schema = 'test';
+routine_name	routine_type
+f1	FUNCTION
+drop function f1;
 SELECT *
 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
 LEFT JOIN INFORMATION_SCHEMA.COLUMNS

=== modified file 'mysql-test/r/mysql_client_test.result'
--- a/mysql-test/r/mysql_client_test.result	2008-11-13 19:19:00 +0000
+++ b/mysql-test/r/mysql_client_test.result	2010-05-19 12:33:51 +0000
@@ -1,3 +1,122 @@
 SET @old_general_log= @@global.general_log;
 ok
+
+# cat MYSQL_TMP_DIR/test_wl4435.out.log
+# ------------------------------------
+
+exec_counter: 0
+num_fields: 4
+  - 0: name: 'a1'/'a1'; table: 't1'/'t1'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+  - 1: name: 'a2'/'a2'; table: 't1'/'t1'; db: 'client_test_db'; catalog: 'def'; length: 32; max_length: 0; type: 254; decimals: 0
+  - 2: name: 'a3'/'a3'; table: 't1'/'t1'; db: 'client_test_db'; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
+  - 3: name: 'a4'/'a4'; table: 't1'/'t1'; db: 'client_test_db'; catalog: 'def'; length: 5; max_length: 0; type: 246; decimals: 1
+Data:
+  int: 1; str: '11'; dbl: 12.340000; dec: '56.7';
+  int: 2; str: '12'; dbl: 56.780000; dec: '90.1';
+  int: 3; str: '13'; dbl: 23.450000; dec: '67.8';
+EOF
+mysql_stmt_next_result(): 0; field_count: 5
+num_fields: 5
+  - 0: name: 'b0'/'b0'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+  - 1: name: 'b1'/'b1'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+  - 2: name: 'b2'/'b2'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 32; max_length: 0; type: 254; decimals: 0
+  - 3: name: 'b3'/'b3'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
+  - 4: name: 'b4'/'b4'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 5; max_length: 0; type: 246; decimals: 1
+Data:
+  int: 100; int: 10; str: '110'; dbl: 70.700000; dec: '10.1';
+  int: 200; int: 20; str: '120'; dbl: 80.800000; dec: '20.2';
+  int: 300; int: 30; str: '130'; dbl: 90.900000; dec: '30.3';
+EOF
+mysql_stmt_next_result(): 0; field_count: 8
+num_fields: 8
+  - 0: name: 'v_str_1'/'v_str_1'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 32; max_length: 0; type: 254; decimals: 0
+  - 1: name: 'v_dbl_1'/'v_dbl_1'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
+  - 2: name: 'v_dec_1'/'v_dec_1'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 8; max_length: 0; type: 246; decimals: 3
+  - 3: name: 'v_int_1'/'v_int_1'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+  - 4: name: 'v_str_2'/'v_str_2'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 64; max_length: 0; type: 254; decimals: 0
+  - 5: name: 'v_dbl_2'/'v_dbl_2'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 5; max_length: 0; type: 5; decimals: 3
+  - 6: name: 'v_dec_2'/'v_dec_2'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 9; max_length: 0; type: 246; decimals: 4
+  - 7: name: 'v_int_2'/'v_int_2'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+Data:
+  str: 'test_1'; dbl: 12.340000; dec: '567.891'; int: 2345; str: 'test_2'; dbl: 67.891000; dec: '234.6789'; int: 6789;
+EOF
+mysql_stmt_next_result(): 0; field_count: 0
+
+exec_counter: 1
+num_fields: 4
+  - 0: name: 'a1'/'a1'; table: 't1'/'t1'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+  - 1: name: 'a2'/'a2'; table: 't1'/'t1'; db: 'client_test_db'; catalog: 'def'; length: 32; max_length: 0; type: 254; decimals: 0
+  - 2: name: 'a3'/'a3'; table: 't1'/'t1'; db: 'client_test_db'; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
+  - 3: name: 'a4'/'a4'; table: 't1'/'t1'; db: 'client_test_db'; catalog: 'def'; length: 5; max_length: 0; type: 246; decimals: 1
+Data:
+  int: 1; str: '11'; dbl: 12.340000; dec: '56.7';
+  int: 2; str: '12'; dbl: 56.780000; dec: '90.1';
+  int: 3; str: '13'; dbl: 23.450000; dec: '67.8';
+EOF
+mysql_stmt_next_result(): 0; field_count: 5
+num_fields: 5
+  - 0: name: 'b0'/'b0'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+  - 1: name: 'b1'/'b1'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+  - 2: name: 'b2'/'b2'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 32; max_length: 0; type: 254; decimals: 0
+  - 3: name: 'b3'/'b3'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
+  - 4: name: 'b4'/'b4'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 5; max_length: 0; type: 246; decimals: 1
+Data:
+  int: 100; int: 10; str: '110'; dbl: 70.700000; dec: '10.1';
+  int: 200; int: 20; str: '120'; dbl: 80.800000; dec: '20.2';
+  int: 300; int: 30; str: '130'; dbl: 90.900000; dec: '30.3';
+EOF
+mysql_stmt_next_result(): 0; field_count: 8
+num_fields: 8
+  - 0: name: 'v_str_1'/'v_str_1'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 32; max_length: 0; type: 254; decimals: 0
+  - 1: name: 'v_dbl_1'/'v_dbl_1'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
+  - 2: name: 'v_dec_1'/'v_dec_1'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 8; max_length: 0; type: 246; decimals: 3
+  - 3: name: 'v_int_1'/'v_int_1'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+  - 4: name: 'v_str_2'/'v_str_2'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 64; max_length: 0; type: 254; decimals: 0
+  - 5: name: 'v_dbl_2'/'v_dbl_2'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 5; max_length: 0; type: 5; decimals: 3
+  - 6: name: 'v_dec_2'/'v_dec_2'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 9; max_length: 0; type: 246; decimals: 4
+  - 7: name: 'v_int_2'/'v_int_2'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+Data:
+  str: 'test_1'; dbl: 12.340000; dec: '567.891'; int: 2345; str: 'test_2'; dbl: 67.891000; dec: '234.6789'; int: 6789;
+EOF
+mysql_stmt_next_result(): 0; field_count: 0
+
+exec_counter: 2
+num_fields: 4
+  - 0: name: 'a1'/'a1'; table: 't1'/'t1'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+  - 1: name: 'a2'/'a2'; table: 't1'/'t1'; db: 'client_test_db'; catalog: 'def'; length: 32; max_length: 0; type: 254; decimals: 0
+  - 2: name: 'a3'/'a3'; table: 't1'/'t1'; db: 'client_test_db'; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
+  - 3: name: 'a4'/'a4'; table: 't1'/'t1'; db: 'client_test_db'; catalog: 'def'; length: 5; max_length: 0; type: 246; decimals: 1
+Data:
+  int: 1; str: '11'; dbl: 12.340000; dec: '56.7';
+  int: 2; str: '12'; dbl: 56.780000; dec: '90.1';
+  int: 3; str: '13'; dbl: 23.450000; dec: '67.8';
+EOF
+mysql_stmt_next_result(): 0; field_count: 5
+num_fields: 5
+  - 0: name: 'b0'/'b0'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+  - 1: name: 'b1'/'b1'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+  - 2: name: 'b2'/'b2'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 32; max_length: 0; type: 254; decimals: 0
+  - 3: name: 'b3'/'b3'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
+  - 4: name: 'b4'/'b4'; table: 't2'/'t2'; db: 'client_test_db'; catalog: 'def'; length: 5; max_length: 0; type: 246; decimals: 1
+Data:
+  int: 100; int: 10; str: '110'; dbl: 70.700000; dec: '10.1';
+  int: 200; int: 20; str: '120'; dbl: 80.800000; dec: '20.2';
+  int: 300; int: 30; str: '130'; dbl: 90.900000; dec: '30.3';
+EOF
+mysql_stmt_next_result(): 0; field_count: 8
+num_fields: 8
+  - 0: name: 'v_str_1'/'v_str_1'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 32; max_length: 0; type: 254; decimals: 0
+  - 1: name: 'v_dbl_1'/'v_dbl_1'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2
+  - 2: name: 'v_dec_1'/'v_dec_1'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 8; max_length: 0; type: 246; decimals: 3
+  - 3: name: 'v_int_1'/'v_int_1'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+  - 4: name: 'v_str_2'/'v_str_2'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 64; max_length: 0; type: 254; decimals: 0
+  - 5: name: 'v_dbl_2'/'v_dbl_2'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 5; max_length: 0; type: 5; decimals: 3
+  - 6: name: 'v_dec_2'/'v_dec_2'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 9; max_length: 0; type: 246; decimals: 4
+  - 7: name: 'v_int_2'/'v_int_2'; table: 'p1'/'p1'; db: 'client_test_db'; catalog: 'def'; length: 11; max_length: 0; type: 3; decimals: 0
+Data:
+  str: 'test_1'; dbl: 12.340000; dec: '567.891'; int: 2345; str: 'test_2'; dbl: 67.891000; dec: '234.6789'; int: 6789;
+EOF
+mysql_stmt_next_result(): 0; field_count: 0
+# ------------------------------------
+
 SET @@global.general_log= @old_general_log;

=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result	2010-02-20 10:07:32 +0000
+++ b/mysql-test/r/partition.result	2010-05-19 12:31:18 +0000
@@ -2111,4 +2111,24 @@ COUNT(*)
 0
 DROP TABLE t1;
 SET SESSION SQL_MODE=DEFAULT;
+#
+# Bug#46198: Hang after failed ALTER TABLE on partitioned table.
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (s1 INT PRIMARY KEY) PARTITION BY HASH(s1);
+LOCK TABLES t1 WRITE, t1 b READ;
+UNLOCK TABLES;
+ALTER TABLE t1 DROP PARTITION p1;
+ERROR HY000: DROP PARTITION can only be used on RANGE/LIST partitions
+SELECT * FROM t1;
+s1
+DROP TABLE t1;
+CREATE TABLE t1 (s1 VARCHAR(5) PRIMARY KEY) PARTITION BY KEY(s1);
+LOCK TABLES t1 WRITE, t1 b READ;
+UNLOCK TABLES;
+ALTER TABLE t1 ADD COLUMN (s3 VARCHAR(5) UNIQUE);
+ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
+SELECT * FROM t1;
+s1
+DROP TABLE t1;
 End of 5.1 tests

=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result	2010-04-19 08:29:52 +0000
+++ b/mysql-test/r/sp.result	2010-05-14 05:29:47 +0000
@@ -2590,11 +2590,11 @@ row_count()
 call bug4905()|
 select row_count()|
 row_count()
--1
+0
 call bug4905()|
 select row_count()|
 row_count()
--1
+0
 select * from t3|
 s1
 1

=== modified file 'mysql-test/r/trigger.result'
--- a/mysql-test/r/trigger.result	2010-03-24 15:03:44 +0000
+++ b/mysql-test/r/trigger.result	2010-05-19 13:22:43 +0000
@@ -2205,4 +2205,45 @@ trigger_name
 # Clean-up.
 drop temporary table t1;
 drop table t1;
+#
+# Bug#34432 Wrong lock type passed to the engine if pre-locking + 
+#           multi-update in a trigger
+#
+DROP TABLE IF EXISTS t1, t2, t3;
+DROP TRIGGER IF EXISTS t2_ai;
+CREATE TABLE t2 
+(
+value CHAR(30),
+domain_id INT,
+mailaccount_id INT, 
+program CHAR(30),
+keey CHAR(30),
+PRIMARY KEY(domain_id)
+);
+CREATE TABLE t3 
+(
+value CHAR(30),
+domain_id INT,
+mailaccount_id INT,
+program CHAR(30),
+keey CHAR(30),
+PRIMARY KEY(domain_id)
+);
+CREATE TABLE t1 (id INT,domain CHAR(30),PRIMARY KEY(id));
+CREATE TRIGGER t2_ai AFTER INSERT ON t2 FOR EACH ROW 
+UPDATE t3 ms, t1 d SET ms.value='No'
+  WHERE ms.domain_id = 
+(SELECT max(id) FROM t1 WHERE domain='example.com') 
+AND ms.mailaccount_id IS NULL 
+AND ms.program='spamfilter' 
+AND ms.keey='scan_incoming';
+|
+INSERT INTO t1 VALUES (1, 'example.com'),
+(2, 'mysql.com'),
+(3, 'earthmotherwear.com'),
+(4, 'yahoo.com'),
+(5, 'example.com');
+INSERT INTO t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
+DROP TRIGGER t2_ai;
+DROP TABLE t1, t2, t3;
 End of 6.0 tests.

=== modified file 'mysql-test/r/variables_debug.result'
--- a/mysql-test/r/variables_debug.result	2008-02-26 15:03:59 +0000
+++ b/mysql-test/r/variables_debug.result	2010-05-19 12:31:18 +0000
@@ -10,3 +10,10 @@ set debug= '-P';
 select @@debug;
 @@debug
 T
+SELECT @@session.debug, @@global.debug;
+@@session.debug	@@global.debug
+T	
+SET SESSION debug = '';
+SELECT @@session.debug, @@global.debug;
+@@session.debug	@@global.debug
+	

=== modified file 'mysql-test/suite/funcs_1/r/innodb_storedproc_10.result'
--- a/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result	2009-01-31 19:22:59 +0000
+++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result	2010-05-14 05:28:51 +0000
@@ -375,7 +375,7 @@ row_count() after delete
 2
 SELECT row_count();
 row_count()
--1
+0
 SELECT * FROM temp;
 f1	f2	f3	f4	f5	f6
 qwe	xyz	1998-03-26	100	uvw	1000

=== modified file 'mysql-test/suite/funcs_1/r/memory_storedproc_10.result'
--- a/mysql-test/suite/funcs_1/r/memory_storedproc_10.result	2009-01-31 19:22:59 +0000
+++ b/mysql-test/suite/funcs_1/r/memory_storedproc_10.result	2010-05-14 05:28:51 +0000
@@ -376,7 +376,7 @@ row_count() after delete
 2
 SELECT row_count();
 row_count()
--1
+0
 SELECT * FROM temp;
 f1	f2	f3	f4	f5	f6
 qwe	xyz	1998-03-26	100	uvw	1000

=== modified file 'mysql-test/suite/funcs_1/r/myisam_storedproc_10.result'
--- a/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result	2009-01-31 19:22:59 +0000
+++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result	2010-05-14 05:28:51 +0000
@@ -376,7 +376,7 @@ row_count() after delete
 2
 SELECT row_count();
 row_count()
--1
+0
 SELECT * FROM temp;
 f1	f2	f3	f4	f5	f6
 qwe	xyz	1998-03-26	100	uvw	1000

=== modified file 'mysql-test/suite/funcs_1/r/ndb_storedproc_10.result'
--- a/mysql-test/suite/funcs_1/r/ndb_storedproc_10.result	2009-01-31 19:22:59 +0000
+++ b/mysql-test/suite/funcs_1/r/ndb_storedproc_10.result	2010-05-14 05:28:51 +0000
@@ -375,7 +375,7 @@ row_count() after delete
 2
 SELECT row_count();
 row_count()
--1
+0
 SELECT * FROM temp;
 f1	f2	f3	f4	f5	f6
 qwe	xyz	1998-03-26	100	uvw	1000

=== added file 'mysql-test/suite/funcs_1/r/row_count_func.result'
--- a/mysql-test/suite/funcs_1/r/row_count_func.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/funcs_1/r/row_count_func.result	2010-05-14 05:28:51 +0000
@@ -0,0 +1,79 @@
+
+# -- 
+# -- Test case for Bug#21818.
+# -- 
+
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+
+# -- Check 1.
+SELECT * FROM t1 INTO OUTFILE "MYSQL_TMP_DIR/bug21818.txt";
+affected rows: 3
+
+SELECT ROW_COUNT();
+ROW_COUNT()
+3
+
+# -- Check 2.
+SELECT a FROM t1 LIMIT 1 INTO @a;
+affected rows: 1
+
+SELECT ROW_COUNT();
+ROW_COUNT()
+1
+
+# -- Check 3.
+DROP DATABASE IF EXISTS mysqltest1;
+CREATE DATABASE mysqltest1;
+affected rows: 1
+
+SELECT ROW_COUNT();
+ROW_COUNT()
+1
+DROP DATABASE mysqltest1;
+
+# -- Check 4.
+DELETE FROM t1;
+LOAD DATA INFILE 'MYSQL_TMP_DIR/bug21818.txt' INTO TABLE t1(a);
+affected rows: 3
+info: Records: 3  Deleted: 0  Skipped: 0  Warnings: 0
+
+SELECT ROW_COUNT();
+ROW_COUNT()
+3
+
+# -- Check 5.
+ALTER TABLE t1 ADD COLUMN b VARCHAR(255);
+affected rows: 3
+info: Records: 3  Duplicates: 0  Warnings: 0
+
+SELECT ROW_COUNT();
+ROW_COUNT()
+3
+
+DROP TABLE t1;
+
+# -- Check 6.
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (ROW_COUNT());
+SELECT * FROM t2;
+a
+3
+DROP TABLE t1;
+DROP TABLE t2;
+
+# -- Check 7 (check that SQL errors reset row_count to -1).
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+SELECT f1();
+ERROR 42000: FUNCTION test.f1 does not exist
+SELECT ROW_COUNT();
+ROW_COUNT()
+-1
+DROP TABLE t1;
+
+# -- End of test case for Bug#21818.

=== added file 'mysql-test/suite/funcs_1/t/row_count_func-master.opt'
--- a/mysql-test/suite/funcs_1/t/row_count_func-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/funcs_1/t/row_count_func-master.opt	2010-05-14 05:28:51 +0000
@@ -0,0 +1 @@
+--secure-file-priv=$MYSQL_TMP_DIR

=== added file 'mysql-test/suite/funcs_1/t/row_count_func.test'
--- a/mysql-test/suite/funcs_1/t/row_count_func.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/funcs_1/t/row_count_func.test	2010-05-14 05:28:51 +0000
@@ -0,0 +1,115 @@
+--echo
+--echo # -- 
+--echo # -- Test case for Bug#21818.
+--echo # -- 
+--echo
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+
+--echo
+--echo # -- Check 1.
+
+--enable_info
+--echo SELECT * FROM t1 INTO OUTFILE "MYSQL_TMP_DIR/bug21818.txt";
+--disable_query_log # to avoid $MYSQL_TMP_DIR in query log
+--eval SELECT * FROM t1 INTO OUTFILE "$MYSQL_TMP_DIR/bug21818.txt"
+--enable_query_log
+--disable_info
+
+--echo
+SELECT ROW_COUNT();
+
+--echo
+--echo # -- Check 2.
+
+--enable_info
+SELECT a FROM t1 LIMIT 1 INTO @a;
+--disable_info
+
+--echo
+SELECT ROW_COUNT();
+
+--echo
+--echo # -- Check 3.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+--enable_warnings
+
+--enable_info
+CREATE DATABASE mysqltest1;
+--disable_info
+
+--echo
+SELECT ROW_COUNT();
+
+DROP DATABASE mysqltest1;
+
+--echo
+--echo # -- Check 4.
+
+DELETE FROM t1;
+
+--enable_info
+--echo LOAD DATA INFILE 'MYSQL_TMP_DIR/bug21818.txt' INTO TABLE t1(a);
+--disable_query_log # to avoid $MYSQL_TMP_DIR in query log
+--eval LOAD DATA INFILE '$MYSQL_TMP_DIR/bug21818.txt' INTO TABLE t1(a)
+--enable_query_log
+--disable_info
+
+--echo
+SELECT ROW_COUNT();
+
+--remove_file $MYSQL_TMP_DIR/bug21818.txt
+
+--echo
+--echo # -- Check 5.
+
+--enable_info
+ALTER TABLE t1 ADD COLUMN b VARCHAR(255);
+--disable_info
+
+--echo
+SELECT ROW_COUNT();
+
+--echo
+DROP TABLE t1;
+
+--echo
+--echo # -- Check 6.
+
+--disable_warnings
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT);
+
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (ROW_COUNT());
+
+SELECT * FROM t2;
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+--echo
+--echo # -- Check 7 (check that SQL errors reset row_count to -1).
+
+CREATE TABLE t1(a INT);
+
+INSERT INTO t1 VALUES (1), (2), (3);
+--error ER_SP_DOES_NOT_EXIST
+SELECT f1();
+
+SELECT ROW_COUNT();
+
+DROP TABLE t1;
+
+--echo
+--echo # -- End of test case for Bug#21818.

=== modified file 'mysql-test/suite/parts/r/rpl_partition.result'
--- a/mysql-test/suite/parts/r/rpl_partition.result	2009-10-18 03:57:38 +0000
+++ b/mysql-test/suite/parts/r/rpl_partition.result	2010-05-19 05:06:13 +0000
@@ -190,6 +190,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT count(*) "Slave norm" FROM t1;
 Slave norm	500
 SELECT count(*) "Slave bykey" FROM t2;

=== modified file 'mysql-test/suite/parts/t/rpl_partition.test'
--- a/mysql-test/suite/parts/t/rpl_partition.test	2009-07-15 16:41:02 +0000
+++ b/mysql-test/suite/parts/t/rpl_partition.test	2010-05-19 05:06:13 +0000
@@ -158,7 +158,7 @@ SELECT count(*) as "Master byrange" FROM
 connection slave;
 show create table t3; 
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 show slave status;
 SELECT count(*) "Slave norm" FROM t1;
 SELECT count(*) "Slave bykey" FROM t2;

=== modified file 'mysql-test/suite/rpl/r/rpl_000015.result'
--- a/mysql-test/suite/rpl/r/rpl_000015.result	2009-11-04 12:28:20 +0000
+++ b/mysql-test/suite/rpl/r/rpl_000015.result	2010-05-18 15:35:14 +0000
@@ -47,6 +47,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	0
+Master_Info_File	#
 start slave;
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -89,6 +90,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 drop table if exists t1;
 create table t1 (n int, PRIMARY KEY(n));
 insert into t1 values (10),(45),(90);

=== modified file 'mysql-test/suite/rpl/r/rpl_bug33931.result'
--- a/mysql-test/suite/rpl/r/rpl_bug33931.result	2009-11-28 14:53:48 +0000
+++ b/mysql-test/suite/rpl/r/rpl_bug33931.result	2010-05-18 15:35:14 +0000
@@ -44,4 +44,5 @@ Last_SQL_Errno	#
 Last_SQL_Error	Failed during slave thread initialization
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	0
+Master_Info_File	#
 SET GLOBAL debug="";

=== modified file 'mysql-test/suite/rpl/r/rpl_change_master.result'
--- a/mysql-test/suite/rpl/r/rpl_change_master.result	2009-10-02 08:35:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result	2010-05-18 15:35:14 +0000
@@ -52,6 +52,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 change master to master_user='root';
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -94,6 +95,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 start slave;
 select * from t1;
 n

=== modified file 'mysql-test/suite/rpl/r/rpl_deadlock_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result	2009-10-01 16:44:53 +0000
+++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result	2010-05-18 15:35:14 +0000
@@ -91,6 +91,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 
 *** Test lock wait timeout ***
 include/stop_slave.inc
@@ -155,6 +156,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 
 *** Test lock wait timeout and purged relay logs ***
 SET @my_max_relay_log_size= @@global.max_relay_log_size;
@@ -224,6 +226,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 
 *** Clean up ***
 DROP TABLE t1,t2,t3;

=== modified file 'mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result	2010-01-07 15:39:11 +0000
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result	2010-05-18 15:35:14 +0000
@@ -134,6 +134,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 
 
 ***** Testing Altering table def scenario *****
@@ -512,6 +513,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 
 ****************************************
 * columns in master at middle of table *
@@ -588,6 +590,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -665,6 +668,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -818,6 +822,7 @@ Last_SQL_Errno	1091
 Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 STOP SLAVE;
 RESET SLAVE;
 
@@ -906,6 +911,7 @@ Last_SQL_Errno	1054
 Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 STOP SLAVE;
 RESET SLAVE;
 
@@ -994,6 +1000,7 @@ Last_SQL_Errno	1072
 Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 STOP SLAVE;
 RESET SLAVE;
 

=== modified file 'mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result'
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result	2010-01-07 15:39:11 +0000
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result	2010-05-18 15:35:14 +0000
@@ -134,6 +134,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 
 
 ***** Testing Altering table def scenario *****
@@ -512,6 +513,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 
 ****************************************
 * columns in master at middle of table *
@@ -588,6 +590,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -665,6 +668,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 
@@ -818,6 +822,7 @@ Last_SQL_Errno	1091
 Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 STOP SLAVE;
 RESET SLAVE;
 
@@ -906,6 +911,7 @@ Last_SQL_Errno	1054
 Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 STOP SLAVE;
 RESET SLAVE;
 
@@ -994,6 +1000,7 @@ Last_SQL_Errno	1072
 Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 STOP SLAVE;
 RESET SLAVE;
 

=== modified file 'mysql-test/suite/rpl/r/rpl_flushlog_loop.result'
--- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result	2009-10-01 17:22:44 +0000
+++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result	2010-05-18 15:35:14 +0000
@@ -62,3 +62,4 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	2
+Master_Info_File	#

=== modified file 'mysql-test/suite/rpl/r/rpl_grant.result'
--- a/mysql-test/suite/rpl/r/rpl_grant.result	2009-10-01 16:44:53 +0000
+++ b/mysql-test/suite/rpl/r/rpl_grant.result	2010-05-18 15:35:14 +0000
@@ -82,3 +82,4 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#

=== modified file 'mysql-test/suite/rpl/r/rpl_heartbeat.result'
--- a/mysql-test/suite/rpl/r/rpl_heartbeat.result	2009-12-22 09:35:56 +0000
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat.result	2010-05-18 15:35:14 +0000
@@ -93,6 +93,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SHOW SLAVE STATUS;
 Slave_IO_State	#
 Master_Host	127.0.0.1
@@ -134,6 +135,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 show status like 'Slave_heartbeat_period';;
 Variable_name	Slave_heartbeat_period
 Value	0.500

=== modified file 'mysql-test/suite/rpl/r/rpl_incident.result'
--- a/mysql-test/suite/rpl/r/rpl_incident.result	2009-10-01 16:44:53 +0000
+++ b/mysql-test/suite/rpl/r/rpl_incident.result	2010-05-18 15:35:14 +0000
@@ -66,6 +66,7 @@ Last_SQL_Errno	1590
 Last_SQL_Error	The incident LOST_EVENTS occured on the master. Message: <none>
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 SELECT * FROM t1;
@@ -115,4 +116,5 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_known_bugs_detection.result'
--- a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result	2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result	2010-05-18 15:35:14 +0000
@@ -52,6 +52,7 @@ Last_SQL_Errno	1105
 Last_SQL_Error	Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT * FROM t1;
 a	b
 stop slave;
@@ -145,6 +146,7 @@ ON DUPLICATE KEY UPDATE
 t1.field_3 = t2.field_c'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT * FROM t1;
 id	field_1	field_2	field_3
 drop table t1, t2;

=== modified file 'mysql-test/suite/rpl/r/rpl_loaddata_fatal.result'
--- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result	2010-02-14 00:59:39 +0000
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result	2010-05-18 15:35:14 +0000
@@ -47,6 +47,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1;
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -89,6 +90,7 @@ Last_SQL_Errno	1593
 Last_SQL_Error	Fatal error: Not enough memory
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_log_pos.result'
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result	2010-01-07 15:39:11 +0000
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result	2010-05-18 15:35:14 +0000
@@ -51,6 +51,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 start slave;
 include/stop_slave.inc
 SHOW SLAVE STATUS;
@@ -94,6 +95,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
 master-bin.000001	#	<Binlog_Do_DB>	<Binlog_Ignore_DB>

=== modified file 'mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result'
--- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2010-05-18 15:35:14 +0000
@@ -61,6 +61,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SHOW BINLOG EVENTS;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4

=== modified file 'mysql-test/suite/rpl/r/rpl_replicate_do.result'
--- a/mysql-test/suite/rpl/r/rpl_replicate_do.result	2009-10-01 16:44:53 +0000
+++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result	2010-05-18 15:35:14 +0000
@@ -67,6 +67,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 create table t1 (ts timestamp);
 set one_shot time_zone='met';
 insert into t1 values('2005-08-12 00:00:00');

=== modified file 'mysql-test/suite/rpl/r/rpl_rotate_logs.result'
--- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result	2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result	2010-05-18 15:35:14 +0000
@@ -55,6 +55,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 select * from t1;
 s
 Could not break slave
@@ -136,6 +137,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 select * from t2;
 m
 34
@@ -205,6 +207,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 lock tables t3 read;
 select count(*) from t3 where n >= 4;
 count(*)

=== modified file 'mysql-test/suite/rpl/r/rpl_row_colSize.result'
--- a/mysql-test/suite/rpl/r/rpl_row_colSize.result	2010-01-07 15:39:11 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_colSize.result	2010-05-18 15:35:14 +0000
@@ -59,6 +59,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -115,6 +116,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'decimal(27,18)' to type 'decimal(27,9)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -171,6 +173,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -228,6 +231,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'double' to type 'float'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -285,6 +289,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'bit(64)' to type 'bit(5)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -341,6 +346,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'bit(12)' to type 'bit(11)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -398,6 +404,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'set' to type 'set('4')'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -455,6 +462,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'char(20)' to type 'char(10)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -543,6 +551,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'enum' to type 'enum('44','54')'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -600,6 +609,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(100)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -656,6 +666,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'varchar(200)' to type 'varchar(10)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -712,6 +723,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(1000)'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -769,6 +781,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'tinyblob' to type 'tinyblob'
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0

=== modified file 'mysql-test/suite/rpl/r/rpl_row_log.result'
--- a/mysql-test/suite/rpl/r/rpl_row_log.result	2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result	2010-05-18 15:35:14 +0000
@@ -288,6 +288,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_log_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result	2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result	2010-05-18 15:35:14 +0000
@@ -288,6 +288,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_max_relay_size.result'
--- a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result	2009-12-22 09:35:56 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result	2010-05-18 15:35:14 +0000
@@ -64,6 +64,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 #
 # Test 2
 #
@@ -114,6 +115,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 #
 # Test 3: max_relay_log_size = 0
 #
@@ -164,6 +166,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 #
 # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
 #
@@ -211,6 +214,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 #
 # Test 5
 #
@@ -259,6 +263,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 #
 # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
 #
@@ -305,6 +310,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 flush logs;
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB

=== modified file 'mysql-test/suite/rpl/r/rpl_row_reset_slave.result'
--- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result	2009-11-04 12:28:20 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result	2010-05-18 15:35:14 +0000
@@ -45,6 +45,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 stop slave;
 change master to master_user='test';
 SHOW SLAVE STATUS;
@@ -88,6 +89,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 reset slave;
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -130,6 +132,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 change master to master_user='root';
 start slave;
 SHOW SLAVE STATUS;
@@ -173,6 +176,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 stop slave;
 reset slave;
 start slave;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result'
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result	2010-01-07 15:39:11 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result	2010-05-18 15:35:14 +0000
@@ -159,6 +159,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	<Last_SQL_Error>
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 INSERT INTO t9 VALUES (4);
 INSERT INTO t4 VALUES (4);
 SHOW SLAVE STATUS;
@@ -202,6 +203,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	<Last_SQL_Error>
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (5);
@@ -247,6 +249,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	<Last_SQL_Error>
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (6);
@@ -292,6 +295,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	<Last_SQL_Error>
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (6);
@@ -336,6 +340,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	<Last_SQL_Error>
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 INSERT INTO t7 VALUES (1),(2),(3);
 INSERT INTO t8 VALUES (1),(2),(3);
 SELECT * FROM t7 ORDER BY a;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result	2010-01-07 15:39:11 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result	2010-05-18 15:35:14 +0000
@@ -159,6 +159,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	<Last_SQL_Error>
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 INSERT INTO t9 VALUES (4);
 INSERT INTO t4 VALUES (4);
 SHOW SLAVE STATUS;
@@ -202,6 +203,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	<Last_SQL_Error>
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (5);
@@ -247,6 +249,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	<Last_SQL_Error>
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (6);
@@ -292,6 +295,7 @@ Last_SQL_Errno	1677
 Last_SQL_Error	<Last_SQL_Error>
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
 START SLAVE;
 INSERT INTO t9 VALUES (6);
@@ -336,6 +340,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	<Last_SQL_Error>
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 INSERT INTO t7 VALUES (1),(2),(3);
 INSERT INTO t8 VALUES (1),(2),(3);
 SELECT * FROM t7 ORDER BY a;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_until.result'
--- a/mysql-test/suite/rpl/r/rpl_row_until.result	2009-10-01 16:44:53 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result	2010-05-18 15:35:14 +0000
@@ -61,6 +61,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
 SELECT * FROM t1;
 n
@@ -109,6 +110,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2
 SELECT * FROM t2;
 n
@@ -155,6 +157,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 START SLAVE;
 include/stop_slave.inc
 START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2
@@ -199,6 +202,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12;

=== added file 'mysql-test/suite/rpl/r/rpl_show_master_info_file.result'
--- a/mysql-test/suite/rpl/r/rpl_show_master_info_file.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_show_master_info_file.result	2010-05-16 18:40:56 +0000
@@ -0,0 +1,9 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SELECT "MYSQLTEST_VARDIR/mysqld.2/data/master.info" as Master_Info_File;
+Master_Info_File
+MYSQLTEST_VARDIR/mysqld.2/data/master.info

=== modified file 'mysql-test/suite/rpl/r/rpl_skip_error.result'
--- a/mysql-test/suite/rpl/r/rpl_skip_error.result	2009-10-01 16:44:53 +0000
+++ b/mysql-test/suite/rpl/r/rpl_skip_error.result	2010-05-18 15:35:14 +0000
@@ -72,6 +72,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 ==== Clean Up ====
 drop table t1;
 create table t1(a int primary key);
@@ -127,6 +128,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 ==== Clean Up ====
 drop table t1;
 ==== Using Innodb ====

=== modified file 'mysql-test/suite/rpl/r/rpl_slave_skip.result'
--- a/mysql-test/suite/rpl/r/rpl_slave_skip.result	2010-01-15 17:52:46 +0000
+++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result	2010-05-18 15:35:14 +0000
@@ -84,6 +84,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 SELECT * FROM t1;
@@ -152,6 +153,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 **** On Master ****
 DROP TABLE t1, t2;
 SET SESSION BINLOG_FORMAT=ROW;

=== modified file 'mysql-test/suite/rpl/r/rpl_ssl.result'
--- a/mysql-test/suite/rpl/r/rpl_ssl.result	2009-10-01 16:44:53 +0000
+++ b/mysql-test/suite/rpl/r/rpl_ssl.result	2010-05-18 15:35:14 +0000
@@ -60,6 +60,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 STOP SLAVE;
 select * from t1;
 t
@@ -106,6 +107,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 drop user replssl@localhost;
 drop table t1;
 End of 5.0 tests

=== modified file 'mysql-test/suite/rpl/r/rpl_ssl1.result'
--- a/mysql-test/suite/rpl/r/rpl_ssl1.result	2009-10-01 16:44:53 +0000
+++ b/mysql-test/suite/rpl/r/rpl_ssl1.result	2010-05-18 15:35:14 +0000
@@ -59,6 +59,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 stop slave;
 change master to master_user='root',master_password='', master_ssl=0;
 start slave;
@@ -105,6 +106,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 stop slave;
 change master to
 master_host="localhost",
@@ -161,4 +163,5 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 drop table t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_log.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result	2010-02-14 00:59:39 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result	2010-05-18 15:35:14 +0000
@@ -286,6 +286,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result	2009-12-22 09:35:56 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result	2010-05-18 15:35:14 +0000
@@ -64,6 +64,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 #
 # Test 2
 #
@@ -114,6 +115,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 #
 # Test 3: max_relay_log_size = 0
 #
@@ -164,6 +166,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 #
 # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
 #
@@ -211,6 +214,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 #
 # Test 5
 #
@@ -259,6 +263,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 #
 # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
 #
@@ -305,6 +310,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 flush logs;
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_reset_slave.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result	2009-11-04 12:28:20 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result	2010-05-18 15:35:14 +0000
@@ -45,6 +45,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 stop slave;
 change master to master_user='test';
 SHOW SLAVE STATUS;
@@ -88,6 +89,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 reset slave;
 SHOW SLAVE STATUS;
 Slave_IO_State	#
@@ -130,6 +132,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 change master to master_user='root';
 start slave;
 SHOW SLAVE STATUS;
@@ -173,6 +176,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 stop slave;
 reset slave;
 start slave;

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_until.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_until.result	2010-02-14 00:59:39 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_until.result	2010-05-18 15:35:14 +0000
@@ -65,6 +65,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
 select * from t1;
 n
@@ -113,6 +114,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=891;
 select * from t2;
 n
@@ -159,6 +161,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 start slave;
 [on master]
 [on slave]
@@ -205,6 +208,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 ==== Test various error conditions ====
 start slave until master_log_file='master-bin', master_log_pos=561;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL

=== modified file 'mysql-test/suite/rpl/r/rpl_temporary_errors.result'
--- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result	2009-10-18 03:57:38 +0000
+++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result	2010-05-18 15:35:14 +0000
@@ -80,6 +80,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 DROP TABLE t1;
 **** On Master ****
 DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl/t/disabled.def'
--- a/mysql-test/suite/rpl/t/disabled.def	2010-03-25 07:26:12 +0000
+++ b/mysql-test/suite/rpl/t/disabled.def	2010-05-16 20:50:41 +0000
@@ -10,6 +10,5 @@
 #
 ##############################################################################
 
-rpl_row_create_table            : Bug#45576 2009-12-01 joro rpl_row_create_table fails on PB2
 rpl_row_create_table : Bug#51574 Feb 27 2010 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

=== modified file 'mysql-test/suite/rpl/t/rpl_bug33931.test'
--- a/mysql-test/suite/rpl/t/rpl_bug33931.test	2009-11-27 23:34:47 +0000
+++ b/mysql-test/suite/rpl/t/rpl_bug33931.test	2010-05-18 15:35:14 +0000
@@ -40,7 +40,7 @@ connection slave;
 source include/wait_for_slave_to_stop.inc;
 
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 19 # 23 # 33 # 37 #
+--replace_column 1 # 8 # 9 # 19 # 23 # 33 # 37 # 41 #
 query_vertical show slave status;
 
 #

=== modified file 'mysql-test/suite/rpl/t/rpl_flushlog_loop.test'
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test	2009-11-27 23:34:47 +0000
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test	2010-05-18 15:35:14 +0000
@@ -71,7 +71,7 @@ source include/wait_for_slave_param.inc;
 #  Show status of slave
 #
 --replace_result $SLAVE_MYPORT SLAVE_PORT $slave_param_value POSITION
---replace_column 1 # 8 # 9 # 16 # 23 # 33 # 34 # 35 #
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 # 34 # 35 # 41 #
 --query_vertical SHOW SLAVE STATUS
 
 --disable_query_log

=== modified file 'mysql-test/suite/rpl/t/rpl_incident.test'
--- a/mysql-test/suite/rpl/t/rpl_incident.test	2009-05-02 19:28:54 +0000
+++ b/mysql-test/suite/rpl/t/rpl_incident.test	2010-05-18 15:35:14 +0000
@@ -24,7 +24,7 @@ source include/wait_for_slave_sql_error.
 SELECT * FROM t1;
 
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 # 41 #
 --query_vertical SHOW SLAVE STATUS
 
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
@@ -36,7 +36,7 @@ START SLAVE;
 
 SELECT * FROM t1;
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 # 41 #
 --query_vertical SHOW SLAVE STATUS
 
 connection master;

=== modified file 'mysql-test/suite/rpl/t/rpl_known_bugs_detection.test'
--- a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test	2009-11-27 23:34:47 +0000
+++ b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test	2010-05-18 15:35:14 +0000
@@ -27,7 +27,7 @@ SELECT * FROM t1;
 connection slave;
 --source include/wait_for_slave_sql_to_stop.inc
 # show the error message
---replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 # 41 #
 --query_vertical show slave status;
 # show that it was not replicated
 SELECT * FROM t1;
@@ -83,7 +83,7 @@ SELECT * FROM t1;
 connection slave;
 --source include/wait_for_slave_sql_to_stop.inc
 # show the error message
---replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 # 41 #
 --query_vertical show slave status;
 # show that it was not replicated
 SELECT * FROM t1;

=== modified file 'mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test'
--- a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test	2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test	2010-05-18 15:35:14 +0000
@@ -17,7 +17,7 @@ SHOW BINLOG EVENTS;
 sync_slave_with_master;
 --echo **** On Slave ****
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 34 # 35 #
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 34 # 35 # 41 #
 --query_vertical SHOW SLAVE STATUS
 --replace_result $VERSION VERSION
 --replace_column 2 # 5 #

=== modified file 'mysql-test/suite/rpl/t/rpl_replicate_do.test'
--- a/mysql-test/suite/rpl/t/rpl_replicate_do.test	2009-11-27 23:34:47 +0000
+++ b/mysql-test/suite/rpl/t/rpl_replicate_do.test	2010-05-18 15:35:14 +0000
@@ -28,7 +28,7 @@ drop table if exists t1,t2,t11;
 sync_slave_with_master;
 # show slave status, just to see of it prints replicate-do-table
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 query_vertical SHOW SLAVE STATUS;
 
 #

=== modified file 'mysql-test/suite/rpl/t/rpl_row_until.test'
--- a/mysql-test/suite/rpl/t/rpl_row_until.test	2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test	2010-05-18 15:35:14 +0000
@@ -57,7 +57,7 @@ eval START SLAVE UNTIL MASTER_LOG_FILE='
 # Here table should be still not deleted
 SELECT * FROM t1;
 --replace_result $master_pos_drop_t1 MASTER_POS_DROP_T1
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 # 41 #
 query_vertical SHOW SLAVE STATUS;
 
 # This should fail right after start
@@ -66,7 +66,7 @@ START SLAVE UNTIL MASTER_LOG_FILE='maste
 # again this table should be still not deleted
 SELECT * FROM t1;
 --replace_result $master_pos_drop_t1 MASTER_POS_DROP_T1
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 # 41 #
 query_vertical SHOW SLAVE STATUS;
 
 # Try replicate all up to and not including the second insert to t2;
@@ -77,7 +77,7 @@ eval START SLAVE UNTIL RELAY_LOG_FILE='s
 --source include/wait_for_slave_sql_to_stop.inc
 SELECT * FROM t2;
 --replace_result $relay_pos_insert1_t2 RELAY_POS_INSERT1_T2 $master_pos_insert1_t2 MASTER_POS_INSERT1_T2
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 # 41 #
 query_vertical SHOW SLAVE STATUS;
 
 # clean up
@@ -99,7 +99,7 @@ let $slave_param_value= $master_pos_crea
 # here the sql slave thread should be stopped
 --replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
 --replace_result $master_pos_create_t2 MASTER_POS_CREATE_T2 $master_pos_drop_t2 MASTER_POS_DROP_T2
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 # 41 #
 query_vertical SHOW SLAVE STATUS;
 
 #testing various error conditions

=== added file 'mysql-test/suite/rpl/t/rpl_show_master_info_file-master.opt'
--- a/mysql-test/suite/rpl/t/rpl_show_master_info_file-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_show_master_info_file-master.opt	2010-05-16 18:40:56 +0000
@@ -0,0 +1 @@
+--master-info-file=$MYSQLTEST_VARDIR/master.info

=== added file 'mysql-test/suite/rpl/t/rpl_show_master_info_file.test'
--- a/mysql-test/suite/rpl/t/rpl_show_master_info_file.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_show_master_info_file.test	2010-05-16 18:40:56 +0000
@@ -0,0 +1,18 @@
+#
+# Bug #50316  	Add Master_info_file to SHOW SLAVE STATUS
+# Testing of matching --master-info-file value to the value of the 
+# new added SSS' field
+#
+
+source include/master-slave.inc;
+source include/have_binlog_format_mixed.inc;
+
+# test reveals different path separator on windows.
+# Leaving out windows because there is nothing more platform specific.
+source include/not_windows.inc;
+
+connection slave;
+
+--let $master_info_file= query_get_value(SHOW SLAVE STATUS, Master_Info_File, 1)
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT "$master_info_file" as Master_Info_File

=== modified file 'mysql-test/suite/rpl/t/rpl_slave_skip.test'
--- a/mysql-test/suite/rpl/t/rpl_slave_skip.test	2010-03-24 15:03:44 +0000
+++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test	2010-05-18 15:35:14 +0000
@@ -36,7 +36,7 @@ connection slave;
 START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762;
 --source include/wait_for_slave_sql_to_stop.inc
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 # 41 #
 query_vertical SHOW SLAVE STATUS;
 
 # Now we skip *one* table map event. If the execution starts right
@@ -74,7 +74,7 @@ START SLAVE;
 --source include/wait_for_slave_to_start.inc
 sync_with_master;
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 # 41 #
 query_vertical SHOW SLAVE STATUS;
 
 --echo **** On Master ****

=== modified file 'mysql-test/suite/rpl/t/rpl_ssl.test'
--- a/mysql-test/suite/rpl/t/rpl_ssl.test	2010-04-13 15:04:45 +0000
+++ b/mysql-test/suite/rpl/t/rpl_ssl.test	2010-05-18 15:35:14 +0000
@@ -31,7 +31,7 @@ select * from t1;
 # The slave is synced and waiting/reading from master
 # SHOW SLAVE STATUS will show "Waiting for master to send event"
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 query_vertical show slave status;
 
 # Stop the slave, as reported in bug#21871 it would hang
@@ -71,7 +71,7 @@ let $master_count= `select count(*) from
 sync_slave_with_master;
 --source include/wait_for_slave_to_start.inc
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 query_vertical show slave status;
 
 let $slave_count= `select count(*) from t1`;

=== modified file 'mysql-test/suite/rpl/t/rpl_ssl1.test'
--- a/mysql-test/suite/rpl/t/rpl_ssl1.test	2010-04-13 15:04:45 +0000
+++ b/mysql-test/suite/rpl/t/rpl_ssl1.test	2010-05-18 15:35:14 +0000
@@ -45,7 +45,7 @@ select * from t1;
 
 #checking show slave status
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 # 41 #
 query_vertical show slave status;
 
 #checking if replication works without ssl also performing clean up
@@ -59,7 +59,7 @@ drop user replssl@localhost;
 drop table t1;
 sync_slave_with_master;
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 # 41 #
 query_vertical show slave status;
 
 # End of 4.1 tests
@@ -91,7 +91,7 @@ select * from t1;
 
 #checking show slave status
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 # 41 #
 query_vertical show slave status;
 
 connection master;

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result	2009-10-01 16:44:53 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result	2010-05-18 15:35:14 +0000
@@ -181,6 +181,7 @@ Last_SQL_Errno	<Last_SQL_Errno>
 Last_SQL_Error	<Last_SQL_Error>
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 set GLOBAL slave_transaction_retries=10;
 include/start_slave.inc
 select * from t1 order by nid;

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result	2009-10-01 16:44:53 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result	2010-05-18 15:35:14 +0000
@@ -58,6 +58,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 SELECT * FROM t1 ORDER BY a;
 a	b
 1	2
@@ -103,5 +104,6 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	2
+Master_Info_File	#
 STOP SLAVE;
 DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result	2010-01-07 15:39:11 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result	2010-05-18 15:35:14 +0000
@@ -55,6 +55,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	2
+Master_Info_File	#
 SELECT * FROM t1 ORDER BY a;
 a	b
 1	2
@@ -106,4 +107,5 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result	2009-10-01 16:44:53 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result	2010-05-18 15:35:14 +0000
@@ -32,16 +32,55 @@ SELECT * FROM t1 ORDER BY c3;
 c1	c2	c3
 row3	C	3
 row4	D	4
-SHOW SLAVE STATUS;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	Yes	Yes				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>	No	<Last_IO_Errno>	<Last_IO_Error>	0			1
+SHOW SLAVE STATUS;;
+Slave_IO_State	<Slave_IO_State>
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	<Read_Master_Log_Pos>
+Relay_Log_File	<Relay_Log_File>
+Relay_Log_Pos	<Relay_Log_Pos>
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	<Replicate_Ignore_Table>
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	<Exec_Master_Log_Pos>
+Relay_Log_Space	<Relay_Log_Space>
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	<Seconds_Behind_Master>
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	<Last_IO_Errno>
+Last_IO_Error	<Last_IO_Error>
+Last_SQL_Errno	0
+Last_SQL_Error	
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 STOP SLAVE;
 CHANGE MASTER TO
 master_log_file = 'master-bin.000001',
 master_log_pos = <the_pos> ;
 SHOW SLAVE STATUS;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	No	No				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>	No	<Last_IO_Errno>	<Last_IO_Error>	0			1
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id	Master_Info_File
+<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	No	No				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>	No	<Last_IO_Errno>	<Last_IO_Error>	0			1	<Master-Info-File>
 START SLAVE;
 SELECT * FROM t1 ORDER BY c3;
 c1	c2	c3
@@ -67,7 +106,46 @@ COMMIT;
 SELECT * FROM t1;
 c1	c2	c3
 row2	new on slave	2
-SHOW SLAVE STATUS;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	Yes	Yes				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>	<Last_IO_Errno>	<Last_IO_Error>		0			1
+SHOW SLAVE STATUS;;
+Slave_IO_State	<Slave_IO_State>
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	<Read_Master_Log_Pos>
+Relay_Log_File	<Relay_Log_File>
+Relay_Log_Pos	<Relay_Log_Pos>
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	<Replicate_Ignore_Table>
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	<Exec_Master_Log_Pos>
+Relay_Log_Space	<Relay_Log_Space>
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	<Seconds_Behind_Master>
+Master_SSL_Verify_Server_Cert	<Last_IO_Errno>
+Last_IO_Errno	<Last_IO_Error>
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 DROP TABLE IF EXISTS t1;

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result	2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result	2010-05-18 15:35:14 +0000
@@ -304,6 +304,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	#
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result	2009-10-01 16:44:53 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result	2010-05-18 15:35:14 +0000
@@ -109,6 +109,7 @@ Last_SQL_Errno	0
 Last_SQL_Error	
 Replicate_Ignore_Server_Ids	
 Master_Server_Id	1
+Master_Info_File	<Master-Info-File>
 SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
 hex(c1)	hex(c2)	c3
 1	1	row1

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test	2009-07-14 19:31:19 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test	2010-05-18 15:35:14 +0000
@@ -196,7 +196,7 @@ source include/wait_for_slave_sql_to_sto
 # Replication should have stopped, since max retries were not enough.
 # verify with show slave status
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 19 <Last_Errno> 20 <Last_Error> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error> 37 <Last_SQL_Errno> 38 <Last_SQL_Error>
+--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 19 <Last_Errno> 20 <Last_Error> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error> 37 <Last_SQL_Errno> 38 <Last_SQL_Error> 41 <Master-Info-File>
 --query_vertical SHOW SLAVE STATUS;
 
 # now set max retries high enough to succeed, and start slave again

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test	2009-11-10 18:45:15 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test	2010-05-18 15:35:14 +0000
@@ -43,14 +43,14 @@ INSERT INTO t1 VALUES (2,3);
 SELECT * FROM t1 ORDER BY a;
 #SELECT * FROM t2 ORDER BY a;
 # BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 --query_vertical show slave status;
 # connect to master and ensure data it there.
 --connection master
 SELECT * FROM t1 ORDER BY a;
 #SELECT * FROM t2 ORDER BY a;
 # BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 --query_vertical show slave status;
 
 # stop replication on "master" as not to replicate

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test	2009-11-10 18:45:15 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test	2010-05-18 15:35:14 +0000
@@ -52,7 +52,7 @@ sync_with_master;
 
 # Check that there is no error in replication
 --replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 query_vertical SHOW SLAVE STATUS;
 
 # Check that we have the data on the master
@@ -79,7 +79,7 @@ SELECT * FROM t1 ORDER BY a;
 
 # Check that there is no error in replication
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # 41 #
 query_vertical SHOW SLAVE STATUS;
 
 connection master;

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test	2007-07-25 13:40:43 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test	2010-05-18 15:35:14 +0000
@@ -43,8 +43,8 @@ SELECT * FROM t1 ORDER BY c3;
 SELECT * FROM t1 ORDER BY c3;
 
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error>
-SHOW SLAVE STATUS;
+--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error> 41 <Master-Info-File>
+--query_vertical SHOW SLAVE STATUS;
 
 # stop slave and reset position to before the last changes
 STOP SLAVE;
@@ -54,7 +54,7 @@ eval CHANGE MASTER TO
   master_log_pos = $the_pos ;
 
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error>
+--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error> 41 <Master-Info-File>
 SHOW SLAVE STATUS;
 
 # start the slave again
@@ -107,8 +107,8 @@ COMMIT;
 --connection slave
 SELECT * FROM t1;
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 34 <Last_IO_Errno> 35 <Last_IO_Error>
-SHOW SLAVE STATUS;
+--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 34 <Last_IO_Errno> 35 <Last_IO_Error> 41 <Master-Info-File>
+--query_vertical SHOW SLAVE STATUS;
 
 connection master;
 DROP TABLE IF EXISTS t1;

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test	2007-12-12 17:19:24 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test	2010-05-18 15:35:14 +0000
@@ -72,7 +72,7 @@ START SLAVE;
 --sync_slave_with_master
 --connection slave
 --replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error>
+--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error> 41 <Master-Info-File>
 query_vertical SHOW SLAVE STATUS;
 
 SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;

=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test	2010-02-06 10:28:06 +0000
+++ b/mysql-test/t/information_schema.test	2010-05-20 08:54:19 +0000
@@ -1419,6 +1419,24 @@ DROP DATABASE db1;
 
 --echo End of 5.1 tests.
 
+#
+# WL#2003 INFORMATION_SCHEMA: PARAMETERS view
+# WL#2822 INFORMATION_SCHEMA.ROUTINES: Add missing columns
+#
+create function f1 (p1 int, p2 datetime, p3 decimal(10,2))
+returns char(10) return null;
+create procedure p1 (p1 float(8,5), p2 char(32), p3 varchar(10)) begin end;
+create procedure p2 (p1 enum('c', 's'), p2 blob, p3 text) begin end;
+select * from information_schema.parameters where specific_schema='test';
+select data_type, character_maximum_length,
+       character_octet_length, numeric_precision,
+       numeric_scale, character_set_name,
+       collation_name, dtd_identifier
+from information_schema.routines where routine_schema='test';
+drop procedure p1;
+drop procedure p2;
+drop function f1;
+
 --echo #
 --echo # Additional test for WL#3726 "DDL locking for all metadata objects"
 --echo # To avoid possible deadlocks process of filling of I_S tables should
@@ -1514,8 +1532,17 @@ DROP TABLE t1, information_schema.tables
 LOCK TABLES t1 READ, information_schema.tables READ;
 DROP TABLE t1;
 
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
+#
+# Bug#38916 Select from I_S.ROUTINES results in "No database selected" error
+#
+create function f1() returns int return 1;
+--connect (con7,localhost,root,,*NO-ONE*)
+select routine_name, routine_type from information_schema.routines
+where routine_schema = 'test';
+connection default;
+drop function f1;
+disconnect con7;
+
 
 #
 # Bug #43834    Assertion in Natural_join_column::db_name() on an I_S query
@@ -1529,3 +1556,5 @@ WHERE COLUMNS.TABLE_SCHEMA = 'test'
 AND COLUMNS.TABLE_NAME = 't1';
 
 
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc

=== modified file 'mysql-test/t/mysql_client_test.test'
--- a/mysql-test/t/mysql_client_test.test	2008-11-13 19:19:00 +0000
+++ b/mysql-test/t/mysql_client_test.test	2010-05-19 12:33:51 +0000
@@ -16,4 +16,11 @@ SET @old_general_log= @@global.general_l
 # End of 4.1 tests
 echo ok;
 
+--echo
+--echo # cat MYSQL_TMP_DIR/test_wl4435.out.log
+--echo # ------------------------------------
+--cat_file $MYSQL_TMP_DIR/test_wl4435.out.log
+--echo # ------------------------------------
+--echo
+
 SET @@global.general_log= @old_general_log;

=== modified file 'mysql-test/t/parser_stack.test'
--- a/mysql-test/t/parser_stack.test	2008-07-14 21:41:30 +0000
+++ b/mysql-test/t/parser_stack.test	2010-05-14 18:11:25 +0000
@@ -399,4 +399,12 @@ delimiter ;$$
 
 drop procedure p_37228;
 
+#
+# Bug#27863 (excessive memory usage for many small queries in a multiquery
+# packet).
+#
 
+let $i=`select repeat("set @a=1;", 65535)`;
+--disable_query_log
+eval $i;
+--enable_query_log

=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test	2010-02-02 09:22:17 +0000
+++ b/mysql-test/t/partition.test	2010-05-19 12:31:18 +0000
@@ -2118,4 +2118,49 @@ SET SESSION SQL_MODE=DEFAULT;
 #SELECT  1 FROM t1 JOIN t1 AS t2 USING (a) FOR UPDATE;
 #
 #DROP TABLE t1;
+
+--echo #
+--echo # Bug#46198: Hang after failed ALTER TABLE on partitioned table.
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# Case 1.
+#
+
+CREATE TABLE t1 (s1 INT PRIMARY KEY) PARTITION BY HASH(s1);
+
+LOCK TABLES t1 WRITE, t1 b READ;
+
+UNLOCK TABLES;
+
+--error ER_ONLY_ON_RANGE_LIST_PARTITION
+ALTER TABLE t1 DROP PARTITION p1;
+
+# The SELECT below used to hang in tdc_wait_for_old_versions().
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+#
+# Case 2.
+#
+
+CREATE TABLE t1 (s1 VARCHAR(5) PRIMARY KEY) PARTITION BY KEY(s1);
+
+LOCK TABLES t1 WRITE, t1 b READ;
+
+UNLOCK TABLES;
+
+--error ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
+ALTER TABLE t1 ADD COLUMN (s3 VARCHAR(5) UNIQUE);
+
+# The SELECT below used to hang in tdc_wait_for_old_versions().
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
 --echo End of 5.1 tests

=== modified file 'mysql-test/t/trigger.test'
--- a/mysql-test/t/trigger.test	2010-03-24 15:03:44 +0000
+++ b/mysql-test/t/trigger.test	2010-05-19 13:22:43 +0000
@@ -2543,4 +2543,52 @@ select trigger_name from information_sch
 drop temporary table t1;
 drop table t1;
 
+--echo #
+--echo # Bug#34432 Wrong lock type passed to the engine if pre-locking + 
+--echo #           multi-update in a trigger
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3;
+DROP TRIGGER IF EXISTS t2_ai;
+--enable_warnings
+CREATE TABLE t2 
+       (
+         value CHAR(30),
+         domain_id INT,
+         mailaccount_id INT, 
+         program CHAR(30),
+         keey CHAR(30),
+         PRIMARY KEY(domain_id)
+       );
+CREATE TABLE t3 
+       (
+         value CHAR(30),
+         domain_id INT,
+         mailaccount_id INT,
+         program CHAR(30),
+         keey CHAR(30),
+         PRIMARY KEY(domain_id)
+       );
+CREATE TABLE t1 (id INT,domain CHAR(30),PRIMARY KEY(id));
+
+delimiter |;
+CREATE TRIGGER t2_ai AFTER INSERT ON t2 FOR EACH ROW 
+  UPDATE t3 ms, t1 d SET ms.value='No'
+  WHERE ms.domain_id = 
+    (SELECT max(id) FROM t1 WHERE domain='example.com') 
+  AND ms.mailaccount_id IS NULL 
+  AND ms.program='spamfilter' 
+  AND ms.keey='scan_incoming';
+|
+delimiter ;|
+
+INSERT INTO t1 VALUES (1, 'example.com'),
+                      (2, 'mysql.com'),
+                      (3, 'earthmotherwear.com'),
+                      (4, 'yahoo.com'),
+                      (5, 'example.com');
+INSERT INTO t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
+DROP TRIGGER t2_ai;
+DROP TABLE t1, t2, t3;
+
 --echo End of 6.0 tests.

=== modified file 'mysql-test/t/variables_debug.test'
--- a/mysql-test/t/variables_debug.test	2008-02-26 15:03:59 +0000
+++ b/mysql-test/t/variables_debug.test	2010-05-19 12:31:18 +0000
@@ -10,3 +10,13 @@ set debug= '+P';
 select @@debug;
 set debug= '-P';
 select @@debug;
+
+#
+# Bug#38054: "SET SESSION debug" modifies @@global.debug variable
+#
+
+SELECT @@session.debug, @@global.debug;
+
+SET SESSION debug = '';
+
+SELECT @@session.debug, @@global.debug;

=== modified file 'mysys/CMakeLists.txt'
--- a/mysys/CMakeLists.txt	2010-02-22 19:55:27 +0000
+++ b/mysys/CMakeLists.txt	2010-05-19 13:50:12 +0000
@@ -36,7 +36,7 @@ SET(MYSYS_SOURCES  array.c charset-def.c
 				thr_rwlock.c tree.c typelib.c my_vle.c base64.c my_memmem.c my_getpagesize.c
 				lf_alloc-pin.c lf_dynarray.c lf_hash.c
 				my_atomic.c my_getncpus.c
-				my_rdtsc.c)
+				my_rdtsc.c waiting_threads.c)
 
 IF (WIN32)
  SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_winthread.c my_wincond.c my_winerr.c my_winfile.c my_windac.c my_conio.c)

=== modified file 'mysys/Makefile.am'
--- a/mysys/Makefile.am	2009-11-24 23:36:31 +0000
+++ b/mysys/Makefile.am	2010-05-19 13:50:12 +0000
@@ -61,7 +61,7 @@ if NEED_THREAD
 # mf_keycache is used only in the server, so it is safe to leave the file
 # out of the non-threaded library.
 # In fact, it will currently not compile without thread support.
-libmysys_a_SOURCES +=   mf_keycache.c
+libmysys_a_SOURCES +=   mf_keycache.c waiting_threads.c
 endif
 
 EXTRA_DIST =		thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
@@ -159,6 +159,3 @@ probes_mysql.d:
 probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
 	$(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
 endif
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== added file 'mysys/waiting_threads.c'
--- a/mysys/waiting_threads.c	1970-01-01 00:00:00 +0000
+++ b/mysys/waiting_threads.c	2010-05-19 13:50:12 +0000
@@ -0,0 +1,1256 @@
+/* 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
+
+/**
+  @file
+
+  "waiting threads" subsystem - a unified interface for threads to wait
+  on each other, with built-in deadlock detection.
+
+  Main concepts
+  ^^^^^^^^^^^^^
+  a thread - is represented by a WT_THD structure. One physical thread
+    can have only one WT_THD descriptor at any given moment.
+
+  a resource - a thread does not wait for other threads directly,
+    instead it waits for a "resource", which is "owned" by other threads.
+    It waits, exactly, for all "owners" to "release" a resource.
+    It does not have to correspond to a physical resource. For example, it
+    may be convenient in certain cases to force resource == thread.
+    A resource is represented by a WT_RESOURCE structure. 
+
+  a resource identifier - a pair of {resource type, value}. A value is
+    an ulonglong number. Represented by a WT_RESOURCE_ID structure.
+
+  a resource type - a pointer to a statically defined instance of
+    WT_RESOURCE_TYPE structure. This structure contains a pointer to
+    a function that knows how to compare values of this resource type.
+    In the simple case it could be wt_resource_id_memcmp().
+
+  a wait-for graph - a graph, that represenst "wait-for" relationships.
+    It has two types of nodes - threads and resources. There are directed
+    edges from a thread to a resource it is waiting for (WT_THD::waiting_for),
+    from a thread to resources that it "owns" (WT_THD::my_resources),
+    and from a resource to threads that "own" it (WT_RESOURCE::owners)
+
+  Graph completeness
+  ^^^^^^^^^^^^^^^^^^
+
+  For flawless deadlock detection wait-for graph must be complete.
+  It means that when a thread starts waiting it needs to know *all* its
+  blockers, and call wt_thd_will_wait_for() for every one of them.
+  Otherwise two phenomena should be expected:
+
+  1. Fuzzy timeouts:
+
+    thread A needs to get a lock, and is blocked by a thread B.
+    it waits.
+    Just before the timeout thread B releases the lock.
+    thread A is ready to grab the lock but discovers that it is also
+    blocked by a thread C.
+    It waits and times out.
+
+    As a result thread A has waited two timeout intervals, instead of one.
+
+  2. Unreliable cycle detection:
+
+     Thread A waits for threads B and C
+     Thread C waits for D
+     Thread D wants to start waiting for A
+
+     one can see immediately that thread D creates a cycle, and thus
+     a deadlock is detected.
+
+     But if thread A would only wait for B, and start waiting for C
+     when B would unlock, thread D would be allowed to wait, a deadlock
+     would be only detected when B unlocks or somebody times out.
+
+  These two phenomena don't affect a correctness, and strictly speaking,
+  the caller is not required to call wt_thd_will_wait_for() for *all*
+  blockers - it may optimize wt_thd_will_wait_for() calls. But they
+  may be perceived as bugs by users, it must be understood that such
+  an optimization comes with its price.
+
+  Usage
+  ^^^^^
+
+  First, the wt* subsystem must be initialized by calling
+  wt_init(). In the server you don't need to do it, it's done
+  in mysqld.cc.
+
+  Similarly, wt_end() frees wt* structures, should be called
+  at the end, but in the server mysqld.cc takes care of that.
+
+  Every WT_THD should be initialized with wt_thd_lazy_init().
+  After that they can be used in other wt_thd_* calls.
+  Before discarding, WT_THD should be free'd with
+  wt_thd_destroy(). In the server both are handled in sql_class.cc,
+  it's an error to try to do it manually.
+
+  To use the deadlock detection one needs to use this thread's WT_THD,
+  call wt_thd_will_wait_for() for every thread it needs to wait on,
+  then call wt_thd_cond_timedwait(). When thread releases a resource
+  it should call wt_thd_release() (or wt_thd_release_all()) - it will
+  notify (send a signal) threads waiting in wt_thd_cond_timedwait(),
+  if appropriate.
+
+  Just like with pthread's cond_wait, there could be spurious
+  wake-ups from wt_thd_cond_timedwait(). A caller is expected to
+  handle that (that is, to re-check the blocking criteria).
+
+  wt_thd_will_wait_for() and wt_thd_cond_timedwait() return either
+  WT_OK or WT_DEADLOCK. Additionally wt_thd_cond_timedwait() can return
+  WT_TIMEOUT. Out of memory and other fatal errors are reported as
+  WT_DEADLOCK - and a transaction must be aborted just the same.
+
+  Configuration
+  ^^^^^^^^^^^^^
+  There are four config variables. Two deadlock search depths - short and
+  long - and two timeouts. Deadlock search is performed with the short
+  depth on every wt_thd_will_wait_for() call. wt_thd_cond_timedwait()
+  waits with a short timeout, performs a deadlock search with the long
+  depth, and waits with a long timeout. As most deadlock cycles are supposed
+  to be short, most deadlocks will be detected at once, and waits will
+  rarely be necessary.
+
+  These config variables are thread-local. Different threads may have
+  different search depth and timeout values.
+
+  Also, deadlock detector supports different killing strategies, the victim
+  in a deadlock cycle is selected based on the "weight". See "weight"
+  description in waiting_threads.h for details. It's up to the caller to
+  set weights accordingly.
+
+  Status
+  ^^^^^^
+  We calculate the number of successfull waits (WT_OK returned from
+  wt_thd_cond_timedwait()), a number of timeouts, a deadlock cycle
+  length distribution - number of deadlocks with every length from
+  1 to WT_CYCLE_STATS, and a wait time distribution - number
+  of waits with a time from 1 us to 1 min in WT_WAIT_STATS
+  intervals on a log e scale.
+
+  Sample usage as was done in the Maria engine
+  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+  - in class THD, THD::transaction had a WT_THD object; there were session
+  variables to set the short/long depth/timeout.
+  - when mysqld started, wt_init() was called; when it ended, wt_end() was
+  called.
+  - in THD's constructor,
+  wt_thd_lazy_init(&transaction.wt, &variables.wt_deadlock_search_depth_short,
+    &variables.wt_timeout_short,
+    &variables.wt_deadlock_search_depth_long,
+    &variables.wt_timeout_long);
+  - in THD::cleanup():
+  wt_thd_destroy(&transaction.wt);
+  - this was sufficient to make the deadlock-detector available to the Maria
+  engine (which can grab THD); the engine used it this way:
+  - when it wrote a row, and hit a duplicate key, it would find who wrote this
+  key, the "blocker" transaction. If "blocker" had committed, duplicate key
+  error would be sent. Otherwise, we would wait for it, in the following code
+  snippet (originally from storage/maria/ma_write.c). After the blocker is
+  gone, we would retry the write:
+
+        while (keyinfo->ck_insert(info,
+                 (*keyinfo->make_key)(info, &int_key, i, buff, record,
+                                      filepos, info->trn->trid)))
+        {
+          / * we got a write error * /
+          if error is not "duplicate key" then return error;
+          info->dup_key_trid has the culprit:
+          if the culprit is ourselves then return error;
+          otherwise:
+          blocker= trnman_trid_to_trn(info->trn, info->dup_key_trid);
+          / *
+            if blocker TRN was not found, it means that the conflicting
+            transaction was committed long time ago. It could not be
+            aborted, as it would have to wait on the key tree lock
+            to remove the conflicting key it has inserted.
+          * /
+          if (!blocker || blocker->commit_trid != ~(TrID)0)
+          { / * committed * /
+            if (blocker)
+              pthread_mutex_unlock(& blocker->state_lock);
+            rw_unlock(&keyinfo->root_lock);
+            goto err;
+          }
+          / * release root_lock to let blocker finish its work * /
+          rw_unlock(&keyinfo->root_lock);
+          {
+            / * running. now we wait * /
+            WT_RESOURCE_ID rc;
+            int res;
+            const char *old_proc_info;
+
+            rc.type= &ma_rc_dup_unique;
+            rc.value= (intptr)blocker;
+            res= wt_thd_will_wait_for(info->trn->wt, blocker->wt, & rc);
+            if (res != WT_OK)
+            {
+              pthread_mutex_unlock(& blocker->state_lock);
+              my_errno= HA_ERR_LOCK_DEADLOCK;
+              goto err;
+            }
+            old_proc_info= proc_info_hook(0,
+                                          "waiting for a resource",
+                                          __func__, __FILE__, __LINE__);
+            res= wt_thd_cond_timedwait(info->trn->wt, & blocker->state_lock);
+            proc_info_hook(0, old_proc_info, __func__, __FILE__, __LINE__);
+
+            pthread_mutex_unlock(& blocker->state_lock);
+            if (res != WT_OK)
+            {
+              my_errno= res == WT_TIMEOUT ? HA_ERR_LOCK_WAIT_TIMEOUT
+                                          : HA_ERR_LOCK_DEADLOCK;
+              goto err;
+            }
+            / * if we come here, blocker has rolled back or committed,
+            so is gone, we can retry the ck_insert() * /
+          }
+          rw_wrlock(&keyinfo->root_lock);
+#ifndef MARIA_CANNOT_ROLLBACK
+          keyinfo->version++;
+#endif
+        }
+  - ma_rc_dup_unique was:
+  / * a WT_RESOURCE_TYPE for transactions waiting on a unique key conflict * /
+  WT_RESOURCE_TYPE ma_rc_dup_unique={ wt_resource_id_memcmp, 0};
+  - When a Maria transaction would commit or rollback it would call:
+  / * Wake up threads waiting for this transaction * /
+  static void wt_thd_release_self(TRN *trn)
+  {
+    if (trn->wt)
+    {
+      WT_RESOURCE_ID rc;
+      rc.type= &ma_rc_dup_unique;
+      rc.value= (intptr)trn;
+      wt_thd_release(trn->wt, & rc);
+      trn->wt= 0;
+    }
+  }
+
+  Tests
+  ^^^^^
+  unittest/mysys/waiting_threads-t.c, currently disabled.
+*/
+
+/*
+  Note that if your lock system satisfy the following condition:
+
+    there exist four lock levels A, B, C, D, such as
+      A is compatible with B
+      A is not compatible with C
+      D is not compatible with B
+
+      (example A=IX, B=IS, C=S, D=X)
+
+   you need to include lock level in the resource identifier - a
+   thread waiting for lock of the type A on resource R and another
+   thread waiting for lock of the type B on resource R should wait on
+   different WT_RESOURCE structures, on different {lock, resource}
+   pairs.  Otherwise the following is possible:
+
+      thread1> take S-lock on R
+      thread2> take IS-lock on R
+      thread3> wants X-lock on R, starts waiting for threads 1 and 2 on R.
+      thread3 is killed (or timeout or whatever)
+      WT_RESOURCE structure for R is still in the hash, as it has two owners
+      thread4> wants an IX-lock on R
+      WT_RESOURCE for R is found in the hash, thread4 starts waiting on it.
+      !! now thread4 is waiting for both thread1 and thread2
+      !! while, in fact, IX-lock and IS-lock are compatible and
+      !! thread4 should not wait for thread2.
+*/
+
+#include <waiting_threads.h>
+#include <m_string.h>
+
+/* status variables */
+
+/**
+  preset table of wait intervals
+*/
+ulonglong wt_wait_table[WT_WAIT_STATS];
+/**
+  wait time distribution (log e scale)
+*/
+uint32 wt_wait_stats[WT_WAIT_STATS+1];
+/**
+  distribution of cycle lengths
+  first column tells whether this was during short or long detection
+*/
+uint32 wt_cycle_stats[2][WT_CYCLE_STATS+1];
+uint32 wt_success_stats;
+
+static my_atomic_rwlock_t cycle_stats_lock, wait_stats_lock, success_stats_lock;
+
+#ifdef SAFE_STATISTICS
+#define incr(VAR, LOCK)                           \
+  do {                                            \
+    my_atomic_rwlock_wrlock(&(LOCK));             \
+    my_atomic_add32(&(VAR), 1);                   \
+    my_atomic_rwlock_wrunlock(&(LOCK));           \
+  } while(0)
+#else
+#define incr(VAR,LOCK)  do { (VAR)++; } while(0)
+#endif
+
+static void increment_success_stats()
+{
+  incr(wt_success_stats, success_stats_lock);
+}
+
+static void increment_cycle_stats(uint depth, uint slot)
+{
+  if (depth >= WT_CYCLE_STATS)
+    depth= WT_CYCLE_STATS;
+  incr(wt_cycle_stats[slot][depth], cycle_stats_lock);
+}
+
+static void increment_wait_stats(ulonglong waited,int ret)
+{
+  uint i;
+  if ((ret) == ETIMEDOUT)
+    i= WT_WAIT_STATS;
+  else
+    for (i= 0; i < WT_WAIT_STATS && waited/10 > wt_wait_table[i]; i++) ;
+  incr(wt_wait_stats[i], wait_stats_lock);
+}
+
+/*
+  'lock' protects 'owners', 'state', and 'waiter_count'
+  'id' is read-only
+
+  a resource is picked up from a hash in a lock-free manner
+  it's returned pinned, so it cannot be freed at once
+  but it may be freed right after the pin is removed
+  to free a resource it should
+    1. have no owners
+    2. have no waiters
+
+  two ways to access a resource:
+    1. find it in a hash
+       - it's returned pinned.
+        a) take a lock in exclusive mode
+        b) check the state, it should be ACTIVE to be usable
+        c) unpin
+    2. by a direct reference
+       - could only used if a resource cannot be freed
+       e.g. accessing a resource by thd->waiting_for is safe,
+       a resource cannot be freed as there's a thread waiting for it
+*/
+struct st_wt_resource {
+  WT_RESOURCE_ID  id;
+  uint            waiter_count;
+  enum { ACTIVE, FREE } state;
+#ifndef DBUG_OFF
+  pthread_mutex_t  *cond_mutex; /* a mutex for the 'cond' below */
+#endif
+  /*
+    before the 'lock' all elements are mutable, after (and including) -
+    immutable in the sense that lf_hash_insert() won't memcpy() over them.
+    See wt_init().
+  */
+#ifdef WT_RWLOCKS_USE_MUTEXES
+  /*
+    we need a special rwlock-like 'lock' to allow readers bypass
+    waiting writers, otherwise readers can deadlock. For example:
+
+      A waits on resource x, owned by B, B waits on resource y, owned
+      by A, we have a cycle (A->x->B->y->A)
+      Both A and B start deadlock detection:
+
+        A locks x                          B locks y
+        A goes deeper                      B goes deeper
+        A locks y                          B locks x
+
+      with mutexes it would deadlock. With rwlocks it won't, as long
+      as both A and B are taking read locks (and they do).
+      But other threads may take write locks. Assume there's
+      C who wants to start waiting on x, and D who wants to start
+      waiting on y.
+
+        A read-locks x                       B read-locks y
+        A goes deeper                        B goes deeper
+     => C write-locks x (to add a new edge)  D write-locks y
+     .. C is blocked                         D is blocked
+        A read-locks y                       B read-locks x
+
+      Now, if a read lock can bypass a pending wrote lock request, we're fine.
+      If it can not, we have a deadlock.
+
+    writer starvation is technically possible, but unlikely, because
+    the contention is expected to be low.
+  */
+  struct {
+    pthread_cond_t   cond;
+    pthread_mutex_t  mutex;
+    uint readers: 16;
+    uint pending_writers: 15;
+    uint write_locked: 1;
+  } lock;
+#else
+  rw_lock_t lock;
+#endif
+  pthread_cond_t   cond; /* the corresponding mutex is provided by the caller */
+  DYNAMIC_ARRAY    owners;
+};
+
+#ifdef  WT_RWLOCKS_USE_MUTEXES
+static void rc_rwlock_init(WT_RESOURCE *rc)
+{
+  pthread_cond_init(&rc->lock.cond, 0);
+  pthread_mutex_init(&rc->lock.mutex, MY_MUTEX_INIT_FAST);
+}
+static void rc_rwlock_destroy(WT_RESOURCE *rc)
+{
+  DBUG_ASSERT(rc->lock.write_locked == 0);
+  DBUG_ASSERT(rc->lock.readers == 0);
+  pthread_cond_destroy(&rc->lock.cond);
+  pthread_mutex_destroy(&rc->lock.mutex);
+}
+static void rc_rdlock(WT_RESOURCE *rc)
+{
+  DBUG_PRINT("wt", ("TRYLOCK resid=%ld for READ", (ulong)rc->id.value));
+  pthread_mutex_lock(&rc->lock.mutex);
+  while (rc->lock.write_locked)
+    pthread_cond_wait(&rc->lock.cond, &rc->lock.mutex);
+  rc->lock.readers++;
+  pthread_mutex_unlock(&rc->lock.mutex);
+  DBUG_PRINT("wt", ("LOCK resid=%ld for READ", (ulong)rc->id.value));
+}
+static void rc_wrlock(WT_RESOURCE *rc)
+{
+  DBUG_PRINT("wt", ("TRYLOCK resid=%ld for WRITE", (ulong)rc->id.value));
+  pthread_mutex_lock(&rc->lock.mutex);
+  while (rc->lock.write_locked || rc->lock.readers)
+    pthread_cond_wait(&rc->lock.cond, &rc->lock.mutex);
+  rc->lock.write_locked= 1;
+  pthread_mutex_unlock(&rc->lock.mutex);
+  DBUG_PRINT("wt", ("LOCK resid=%ld for WRITE", (ulong)rc->id.value));
+}
+static void rc_unlock(WT_RESOURCE *rc)
+{
+  DBUG_PRINT("wt", ("UNLOCK resid=%ld", (ulong)rc->id.value));
+  pthread_mutex_lock(&rc->lock.mutex);
+  if (rc->lock.write_locked)
+  {
+    rc->lock.write_locked= 0;
+    pthread_cond_broadcast(&rc->lock.cond);
+  }
+  else if (--rc->lock.readers == 0)
+    pthread_cond_broadcast(&rc->lock.cond);
+  pthread_mutex_unlock(&rc->lock.mutex);
+}
+#else
+static void rc_rwlock_init(WT_RESOURCE *rc)
+{
+  my_rwlock_init(&rc->lock, 0);
+}
+static void rc_rwlock_destroy(WT_RESOURCE *rc)
+{
+  rwlock_destroy(&rc->lock);
+}
+static void rc_rdlock(WT_RESOURCE *rc)
+{
+  DBUG_PRINT("wt", ("TRYLOCK resid=%ld for READ", (ulong)rc->id.value));
+  rw_rdlock(&rc->lock);
+  DBUG_PRINT("wt", ("LOCK resid=%ld for READ", (ulong)rc->id.value));
+}
+static void rc_wrlock(WT_RESOURCE *rc)
+{
+  DBUG_PRINT("wt", ("TRYLOCK resid=%ld for WRITE", (ulong)rc->id.value));
+  rw_wrlock(&rc->lock);
+  DBUG_PRINT("wt", ("LOCK resid=%ld for WRITE", (ulong)rc->id.value));
+}
+static void rc_unlock(WT_RESOURCE *rc)
+{
+  DBUG_PRINT("wt", ("UNLOCK resid=%ld", (ulong)rc->id.value));
+  rw_unlock(&rc->lock);
+}
+#endif
+
+/*
+  All resources are stored in a lock-free hash. Different threads
+  may add new resources and perform deadlock detection concurrently.
+*/
+static LF_HASH      reshash;
+
+/**
+  WT_RESOURCE constructor
+
+  It's called from lf_hash and takes a pointer to an LF_SLIST instance.
+  WT_RESOURCE is located at arg+sizeof(LF_SLIST)
+*/
+static void wt_resource_init(uchar *arg)
+{
+  WT_RESOURCE *rc= (WT_RESOURCE*)(arg+LF_HASH_OVERHEAD);
+  DBUG_ENTER("wt_resource_init");
+
+  bzero(rc, sizeof(*rc));
+  rc_rwlock_init(rc);
+  pthread_cond_init(&rc->cond, 0);
+  my_init_dynamic_array(&rc->owners, sizeof(WT_THD *), 0, 5);
+  DBUG_VOID_RETURN;
+}
+
+/**
+  WT_RESOURCE destructor
+
+  It's called from lf_hash and takes a pointer to an LF_SLIST instance.
+  WT_RESOURCE is located at arg+sizeof(LF_SLIST)
+*/
+static void wt_resource_destroy(uchar *arg)
+{
+  WT_RESOURCE *rc= (WT_RESOURCE*)(arg+LF_HASH_OVERHEAD);
+  DBUG_ENTER("wt_resource_destroy");
+
+  DBUG_ASSERT(rc->owners.elements == 0);
+  rc_rwlock_destroy(rc);
+  pthread_cond_destroy(&rc->cond);
+  delete_dynamic(&rc->owners);
+  DBUG_VOID_RETURN;
+}
+
+void wt_init()
+{
+  DBUG_ENTER("wt_init");
+  DBUG_ASSERT(reshash.alloc.constructor != wt_resource_init);
+
+  lf_hash_init(&reshash, sizeof(WT_RESOURCE), LF_HASH_UNIQUE, 0,
+               sizeof_WT_RESOURCE_ID, 0, 0);
+  reshash.alloc.constructor= wt_resource_init;
+  reshash.alloc.destructor= wt_resource_destroy;
+  /*
+    Note a trick: we initialize the hash with the real element size,
+    but fix it later to a shortened element size. This way
+    the allocator will allocate elements correctly, but
+    lf_hash_insert() will only overwrite part of the element with memcpy().
+    lock, condition, and dynamic array will be intact.
+  */
+  reshash.element_size= offsetof(WT_RESOURCE, lock);
+  bzero(wt_wait_stats, sizeof(wt_wait_stats));
+  bzero(wt_cycle_stats, sizeof(wt_cycle_stats));
+  wt_success_stats= 0;
+  { /* initialize wt_wait_table[]. from 1 us to 1 min, log e scale */
+    int i;
+    double from= log(1);   /* 1 us */
+    double to= log(60e6);  /* 1 min */
+    for (i= 0; i < WT_WAIT_STATS; i++)
+    {
+      wt_wait_table[i]= (ulonglong)exp((to-from)/(WT_WAIT_STATS-1)*i+from);
+      DBUG_ASSERT(i == 0 || wt_wait_table[i-1] != wt_wait_table[i]);
+    }
+  }
+  my_atomic_rwlock_init(&cycle_stats_lock);
+  my_atomic_rwlock_init(&success_stats_lock);
+  my_atomic_rwlock_init(&wait_stats_lock);
+  DBUG_VOID_RETURN;
+}
+
+void wt_end()
+{
+  DBUG_ENTER("wt_end");
+
+  DBUG_ASSERT(reshash.count == 0);
+  lf_hash_destroy(&reshash);
+  my_atomic_rwlock_destroy(&cycle_stats_lock);
+  my_atomic_rwlock_destroy(&success_stats_lock);
+  my_atomic_rwlock_destroy(&wait_stats_lock);
+  DBUG_VOID_RETURN;
+}
+
+/**
+  Lazy WT_THD initialization
+
+  Cheap initialization of WT_THD. Only initialize fields that don't require
+  memory allocations - basically, it only does assignments. The rest of the
+  WT_THD structure will be initialized on demand, on the first use.
+  This allows one to initialize lazily all WT_THD structures, even if some
+  (or even most) of them will never be used for deadlock detection.
+
+  @param ds     a pointer to deadlock search depth short value
+  @param ts     a pointer to deadlock timeout short value
+  @param dl     a pointer to deadlock search depth long value
+  @param tl     a pointer to deadlock timeout long value
+
+  @note these are pointers to values, and WT_THD stores them as pointers.
+  It allows one later to change search depths and timeouts for existing
+  threads. It also means that the pointers must stay valid for the lifetime
+  of WT_THD.
+*/
+void wt_thd_lazy_init(WT_THD *thd, const ulong *ds, const ulong *ts,
+                                   const ulong *dl, const ulong *tl)
+{
+  DBUG_ENTER("wt_thd_lazy_init");
+  thd->waiting_for= 0;
+  thd->weight= 0;
+  thd->deadlock_search_depth_short= ds;
+  thd->timeout_short= ts;
+  thd->deadlock_search_depth_long= dl;
+  thd->timeout_long= tl;
+  /* dynamic array is also initialized lazily - without memory allocations */
+  my_init_dynamic_array(&thd->my_resources, sizeof(WT_RESOURCE *), 0, 5);
+#ifndef DBUG_OFF
+  thd->name= my_thread_name();
+#endif
+  DBUG_VOID_RETURN;
+}
+
+/**
+  Finalize WT_THD initialization
+
+  After lazy WT_THD initialization, parts of the structure are still
+  uninitialized. This function completes the initialization, allocating
+  memory, if necessary. It's called automatically on demand, when WT_THD
+  is about to be used.
+*/
+static int fix_thd_pins(WT_THD *thd)
+{
+  if (unlikely(thd->pins == 0))
+  {
+    thd->pins= lf_hash_get_pins(&reshash);
+#ifndef DBUG_OFF
+    thd->name= my_thread_name();
+#endif
+  }
+  return thd->pins == 0;
+}
+
+void wt_thd_destroy(WT_THD *thd)
+{
+  DBUG_ENTER("wt_thd_destroy");
+
+  DBUG_ASSERT(thd->my_resources.elements == 0);
+  DBUG_ASSERT(thd->waiting_for == 0);
+
+  if (thd->pins != 0)
+    lf_hash_put_pins(thd->pins);
+
+  delete_dynamic(&thd->my_resources);
+  DBUG_VOID_RETURN;
+}
+/**
+  Trivial resource id comparison function - bytewise memcmp.
+
+  It can be used in WT_RESOURCE_TYPE structures where bytewise
+  comparison of values is sufficient.
+*/
+my_bool wt_resource_id_memcmp(const void *a, const void *b)
+{
+  /* we use the fact that there's no padding in the middle of WT_RESOURCE_ID */
+  compile_time_assert(offsetof(WT_RESOURCE_ID, type) == sizeof(ulonglong));
+  return memcmp(a, b, sizeof_WT_RESOURCE_ID);
+}
+
+/**
+  arguments for the recursive deadlock_search function
+*/
+struct deadlock_arg {
+  WT_THD * const thd;          /**< starting point of a search */
+  uint const max_depth;        /**< search depth limit */
+  WT_THD *victim;              /**< a thread to be killed to resolve a deadlock */
+  WT_RESOURCE *last_locked_rc; /**< see comment at the end of deadlock_search() */
+};
+
+/**
+  helper function to change the victim, according to the weight
+*/
+static void change_victim(WT_THD* found, struct deadlock_arg *arg)
+{
+  if (found->weight < arg->victim->weight)
+  {
+    if (arg->victim != arg->thd)
+    {
+      rc_unlock(arg->victim->waiting_for); /* release the previous victim */
+      DBUG_ASSERT(arg->last_locked_rc == found->waiting_for);
+    }
+    arg->victim= found;
+    arg->last_locked_rc= 0;
+  }
+}
+
+/**
+  recursive loop detection in a wait-for graph with a limited search depth
+*/
+static int deadlock_search(struct deadlock_arg *arg, WT_THD *blocker,
+                           uint depth)
+{
+  WT_RESOURCE *rc, *volatile *shared_ptr= &blocker->waiting_for;
+  WT_THD *cursor;
+  uint i;
+  int ret= WT_OK;
+  DBUG_ENTER("deadlock_search");
+  DBUG_PRINT("wt", ("enter: thd=%s, blocker=%s, depth=%u",
+                    arg->thd->name, blocker->name, depth));
+
+  LF_REQUIRE_PINS(1);
+
+  arg->last_locked_rc= 0;
+
+  if (depth > arg->max_depth)
+  {
+    DBUG_PRINT("wt", ("exit: WT_DEPTH_EXCEEDED (early)"));
+    DBUG_RETURN(WT_DEPTH_EXCEEDED);
+  }
+
+retry:
+  /*
+    safe dereference as explained in lf_alloc-pin.c
+    (in short: protects against lf_alloc_free() in lf_hash_delete())
+  */
+  do
+  {
+    rc= *shared_ptr;
+    lf_pin(arg->thd->pins, 0, rc);
+  } while (rc != *shared_ptr && LF_BACKOFF);
+
+  if (rc == 0)
+  {
+    DBUG_PRINT("wt", ("exit: OK (early)"));
+    DBUG_RETURN(0);
+  }
+
+  rc_rdlock(rc);
+  if (rc->state != ACTIVE || *shared_ptr != rc)
+  {
+    /* blocker is not waiting on this resource anymore */
+    rc_unlock(rc);
+    lf_unpin(arg->thd->pins, 0);
+    goto retry;
+  }
+  /* as the state is locked, we can unpin now */
+  lf_unpin(arg->thd->pins, 0);
+
+  /*
+    Below is not a pure depth-first search. It's a depth-first with a
+    slightest hint of breadth-first. Depth-first is:
+
+      check(element, X):
+        foreach current in element->nodes[] do:
+          if current == X return error;
+          check(current, X);
+
+    while we do
+
+      check(element, X):
+        foreach current in element->nodes[] do:
+          if current == X return error;
+        foreach current in element->nodes[] do:
+          check(current, X);
+
+    preferring shorter deadlocks over longer ones.
+  */
+  for (i= 0; i < rc->owners.elements; i++)
+  {
+    cursor= *dynamic_element(&rc->owners, i, WT_THD**);
+    /*
+      We're only looking for (and detecting) cycles that include 'arg->thd'.
+      That is, only deadlocks that *we* have created. For example,
+        thd->A->B->thd
+      (thd waits for A, A waits for B, while B is waiting for thd).
+      While walking the graph we can encounter other cicles, e.g.
+        thd->A->B->C->A
+      This will not be detected. Instead we will walk it in circles until
+      the search depth limit is reached (the latter guarantees that an
+      infinite loop is impossible). We expect the thread that has created
+      the cycle (one of A, B, and C) to detect its deadlock.
+    */
+    if (cursor == arg->thd)
+    {
+      ret= WT_DEADLOCK;
+      increment_cycle_stats(depth, arg->max_depth ==
+                                   *arg->thd->deadlock_search_depth_long);
+      arg->victim= cursor;
+      goto end;
+    }
+  }
+  for (i= 0; i < rc->owners.elements; i++)
+  {
+    cursor= *dynamic_element(&rc->owners, i, WT_THD**);
+    switch (deadlock_search(arg, cursor, depth+1)) {
+    case WT_OK:
+      break;
+    case WT_DEPTH_EXCEEDED:
+      ret= WT_DEPTH_EXCEEDED;
+      break;
+    case WT_DEADLOCK:
+      ret= WT_DEADLOCK;
+      change_victim(cursor, arg);       /* also sets arg->last_locked_rc to 0 */
+      i= rc->owners.elements;           /* jump out of the loop */
+      break;
+    default:
+      DBUG_ASSERT(0);
+    }
+    if (arg->last_locked_rc)
+      rc_unlock(arg->last_locked_rc);
+  }
+end:
+  /*
+    Note that 'rc' is locked in this function, but it's never unlocked here.
+    Instead it's saved in arg->last_locked_rc and the *caller* is
+    expected to unlock it.  It's done to support different killing
+    strategies. This is how it works:
+    Assuming a graph
+
+      thd->A->B->C->thd
+
+    deadlock_search() function starts from thd, locks it (in fact it locks not
+    a thd, but a resource it is waiting on, but below, for simplicity, I'll
+    talk about "locking a thd"). Then it goes down recursively, locks A, and so
+    on. Goes down recursively, locks B. Goes down recursively, locks C.
+    Notices that C is waiting on thd. Deadlock detected. Sets arg->victim=thd.
+    Returns from the last deadlock_search() call. C stays locked!
+    Now it checks whether C is a more appropriate victim than 'thd'.
+    If yes - arg->victim=C, otherwise C is unlocked. Returns. B stays locked.
+    Now it checks whether B is a more appropriate victim than arg->victim.
+    If yes - old arg->victim is unlocked and arg->victim=B,
+    otherwise B is unlocked. Return.
+    And so on.
+
+    In short, a resource is locked in a frame. But it's not unlocked in the
+    same frame, it's unlocked by the caller, and only after the caller checks
+    that it doesn't need to use current WT_THD as a victim. If it does - the
+    lock is kept and the old victim's resource is unlocked. When the recursion
+    is unrolled and we are back to deadlock() function, there are only two
+    locks left - on thd and on the victim.
+  */
+  arg->last_locked_rc= rc;
+  DBUG_PRINT("wt", ("exit: %s",
+                    ret == WT_DEPTH_EXCEEDED ? "WT_DEPTH_EXCEEDED" :
+                    ret ? "WT_DEADLOCK" : "OK"));
+  DBUG_RETURN(ret);
+}
+
+/**
+  Deadlock detection in a wait-for graph
+
+  A wrapper for recursive deadlock_search() - prepares deadlock_arg structure,
+  invokes deadlock_search(), increments statistics, notifies the victim.
+
+  @param thd            thread that is going to wait. Deadlock is detected
+                        if, while walking the graph, we reach a thread that
+                        is waiting on thd
+  @param blocker        starting point of a search. In wt_thd_cond_timedwait()
+                        it's thd, in wt_thd_will_wait_for() it's a thread that
+                        thd is going to wait for
+  @param depth          starting search depth. In general it's the number of
+                        edges in the wait-for graph between thd and the
+                        blocker. Practically only two values are used (and
+                        supported) - when thd == blocker it's 0, when thd
+                        waits directly for blocker, it's 1
+  @param max_depth      search depth limit
+*/
+static int deadlock(WT_THD *thd, WT_THD *blocker, uint depth,
+                            uint max_depth)
+{
+  struct deadlock_arg arg= {thd, max_depth, 0, 0};
+  int ret;
+  DBUG_ENTER("deadlock");
+  DBUG_ASSERT(depth < 2);
+  ret= deadlock_search(&arg, blocker, depth);
+  if (ret == WT_DEPTH_EXCEEDED)
+  {
+    increment_cycle_stats(WT_CYCLE_STATS, max_depth ==
+                                          *thd->deadlock_search_depth_long);
+    ret= WT_OK;
+  }
+  /*
+    if we started with depth==1, blocker was never considered for a victim
+    in deadlock_search(). Do it here.
+  */
+  if (ret == WT_DEADLOCK && depth)
+    change_victim(blocker, &arg);
+  if (arg.last_locked_rc)
+  {
+    /*
+      Special return code if there's nobody to wait for.
+
+      depth == 0 means that we start the search from thd (thd == blocker).
+      ret == WT_OK means that no cycle was found and
+        arg.last_locked_rc == thd->waiting_for.
+      and arg.last_locked_rc->owners.elements == 0 means that
+        (applying the rule above) thd->waiting_for->owners.elements == 0,
+        and thd doesn't have anybody to wait for.
+    */
+    if (depth == 0 && ret == WT_OK && arg.last_locked_rc->owners.elements == 0)
+    {
+      DBUG_ASSERT(thd == blocker);
+      DBUG_ASSERT(arg.last_locked_rc == thd->waiting_for);
+      ret= WT_FREE_TO_GO;
+    }
+    rc_unlock(arg.last_locked_rc);
+  }
+  /* notify the victim, if appropriate */
+  if (ret == WT_DEADLOCK && arg.victim != thd)
+  {
+    DBUG_PRINT("wt", ("killing %s", arg.victim->name));
+    arg.victim->killed= 1;
+    pthread_cond_broadcast(&arg.victim->waiting_for->cond);
+    rc_unlock(arg.victim->waiting_for);
+    ret= WT_OK;
+  }
+  DBUG_RETURN(ret);
+}
+
+
+/**
+  Delete an element from reshash if it has no waiters or owners
+
+  rc->lock must be locked by the caller and it's unlocked on return.
+*/
+static int unlock_lock_and_free_resource(WT_THD *thd, WT_RESOURCE *rc)
+{
+  uint keylen;
+  const void *key;
+  DBUG_ENTER("unlock_lock_and_free_resource");
+
+  DBUG_ASSERT(rc->state == ACTIVE);
+
+  if (rc->owners.elements || rc->waiter_count)
+  {
+    DBUG_PRINT("wt", ("nothing to do, %u owners, %u waiters",
+                      rc->owners.elements, rc->waiter_count));
+    rc_unlock(rc);
+    DBUG_RETURN(0);
+  }
+
+  if (fix_thd_pins(thd))
+  {
+    rc_unlock(rc);
+    DBUG_RETURN(1);
+  }
+
+  /* XXX if (rc->id.type->make_key) key= rc->id.type->make_key(&rc->id, &keylen); else */
+  {
+    key= &rc->id;
+    keylen= sizeof_WT_RESOURCE_ID;
+  }
+
+  /*
+    To free the element correctly we need to:
+     1. take its lock (already done).
+     2. set the state to FREE
+     3. release the lock
+     4. remove from the hash
+  */
+  rc->state= FREE;
+  rc_unlock(rc);
+  DBUG_RETURN(lf_hash_delete(&reshash, thd->pins, key, keylen) == -1);
+}
+
+
+/**
+  register the fact that thd is not waiting anymore
+
+  decrease waiter_count, clear waiting_for, free the resource if appropriate.
+  thd->waiting_for must be locked!
+*/
+static int stop_waiting_locked(WT_THD *thd)
+{
+  int ret;
+  WT_RESOURCE *rc= thd->waiting_for;
+  DBUG_ENTER("stop_waiting_locked");
+
+  DBUG_ASSERT(rc->waiter_count);
+  DBUG_ASSERT(rc->state == ACTIVE);
+  rc->waiter_count--;
+  thd->waiting_for= 0;
+  ret= unlock_lock_and_free_resource(thd, rc);
+  DBUG_RETURN((thd->killed || ret) ? WT_DEADLOCK : WT_OK);
+}
+
+/**
+  register the fact that thd is not waiting anymore
+
+  locks thd->waiting_for and calls stop_waiting_locked().
+*/
+static int stop_waiting(WT_THD *thd)
+{
+  int ret;
+  WT_RESOURCE *rc= thd->waiting_for;
+  DBUG_ENTER("stop_waiting");
+
+  if (!rc)
+    DBUG_RETURN(WT_OK);
+  /*
+    nobody's trying to free the resource now,
+    as its waiter_count is guaranteed to be non-zero
+  */
+  rc_wrlock(rc);
+  ret= stop_waiting_locked(thd);
+  DBUG_RETURN(ret);
+}
+
+/**
+  notify the system that a thread needs to wait for another thread
+
+  called by a *waiter* to declare that it (thd) will wait for another
+  thread (blocker) on a specific resource (resid).
+  can be called many times, if many blockers own a blocking resource.
+  but must always be called with the same resource id - a thread cannot
+  wait for more than one resource at a time.
+
+  @return WT_OK or WT_DEADLOCK
+
+  As a new edge is added to the wait-for graph, a deadlock detection is
+  performed for this new edge.
+*/
+int wt_thd_will_wait_for(WT_THD *thd, WT_THD *blocker,
+                         const WT_RESOURCE_ID *resid)
+{
+  uint i;
+  WT_RESOURCE *rc;
+  DBUG_ENTER("wt_thd_will_wait_for");
+
+  LF_REQUIRE_PINS(3);
+
+  DBUG_PRINT("wt", ("enter: thd=%s, blocker=%s, resid=%lu",
+                    thd->name, blocker->name, (ulong)resid->value));
+
+  if (fix_thd_pins(thd))
+    DBUG_RETURN(WT_DEADLOCK);
+
+  if (thd->waiting_for == 0)
+  {
+    uint keylen;
+    const void *key;
+    /* XXX if (restype->make_key) key= restype->make_key(resid, &keylen); else */
+    {
+      key= resid;
+      keylen= sizeof_WT_RESOURCE_ID;
+    }
+
+    DBUG_PRINT("wt", ("first blocker"));
+
+retry:
+    while ((rc= lf_hash_search(&reshash, thd->pins, key, keylen)) == 0)
+    {
+      WT_RESOURCE tmp;
+
+      DBUG_PRINT("wt", ("failed to find rc in hash, inserting"));
+      bzero(&tmp, sizeof(tmp));
+      tmp.id= *resid;
+      tmp.state= ACTIVE;
+
+      if (lf_hash_insert(&reshash, thd->pins, &tmp) == -1) /* if OOM */
+        DBUG_RETURN(WT_DEADLOCK);
+      /*
+        Two cases: either lf_hash_insert() failed - because another thread
+        has just inserted a resource with the same id - and we need to retry.
+        Or lf_hash_insert() succeeded, and then we need to repeat
+        lf_hash_search() to find a real address of the newly inserted element.
+        That is, we don't care what lf_hash_insert() has returned.
+        And we need to repeat the loop anyway.
+      */
+    }
+    if (rc == MY_ERRPTR)
+      DBUG_RETURN(WT_DEADLOCK);
+
+    DBUG_PRINT("wt", ("found in hash rc=%p", rc));
+
+    rc_wrlock(rc);
+    if (rc->state != ACTIVE)
+    {
+      DBUG_PRINT("wt", ("but it's not active, retrying"));
+      /* Somebody has freed the element while we weren't looking */
+      rc_unlock(rc);
+      lf_hash_search_unpin(thd->pins);
+      goto retry;
+    }
+
+    lf_hash_search_unpin(thd->pins); /* the element cannot go away anymore */
+    thd->waiting_for= rc;
+    rc->waiter_count++;
+    thd->killed= 0;
+  }
+  else
+  {
+    DBUG_ASSERT(thd->waiting_for->id.type == resid->type);
+    DBUG_ASSERT(resid->type->compare(&thd->waiting_for->id, resid) == 0);
+    DBUG_PRINT("wt", ("adding another blocker"));
+
+    /*
+      we can safely access the resource here, it's in the hash as it has
+      non-zero waiter_count
+    */
+    rc= thd->waiting_for;
+    rc_wrlock(rc);
+    DBUG_ASSERT(rc->waiter_count);
+    DBUG_ASSERT(rc->state == ACTIVE);
+
+    if (thd->killed)
+    {
+      stop_waiting_locked(thd);
+      DBUG_RETURN(WT_DEADLOCK);
+    }
+  }
+  /*
+    Another thread could be waiting on this resource for this very 'blocker'.
+    In this case we should not add it to the list for the second time.
+  */
+  for (i= 0; i < rc->owners.elements; i++)
+    if (*dynamic_element(&rc->owners, i, WT_THD**) == blocker)
+      break;
+  if (i >= rc->owners.elements)
+  {
+    if (push_dynamic(&blocker->my_resources, (void*)&rc))
+    {
+      stop_waiting_locked(thd);
+      DBUG_RETURN(WT_DEADLOCK); /* deadlock and OOM use the same error code */
+    }
+    if (push_dynamic(&rc->owners, (void*)&blocker))
+    {
+      pop_dynamic(&blocker->my_resources);
+      stop_waiting_locked(thd);
+      DBUG_RETURN(WT_DEADLOCK);
+    }
+  }
+  rc_unlock(rc);
+
+  if (deadlock(thd, blocker, 1, *thd->deadlock_search_depth_short) != WT_OK)
+  {
+    stop_waiting(thd);
+    DBUG_RETURN(WT_DEADLOCK);
+  }
+  DBUG_RETURN(WT_OK);
+}
+
+/**
+  called by a *waiter* (thd) to start waiting
+
+  It's supposed to be a drop-in replacement for
+  pthread_cond_timedwait(), and it takes mutex as an argument.
+
+  @return one of WT_TIMEOUT, WT_DEADLOCK, WT_OK
+*/
+int wt_thd_cond_timedwait(WT_THD *thd, pthread_mutex_t *mutex)
+{
+  int ret= WT_TIMEOUT;
+  struct timespec timeout;
+  ulonglong before, after, starttime;
+  WT_RESOURCE *rc= thd->waiting_for;
+  DBUG_ENTER("wt_thd_cond_timedwait");
+  DBUG_PRINT("wt", ("enter: thd=%s, rc=%p", thd->name, rc));
+
+#ifndef DBUG_OFF
+  if (rc->cond_mutex)
+    DBUG_ASSERT(rc->cond_mutex == mutex);
+  else
+    rc->cond_mutex= mutex;
+  safe_mutex_assert_owner(mutex);
+#endif
+
+  before= starttime= my_getsystime();
+
+#ifdef __WIN__
+  /*
+    only for the sake of Windows we distinguish between
+    'before' and 'starttime':
+
+    my_getsystime() returns high-resolution value, that cannot be used for
+    waiting (it doesn't follow system clock changes), but is good for time
+    intervals.
+
+    GetSystemTimeAsFileTime() follows system clock, but is low-resolution
+    and will result in lousy intervals.
+  */
+  GetSystemTimeAsFileTime((PFILETIME)&starttime);
+#endif
+
+  rc_wrlock(rc);
+  if (rc->owners.elements == 0)
+    ret= WT_OK;
+  rc_unlock(rc);
+
+  set_timespec_time_nsec(timeout, starttime, (*thd->timeout_short)*1000ULL);
+  if (ret == WT_TIMEOUT && !thd->killed)
+    ret= pthread_cond_timedwait(&rc->cond, mutex, &timeout);
+  if (ret == WT_TIMEOUT && !thd->killed)
+  {
+    int r= deadlock(thd, thd, 0, *thd->deadlock_search_depth_long);
+    if (r == WT_FREE_TO_GO)
+      ret= WT_OK;
+    else if (r != WT_OK)
+      ret= WT_DEADLOCK;
+    else if (*thd->timeout_long > *thd->timeout_short)
+    {
+      set_timespec_time_nsec(timeout, starttime, (*thd->timeout_long)*1000ULL);
+      if (!thd->killed)
+        ret= pthread_cond_timedwait(&rc->cond, mutex, &timeout);
+    }
+  }
+  after= my_getsystime();
+  if (stop_waiting(thd) == WT_DEADLOCK) /* if we're killed */
+    ret= WT_DEADLOCK;
+  increment_wait_stats(after-before, ret);
+  if (ret == WT_OK)
+    increment_success_stats();
+  DBUG_RETURN(ret);
+}
+
+/**
+  called by a *blocker* when it releases a resource
+
+  it's conceptually similar to pthread_cond_broadcast, and must be done
+  under the same mutex as wt_thd_cond_timedwait().
+
+  @param resid   a resource to release. 0 to release all resources
+*/
+
+void wt_thd_release(WT_THD *thd, const WT_RESOURCE_ID *resid)
+{
+  uint i;
+  DBUG_ENTER("wt_thd_release");
+
+  for (i= 0; i < thd->my_resources.elements; i++)
+  {
+    WT_RESOURCE *rc= *dynamic_element(&thd->my_resources, i, WT_RESOURCE**);
+    if (!resid || (resid->type->compare(&rc->id, resid) == 0))
+    {
+      uint j;
+
+      rc_wrlock(rc);
+      /*
+        nobody's trying to free the resource now,
+        as its owners[] array is not empty (at least thd must be there)
+      */
+      DBUG_ASSERT(rc->state == ACTIVE);
+      for (j= 0; j < rc->owners.elements; j++)
+        if (*dynamic_element(&rc->owners, j, WT_THD**) == thd)
+          break;
+      DBUG_ASSERT(j < rc->owners.elements);
+      delete_dynamic_element(&rc->owners, j);
+      if (rc->owners.elements == 0)
+      {
+        pthread_cond_broadcast(&rc->cond);
+#ifndef DBUG_OFF
+        if (rc->cond_mutex)
+          safe_mutex_assert_owner(rc->cond_mutex);
+#endif
+      }
+      unlock_lock_and_free_resource(thd, rc);
+      if (resid)
+      {
+        delete_dynamic_element(&thd->my_resources, i);
+        DBUG_VOID_RETURN;
+      }
+    }
+  }
+  if (!resid)
+    reset_dynamic(&thd->my_resources);
+  DBUG_VOID_RETURN;
+}
+

=== modified file 'netware/Makefile.am'
--- a/netware/Makefile.am	2009-02-07 15:50:31 +0000
+++ b/netware/Makefile.am	2010-05-19 13:00:23 +0000
@@ -115,6 +115,3 @@ test_db.sql: init_db.sql $(top_srcdir)/s
 	@echo "Building $@";
 	@cat init_db.sql \
 	     $(top_srcdir)/scripts/mysql_test_data_timezone.sql  > $@;
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'plugin/Makefile.am'
--- a/plugin/Makefile.am	2010-03-11 15:37:51 +0000
+++ b/plugin/Makefile.am	2010-05-19 13:00:23 +0000
@@ -28,6 +28,3 @@ DIST_SUBDIRS =	@mysql_pg_distdirs@
 install-exec-hook:
 	$(mkinstalldirs) $(DESTDIR)$(pkglibdir) $(DESTDIR)$(pkglibdir)/plugin
 	test ! -d debug || $(TAR) cf - debug | ( cd $(DESTDIR)$(pkglibdir)/plugin && $(TAR) xvf - )
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'plugin/audit_null/CMakeLists.txt'
--- a/plugin/audit_null/CMakeLists.txt	2010-01-26 04:39:48 +0000
+++ b/plugin/audit_null/CMakeLists.txt	2010-05-12 15:32:31 +0000
@@ -13,4 +13,4 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
 
-MYSQL_ADD_PLUGIN(audit_null audit_null.c)
+MYSQL_ADD_PLUGIN(audit_null audit_null.c MODULE_ONLY)

=== modified file 'plugin/daemon_example/Makefile.am'
--- a/plugin/daemon_example/Makefile.am	2009-11-09 11:32:48 +0000
+++ b/plugin/daemon_example/Makefile.am	2010-05-19 13:00:23 +0000
@@ -39,6 +39,3 @@ libdaemon_example_a_CXXFLAGS =	$(AM_CFLA
 libdaemon_example_a_CFLAGS =	$(AM_CFLAGS)
 libdaemon_example_a_SOURCES=	daemon_example.cc
 EXTRA_DIST = CMakeLists.txt
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'plugin/fulltext/CMakeLists.txt'
--- a/plugin/fulltext/CMakeLists.txt	2010-02-01 22:46:02 +0000
+++ b/plugin/fulltext/CMakeLists.txt	2010-05-12 11:51:23 +0000
@@ -13,5 +13,5 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
 
-
-MYSQL_ADD_PLUGIN(ftexample plugin_example.c MODULE_ONLY MODULE_OUTPUT_NAME mypluglib)
+MYSQL_ADD_PLUGIN(ftexample plugin_example.c
+  MODULE_ONLY MODULE_OUTPUT_NAME "mypluglib")

=== modified file 'plugin/fulltext/Makefile.am'
--- a/plugin/fulltext/Makefile.am	2009-11-09 11:32:48 +0000
+++ b/plugin/fulltext/Makefile.am	2010-05-19 13:00:23 +0000
@@ -23,6 +23,3 @@ mypluglib_la_SOURCES= plugin_example.c
 mypluglib_la_LDFLAGS= -module -rpath $(pkgplugindir)
 mypluglib_la_CFLAGS= -DMYSQL_DYNAMIC_PLUGIN
 EXTRA_DIST= CMakeLists.txt
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'pstack/Makefile.am'
--- a/pstack/Makefile.am	2007-09-27 19:39:23 +0000
+++ b/pstack/Makefile.am	2010-05-19 13:00:23 +0000
@@ -27,6 +27,3 @@ libpstack_a_SOURCES =	bucomm.c filemode.
 			debug.c ieee.c pstack.c stabs.c
 noinst_HEADERS =	bucomm.h debug.h ieee.h budbg.h demangle.h \
 			linuxthreads.h pstack.h pstacktrace.h
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'pstack/aout/Makefile.am'
--- a/pstack/aout/Makefile.am	2006-12-31 00:02:27 +0000
+++ b/pstack/aout/Makefile.am	2010-05-19 13:00:23 +0000
@@ -1,4 +1 @@
 noinst_HEADERS = aout64.h stab.def stab_gnu.h
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'regex/Makefile.am'
--- a/regex/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/regex/Makefile.am	2010-05-19 13:00:23 +0000
@@ -31,6 +31,3 @@ test: re tests
 	./re < tests
 	./re -el < tests
 	./re -er < tests
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'scripts/CMakeLists.txt'
--- a/scripts/CMakeLists.txt	2010-04-19 08:29:52 +0000
+++ b/scripts/CMakeLists.txt	2010-05-12 21:20:24 +0000
@@ -93,6 +93,10 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles")
   # No multiconfig build - use CMAKE_C_FLAGS
   SET(CFLAGS "@CMAKE_C_FLAGS@")
   SET(CXXFLAGS "@CMAKE_CXX_FLAGS@")
+  FOREACH(ARCH ${CMAKE_OSX_ARCHITECTURES})
+    SET(CFLAGS   "${CFLAGS} -arch ${ARCH}")
+    SET(CXXFLAGS "${CXXFLAGS} -arch ${ARCH}")
+  ENDFOREACH()
 ELSE()
   # Multiconfig build - use CMAKE_C_FLAGS_RELWITHDEBINFO
   SET(CFLAGS "@CMAKE_C_FLAGS_RELWITHDEBINFO@")
@@ -134,10 +138,9 @@ ELSE()
   SET(CHECK_PID "kill -s SIGCONT $PID  > /dev/null 2> /dev/null")
 ENDIF()
 
-ENDIF(UNIX)
-
-
+SET(HOSTNAME "hostname")
 
+ENDIF(UNIX)
 
 # Really ugly, one script, "mysql_install_db", needs prefix set to ".",
 # i.e. makes access relative the current directory. This matches
@@ -298,14 +301,13 @@ ELSE()
     mysql_secure_installation
     mysql_zap
     mysqlaccess
+    mysqlaccess.conf
     mysqlbug
     mysql_convert_table_format
     mysql_find_rows
     mysqlhotcopy
     mysqldumpslow
     mysqld_multi
-    mysqlaccess
-    mysqlaccess.conf
     mysqld_safe
   )
   FOREACH(file ${BIN_SCRIPTS})

=== modified file 'scripts/Makefile.am'
--- a/scripts/Makefile.am	2010-03-25 07:26:12 +0000
+++ b/scripts/Makefile.am	2010-05-19 13:01:45 +0000
@@ -190,7 +190,3 @@ SUFFIXES = .sh
 	$< > $@-t
 	@CHMOD@ +x $@-t
 	@MV@ $@-t $@
-
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'scripts/mysqld_safe.sh'
--- a/scripts/mysqld_safe.sh	2010-04-18 13:32:05 +0000
+++ b/scripts/mysqld_safe.sh	2010-05-12 11:51:23 +0000
@@ -306,7 +306,7 @@ set_malloc_lib() {
     malloc_lib=
     # This list is kept intentionally simple.  Simply set --malloc-lib
     # to a full path if another location is desired.
-    for libdir in /usr/lib "$pkglibdir"; do
+    for libdir in /usr/lib "$pkglibdir" "$pkglibdir/mysql"; do
       for flavor in _minimal '' _and_profiler _debug; do
         tmp="$libdir/libtcmalloc$flavor.so"
         #log_notice "DEBUG: Checking for malloc lib '$tmp'"
@@ -699,7 +699,7 @@ fi
 
 cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS"
 
-plugin_dir="${PLUGIN_DIR:-@pkgplugindir@}${PLUGIN_VARIANT}"
+plugin_dir="${PLUGIN_DIR:-$MY_BASEDIR_VERSION/lib/plugin}${PLUGIN_VARIANT}"
 
 for i in  "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
   "--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"

=== modified file 'sql-bench/CMakeLists.txt'
--- a/sql-bench/CMakeLists.txt	2010-02-19 17:30:08 +0000
+++ b/sql-bench/CMakeLists.txt	2010-05-12 11:51:23 +0000
@@ -18,23 +18,22 @@ FILE(GLOB all_files 
 ${CMAKE_SOURCE_DIR}/sql-bench/* 
 ${CMAKE_SOURCE_DIR}/sql-bench/Data/ATIS/*
 ${CMAKE_SOURCE_DIR}/sql-bench/Data/Wisconsin/*
-${CMAKE_SOURCE_DIR}/sql-bench/Comments/*
 ${CMAKE_SOURCE_DIR}/sql-bench/limits/*
 )
 
-IF(NOT INSTALL_SQLBENCHROOTDIR)
+IF(NOT INSTALL_SQLBENCHDIR)
  RETURN()
 ENDIF()
 
-IF(INSTALL_SQLBENCHROOTDIR STREQUAL ".")
+IF(INSTALL_SQLBENCHDIR STREQUAL ".")
   SET(prefix)
 ELSE()
- SET(prefix ${INSTALL_SQLBENCHROOTDIR}/)
+ SET(prefix ${INSTALL_SQLBENCHDIR}/)
 ENDIF()
 
 GET_FILENAME_COMPONENT(basedir ${CMAKE_SOURCE_DIR} ABSOLUTE)
 FOREACH(file ${all_files})
-  IF(NOT IS_DIRECTORY ${file} AND NOT ${file} MATCHES "Make" )
+  IF(NOT IS_DIRECTORY ${file} AND NOT ${file} MATCHES "Make|as3ap|/example$" )
   FILE(RELATIVE_PATH relpath ${basedir} ${file})
   SET(target_relpath ${relpath})
   GET_FILENAME_COMPONENT(ext ${file} EXT)

=== modified file 'sql-bench/Makefile.am'
--- a/sql-bench/Makefile.am	2009-11-09 11:32:48 +0000
+++ b/sql-bench/Makefile.am	2010-05-19 13:00:23 +0000
@@ -81,6 +81,3 @@ SUFFIXES = .sh
 	  $< > $@-t
 	@CHMOD@ +x $@-t
 	@MV@ $@-t $@
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'sql-common/Makefile.am'
--- a/sql-common/Makefile.am	2006-12-31 00:02:27 +0000
+++ b/sql-common/Makefile.am	2010-05-19 13:00:23 +0000
@@ -15,6 +15,3 @@
 
 ## Process this file with automake to create Makefile.in
 EXTRA_DIST = client.c pack.c my_time.c my_user.c
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'sql/Makefile.am'
--- a/sql/Makefile.am	2010-04-13 15:04:45 +0000
+++ b/sql/Makefile.am	2010-05-19 13:00:23 +0000
@@ -271,6 +271,3 @@ probes_libndb.o: probes_mysql.d libndb_l
 	fi
 
 endif
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2010-05-07 10:08:23 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2010-05-20 16:01:10 +0000
@@ -263,7 +263,6 @@ static void run_query(THD *thd, char *bu
   ulonglong save_thd_options= thd->variables.option_bits;
   DBUG_ASSERT(sizeof(save_thd_options) == sizeof(thd->variables.option_bits));
   NET save_thd_net= thd->net;
-  const char* found_semicolon= NULL;
 
   bzero((char*) &thd->net, sizeof(NET));
   thd->set_query(buf, (uint) (end - buf));
@@ -277,7 +276,10 @@ static void run_query(THD *thd, char *bu
   DBUG_ASSERT(!thd->in_sub_stmt);
   DBUG_ASSERT(!thd->locked_tables_mode);
 
-  mysql_parse(thd, thd->query(), thd->query_length(), &found_semicolon);
+  {
+    Parser_state parser_state(thd, thd->query(), thd->query_length());
+    mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
+  }
 
   if (no_print_error && thd->is_slave_error)
   {

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2010-04-07 11:58:40 +0000
+++ b/sql/item_func.cc	2010-05-14 05:28:51 +0000
@@ -6030,7 +6030,7 @@ longlong Item_func_row_count::val_int()
   DBUG_ASSERT(fixed == 1);
   THD *thd= current_thd;
 
-  return thd->row_count_func;
+  return thd->get_row_count_func();
 }
 
 

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2010-04-29 11:20:36 +0000
+++ b/sql/log_event.cc	2010-05-14 18:38:28 +0000
@@ -3290,8 +3290,8 @@ int Query_log_event::do_apply_event(Rela
       thd->table_map_for_update= (table_map)table_map_for_update;
       
       /* Execute the query (note that we bypass dispatch_command()) */
-      const char* found_semicolon= NULL;
-      mysql_parse(thd, thd->query(), thd->query_length(), &found_semicolon);
+      Parser_state parser_state(thd, thd->query(), thd->query_length());
+      mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
       log_slow_statement(thd);
 
       /*

=== modified file 'sql/protocol.cc'
--- a/sql/protocol.cc	2010-03-31 14:05:33 +0000
+++ b/sql/protocol.cc	2010-05-14 05:28:51 +0000
@@ -210,7 +210,7 @@ net_send_ok(THD *thd,
   NET *net= &thd->net;
   uchar buff[MYSQL_ERRMSG_SIZE+10],*pos;
   bool error= FALSE;
-  DBUG_ENTER("my_ok");
+  DBUG_ENTER("net_send_ok");
 
   if (! net->vio)	// hack for re-parsing queries
   {

=== modified file 'sql/rpl_mi.cc'
--- a/sql/rpl_mi.cc	2010-03-31 14:05:33 +0000
+++ b/sql/rpl_mi.cc	2010-05-18 15:35:14 +0000
@@ -143,7 +143,6 @@ int init_master_info(Master_info* mi, co
                      int thread_mask)
 {
   int fd,error;
-  char fname[FN_REFLEN+128];
   DBUG_ENTER("init_master_info");
 
   if (mi->inited)
@@ -169,7 +168,8 @@ int init_master_info(Master_info* mi, co
 
   mi->mysql=0;
   mi->file_id=1;
-  fn_format(fname, master_info_fname, mysql_data_home, "", 4+32);
+  fn_format(mi->info_file_name, master_info_fname, mysql_data_home, "",
+            MYF(MY_UNPACK_FILENAME|MY_RETURN_REAL_PATH));
 
   /*
     We need a mutex while we are changing master info parameters to
@@ -181,7 +181,7 @@ int init_master_info(Master_info* mi, co
 
   /* does master.info exist ? */
 
-  if (access(fname,F_OK))
+  if (access(mi->info_file_name, F_OK))
   {
     if (abort_if_no_master_info_file)
     {
@@ -194,18 +194,18 @@ int init_master_info(Master_info* mi, co
     */
     if (fd >= 0)
       mysql_file_close(fd, MYF(MY_WME));
-    if ((fd= mysql_file_open(key_file_master_info,
-                             fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0 )
+    if ((fd= mysql_file_open(key_file_master_info, mi->info_file_name,
+                             O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0 )
     {
       sql_print_error("Failed to create a new master info file (\
-file '%s', errno %d)", fname, my_errno);
+file '%s', errno %d)", mi->info_file_name, my_errno);
       goto err;
     }
     if (init_io_cache(&mi->file, fd, IO_SIZE*2, READ_CACHE, 0L,0,
                       MYF(MY_WME)))
     {
       sql_print_error("Failed to create a cache on master info file (\
-file '%s')", fname);
+file '%s')", mi->info_file_name);
       goto err;
     }
 
@@ -220,17 +220,17 @@ file '%s')", fname);
     else
     {
       if ((fd= mysql_file_open(key_file_master_info,
-                               fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0 )
+                               mi->info_file_name, O_RDWR|O_BINARY, MYF(MY_WME))) < 0 )
       {
         sql_print_error("Failed to open the existing master info file (\
-file '%s', errno %d)", fname, my_errno);
+file '%s', errno %d)", mi->info_file_name, my_errno);
         goto err;
       }
       if (init_io_cache(&mi->file, fd, IO_SIZE*2, READ_CACHE, 0L,
                         0, MYF(MY_WME)))
       {
         sql_print_error("Failed to create a cache on master info file (\
-file '%s')", fname);
+file '%s')", mi->info_file_name);
         goto err;
       }
     }
@@ -344,7 +344,7 @@ file '%s')", fname);
     if (ssl)
       sql_print_warning("SSL information in the master info file "
                       "('%s') are ignored because this MySQL slave was "
-                      "compiled without SSL support.", fname);
+                      "compiled without SSL support.", mi->info_file_name);
 #endif /* HAVE_OPENSSL */
 
     /*

=== modified file 'sql/rpl_mi.h'
--- a/sql/rpl_mi.h	2010-03-31 14:05:33 +0000
+++ b/sql/rpl_mi.h	2010-05-18 15:35:14 +0000
@@ -112,6 +112,7 @@ class Master_info : public Slave_reporti
   ulonglong received_heartbeats;  // counter of received heartbeat events
   DYNAMIC_ARRAY ignore_server_ids;
   ulong master_id;
+  char info_file_name[FN_REFLEN + 128];
 };
 void init_master_log_pos(Master_info* mi);
 int init_master_info(Master_info* mi, const char* master_info_fname,

=== modified file 'sql/share/Makefile.am'
--- a/sql/share/Makefile.am	2010-03-25 07:26:12 +0000
+++ b/sql/share/Makefile.am	2010-05-19 13:01:45 +0000
@@ -58,6 +58,3 @@ distclean-local:
 
 # Do nothing
 link_sources:
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2010-04-01 19:34:09 +0000
+++ b/sql/slave.cc	2010-05-18 15:35:14 +0000
@@ -1802,7 +1802,8 @@ bool show_master_info(THD* thd, Master_i
                                              FN_REFLEN));
   field_list.push_back(new Item_return_int("Master_Server_Id", sizeof(ulong),
                                            MYSQL_TYPE_LONG));
-
+  field_list.push_back(new Item_empty_string("Master_Info_File",
+                                             sizeof(mi->info_file_name)));
   if (protocol->send_result_set_metadata(&field_list,
                             Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
     DBUG_RETURN(TRUE);
@@ -1950,6 +1951,7 @@ bool show_master_info(THD* thd, Master_i
     }
     // Master_Server_id
     protocol->store((uint32) mi->master_id);
+    protocol->store(mi->info_file_name, &my_charset_bin);
 
     mysql_mutex_unlock(&mi->rli.err_lock);
     mysql_mutex_unlock(&mi->err_lock);

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2010-05-07 13:57:10 +0000
+++ b/sql/sql_class.cc	2010-05-20 16:01:10 +0000
@@ -516,7 +516,7 @@ THD::THD()
   cuted_fields= 0L;
   sent_row_count= 0L;
   limit_found_rows= 0;
-  row_count_func= -1;
+  m_row_count_func= -1;
   statement_id_counter= 0UL;
   // Must be reset to handle error with THD's created for init of mysqld
   lex->current_select= 0;
@@ -808,7 +808,10 @@ MYSQL_ERROR* THD::raise_condition(uint s
     else
     {
       if (! stmt_da->is_error())
+      {
+        set_row_count_func(-1);
         stmt_da->set_error_status(this, sql_errno, msg, sqlstate);
+      }
     }
   }
 
@@ -1809,11 +1812,6 @@ bool select_to_file::send_eof()
     error= 1;
   if (!error)
   {
-    /*
-      In order to remember the value of affected rows for ROW_COUNT()
-      function, SELECT INTO has to have an own SQLCOM.
-      TODO: split from SQLCOM_SELECT
-    */
     ::my_ok(thd,row_count);
   }
   file= -1;
@@ -2834,11 +2832,6 @@ bool select_dumpvar::send_eof()
   if (! row_count)
     push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
                  ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA));
-  /*
-    In order to remember the value of affected rows for ROW_COUNT()
-    function, SELECT INTO has to have an own SQLCOM.
-    TODO: split from SQLCOM_SELECT
-  */
   ::my_ok(thd,row_count);
   return 0;
 }

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2010-05-07 10:08:23 +0000
+++ b/sql/sql_class.h	2010-05-20 16:01:10 +0000
@@ -1998,7 +1998,50 @@ public:
   }
 
   ulonglong  limit_found_rows;
-  longlong   row_count_func;    /* For the ROW_COUNT() function */
+
+private:
+  /**
+    Stores the result of ROW_COUNT() function.
+
+    ROW_COUNT() function is a MySQL extention, but we try to keep it
+    similar to ROW_COUNT member of the GET DIAGNOSTICS stack of the SQL
+    standard (see SQL99, part 2, search for ROW_COUNT). It's value is
+    implementation defined for anything except INSERT, DELETE, UPDATE.
+
+    ROW_COUNT is assigned according to the following rules:
+
+      - In my_ok():
+        - for DML statements: to the number of affected rows;
+        - for DDL statements: to 0.
+
+      - In my_eof(): to -1 to indicate that there was a result set.
+
+        We derive this semantics from the JDBC specification, where int
+        java.sql.Statement.getUpdateCount() is defined to (sic) "return the
+        current result as an update count; if the result is a ResultSet
+        object or there are no more results, -1 is returned".
+
+      - In my_error(): to -1 to be compatible with the MySQL C API and
+        MySQL ODBC driver.
+
+      - For SIGNAL statements: to 0 per WL#2110 specification (see also
+        sql_signal.cc comment). Zero is used since that's the "default"
+        value of ROW_COUNT in the diagnostics area.
+  */
+
+  longlong m_row_count_func;    /* For the ROW_COUNT() function */
+
+public:
+  inline longlong get_row_count_func() const
+  {
+    return m_row_count_func;
+  }
+
+  inline void set_row_count_func(longlong row_count_func)
+  {
+    m_row_count_func= row_count_func;
+  }
+
   ha_rows    cuted_fields;
 
   /*
@@ -2816,6 +2859,7 @@ inline void
 my_ok(THD *thd, ulonglong affected_rows= 0, ulonglong id= 0,
         const char *message= NULL)
 {
+  thd->set_row_count_func(affected_rows);
   thd->stmt_da->set_ok_status(thd, affected_rows, id, message);
 }
 
@@ -2825,6 +2869,7 @@ my_ok(THD *thd, ulonglong affected_rows=
 inline void
 my_eof(THD *thd)
 {
+  thd->set_row_count_func(-1);
   thd->stmt_da->set_eof_status(thd);
 }
 
@@ -3486,7 +3531,7 @@ public:
 /* Bits in sql_command_flags */
 
 #define CF_CHANGES_DATA           (1U << 0)
-#define CF_HAS_ROW_COUNT          (1U << 1)
+/* The 2nd bit is unused -- it used to be CF_HAS_ROW_COUNT. */
 #define CF_STATUS_COMMAND         (1U << 2)
 #define CF_SHOW_TABLE_COMMAND     (1U << 3)
 #define CF_WRITE_LOGS_COMMAND     (1U << 4)

=== modified file 'sql/sql_delete.cc'
--- a/sql/sql_delete.cc	2010-04-01 19:34:09 +0000
+++ b/sql/sql_delete.cc	2010-05-14 05:29:47 +0000
@@ -187,8 +187,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *
   if (prune_partitions(thd, table, conds))
   {
     free_underlaid_joins(thd, select_lex);
-    thd->row_count_func= 0;
-    my_ok(thd, (ha_rows) thd->row_count_func);  // No matching records
+    // No matching record
+    my_ok(thd, 0);
     DBUG_RETURN(0);
   }
 #endif
@@ -204,7 +204,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *
   {
     delete select;
     free_underlaid_joins(thd, select_lex);
-    thd->row_count_func= 0;
     /* 
       Error was already created by quick select evaluation (check_quick()).
       TODO: Add error code output parameter to Item::val_xxx() methods.
@@ -213,7 +212,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *
     */
     if (thd->is_error())
       DBUG_RETURN(TRUE);
-    my_ok(thd, (ha_rows) thd->row_count_func);
+    my_ok(thd, 0);
     /*
       We don't need to call reset_auto_increment in this case, because
       mysql_truncate always gives a NULL conds argument, hence we never
@@ -460,8 +459,7 @@ cleanup:
       If a TRUNCATE TABLE was issued, the number of rows should be reported as
       zero since the exact number is unknown.
     */
-    thd->row_count_func= reset_auto_increment ? 0 : deleted;
-    my_ok(thd, (ha_rows) thd->row_count_func);
+    my_ok(thd, reset_auto_increment ? 0 : deleted);
     DBUG_PRINT("info",("%ld records deleted",(long) deleted));
   }
   DBUG_RETURN(error >= 0 || thd->is_error());
@@ -1058,8 +1056,7 @@ bool multi_delete::send_eof()
 
   if (!local_error)
   {
-    thd->row_count_func= deleted;
-    ::my_ok(thd, (ha_rows) thd->row_count_func);
+    ::my_ok(thd, deleted);
   }
   return 0;
 }

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2010-05-07 10:08:23 +0000
+++ b/sql/sql_insert.cc	2010-05-20 16:01:10 +0000
@@ -1005,10 +1005,10 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
   if (values_list.elements == 1 && (!(thd->variables.option_bits & OPTION_WARNINGS) ||
 				    !thd->cuted_fields))
   {
-    thd->row_count_func= info.copied + info.deleted +
-                         ((thd->client_capabilities & CLIENT_FOUND_ROWS) ?
-                          info.touched : info.updated);
-    my_ok(thd, (ulong) thd->row_count_func, id);
+    my_ok(thd, info.copied + info.deleted +
+               ((thd->client_capabilities & CLIENT_FOUND_ROWS) ?
+                info.touched : info.updated),
+          id);
   }
   else
   {
@@ -1024,8 +1024,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
       sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
 	      (ulong) (info.deleted + updated),
               (ulong) thd->warning_info->statement_warn_count());
-    thd->row_count_func= info.copied + info.deleted + updated;
-    ::my_ok(thd, (ulong) thd->row_count_func, id, buff);
+    ::my_ok(thd, info.copied + info.deleted + updated, id, buff);
   }
   thd->abort_on_warning= 0;
   DBUG_RETURN(FALSE);
@@ -3337,7 +3336,7 @@ bool select_insert::send_eof()
 {
   int error;
   bool const trans_table= table->file->has_transactions();
-  ulonglong id;
+  ulonglong id, row_count;
   bool changed;
   THD::killed_state killed_status= thd->killed;
   DBUG_ENTER("select_insert::send_eof");
@@ -3403,16 +3402,15 @@ bool select_insert::send_eof()
     sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
 	    (ulong) (info.deleted+info.updated),
             (ulong) thd->warning_info->statement_warn_count());
-  thd->row_count_func= info.copied + info.deleted +
-                       ((thd->client_capabilities & CLIENT_FOUND_ROWS) ?
-                        info.touched : info.updated);
-
+  row_count= info.copied + info.deleted +
+             ((thd->client_capabilities & CLIENT_FOUND_ROWS) ?
+              info.touched : info.updated);
   id= (thd->first_successful_insert_id_in_cur_stmt > 0) ?
     thd->first_successful_insert_id_in_cur_stmt :
     (thd->arg_of_last_insert_id_function ?
      thd->first_successful_insert_id_in_prev_stmt :
      (info.copied ? autoinc_value_of_last_inserted_row : 0));
-  ::my_ok(thd, (ulong) thd->row_count_func, id, buff);
+  ::my_ok(thd, row_count, id, buff);
   DBUG_RETURN(0);
 }
 

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2010-04-19 15:12:28 +0000
+++ b/sql/sql_lex.cc	2010-05-14 18:38:28 +0000
@@ -142,37 +142,64 @@ st_parsing_options::reset()
   allows_derived= TRUE;
 }
 
+
+/**
+  Perform initialization of Lex_input_stream instance.
+
+  Basically, a buffer for pre-processed query. This buffer should be large
+  enough to keep multi-statement query. The allocation is done once in the
+  Lex_input_stream constructor in order to prevent memory pollution when
+  the server is processing large multi-statement queries.
+
+  @todo Check return value of THD::alloc().
+*/
+
 Lex_input_stream::Lex_input_stream(THD *thd,
                                    const char* buffer,
                                    unsigned int length)
-: m_thd(thd),
-  yylineno(1),
-  yytoklen(0),
-  yylval(NULL),
-  lookahead_token(-1),
-  lookahead_yylval(NULL),
-  m_ptr(buffer),
-  m_tok_start(NULL),
-  m_tok_end(NULL),
-  m_end_of_query(buffer + length),
-  m_tok_start_prev(NULL),
-  m_buf(buffer),
-  m_buf_length(length),
-  m_echo(TRUE),
-  m_cpp_tok_start(NULL),
-  m_cpp_tok_start_prev(NULL),
-  m_cpp_tok_end(NULL),
-  m_body_utf8(NULL),
-  m_cpp_utf8_processed_ptr(NULL),
-  next_state(MY_LEX_START),
-  found_semicolon(NULL),
-  ignore_space(test(thd->variables.sql_mode & MODE_IGNORE_SPACE)),
-  stmt_prepare_mode(FALSE),
-  multi_statements(TRUE),
-  in_comment(NO_COMMENT),
-  m_underscore_cs(NULL)
+  :m_thd(thd)
 {
   m_cpp_buf= (char*) thd->alloc(length + 1);
+  reset(buffer, length);
+}
+
+
+/**
+  Prepare Lex_input_stream instance state for use for handling next SQL statement.
+
+  It should be called between two statements in a multi-statement query.
+  The operation resets the input stream to the beginning-of-parse state,
+  but does not reallocate m_cpp_buf.
+*/
+
+void
+Lex_input_stream::reset(const char *buffer, unsigned int length)
+{
+  yylineno= 1;
+  yytoklen= 0;
+  yylval= NULL;
+  lookahead_token= -1;
+  lookahead_yylval= NULL;
+  m_ptr= buffer;
+  m_tok_start= NULL;
+  m_tok_end= NULL;
+  m_end_of_query= buffer + length;
+  m_tok_start_prev= NULL;
+  m_buf= buffer;
+  m_buf_length= length;
+  m_echo= TRUE;
+  m_cpp_tok_start= NULL;
+  m_cpp_tok_start_prev= NULL;
+  m_cpp_tok_end= NULL;
+  m_body_utf8= NULL;
+  m_cpp_utf8_processed_ptr= NULL;
+  next_state= MY_LEX_START;
+  found_semicolon= NULL;
+  ignore_space= test(m_thd->variables.sql_mode & MODE_IGNORE_SPACE);
+  stmt_prepare_mode= FALSE;
+  multi_statements= TRUE;
+  in_comment=NO_COMMENT;
+  m_underscore_cs= NULL;
   m_cpp_ptr= m_cpp_buf;
 }
 

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2010-04-19 15:12:28 +0000
+++ b/sql/sql_lex.h	2010-05-14 18:38:28 +0000
@@ -1378,6 +1378,8 @@ public:
   Lex_input_stream(THD *thd, const char* buff, unsigned int length);
   ~Lex_input_stream();
 
+  void reset(const char *buff, unsigned int length);
+
   /**
     Set the echo mode.
 
@@ -2207,8 +2209,8 @@ struct LEX: public Query_tables_list
 class Set_signal_information
 {
 public:
-  /** Constructor. */
-  Set_signal_information();
+  /** Empty default constructor, use clear() */
+ Set_signal_information() {} 
 
   /** Copy constructor. */
   Set_signal_information(const Set_signal_information& set);
@@ -2221,7 +2223,7 @@ public:
   void clear();
 
   /**
-    For each contition item assignment, m_item[] contains the parsed tree
+    For each condition item assignment, m_item[] contains the parsed tree
     that represents the expression assigned, if any.
     m_item[] is an array indexed by Diag_condition_item_name.
   */
@@ -2238,8 +2240,16 @@ class Yacc_state
 {
 public:
   Yacc_state()
-    : yacc_yyss(NULL), yacc_yyvs(NULL)
-  {}
+  {
+    reset();
+  }
+
+  void reset()
+  {
+    yacc_yyss= NULL;
+    yacc_yyvs= NULL;
+    m_set_signal_info.clear();
+  }
 
   ~Yacc_state();
 
@@ -2284,6 +2294,12 @@ public:
 
   Lex_input_stream m_lip;
   Yacc_state m_yacc;
+
+  void reset(const char *found_semicolon, unsigned int length)
+  {
+    m_lip.reset(found_semicolon, length);
+    m_yacc.reset();
+  }
 };
 
 

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2010-05-07 10:08:23 +0000
+++ b/sql/sql_parse.cc	2010-05-20 16:01:10 +0000
@@ -274,22 +274,20 @@ void init_update_queries(void)
   sql_command_flags[SQLCOM_CREATE_TRIGGER]= CF_AUTO_COMMIT_TRANS;
   sql_command_flags[SQLCOM_DROP_TRIGGER]=   CF_AUTO_COMMIT_TRANS;
 
-  sql_command_flags[SQLCOM_UPDATE]=	    CF_CHANGES_DATA | CF_HAS_ROW_COUNT |
-                                            CF_REEXECUTION_FRAGILE | CF_PROTECT_AGAINST_GRL;
-  sql_command_flags[SQLCOM_UPDATE_MULTI]=   CF_CHANGES_DATA | CF_HAS_ROW_COUNT |
-                                            CF_REEXECUTION_FRAGILE | CF_PROTECT_AGAINST_GRL;
-  sql_command_flags[SQLCOM_INSERT]=	    CF_CHANGES_DATA | CF_HAS_ROW_COUNT |
-                                            CF_REEXECUTION_FRAGILE | CF_PROTECT_AGAINST_GRL;
-  sql_command_flags[SQLCOM_INSERT_SELECT]=  CF_CHANGES_DATA | CF_HAS_ROW_COUNT |
-                                            CF_REEXECUTION_FRAGILE | CF_PROTECT_AGAINST_GRL;
-  sql_command_flags[SQLCOM_DELETE]=         CF_CHANGES_DATA | CF_HAS_ROW_COUNT |
-                                            CF_REEXECUTION_FRAGILE | CF_PROTECT_AGAINST_GRL;
-  sql_command_flags[SQLCOM_DELETE_MULTI]=   CF_CHANGES_DATA | CF_HAS_ROW_COUNT |
-                                            CF_REEXECUTION_FRAGILE | CF_PROTECT_AGAINST_GRL;
-  sql_command_flags[SQLCOM_REPLACE]=        CF_CHANGES_DATA | CF_HAS_ROW_COUNT |
-                                            CF_REEXECUTION_FRAGILE;
-  sql_command_flags[SQLCOM_REPLACE_SELECT]= CF_CHANGES_DATA | CF_HAS_ROW_COUNT |
-                                            CF_REEXECUTION_FRAGILE;
+  sql_command_flags[SQLCOM_UPDATE]=	    CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
+                                            CF_PROTECT_AGAINST_GRL;
+  sql_command_flags[SQLCOM_UPDATE_MULTI]=   CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
+                                            CF_PROTECT_AGAINST_GRL;
+  sql_command_flags[SQLCOM_INSERT]=	    CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
+                                            CF_PROTECT_AGAINST_GRL;
+  sql_command_flags[SQLCOM_INSERT_SELECT]=  CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
+                                            CF_PROTECT_AGAINST_GRL;
+  sql_command_flags[SQLCOM_DELETE]=         CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
+                                            CF_PROTECT_AGAINST_GRL;
+  sql_command_flags[SQLCOM_DELETE_MULTI]=   CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
+                                            CF_PROTECT_AGAINST_GRL;
+  sql_command_flags[SQLCOM_REPLACE]=        CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE;
+  sql_command_flags[SQLCOM_REPLACE_SELECT]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE;
   sql_command_flags[SQLCOM_SELECT]=         CF_REEXECUTION_FRAGILE;
   sql_command_flags[SQLCOM_SET_OPTION]=     CF_REEXECUTION_FRAGILE | CF_AUTO_COMMIT_TRANS;
   sql_command_flags[SQLCOM_DO]=             CF_REEXECUTION_FRAGILE;
@@ -367,8 +365,7 @@ void init_update_queries(void)
     last called (or executed) statement is preserved.
     See mysql_execute_command() for how CF_ROW_COUNT is used.
   */
-  sql_command_flags[SQLCOM_CALL]=      CF_HAS_ROW_COUNT | CF_REEXECUTION_FRAGILE;
-  sql_command_flags[SQLCOM_EXECUTE]=   CF_HAS_ROW_COUNT;
+  sql_command_flags[SQLCOM_CALL]=      CF_REEXECUTION_FRAGILE;
 
   /*
     The following admin table operations are allowed
@@ -461,7 +458,6 @@ static void handle_bootstrap_impl(THD *t
 {
   MYSQL_FILE *file= bootstrap_file;
   char *buff;
-  const char* found_semicolon= NULL;
 
   DBUG_ENTER("handle_bootstrap");
 
@@ -534,7 +530,8 @@ static void handle_bootstrap_impl(THD *t
       mode we have only one thread.
     */
     thd->set_time();
-    mysql_parse(thd, thd->query(), length, & found_semicolon);
+    Parser_state parser_state(thd, thd->query(), length);
+    mysql_parse(thd, thd->query(), length, &parser_state);
     close_thread_tables(thd);			// Free tables
 
     bootstrap_error= thd->is_error();
@@ -1077,19 +1074,21 @@ bool dispatch_command(enum enum_server_c
                       (char *) thd->security_ctx->host_or_ip);
     char *packet_end= thd->query() + thd->query_length();
     /* 'b' stands for 'buffer' parameter', special for 'my_snprintf' */
-    const char* end_of_stmt= NULL;
 
     general_log_write(thd, command, thd->query(), thd->query_length());
     DBUG_PRINT("query",("%-.4096s",thd->query()));
 #if defined(ENABLED_PROFILING)
     thd->profiling.set_query_source(thd->query(), thd->query_length());
 #endif
+    Parser_state parser_state(thd, thd->query(), thd->query_length());
 
-    mysql_parse(thd, thd->query(), thd->query_length(), &end_of_stmt);
+    mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
 
-    while (!thd->killed && (end_of_stmt != NULL) && ! thd->is_error())
+    while (!thd->killed && (parser_state.m_lip.found_semicolon != NULL) &&
+           ! thd->is_error())
     {
-      char *beginning_of_next_stmt= (char*) end_of_stmt;
+      char *beginning_of_next_stmt= (char*)
+        parser_state.m_lip.found_semicolon;
 
       thd->protocol->end_statement();
       query_cache_end_of_result(thd);
@@ -1130,8 +1129,9 @@ bool dispatch_command(enum enum_server_c
       */
       statistic_increment(thd->status_var.questions, &LOCK_status);
       thd->set_time(); /* Reset the query start time. */
+      parser_state.reset(beginning_of_next_stmt, length);
       /* TODO: set thd->lex->sql_command to SQLCOM_END here */
-      mysql_parse(thd, beginning_of_next_stmt, length, &end_of_stmt);
+      mysql_parse(thd, beginning_of_next_stmt, length, &parser_state);
     }
 
     DBUG_PRINT("info",("query ready"));
@@ -3184,7 +3184,7 @@ end_with_restore_list:
     res= mysql_insert(thd, all_tables, lex->field_list, lex->many_values,
 		      lex->update_list, lex->value_list,
                       lex->duplicates, lex->ignore);
-    MYSQL_INSERT_DONE(res, (ulong) thd->row_count_func);
+    MYSQL_INSERT_DONE(res, (ulong) thd->get_row_count_func());
     /*
       If we have inserted into a VIEW, and the base table has
       AUTO_INCREMENT column, but this column is not accessible through
@@ -3250,7 +3250,7 @@ end_with_restore_list:
         delete sel_result;
       }
       /* revert changes for SP */
-      MYSQL_INSERT_SELECT_DONE(res, (ulong) thd->row_count_func);
+      MYSQL_INSERT_SELECT_DONE(res, (ulong) thd->get_row_count_func());
       select_lex->table_list.first= (uchar*) first_table;
     }
     /*
@@ -3296,7 +3296,7 @@ end_with_restore_list:
                        &select_lex->order_list,
                        unit->select_limit_cnt, select_lex->options,
                        FALSE);
-    MYSQL_DELETE_DONE(res, (ulong) thd->row_count_func);
+    MYSQL_DELETE_DONE(res, (ulong) thd->get_row_count_func());
     break;
   }
   case SQLCOM_DELETE_MULTI:
@@ -4299,8 +4299,9 @@ create_sp_error:
         thd->server_status&= ~bits_to_be_cleared;
 
 	if (!res)
-          my_ok(thd, (ulong) (thd->row_count_func < 0 ? 0 :
-                              thd->row_count_func));
+        {
+          my_ok(thd, (thd->get_row_count_func() < 0) ? 0 : thd->get_row_count_func());
+        }
 	else
         {
           DBUG_ASSERT(thd->is_error() || thd->killed);
@@ -4687,15 +4688,6 @@ create_sp_error:
   if (thd->one_shot_set && lex->sql_command != SQLCOM_SET_OPTION)
     reset_one_shot_variables(thd);
 
-  /*
-    The return value for ROW_COUNT() is "implementation dependent" if the
-    statement is not DELETE, INSERT or UPDATE, but -1 is what JDBC and ODBC
-    wants. We also keep the last value in case of SQLCOM_CALL or
-    SQLCOM_EXECUTE.
-  */
-  if (!(sql_command_flags[lex->sql_command] & CF_HAS_ROW_COUNT))
-    thd->row_count_func= -1;
-
   goto finish;
 
 error:
@@ -5732,7 +5724,7 @@ void mysql_init_multi_delete(LEX *lex)
 */
 
 void mysql_parse(THD *thd, const char *inBuf, uint length,
-                 const char ** found_semicolon)
+                 Parser_state *parser_state)
 {
   int error;
   DBUG_ENTER("mysql_parse");
@@ -5762,10 +5754,7 @@ void mysql_parse(THD *thd, const char *i
   {
     LEX *lex= thd->lex;
 
-    Parser_state parser_state(thd, inBuf, length);
-
-    bool err= parse_sql(thd, & parser_state, NULL);
-    *found_semicolon= parser_state.m_lip.found_semicolon;
+    bool err= parse_sql(thd, parser_state, NULL);
 
     if (!err)
     {
@@ -5780,6 +5769,7 @@ void mysql_parse(THD *thd, const char *i
       {
 	if (! thd->is_error())
 	{
+          const char *found_semicolon= parser_state->m_lip.found_semicolon;
           /*
             Binlog logs a string starting from thd->query and having length
             thd->query_length; so we set thd->query_length correctly (to not
@@ -5790,12 +5780,12 @@ void mysql_parse(THD *thd, const char *i
             PROCESSLIST.
             Note that we don't need LOCK_thread_count to modify query_length.
           */
-          if (*found_semicolon && (ulong) (*found_semicolon - thd->query()))
+          if (found_semicolon && (ulong) (found_semicolon - thd->query()))
             thd->set_query_inner(thd->query(),
-                                 (uint32) (*found_semicolon -
+                                 (uint32) (found_semicolon -
                                            thd->query() - 1));
           /* Actually execute the query */
-          if (*found_semicolon)
+          if (found_semicolon)
           {
             lex->safe_to_cache_query= 0;
             thd->server_status|= SERVER_MORE_RESULTS_EXISTS;
@@ -5832,11 +5822,6 @@ void mysql_parse(THD *thd, const char *i
     thd->cleanup_after_query();
     DBUG_ASSERT(thd->change_list.is_empty());
   }
-  else
-  {
-    /* There are no multi queries in the cache. */
-    *found_semicolon= NULL;
-  }
 
   DBUG_VOID_RETURN;
 }

=== modified file 'sql/sql_parse.h'
--- a/sql/sql_parse.h	2010-04-12 13:17:37 +0000
+++ b/sql/sql_parse.h	2010-05-14 18:11:25 +0000
@@ -84,7 +84,7 @@ bool is_log_table_write_query(enum enum_
 bool alloc_query(THD *thd, const char *packet, uint packet_length);
 void mysql_init_select(LEX *lex);
 void mysql_parse(THD *thd, const char *inBuf, uint length,
-                 const char ** semicolon);
+                 Parser_state *parser_state);
 void mysql_reset_thd_for_next_command(THD *thd);
 bool mysql_new_select(LEX *lex, bool move_down);
 void create_select_for_variable(const char *var_name);

=== modified file 'sql/sql_signal.cc'
--- a/sql/sql_signal.cc	2010-03-31 14:05:33 +0000
+++ b/sql/sql_signal.cc	2010-05-14 18:11:25 +0000
@@ -75,10 +75,6 @@ const LEX_STRING Diag_statement_item_nam
   { C_STRING_WITH_LEN("TRANSACTION_ACTIVE") }
 };
 
-Set_signal_information::Set_signal_information()
-{
-  clear();
-}
 
 Set_signal_information::Set_signal_information(
   const Set_signal_information& set)
@@ -458,8 +454,20 @@ bool Signal_statement::execute(THD *thd)
 
   DBUG_ENTER("Signal_statement::execute");
 
+  /*
+    WL#2110 SIGNAL specification says:
+
+      When SIGNAL is executed, it has five effects, in the following order:
+
+        (1) First, the diagnostics area is completely cleared. So if the
+        SIGNAL is in a DECLARE HANDLER then any pending errors or warnings
+        are gone. So is 'row count'.
+
+    This has roots in the SQL standard specification for SIGNAL.
+  */
+
   thd->stmt_da->reset_diagnostics_area();
-  thd->row_count_func= 0;
+  thd->set_row_count_func(0);
   thd->warning_info->clear_warning_info(thd->query_id);
 
   result= raise_condition(thd, &cond);

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2010-04-21 07:35:37 +0000
+++ b/sql/sql_update.cc	2010-05-14 05:29:47 +0000
@@ -843,9 +843,8 @@ int mysql_update(THD *thd,
     my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO), (ulong) found,
                 (ulong) updated,
                 (ulong) thd->warning_info->statement_warn_count());
-    thd->row_count_func=
-      (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
-    my_ok(thd, (ulong) thd->row_count_func, id, buff);
+    my_ok(thd, (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated,
+          id, buff);
     DBUG_PRINT("info",("%ld records updated", (long) updated));
   }
   thd->count_cuted_fields= CHECK_FIELD_IGNORE;		/* calc cuted fields */
@@ -2150,8 +2149,7 @@ bool multi_update::send_eof()
     thd->first_successful_insert_id_in_prev_stmt : 0;
   my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO),
               (ulong) found, (ulong) updated, (ulong) thd->cuted_fields);
-  thd->row_count_func=
-    (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
-  ::my_ok(thd, (ulong) thd->row_count_func, id, buff);
+  ::my_ok(thd, (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated,
+          id, buff);
   DBUG_RETURN(FALSE);
 }

=== modified file 'storage/Makefile.am'
--- a/storage/Makefile.am	2009-11-09 11:32:48 +0000
+++ b/storage/Makefile.am	2010-05-19 13:00:23 +0000
@@ -20,6 +20,3 @@ AUTOMAKE_OPTIONS =	foreign
 # These are built from source in the Docs directory
 SUBDIRS = @mysql_se_dirs@
 DIST_SUBDIRS = @mysql_se_distdirs@
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/archive/Makefile.am'
--- a/storage/archive/Makefile.am	2010-04-27 08:29:51 +0000
+++ b/storage/archive/Makefile.am	2010-05-19 13:01:45 +0000
@@ -102,6 +102,3 @@ probes_mysql.o: $(DTRACEPROVIDER) $(DTRA
 	$(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
 
 endif
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/blackhole/Makefile.am'
--- a/storage/blackhole/Makefile.am	2010-04-27 08:29:51 +0000
+++ b/storage/blackhole/Makefile.am	2010-05-19 13:01:45 +0000
@@ -83,6 +83,3 @@ probes_mysql.o: $(DTRACEPROVIDER) $(DTRA
 	$(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
 
 endif
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/csv/Makefile.am'
--- a/storage/csv/Makefile.am	2009-04-05 20:18:21 +0000
+++ b/storage/csv/Makefile.am	2010-05-19 13:00:23 +0000
@@ -62,6 +62,3 @@ probes_mysql.d:
 probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
 	$(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
 endif
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/example/Makefile.am'
--- a/storage/example/Makefile.am	2010-04-27 08:29:51 +0000
+++ b/storage/example/Makefile.am	2010-05-19 13:01:45 +0000
@@ -83,6 +83,3 @@ probes_mysql.o: $(DTRACEPROVIDER) $(DTRA
 	$(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
 
 endif
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/federated/Makefile.am'
--- a/storage/federated/Makefile.am	2010-05-05 07:35:38 +0000
+++ b/storage/federated/Makefile.am	2010-05-19 13:00:23 +0000
@@ -84,6 +84,3 @@ probes_mysql.o: $(DTRACEPROVIDER) $(DTRA
 	$(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
 
 endif
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/heap/Makefile.am'
--- a/storage/heap/Makefile.am	2009-04-05 20:18:21 +0000
+++ b/storage/heap/Makefile.am	2010-05-19 13:00:23 +0000
@@ -71,6 +71,3 @@ probes_mysql.d:
 probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
 	$(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
 endif
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ibmdb2i/Makefile.am'
--- a/storage/ibmdb2i/Makefile.am	2009-04-01 20:18:49 +0000
+++ b/storage/ibmdb2i/Makefile.am	2010-05-19 13:00:23 +0000
@@ -50,5 +50,3 @@ libibmdb2i_a_SOURCES=	$(ha_ibmdb2i_la_SO
 
 
 EXTRA_DIST =		CMakeLists.txt plug.in
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/innobase/Makefile.am'
--- a/storage/innobase/Makefile.am	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/Makefile.am	2010-05-19 13:00:23 +0000
@@ -337,6 +337,3 @@ ha_innodb_la_SOURCES=	$(libinnobase_a_SO
 EXTRA_DIST=		CMakeLists.txt plug.in \
 			pars/make_bison.sh pars/make_flex.sh \
 			pars/pars0grm.y pars/pars0lex.l
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/myisam/Makefile.am'
--- a/storage/myisam/Makefile.am	2009-11-25 12:25:01 +0000
+++ b/storage/myisam/Makefile.am	2010-05-19 13:00:23 +0000
@@ -170,6 +170,3 @@ probes_mysql.d:
 probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
 	$(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
 endif
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/myisammrg/Makefile.am'
--- a/storage/myisammrg/Makefile.am	2009-04-05 20:18:21 +0000
+++ b/storage/myisammrg/Makefile.am	2010-05-19 13:00:23 +0000
@@ -60,6 +60,3 @@ probes_mysql.d:
 probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
 	$(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
 endif
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/Makefile.am'
--- a/storage/ndb/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/Makefile.am	2010-05-19 13:00:23 +0000
@@ -44,6 +44,3 @@ all-windoze-dsp: windoze
 	find . -name '*.dsp' | grep -v SCCS | xargs unix2dos
 	$(top_srcdir)/storage/ndb/config/make-win-dsw.sh | unix2dos > ndb.dsw
 	tar cvfz ndb-win-dsp.tar.gz ndb.dsw `find . -name '*.dsp' | grep -v SCCS`
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/docs/Makefile.am'
--- a/storage/ndb/docs/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/docs/Makefile.am	2010-05-19 13:00:23 +0000
@@ -127,6 +127,3 @@ testdoc: DUMMY
 	cd $(top_srcdir)/storage/ndb ; $(DOXYGEN) $(DOXYDIR)/Doxyfile.test
 
 windoze-dsp:
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/include/Makefile.am'
--- a/storage/ndb/include/Makefile.am	2007-06-14 10:57:32 +0000
+++ b/storage/ndb/include/Makefile.am	2010-05-19 13:00:23 +0000
@@ -63,6 +63,3 @@ dist-hook:
 	-rm -rf `find $(distdir) -type d -name SCCS`
 
 windoze-dsp:
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/src/Makefile.am'
--- a/storage/ndb/src/Makefile.am	2007-01-20 00:58:03 +0000
+++ b/storage/ndb/src/Makefile.am	2010-05-19 13:00:23 +0000
@@ -48,6 +48,3 @@ libndbclient.dsp: Makefile \
 	@$(top_srcdir)/storage/ndb/config/win-sources $@ dummy.cpp
 	@$(top_srcdir)/storage/ndb/config/win-libraries $@ LIB $(libndbclient_la_LIBADD)
 	@touch dummy.cpp
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/src/common/Makefile.am'
--- a/storage/ndb/src/common/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/common/Makefile.am	2010-05-19 13:00:23 +0000
@@ -28,6 +28,3 @@ libcommon_la_LIBADD = \
               util/libgeneral.la 
 
 windoze-dsp:
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/src/common/debugger/Makefile.am'
--- a/storage/ndb/src/common/debugger/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/common/debugger/Makefile.am	2010-05-19 13:00:23 +0000
@@ -22,9 +22,6 @@ libtrace_la_SOURCES = SignalLoggerManage
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: libtrace.dsp
 
 libtrace.dsp: Makefile \

=== modified file 'storage/ndb/src/common/debugger/signaldata/Makefile.am'
--- a/storage/ndb/src/common/debugger/signaldata/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/common/debugger/signaldata/Makefile.am	2010-05-19 13:00:23 +0000
@@ -43,9 +43,6 @@ libsignaldataprint_la_SOURCES = \
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_ndbapi.mk.am
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: libsignaldataprint.dsp
 
 libsignaldataprint.dsp: Makefile \

=== modified file 'storage/ndb/src/common/logger/Makefile.am'
--- a/storage/ndb/src/common/logger/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/common/logger/Makefile.am	2010-05-19 13:00:23 +0000
@@ -22,8 +22,6 @@ liblogger_la_SOURCES = $(SOURCE_WIN) Sys
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_ndbapi.mk.am
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
 windoze-dsp: liblogger.dsp
 
 liblogger.dsp: Makefile \

=== modified file 'storage/ndb/src/common/mgmcommon/Makefile.am'
--- a/storage/ndb/src/common/mgmcommon/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/common/mgmcommon/Makefile.am	2010-05-19 13:00:23 +0000
@@ -25,9 +25,6 @@ include $(top_srcdir)/storage/ndb/config
 include $(top_srcdir)/storage/ndb/config/type_ndbapi.mk.am
 include $(top_srcdir)/storage/ndb/config/type_mgmapiclient.mk.am
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: libmgmsrvcommon.dsp
 
 libmgmsrvcommon.dsp: Makefile \

=== modified file 'storage/ndb/src/common/portlib/Makefile.am'
--- a/storage/ndb/src/common/portlib/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/common/portlib/Makefile.am	2010-05-19 13:00:23 +0000
@@ -29,7 +29,6 @@ EXTRA_PROGRAMS = memtest PortLibTest mun
 PortLibTest_SOURCES = NdbPortLibTest.cpp
 munmaptest_SOURCES = munmaptest.cpp
 
-# Don't update the files from bitkeeper
 WIN_src = win32/NdbCondition.c \
               win32/NdbDaemon.c \
               win32/NdbEnv.c \
@@ -54,6 +53,3 @@ libportlib.dsp: Makefile \
 	@$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
 	@$(top_srcdir)/storage/ndb/config/win-sources $@ $(WIN_src)
 	@$(top_srcdir)/storage/ndb/config/win-libraries $@ LIB $(LDADD)
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/src/common/transporter/Makefile.am'
--- a/storage/ndb/src/common/transporter/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/common/transporter/Makefile.am	2010-05-19 13:00:23 +0000
@@ -32,9 +32,6 @@ INCLUDES_LOC = -I$(top_srcdir)/storage/n
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_util.mk.am
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: libtransporter.dsp
 
 libtransporter.dsp: Makefile \

=== modified file 'storage/ndb/src/common/util/Makefile.am'
--- a/storage/ndb/src/common/util/Makefile.am	2010-03-25 07:26:12 +0000
+++ b/storage/ndb/src/common/util/Makefile.am	2010-05-19 13:01:45 +0000
@@ -46,9 +46,6 @@ testBitmask.o:	$(testBitmask_SOURCES)
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_util.mk.am
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: libgeneral.dsp
 
 libgeneral.dsp: Makefile \

=== modified file 'storage/ndb/src/cw/Makefile.am'
--- a/storage/ndb/src/cw/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/cw/Makefile.am	2010-05-19 13:00:23 +0000
@@ -16,6 +16,3 @@
 SUBDIRS = cpcd
 
 windoze-dsp:
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/src/cw/cpcd/Makefile.am'
--- a/storage/ndb/src/cw/cpcd/Makefile.am	2007-02-13 01:38:54 +0000
+++ b/storage/ndb/src/cw/cpcd/Makefile.am	2010-05-19 13:00:23 +0000
@@ -28,7 +28,4 @@ include $(top_srcdir)/storage/ndb/config
 
 ndb_cpcd_LDFLAGS = -static @ndb_bin_am_ldflags@
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp:

=== modified file 'storage/ndb/src/kernel/Makefile.am'
--- a/storage/ndb/src/kernel/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/Makefile.am	2010-05-19 13:00:23 +0000
@@ -70,6 +70,3 @@ storage/ndbd.dsp: Makefile \
 	@$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
 	@$(top_srcdir)/storage/ndb/config/win-sources $@ $(ndbd_SOURCES)
 	@$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/src/kernel/blocks/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/blocks/Makefile.am	2010-05-19 13:00:23 +0000
@@ -64,10 +64,4 @@ ndb_print_file_LDFLAGS = @ndb_bin_am_ldf
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp:
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/src/kernel/blocks/backup/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/backup/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/blocks/backup/Makefile.am	2010-05-19 13:00:23 +0000
@@ -23,7 +23,3 @@ ndb_print_backup_file_LDFLAGS = @ndb_bin
 
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/dbdict/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Makefile.am	2010-05-19 13:00:23 +0000
@@ -30,6 +30,3 @@ ndb_print_schema_file_LDFLAGS = @ndb_bin
          $(top_builddir)/dbug/libdbug.a \
          $(top_builddir)/mysys/libmysys.a \
          $(top_builddir)/strings/libmystrings.a
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/dbdih/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/Makefile.am	2010-05-19 13:00:23 +0000
@@ -24,6 +24,3 @@ ndb_print_sys_file_LDFLAGS = @ndb_bin_am
 
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/dblqh/Makefile.am	2007-05-29 21:39:57 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/Makefile.am	2010-05-19 13:00:23 +0000
@@ -26,6 +26,3 @@ ndbd_redo_log_reader_LDFLAGS = @ndb_bin_
          $(top_builddir)/dbug/libdbug.a \
          $(top_builddir)/mysys/libmysys.a \
          $(top_builddir)/strings/libmystrings.a
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/dbtup/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/Makefile.am	2010-05-19 13:00:23 +0000
@@ -23,6 +23,3 @@ test_varpage_LDFLAGS = @ndb_bin_am_ldfla
   $(top_builddir)/mysys/libmysys.a \
   $(top_builddir)/dbug/libdbug.a \
   $(top_builddir)/strings/libmystrings.a
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/src/kernel/error/Makefile.am'
--- a/storage/ndb/src/kernel/error/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/error/Makefile.am	2010-05-19 13:00:23 +0000
@@ -22,9 +22,6 @@ liberror_a_SOURCES = TimeModule.cpp \
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: liberror.dsp
 
 liberror.dsp: Makefile \

=== modified file 'storage/ndb/src/kernel/vm/Makefile.am'
--- a/storage/ndb/src/kernel/vm/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/vm/Makefile.am	2010-05-19 13:00:23 +0000
@@ -43,9 +43,6 @@ INCLUDES_LOC = -I$(top_srcdir)/storage/n
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: libkernel.dsp
 
 libkernel.dsp: Makefile \

=== modified file 'storage/ndb/src/mgmapi/Makefile.am'
--- a/storage/ndb/src/mgmapi/Makefile.am	2007-04-13 09:33:08 +0000
+++ b/storage/ndb/src/mgmapi/Makefile.am	2010-05-19 13:00:23 +0000
@@ -29,9 +29,6 @@ include $(top_srcdir)/storage/ndb/config
 
 #ndbtest_PROGRAMS = ndb_test_mgmapi
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: libmgmapi.dsp
 
 libmgmapi.dsp: Makefile \

=== modified file 'storage/ndb/src/mgmclient/Makefile.am'
--- a/storage/ndb/src/mgmclient/Makefile.am	2007-08-01 07:24:01 +0000
+++ b/storage/ndb/src/mgmclient/Makefile.am	2010-05-19 13:00:23 +0000
@@ -44,9 +44,6 @@ LDADD_LOC = $(noinst_LTLIBRARIES) \
 
 ndb_mgm_LDFLAGS = @ndb_bin_am_ldflags@
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: ndb_mgm.dsp libndbmgmclient.dsp
 
 ndb_mgm.dsp: Makefile \

=== modified file 'storage/ndb/src/mgmsrv/Makefile.am'
--- a/storage/ndb/src/mgmsrv/Makefile.am	2009-07-31 19:28:15 +0000
+++ b/storage/ndb/src/mgmsrv/Makefile.am	2010-05-19 13:00:23 +0000
@@ -57,9 +57,6 @@ include $(top_srcdir)/storage/ndb/config
 
 ndb_mgmd_LDFLAGS = @ndb_bin_am_ldflags@
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: ndb_mgmd.dsp
 
 ndb_mgmd.dsp: Makefile \

=== modified file 'storage/ndb/src/ndbapi/Makefile.am'
--- a/storage/ndb/src/ndbapi/Makefile.am	2007-04-11 13:51:09 +0000
+++ b/storage/ndb/src/ndbapi/Makefile.am	2010-05-19 13:00:23 +0000
@@ -71,9 +71,6 @@ ndberror_check_LDFLAGS = \
          $(top_builddir)/mysys/libmysys.a \
          $(top_builddir)/strings/libmystrings.a
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: libndbapi.dsp
 
 libndbapi.dsp: Makefile \

=== modified file 'storage/ndb/test/Makefile.am'
--- a/storage/ndb/test/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/test/Makefile.am	2010-05-19 13:00:23 +0000
@@ -21,6 +21,3 @@ dist-hook:
 	-rm -rf `find $(distdir) -type d -name SCCS`
 
 windoze-dsp:
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'storage/ndb/test/ndbapi/Makefile.am'
--- a/storage/ndb/test/ndbapi/Makefile.am	2008-01-18 21:55:02 +0000
+++ b/storage/ndb/test/ndbapi/Makefile.am	2010-05-19 13:00:23 +0000
@@ -125,11 +125,6 @@ testBackup_LDADD = $(LDADD) bank/libbank
 testSRBank_LDADD = bank/libbank.a $(LDADD) 
 NdbRepStress_LDADD = $(LDADD) $(top_builddir)/libmysql_r/libmysqlclient_r.la
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
-
-
 windoze-dsp: flexBench.dsp testBasic.dsp testBlobs.dsp \
              testScan.dsp
 

=== modified file 'storage/ndb/test/ndbapi/bank/Makefile.am'
--- a/storage/ndb/test/ndbapi/bank/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/test/ndbapi/bank/Makefile.am	2010-05-19 13:00:23 +0000
@@ -32,7 +32,4 @@ LDADD_LOC = $(noinst_LIBRARIES)
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_ndbapitest.mk.am
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp:

=== modified file 'storage/ndb/test/run-test/Makefile.am'
--- a/storage/ndb/test/run-test/Makefile.am	2009-10-13 18:21:42 +0000
+++ b/storage/ndb/test/run-test/Makefile.am	2010-05-19 13:00:23 +0000
@@ -51,7 +51,4 @@ wrappers_SCRIPTS=atrt-testBackup atrt-my
 
 EXTRA_DIST = $(test_DATA) $(test_SCRIPTS) $(wrappers_SCRIPTS) README.ATRT atrt.hpp
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp:

=== modified file 'storage/ndb/test/src/Makefile.am'
--- a/storage/ndb/test/src/Makefile.am	2008-01-18 21:55:02 +0000
+++ b/storage/ndb/test/src/Makefile.am	2010-05-19 13:00:23 +0000
@@ -31,9 +31,6 @@ INCLUDES_LOC = -I$(top_srcdir)/storage/n
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_ndbapitest.mk.am
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: libNDBT.dsp
 
 libNDBT.dsp: Makefile \

=== modified file 'storage/ndb/test/tools/Makefile.am'
--- a/storage/ndb/test/tools/Makefile.am	2007-11-14 12:28:45 +0000
+++ b/storage/ndb/test/tools/Makefile.am	2010-05-19 13:00:23 +0000
@@ -43,7 +43,4 @@ include $(top_srcdir)/storage/ndb/config
 ndb_cpcc_LDADD = $(LDADD)
 ndb_cpcc_LDFLAGS = -static
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp:

=== modified file 'storage/ndb/tools/Makefile.am'
--- a/storage/ndb/tools/Makefile.am	2007-04-24 20:43:13 +0000
+++ b/storage/ndb/tools/Makefile.am	2010-05-19 13:00:23 +0000
@@ -75,9 +75,6 @@ ndb_select_count_LDFLAGS = @ndb_bin_am_l
 ndb_restore_LDFLAGS = @ndb_bin_am_ldflags@
 ndb_config_LDFLAGS = @ndb_bin_am_ldflags@
 
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-
 windoze-dsp: \
   ndb_waiter.dsp \
   ndb_drop_table.dsp \

=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc	2010-05-12 14:04:32 +0000
+++ b/storage/perfschema/pfs_engine_table.cc	2010-05-20 16:01:10 +0000
@@ -148,6 +148,9 @@ void PFS_engine_table_share::check_one_t
       m_checked= true;
     close_thread_tables(thd);
   }
+  else
+    sql_print_error(ER(ER_WRONG_NATIVE_TABLE_STRUCTURE),
+                    PERFORMANCE_SCHEMA_str.str, m_name.str);
 
   lex_end(&dummy_lex);
   thd->lex= old_lex;
@@ -824,44 +827,44 @@ bool pfs_show_status(handlerton *hton, T
       total_memory+= size;
       break;
     case 44:
-      name= "SETUP_ACTORS.ROW_SIZE";
-      size= sizeof(PFS_setup_actor);
-      break;
-    case 45:
-      name= "SETUP_ACTORS.ROW_COUNT";
-      size= setup_actor_max;
-      break;
-    case 46:
-      name= "SETUP_ACTORS.MEMORY";
-      size= setup_actor_max * sizeof(PFS_setup_actor);
-      total_memory+= size;
-      break;
-    case 47:
       name= "(PFS_TABLE_SHARE).ROW_SIZE";
       size= sizeof(PFS_table_share);
       break;
-    case 48:
+    case 45:
       name= "(PFS_TABLE_SHARE).ROW_COUNT";
       size= table_share_max;
       break;
-    case 49:
+    case 46:
       name= "(PFS_TABLE_SHARE).MEMORY";
       size= table_share_max * sizeof(PFS_table_share);
       total_memory+= size;
       break;
-    case 50:
+    case 47:
       name= "(PFS_TABLE).ROW_SIZE";
       size= sizeof(PFS_table);
       break;
-    case 51:
+    case 48:
       name= "(PFS_TABLE).ROW_COUNT";
       size= table_max;
       break;
-    case 52:
+    case 49:
       name= "(PFS_TABLE).MEMORY";
       size= table_max * sizeof(PFS_table);
       total_memory+= size;
       break;
+    case 50:
+      name= "SETUP_ACTORS.ROW_SIZE";
+      size= sizeof(PFS_setup_actor);
+      break;
+    case 51:
+      name= "SETUP_ACTORS.ROW_COUNT";
+      size= setup_actor_max;
+      break;
+    case 52:
+      name= "SETUP_ACTORS.MEMORY";
+      size= setup_actor_max * sizeof(PFS_setup_actor);
+      total_memory+= size;
+      break;
     /*
       This case must be last,
       for aggregation in total_memory.
@@ -869,6 +872,8 @@ bool pfs_show_status(handlerton *hton, T
     case 53:
       name= "PERFORMANCE_SCHEMA.MEMORY";
       size= total_memory;
+      /* This will fail if something is not advertised here */
+      DBUG_ASSERT(size == pfs_allocated_memory);
       break;
     default:
       goto end;

=== modified file 'storage/perfschema/pfs_global.cc'
--- a/storage/perfschema/pfs_global.cc	2010-04-19 12:26:29 +0000
+++ b/storage/perfschema/pfs_global.cc	2010-05-11 14:19:09 +0000
@@ -26,6 +26,7 @@
 #include <string.h>
 
 bool pfs_initialized= false;
+ulonglong pfs_allocated_memory= 0;
 
 /**
   Memory allocation for the performance schema.
@@ -38,7 +39,9 @@ void *pfs_malloc(size_t size, myf flags)
   DBUG_ASSERT(size > 0);
 
   void *ptr= malloc(size);
-  if (ptr && (flags & MY_ZEROFILL))
+  if (likely(ptr != NULL))
+    pfs_allocated_memory+= size;
+  if (likely((ptr != NULL) && (flags & MY_ZEROFILL)))
     memset(ptr, 0, size);
   return ptr;
 }

=== modified file 'storage/perfschema/pfs_global.h'
--- a/storage/perfschema/pfs_global.h	2010-04-14 09:54:35 +0000
+++ b/storage/perfschema/pfs_global.h	2010-05-11 14:19:09 +0000
@@ -22,6 +22,7 @@
 */
 
 extern bool pfs_initialized;
+extern ulonglong pfs_allocated_memory;
 
 void *pfs_malloc(size_t size, myf flags);
 #define PFS_MALLOC_ARRAY(n, T, f) \

=== modified file 'strings/Makefile.am'
--- a/strings/Makefile.am	2010-04-11 06:52:42 +0000
+++ b/strings/Makefile.am	2010-05-19 13:00:23 +0000
@@ -88,7 +88,3 @@ test_decimal$(EXEEXT): decimal.c $(pkgli
 	$(CP) $(srcdir)/decimal.c ./test_decimal.c
 	$(LINK) $(FLAGS) -DMAIN  ./test_decimal.c $(LDADD) $(pkglib_LIBRARIES)
 	$(RM) -f ./test_decimal.c
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
-

=== modified file 'support-files/CMakeLists.txt'
--- a/support-files/CMakeLists.txt	2010-02-19 17:30:08 +0000
+++ b/support-files/CMakeLists.txt	2010-05-12 15:25:53 +0000
@@ -29,16 +29,13 @@ ELSE()
   SET(CXXFLAGS ${CMAKE_CXX_FLAGS})
   SET(MYSQLD_USER "mysql")
   SET(ini_file_extension "cnf")
+  SET(HOSTNAME "hostname")
 ENDIF()
 
-IF(UNIX)
-  IF(INSTALL_LAYOUT MATCHES "STANDALONE")
-    SET(inst_location ${INSTALL_SUPPORTFILESDIR})
-  ELSE()
-    SET(inst_location ${INSTALL_DOCREADMEDIR})
-  ENDIF()
-ELSE()
+IF(WIN32)
   SET(inst_location ${INSTALL_DOCREADMEDIR})
+ELSE()
+  SET(inst_location ${INSTALL_SUPPORTFILESDIR})
 ENDIF()
 
 FOREACH(inifile my-huge my-innodb-heavy-4G my-large my-medium my-small)
@@ -50,12 +47,9 @@ ENDFOREACH()
 IF(UNIX)
   IF(INSTALL_LAYOUT MATCHES "STANDALONE")
     SET(prefix ".")
-    SET(inst_location ${INSTALL_SUPPORTFILESDIR})
   ELSE()
     SET(prefix ${CMAKE_INSTALL_PREFIX})
-    SET(inst_location ${INSTALL_MYSQLSHAREDIR})
   ENDIF()
-
  
   FOREACH(script  mysqld_multi.server mysql-log-rotate binary-configure
     config.medium.ini config.small.ini config.huge.ini ndb-config-2-node.ini)

=== modified file 'support-files/MacOSX/Makefile.am'
--- a/support-files/MacOSX/Makefile.am	2008-02-26 17:36:06 +0000
+++ b/support-files/MacOSX/Makefile.am	2010-05-19 13:00:23 +0000
@@ -52,6 +52,3 @@ SUFFIXES = .sh
 		-e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
 	$< > $@-t
 	@MV@ $@-t $@
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'support-files/Makefile.am'
--- a/support-files/Makefile.am	2010-02-06 16:13:42 +0000
+++ b/support-files/Makefile.am	2010-05-19 13:00:23 +0000
@@ -33,7 +33,7 @@ EXTRA_DIST =		mysql.spec.sh \
 			magic mysql.m4 \
 			MySQL-shared-compat.spec.sh \
 			ndb-config-2-node.ini.sh \
-			compiler_warnings.supp \ 
+			compiler_warnings.supp \
 			dtrace \
 			CMakeLists.txt
 
@@ -129,6 +129,3 @@ SUFFIXES = .sh
 	  -e 's!@''PERL_DATA_DUMPER''@!@PERL_DATA_DUMPER@!' \
 	$< > $@-t
 	@MV@ $@-t $@
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'support-files/RHEL4-SElinux/Makefile.am'
--- a/support-files/RHEL4-SElinux/Makefile.am	2007-01-25 16:51:21 +0000
+++ b/support-files/RHEL4-SElinux/Makefile.am	2010-05-19 13:00:23 +0000
@@ -18,6 +18,3 @@
 ## Process this file with automake to create Makefile.in
 
 EXTRA_DIST =		mysql.fc mysql.te
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'support-files/mysql.spec.sh'
--- a/support-files/mysql.spec.sh	2010-04-18 13:32:05 +0000
+++ b/support-files/mysql.spec.sh	2010-05-12 15:32:31 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2000-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
+# Copyright (c) 2000, 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
@@ -20,125 +20,200 @@
 
 # NOTE: "vendor" is used in upgrade/downgrade check, so you can't
 # change these, has to be exactly as is.
-%define mysql_old_vendor	MySQL AB
-%define mysql_vendor_2		Sun Microsystems, Inc.
-%define mysql_vendor		Oracle and/or its affiliates
-
-%define mysql_version @VERSION@
-
-%define mysqld_user    mysql
-%define mysqld_group   mysql
-%define mysqldatadir   /var/lib/mysql
-%define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com
-
-# ------------------------------------------------------------------------------
-# On SuSE 9 no separate "debuginfo" package is built. To enable basic
-# debugging on that platform, we don't strip binaries on SuSE 9. We
-# disable the strip of binaries by redefining the RPM macro
-# "__os_install_post" leaving out the script calls that normally does
-# this. We do this in all cases, as on platforms where "debuginfo" is
-# created, a script "find-debuginfo.sh" will be called that will do
-# the strip anyway, part of separating the executable and debug
-# information into separate files put into separate packages.
+%define mysql_old_vendor        MySQL AB
+%define mysql_vendor_2          Sun Microsystems, Inc.
+%define mysql_vendor            Oracle and/or its affiliates
+
+%define mysql_version   @VERSION@
+
+%define mysqld_user     mysql
+%define mysqld_group    mysql
+%define mysqldatadir    /var/lib/mysql
+
+%define release         1
+
+#
+# Macros we use which are not available in all supported versions of RPM
+#
+# - defined/undefined are missing on RHEL4
 #
-# Some references (shows more advanced conditional usage):
-# http://www.redhat.com/archives/rpm-list/2001-November/msg00257.html
-# http://www.redhat.com/archives/rpm-list/2003-February/msg00275.html
-# http://www.redhat.com/archives/rhl-devel-list/2004-January/msg01546.html
-# http://lists.opensuse.org/archive/opensuse-commit/2006-May/1171.html
-# ------------------------------------------------------------------------------
-%define __os_install_post /usr/lib/rpm/brp-compress
-
-# ------------------------------------------------------------------------------
-# We don't package all files installed into the build root by intention -
-# See BUG#998 for details.
-# ------------------------------------------------------------------------------
-%define _unpackaged_files_terminate_build 0
-
-# ------------------------------------------------------------------------------
-# RPM build tools now automatically detects Perl module dependencies. This
-# detection gives problems as it is broken in some versions, and it also
-# give unwanted dependencies from mandatory scripts in our package.
-# Might not be possible to disable in all RPM tool versions, but here we
-# try. We keep the "AutoReqProv: no" for the "test" sub package, as disabling
-# here might fail, and that package has the most problems.
-# See http://fedoraproject.org/wiki/Packaging/Perl#Filtering_Requires:_and_Provides
-#     http://www.wideopen.com/archives/rpm-list/2002-October/msg00343.html
-# ------------------------------------------------------------------------------
+%if %{expand:%{?defined:0}%{!?defined:1}}
+%define defined()       %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
+%endif
+%if %{expand:%{?undefined:0}%{!?undefined:1}}
+%define undefined()     %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
+%endif
+
+# ----------------------------------------------------------------------------
+# RPM build tools now automatically detect Perl module dependencies.  This
+# detection causes problems as it is broken in some versions, and it also
+# provides unwanted dependencies from mandatory scripts in our package.
+# It might not be possible to disable this in all versions of RPM, but here we
+# try anyway.  We keep the "AutoReqProv: no" for the "test" sub package, as
+# disabling here might fail, and that package has the most problems.
+# See:
+#  http://fedoraproject.org/wiki/Packaging/Perl#Filtering_Requires:_and_Provides
+#  http://www.wideopen.com/archives/rpm-list/2002-October/msg00343.html
+# ----------------------------------------------------------------------------
 %undefine __perl_provides
 %undefine __perl_requires
 
 ##############################################################################
 # Command line handling
 ##############################################################################
+#
+# To set options:
+#
+#   $ rpmbuild --define="option <x>" ...
+#
 
-# ----------------------------------------------------------------------
-# use "rpmbuild --with yassl" or "rpm --define '_with_yassl 1'" (for RPM 3.x)
-# to build with yaSSL support (off by default)
-# ----------------------------------------------------------------------
-%{?_with_yassl:%define YASSL_BUILD 1}
-%{!?_with_yassl:%define YASSL_BUILD 0}
-
-# ----------------------------------------------------------------------
-# use "rpmbuild --without bundled_zlib" or "rpm --define '_without_bundled_zlib 1'"
-# (for RPM 3.x) to not build using the bundled zlib (on by default)
-# ----------------------------------------------------------------------
-%{!?_with_bundled_zlib: %{!?_without_bundled_zlib: %define WITH_BUNDLED_ZLIB 1}}
-%{?_with_bundled_zlib:%define WITH_BUNDLED_ZLIB 1}
-%{?_without_bundled_zlib:%define WITH_BUNDLED_ZLIB 0}
-
-# ----------------------------------------------------------------------
-# support optional "tcmalloc" stuff (experimental)
-# ----------------------------------------------------------------------
-%{?malloc_lib_target:%define WITH_TCMALLOC 1}
-%{!?malloc_lib_target:%define WITH_TCMALLOC 0}
+# ----------------------------------------------------------------------------
+# Commercial builds
+# ----------------------------------------------------------------------------
+%if %{undefined commercial}
+%define commercial 0
+%endif
 
-# ----------------------------------------------------------------------
-# use "rpmbuild --with cluster" or "rpm --define '_with_cluster 1'" (for RPM 3.x)
-# to build with cluster support (off by default)
-# ----------------------------------------------------------------------
-%{?_with_cluster:%define CLUSTER_BUILD 1}
-%{!?_with_cluster:%define CLUSTER_BUILD 0}
+# ----------------------------------------------------------------------------
+# Source name
+# ----------------------------------------------------------------------------
+%if %{undefined src_base}
+%define src_base mysql
+%endif
+%define src_dir %{src_base}-%{mysql_version}
+
+# ----------------------------------------------------------------------------
+# Feature set (storage engines, options).  Default to community (everything)
+# ----------------------------------------------------------------------------
+%if %{undefined feature_set}
+%define feature_set community
+%endif
+
+# ----------------------------------------------------------------------------
+# Server comment strings
+# ----------------------------------------------------------------------------
+%if %{undefined compilation_comment_debug}
+%define compilation_comment_debug       MySQL Community Server - Debug (GPL)
+%endif
+%if %{undefined compilation_comment_release}
+%define compilation_comment_release     MySQL Community Server (GPL)
+%endif
+
+# ----------------------------------------------------------------------------
+# Product and server suffixes
+# ----------------------------------------------------------------------------
+%if %{undefined product_suffix}
+  %if %{defined short_product_tag}
+    %define product_suffix      -%{short_product_tag}
+  %else
+    %define product_suffix      %{nil}
+  %endif
+%endif
+
+%if %{undefined server_suffix}
+%define server_suffix   %{nil}
+%endif
+
+# ----------------------------------------------------------------------------
+# Distribution support
+# ----------------------------------------------------------------------------
+%if %{undefined distro_specific}
+%define distro_specific 0
+%endif
+%if %{distro_specific}
+  %if %(test -f /etc/redhat-release && echo 1 || echo 0)
+    %define elver %(rpm -qf --qf '%%{version}\\n' /etc/redhat-release | sed -e 's/^\\([0-9]*\\).*/\\1/g')
+    %if "%elver" == "4"
+      %define distro_description        Enterprise Linux 4
+      %define distro_releasetag         el4
+      %define distro_buildreq           gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
+      %define distro_requires           chkconfig coreutils grep procps shadow-utils
+    %else
+      %if "%elver" == "5"
+        %define distro_description      Enterprise Linux 5
+        %define distro_releasetag       el5
+        %define distro_buildreq         gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
+        %define distro_requires         chkconfig coreutils grep procps shadow-utils
+      %else
+        %{error:Enterprise Linux %{elver} is unsupported}
+      %endif
+    %endif
+  %else
+    %if %(test -f /etc/SuSE-release && echo 1 || echo 0)
+      %define susever %(rpm -qf --qf '%%{version}\\n' /etc/SuSE-release)
+      %if "%susever" == "10"
+        %define distro_description      SUSE Linux Enterprise Server 10
+        %define distro_releasetag       sles10
+        %define distro_buildreq         gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client readline-devel zlib-devel
+        %define distro_requires         aaa_base coreutils grep procps pwdutils
+      %else
+        %if "%susever" == "11"
+          %define distro_description    SUSE Linux Enterprise Server 11
+          %define distro_releasetag     sles11
+          %define distro_buildreq       gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client procps pwdutils readline-devel zlib-devel
+          %define distro_requires       aaa_base coreutils grep procps pwdutils
+        %else
+          %{error:SuSE %{susever} is unsupported}
+        %endif
+      %endif
+    %else
+      %{error:Unsupported distribution}
+    %endif
+  %endif
+%else
+  %define generic_kernel %(uname -r | cut -d. -f1-2)
+  %define distro_description            Generic Linux (kernel %{generic_kernel})
+  %define distro_releasetag             linux%{generic_kernel}
+  %define distro_buildreq               gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
+  %define distro_requires               coreutils grep procps /sbin/chkconfig /usr/sbin/useradd /usr/sbin/groupadd
+%endif
+
+# Avoid debuginfo RPMs, leaves binaries unstripped
+%define debug_package   %{nil}
+
+# Hack to work around bug in RHEL5 __os_install_post macro, wrong inverted
+# test for __debug_package
+%define __strip         /bin/true
+
+# ----------------------------------------------------------------------------
+# Support optional "tcmalloc" library (experimental)
+# ----------------------------------------------------------------------------
+%if %{defined malloc_lib_target}
+%define WITH_TCMALLOC 1
+%else
+%define WITH_TCMALLOC 0
+%endif
 
 ##############################################################################
-# Product definitions - set for a "community" package
+# Configuration based upon above user input, not to be set directly
 ##############################################################################
 
-%define server_suffix  -community
-%define package_suffix -community
-%define ndbug_comment MySQL Community Server (GPL)
-%define debug_comment MySQL Community Server - Debug (GPL)
-%define commercial 0
-%define EMBEDDED_BUILD 1
-%define PARTITION_BUILD 1
-# Default for CLUSTER_BUILD is "0", but command line option may override it
-%define COMMUNITY_BUILD 1
-%define INNODB_BUILD 1
-%define NORMAL_TEST_MODE test-bt
-%define DEBUG_TEST_MODE test-bt-debug
-
-%define release 1.glibc23
-
-%define mysql_license GPL
-%define src_dir mysql-%{mysql_version}
+%if %{commercial}
+%define license_files_server    %{src_dir}/LICENSE.mysql
+%define license_type            Commercial
+%else
+%define license_files_devel     %{src_dir}/EXCEPTIONS-CLIENT
+%define license_files_server    %{src_dir}/COPYING %{src_dir}/README
+%define license_type            GPL
+%endif
 
 ##############################################################################
 # Main spec file section
 ##############################################################################
 
-Name:		MySQL
-Summary:	MySQL: a very fast and reliable SQL database server
-Group:		Applications/Databases
-Version:	@MYSQL_U_SCORE_VERSION@
-Release:	%{release}
-License:	Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ %{mysql_vendor}  All rights reserved.  Use is subject to license terms.  Under %{mysql_license} license as shown in the Description field.
-Source:		http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz
-URL:		http://www.mysql.com/
-Packager:	%{mysql_vendor} Product Engineering Team <build@stripped>
-Vendor:		%{mysql_vendor}
-Provides:	msqlormysql MySQL-server mysql
-BuildRequires: ncurses-devel
-Obsoletes:	mysql
+Name:           MySQL%{product_suffix}
+Summary:        MySQL: a very fast and reliable SQL database server
+Group:          Applications/Databases
+Version:        @MYSQL_U_SCORE_VERSION@
+Release:        %{release}%{?distro_releasetag:.%{distro_releasetag}}
+Distribution:   %{distro_description}
+License:        Copyright (c) 2000, @MYSQL_COPYRIGHT_YEAR@, %{mysql_vendor}.  All rights reserved.  Use is subject to license terms.  Under %{license_type} license as shown in the Description field.
+Source:         http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz
+URL:            http://www.mysql.com/
+Packager:       MySQL Build Team <build@stripped>
+Vendor:         %{mysql_vendor}
+Provides:       msqlormysql MySQL-server mysql
+BuildRequires:  %{distro_buildreq}
 
 # Think about what you use here since the first step is to
 # run a rm -rf
@@ -152,11 +227,12 @@ is intended for mission-critical, heavy-
 as for embedding into mass-deployed software. MySQL is a trademark of
 %{mysql_vendor}
 
-Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ %{mysql_vendor}  All rights reserved.
-Use is subject to license terms.
-
-This software comes with ABSOLUTELY NO WARRANTY. This is free software,
-and you are welcome to modify and redistribute it under the GPL license.
+The MySQL software has Dual Licensing, which means you can use the MySQL
+software free of charge under the GNU General Public License
+(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
+licenses from %{mysql_vendor} if you do not wish to be bound by the terms of
+the GPL. See the chapter "Licensing and Support" in the manual for
+further info.
 
 The MySQL web site (http://www.mysql.com/) provides the latest
 news and information about the MySQL software. Also please see the
@@ -166,436 +242,234 @@ documentation and the manual for more in
 # Sub package definition
 ##############################################################################
 
-%package server
-Summary:	MySQL: a very fast and reliable SQL database server
-Group:		Applications/Databases
-Requires: coreutils grep procps /usr/sbin/useradd /usr/sbin/groupadd /sbin/chkconfig
-Provides:	msqlormysql mysql-server mysql MySQL
-Obsoletes:	MySQL mysql mysql-server
+%package -n MySQL-server%{product_suffix}
+Summary:        MySQL: a very fast and reliable SQL database server
+Group:          Applications/Databases
+Requires:       %{distro_requires}
+Provides:       msqlormysql mysql-server mysql MySQL MySQL-server
+Obsoletes:      MySQL mysql mysql-server MySQL-server
 
-%description server
+%description -n MySQL-server%{product_suffix}
 The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
 and robust SQL (Structured Query Language) database server. MySQL Server
 is intended for mission-critical, heavy-load production systems as well
 as for embedding into mass-deployed software. MySQL is a trademark of
 %{mysql_vendor}
 
-Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ %{mysql_vendor}  All rights reserved.
-Use is subject to license terms.
+The MySQL software has Dual Licensing, which means you can use the MySQL
+software free of charge under the GNU General Public License
+(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
+licenses from %{mysql_vendor} if you do not wish to be bound by the terms of
+the GPL. See the chapter "Licensing and Support" in the manual for
+further info.
+
+The MySQL web site (http://www.mysql.com/) provides the latest news and 
+information about the MySQL software.  Also please see the documentation
+and the manual for more information.
 
-This software comes with ABSOLUTELY NO WARRANTY. This is free software,
-and you are welcome to modify and redistribute it under the GPL license.
-
-The MySQL web site (http://www.mysql.com/) provides the latest
-news and information about the MySQL software. Also please see the
-documentation and the manual for more information.
-
-This package includes the MySQL server binary
-%if %{INNODB_BUILD}
-(configured including InnoDB)
-%endif
-as well as related utilities to run and administer a MySQL server.
+This package includes the MySQL server binary as well as related utilities
+to run and administer a MySQL server.
 
 If you want to access and work with the database, you have to install
-package "MySQL-client" as well!
+package "MySQL-client%{product_suffix}" as well!
 
-# ------------------------------------------------------------------------------
+# ----------------------------------------------------------------------------
+%package -n MySQL-client%{product_suffix}
+Summary:        MySQL - Client
+Group:          Applications/Databases
+Obsoletes:      mysql-client MySQL-client
+Provides:       mysql-client MySQL-client
 
-%package client
-Summary: MySQL - Client
-Group: Applications/Databases
-Obsoletes: mysql-client
-Provides: mysql-client
-
-%description client
+%description -n MySQL-client%{product_suffix}
 This package contains the standard MySQL clients and administration tools.
 
-%{see_base}
-
-# ------------------------------------------------------------------------------
-
-%if %{CLUSTER_BUILD}
-%package ndb-storage
-Summary:	MySQL - ndbcluster storage engine
-Group:		Applications/Databases
-
-%description ndb-storage
-This package contains the ndbcluster storage engine.
-It is necessary to have this package installed on all
-computers that should store ndbcluster table data.
-
-%{see_base}
+For a description of MySQL see the base MySQL RPM or http://www.mysql.com/
 
-# ------------------------------------------------------------------------------
+# ----------------------------------------------------------------------------
+%package -n MySQL-test%{product_suffix}
+Requires:       MySQL-client%{product_suffix} perl
+Summary:        MySQL - Test suite
+Group:          Applications/Databases
+Provides:       mysql-test
+Obsoletes:      mysql-bench mysql-test
+AutoReqProv:    no
 
-%package ndb-management
-Summary:	MySQL - ndbcluster storage engine management
-Group:		Applications/Databases
-
-%description ndb-management
-This package contains ndbcluster storage engine management.
-It is necessary to have this package installed on at least
-one computer in the cluster.
-
-%{see_base}
-
-# ------------------------------------------------------------------------------
-
-%package ndb-tools
-Summary:	MySQL - ndbcluster storage engine basic tools
-Group:		Applications/Databases
-
-%description ndb-tools
-This package contains ndbcluster storage engine basic tools.
-
-%{see_base}
-
-# ------------------------------------------------------------------------------
-
-%package ndb-extra
-Summary:	MySQL - ndbcluster storage engine extra tools
-Group:		Applications/Databases
-
-%description ndb-extra
-This package contains some extra ndbcluster storage engine tools for the advanced user.
-They should be used with caution.
-
-%{see_base}
-%endif
-
-# ------------------------------------------------------------------------------
-
-%package test
-Requires: %{name}-client perl
-Summary: MySQL - Test suite
-Group: Applications/Databases
-Provides: mysql-test
-Obsoletes: mysql-bench mysql-test
-AutoReqProv: no
-
-%description test
+%description -n MySQL-test%{product_suffix}
 This package contains the MySQL regression test suite.
 
-%{see_base}
-
-# ------------------------------------------------------------------------------
-
-%package devel
-Summary: MySQL - Development header files and libraries
-Group: Applications/Databases
-Provides: mysql-devel
-Obsoletes: mysql-devel
-
-%description devel
-This package contains the development header files and libraries
-necessary to develop MySQL client applications.
-
-%{see_base}
-
-# ------------------------------------------------------------------------------
-
-%package shared
-Summary: MySQL - Shared libraries
-Group: Applications/Databases
-
-%description shared
-This package contains the shared libraries (*.so*) which certain
-languages and applications need to dynamically load and use MySQL.
-
-# ------------------------------------------------------------------------------
+For a description of MySQL see the base MySQL RPM or http://www.mysql.com/
 
-%if %{EMBEDDED_BUILD}
+# ----------------------------------------------------------------------------
+%package -n MySQL-devel%{product_suffix}
+Summary:        MySQL - Development header files and libraries
+Group:          Applications/Databases
+Provides:       mysql-devel
+Obsoletes:      mysql-devel
+
+%description -n MySQL-devel%{product_suffix}
+This package contains the development header files and libraries necessary
+to develop MySQL client applications.
+
+For a description of MySQL see the base MySQL RPM or http://www.mysql.com/
+
+# ----------------------------------------------------------------------------
+%package -n MySQL-shared%{product_suffix}
+Summary:        MySQL - Shared libraries
+Group:          Applications/Databases
+
+%description -n MySQL-shared%{product_suffix}
+This package contains the shared libraries (*.so*) which certain languages
+and applications need to dynamically load and use MySQL.
+
+# ----------------------------------------------------------------------------
+%package -n MySQL-embedded%{product_suffix}
+Summary:        MySQL - embedded library
+Group:          Applications/Databases
+Requires:       MySQL-devel%{product_suffix}
+Obsoletes:      mysql-embedded
 
-%package embedded
-Requires: %{name}-devel
-Summary: MySQL - embedded library
-Group: Applications/Databases
-Obsoletes: mysql-embedded
-
-%description embedded
+%description -n MySQL-embedded%{product_suffix}
 This package contains the MySQL server as an embedded library.
 
-The embedded MySQL server library makes it possible to run a
-full-featured MySQL server inside the client application.
-The main benefits are increased speed and more simple management
-for embedded applications.
+The embedded MySQL server library makes it possible to run a full-featured
+MySQL server inside the client application. The main benefits are increased
+speed and more simple management for embedded applications.
 
 The API is identical for the embedded MySQL version and the
 client/server version.
 
-%{see_base}
-
-%endif
+For a description of MySQL see the base MySQL RPM or http://www.mysql.com/
 
 ##############################################################################
-#
-##############################################################################
-
 %prep
-# We unpack the source two times, for 'debug' and 'release' build.
-%setup -T -a 0 -c -n mysql-%{mysql_version}
-mv mysql-%{mysql_version} mysql-debug-%{mysql_version}
-%setup -D -T -a 0 -n mysql-%{mysql_version}
-mv mysql-%{mysql_version} mysql-release-%{mysql_version}
+%setup -T -a 0 -c -n %{src_dir}
 
 ##############################################################################
-# The actual build
-##############################################################################
-
 %build
 
-BuildMySQL() {
-# Let "MYSQL_BUILD_*FLAGS" take precedence.
-CFLAGS=${MYSQL_BUILD_CFLAGS:-$CFLAGS}
-CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$CXXFLAGS}
-LDFLAGS=${MYSQL_BUILD_LDFLAGS:-$LDFLAGS}
-# Fall back on RPM_OPT_FLAGS (part of RPM environment) if no flags are given.
-CFLAGS=${CFLAGS:-$RPM_OPT_FLAGS}
-CXXFLAGS=${CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti }
-# Evaluate current setting of $DEBUG
-if [ $DEBUG -gt 0 ] ; then
-	OPT_COMMENT='--with-comment="%{debug_comment}"'
-	OPT_DEBUG='--with-debug'
-	CFLAGS=`echo   " $CFLAGS "   | \
-	    sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
-	        -e 's/^ //' -e 's/ $//'`
-	CXXFLAGS=`echo " $CXXFLAGS " | \
-	    sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
-	        -e 's/^ //' -e 's/ $//'`
-else
-	OPT_COMMENT='--with-comment="%{ndbug_comment}"'
-	OPT_DEBUG=''
-fi
-# The --enable-assembler simply does nothing on systems that does not
-# support assembler speedups.
-sh -c  "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
-	CC=\"${MYSQL_BUILD_CC:-$CC}\" \
-	CXX=\"${MYSQL_BUILD_CXX:-$CXX}\" \
-	CFLAGS=\"$CFLAGS\" \
-	CXXFLAGS=\"$CXXFLAGS\" \
-	LDFLAGS=\"$LDFLAGS\" \
-	./configure \
- 	    $* \
-	    --with-mysqld-ldflags='-static' \
-	    --with-client-ldflags='-static' \
-	    --enable-assembler \
-	    --enable-local-infile \
-	    --with-fast-mutexes \
-	    --with-mysqld-user=%{mysqld_user} \
-	    --with-unix-socket-path=/var/lib/mysql/mysql.sock \
-	    --with-pic \
-	    --prefix=/ \
-%if %{CLUSTER_BUILD}
-	    --with-extra-charsets=all \
-%else
-	    --with-extra-charsets=complex \
-%endif
-%if %{YASSL_BUILD}
-	    --with-ssl \
-%else
-	    --without-ssl \
-%endif
-	    --exec-prefix=%{_exec_prefix} \
-	    --libexecdir=%{_sbindir} \
-	    --libdir=%{_libdir} \
-	    --sysconfdir=%{_sysconfdir} \
-	    --datadir=%{_datadir} \
-	    --localstatedir=%{mysqldatadir} \
-	    --infodir=%{_infodir} \
-	    --includedir=%{_includedir} \
-	    --mandir=%{_mandir} \
-	    --enable-thread-safe-client \
-	    $OPT_COMMENT \
-	    $OPT_DEBUG \
-	    --with-readline \
-%if %{WITH_BUNDLED_ZLIB}
-	    --with-zlib-dir=bundled \
-%endif
-%if %{CLUSTER_BUILD}
-		--with-plugin-ndbcluster \
-%else
-		--without-plugin-ndbcluster \
-%endif
-%if %{INNODB_BUILD}
-		--with-plugin-innobase \
-%else
-		--without-plugin-innobase \
-%endif
-%if %{PARTITION_BUILD}
-		--with-plugin-partition \
-%else
-		--without-plugin-partition \
-%endif
-		--with-plugin-csv \
-		--with-plugin-archive \
-		--with-plugin-blackhole \
-		--with-plugin-federated \
-		--with-perfschema \
-		--without-plugin-daemon_example \
-		--without-plugin-ftexample \
-%if %{EMBEDDED_BUILD}
-		--with-embedded-server \
-%else
-		--without-embedded-server \
-%endif
-		--with-big-tables \
-		--enable-shared \
-		"
- make
-}
-# end of function definition "BuildMySQL"
-
-# Use our own copy of glibc
-
-OTHER_LIBC_DIR=/usr/local/mysql-glibc
-USE_OTHER_LIBC_DIR=""
-if test -d "$OTHER_LIBC_DIR"
-then
-  USE_OTHER_LIBC_DIR="--with-other-libc=$OTHER_LIBC_DIR"
-fi
+# Be strict about variables, bail at earliest opportunity, etc.
+set -eu
 
-# Use the build root for temporary storage of the shared libraries.
-
-RBR=$RPM_BUILD_ROOT
+# Optional package files
+touch optional-files-devel
 
-# Clean up the BuildRoot first
-[ "$RBR" != "/" ] && [ -d $RBR ] && rm -rf $RBR;
-mkdir -p $RBR%{_libdir}/mysql
-
-#
-# Use MYSQL_BUILD_PATH so that we can use a dedicated version of gcc
 #
-PATH=${MYSQL_BUILD_PATH:-/bin:/usr/bin}
-export PATH
-
-# Build the Debug binary.
-
-# Use gcc for C and C++ code (to avoid a dependency on libstdc++ and
-# including exceptions into the code
-if [ -z "$CXX" -a -z "$CC" ] ; then
-	export CC="gcc" CXX="gcc"
-fi
-
-
-##############################################################################
+# Set environment in order of preference, MYSQL_BUILD_* first, then variable
+# name, finally a default.  RPM_OPT_FLAGS is assumed to be a part of the
+# default RPM build environment.
 #
-#  Build the debug version
+# We set CXX=gcc by default to support so-called 'generic' binaries, where we
+# do not have a dependancy on libgcc/libstdc++.  This only works while we do
+# not require C++ features such as exceptions, and may need to be removed at
+# a later date.
 #
-##############################################################################
 
-(
-# We are in a subshell, so we can modify variables just for one run.
+# This is a hack, $RPM_OPT_FLAGS on ia64 hosts contains flags which break
+# the compile in cmd-line-utils/readline - needs investigation, but for now
+# we simply unset it and use those specified directly in cmake.
+%if "%{_arch}" == "ia64"
+RPM_OPT_FLAGS=
+%endif
+
+export PATH=${MYSQL_BUILD_PATH:-$PATH}
+export CC=${MYSQL_BUILD_CC:-${CC:-gcc}}
+export CXX=${MYSQL_BUILD_CXX:-${CXX:-gcc}}
+export CFLAGS=${MYSQL_BUILD_CFLAGS:-${CFLAGS:-$RPM_OPT_FLAGS}}
+export CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-${CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti}}
+export LDFLAGS=${MYSQL_BUILD_LDFLAGS:-${LDFLAGS:-}}
+export CMAKE=${MYSQL_BUILD_CMAKE:-${CMAKE:-cmake}}
 
-# Add -g and --with-debug.
-DEBUG=1
-cd mysql-debug-%{mysql_version} &&
-CFLAGS="$CFLAGS" \
-CXXFLAGS="$CXXFLAGS" \
-BuildMySQL 
+# Build debug mysqld and libmysqld.a
+mkdir debug
+(
+  cd debug
+  # Attempt to remove any optimisation flags from the debug build
+  CFLAGS=`echo " ${CFLAGS} " | \
+            sed -e 's/ -O[0-9]* / /' \
+                -e 's/ -unroll2 / /' \
+                -e 's/ -ip / /' \
+                -e 's/^ //' \
+                -e 's/ $//'`
+  CXXFLAGS=`echo " ${CXXFLAGS} " | \
+              sed -e 's/ -O[0-9]* / /' \
+                  -e 's/ -unroll2 / /' \
+                  -e 's/ -ip / /' \
+                  -e 's/^ //' \
+                  -e 's/ $//'`
+  # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included before
+  # XXX: install_layout so we can't just set it based on INSTALL_LAYOUT=RPM
+  ${CMAKE} ../%{src_dir} -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \
+           -DCMAKE_BUILD_TYPE=Debug \
+           -DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \
+           -DFEATURE_SET="%{feature_set}" \
+           -DCOMPILATION_COMMENT="%{compilation_comment_debug}" \
+           -DMYSQL_SERVER_SUFFIX="%{server_suffix}"
+  make VERBOSE=1
 )
-
-# We might want to save the config log file
-if test -n "$MYSQL_DEBUGCONFLOG_DEST"
-then
-  cp -fp mysql-debug-%{mysql_version}/config.log "$MYSQL_DEBUGCONFLOG_DEST"
-fi
-
-(cd mysql-debug-%{mysql_version} ; make test-bt-debug)
-
-##############################################################################
-#
-#  Build the release binary
-#
-##############################################################################
-
-DEBUG=0
-(cd mysql-release-%{mysql_version} &&
-CFLAGS="$CFLAGS" \
-CXXFLAGS="$CXXFLAGS" \
-BuildMySQL 
+# Build full release
+mkdir release
+(
+  cd release
+  # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included before
+  # XXX: install_layout so we can't just set it based on INSTALL_LAYOUT=RPM
+  ${CMAKE} ../%{src_dir} -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \
+           -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+           -DMYSQL_UNIX_ADDR="/var/lib/mysql/mysql.sock" \
+           -DFEATURE_SET="%{feature_set}" \
+           -DCOMPILATION_COMMENT="%{compilation_comment_release}" \
+           -DMYSQL_SERVER_SUFFIX="%{server_suffix}"
+  make VERBOSE=1
 )
-# We might want to save the config log file
-if test -n "$MYSQL_CONFLOG_DEST"
-then
-  cp -fp  mysql-release-%{mysql_version}/config.log "$MYSQL_CONFLOG_DEST"
-fi
 
-(cd mysql-release-%{mysql_version} ; make test-bt)
+# Use the build root for temporary storage of the shared libraries.
+RBR=$RPM_BUILD_ROOT
 
-##############################################################################
+# Clean up the BuildRoot first
+[ "$RBR" != "/" ] && [ -d "$RBR" ] && rm -rf "$RBR";
 
-# For gcc builds, include libgcc.a in the devel subpackage (BUG 4921)
-# Some "icc" calls may have "gcc" in the argument string, so we should first
-# check for "icc". (If we don't check, the "--print-libgcc-file" call will fail.)
-if expr "$CC" : ".*icc.*" > /dev/null ;
-then
-    %define WITH_LIBGCC 0
-    :
-elif expr "$CC" : ".*gcc.*" > /dev/null ;
+# For gcc builds, include libgcc.a in the devel subpackage (BUG 4921).  This
+# needs to be during build phase as $CC is not set during install.
+if "$CC" -v 2>&1 | grep '^gcc.version' >/dev/null 2>&1
 then
   libgcc=`$CC $CFLAGS --print-libgcc-file`
   if [ -f $libgcc ]
   then
-    %define WITH_LIBGCC 1
+    mkdir -p $RBR%{_libdir}/mysql
     install -m 644 $libgcc $RBR%{_libdir}/mysql/libmygcc.a
-  else
-    %define WITH_LIBGCC 0
-    :
+    echo "%{_libdir}/mysql/libmygcc.a" >>optional-files-devel
   fi
-else
-    %define WITH_LIBGCC 0
-    :
 fi
 
 ##############################################################################
-
 %install
+
 RBR=$RPM_BUILD_ROOT
-MBD=$RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-release-%{mysql_version}
+MBD=$RPM_BUILD_DIR/%{src_dir}
 
 # Ensure that needed directories exists
 install -d $RBR%{_sysconfdir}/{logrotate.d,init.d}
 install -d $RBR%{mysqldatadir}/mysql
 install -d $RBR%{_datadir}/mysql-test
+install -d $RBR%{_datadir}/mysql/SELinux/RHEL4
 install -d $RBR%{_includedir}
 install -d $RBR%{_libdir}
 install -d $RBR%{_mandir}
 install -d $RBR%{_sbindir}
 
-# Get the plugin files from the debug build
-mkdir $RBR/tmp-debug-plugin $MBD/plugin/debug
-( cd $RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-debug-%{mysql_version}/plugin
-  make install DESTDIR=$RBR/tmp-debug-plugin
-  mv $RBR/tmp-debug-plugin/usr/lib*/mysql/plugin/* $MBD/plugin/debug/
-  # From here, the install hook in "plugin/Makefile.am" will do the rest.
-)
-rmdir -p $RBR/tmp-debug-plugin/usr/lib*/mysql/plugin || true
-
 # Install all binaries
-(cd $MBD && make install DESTDIR=$RBR testroot=%{_datadir})
-# Old packages put shared libs in %{_libdir}/ (not %{_libdir}/mysql), so do
-# the same here.
-mv $RBR/%{_libdir}/mysql/*.so* $RBR/%{_libdir}/
-
-# install "mysqld-debug"
-$MBD/libtool --mode=execute install -m 755 \
-                 $RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-debug-%{mysql_version}/sql/mysqld \
-                 $RBR%{_sbindir}/mysqld-debug
+(
+  cd $MBD/release
+  make DESTDIR=$RBR install
+)
 
-# install saved perror binary with NDB support (BUG#13740)
-install -m 755 $MBD/extra/perror $RBR%{_bindir}/perror
+# FIXME: at some point we should stop doing this and just install everything
+# FIXME: directly into %{_libdir}/mysql - perhaps at the same time as renaming
+# FIXME: the shared libraries to use libmysql*-$major.$minor.so syntax
+mv -v $RBR/%{_libdir}/*.a $RBR/%{_libdir}/mysql/
 
 # Install logrotate and autostart
-install -m 644 $MBD/support-files/mysql-log-rotate $RBR%{_sysconfdir}/logrotate.d/mysql
-install -m 755 $MBD/support-files/mysql.server $RBR%{_sysconfdir}/init.d/mysql
-
-%if %{EMBEDDED_BUILD}
-# Install embedded server library in the build root
-install -m 644 $MBD/libmysqld/libmysqld.a $RBR%{_libdir}/mysql/
-%endif
-
-# in RPMs, it is unlikely that anybody should use "sql-bench"
-rm -fr $RBR%{_datadir}/sql-bench
+install -m 644 $MBD/release/support-files/mysql-log-rotate $RBR%{_sysconfdir}/logrotate.d/mysql
+install -m 755 $MBD/release/support-files/mysql.server $RBR%{_sysconfdir}/init.d/mysql
 
 # Create a symlink "rcmysql", pointing to the init.script. SuSE users
 # will appreciate that, as all services usually offer this.
@@ -605,6 +479,10 @@ ln -s %{_sysconfdir}/init.d/mysql $RBR%{
 # Just to make sure it's in the file list and marked as a config file
 touch $RBR%{_sysconfdir}/my.cnf
 
+# Install SELinux files in datadir
+install -m 600 $MBD/%{src_dir}/support-files/RHEL4-SElinux/mysql.{fc,te} \
+  $RBR%{_datadir}/mysql/SELinux/RHEL4
+
 %if %{WITH_TCMALLOC}
 # Even though this is a shared library, put it under /usr/lib*/mysql, so it
 # doesn't conflict with possible shared lib by the same name in /usr/lib*.  See
@@ -612,11 +490,15 @@ touch $RBR%{_sysconfdir}/my.cnf
 install -m 644 "%{malloc_lib_source}" "$RBR%{_libdir}/mysql/%{malloc_lib_target}"
 %endif
 
+# Remove man pages we explicitly do not want to package, avoids 'unpackaged
+# files' warning.
+rm -f $RBR%{_mandir}/man1/make_win_bin_dist.1*
+
 ##############################################################################
 #  Post processing actions, i.e. when installed
 ##############################################################################
 
-%pre server
+%pre -n MySQL-server%{product_suffix}
 # Check if we can safely upgrade.  An upgrade is only safe if it's from one
 # of our RPMs in the same version family.
 
@@ -687,12 +569,12 @@ fi
 
 # Shut down a previously installed server first
 if [ -x %{_sysconfdir}/init.d/mysql ] ; then
-	%{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1
-	echo "Giving mysqld 5 seconds to exit nicely"
-	sleep 5
+        %{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1
+        echo "Giving mysqld 5 seconds to exit nicely"
+        sleep 5
 fi
 
-%post server
+%post -n MySQL-server%{product_suffix}
 mysql_datadir=%{mysqldatadir}
 
 # ----------------------------------------------------------------------
@@ -707,10 +589,10 @@ if [ ! -d $mysql_datadir/test ] ; then m
 # ----------------------------------------------------------------------
 # use insserv for older SuSE Linux versions
 if [ -x /sbin/insserv ] ; then
-	/sbin/insserv %{_sysconfdir}/init.d/mysql
-# use chkconfig on Red Hat and newer SuSE releases
+        /sbin/insserv %{_sysconfdir}/init.d/mysql
+# use chkconfig on Enterprise Linux and newer SuSE releases
 elif [ -x /sbin/chkconfig ] ; then
-	/sbin/chkconfig --add mysql
+        /sbin/chkconfig --add mysql
 fi
 
 # ----------------------------------------------------------------------
@@ -760,28 +642,20 @@ sleep 2
 #scheduled service packs and more.  Visit www.mysql.com/enterprise for more
 #information."
 
-%if %{CLUSTER_BUILD}
-%post ndb-storage
-mysql_clusterdir=/var/lib/mysql-cluster
-
-# Create cluster directory if needed
-if test ! -d $mysql_clusterdir; then mkdir -m 755 $mysql_clusterdir; fi
-%endif
-
-%preun server
+%preun -n MySQL-server%{product_suffix}
 if [ $1 = 0 ] ; then
-	# Stop MySQL before uninstalling it
-	if [ -x %{_sysconfdir}/init.d/mysql ] ; then
-		%{_sysconfdir}/init.d/mysql stop > /dev/null
-		# Remove autostart of MySQL
-		# For older SuSE Linux versions
-		if [ -x /sbin/insserv ] ; then
-			/sbin/insserv -r %{_sysconfdir}/init.d/mysql
-		# use chkconfig on Red Hat and newer SuSE releases
-		elif [ -x /sbin/chkconfig ] ; then
-			/sbin/chkconfig --del mysql
-		fi
-	fi
+        # Stop MySQL before uninstalling it
+        if [ -x %{_sysconfdir}/init.d/mysql ] ; then
+                %{_sysconfdir}/init.d/mysql stop > /dev/null
+                # Remove autostart of MySQL
+                # For older SuSE Linux versions
+                if [ -x /sbin/insserv ] ; then
+                        /sbin/insserv -r %{_sysconfdir}/init.d/mysql
+                # use chkconfig on Enterprise Linux and newer SuSE releases
+                elif [ -x /sbin/chkconfig ] ; then
+                        /sbin/chkconfig --del mysql
+                fi
+        fi
 fi
 
 # We do not remove the mysql user since it may still own a lot of
@@ -797,20 +671,18 @@ fi
 #  Files section
 ##############################################################################
 
-%files server
+%files -n MySQL-server%{product_suffix}
 %defattr(-,root,root,0755)
 
-%doc mysql-release-%{mysql_version}/COPYING mysql-release-%{mysql_version}/README
-%doc mysql-release-%{mysql_version}/support-files/my-*.cnf
-%if %{CLUSTER_BUILD}
-%doc mysql-release-%{mysql_version}/support-files/ndb-*.ini
+%if %{defined license_files_server}
+%doc %{license_files_server}
 %endif
+%doc %{src_dir}/Docs/ChangeLog
+%doc release/support-files/my-*.cnf
 
 %doc %attr(644, root, root) %{_infodir}/mysql.info*
 
-%if %{INNODB_BUILD}
 %doc %attr(644, root, man) %{_mandir}/man1/innochecksum.1*
-%endif
 %doc %attr(644, root, man) %{_mandir}/man1/my_print_defaults.1*
 %doc %attr(644, root, man) %{_mandir}/man1/myisam_ftdump.1*
 %doc %attr(644, root, man) %{_mandir}/man1/myisamchk.1*
@@ -840,9 +712,7 @@ fi
 
 %ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf
 
-%if %{INNODB_BUILD}
 %attr(755, root, root) %{_bindir}/innochecksum
-%endif
 %attr(755, root, root) %{_bindir}/my_print_defaults
 %attr(755, root, root) %{_bindir}/myisam_ftdump
 %attr(755, root, root) %{_bindir}/myisamchk
@@ -867,17 +737,19 @@ fi
 %attr(755, root, root) %{_bindir}/resolve_stack_dump
 %attr(755, root, root) %{_bindir}/resolveip
 
-%if %{WITH_TCMALLOC}
-%attr(755, root, root) %{_libdir}/mysql/%{malloc_lib_target}
-%endif
-
 %attr(755, root, root) %{_sbindir}/mysqld
 %attr(755, root, root) %{_sbindir}/mysqld-debug
 %attr(755, root, root) %{_sbindir}/rcmysql
-%attr(755, root, root) %{_libdir}/mysql/plugin/semisync_master.so*
-%attr(755, root, root) %{_libdir}/mysql/plugin/semisync_slave.so*
-%attr(755, root, root) %{_libdir}/mysql/plugin/debug/semisync_master.so*
-%attr(755, root, root) %{_libdir}/mysql/plugin/debug/semisync_slave.so*
+%attr(755, root, root) %{_libdir}/mysql/plugin/audit_null.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/daemon_example.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/mypluglib.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/semisync_master.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/semisync_slave.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/debug/audit_null.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/debug/daemon_example.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/debug/mypluglib.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/debug/semisync_master.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/debug/semisync_slave.so
 
 %if %{WITH_TCMALLOC}
 %attr(755, root, root) %{_libdir}/mysql/%{malloc_lib_target}
@@ -888,13 +760,17 @@ fi
 
 %attr(755, root, root) %{_datadir}/mysql/
 
-%files client
+# ----------------------------------------------------------------------------
+%files -n MySQL-client%{product_suffix}
+
 %defattr(-, root, root, 0755)
 %attr(755, root, root) %{_bindir}/msql2mysql
 %attr(755, root, root) %{_bindir}/mysql
 %attr(755, root, root) %{_bindir}/mysql_find_rows
 %attr(755, root, root) %{_bindir}/mysql_waitpid
 %attr(755, root, root) %{_bindir}/mysqlaccess
+# XXX: This should be moved to %{_sysconfdir}
+%attr(644, root, root) %{_bindir}/mysqlaccess.conf
 %attr(755, root, root) %{_bindir}/mysqladmin
 %attr(755, root, root) %{_bindir}/mysqlbinlog
 %attr(755, root, root) %{_bindir}/mysqlcheck
@@ -916,68 +792,12 @@ fi
 %doc %attr(644, root, man) %{_mandir}/man1/mysqlshow.1*
 %doc %attr(644, root, man) %{_mandir}/man1/mysqlslap.1*
 
-%post shared
-/sbin/ldconfig
-
-%postun shared
-/sbin/ldconfig
-
-%if %{CLUSTER_BUILD}
-%files ndb-storage
-%defattr(-,root,root,0755)
-%attr(755, root, root) %{_sbindir}/ndbd
-%doc %attr(644, root, man) %{_mandir}/man8/ndbd.8*
-
-%files ndb-management
-%defattr(-,root,root,0755)
-%attr(755, root, root) %{_sbindir}/ndb_mgmd
-%doc %attr(644, root, man) %{_mandir}/man8/ndb_mgmd.8*
-
-%files ndb-tools
-%defattr(-,root,root,0755)
-%attr(755, root, root) %{_bindir}/ndb_config
-%attr(755, root, root) %{_bindir}/ndb_desc
-%attr(755, root, root) %{_bindir}/ndb_error_reporter
-%attr(755, root, root) %{_bindir}/ndb_mgm
-%attr(755, root, root) %{_bindir}/ndb_print_backup_file
-%attr(755, root, root) %{_bindir}/ndb_print_schema_file
-%attr(755, root, root) %{_bindir}/ndb_print_sys_file
-%attr(755, root, root) %{_bindir}/ndb_restore
-%attr(755, root, root) %{_bindir}/ndb_select_all
-%attr(755, root, root) %{_bindir}/ndb_select_count
-%attr(755, root, root) %{_bindir}/ndb_show_tables
-%attr(755, root, root) %{_bindir}/ndb_size.pl
-%attr(755, root, root) %{_bindir}/ndb_test_platform
-%attr(755, root, root) %{_bindir}/ndb_waiter
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_config.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_desc.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_error_reporter.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_mgm.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_restore.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_print_backup_file.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_print_schema_file.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_print_sys_file.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_select_all.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_select_count.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_show_tables.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_size.pl.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_waiter.1*
-
-%files ndb-extra
-%defattr(-,root,root,0755)
-%attr(755, root, root) %{_bindir}/ndb_delete_all
-%attr(755, root, root) %{_bindir}/ndb_drop_index
-%attr(755, root, root) %{_bindir}/ndb_drop_table
-%attr(755, root, root) %{_sbindir}/ndb_cpcd
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_delete_all.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_drop_index.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_drop_table.1*
-%doc %attr(644, root, man) %{_mandir}/man1/ndb_cpcd.1*
-%endif
-
-%files devel
+# ----------------------------------------------------------------------------
+%files -n MySQL-devel%{product_suffix} -f optional-files-devel
 %defattr(-, root, root, 0755)
-%doc mysql-release-%{mysql_version}/EXCEPTIONS-CLIENT
+%if %{defined license_files_devel}
+%doc %{license_files_devel}
+%endif
 %doc %attr(644, root, man) %{_mandir}/man1/comp_err.1*
 %doc %attr(644, root, man) %{_mandir}/man1/mysql_config.1*
 %attr(755, root, root) %{_bindir}/mysql_config
@@ -985,63 +805,40 @@ fi
 %dir %attr(755, root, root) %{_libdir}/mysql
 %{_includedir}/mysql/*
 %{_datadir}/aclocal/mysql.m4
-%{_libdir}/mysql/libdbug.a
-%{_libdir}/mysql/libheap.a
-%if %{WITH_LIBGCC}
-%{_libdir}/mysql/libmygcc.a
-%endif
-%{_libdir}/mysql/libmyisam.a
-%{_libdir}/mysql/libmyisammrg.a
 %{_libdir}/mysql/libmysqlclient.a
-%{_libdir}/mysql/libmysqlclient.la
 %{_libdir}/mysql/libmysqlclient_r.a
-%{_libdir}/mysql/libmysqlclient_r.la
 %{_libdir}/mysql/libmysqlservices.a
-%{_libdir}/mysql/libmystrings.a
-%{_libdir}/mysql/libmysys.a
-%if %{CLUSTER_BUILD}
-%{_libdir}/mysql/libndbclient.a
-%{_libdir}/mysql/libndbclient.la
-%endif
-%{_libdir}/mysql/libvio.a
-%{_libdir}/mysql/libz.a
-%{_libdir}/mysql/libz.la
-%{_libdir}/mysql/plugin/semisync_master.a
-%{_libdir}/mysql/plugin/semisync_master.la
-%{_libdir}/mysql/plugin/semisync_slave.a
-%{_libdir}/mysql/plugin/semisync_slave.la
-%{_libdir}/mysql/plugin/debug/semisync_master.a
-%{_libdir}/mysql/plugin/debug/semisync_master.la
-%{_libdir}/mysql/plugin/debug/semisync_slave.a
-%{_libdir}/mysql/plugin/debug/semisync_slave.la
 
-%files shared
+# ----------------------------------------------------------------------------
+%files -n MySQL-shared%{product_suffix}
 %defattr(-, root, root, 0755)
 # Shared libraries (omit for architectures that don't support them)
 %{_libdir}/libmysql*.so*
-%if %{CLUSTER_BUILD}
-%{_libdir}/libndb*.so*
-%endif
 
-%files test
+%post -n MySQL-shared%{product_suffix}
+/sbin/ldconfig
+
+%postun -n MySQL-shared%{product_suffix}
+/sbin/ldconfig
+
+# ----------------------------------------------------------------------------
+%files -n MySQL-test%{product_suffix}
 %defattr(-, root, root, 0755)
 %attr(-, root, root) %{_datadir}/mysql-test
 %attr(755, root, root) %{_bindir}/mysql_client_test
+%attr(755, root, root) %{_bindir}/mysql_client_test_embedded
+%attr(755, root, root) %{_bindir}/mysqltest_embedded
 %doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test.1*
 %doc %attr(644, root, man) %{_mandir}/man1/mysql-stress-test.pl.1*
 %doc %attr(644, root, man) %{_mandir}/man1/mysql-test-run.pl.1*
-%if %{EMBEDDED_BUILD}
-%attr(755, root, root) %{_bindir}/mysql_client_test_embedded
-%attr(755, root, root) %{_bindir}/mysqltest_embedded
 %doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test_embedded.1*
 %doc %attr(644, root, man) %{_mandir}/man1/mysqltest_embedded.1*
-%endif
 
-%if %{EMBEDDED_BUILD}
-%files embedded
+# ----------------------------------------------------------------------------
+%files -n MySQL-embedded%{product_suffix}
 %defattr(-, root, root, 0755)
 %attr(644, root, root) %{_libdir}/mysql/libmysqld.a
-%endif
+%attr(644, root, root) %{_libdir}/mysql/libmysqld-debug.a
 
 ##############################################################################
 # The spec file changelog only includes changes made to the spec file
@@ -1049,6 +846,16 @@ fi
 # merging BK trees)
 ##############################################################################
 %changelog
+* Wed May 12 2010 Jonathan Perkin <jonathan.perkin@stripped>
+
+- Large number of changes to build using CMake
+- Introduce distribution-specific RPMs
+- Drop debuginfo, build all binaries with debug/symbols
+- Remove __os_install_post, use native macro
+- Remove _unpackaged_files_terminate_build, make it an error to have
+  unpackaged files
+- Remove cluster RPMs
+
 * Wed Mar 24 2010 Joerg Bruehe <joerg.bruehe@stripped>
 
 - Add "--with-perfschema" to the configure options.
@@ -1658,7 +1465,7 @@ fi
 
 - Reworked the build steps a little bit: the Max binary is supposed
   to include OpenSSL, which cannot be linked statically, thus trying
-	to statically link against a special glibc is futile anyway
+  to statically link against a special glibc is futile anyway
 - because of this, it is not required to make yet another build run
   just to compile the shared libs (saves a lot of time)
 - updated package description of the Max subpackage
@@ -1669,7 +1476,7 @@ fi
 - Updated Packager information
 - Fixed the build options: the regular package is supposed to
   include InnoDB and linked statically, while the Max package
-	should include BDB and SSL support
+  should include BDB and SSL support
 
 * Fri May 03 2002 Lenz Grimmer <lenz@stripped>
 

=== modified file 'tests/Makefile.am'
--- a/tests/Makefile.am	2009-07-08 14:49:45 +0000
+++ b/tests/Makefile.am	2010-05-19 13:00:23 +0000
@@ -60,6 +60,3 @@ DEFS =			-DMYSQL_CLIENT_NO_THREADS
 
 thread_test.o:		thread_test.c
 			$(COMPILE) -c $(INCLUDES) $<
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'unittest/Makefile.am'
--- a/unittest/Makefile.am	2007-05-28 20:18:51 +0000
+++ b/unittest/Makefile.am	2010-05-19 13:00:23 +0000
@@ -25,6 +25,3 @@ test:
 
 test-verbose:
 	HARNESS_VERBOSE=1 perl unit.pl run $(unittests)
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'unittest/examples/Makefile.am'
--- a/unittest/examples/Makefile.am	2010-04-30 14:27:05 +0000
+++ b/unittest/examples/Makefile.am	2010-05-19 13:01:45 +0000
@@ -23,6 +23,3 @@ LDADD 		= $(top_builddir)/unittest/mytap
 
 # We omit core-t here, since it will always fail.
 noinst_PROGRAMS    = simple-t skip-t todo-t skip_all-t no_plan-t
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'unittest/mysys/CMakeLists.txt'
--- a/unittest/mysys/CMakeLists.txt	2009-11-30 01:49:26 +0000
+++ b/unittest/mysys/CMakeLists.txt	2010-05-19 13:50:12 +0000
@@ -27,6 +27,6 @@ MACRO (MY_ADD_TEST name)
 ENDMACRO()
 
 
-FOREACH(testname bitmap base64 my_vsnprintf my_atomic my_rdtsc lf)
+FOREACH(testname bitmap base64 my_vsnprintf my_atomic my_rdtsc lf waiting_threads)
   MY_ADD_TEST(${testname})
 ENDFOREACH()

=== modified file 'unittest/mysys/Makefile.am'
--- a/unittest/mysys/Makefile.am	2010-04-30 14:27:05 +0000
+++ b/unittest/mysys/Makefile.am	2010-05-19 13:50:12 +0000
@@ -29,7 +29,7 @@ if NEED_THREAD
 # my_atomic-t is used to check thread functions, so it is safe to 
 # ignore the file in non-threaded builds.
 # In fact, it will not compile without thread support.
-noinst_PROGRAMS += my_atomic-t
+noinst_PROGRAMS += my_atomic-t waiting_threads-t
 endif
 
 EXTRA_DIST       = CMakeLists.txt

=== added file 'unittest/mysys/waiting_threads-t.c'
--- a/unittest/mysys/waiting_threads-t.c	1970-01-01 00:00:00 +0000
+++ b/unittest/mysys/waiting_threads-t.c	2010-05-19 13:50:12 +0000
@@ -0,0 +1,340 @@
+/* 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
+
+/*
+  This is a unit test for the deadlock detector in mysys/waiting_thread.c and
+  include/waiting_thread.h.
+  As the detector is not used in MySQL, and the test sometimes fails on some
+  platforms and we don't have time to investigate/fix it, this test is
+  compiled but not run (see start of do_tests()). Make sure to enable it if
+  you use the module.
+*/
+
+#include "thr_template.c"
+#include <waiting_threads.h>
+#include <m_string.h>
+
+/*
+  Random-number section.
+
+  These functions used to be in mysys in MySQL 6.0, replacing randominit()
+  and my_rnd() from sql/password.c.
+  my_rnd_struct used to be in include/my_sys.h in MySQL 6.0, replacing
+  rand_struct from include/mysql_com.h. But this change has not been
+  back-ported to next-mr because:
+  - mysql_com.h is included in mysql.h so is part of the API
+  - assume a 3rd-party product including mysql.h and using rand_struct
+  - moving the definition of the struct into my_sys.h forces this product to
+  have to include my_sys.h which is generally unwanted.
+
+  So for now this code stays duplicated here.
+*/
+
+struct my_rnd_struct {
+  unsigned long seed1,seed2,max_value;
+  double max_value_dbl;
+};
+
+/** Initialize random generator, see password.c:randominit() */
+
+static void my_rnd_init(struct my_rnd_struct *rand_st, ulong seed1, ulong seed2)
+{
+#ifdef HAVE_purify
+  bzero((char*) rand_st,sizeof(*rand_st));      /* Avoid UMC varnings */
+#endif
+  rand_st->max_value= 0x3FFFFFFFL;
+  rand_st->max_value_dbl=(double) rand_st->max_value;
+  rand_st->seed1=seed1%rand_st->max_value ;
+  rand_st->seed2=seed2%rand_st->max_value;
+}
+
+/** Generate random number, see password.c:my_rnd() */
+
+static double my_rnd(struct my_rnd_struct *rand_st)
+{
+  rand_st->seed1=(rand_st->seed1*3+rand_st->seed2) % rand_st->max_value;
+  rand_st->seed2=(rand_st->seed1+rand_st->seed2+33) % rand_st->max_value;
+  return (((double) rand_st->seed1)/rand_st->max_value_dbl);
+}
+
+/* end of random-number section; start of unit test for deadlock detector */
+
+
+struct test_wt_thd {
+  WT_THD thd;
+  pthread_mutex_t lock;
+} thds[THREADS];
+
+uint i, cnt;
+pthread_mutex_t lock;
+pthread_cond_t thread_sync;
+
+ulong wt_timeout_short=100, wt_deadlock_search_depth_short=4;
+ulong wt_timeout_long=10000, wt_deadlock_search_depth_long=15;
+
+#define reset(ARRAY) bzero(ARRAY, sizeof(ARRAY))
+
+/* see explanation of the kill strategies in waiting_threads.h */
+enum { LATEST, RANDOM, YOUNGEST, LOCKS } kill_strategy;
+
+WT_RESOURCE_TYPE restype={ wt_resource_id_memcmp, 0};
+
+#define rnd() ((uint)(my_rnd(&rand) * INT_MAX32))
+
+/*
+  stress test: wait on a random number of random threads.
+  it always succeeds (unless crashes or hangs).
+*/
+pthread_handler_t test_wt(void *arg)
+{
+  int    m, n, i, id, res;
+  struct my_rnd_struct rand;
+
+  my_thread_init();
+
+  pthread_mutex_lock(&mutex);
+  id= cnt++;
+  wt_thd_lazy_init(& thds[id].thd,
+                   & wt_deadlock_search_depth_short, & wt_timeout_short,
+                   & wt_deadlock_search_depth_long, & wt_timeout_long);
+
+  /* now, wait for everybody to be ready to run */
+  if (cnt >= THREADS)
+    pthread_cond_broadcast(&thread_sync);
+  else
+    while (cnt < THREADS)
+      pthread_cond_wait(&thread_sync, &mutex);
+  pthread_mutex_unlock(&mutex);
+
+  my_rnd_init(&rand, (ulong)(intptr)&m, id);
+  if (kill_strategy == YOUNGEST)
+    thds[id].thd.weight= (ulong)~my_getsystime();
+  if (kill_strategy == LOCKS)
+    thds[id].thd.weight= 0;
+
+  for (m= *(int *)arg; m ; m--)
+  {
+    WT_RESOURCE_ID resid;
+    int blockers[THREADS/10], j, k;
+
+    resid.value= id;
+    resid.type= &restype;
+
+    res= 0;
+
+    /* prepare for waiting for a random number of random threads */
+    for (j= n= (rnd() % THREADS)/10; !res && j >= 0; j--)
+    {
+retry:
+      i= rnd() % (THREADS-1); /* pick a random thread */
+      if (i >= id) i++;   /* with a number from 0 to THREADS-1 excluding ours */
+
+      for (k=n; k >=j; k--) /* the one we didn't pick before */
+        if (blockers[k] == i)
+          goto retry;
+      blockers[j]= i;
+
+      if (kill_strategy == RANDOM)
+        thds[id].thd.weight= rnd();
+
+      pthread_mutex_lock(& thds[i].lock);
+      res= wt_thd_will_wait_for(& thds[id].thd, & thds[i].thd, &resid);
+      pthread_mutex_unlock(& thds[i].lock);
+    }
+
+    if (!res)
+    {
+      pthread_mutex_lock(&lock);
+      res= wt_thd_cond_timedwait(& thds[id].thd, &lock);
+      pthread_mutex_unlock(&lock);
+    }
+
+    if (res)
+    {
+      pthread_mutex_lock(& thds[id].lock);
+      pthread_mutex_lock(&lock);
+      wt_thd_release_all(& thds[id].thd);
+      pthread_mutex_unlock(&lock);
+      pthread_mutex_unlock(& thds[id].lock);
+      if (kill_strategy == LOCKS)
+        thds[id].thd.weight= 0;
+      if (kill_strategy == YOUNGEST)
+        thds[id].thd.weight= (ulong)~my_getsystime();
+    }
+    else if (kill_strategy == LOCKS)
+      thds[id].thd.weight++;
+  }
+
+  pthread_mutex_lock(&mutex);
+  /* wait for everybody to finish */
+  if (!--cnt)
+    pthread_cond_broadcast(&thread_sync);
+  else
+    while (cnt)
+      pthread_cond_wait(&thread_sync, &mutex);
+
+  pthread_mutex_lock(& thds[id].lock);
+  pthread_mutex_lock(&lock);
+  wt_thd_release_all(& thds[id].thd);
+  pthread_mutex_unlock(&lock);
+  pthread_mutex_unlock(& thds[id].lock);
+  wt_thd_destroy(& thds[id].thd);
+
+  if (!--running_threads) /* now, signal when everybody is done with deinit */
+    pthread_cond_signal(&cond);
+  pthread_mutex_unlock(&mutex);
+  DBUG_PRINT("wt", ("exiting"));
+  my_thread_end();
+  return 0;
+}
+
+void do_one_test()
+{
+  double sum, sum0;
+  DBUG_ENTER("do_one_test");
+
+  reset(wt_cycle_stats);
+  reset(wt_wait_stats);
+  wt_success_stats=0;
+  cnt=0;
+  test_concurrently("waiting_threads", test_wt, THREADS, CYCLES);
+
+  sum=sum0=0;
+  for (cnt=0; cnt < WT_CYCLE_STATS; cnt++)
+    sum+= wt_cycle_stats[0][cnt] + wt_cycle_stats[1][cnt];
+  for (cnt=0; cnt < WT_CYCLE_STATS; cnt++)
+    if (wt_cycle_stats[0][cnt] + wt_cycle_stats[1][cnt] > 0)
+    {
+      sum0+=wt_cycle_stats[0][cnt] + wt_cycle_stats[1][cnt];
+      diag("deadlock cycles of length %2u: %4u %4u %8.2f %%", cnt,
+           wt_cycle_stats[0][cnt], wt_cycle_stats[1][cnt], 1e2*sum0/sum);
+    }
+  diag("depth exceeded: %u %u",
+       wt_cycle_stats[0][cnt], wt_cycle_stats[1][cnt]);
+  for (cnt=0; cnt < WT_WAIT_STATS; cnt++)
+    if (wt_wait_stats[cnt]>0)
+      diag("deadlock waits up to %7llu us: %5u",
+           wt_wait_table[cnt], wt_wait_stats[cnt]);
+  diag("timed out: %u", wt_wait_stats[cnt]);
+  diag("successes: %u", wt_success_stats);
+
+  DBUG_VOID_RETURN;
+}
+
+void do_tests()
+{
+  DBUG_ENTER("do_tests");
+
+  skip_all(": this module is not used in MySQL");
+
+  plan(12);
+  compile_time_assert(THREADS >= 4);
+
+  DBUG_PRINT("wt", ("================= initialization ==================="));
+
+  bad= my_atomic_initialize();
+  ok(!bad, "my_atomic_initialize() returned %d", bad);
+
+  pthread_cond_init(&thread_sync, 0);
+  pthread_mutex_init(&lock, 0);
+  wt_init();
+  for (cnt=0; cnt < THREADS; cnt++)
+    pthread_mutex_init(& thds[cnt].lock, 0);
+  {
+    WT_RESOURCE_ID resid[4];
+    for (i=0; i < array_elements(resid); i++)
+    {
+      wt_thd_lazy_init(& thds[i].thd,
+                       & wt_deadlock_search_depth_short, & wt_timeout_short,
+                       & wt_deadlock_search_depth_long, & wt_timeout_long);
+      resid[i].value= i+1;
+      resid[i].type= &restype;
+    }
+
+    DBUG_PRINT("wt", ("================= manual test ==================="));
+
+#define ok_wait(X,Y, R) \
+    ok(wt_thd_will_wait_for(& thds[X].thd, & thds[Y].thd, &resid[R]) == 0, \
+      "thd[" #X "] will wait for thd[" #Y "]")
+#define ok_deadlock(X,Y,R) \
+    ok(wt_thd_will_wait_for(& thds[X].thd, & thds[Y].thd, &resid[R]) == WT_DEADLOCK, \
+      "thd[" #X "] will wait for thd[" #Y "] - deadlock")
+
+    ok_wait(0,1,0);
+    ok_wait(0,2,0);
+    ok_wait(0,3,0);
+
+    pthread_mutex_lock(&lock);
+    bad= wt_thd_cond_timedwait(& thds[0].thd, &lock);
+    pthread_mutex_unlock(&lock);
+    ok(bad == WT_TIMEOUT, "timeout test returned %d", bad);
+
+    ok_wait(0,1,0);
+    ok_wait(1,2,1);
+    ok_deadlock(2,0,2);
+
+    pthread_mutex_lock(&lock);
+    ok(wt_thd_cond_timedwait(& thds[0].thd, &lock) == WT_TIMEOUT, "as always");
+    ok(wt_thd_cond_timedwait(& thds[1].thd, &lock) == WT_TIMEOUT, "as always");
+    wt_thd_release_all(& thds[0].thd);
+    wt_thd_release_all(& thds[1].thd);
+    wt_thd_release_all(& thds[2].thd);
+    wt_thd_release_all(& thds[3].thd);
+
+    for (i=0; i < array_elements(resid); i++)
+    {
+      wt_thd_release_all(& thds[i].thd);
+      wt_thd_destroy(& thds[i].thd);
+    }
+    pthread_mutex_unlock(&lock);
+  }
+
+  wt_deadlock_search_depth_short=6;
+  wt_timeout_short=1000;
+  wt_timeout_long= 100;
+  wt_deadlock_search_depth_long=16;
+  DBUG_PRINT("wt", ("================= stress test ==================="));
+
+  diag("timeout_short=%lu us, deadlock_search_depth_short=%lu",
+       wt_timeout_short, wt_deadlock_search_depth_short);
+  diag("timeout_long=%lu us, deadlock_search_depth_long=%lu",
+       wt_timeout_long, wt_deadlock_search_depth_long);
+
+#define test_kill_strategy(X)                   \
+  diag("kill strategy: " #X);                   \
+  DBUG_EXECUTE("reset_file",                    \
+               { rewind(DBUG_FILE); my_chsize(fileno(DBUG_FILE), 0, 0, MYF(0)); }); \
+  DBUG_PRINT("info", ("kill strategy: " #X));   \
+  kill_strategy=X;                              \
+  do_one_test();
+
+  test_kill_strategy(LATEST);
+  test_kill_strategy(RANDOM);
+  /*
+    these two take looong time on sol10-amd64-a
+    the server doesn't use this code now, so we disable these tests
+
+    test_kill_strategy(YOUNGEST);
+    test_kill_strategy(LOCKS);
+  */
+
+  DBUG_PRINT("wt", ("================= cleanup ==================="));
+  for (cnt=0; cnt < THREADS; cnt++)
+    pthread_mutex_destroy(& thds[cnt].lock);
+  wt_end();
+  pthread_mutex_destroy(&lock);
+  pthread_cond_destroy(&thread_sync);
+  DBUG_VOID_RETURN;
+}

=== modified file 'unittest/mytap/t/Makefile.am'
--- a/unittest/mytap/t/Makefile.am	2010-04-30 14:27:05 +0000
+++ b/unittest/mytap/t/Makefile.am	2010-05-19 13:01:45 +0000
@@ -21,6 +21,3 @@ LDADD 		= $(top_builddir)/unittest/mytap
 		  $(top_builddir)/strings/libmystrings.a
 
 noinst_PROGRAMS = basic-t
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'vio/Makefile.am'
--- a/vio/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/vio/Makefile.am	2010-05-19 13:00:23 +0000
@@ -23,6 +23,3 @@ noinst_HEADERS =	vio_priv.h
 libvio_a_SOURCES =	vio.c viosocket.c viossl.c viosslfactories.c
 
 EXTRA_DIST=		CMakeLists.txt
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'win/Makefile.am'
--- a/win/Makefile.am	2009-06-18 08:49:44 +0000
+++ b/win/Makefile.am	2010-05-19 13:00:23 +0000
@@ -17,6 +17,3 @@
 EXTRA_DIST = build-vs71.bat build-vs8.bat build-vs8_x64.bat build-vs9.bat \
              build-vs9_x64.bat configure.js README mysql_manifest.cmake \
              create_manifest.js create_def_file.js
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%

=== modified file 'zlib/Makefile.am'
--- a/zlib/Makefile.am	2007-04-10 23:48:43 +0000
+++ b/zlib/Makefile.am	2010-05-19 13:00:23 +0000
@@ -33,6 +33,3 @@ libz_la_SOURCES    = adler32.c compress.
 libzlt_la_SOURCES  = $(libz_la_SOURCES)
 
 EXTRA_DIST= README FAQ INDEX ChangeLog algorithm.txt zlib.3 CMakeLists.txt
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%


Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20100520160110-tfekodkxk60x8jqo.bundle
Thread
bzr commit into mysql-next-mr branch (marc.alff:3147) Marc Alff20 May