List:Commits« Previous MessageNext Message »
From:Jorgen Loland Date:May 25 2009 6:46am
Subject:bzr commit into mysql-6.0-backup-merge branch (jorgen.loland:2802)
View as plain text  
#At file:///localhome/jl208045/mysql/mergecaptain/mysql-6.0-backup-merge/ based on revid:jorgen.loland@stripped

 2802 Jorgen Loland	2009-05-25 [merge]
      Merge mysql-azalea -> mysql-6.0-backup-merge

    removed:
      BUILD/compile-alpha-ccc
      BUILD/compile-alpha-cxx
      mysql-test/collections/mysql-6.0-bugteam.push
      mysql-test/collections/mysql-6.0-falcon-.push
      mysys/make-ccc
      regex/make-ccc
      storage/heap/make-ccc
      storage/maria/ma_ft_eval.c
      storage/maria/ma_ft_eval.h
      storage/maria/ma_ft_stem.c
      storage/maria/ma_ft_test1.c
      storage/maria/ma_ft_test1.h
      storage/myisam/ft_eval.c
      storage/myisam/ft_eval.h
      storage/myisam/ft_stem.c
      storage/myisam/ft_test1.c
      storage/myisam/ft_test1.h
      storage/myisam/make-ccc
      storage/myisammrg/make-ccc
      strings/make-ccc
    added:
      include/mysql/service_my_snprintf.h
      include/mysql/service_thd_alloc.h
      include/mysql/services.h
      include/service_versions.h
      libservices/
      libservices/CMakeLists.txt
      libservices/Makefile.am
      libservices/my_snprintf_service.c
      libservices/thd_alloc_service.c
      mysql-test/extra/rpl_tests/rpl_row_record_find.test
      mysql-test/r/drop_debug.result
      mysql-test/r/log_state_bug33693.result
      mysql-test/suite/binlog/r/binlog_max_extension.result
      mysql-test/suite/binlog/t/binlog_max_extension.test
      mysql-test/suite/rpl/include/rpl_not_null.inc
      mysql-test/suite/rpl/r/rpl_bug41902.result
      mysql-test/suite/rpl/r/rpl_not_null_innodb.result
      mysql-test/suite/rpl/r/rpl_not_null_myisam.result
      mysql-test/suite/rpl/r/rpl_row_record_find_falcon.result
      mysql-test/suite/rpl/r/rpl_row_record_find_innodb.result
      mysql-test/suite/rpl/r/rpl_row_record_find_myisam.result
      mysql-test/suite/rpl/t/rpl_bug41902-slave.opt
      mysql-test/suite/rpl/t/rpl_bug41902.test
      mysql-test/suite/rpl/t/rpl_not_null_innodb.test
      mysql-test/suite/rpl/t/rpl_not_null_myisam.test
      mysql-test/suite/rpl/t/rpl_row_record_find_falcon.test
      mysql-test/suite/rpl/t/rpl_row_record_find_innodb.test
      mysql-test/suite/rpl/t/rpl_row_record_find_myisam.test
      mysql-test/t/drop_debug.test
      mysql-test/t/log_state_bug33693-master.opt
      mysql-test/t/log_state_bug33693.test
      sql/sql_plugin_services.h
    modified:
      BUILD/Makefile.am
      CMakeLists.txt
      Makefile.am
      README
      client/mysql.cc
      client/mysqlbinlog.cc
      client/mysqltest.cc
      client/sql_string.cc
      configure.in
      extra/my_print_defaults.c
      include/Makefile.am
      include/config-win.h
      include/lf.h
      include/m_string.h
      include/maria.h
      include/my_bitmap.h
      include/my_global.h
      include/my_pthread.h
      include/my_sys.h
      include/myisam.h
      include/myisamchk.h
      include/mysql/plugin.h
      include/mysql/plugin.h.pp
      libmysqld/Makefile.am
      mysql-test/include/mtr_check.sql
      mysql-test/include/setup_fake_relay_log.inc
      mysql-test/lib/My/File/Path.pm
      mysql-test/lib/My/SafeProcess.pm
      mysql-test/lib/My/SafeProcess/Base.pm
      mysql-test/lib/mtr_cases.pm
      mysql-test/lib/mtr_process.pl
      mysql-test/lib/mtr_report.pm
      mysql-test/lib/mtr_unique.pm
      mysql-test/mysql-test-run.pl
      mysql-test/r/init_file.result
      mysql-test/r/log_state.result
      mysql-test/r/lowercase_table2.result
      mysql-test/r/mysqltest.result
      mysql-test/r/parser.result
      mysql-test/r/plugin.result
      mysql-test/suite/backup/r/backup_logs.result
      mysql-test/suite/backup/t/backup_logs.test
      mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test
      mysql-test/suite/binlog/t/disabled.def
      mysql-test/suite/funcs_1/datadict/is_routines.inc
      mysql-test/suite/funcs_1/r/is_routines.result
      mysql-test/suite/rpl/r/rpl_change_master.result
      mysql-test/suite/rpl/t/disabled.def
      mysql-test/suite/rpl/t/rpl_change_master.test
      mysql-test/t/init_file.test
      mysql-test/t/log_state.test
      mysql-test/t/lowercase_table2.test
      mysql-test/t/myisam-system.test
      mysql-test/t/mysqlbinlog.test
      mysql-test/t/mysqltest.test
      mysql-test/t/parser.test
      mysql-test/t/plugin.test
      mysys/default.c
      mysys/lf_alloc-pin.c
      mysys/lf_dynarray.c
      mysys/lf_hash.c
      mysys/my_getopt.c
      mysys/my_getsystime.c
      mysys/my_pthread.c
      mysys/my_safehash.c
      mysys/my_safehash.h
      mysys/typelib.c
      mysys/waiting_threads.c
      plugin/daemon_example/Makefile.am
      scripts/make_binary_distribution.sh
      scripts/make_win_bin_dist
      scripts/mysqld_safe.sh
      sql-common/client.c
      sql-common/my_time.c
      sql-common/pack.c
      sql/CMakeLists.txt
      sql/Makefile.am
      sql/field.cc
      sql/ha_partition.cc
      sql/handler.h
      sql/item.cc
      sql/item.h
      sql/item_cmpfunc.cc
      sql/item_func.cc
      sql/item_strfunc.cc
      sql/item_sum.cc
      sql/item_sum.h
      sql/item_timefunc.cc
      sql/log.cc
      sql/log.h
      sql/log_event.cc
      sql/log_event.h
      sql/log_event_old.cc
      sql/mysql_priv.h
      sql/mysqld.cc
      sql/replication.h
      sql/rpl_info.h
      sql/rpl_record.cc
      sql/rpl_record.h
      sql/set_var.cc
      sql/slave.cc
      sql/sql_base.cc
      sql/sql_bitmap.h
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_connect.cc
      sql/sql_db.cc
      sql/sql_delete.cc
      sql/sql_lex.cc
      sql/sql_parse.cc
      sql/sql_partition.cc
      sql/sql_plugin.cc
      sql/sql_plugin.h
      sql/sql_prepare.cc
      sql/sql_repl.cc
      sql/sql_select.cc
      sql/sql_show.cc
      sql/sql_string.cc
      sql/sql_table.cc
      sql/sql_udf.h
      sql/sql_update.cc
      sql/sql_yacc.yy
      sql/thr_malloc.cc
      sql/time.cc
      sql/transaction.cc
      storage/archive/archive_performance.c
      storage/archive/archive_test.c
      storage/example/Makefile.am
      storage/example/ha_example.cc
      storage/falcon/IndexKey.cpp.save
      storage/falcon/ha_falcon.cpp
      storage/maria/Makefile.am
      storage/maria/ma_bitmap.c
      storage/maria/ma_blockrec.c
      storage/maria/ma_create.c
      storage/maria/ma_key.c
      storage/maria/ma_loghandler.c
      storage/maria/ma_loghandler_lsn.h
      storage/maria/ma_pagecache.c
      storage/maria/ma_recovery.c
      storage/maria/maria_backup_engine.cc
      storage/maria/maria_def.h
      storage/maria/maria_pack.c
      storage/maria/trnman.h
      storage/maria/unittest/lockman2-t.c
      storage/maria/unittest/ma_control_file-t.c
      storage/maria/unittest/trnman-t.c
      storage/myisam/CMakeLists.txt*
      storage/myisam/Makefile.am
      storage/myisam/ft_myisam.c
      storage/myisam/mi_create.c
      storage/myisam/myisam_backup_engine.cc
      storage/myisam/myisampack.c
      storage/mysql_storage_engine.cmake
      storage/ndb/src/ndbapi/NdbRecAttr.cpp
      storage/ndb/test/run-test/setup.cpp
      strings/ctype-ucs2.c
      strings/decimal.c
      strings/dtoa.c
      strings/my_strtoll10.c
      strings/my_vsnprintf.c
      tests/mysql_client_test.c
=== modified file 'BUILD/Makefile.am'
--- a/BUILD/Makefile.am	2009-01-07 10:58:33 +0000
+++ b/BUILD/Makefile.am	2009-04-06 23:03:28 +0000
@@ -24,8 +24,6 @@ EXTRA_DIST =		FINISH.sh \
 			check-cpu \
 			cleanup \
 			compile-alpha \
-			compile-alpha-ccc \
-			compile-alpha-cxx \
 			compile-alpha-debug \
 			compile-amd64-debug-max \
 			compile-amd64-debug-max-no-ndb \

=== removed file 'BUILD/compile-alpha-ccc'
--- a/BUILD/compile-alpha-ccc	2009-04-03 23:38:18 +0000
+++ b/BUILD/compile-alpha-ccc	1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
-#! /bin/sh
-
-/bin/rm -f */.deps/*.P */*.o
-make -k maintainer-clean
-/bin/rm -f */.deps/*.P */*.o
-/bin/rm -f config.cache mysql-*.tar.gz
-
-path=`dirname $0`
-. "$path/autorun.sh"
-
-CC=ccc CFLAGS="-fast -O3 -fomit-frame-pointer" CXX=g++ CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -mcpu=ev6 -Wa,-mev6" CXXLDFLAGS='/usr/lib/compaq/libots-2.2.7/libots.so /usr/lib/compaq/cpml-5.0.0/libcpml_ev6.a' ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-thread-safe-client
-make
-rm */.deps/*
-make
-if [ $? = 0 ]
-then
-  rm */.deps/*
-  bin/mysqladmin shutdown
-  sur make install
-  if [ $? = 0 ]
-  then
-     scripts/make_binary_distribution
-  fi
-fi
-
-exit
-
-# This should give better performance by compiling many files at once, but
-# according to our benchmarks there isn't any real difference.
-
-pwd=`pwd`
-for i in */make-ccc
-do
-   cd `dirname $i`
-   make-ccc
-   cd $pwd
-done
-cd sql
-rm mysqld .deps/*.P
-make mysqld
-cd $pwd

=== removed file 'BUILD/compile-alpha-cxx'
--- a/BUILD/compile-alpha-cxx	2007-01-28 20:09:54 +0000
+++ b/BUILD/compile-alpha-cxx	1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
-#! /bin/sh
-
-/bin/rm -f */.deps/*.P */*.o
-make -k maintainer-clean
-/bin/rm -f */.deps/*.P */*.o
-/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache mysql-*.tar.gz
-
-path=`dirname $0`
-. "$path/autorun.sh"
-
-CC=ccc CFLAGS="-fast" CXX=cxx CXXFLAGS="-fast -noexceptions -nortti" ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-non_shared --with-client-ldflags=-non_shared --without-extra-tools --disable-dependency-tracking
-
-make -j2
-find . -name ".deps" | xargs rm -r 
-make
-if [ $? = 0 ]
-then
-  find . -name ".deps" | xargs rm -r 
-  bin/mysqladmin shutdown
-  sur make install
-  if [ $? = 0 ]
-  then
-     scripts/make_binary_distribution
-  fi
-  make test
-fi
-
-exit
-
-# This should give better performance by compiling many files at once, but
-# according to our benchmarks there isn't any real difference.
-
-pwd=`pwd`
-for i in */make-ccc
-do
-   cd `dirname $i`
-   make-ccc
-   cd $pwd
-done
-cd sql
-rm mysqld .deps/*.P
-make mysqld
-cd $pwd

=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt	2009-04-15 23:38:47 +0000
+++ b/CMakeLists.txt	2009-05-04 20:51:05 +0000
@@ -318,6 +318,7 @@ ADD_SUBDIRECTORY(extra)
 ADD_SUBDIRECTORY(client)
 ADD_SUBDIRECTORY(sql)
 ADD_SUBDIRECTORY(libmysql)
+ADD_SUBDIRECTORY(libservices)
 ADD_SUBDIRECTORY(tests)
 ADD_SUBDIRECTORY(unittest/mytap)
 ADD_SUBDIRECTORY(unittest/examples)

=== modified file 'Makefile.am'
--- a/Makefile.am	2009-02-23 11:55:35 +0000
+++ b/Makefile.am	2009-05-07 14:10:24 +0000
@@ -28,7 +28,7 @@ EXTRA_DIST =		INSTALL-SOURCE INSTALL-WIN
 
 SUBDIRS =		. include @docs_dirs@ @zlib_dir@ \
 			@readline_topdir@ sql-common scripts \
-			@pstack_dir@ \
+			@pstack_dir@ libservices \
 			@sql_union_dirs@ unittest storage plugin \
 			@sql_server@ @man_dirs@ tests \
 			netware @libmysqld_dirs@ \
@@ -37,7 +37,7 @@ SUBDIRS =		. include @docs_dirs@ @zlib_d
 
 DIST_SUBDIRS =		. include Docs zlib \
 			cmd-line-utils sql-common scripts \
-			pstack \
+			pstack libservices \
 			strings mysys dbug mysys/tests extra regex libmysql libmysql_r client unittest storage plugin \
 			vio sql man tests \
 			netware libmysqld \

=== modified file 'README'
--- a/README	2008-03-26 10:15:03 +0000
+++ b/README	2009-05-05 14:27:35 +0000
@@ -1,11 +1,19 @@
 This is a release of MySQL, a dual-license SQL database server.
-MySQL is brought to you by the MySQL team at MySQL AB.
+MySQL is brought to you by the MySQL team at Sun Microsystems, Inc.
 
 License information can be found in these files:
 - For GPL (free) distributions, see the COPYING file and
   the EXCEPTIONS-CLIENT file.
 - For commercial distributions, see the LICENSE.mysql file.
 
+GPLv2 Disclaimer
+For the avoidance of doubt, except that if any license choice
+other than GPL or LGPL is available it will apply instead, Sun
+elects to use only the General Public License version 2 (GPLv2)
+at this time for any software where a choice of GPL license versions
+is made available with the language indicating that GPLv2 or any
+later version may be used, or where a choice of which version of
+the GPL is applied is otherwise unspecified.
 
 For further information about MySQL or additional documentation, see:
 - The latest information about MySQL: http://www.mysql.com

=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	2009-04-14 14:23:07 +0000
+++ b/client/mysql.cc	2009-05-14 17:35:06 +0000
@@ -55,7 +55,6 @@ static char *server_version= NULL;
 #define MAX_SERVER_ARGS               64
 
 void* sql_alloc(unsigned size);	     // Don't use mysqld alloc for these
-void sql_element_free(void *ptr);
 #include "sql_string.h"
 
 extern "C" {
@@ -4936,8 +4935,4 @@ void *sql_alloc(size_t Size)
   return my_malloc(Size,MYF(MY_WME));
 }
 
-void sql_element_free(void *ptr)
-{
-  my_free(ptr,MYF(0));
-}
 #endif /* EMBEDDED_LIBRARY */

=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc	2009-03-17 20:07:27 +0000
+++ b/client/mysqlbinlog.cc	2009-04-21 09:28:48 +0000
@@ -1302,7 +1302,6 @@ static int parse_args(int *argc, char***
   int ho_error;
 
   result_file = stdout;
-  load_defaults("my",load_default_groups,argc,argv);
   if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
     exit(ho_error);
   if (debug_info_flag)
@@ -1956,8 +1955,9 @@ int main(int argc, char** argv)
 
   my_init_time(); // for time functions
 
+  load_defaults("my", load_default_groups, &argc, &argv);
+  defaults_argv= argv;
   parse_args(&argc, (char***)&argv);
-  defaults_argv=argv;
 
   if (!argc)
   {

=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2009-04-09 10:00:53 +0000
+++ b/client/mysqltest.cc	2009-05-11 17:58:07 +0000
@@ -282,6 +282,7 @@ enum enum_commands {
   Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE,
   Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER,
   Q_RESULT_FORMAT_VERSION,
+  Q_MOVE_FILE,
 
   Q_UNKNOWN,			       /* Unknown command.   */
   Q_COMMENT,			       /* Comments, ignored. */
@@ -377,6 +378,7 @@ const char *command_names[]=
   "send_shutdown",
   "shutdown_server",
   "result_format",
+  "move_file",
 
   0
 };
@@ -1792,7 +1794,7 @@ void check_result()
           log_file.file_name(), reject_file, errno);
 
     show_diff(NULL, result_file_name, reject_file);
-    die(mess);
+    die("%s", mess);
     break;
   }
   default: /* impossible */
@@ -2943,6 +2945,42 @@ void do_copy_file(struct st_command *com
 
 /*
   SYNOPSIS
+  do_move_file
+  command	command handle
+
+  DESCRIPTION
+  move_file <from_file> <to_file>
+  Move <from_file> to <to_file>
+*/
+
+void do_move_file(struct st_command *command)
+{
+  int error;
+  static DYNAMIC_STRING ds_from_file;
+  static DYNAMIC_STRING ds_to_file;
+  const struct command_arg move_file_args[] = {
+    { "from_file", ARG_STRING, TRUE, &ds_from_file, "Filename to move from" },
+    { "to_file", ARG_STRING, TRUE, &ds_to_file, "Filename to move to" }
+  };
+  DBUG_ENTER("do_move_file");
+
+  check_command_args(command, command->first_argument,
+                     move_file_args,
+                     sizeof(move_file_args)/sizeof(struct command_arg),
+                     ' ');
+
+  DBUG_PRINT("info", ("Move %s to %s", ds_from_file.str, ds_to_file.str));
+  error= (my_rename(ds_from_file.str, ds_to_file.str,
+                    MYF(0)) != 0);
+  handle_command_error(command, error);
+  dynstr_free(&ds_from_file);
+  dynstr_free(&ds_to_file);
+  DBUG_VOID_RETURN;
+}
+
+
+/*
+  SYNOPSIS
   do_chmod_file
   command	command handle
 
@@ -7723,6 +7761,7 @@ int main(int argc, char **argv)
       case Q_CHANGE_USER: do_change_user(command); break;
       case Q_CAT_FILE: do_cat_file(command); break;
       case Q_COPY_FILE: do_copy_file(command); break;
+      case Q_MOVE_FILE: do_move_file(command); break;
       case Q_CHMOD_FILE: do_chmod_file(command); break;
       case Q_PERL: do_perl(command); break;
       case Q_RESULT_FORMAT_VERSION: do_result_format_version(command); break;

=== modified file 'client/sql_string.cc'
--- a/client/sql_string.cc	2009-03-24 14:24:44 +0000
+++ b/client/sql_string.cc	2009-04-24 10:04:14 +0000
@@ -34,7 +34,6 @@
 */
 
 extern void sql_alloc(size_t size);
-extern void sql_element_free(void *ptr);
 
 #include "sql_string.h"
 

=== modified file 'configure.in'
--- a/configure.in	2009-04-30 14:39:35 +0000
+++ b/configure.in	2009-05-14 17:35:06 +0000
@@ -2981,7 +2981,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile 
  man/Makefile BUILD/Makefile vio/Makefile dnl
  libmysql/Makefile libmysql_r/Makefile client/Makefile dnl
  sql/Makefile sql/share/Makefile sql/backup/Makefile dnl
- sql/sql_builtin.cc sql-common/Makefile dnl
+ sql/sql_builtin.cc sql-common/Makefile libservices/Makefile dnl
  dbug/Makefile scripts/Makefile include/Makefile dnl
  tests/Makefile Docs/Makefile support-files/Makefile dnl
  support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl

=== modified file 'extra/my_print_defaults.c'
--- a/extra/my_print_defaults.c	2007-05-10 09:59:39 +0000
+++ b/extra/my_print_defaults.c	2009-04-21 09:27:46 +0000
@@ -192,7 +192,8 @@ int main(int argc, char **argv)
   }
 
   for (argument= arguments+1 ; *argument ; argument++)
-    puts(*argument);
+    if (*argument != args_separator)           /* skip arguments separator */
+      puts(*argument);
   my_free((char*) load_default_groups,MYF(0));
   free_defaults(arguments);
 

=== modified file 'include/Makefile.am'
--- a/include/Makefile.am	2009-03-20 15:58:14 +0000
+++ b/include/Makefile.am	2009-05-04 20:51:05 +0000
@@ -22,7 +22,8 @@ HEADERS_ABI =		mysql.h mysql_com.h mysql
 			my_list.h my_alloc.h typelib.h mysql/plugin.h \
 			mysql/plugin_audit.h mysql/plugin_ftparser.h
 pkginclude_HEADERS =	$(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
-			my_xml.h mysql_embed.h \
+			my_xml.h mysql_embed.h mysql/services.h \
+			mysql/service_my_snprintf.h mysql/service_thd_alloc.h \
 		  	my_pthread.h my_no_pthread.h \
 			decimal.h errmsg.h my_global.h my_net.h \
 			my_getopt.h sslopt-longopts.h my_dir.h \
@@ -36,7 +37,7 @@ noinst_HEADERS =	config-win.h config-net
 			my_nosys.h my_alarm.h queues.h rijndael.h sha1.h sha2.h \
 			my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
 			thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
-			my_handler.h my_time.h \
+			my_handler.h my_time.h service_versions.h \
 			my_vle.h my_user.h my_atomic.h atomic/nolock.h \
 			atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \
                         atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \

=== modified file 'include/config-win.h'
--- a/include/config-win.h	2009-04-30 14:39:35 +0000
+++ b/include/config-win.h	2009-05-14 21:49:53 +0000
@@ -132,17 +132,9 @@ typedef int mode_t; 
 #undef _REENTRANT			/* Crashes something for win32 */
 #undef SAFE_MUTEX			/* Can't be used on windows */
 
-#if defined(_MSC_VER) && _MSC_VER >= 1310
-#define LL(A)           A##ll
-#define ULL(A)          A##ull
-#else
-#define LL(A)           ((__int64) A)
-#define ULL(A)          ((unsigned __int64) A)
-#endif
-
-#define LONGLONG_MIN	LL(0x8000000000000000)
-#define LONGLONG_MAX	LL(0x7FFFFFFFFFFFFFFF)
-#define ULONGLONG_MAX	ULL(0xFFFFFFFFFFFFFFFF)
+#define LONGLONG_MIN	0x8000000000000000LL
+#define LONGLONG_MAX	0x7FFFFFFFFFFFFFFFLL
+#define ULONGLONG_MAX	0xFFFFFFFFFFFFFFFFULL
 
 /* Type information */
 
@@ -285,7 +277,7 @@ inline ulonglong double2ulonglong(double
 #define STACK_DIRECTION -1
 
 /* Difference between GetSystemTimeAsFileTime() and now() */
-#define OFFSET_TO_EPOCH ULL(116444736000000000)
+#define OFFSET_TO_EPOCH 116444736000000000ULL
 
 #define HAVE_PERROR
 #define HAVE_VFPRINT

=== modified file 'include/lf.h'
--- a/include/lf.h	2009-04-23 07:12:13 +0000
+++ b/include/lf.h	2009-04-30 21:09:04 +0000
@@ -2,8 +2,7 @@
 
    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; either version 2 of the License, or
-   (at your option) any later version.
+   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

=== modified file 'include/m_string.h'
--- a/include/m_string.h	2009-01-29 21:17:59 +0000
+++ b/include/m_string.h	2009-05-04 17:14:38 +0000
@@ -290,16 +290,10 @@ extern size_t my_snprintf(char *to, size
 
 /*
   LEX_STRING -- a pair of a C-string and its length.
+  (it's part of the plugin API as a MYSQL_LEX_STRING)
 */
 
-#ifndef _my_plugin_h
-/* This definition must match the one given in mysql/plugin.h */
-struct st_mysql_lex_string
-{
-  char *str;
-  size_t length;
-};
-#endif
+#include <mysql/plugin.h>
 typedef struct st_mysql_lex_string LEX_STRING;
 
 #define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1))

=== modified file 'include/maria.h'
--- a/include/maria.h	2009-02-13 16:30:54 +0000
+++ b/include/maria.h	2009-05-14 21:49:53 +0000
@@ -2,8 +2,7 @@
 
    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; either version 2 of the License, or
-   (at your option) any later version.
+   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
@@ -67,31 +66,31 @@ extern "C" {
   sets all high keys.
 */
 #define MARIA_KEYMAP_BITS      (8 * SIZEOF_LONG_LONG)
-#define MARIA_KEYMAP_HIGH_MASK (ULL(1) << (MARIA_KEYMAP_BITS - 1))
+#define MARIA_KEYMAP_HIGH_MASK (1ULL << (MARIA_KEYMAP_BITS - 1))
 #define maria_get_mask_all_keys_active(_keys_) \
                             (((_keys_) < MARIA_KEYMAP_BITS) ? \
-                             ((ULL(1) << (_keys_)) - ULL(1)) : \
-                             (~ ULL(0)))
+                             ((1ULL << (_keys_)) - 1ULL) : \
+                             (~ 0ULL))
 #if MARIA_MAX_KEY > MARIA_KEYMAP_BITS
 #define maria_is_key_active(_keymap_,_keyno_) \
                             (((_keyno_) < MARIA_KEYMAP_BITS) ? \
-                             test((_keymap_) & (ULL(1) << (_keyno_))) : \
+                             test((_keymap_) & (1ULL << (_keyno_))) : \
                              test((_keymap_) & MARIA_KEYMAP_HIGH_MASK))
 #define maria_set_key_active(_keymap_,_keyno_) \
                             (_keymap_)|= (((_keyno_) < MARIA_KEYMAP_BITS) ? \
-                                          (ULL(1) << (_keyno_)) : \
+                                          (1ULL << (_keyno_)) : \
                                           MARIA_KEYMAP_HIGH_MASK)
 #define maria_clear_key_active(_keymap_,_keyno_) \
                             (_keymap_)&= (((_keyno_) < MARIA_KEYMAP_BITS) ? \
-                                          (~ (ULL(1) << (_keyno_))) : \
-                                          (~ (ULL(0))) /*ignore*/ )
+                                          (~ (1ULL << (_keyno_))) : \
+                                          (~ (0ULL)) /*ignore*/ )
 #else
 #define maria_is_key_active(_keymap_,_keyno_) \
-                            test((_keymap_) & (ULL(1) << (_keyno_)))
+                            test((_keymap_) & (1ULL << (_keyno_)))
 #define maria_set_key_active(_keymap_,_keyno_) \
-                            (_keymap_)|= (ULL(1) << (_keyno_))
+                            (_keymap_)|= (1ULL << (_keyno_))
 #define maria_clear_key_active(_keymap_,_keyno_) \
-                            (_keymap_)&= (~ (ULL(1) << (_keyno_)))
+                            (_keymap_)&= (~ (1ULL << (_keyno_)))
 #endif
 #define maria_is_any_key_active(_keymap_) \
                             test((_keymap_))

=== modified file 'include/my_bitmap.h'
--- a/include/my_bitmap.h	2007-12-12 10:14:59 +0000
+++ b/include/my_bitmap.h	2009-05-14 21:49:53 +0000
@@ -169,11 +169,11 @@ static inline my_bool bitmap_cmp(const M
 */
 
 #define bit_is_set(I,B)   (sizeof(I) * CHAR_BIT > (B) ?                 \
-                           (((I) & (ULL(1) << (B))) == 0 ? 0 : 1) : -1)
+                           (((I) & (1ULL << (B))) == 0 ? 0 : 1) : -1)
 #define bit_do_set(I,B)   (sizeof(I) * CHAR_BIT > (B) ?         \
-                           ((I) |= (ULL(1) << (B)), 1) : -1)
+                           ((I) |= (1ULL << (B)), 1) : -1)
 #define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ?         \
-                           ((I) &= ~(ULL(1) << (B)), 0) : -1)
+                           ((I) &= ~(1ULL << (B)), 0) : -1)
 
 #ifdef	__cplusplus
 }

=== modified file 'include/my_global.h'
--- a/include/my_global.h	2009-04-30 14:35:36 +0000
+++ b/include/my_global.h	2009-05-14 21:49:53 +0000
@@ -1126,22 +1126,6 @@ typedef char		bool;	/* Ordinary boolean 
 #define INT32(v)	(int32) (v)
 #define MYF(v)		STATIC_CAST(myf)(v)
 
-#ifndef LL
-#ifdef HAVE_LONG_LONG
-#define LL(A) A ## LL
-#else
-#define LL(A) A ## L
-#endif
-#endif
-
-#ifndef ULL
-#ifdef HAVE_LONG_LONG
-#define ULL(A) A ## ULL
-#else
-#define ULL(A) A ## UL
-#endif
-#endif
-
 /*
   Defines to make it possible to prioritize register assignments. No
   longer that important with modern compilers.

=== modified file 'include/my_pthread.h'
--- a/include/my_pthread.h	2009-03-02 21:52:37 +0000
+++ b/include/my_pthread.h	2009-05-14 21:49:53 +0000
@@ -391,8 +391,8 @@ int my_pthread_mutex_trylock(pthread_mut
 #define set_timespec_time_nsec(ABSTIME,TIME,NSEC) do {                  \
   ulonglong nsec= (NSEC);                                               \
   ulonglong now= (TIME) + (nsec/100);                                   \
-  (ABSTIME).MY_tv_sec=  (now / ULL(10000000));                          \
-  (ABSTIME).MY_tv_nsec= (now % ULL(10000000) * 100 + (nsec % 100));     \
+  (ABSTIME).MY_tv_sec=  (now / 10000000ULL);                          \
+  (ABSTIME).MY_tv_nsec= (now % 10000000ULL * 100 + (nsec % 100));     \
 } while(0)
 #endif /* !set_timespec_time_nsec */
 
@@ -627,7 +627,6 @@ extern my_bool my_thread_init(void);
 extern void my_thread_end(void);
 extern const char *my_thread_name(void);
 extern my_thread_id my_thread_dbug_id(void);
-extern int pthread_no_free(void *);
 extern int pthread_dummy(int);
 
 /* All thread specific variables are in the following struct */

=== modified file 'include/my_sys.h'
--- a/include/my_sys.h	2009-05-11 07:36:07 +0000
+++ b/include/my_sys.h	2009-05-25 06:46:00 +0000
@@ -920,6 +920,7 @@ extern void *memdup_root(MEM_ROOT *root,
 extern int get_defaults_options(int argc, char **argv,
                                 char **defaults, char **extra_defaults,
                                 char **group_suffix);
+extern const char *args_separator;
 extern int my_load_defaults(const char *conf_file, const char **groups,
                             int *argc, char ***argv, const char ***);
 extern int load_defaults(const char *conf_file, const char **groups,

=== modified file 'include/myisam.h'
--- a/include/myisam.h	2009-02-13 16:30:54 +0000
+++ b/include/myisam.h	2009-05-14 21:49:53 +0000
@@ -76,35 +76,35 @@ extern "C" {
   sets all high keys.
 */
 #define MI_KEYMAP_BITS      (8 * SIZEOF_LONG_LONG)
-#define MI_KEYMAP_HIGH_MASK (ULL(1) << (MI_KEYMAP_BITS - 1))
+#define MI_KEYMAP_HIGH_MASK (1ULL << (MI_KEYMAP_BITS - 1))
 #define mi_get_mask_all_keys_active(_keys_) \
                             (((_keys_) < MI_KEYMAP_BITS) ? \
-                             ((ULL(1) << (_keys_)) - ULL(1)) : \
-                             (~ ULL(0)))
+                             ((1ULL << (_keys_)) - 1ULL) : \
+                             (~ 0ULL))
 
 #if MI_MAX_KEY > MI_KEYMAP_BITS
 
 #define mi_is_key_active(_keymap_,_keyno_) \
                             (((_keyno_) < MI_KEYMAP_BITS) ? \
-                             test((_keymap_) & (ULL(1) << (_keyno_))) : \
+                             test((_keymap_) & (1ULL << (_keyno_))) : \
                              test((_keymap_) & MI_KEYMAP_HIGH_MASK))
 #define mi_set_key_active(_keymap_,_keyno_) \
                             (_keymap_)|= (((_keyno_) < MI_KEYMAP_BITS) ? \
-                                          (ULL(1) << (_keyno_)) : \
+                                          (1ULL << (_keyno_)) : \
                                           MI_KEYMAP_HIGH_MASK)
 #define mi_clear_key_active(_keymap_,_keyno_) \
                             (_keymap_)&= (((_keyno_) < MI_KEYMAP_BITS) ? \
-                                          (~ (ULL(1) << (_keyno_))) : \
-                                          (~ (ULL(0))) /*ignore*/ )
+                                          (~ (1ULL << (_keyno_))) : \
+                                          (~ (0ULL)) /*ignore*/ )
 
 #else
 
 #define mi_is_key_active(_keymap_,_keyno_) \
-                            test((_keymap_) & (ULL(1) << (_keyno_)))
+                            test((_keymap_) & (1ULL << (_keyno_)))
 #define mi_set_key_active(_keymap_,_keyno_) \
-                            (_keymap_)|= (ULL(1) << (_keyno_))
+                            (_keymap_)|= (1ULL << (_keyno_))
 #define mi_clear_key_active(_keymap_,_keyno_) \
-                            (_keymap_)&= (~ (ULL(1) << (_keyno_)))
+                            (_keymap_)&= (~ (1ULL << (_keyno_)))
 
 #endif
 

=== modified file 'include/myisamchk.h'
--- a/include/myisamchk.h	2008-07-24 11:33:35 +0000
+++ b/include/myisamchk.h	2009-04-23 21:17:43 +0000
@@ -2,8 +2,7 @@
 
    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; either version 2 of the License, or
-   (at your option) any later version.
+   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

=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h	2009-04-15 08:35:38 +0000
+++ b/include/mysql/plugin.h	2009-05-14 08:56:34 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 MySQL AB
+/* Copyright (C) 2005 MySQL AB, 2009 Sun Microsystems, Inc.
 
    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
@@ -16,12 +16,6 @@
 #ifndef _my_plugin_h
 #define _my_plugin_h
 
-/* size_t */
-#include <stdlib.h>
-
-typedef struct st_mysql MYSQL;
-
-
 /*
   On Windows, exports from DLL need to be declared
 */
@@ -39,15 +33,7 @@ class Item;
 #define MYSQL_THD void*
 #endif
 
-#ifndef _m_string_h
-/* This definition must match the one given in m_string.h */
-struct st_mysql_lex_string
-{
-  char *str;
-  unsigned int length;
-};
-#endif /* _m_string_h */
-typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+#include <mysql/services.h>
 
 #define MYSQL_XIDDATASIZE 128
 /**
@@ -127,7 +113,8 @@ enum enum_mysql_show_type
 {
   SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
   SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
-  SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE
+  SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
+  SHOW_always_last
 };
 
 struct st_mysql_show_var {
@@ -574,54 +561,6 @@ int thd_killed(const MYSQL_THD thd);
 */
 unsigned long thd_get_thread_id(const MYSQL_THD thd);
 
-
-/**
-  Allocate memory in the connection's local memory pool
-
-  @details
-  When properly used in place of @c my_malloc(), this can significantly
-  improve concurrency. Don't use this or related functions to allocate
-  large chunks of memory. Use for temporary storage only. The memory
-  will be freed automatically at the end of the statement; no explicit
-  code is required to prevent memory leaks.
-
-  @see alloc_root()
-*/
-void *thd_alloc(MYSQL_THD thd, unsigned int size);
-/**
-  @see thd_alloc()
-*/
-void *thd_calloc(MYSQL_THD thd, unsigned int size);
-/**
-  @see thd_alloc()
-*/
-char *thd_strdup(MYSQL_THD thd, const char *str);
-/**
-  @see thd_alloc()
-*/
-char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size);
-/**
-  @see thd_alloc()
-*/
-void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
-
-/**
-  Create a LEX_STRING in this connection's local memory pool
-
-  @param thd      user thread connection handle
-  @param lex_str  pointer to LEX_STRING object to be initialized
-  @param str      initializer to be copied into lex_str
-  @param size     length of str, in bytes
-  @param allocate_lex_string  flag: if TRUE, allocate new LEX_STRING object,
-                              instead of using lex_str value
-  @return  NULL on failure, or pointer to the LEX_STRING object
-
-  @see thd_alloc()
-*/
-MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
-                                      const char *str, unsigned int size,
-                                      int allocate_lex_string);
-
 /**
   Get the XID for this connection's transaction
 

=== modified file 'include/mysql/plugin.h.pp'
--- a/include/mysql/plugin.h.pp	2009-04-14 12:42:21 +0000
+++ b/include/mysql/plugin.h.pp	2009-05-14 08:56:34 +0000
@@ -1,11 +1,38 @@
+#include <mysql/services.h>
+#include <mysql/service_my_snprintf.h>
+#include <stdarg.h>
+#include <stdlib.h>
+extern struct my_snprintf_service_st {
+  size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
+  size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
+} *my_snprintf_service;
+size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
+size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
+#include <mysql/service_thd_alloc.h>
 #include <stdlib.h>
-typedef struct st_mysql MYSQL;
 struct st_mysql_lex_string
 {
   char *str;
-  unsigned int length;
+  size_t length;
 };
 typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+extern struct thd_alloc_service_st {
+  void *(*thd_alloc_func)(void*, unsigned int);
+  void *(*thd_calloc_func)(void*, unsigned int);
+  char *(*thd_strdup_func)(void*, const char *);
+  char *(*thd_strmake_func)(void*, const char *, unsigned int);
+  void *(*thd_memdup_func)(void*, const void*, unsigned int);
+  MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
+                                        const char *, unsigned int, int);
+} *thd_alloc_service;
+void *thd_alloc(void* thd, unsigned int size);
+void *thd_calloc(void* thd, unsigned int size);
+char *thd_strdup(void* thd, const char *str);
+char *thd_strmake(void* thd, const char *str, unsigned int size);
+void *thd_memdup(void* thd, const void* str, unsigned int size);
+MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
+                                      const char *str, unsigned int size,
+                                      int allocate_lex_string);
 struct st_mysql_xid {
   long formatID;
   long gtrid_length;
@@ -17,7 +44,8 @@ enum enum_mysql_show_type
 {
   SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
   SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
-  SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE
+  SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
+  SHOW_always_last
 };
 struct st_mysql_show_var {
   const char *name;
@@ -133,14 +161,6 @@ const char *set_thd_proc_info(void*, con
 int mysql_tmpfile(const char *prefix);
 int thd_killed(const void* thd);
 unsigned long thd_get_thread_id(const void* thd);
-void *thd_alloc(void* thd, unsigned int size);
-void *thd_calloc(void* thd, unsigned int size);
-char *thd_strdup(void* thd, const char *str);
-char *thd_strmake(void* thd, const char *str, unsigned int size);
-void *thd_memdup(void* thd, const void* str, unsigned int size);
-MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
-                                      const char *str, unsigned int size,
-                                      int allocate_lex_string);
 void thd_get_xid(const void* thd, MYSQL_XID *xid);
 void mysql_query_cache_invalidate4(void* thd,
                                    const char *key, unsigned int key_length,

=== added file 'include/mysql/service_my_snprintf.h'
--- a/include/mysql/service_my_snprintf.h	1970-01-01 00:00:00 +0000
+++ b/include/mysql/service_my_snprintf.h	2009-05-04 17:14:38 +0000
@@ -0,0 +1,79 @@
+/* Copyright (C) 2009 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+/**
+  @file
+  my_snprintf service
+
+  Portable and limited vsnprintf() implementation.
+
+  This is a portable, limited vsnprintf() implementation, with some
+  extra features. "Portable" means that it'll produce identical result
+  on all platforms (for example, on Windows and Linux %e formats the
+  exponent differently, on different systems %p either prints leading
+  0x or not, %s may accept null pointer or crash on it). "Limited"
+  means that it does not support all the C89 features. But it supports
+  few extensions, not in any standard.
+
+  my_vsnprintf(to, n, fmt, ap)
+
+  @param[out] to     A buffer to store the result in
+  @param[in]  n      Store up to n-1 characters, followed by an end 0
+  @param[in]  fmt    printf-like format string
+  @param[in]  ap     Arguments
+
+  @return a number of bytes written to a buffer
+
+  @post
+  The syntax of a format string is generally the same:
+  % <flag> <width> <precision> <length modifier> <format>
+  where everithing but the format is optional.
+
+  The only possible <flag> is '0'. It has the standard zero-padding semantics.
+  Both <width> and <precision> can be specified as numbers or '*'.
+
+  <length modifier> can be 'l', 'll', or 'z'.
+
+  Supported formats are 's' (null pointer is accepted, printed as
+  "(null)"), 'b' (extension, see below), 'c', 'f', 'g', 'd', 'u', 'x',
+  'X', 'p' (works as 0x%x).
+
+  Extensions:
+
+  Format 'b': binary buffer, prints exactly <precision> bytes from the
+  argument, without stopping at '\0'.
+
+  More to come (identifier quoting, escaping, see WL#751).
+*/
+
+#include <stdarg.h>
+#include <stdlib.h>
+extern struct my_snprintf_service_st {
+  size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
+  size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
+} *my_snprintf_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define my_vsnprintf my_snprintf_service->my_vsnprintf_type
+#define my_snprintf my_snprintf_service->my_snprintf_type
+
+#else
+
+size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
+size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
+
+#endif
+

=== added file 'include/mysql/service_thd_alloc.h'
--- a/include/mysql/service_thd_alloc.h	1970-01-01 00:00:00 +0000
+++ b/include/mysql/service_thd_alloc.h	2009-05-04 17:14:38 +0000
@@ -0,0 +1,116 @@
+/* Copyright (C) 2009 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+/**
+  @file
+  This service provdes functions to allocate memory in a connection local
+  memory pool. The memory allocated there will be automatically freed at the
+  end of the statement, don't use it for allocations that should live longer
+  than that. For short living allocations this is more efficient than
+  using my_malloc and friends, and automatic "garbage collection" allows not
+  to think about memory leaks.
+
+  The pool is best for small to medium objects, don't use it for large
+  allocations - they are better served with my_malloc.
+*/
+
+#include <stdlib.h>
+
+struct st_mysql_lex_string
+{
+  char *str;
+  size_t length;
+};
+typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+
+extern struct thd_alloc_service_st {
+  void *(*thd_alloc_func)(MYSQL_THD, unsigned int);
+  void *(*thd_calloc_func)(MYSQL_THD, unsigned int);
+  char *(*thd_strdup_func)(MYSQL_THD, const char *);
+  char *(*thd_strmake_func)(MYSQL_THD, const char *, unsigned int);
+  void *(*thd_memdup_func)(MYSQL_THD, const void*, unsigned int);
+  MYSQL_LEX_STRING *(*thd_make_lex_string_func)(MYSQL_THD, MYSQL_LEX_STRING *,
+                                        const char *, unsigned int, int);
+} *thd_alloc_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define thd_alloc(thd,size) (thd_alloc_service->thd_alloc_func((thd), (size)))
+
+#define thd_calloc(thd,size) (thd_alloc_service->thd_calloc_func((thd), (size)))
+
+#define thd_strdup(thd,str) (thd_alloc_service->thd_strdup_func((thd), (str)))
+
+#define thd_strmake(thd,str,size) \
+  (thd_alloc_service->thd_strmake_func((thd), (str), (size)))
+
+#define thd_memdup(thd,str,size) \
+  (thd_alloc_service->thd_memdup_func((thd), (str), (size)))
+
+#define thd_make_lex_string(thd, lex_str, str, size, allocate_lex_string) \
+  (thd_alloc_service->thd_make_lex_string_func((thd), (lex_str), (str), \
+                                               (size), (allocate_lex_string)))
+
+#else
+
+/**
+  Allocate memory in the connection's local memory pool
+
+  @details
+  When properly used in place of @c my_malloc(), this can significantly
+  improve concurrency. Don't use this or related functions to allocate
+  large chunks of memory. Use for temporary storage only. The memory
+  will be freed automatically at the end of the statement; no explicit
+  code is required to prevent memory leaks.
+
+  @see alloc_root()
+*/
+void *thd_alloc(MYSQL_THD thd, unsigned int size);
+/**
+  @see thd_alloc()
+*/
+void *thd_calloc(MYSQL_THD thd, unsigned int size);
+/**
+  @see thd_alloc()
+*/
+char *thd_strdup(MYSQL_THD thd, const char *str);
+/**
+  @see thd_alloc()
+*/
+char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size);
+/**
+  @see thd_alloc()
+*/
+void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
+
+/**
+  Create a LEX_STRING in this connection's local memory pool
+
+  @param thd      user thread connection handle
+  @param lex_str  pointer to LEX_STRING object to be initialized
+  @param str      initializer to be copied into lex_str
+  @param size     length of str, in bytes
+  @param allocate_lex_string  flag: if TRUE, allocate new LEX_STRING object,
+                              instead of using lex_str value
+  @return  NULL on failure, or pointer to the LEX_STRING object
+
+  @see thd_alloc()
+*/
+MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
+                                      const char *str, unsigned int size,
+                                      int allocate_lex_string);
+
+#endif
+

=== added file 'include/mysql/services.h'
--- a/include/mysql/services.h	1970-01-01 00:00:00 +0000
+++ b/include/mysql/services.h	2009-04-30 16:22:40 +0000
@@ -0,0 +1,31 @@
+/* Copyright (C) 2009 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+#ifndef MYSQL_SERVICES_INCLUDED
+#define MYSQL_SERVICES_INCLUDED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <mysql/service_my_snprintf.h>
+#include <mysql/service_thd_alloc.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

=== added file 'include/service_versions.h'
--- a/include/service_versions.h	1970-01-01 00:00:00 +0000
+++ b/include/service_versions.h	2009-05-06 18:17:49 +0000
@@ -0,0 +1,24 @@
+/* Copyright (C) 2009 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+#ifdef _WIN32
+#define SERVICE_VERSION __declspec(dllexport) void *
+#else
+#define SERVICE_VERSION void *
+#endif
+
+#define VERSION_my_snprintf     0x0100
+#define VERSION_thd_alloc       0x0100
+

=== modified file 'libmysqld/Makefile.am'
--- a/libmysqld/Makefile.am	2009-03-09 14:00:03 +0000
+++ b/libmysqld/Makefile.am	2009-05-04 15:51:55 +0000
@@ -1,242 +1,242 @@
-# Copyright (C) 2001-2006 MySQL AB
-# 
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-# 
-# This library 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
-# Library General Public License for more details.
-# 
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-#
-# This file is public domain and comes with NO WARRANTY of any kind
-
-MYSQLDATAdir =		$(localstatedir)
-MYSQLSHAREdir =		$(pkgdatadir)
-MYSQLBASEdir=		$(prefix)
-MYSQLLIBdir=            $(libdir)
-pkgplugindir =		$(pkglibdir)/plugin
-
-EXTRA_DIST =		libmysqld.def CMakeLists.txt
-DEFS =			-DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-			-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-			-DDATADIR="\"$(MYSQLDATAdir)\"" \
-			-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-			@DEFS@ \
-			-DLIBDIR="\"$(MYSQLLIBdir)\"" \
-			-DPLUGINDIR="\"$(pkgplugindir)\""
-AM_CPPFLAGS =		-I$(top_srcdir)/include \
-			-I$(top_builddir)/sql -I$(top_srcdir)/sql \
-			-I$(top_srcdir)/sql/examples \
-			-I$(top_srcdir)/regex \
-			$(openssl_includes) @ZLIB_INCLUDES@ \
-			@condition_dependent_plugin_includes@
-
-noinst_LIBRARIES =	libmysqld_int.a
-pkglib_LIBRARIES =	libmysqld.a
-SUBDIRS =		. examples
-libmysqld_sources=	libmysqld.c lib_sql.cc emb_qcache.cc
-libmysqlsources =	errmsg.c get_password.c libmysql.c client.c pack.c \
-                        my_time.c
-
-noinst_HEADERS =	embedded_priv.h emb_qcache.h
-
-sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
-	     ha_ndbcluster.cc ha_ndbcluster_cond.cc \
-	ha_ndbcluster_connection.cc \
-	ha_ndbcluster_binlog.cc ha_partition.cc \
-	handler.cc sql_handler.cc \
-	hostname.cc init.cc password.c \
-	item.cc item_buff.cc item_cmpfunc.cc item_create.cc \
-	item_func.cc item_strfunc.cc item_sum.cc item_timefunc.cc \
-	item_geofunc.cc item_subselect.cc item_row.cc\
-	item_xmlfunc.cc \
-	sha2.cc des_key_file.cc \
-	key.cc lock.cc log.cc sql_state.c \
-	log_event.cc rpl_record.cc \
-	log_event_old.cc rpl_record_old.cc \
-	protocol.cc net_serv.cc opt_range.cc \
-	opt_sum.cc procedure.cc records.cc sql_acl.cc \
-	sql_load.cc discover.cc sql_locale.cc \
-	sql_profile.cc \
-	sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
-	sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \
-        sql_join_cache.cc \
-	sql_lex.cc sql_list.cc sql_manager.cc sql_map.cc \
-	scheduler.cc sql_connect.cc sql_parse.cc \
-	sql_prepare.cc sql_derived.cc sql_rename.cc \
-	sql_select.cc sql_do.cc sql_show.cc set_var.cc \
-	sql_string.cc sql_table.cc sql_test.cc sql_udf.cc \
-	sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \
-	unireg.cc uniques.cc sql_union.cc hash_filo.cc \
-	spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
-	sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
-	parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
-	rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
-	debug_sync.cc sql_tablespace.cc transaction.cc \
-	rpl_injector.cc my_user.c partition_info.cc \
-	sql_servers.cc bml.cc si_objects.cc sql_audit.cc \
-	event_parse_data.cc mdl.cc sql_signal.cc \
-        rpl_handler.cc
-
-libmysqld_int_a_SOURCES= $(libmysqld_sources)
-nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources)
-libmysqld_a_SOURCES=
-
-sqlstoragesources =	$(EXTRA_libmysqld_a_SOURCES)
-storagesources = @condition_dependent_plugin_modules@
-storageobjects = @condition_dependent_plugin_objects@
-storagesourceslinks = @condition_dependent_plugin_links@
-
-# automake misses these
-sql_yacc.cc sql_yacc.h: $(top_srcdir)/sql/sql_yacc.yy
-
-# The following libraries should be included in libmysqld.a
-INC_LIB=	$(top_builddir)/regex/libregex.a \
-		$(top_builddir)/mysys/.libs/libmysys.a \
-		$(top_builddir)/strings/.libs/libmystrings.a \
-		$(top_builddir)/dbug/.libs/libdbug.a \
-		$(top_builddir)/vio/libvio.a \
-                @NDB_SCI_LIBS@ \
-		@mysql_plugin_libs@ \
-		$(yassl_inc_libs)
-
-if HAVE_YASSL
-yassl_inc_libs=	$(top_builddir)/extra/yassl/src/.libs/libyassl.a \
-		$(top_builddir)/extra/yassl/taocrypt/src/.libs/libtaocrypt.a
-endif
-
-# Storage engine specific compilation options
-ha_ndbcluster.o:ha_ndbcluster.cc
-		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
-
-ha_ndbcluster_cond.o:ha_ndbcluster_cond.cc
-		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
-
-ha_ndbcluster_binlog.o: ha_ndbcluster_binlog.cc
-		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
-
-ha_ndbcluster_connection.o: ha_ndbcluster_connection.cc
-		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
-
-# Until we can remove dependency on ha_ndbcluster.h
-handler.o:	handler.cc
-		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
-
-# We need rules to compile these as no good way
-# found to append fileslists that collected by configure
-# to the sources list
-
-ha_federated.o:ha_federated.cc
-		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
-
-ha_heap.o:ha_heap.cc
-		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
-
-ha_innodb.o:ha_innodb.cc
-		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
-
-ha_myisam.o:ha_myisam.cc
-		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
-
-ha_myisammrg.o:ha_myisammrg.cc
-		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
-
-#
-# To make it easy for the end user to use the embedded library we
-# generate a total libmysqld.a from all library files,
-
-# note - InnoDB libraries have circular dependencies, so in INC_LIB
-# few libraries are present two times. Metrowerks linker doesn't like
-# it at all. Traditional ar has no problems with it, but still there's no
-# need to add the same file twice to the library, so 'sort -u' save us
-# some time and spares unnecessary work.
-
-libmysqld.a:	libmysqld_int.a $(INC_LIB) $(libmysqld_a_DEPENDENCIES) $(storageobjects)
-if DARWIN_MWCC
-	mwld -lib -o $@ libmysqld_int.a `echo $(INC_LIB) | sort -u` $(storageobjects)
-else
-		-rm -f libmysqld.a
-		if test "$(host_os)" = "netware" ; \
-		then \
-		  $(libmysqld_a_AR) libmysqld.a $(INC_LIB) libmysqld_int.a $(storageobjects); \
-		else \
-		  current_dir=`pwd`; \
-		  rm -rf tmp; mkdir tmp; \
-		  (for arc in $(INC_LIB) ./libmysqld_int.a; do \
-		    arpath=`echo $$arc|sed 's|[^/]*$$||'|sed 's|\.libs/$$||'`; \
-		    artmp=`echo $$arc|sed 's|^.*/|tmp/lib-|'`; \
-		    for F in `$(AR) t $$arc | grep -v SYMDEF`; do \
-		      if test -e "$$arpath/$$F" ; then echo "$$arpath/$$F"; else \
-		      mkdir $$artmp; cd $$artmp > /dev/null; \
-		      $(AR) x ../../$$arc; \
-		      cd $$current_dir > /dev/null; \
-		      ls $$artmp/* | grep -v SYMDEF; \
-		      continue 2; fi; done; \
-		  done; echo $(libmysqld_a_DEPENDENCIES) ) | sort -u | xargs $(AR) cq libmysqld.a ; \
-		  $(AR) r libmysqld.a $(storageobjects); \
-		  $(RANLIB) libmysqld.a	; \
-		  rm -rf tmp; \
-		fi
-endif
-
-## XXX: any time the client interface changes, we'll need to bump
-## the version info for libmysqld; however, it's possible for the
-## libmysqld interface to change without affecting the standard
-## libmysqlclient interface.  Should we make a separate version
-## string for the two?
-#libmysqld_la_LDFLAGS = -version-info @SHARED_LIB_VERSION@
-#CLEANFILES =		$(libmysqld_la_LIBADD) libmysqld.la
-
-BUILT_SOURCES = link_sources
-
-CLEANFILES = $(BUILT_SOURCES)
-
-link_sources:
-	  for f in $(sqlsources); do \
-	    rm -f $$f; \
-	    if test -e $(top_srcdir)/sql/$$f ; \
-	    then \
-	      @LN_CP_F@ $(top_srcdir)/sql/$$f $$f; \
-	    else \
-	      @LN_CP_F@ $(top_builddir)/sql/$$f $$f; \
-	    fi ; \
-	  done; \
-	  for f in $(libmysqlsources); do \
-	    rm -f $$f; \
-	    if test -e $(top_srcdir)/libmysql/$$f ; \
-	    then \
-	      @LN_CP_F@ $(top_srcdir)/libmysql/$$f $$f; \
-	    else \
-	      @LN_CP_F@ $(top_builddir)/libmysql/$$f $$f; \
-	    fi ; \
-	  done; \
-	  if test -n "$(sqlstoragesources)" ; \
-	  then \
-	    for f in "$(sqlstoragesources)"; do \
-	      rm -f "$$f"; \
-	      @LN_CP_F@ `find $(srcdir)/../sql -name "$$f"` "$$f"; \
-	    done; \
-	  fi; \
-	  if test -n "$(storagesources)" ; \
-	  then \
-	    rm -f $(storagesources); \
-	    for f in $(storagesourceslinks); do \
-	      @LN_CP_F@ $(top_srcdir)/$$f . ; \
-	    done; \
-	  fi; \
-	  rm -f client_settings.h; \
-	  @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h \
-                                          client_settings.h; \
-	echo timestamp > link_sources
-
-
-clean-local:
-	rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlstoragesources) $(storagesources) | sed "s;\.lo;.c;g"`; \
-	rm -f client_settings.h
+# Copyright (C) 2001-2006 MySQL AB
+# 
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; version 2
+# of the License.
+# 
+# This library 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
+# Library General Public License for more details.
+# 
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA
+#
+# This file is public domain and comes with NO WARRANTY of any kind
+
+MYSQLDATAdir =		$(localstatedir)
+MYSQLSHAREdir =		$(pkgdatadir)
+MYSQLBASEdir=		$(prefix)
+MYSQLLIBdir=            $(libdir)
+pkgplugindir =		$(pkglibdir)/plugin
+
+EXTRA_DIST =		libmysqld.def CMakeLists.txt
+DEFS =			-DEMBEDDED_LIBRARY -DMYSQL_SERVER \
+			-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
+			-DDATADIR="\"$(MYSQLDATAdir)\"" \
+			-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
+			@DEFS@ \
+			-DLIBDIR="\"$(MYSQLLIBdir)\"" \
+			-DPLUGINDIR="\"$(pkgplugindir)\""
+AM_CPPFLAGS =		-I$(top_srcdir)/include \
+			-I$(top_builddir)/sql -I$(top_srcdir)/sql \
+			-I$(top_srcdir)/sql/examples \
+			-I$(top_srcdir)/regex \
+			$(openssl_includes) @ZLIB_INCLUDES@ \
+			@condition_dependent_plugin_includes@
+
+noinst_LIBRARIES =	libmysqld_int.a
+pkglib_LIBRARIES =	libmysqld.a
+SUBDIRS =		. examples
+libmysqld_sources=	libmysqld.c lib_sql.cc emb_qcache.cc
+libmysqlsources =	errmsg.c get_password.c libmysql.c client.c pack.c \
+                        my_time.c
+
+noinst_HEADERS =	embedded_priv.h emb_qcache.h
+
+sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
+	     ha_ndbcluster.cc ha_ndbcluster_cond.cc \
+	ha_ndbcluster_connection.cc \
+	ha_ndbcluster_binlog.cc ha_partition.cc \
+	handler.cc sql_handler.cc \
+	hostname.cc init.cc password.c \
+	item.cc item_buff.cc item_cmpfunc.cc item_create.cc \
+	item_func.cc item_strfunc.cc item_sum.cc item_timefunc.cc \
+	item_geofunc.cc item_subselect.cc item_row.cc\
+	item_xmlfunc.cc \
+	sha2.cc des_key_file.cc \
+	key.cc lock.cc log.cc sql_state.c \
+	log_event.cc rpl_record.cc \
+	log_event_old.cc rpl_record_old.cc \
+	protocol.cc net_serv.cc opt_range.cc \
+	opt_sum.cc procedure.cc records.cc sql_acl.cc \
+	sql_load.cc discover.cc sql_locale.cc \
+	sql_profile.cc \
+	sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
+	sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \
+        sql_join_cache.cc \
+	sql_lex.cc sql_list.cc sql_manager.cc sql_map.cc \
+	scheduler.cc sql_connect.cc sql_parse.cc \
+	sql_prepare.cc sql_derived.cc sql_rename.cc \
+	sql_select.cc sql_do.cc sql_show.cc set_var.cc \
+	sql_string.cc sql_table.cc sql_test.cc sql_udf.cc \
+	sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \
+	unireg.cc uniques.cc sql_union.cc hash_filo.cc \
+	spatial.cc gstream.cc sql_help.cc tztime.cc sql_cursor.cc \
+	sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
+	parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
+	rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
+	debug_sync.cc sql_tablespace.cc transaction.cc \
+	rpl_injector.cc my_user.c partition_info.cc \
+	sql_servers.cc bml.cc si_objects.cc sql_audit.cc \
+	event_parse_data.cc mdl.cc sql_signal.cc \
+        rpl_handler.cc
+
+libmysqld_int_a_SOURCES= $(libmysqld_sources)
+nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources)
+libmysqld_a_SOURCES=
+
+sqlstoragesources =	$(EXTRA_libmysqld_a_SOURCES)
+storagesources = @condition_dependent_plugin_modules@
+storageobjects = @condition_dependent_plugin_objects@
+storagesourceslinks = @condition_dependent_plugin_links@
+
+# automake misses these
+sql_yacc.cc sql_yacc.h: $(top_srcdir)/sql/sql_yacc.yy
+
+# The following libraries should be included in libmysqld.a
+INC_LIB=	$(top_builddir)/regex/libregex.a \
+		$(top_builddir)/mysys/.libs/libmysys.a \
+		$(top_builddir)/strings/.libs/libmystrings.a \
+		$(top_builddir)/dbug/.libs/libdbug.a \
+		$(top_builddir)/vio/libvio.a \
+                @NDB_SCI_LIBS@ \
+		@mysql_plugin_libs@ \
+		$(yassl_inc_libs)
+
+if HAVE_YASSL
+yassl_inc_libs=	$(top_builddir)/extra/yassl/src/.libs/libyassl.a \
+		$(top_builddir)/extra/yassl/taocrypt/src/.libs/libtaocrypt.a
+endif
+
+# Storage engine specific compilation options
+ha_ndbcluster.o:ha_ndbcluster.cc
+		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
+
+ha_ndbcluster_cond.o:ha_ndbcluster_cond.cc
+		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
+
+ha_ndbcluster_binlog.o: ha_ndbcluster_binlog.cc
+		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
+
+ha_ndbcluster_connection.o: ha_ndbcluster_connection.cc
+		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
+
+# Until we can remove dependency on ha_ndbcluster.h
+handler.o:	handler.cc
+		$(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $<
+
+# We need rules to compile these as no good way
+# found to append fileslists that collected by configure
+# to the sources list
+
+ha_federated.o:ha_federated.cc
+		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
+
+ha_heap.o:ha_heap.cc
+		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
+
+ha_innodb.o:ha_innodb.cc
+		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
+
+ha_myisam.o:ha_myisam.cc
+		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
+
+ha_myisammrg.o:ha_myisammrg.cc
+		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
+
+#
+# To make it easy for the end user to use the embedded library we
+# generate a total libmysqld.a from all library files,
+
+# note - InnoDB libraries have circular dependencies, so in INC_LIB
+# few libraries are present two times. Metrowerks linker doesn't like
+# it at all. Traditional ar has no problems with it, but still there's no
+# need to add the same file twice to the library, so 'sort -u' save us
+# some time and spares unnecessary work.
+
+libmysqld.a:	libmysqld_int.a $(INC_LIB) $(libmysqld_a_DEPENDENCIES) $(storageobjects)
+if DARWIN_MWCC
+	mwld -lib -o $@ libmysqld_int.a `echo $(INC_LIB) | sort -u` $(storageobjects)
+else
+		-rm -f libmysqld.a
+		if test "$(host_os)" = "netware" ; \
+		then \
+		  $(libmysqld_a_AR) libmysqld.a $(INC_LIB) libmysqld_int.a $(storageobjects); \
+		else \
+		  current_dir=`pwd`; \
+		  rm -rf tmp; mkdir tmp; \
+		  (for arc in $(INC_LIB) ./libmysqld_int.a; do \
+		    arpath=`echo $$arc|sed 's|[^/]*$$||'|sed 's|\.libs/$$||'`; \
+		    artmp=`echo $$arc|sed 's|^.*/|tmp/lib-|'`; \
+		    for F in `$(AR) t $$arc | grep -v SYMDEF`; do \
+		      if test -e "$$arpath/$$F" ; then echo "$$arpath/$$F"; else \
+		      mkdir $$artmp; cd $$artmp > /dev/null; \
+		      $(AR) x ../../$$arc; \
+		      cd $$current_dir > /dev/null; \
+		      ls $$artmp/* | grep -v SYMDEF; \
+		      continue 2; fi; done; \
+		  done; echo $(libmysqld_a_DEPENDENCIES) ) | sort -u | xargs $(AR) cq libmysqld.a ; \
+		  $(AR) r libmysqld.a $(storageobjects); \
+		  $(RANLIB) libmysqld.a	; \
+		  rm -rf tmp; \
+		fi
+endif
+
+## XXX: any time the client interface changes, we'll need to bump
+## the version info for libmysqld; however, it's possible for the
+## libmysqld interface to change without affecting the standard
+## libmysqlclient interface.  Should we make a separate version
+## string for the two?
+#libmysqld_la_LDFLAGS = -version-info @SHARED_LIB_VERSION@
+#CLEANFILES =		$(libmysqld_la_LIBADD) libmysqld.la
+
+BUILT_SOURCES = link_sources
+
+CLEANFILES = $(BUILT_SOURCES)
+
+link_sources:
+	  for f in $(sqlsources); do \
+	    rm -f $$f; \
+	    if test -e $(top_srcdir)/sql/$$f ; \
+	    then \
+	      @LN_CP_F@ $(top_srcdir)/sql/$$f $$f; \
+	    else \
+	      @LN_CP_F@ $(top_builddir)/sql/$$f $$f; \
+	    fi ; \
+	  done; \
+	  for f in $(libmysqlsources); do \
+	    rm -f $$f; \
+	    if test -e $(top_srcdir)/libmysql/$$f ; \
+	    then \
+	      @LN_CP_F@ $(top_srcdir)/libmysql/$$f $$f; \
+	    else \
+	      @LN_CP_F@ $(top_builddir)/libmysql/$$f $$f; \
+	    fi ; \
+	  done; \
+	  if test -n "$(sqlstoragesources)" ; \
+	  then \
+	    for f in "$(sqlstoragesources)"; do \
+	      rm -f "$$f"; \
+	      @LN_CP_F@ `find $(srcdir)/../sql -name "$$f"` "$$f"; \
+	    done; \
+	  fi; \
+	  if test -n "$(storagesources)" ; \
+	  then \
+	    rm -f $(storagesources); \
+	    for f in $(storagesourceslinks); do \
+	      @LN_CP_F@ $(top_srcdir)/$$f . ; \
+	    done; \
+	  fi; \
+	  rm -f client_settings.h; \
+	  @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h \
+                                          client_settings.h; \
+	echo timestamp > link_sources
+
+
+clean-local:
+	rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlstoragesources) $(storagesources) | sed "s;\.lo;.c;g"`; \
+	rm -f client_settings.h

=== added directory 'libservices'
=== added file 'libservices/CMakeLists.txt'
--- a/libservices/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ b/libservices/CMakeLists.txt	2009-05-05 18:58:20 +0000
@@ -0,0 +1,20 @@
+# Copyright (C) 2006 MySQL AB
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
+SET(LIBSERVICES_SOURCES my_snprintf_service.c thd_alloc_service.c)
+
+ADD_LIBRARY(libservices ${LIBSERVICES_SOURCES})

=== added file 'libservices/Makefile.am'
--- a/libservices/Makefile.am	1970-01-01 00:00:00 +0000
+++ b/libservices/Makefile.am	2009-05-06 10:55:56 +0000
@@ -0,0 +1,19 @@
+# Copyright 2009 Sun Microsystems, Inc.
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+AM_CPPFLAGS =		-I$(top_srcdir)/include
+pkglib_LIBRARIES =	libmysqlservices.a
+libmysqlservices_a_SOURCES =  my_snprintf_service.c thd_alloc_service.c
+EXTRA_DIST = CMakeLists.txt

=== added file 'libservices/my_snprintf_service.c'
--- a/libservices/my_snprintf_service.c	1970-01-01 00:00:00 +0000
+++ b/libservices/my_snprintf_service.c	2009-05-06 18:17:49 +0000
@@ -0,0 +1,17 @@
+/* Copyright (C) 2009 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+#include <service_versions.h>
+SERVICE_VERSION my_snprintf_service= (void*)VERSION_my_snprintf;

=== added file 'libservices/thd_alloc_service.c'
--- a/libservices/thd_alloc_service.c	1970-01-01 00:00:00 +0000
+++ b/libservices/thd_alloc_service.c	2009-05-06 18:17:49 +0000
@@ -0,0 +1,17 @@
+/* Copyright (C) 2009 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+#include <service_versions.h>
+SERVICE_VERSION thd_alloc_servicee= (void*)VERSION_thd_alloc;

=== removed file 'mysql-test/collections/mysql-6.0-bugteam.push'
--- a/mysql-test/collections/mysql-6.0-bugteam.push	2009-04-28 06:32:50 +0000
+++ b/mysql-test/collections/mysql-6.0-bugteam.push	1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-perl mysql-test-run.pl --comment=n_mix                            --mysqld=--binlog-format=mixed                                                --suite=main,backup,backup_engines,backup_ptr,binlog,federated,rpl,maria  --experimental=collections/default.experimental --timer --force 
-perl mysql-test-run.pl --comment=ps_row            --ps-protocol  --mysqld=--binlog-format=row                                                  --suite=main,backup,backup_engines,backup_ptr,binlog,federated,rpl,maria  --experimental=collections/default.experimental --timer --force 
-perl mysql-test-run.pl --comment=embedded          --embedded                                                                                   --suite=main,backup,backup_engines,backup_ptr,binlog,federated,rpl,maria  --experimental=collections/default.experimental --timer --force 
-perl mysql-test-run.pl --comment=rpl_binlog_row                   --mysqld=--binlog-format=row                                                  --suite=rpl,binlog                                                        --experimental=collections/default.experimental --timer --force 
-perl mysql-test-run.pl --comment=funcs_1                                                                                                        --suite=funcs_1                                                           --experimental=collections/default.experimental --timer --force 
-perl mysql-test-run.pl --comment=ps_stm_threadpool --ps-protocol  --mysqld=--binlog-format=statement --mysqld=--thread-handling=pool-of-threads --suite=main,backup,backup_engines,backup_ptr,binlog,federated,rpl,maria  --experimental=collections/default.experimental --timer --force 
-perl mysql-test-run.pl --comment=falcon                                                                                                         --suite=falcon                                                            --experimental=collections/default.experimental --timer --force 

=== removed file 'mysql-test/collections/mysql-6.0-falcon-.push'
--- a/mysql-test/collections/mysql-6.0-falcon-.push	2009-03-31 12:45:26 +0000
+++ b/mysql-test/collections/mysql-6.0-falcon-.push	1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-perl mysql-test-run.pl --timer --force --comment=n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental
-perl mysql-test-run.pl --timer --force --comment=ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental
-perl mysql-test-run.pl --timer --force --comment=embedded --embedded --experimental=collections/default.experimental
-perl mysql-test-run.pl --timer --force --comment=rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental
-perl mysql-test-run.pl --timer --force --comment=funcs_1 --suite=funcs_1 --experimental=collections/default.experimental
-perl mysql-test-run.pl --timer --force --comment=ps_stm_threadpool --ps-protocol --mysqld=--binlog-format=statement --mysqld=--thread-handling=pool-of-threads --experimental=collections/default.experimental
-perl mysql-test-run.pl --timer --force --comment=falcon --suite=falcon --experimental=collections/default.experimental
-perl mysql-test-run.pl --timer --force --comment=falcon_exp --suite=falcon_team --experimental=collections/falcon_team.experimental

=== added file 'mysql-test/extra/rpl_tests/rpl_row_record_find.test'
--- a/mysql-test/extra/rpl_tests/rpl_row_record_find.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_row_record_find.test	2009-04-29 16:48:59 +0000
@@ -0,0 +1,173 @@
+# USAGE:
+#   Before including this file the following variables should be set:
+#     * $master_engine
+#     * slave_engine
+#
+#   Example:
+#
+#     let $master_engine= Falcon;
+#     let $slave_engine= MyISAM;
+#
+#     -- source extra/rpl_tests/rpl_row_record_find.test
+# 
+
+
+connection master;
+
+--disable_warnings
+DROP TABLE IF EXISTS t;
+--enable_warnings
+
+sync_slave_with_master;
+connection master;
+
+let $i= 10;
+while($i)
+{
+  let $step= "";
+
+  connection master;
+  SET SQL_LOG_BIN=0;
+
+  if (`SELECT $i=1`) {
+    let $step= No keys ($master_engine -> $slave_engine);
+    --echo ******* TEST: $step
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $master_engine;
+    connection slave;
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $slave_engine;
+  }
+  if (`SELECT $i=2`)
+  { 
+    let $step= One key ($master_engine -> $slave_engine);
+    --echo ******* TEST: $step
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $master_engine;
+    connection slave;
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $slave_engine;
+  }
+  if (`SELECT $i=3`)
+  {
+    let $step= One Composite key ($master_engine -> $slave_engine);
+    --echo ****** TEST: $step
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $master_engine;
+    connection slave;
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $slave_engine;
+  }  
+  if (`SELECT $i=4`)
+  {
+    let $step= One Unique key ($master_engine -> $slave_engine);
+    --echo ****** TEST: $step
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $master_engine;
+    connection slave;
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $slave_engine;
+  }  
+  if (`SELECT $i=5`)
+  {
+    let $step= One Composite Unique key ($master_engine -> $slave_engine);
+    --echo ****** TEST: $step
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $master_engine;
+    connection slave;
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $slave_engine;
+  }  
+  if (`SELECT $i=6`)
+  {
+    let $step= One Primary key ($master_engine -> $slave_engine);
+    --echo ****** TEST: $step
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $master_engine;
+    connection slave;
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $slave_engine;
+  }  
+  if (`SELECT $i=7`)
+  {
+    let $step= One Composite Primary Key ($master_engine -> $slave_engine);
+    --echo ****** TEST: $step
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $master_engine;
+    connection slave;
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $slave_engine;
+  } 
+  if (`SELECT $i=8`)
+  {
+    let $step= One Composite key with holes ($master_engine -> $slave_engine);
+    --echo ****** TEST: $step
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $master_engine;
+    connection slave;
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $slave_engine;
+  }  
+  if (`SELECT $i=9`)
+  {
+    let $step= One Composite Unique key with holes ($master_engine -> $slave_engine);
+    --echo ****** TEST: $step
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $master_engine;
+    connection slave;
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $slave_engine;
+  }  
+  if (`SELECT $i=10`)
+  {
+    let $step= One Composite Primary Key with holes ($master_engine -> $slave_engine);
+    --echo ****** TEST: $step
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $master_engine;
+    connection slave;
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $slave_engine;
+  } 
+  if (`SELECT $i=11`)
+  { 
+    let $step= One key ($master_engine -> $slave_engine);
+    --echo ******* TEST: $step
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c4)) engine= $master_engine;
+    connection slave;
+    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c4)) engine= $slave_engine;
+  }
+
+
+  connection master;
+  SET SQL_LOG_BIN=1;
+
+  connection master;
+  INSERT INTO t VALUES (1, '1', '1', '1' );
+  INSERT INTO t VALUES (4, '4', '4', '4' );
+  INSERT INTO t VALUES (7, '7', '7', '7' );
+
+  INSERT INTO t VALUES (9, '9', '9', NULL );
+
+  INSERT INTO t VALUES (2, '1', '2', '2' );
+  INSERT INTO t VALUES (3, '1', '3', '2' );
+ 
+  sync_slave_with_master;
+
+  connection master;
+  UPDATE t SET c4 = '7';
+
+  UPDATE t SET c4 = '5' WHERE c1 = 1;
+  UPDATE t SET c2 = '5' WHERE c1 = 1;
+  UPDATE t SET c1 = '5' WHERE c1 = 1;
+
+  UPDATE t SET c4 = '8' WHERE c2 = '4';
+  UPDATE t SET c1 = '8' WHERE c2 = '4';
+  UPDATE t SET c2 = '8' WHERE c2 = '4';
+
+  UPDATE t SET c3 = '0' WHERE c4 = NULL;
+  UPDATE t SET c2 = '0' WHERE c4 = '0';
+
+  UPDATE t SET c2 = '2' WHERE c4 = '2';
+
+  sync_slave_with_master;
+
+  let $diff_table_1=master:test.t;
+  let $diff_table_2=slave:test.t;
+  source include/diff_tables.inc;
+
+  connection master;
+  DELETE FROM t WHERE c1 = 7;
+  DELETE FROM t WHERE c1 = 8;
+  DELETE FROM t;
+
+  sync_slave_with_master;
+
+  let $diff_table_1=master:test.t;
+  let $diff_table_2=slave:test.t;
+  source include/diff_tables.inc;
+
+  DROP TABLE t;
+  sync_slave_with_master;
+
+  dec $i;
+}

=== modified file 'mysql-test/include/mtr_check.sql'
--- a/mysql-test/include/mtr_check.sql	2009-02-01 09:18:09 +0000
+++ b/mysql-test/include/mtr_check.sql	2009-03-31 13:39:40 +0000
@@ -57,3 +57,13 @@ BEGIN
     mysql.user;
 
 END||
+
+--
+-- Procedure used by test case used to force all
+-- servers to restart after testcase and thus skipping
+-- check test case after test
+--
+CREATE DEFINER=root@localhost PROCEDURE force_restart()
+BEGIN
+  SELECT 1 INTO OUTFILE 'force_restart';
+END||

=== modified file 'mysql-test/include/setup_fake_relay_log.inc'
--- a/mysql-test/include/setup_fake_relay_log.inc	2009-02-09 13:17:04 +0000
+++ b/mysql-test/include/setup_fake_relay_log.inc	2009-04-23 10:06:29 +0000
@@ -69,7 +69,21 @@ let $_fake_relay_log_purge= `SELECT @@gl
 # Create relay log file.
 copy_file $fake_relay_log $_fake_relay_log;
 # Create relay log index.
---exec echo $_fake_filename-fake.000001 > $_fake_relay_index
+
+# After patch for BUG#12190, the filename used in CHANGE MASTER
+# RELAY_LOG_FILE will be automatically added the directory of the
+# relay log before comparison, thus we need to added the directory
+# part (./ on unix .\ on windows) when faking the relay-log-bin.index.
+
+if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`)
+{
+  eval select './$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index';
+}
+
+if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") != 0`)
+{
+  eval select '.\\\\$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index';
+}
 
 # Setup replication from existing relay log.
 eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4;

=== modified file 'mysql-test/lib/My/File/Path.pm'
--- a/mysql-test/lib/My/File/Path.pm	2009-01-24 14:07:57 +0000
+++ b/mysql-test/lib/My/File/Path.pm	2009-04-01 14:23:10 +0000
@@ -164,6 +164,9 @@ sub copytree {
       copytree("$from_dir/$_", "$to_dir/$_");
       next;
     }
+
+    # Only copy plain files
+    next unless -f "$from_dir/$_";
     copy("$from_dir/$_", "$to_dir/$_");
   }
   closedir(DIR);

=== modified file 'mysql-test/lib/My/SafeProcess.pm'
--- a/mysql-test/lib/My/SafeProcess.pm	2009-03-09 13:31:39 +0000
+++ b/mysql-test/lib/My/SafeProcess.pm	2009-04-29 14:13:38 +0000
@@ -536,7 +536,37 @@ sub wait_any {
   return $proc;
 }
 
+
+#
+# Wait for all processes to exit
+#
+sub wait_all {
+  while(keys %running)
+  {
+    wait_any();
+  }
+}
+
+
 #
+# Check if any process has exited, but don't wait.
+#
+# Returns a reference to the SafeProcess that
+# exited or undefined
+#
+sub check_any {
+  for my $proc (values %running){
+    if ( $proc->is_child($$) ) {
+      if (not $proc->wait_one(0)) {
+	_verbose ("Found exited $proc");
+	return $proc;
+      }
+    }
+  }
+  return undef;
+}
+
+
 # Overload string operator
 # and fallback to default functions if no
 # overloaded function is found

=== modified file 'mysql-test/lib/My/SafeProcess/Base.pm'
--- a/mysql-test/lib/My/SafeProcess/Base.pm	2008-10-08 20:06:10 +0000
+++ b/mysql-test/lib/My/SafeProcess/Base.pm	2009-04-23 11:35:02 +0000
@@ -83,6 +83,13 @@ sub exit_status {
   };
 }
 
+# threads.pm may not exist everywhere, so use only on Windows.
+
+use if $^O eq "MSWin32", "threads";
+use if $^O eq "MSWin32", "threads::shared";
+
+my $win32_spawn_lock :shared;
+
 
 #
 # Create a new process
@@ -104,6 +111,8 @@ sub create_process {
 
   if ($^O eq "MSWin32"){
 
+    lock($win32_spawn_lock);
+
     #printf STDERR "stdin %d, stdout %d, stderr %d\n",
     #    fileno STDIN, fileno STDOUT, fileno STDERR;
 

=== modified file 'mysql-test/lib/mtr_cases.pm'
--- a/mysql-test/lib/mtr_cases.pm	2009-02-16 21:18:45 +0000
+++ b/mysql-test/lib/mtr_cases.pm	2009-05-12 13:54:12 +0000
@@ -33,7 +33,7 @@ our $print_testcases;
 our $skip_rpl;
 our $do_test;
 our $skip_test;
-our $opt_skip_combination;
+our $skip_combinations;
 our $binlog_format;
 our $enable_disabled;
 our $default_storage_engine;
@@ -93,7 +93,6 @@ sub init_pattern {
 
 sub collect_test_cases ($$) {
   my $suites= shift; # Semicolon separated list of test suites
-  my %found_suites;
   my $opt_cases= shift;
   my $cases= []; # Array of hash(one hash for each testcase)
 
@@ -103,7 +102,6 @@ sub collect_test_cases ($$) {
   foreach my $suite (split(",", $suites))
   {
     push(@$cases, collect_one_suite($suite, $opt_cases));
-    $found_suites{$suite}= 1;
   }
 
   if ( @$opt_cases )
@@ -115,23 +113,28 @@ sub collect_test_cases ($$) {
     {
       my $found= 0;
       my ($sname, $tname, $extension)= split_testname($test_name_spec);
-      if (defined($sname) && !defined($found_suites{$sname}))
-      {
-	$found_suites{$sname}= 1;
-	push(@$cases, collect_one_suite($sname));
-      }
-
       foreach my $test ( @$cases )
       {
 	# test->{name} is always in suite.name format
 	if ( $test->{name} =~ /.*\.$tname/ )
 	{
 	  $found= 1;
+	  last;
 	}
       }
       if ( not $found )
       {
-	mtr_error("Could not find '$tname' in '$suites' suite(s)");
+	mtr_error("Could not find '$tname' in '$suites' suite(s)") unless $sname;
+	# If suite was part of name, find it there
+	my ($this_case) = collect_one_suite($sname, [ $tname ]);
+	if ($this_case)
+        {
+	  push (@$cases, $this_case);
+	}
+	else
+	{
+	  mtr_error("Could not find '$tname' in '$sname' suite");
+        }
       }
     }
   }
@@ -383,7 +386,7 @@ sub collect_one_suite($)
   # Read combinations for this suite and build testcases x combinations
   # if any combinations exists
   # ----------------------------------------------------------------------
-  if ( ! $opt_skip_combination )
+  if ( ! $skip_combinations )
   {
     my @combinations;
     my $combination_file= "$suitedir/combinations";

=== modified file 'mysql-test/lib/mtr_process.pl'
--- a/mysql-test/lib/mtr_process.pl	2009-02-13 16:30:54 +0000
+++ b/mysql-test/lib/mtr_process.pl	2009-05-07 23:16:34 +0000
@@ -21,7 +21,25 @@
 use strict;
 use Socket;
 use Errno;
+use My::Platform;
+use if IS_WINDOWS, "Net::Ping";
 
+# Ancient perl might not have port_number method for Net::Ping.
+# Check it and use fallback to connect() if it is not present.
+BEGIN 
+{
+  my $use_netping= 0;
+  if (IS_WINDOWS)
+  {
+    my $ping = Net::Ping->new();
+    if ($ping->can("port_number"))
+    {
+      $use_netping= 1;
+    }
+  }
+  eval 'sub USE_NETPING { $use_netping }';
+}
+  
 sub sleep_until_file_created ($$$);
 sub mtr_ping_port ($);
 
@@ -30,6 +48,24 @@ sub mtr_ping_port ($) {
 
   mtr_verbose("mtr_ping_port: $port");
 
+  if (IS_WINDOWS && USE_NETPING)
+  {
+    # Under Windows, connect to a port that is not open is slow
+    # It takes ~1sec. Net::Ping with small timeout is much faster.
+    my $ping = Net::Ping->new();
+    $ping->port_number($port);
+    if ($ping->ping("localhost",0.1))
+    {
+      mtr_verbose("USED");
+      return 1;
+    }
+    else
+    {
+      mtr_verbose("FREE");
+      return 0;
+    }
+  }
+  
   my $remote= "localhost";
   my $iaddr=  inet_aton($remote);
   if ( ! $iaddr )

=== modified file 'mysql-test/lib/mtr_report.pm'
--- a/mysql-test/lib/mtr_report.pm	2009-04-01 20:48:42 +0000
+++ b/mysql-test/lib/mtr_report.pm	2009-04-28 10:42:25 +0000
@@ -259,6 +259,17 @@ sub mtr_report_stats ($) {
       $tot_restarts++;
     }
 
+    # Add counts for repeated runs, if any.
+    # Note that the last run has already been counted above.
+    my $num_repeat = $tinfo->{'repeat'} - 1;
+    if ( $num_repeat > 0 )
+    {
+      $tot_tests += $num_repeat;
+      my $rep_failed = $tinfo->{'rep_failures'} || 0;
+      $tot_failed += $rep_failed;
+      $tot_passed += $num_repeat - $rep_failed;
+    }
+
     # Look for warnings produced by mysqltest
     my $base_file= mtr_match_extension($tinfo->{'result_file'},
 				       "result"); # Trim extension
@@ -337,7 +348,7 @@ sub mtr_report_stats ($) {
     foreach my $tinfo (@$tests)
     {
       my $tname= $tinfo->{'name'};
-      if ( $tinfo->{failures} and ! $seen{$tname})
+      if ( ($tinfo->{failures} || $tinfo->{rep_failures}) and ! $seen{$tname})
       {
         print " $tname";
 	$seen{$tname}= 1;

=== modified file 'mysql-test/lib/mtr_unique.pm'
--- a/mysql-test/lib/mtr_unique.pm	2009-03-11 17:17:00 +0000
+++ b/mysql-test/lib/mtr_unique.pm	2009-04-28 10:42:25 +0000
@@ -28,32 +28,36 @@ sub msg {
  # print "### unique($$) - ", join(" ", @_), "\n";
 }
 
-my $file;
+my $dir;
 
 if(!IS_WINDOWS)
 {
-  $file= "/tmp/mysql-test-ports";
+  $dir= "/tmp/mysql-unique-ids";
 }
 else
 {
-  $file= $ENV{'TEMP'}."/mysql-test-ports";
+  # Try to use machine-wide directory location for unique IDs,
+  # $ALLUSERSPROFILE . IF it is not available, fallback to $TEMP
+  # which is typically a per-user temporary directory
+  if (exists $ENV{'ALLUSERSPROFILE'} && -w $ENV{'ALLUSERSPROFILE'})
+  {
+    $dir= $ENV{'ALLUSERSPROFILE'}."/mysql-unique-ids";
+  }
+  else
+  {
+    $dir= $ENV{'TEMP'}."/mysql-unique-ids";
+  }
 }
-  
 
-my %mtr_unique_ids;
+my $mtr_unique_fh = undef;
 
-END {
-  my $allocated_id= $mtr_unique_ids{$$};
-  if (defined $allocated_id)
-  {
-    mtr_release_unique_id($allocated_id);
-  }
-  delete $mtr_unique_ids{$$};
+END
+{
+  mtr_release_unique_id();
 }
 
 #
-# Get a unique, numerical ID, given a file name (where all
-# requested IDs are stored), a minimum and a maximum value.
+# Get a unique, numerical ID in a specified range.
 #
 # If no unique ID within the specified parameters can be
 # obtained, return undef.
@@ -61,135 +65,63 @@ END {
 sub mtr_get_unique_id($$) {
   my ($min, $max)= @_;;
 
-  msg("get, '$file', $min-$max");
-
-  die "Can only get one unique id per process!" if $mtr_unique_ids{$$};
+  msg("get $min-$max, $$");
 
-  my $ret = undef;
-  my $changed = 0;
-
-  if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
-    die 'lock file is a symbolic link';
-  }
+  die "Can only get one unique id per process!" if defined $mtr_unique_fh;
 
-  chmod 0777, "$file.sem";
-  open SEM, ">", "$file.sem" or die "can't write to $file.sem";
-  flock SEM, LOCK_EX or die "can't lock $file.sem";
-  if(! -e $file) {
-    open FILE, ">", $file or die "can't create $file";
-    close FILE;
-  }
 
-  msg("HAVE THE LOCK");
+  # Make sure our ID directory exists
+  if (! -d $dir)
+  {
+    # If there is a file with the reserved
+    # directory name, just delete the file.
+    if (-e $dir)
+    {
+      unlink($dir);
+    }
 
-  if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
-    die 'lock file is a symbolic link';
-  }
+    mkdir $dir;
+    chmod 0777, $dir;
 
-  chmod 0777, $file;
-  open FILE, "+<", $file or die "can't open $file";
-  #select undef,undef,undef,0.2;
-  seek FILE, 0, 0;
-  my %taken = ();
-  while(<FILE>) {
-    chomp;
-    my ($id, $pid) = split / /;
-    $taken{$id} = $pid;
-    msg("taken: $id, $pid");
-    # Check if process with given pid is alive
-    if(!process_alive($pid)) {
-      print "Removing slot $id used by missing process $pid\n";
-      msg("Removing slot $id used by missing process $pid");
-      delete $taken{$id};
-      $changed++;
+    if(! -d $dir)
+    {
+      die "can't make directory $dir";
     }
   }
-  for(my $i=$min; $i<=$max; ++$i) {
-    if(! exists $taken{$i}) {
-      $ret = $i;
-      $taken{$i} = $$;
-      $changed++;
-      # Remember the id this process got
-      $mtr_unique_ids{$$}= $i;
-      msg(" got $i"); 
-      last;
+
+
+  my $fh;
+  for(my $id = $min; $id <= $max; $id++)
+  {
+    open( $fh, ">$dir/$id");
+    chmod 0666, "$dir/$id";
+    # Try to lock the file exclusively. If lock succeeds, we're done.
+    if (flock($fh, LOCK_EX|LOCK_NB))
+    {
+      # Store file handle - we would need it to release the ID (==unlock the file)
+      $mtr_unique_fh = $fh;
+      return $id;
     }
-  }
-  if($changed) {
-    seek FILE, 0, 0;
-    truncate FILE, 0 or die "can't truncate $file";
-    for my $k (keys %taken) {
-      print FILE $k . ' ' . $taken{$k} . "\n";
+    else
+    {
+      close $fh;
     }
   }
-  close FILE;
-
-  msg("RELEASING THE LOCK");
-  flock SEM, LOCK_UN or warn "can't unlock $file.sem";
-  close SEM;
-
-  return $ret;
+  return undef;
 }
 
 
 #
 # Release a unique ID.
 #
-sub mtr_release_unique_id($) {
-  my ($myid)= @_;
-
-  msg("release, $myid");
-
-
-  if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
-    die 'lock file is a symbolic link';
-  }
-
-  open SEM, ">", "$file.sem" or die "can't write to $file.sem";
-  flock SEM, LOCK_EX or die "can't lock $file.sem";
-
-  msg("HAVE THE LOCK");
-
-  if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
-    die 'lock file is a symbolic link';
-  }
-
-  if(! -e $file) {
-    open FILE, ">", $file or die "can't create $file";
-    close FILE;
-  }
-  open FILE, "+<", $file or die "can't open $file";
-  #select undef,undef,undef,0.2;
-  seek FILE, 0, 0;
-  my %taken = ();
-  while(<FILE>) {
-    chomp;
-    my ($id, $pid) = split / /;
-    msg(" taken, $id $pid");
-    $taken{$id} = $pid;
-  }
-
-  if ($taken{$myid} != $$)
+sub mtr_release_unique_id()
+{
+  msg("release $$");
+  if (defined $mtr_unique_fh)
   {
-    msg(" The unique id for this process does not match pid");
+    close $mtr_unique_fh;
+    $mtr_unique_fh = undef;
   }
-
-
-  msg(" removing $myid");
-  delete $taken{$myid};
-  seek FILE, 0, 0;
-  truncate FILE, 0 or die "can't truncate $file";
-  for my $k (keys %taken) {
-    print FILE $k . ' ' . $taken{$k} . "\n";
-  }
-  close FILE;
-
-  msg("RELEASE THE LOCK");
-
-  flock SEM, LOCK_UN or warn "can't unlock $file.sem";
-  close SEM;
-
-  delete $mtr_unique_ids{$$};
 }
 
 

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2009-04-30 14:35:36 +0000
+++ b/mysql-test/mysql-test-run.pl	2009-05-12 13:54:12 +0000
@@ -215,6 +215,7 @@ sub check_timeout { return $opt_testcase
 
 my $opt_start;
 my $opt_start_dirty;
+my $opt_wait_all;
 my $opt_repeat= 1;
 my $opt_retry= 3;
 my $opt_retry_failure= 2;
@@ -528,6 +529,7 @@ sub run_test_server ($$$) {
 	      }
 	    }
 	    $num_saved_datadir++;
+	    $num_failed_test++ unless $result->{retries};
 
 	    if ( !$opt_force ) {
 	      # Test has failed, force is off
@@ -542,7 +544,6 @@ sub run_test_server ($$$) {
 			 "Terminating...");
 	      return undef;
 	    }
-	    $num_failed_test++;
 	  }
 
 	  # Retry test run after test failure
@@ -567,9 +568,11 @@ sub run_test_server ($$$) {
 
 	  # Repeat test $opt_repeat number of times
 	  my $repeat= $result->{repeat} || 1;
-	  if ($repeat < $opt_repeat)
+	  # Don't repeat if test was skipped
+	  if ($repeat < $opt_repeat && $result->{'result'} ne 'MTR_RES_SKIPPED')
 	  {
 	    $result->{retries}= 0;
+	    $result->{rep_failures}++ if $result->{failures};
 	    $result->{failures}= 0;
 	    delete($result->{result});
 	    $result->{repeat}= $repeat+1;
@@ -893,6 +896,7 @@ sub command_line_setup {
              'sleep=i'                  => \$opt_sleep,
              'start-dirty'              => \$opt_start_dirty,
              'start'                    => \$opt_start,
+             'wait-all'                 => \$opt_wait_all,
 	     'print-testcases'          => \&collect_option,
 	     'repeat=i'                 => \$opt_repeat,
 	     'retry=i'                  => \$opt_retry,
@@ -1255,6 +1259,15 @@ sub command_line_setup {
   }
 
   # --------------------------------------------------------------------------
+  # Check use of wait-all
+  # --------------------------------------------------------------------------
+
+  if ($opt_wait_all && ! ($opt_start_dirty || $opt_start))
+  {
+    mtr_error("--wait-all can only be used with --start or --start-dirty");
+  }
+
+  # --------------------------------------------------------------------------
   # Check timeout arguments
   # --------------------------------------------------------------------------
 
@@ -1344,29 +1357,31 @@ sub set_build_thread_ports($) {
 
   if ( lc($opt_build_thread) eq 'auto' ) {
     my $found_free = 0;
-    $build_thread = 250;	# Start attempts from here
+    $build_thread = 300;	# Start attempts from here
     while (! $found_free)
     {
-      $build_thread= mtr_get_unique_id($build_thread, 299);
+      $build_thread= mtr_get_unique_id($build_thread, 349);
       if ( !defined $build_thread ) {
-	mtr_error("Could not get a unique build thread id");
+        mtr_error("Could not get a unique build thread id");
       }
       $found_free= check_ports_free($build_thread);
       # If not free, release and try from next number
-      mtr_release_unique_id($build_thread++) unless $found_free;
+      if (! $found_free) {
+        mtr_release_unique_id();
+        $build_thread++;
+      }
     }
   }
   else
   {
     $build_thread = $opt_build_thread + $thread - 1;
+    if (! check_ports_free($build_thread)) {
+      # Some port was not free(which one has already been printed)
+      mtr_error("Some port(s) was not free")
+    }
   }
   $ENV{MTR_BUILD_THREAD}= $build_thread;
 
-  if (! check_ports_free($build_thread)) {
-    # Some port was not free(which one has already been printed)
-    mtr_error("Some port(s) was not free")
-  }
-
   # Calculate baseport
   $baseport= $build_thread * 10 + 10000;
   if ( $baseport < 5001 or $baseport + 9 >= 32767 )
@@ -1603,24 +1618,6 @@ sub client_debug_arg($$) {
 }
 
 
-sub mysql_fix_arguments () {
-
-  return "" if ( IS_WINDOWS );
-
-  my $exe=
-    mtr_script_exists("$basedir/scripts/mysql_fix_privilege_tables",
-		      "$path_client_bindir/mysql_fix_privilege_tables");
-  my $args;
-  mtr_init_args(\$args);
-  mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
-
-  mtr_add_arg($args, "--basedir=%s", $basedir);
-  mtr_add_arg($args, "--bindir=%s", $path_client_bindir);
-  mtr_add_arg($args, "--verbose");
-  return mtr_args2str($exe, @$args);
-}
-
-
 sub client_arguments ($;$) {
   my $client_name= shift;
   my $group_suffix= shift;
@@ -3201,6 +3198,26 @@ sub find_analyze_request
 }
 
 
+# The test can leave a file in var/tmp/ to signal
+# that all servers should be restarted
+sub restart_forced_by_test
+{
+  my $restart = 0;
+  foreach my $mysqld ( mysqlds() )
+  {
+    my $datadir = $mysqld->value('datadir');
+    my $force_restart_file = "$datadir/mtr/force_restart";
+    if ( -f $force_restart_file )
+    {
+      mtr_verbose("Restart of servers forced by test");
+      $restart = 1;
+      last;
+    }
+  }
+  return $restart;
+}
+
+
 # Return timezone value of tinfo or default value
 sub timezone {
   my ($tinfo)= @_;
@@ -3242,7 +3259,7 @@ sub run_testcase ($) {
     {
 
       # Remove old datadirs
-      clean_datadir();
+      clean_datadir() unless $opt_start_dirty;
 
       # Restore old ENV
       while (my ($option, $value)= each( %old_env )) {
@@ -3309,19 +3326,29 @@ sub run_testcase ($) {
   # --------------------------------------------------------------------
   # If --start or --start-dirty given, stop here to let user manually
   # run tests
+  # If --wait-all is also given, do the same, but don't die if one
+  # server exits
   # ----------------------------------------------------------------------
+
   if ( $opt_start or $opt_start_dirty )
   {
     mtr_print("\nStarted", started(all_servers()));
     mtr_print("Waiting for server(s) to exit...");
-    my $proc= My::SafeProcess->wait_any();
-    if ( grep($proc eq $_, started(all_servers())) )
-    {
-      mtr_print("Server $proc died");
+    if ( $opt_wait_all ) {
+      My::SafeProcess->wait_all();
+      mtr_print( "All servers exited" );
+      exit(1);
+    }
+    else {
+      my $proc= My::SafeProcess->wait_any();
+      if ( grep($proc eq $_, started(all_servers())) )
+      {
+        mtr_print("Server $proc died");
+        exit(1);
+      }
+      mtr_print("Unknown process $proc died");
       exit(1);
     }
-    mtr_print("Unknown process $proc died");
-    exit(1);
   }
 
   my $test_timeout_proc= My::SafeProcess->timer(testcase_timeout());
@@ -3339,10 +3366,38 @@ sub run_testcase ($) {
   }
 
   my $test= start_mysqltest($tinfo);
+  # Set only when we have to keep waiting after expectedly died server
+  my $keep_waiting_proc = 0;
 
   while (1)
   {
-    my $proc= My::SafeProcess->wait_any();
+    my $proc;
+    if ($keep_waiting_proc)
+    {
+      # Any other process exited?
+      $proc = My::SafeProcess->check_any();
+      if ($proc)
+      {
+	mtr_verbose ("Found exited process $proc");
+	# If that was the timeout, cancel waiting
+	if ( $proc eq $test_timeout_proc )
+	{
+	  $keep_waiting_proc = 0;
+	}
+      }
+      else
+      {
+	$proc = $keep_waiting_proc;
+      }
+    }
+    else
+    {
+      $proc= My::SafeProcess->wait_any();
+    }
+
+    # Will be restored if we need to keep waiting
+    $keep_waiting_proc = 0;
+
     unless ( defined $proc )
     {
       mtr_error("wait_any failed");
@@ -3369,7 +3424,11 @@ sub run_testcase ($) {
       if ( $res == 0 )
       {
 	my $check_res;
-	if ( $opt_check_testcases and
+	if ( restart_forced_by_test() )
+	{
+	  stop_all_servers();
+	}
+	elsif ( $opt_check_testcases and
 	     $check_res= check_testcase($tinfo, "after"))
 	{
 	  if ($check_res == 1) {
@@ -3434,8 +3493,12 @@ sub run_testcase ($) {
     # ----------------------------------------------------
     # Check if it was an expected crash
     # ----------------------------------------------------
-    if ( check_expected_crash_and_restart($proc) )
+    my $check_crash = check_expected_crash_and_restart($proc);
+    if ($check_crash)
     {
+      # Keep waiting if it returned 2, if 1 don't wait or stop waiting.
+      $keep_waiting_proc = 0 if $check_crash == 1;
+      $keep_waiting_proc = $proc if $check_crash == 2;
       next;
     }
 
@@ -3777,16 +3840,16 @@ sub check_expected_crash_and_restart {
     {
       mtr_verbose("Crash was expected, file '$expect_file' exists");
 
-      while (1){
-
+      for (my $waits = 0;  $waits < 50;  $waits++)
+      {
 	# If last line in expect file starts with "wait"
 	# sleep a little and try again, thus allowing the
 	# test script to control when the server should start
-	# up again
+	# up again. Keep trying for up to 5s at a time.
 	my $last_line= mtr_lastlinesfromfile($expect_file, 1);
 	if ($last_line =~ /^wait/ )
 	{
-	  mtr_verbose("Test says wait before restart");
+	  mtr_verbose("Test says wait before restart") if $waits == 0;
 	  mtr_milli_sleep(100);
 	  next;
 	}
@@ -3796,11 +3859,11 @@ sub check_expected_crash_and_restart {
 	# Start server with same settings as last time
 	mysqld_start($mysqld, $mysqld->{'started_opts'});
 
-	last;
+	return 1;
       }
+      # Loop ran through: we should keep waiting after a re-check
+      return 2;
     }
-
-    return 1;
   }
 
   # Not an expected crash
@@ -4518,14 +4581,17 @@ sub start_servers($) {
     my $mysqld_basedir= $mysqld->value('basedir');
     if ( $basedir eq $mysqld_basedir )
     {
-      # Copy datadir from installed system db
-      for my $path ( "$opt_vardir", "$opt_vardir/..") {
-	my $install_db= "$path/install.db";
-	copytree($install_db, $datadir)
-	  if -d $install_db;
+      if (! $opt_start_dirty)	# If dirty, keep possibly grown system db
+      {
+	# Copy datadir from installed system db
+	for my $path ( "$opt_vardir", "$opt_vardir/..") {
+	  my $install_db= "$path/install.db";
+	  copytree($install_db, $datadir)
+	    if -d $install_db;
+	}
+	mtr_error("Failed to copy system db to '$datadir'")
+	  unless -d $datadir;
       }
-      mtr_error("Failed to copy system db to '$datadir'")
-	unless -d $datadir;
     }
     else
     {
@@ -5066,10 +5132,13 @@ Options to control what engine/variation
   vs-config             Visual Studio configuration used to create executables
                         (default: MTR_VS_CONFIG environment variable)
 
-  config|defaults-file=<config template> Use fixed config template for all
+  defaults-file=<config template> Use fixed config template for all
                         tests
   defaults-extra-file=<config template> Extra config template to add to
                         all generated configs
+  combination=<opt>     Use at least twice to run tests with specified 
+                        options to mysqld
+  skip-combinations     Ignore combination file (or options)
 
 Options to control directories to use
   tmpdir=DIR            The directory where temporary files are stored
@@ -5092,7 +5161,6 @@ Options to control what test suites or c
   force                 Continue to run the suite after failure
   with-ndbcluster-only  Run only tests that include "ndb" in the filename
   skip-ndb[cluster]     Skip all tests that need cluster
-  skip-ndb[cluster]-slave Skip all tests that need a slave cluster
   do-test=PREFIX or REGEX
                         Run test cases which name are prefixed with PREFIX
                         or fulfills REGEX
@@ -5107,6 +5175,9 @@ Options to control what test suites or c
                         The default is: "$DEFAULT_SUITES"
   skip-rpl              Skip the replication test cases.
   big-test              Also run tests marked as "big"
+  enable-disabled       Run also tests marked as disabled
+  print_testcases       Don't run the tests but print details about all the
+                        selected tests, in the order they would be run.
 
 Options that specify ports
 
@@ -5176,7 +5247,7 @@ Options for valgrind
   valgrind-options=ARGS Deprecated, use --valgrind-option
   valgrind-option=ARGS  Option to give valgrind, replaces default option(s),
                         can be specified more then once
-  valgrind-path=[EXE]   Path to the valgrind executable
+  valgrind-path=<EXE>   Path to the valgrind executable
   callgrind             Instruct valgrind to use callgrind
 
 Misc options
@@ -5184,14 +5255,18 @@ Misc options
   comment=STR           Write STR to the output
   notimer               Don't show test case execution time
   verbose               More verbose output(use multiple times for even more)
+  verbose-restart       Write when and why servers are restarted
   start                 Only initialize and start the servers, using the
                         startup settings for the first specified test case
                         Example:
                          $0 --start alias &
   start-dirty           Only start the servers (without initialization) for
                         the first specified test case
+  wait-all              If --start or --start-dirty option is used, wait for all
+                        servers to exit before finishing the process
   fast                  Run as fast as possible, dont't wait for servers
                         to shutdown etc.
+  parallel=N            Run tests in N parallel threads (default=1)
   repeat=N              Run each test N number of times
   retry=N               Retry tests that fail N times, limit number of failures
                         to $opt_retry_failure
@@ -5211,6 +5286,12 @@ Misc options
                         actions. Disable facility with NUM=0.
   gcov                  Collect coverage information after the test.
                         The result is a gcov file per source and header file.
+  experimental=<file>   Refer to list of tests considered experimental;
+                        failures will be marked exp-fail instead of fail.
+  report-features       First run a "test" that reports mysql features
+  timestamp             Print timestamp before each test report line
+  timediff              With --timestamp, also print time passed since
+                        *previous* test started
 
 HERE
   exit(1);

=== added file 'mysql-test/r/drop_debug.result'
--- a/mysql-test/r/drop_debug.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/drop_debug.result	2009-05-07 11:15:54 +0000
@@ -0,0 +1,25 @@
+
+# --
+# -- Bug#43138: DROP DATABASE failure does not clean up message list.
+# --
+
+DROP DATABASE IF EXISTS mysql_test;
+
+CREATE DATABASE mysql_test;
+CREATE TABLE mysql_test.t1(a INT);
+CREATE TABLE mysql_test.t2(b INT);
+CREATE TABLE mysql_test.t3(c INT);
+
+SET SESSION DEBUG = "+d,bug43138";
+
+DROP DATABASE mysql_test;
+Warnings:
+Error	1051	Unknown table 't1'
+Error	1051	Unknown table 't2'
+Error	1051	Unknown table 't3'
+
+SET SESSION DEBUG = "-d,bug43138";
+
+# --
+# -- End of Bug#43138.
+# --

=== modified file 'mysql-test/r/init_file.result'
--- a/mysql-test/r/init_file.result	2009-02-01 09:18:09 +0000
+++ b/mysql-test/r/init_file.result	2009-04-02 11:00:44 +0000
@@ -4,6 +4,7 @@ SELECT * INTO @Y FROM init_file.startup 
 SELECT YEAR(@X)-YEAR(@Y);
 YEAR(@X)-YEAR(@Y)
 0
+DROP DATABASE init_file;
 ok
 end of 4.1 tests
 select * from t1;
@@ -19,3 +20,5 @@ y
 3
 11
 13
+drop table t1, t2;
+call mtr.force_restart();

=== modified file 'mysql-test/r/log_state.result'
--- a/mysql-test/r/log_state.result	2009-01-26 16:32:29 +0000
+++ b/mysql-test/r/log_state.result	2009-03-31 16:47:35 +0000
@@ -311,6 +311,30 @@ SET @@global.general_log_file = @old_gen
 SET @@global.slow_query_log = @old_slow_query_log;
 SET @@global.slow_query_log_file = @old_slow_query_log_file;
 End of 5.1 tests
+
+# --
+# -- Bug#38124: "general_log_file" variable silently unset when
+# --             using expression
+# --
+SET GLOBAL general_log_file = DEFAULT;
+SELECT @@general_log_file INTO @my_glf;
+SET GLOBAL general_log_file = 'BUG38124.LOG';
+SELECT @@general_log_file;
+@@general_log_file
+BUG38124.LOG
+SET GLOBAL general_log_file = concat('BUG38124-2.LOG');
+SELECT @@general_log_file;
+@@general_log_file
+BUG38124-2.LOG
+SET GLOBAL general_log_file = substr('BUG38124-2.LOG',3,6);
+SELECT @@general_log_file;
+@@general_log_file
+G38124
+SET GLOBAL general_log_file = DEFAULT;
+SELECT @@general_log_file = @my_glf;
+@@general_log_file = @my_glf
+1
+SET GLOBAL general_log_file = @old_general_log_file;
 # Close connection con1
 SET global general_log = @old_general_log;
 SET global general_log_file = @old_general_log_file;

=== added file 'mysql-test/r/log_state_bug33693.result'
--- a/mysql-test/r/log_state_bug33693.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/log_state_bug33693.result	2009-04-01 18:00:07 +0000
@@ -0,0 +1,3 @@
+SELECT INSTR(@@general_log_file, 'MYSQLTEST_VARDIR/run');;
+INSTR(@@general_log_file, 'MYSQLTEST_VARDIR/run')
+0

=== modified file 'mysql-test/r/lowercase_table2.result'
--- a/mysql-test/r/lowercase_table2.result	2006-06-14 05:54:56 +0000
+++ b/mysql-test/r/lowercase_table2.result	2009-05-15 08:00:35 +0000
@@ -174,3 +174,79 @@ TABLE_SCHEMA	TABLE_NAME
 mysqltest_LC2	myUC
 use test;
 drop database mysqltest_LC2;
+# End of 5.1 tests
+#
+# Test for bug #44738 "fill_schema_table_from_frm() opens tables without
+# lowercasing table name". Due to not properly normalizing table names
+# in lower_case_table_names modes in this function queries to I_S which
+# were executed through it left entries with incorrect key in table
+# definition cache. This issue combined with a similar problem in
+# CREATE TABLE (it also has peeked into table definition cache using
+# non-normalized key) led to spurious ER_TABLE_EXISTS_ERROR errors
+# when one tried to create table with the same name as a previously
+# existing but dropped table.
+#
+drop database if exists mysqltest_UPPERCASE;
+drop table if exists t_bug44738_UPPERCASE;
+create database mysqltest_UPPERCASE;
+use mysqltest_UPPERCASE;
+create table t_bug44738_UPPERCASE (i int);
+# Ensure that we don't have any leftovers in table definition
+# cache from previous tests.
+flush tables;
+# There should be no entries for our table in table definition cache
+show open tables like 't_bug44738_%';
+Database	Table	In_use	Name_locked
+select table_schema, table_name, table_comment from information_schema.tables
+where table_schema like 'mysqltest_%' and table_name like 't_bug44738_%';
+table_schema	table_name	table_comment
+mysqltest_UPPERCASE	t_bug44738_UPPERCASE	
+# Due to --lower-case-table-names > 0 mode database and table name for
+# TDC entry for our table should be 'normalized' (i.e. lowercased).
+show open tables like 't_bug44738_%';
+Database	Table	In_use	Name_locked
+mysqltest_uppercase	t_bug44738_uppercase	0	0
+drop table t_bug44738_UPPERCASE;
+# After DROP TABLE this entry should be removed.
+show open tables like 't_bug44738_%';
+Database	Table	In_use	Name_locked
+drop database mysqltest_UPPERCASE;
+use test;
+# Let us check that the original test case which led to discovery
+# of this problem also works.
+create table t_bug44738_UPPERCASE (i int);
+select table_schema, table_name, table_comment from information_schema.tables
+where table_schema = 'test' and table_name like 't_bug44738_%';
+table_schema	table_name	table_comment
+test	t_bug44738_UPPERCASE	
+drop table t_bug44738_UPPERCASE;
+# Check that after the above DROP TABLE there are no entries in TDC
+# which correspond to our table.
+show open tables like 't_bug44738_%';
+Database	Table	In_use	Name_locked
+# Therefore the below statement should succeed.
+create table t_bug44738_UPPERCASE (i int);
+drop table t_bug44738_UPPERCASE;
+# Finally, let us check that another issue which was exposed by
+# the original test case is solved. I.e. that fuse in CREATE TABLE
+# which ensures that table is not created if there is an entry for
+# it in TDC even though it was removed from disk uses normalized
+# version of the table name.
+create table t_bug44738_UPPERCASE (i int) engine = myisam;
+# Load table definition in TDC.
+select table_schema, table_name, table_comment from information_schema.tables
+where table_schema = 'test' and table_name like 't_bug44738_%';
+table_schema	table_name	table_comment
+test	t_bug44738_UPPERCASE	
+# Simulate manual removal of the table.
+# Check that still there is an entry for table in TDC.
+show open tables like 't_bug44738_%';
+Database	Table	In_use	Name_locked
+test	t_bug44738_uppercase	0	0
+# So attempt to create table with the same name should fail.
+create table t_bug44738_UPPERCASE (i int);
+ERROR 42S01: Table 't_bug44738_uppercase' already exists
+# And should succeed after FLUSH TABLES.
+flush tables;
+create table t_bug44738_UPPERCASE (i int);
+drop table t_bug44738_UPPERCASE;

=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result	2009-03-06 20:33:52 +0000
+++ b/mysql-test/r/mysqltest.result	2009-04-01 08:16:35 +0000
@@ -545,6 +545,8 @@ mysqltest: At line 1: Failed to open fil
 mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
 mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
 mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
+mysqltest: At line 1: Missing required argument 'from_file' to command 'move_file'
+mysqltest: At line 1: Missing required argument 'to_file' to command 'move_file'
 mysqltest: At line 1: Missing required argument 'mode' to command 'chmod'
 mysqltest: At line 1: You must write a 4 digit octal number for mode
 mysqltest: At line 1: You must write a 4 digit octal number for mode

=== modified file 'mysql-test/r/parser.result'
--- a/mysql-test/r/parser.result	2009-04-17 20:33:59 +0000
+++ b/mysql-test/r/parser.result	2009-05-11 17:58:07 +0000
@@ -623,10 +623,43 @@ UPDATE t3 SET a4={d '1789-07-14'} WHERE 
 SELECT a1, a4 FROM t2 WHERE a4 LIKE {fn UCASE('1789-07-14')};
 a1	a4
 DROP TABLE t1, t2, t3;
+#
+# End of 5.1 tests
+#
 BACKUP DATABASE *, test to 'broken.bak';
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' test to 'broken.bak'' at line 1
 BACKUP DATABASE *, db1, db2, db3 to 'broken.bak';
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' db1, db2, db3 to 'broken.bak'' at line 1
-#
-# End of 5.1 tests
-#
+# Should use myisam
+create logfile group ndb_lg1 add undofile 'ndb_undo1' initial_size=32M;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+create logfile group ndb_lg1 add undofile 'ndb_undo1' engine=myisam;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+create logfile group ndb_lg1 add undofile 'ndb_undo1';
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+create tablespace ndb_ts1 add datafile 'ndb_ts1.dat' use logfile group ndb_lg1 engine=myisam initial_size=32M;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+create tablespace ndb_ts1 add datafile 'ndb_ts1.dat' use logfile group ndb_lg1 engine=myisam;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+create tablespace ndb_ts1 add datafile 'ndb_ts1.dat' use logfile group ndb_lg1;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+alter logfile group ndb_lg1 add undofile 'ndb_undo1' wait;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+alter logfile group ndb_lg1 add undofile 'ndb_undo1' engine=myisam;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+alter logfile group ndb_lg1 add undofile 'ndb_undo1';
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+alter tablespace ndb_ts1 add datafile 'ndb_ts1.dat' initial_size=32M;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+alter tablespace ndb_ts1 add datafile 'ndb_ts1.dat' engine=myisam;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+alter tablespace ndb_ts1 add datafile 'ndb_ts1.dat';
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+drop logfile group ndb_lg1 engine=myisam;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+drop logfile group ndb_lg1;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+drop tablespace ndb_ts1 engine=myisam;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
+drop tablespace ndb_ts1;
+ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'

=== modified file 'mysql-test/r/plugin.result'
--- a/mysql-test/r/plugin.result	2009-04-16 15:17:31 +0000
+++ b/mysql-test/r/plugin.result	2009-04-30 16:22:40 +0000
@@ -12,6 +12,15 @@ CREATE TABLE t1(a int) ENGINE=EXAMPLE;
 SELECT * FROM t1;
 a
 DROP TABLE t1;
+set global example_ulong_var=500;
+set global example_enum_var= e1;
+show status like 'example%';
+Variable_name	Value
+example_func_example	enum_var is 0, ulong_var is 500, really
+show variables like 'example%';
+Variable_name	Value
+example_enum_var	e1
+example_ulong_var	500
 UNINSTALL PLUGIN example;
 UNINSTALL PLUGIN EXAMPLE;
 ERROR 42000: PLUGIN EXAMPLE does not exist

=== modified file 'mysql-test/suite/backup/r/backup_logs.result'
--- a/mysql-test/suite/backup/r/backup_logs.result	2009-05-07 01:44:37 +0000
+++ b/mysql-test/suite/backup/r/backup_logs.result	2009-05-25 06:46:00 +0000
@@ -367,9 +367,9 @@ Attempt to set the backup log paths to a
 
 SET global max_allowed_packet=1024*100;
 
-Now attempt to set the backup_progress_log_file to 512 characters.
+Now attempt to set the backup_progress_log_file to 255 characters.
 
-SET @@global.backup_progress_log_file = repeat('a',512);
+SET @@global.backup_progress_log_file = repeat('a',255);
 
 Now attempt to set the backup_progress_log_file to 513 characters.
 
@@ -382,9 +382,9 @@ SET @@global.backup_progress_log_file = 
 ERROR HY000: The path specified for backup_progress_log_file is too long.
 SET @@global.backup_progress_log_file = DEFAULT;
 
-Now attempt to set the backup_history_log_file to 512 characters.
+Now attempt to set the backup_history_log_file to 255 characters.
 
-SET @@global.backup_history_log_file = repeat('a',512);
+SET @@global.backup_history_log_file = repeat('a',255);
 
 Now attempt to set the backup_history_log_file to 513 characters.
 

=== modified file 'mysql-test/suite/backup/t/backup_logs.test'
--- a/mysql-test/suite/backup/t/backup_logs.test	2009-05-07 01:44:37 +0000
+++ b/mysql-test/suite/backup/t/backup_logs.test	2009-05-25 06:46:00 +0000
@@ -479,9 +479,9 @@ BACKUP DATABASE backup_logs to 'backup_l
 SET global max_allowed_packet=1024*100;
 
 --echo
---echo Now attempt to set the backup_progress_log_file to 512 characters.
+--echo Now attempt to set the backup_progress_log_file to 255 characters.
 --echo
-SET @@global.backup_progress_log_file = repeat('a',512);
+SET @@global.backup_progress_log_file = repeat('a',255);
 
 --echo
 --echo Now attempt to set the backup_progress_log_file to 513 characters.
@@ -497,9 +497,9 @@ SET @@global.backup_progress_log_file = 
 SET @@global.backup_progress_log_file = DEFAULT;
 
 --echo
---echo Now attempt to set the backup_history_log_file to 512 characters.
+--echo Now attempt to set the backup_history_log_file to 255 characters.
 --echo
-SET @@global.backup_history_log_file = repeat('a',512);
+SET @@global.backup_history_log_file = repeat('a',255);
 
 --echo
 --echo Now attempt to set the backup_history_log_file to 513 characters.

=== added file 'mysql-test/suite/binlog/r/binlog_max_extension.result'
--- a/mysql-test/suite/binlog/r/binlog_max_extension.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_max_extension.result	2009-04-24 12:55:11 +0000
@@ -0,0 +1,12 @@
+RESET MASTER;
+**** Stop master server ****
+INDEX: MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index
+BINLOG: MYSQLTEST_VARDIR/mysqld.1/data//master-bin.000001
+RENAMED BINLOG: MYSQLTEST_VARDIR/mysqld.1/data//master-bin.2147483646
+WROTE into index file last entry: ./master-bin.2147483646
+**** ReStart master server ****
+FLUSH LOGS;
+Warnings:
+Warning	1098	Can't generate a unique log-filename master-bin.(1-999)
+
+RESET MASTER;

=== modified file 'mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test'
--- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test	2009-03-06 18:19:29 +0000
+++ b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test	2009-04-23 10:06:29 +0000
@@ -25,9 +25,22 @@ let $MYSQLD_DATADIR= `select @@datadir`;
 
 copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLD_DATADIR/slave-relay-bin.000001;
 
-write_file $MYSQLD_DATADIR/slave-relay-bin.index;
-slave-relay-bin.000001
-EOF
+
+# After patch for BUG#12190, the filename used in CHANGE MASTER
+# RELAY_LOG_FILE will be automatically added the directory of the
+# relay log before comparison, thus we need to added the directory
+# part (./ on unix .\ on windows) when faking the relay-log-bin.index.
+disable_query_log;
+if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`)
+{
+  eval select './slave-relay-bin.000001\n' into dumpfile '$MYSQLD_DATADIR/slave-relay-bin.index';
+}
+
+if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") != 0`)
+{
+  eval select '.\\\\slave-relay-bin.000001\n' into dumpfile '$MYSQLD_DATADIR/slave-relay-bin.index';
+}
+enable_query_log;
 
 change master to
   MASTER_HOST='dummy.localdomain',

=== added file 'mysql-test/suite/binlog/t/binlog_max_extension.test'
--- a/mysql-test/suite/binlog/t/binlog_max_extension.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_max_extension.test	2009-04-24 12:55:11 +0000
@@ -0,0 +1,72 @@
+#  BUG#40611: MySQL cannot make a binary log after sequential number beyond 
+#             unsigned long.
+# 
+#  Problem statement
+#  =================
+#
+#    Extension for log file names might be created with negative 
+#    numbers (when counter used would wrap around), causing server 
+#    failure when incrementing -00001 (reaching number 000000 
+#    extension).
+#
+#  Test
+#  ====
+#    This tests aims at testing the a patch that removes negatives 
+#    numbers from log name extensions and checks that the server 
+#    reports gracefully that the limit has been reached.
+#
+#    It instruments index file to point to a log file close to
+#    the new maximum and calls flush logs to get warning.
+#
+
+source include/have_log_bin.inc;
+RESET MASTER;
+
+let $MYSQLTEST_DATADIR= `select @@datadir`;
+
+let DATADIR= $MYSQLTEST_DATADIR;
+
+###############################################
+# check hitting maximum file name extension:
+###############################################
+
+# Stop master server
+--echo **** Stop master server ****
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait
+EOF
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+perl;
+
+my $index_file= $ENV{'DATADIR'} . "/master-bin.index";
+my $bin_file= $ENV{'DATADIR'} . "/master-bin.000001";
+my $bin_long_file= $ENV{'DATADIR'} . "/master-bin.2147483646";
+
+print("INDEX: $index_file\n");
+print("BINLOG: $bin_file\n");
+print("RENAMED BINLOG: $bin_long_file\n");
+
+use File::Copy;
+copy($bin_file, $bin_long_file) or die "File cannot be copied.";
+
+open (F, ">>$index_file");
+print F "./master-bin.2147483646\n";
+close F;
+print("WROTE into index file last entry: ./master-bin.2147483646\n");
+
+EOF
+
+--echo **** ReStart master server ****
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+# should throw warning
+FLUSH LOGS;
+
+RESET MASTER;

=== modified file 'mysql-test/suite/binlog/t/disabled.def'
--- a/mysql-test/suite/binlog/t/disabled.def	2009-02-18 10:23:38 +0000
+++ b/mysql-test/suite/binlog/t/disabled.def	2009-05-11 10:22:35 +0000
@@ -13,3 +13,4 @@ binlog_truncate_innodb	: BUG#42643 2009-
 
 binlog_multi_engine     : Bug#30544 istruewing 2007-11-26
 binlog_row_ctype_cp932  : Bug#33376 2007-12-19 mats Write set for table not set correctly when inserting an empty set
+binlog_max_extension    : BUG#44779 2009-05-11 lsoares binlog_max_extension may be causing failure on next test in PB in windows x86 max-nt

=== modified file 'mysql-test/suite/funcs_1/datadict/is_routines.inc'
--- a/mysql-test/suite/funcs_1/datadict/is_routines.inc	2009-02-13 16:30:54 +0000
+++ b/mysql-test/suite/funcs_1/datadict/is_routines.inc	2009-04-01 09:11:21 +0000
@@ -97,10 +97,11 @@ CREATE FUNCTION function_for_routines() 
 SELECT specific_name,routine_catalog,routine_schema,routine_name,routine_type,
        routine_body,external_name,external_language,parameter_style,sql_path
 FROM information_schema.routines
-WHERE routine_catalog   IS NOT NULL OR external_name   IS NOT NULL
+WHERE routine_schema = 'test' AND
+   (routine_catalog   IS NOT NULL OR external_name   IS NOT NULL
    OR external_language IS NOT NULL OR sql_path        IS NOT NULL
    OR routine_body      <> 'SQL'    OR parameter_style <> 'SQL'
-   OR specific_name     <> routine_name;
+   OR specific_name     <> routine_name);
 
 DROP PROCEDURE sp_for_routines;
 DROP FUNCTION  function_for_routines;

=== modified file 'mysql-test/suite/funcs_1/r/is_routines.result'
--- a/mysql-test/suite/funcs_1/r/is_routines.result	2009-02-16 14:47:53 +0000
+++ b/mysql-test/suite/funcs_1/r/is_routines.result	2009-04-01 09:37:16 +0000
@@ -132,14 +132,12 @@ CREATE FUNCTION function_for_routines() 
 SELECT specific_name,routine_catalog,routine_schema,routine_name,routine_type,
 routine_body,external_name,external_language,parameter_style,sql_path
 FROM information_schema.routines
-WHERE routine_catalog   IS NOT NULL OR external_name   IS NOT NULL
+WHERE routine_schema = 'test' AND
+(routine_catalog   IS NOT NULL OR external_name   IS NOT NULL
 OR external_language IS NOT NULL OR sql_path        IS NOT NULL
 OR routine_body      <> 'SQL'    OR parameter_style <> 'SQL'
-   OR specific_name     <> routine_name;
+   OR specific_name     <> routine_name);
 specific_name	routine_catalog	routine_schema	routine_name	routine_type	routine_body	external_name	external_language	parameter_style	sql_path
-add_suppression	def	mtr	add_suppression	PROCEDURE	SQL	NULL	NULL	SQL	NULL
-check_testcase	def	mtr	check_testcase	PROCEDURE	SQL	NULL	NULL	SQL	NULL
-check_warnings	def	mtr	check_warnings	PROCEDURE	SQL	NULL	NULL	SQL	NULL
 function_for_routines	def	test	function_for_routines	FUNCTION	SQL	NULL	NULL	SQL	NULL
 sp_for_routines	def	test	sp_for_routines	PROCEDURE	SQL	NULL	NULL	SQL	NULL
 DROP PROCEDURE sp_for_routines;

=== added file 'mysql-test/suite/rpl/include/rpl_not_null.inc'
--- a/mysql-test/suite/rpl/include/rpl_not_null.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/include/rpl_not_null.inc	2009-04-23 23:54:59 +0000
@@ -0,0 +1,364 @@
+#################################################################################
+# This test checks if the replication between "null" fields to either "null"
+# fields or "not null" fields works properly. In the first case, the execution
+# should work fine. In the second case, it may fail according to the sql_mode
+# being used.
+#
+# The test is devided in three main parts:
+#
+# 1 - NULL --> NULL (no failures)
+# 2 - NULL --> NOT NULL ( sql-mode  = STRICT and failures)
+# 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures)
+#
+#################################################################################
+connection master;
+
+SET SQL_LOG_BIN= 0;
+eval CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
+`c` INT DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+
+eval CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+
+eval CREATE TABLE t3(`a` INT, `b` DATE DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+
+eval CREATE TABLE t4(`a` INT, `b` DATE DEFAULT NULL,
+`c` INT DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+SET SQL_LOG_BIN= 1;
+
+connection slave;
+
+eval CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
+`c` INT DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+
+eval CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+
+eval CREATE TABLE t3(`a` INT, `b` DATE DEFAULT '0000-00-00',
+`c` INT DEFAULT 500, 
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+
+eval CREATE TABLE t4(`a` INT, `b` DATE DEFAULT '0000-00-00',
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+
+--echo ************* EXECUTION WITH INSERTS *************
+connection master;
+INSERT INTO t1(a,b,c) VALUES (1, null, 1);
+INSERT INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
+INSERT INTO t1(a,b) VALUES (3, null);
+INSERT INTO t1(a,c) VALUES (4, 4);
+INSERT INTO t1(a) VALUES (5);
+
+INSERT INTO t2(a,b) VALUES (1, null);
+INSERT INTO t2(a,b) VALUES (2,'1111-11-11');
+INSERT INTO t2(a) VALUES (3);
+
+INSERT INTO t3(a,b) VALUES (1, null);
+INSERT INTO t3(a,b) VALUES (2,'1111-11-11');
+INSERT INTO t3(a) VALUES (3);
+
+INSERT INTO t4(a,b,c) VALUES (1, null, 1);
+INSERT INTO t4(a,b,c) VALUES (2,'1111-11-11', 2);
+INSERT INTO t4(a,b) VALUES (3, null);
+INSERT INTO t4(a,c) VALUES (4, 4);
+INSERT INTO t4(a) VALUES (5);
+
+--echo ************* SHOWING THE RESULT SETS WITH INSERTS *************
+sync_slave_with_master;
+
+--echo TABLES t1 and t2 must be equal otherwise an error will be thrown. 
+let $diff_table_1=master:test.t1;
+let $diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+ 
+let $diff_table_1=master:test.t2;
+let $diff_table_2=slave:test.t2;
+source include/diff_tables.inc;
+
+--echo TABLES t2 and t3 must be different.
+connection master;
+SELECT * FROM t3;
+connection slave;
+SELECT * FROM t3;
+connection master;
+SELECT * FROM t4;
+connection slave;
+SELECT * FROM t4;
+
+--echo ************* EXECUTION WITH UPDATES and REPLACES *************
+connection master;
+DELETE FROM t1;
+INSERT INTO t1(a,b,c) VALUES (1,'1111-11-11', 1);
+REPLACE INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
+UPDATE t1 set b= NULL, c= 300 where a= 1;
+REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300);
+
+--echo ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
+sync_slave_with_master;
+
+--echo TABLES t1 and t2 must be equal otherwise an error will be thrown. 
+let $diff_table_1=master:test.t1;
+let $diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+
+--echo ************* CLEANING *************
+connection master;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+
+sync_slave_with_master;
+  
+connection master;
+
+SET SQL_LOG_BIN= 0;
+eval CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT NULL, `c` BIT DEFAULT NULL, 
+PRIMARY KEY (`a`)) ENGINE= $engine;
+SET SQL_LOG_BIN= 1;
+
+connection slave;
+
+eval CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT b'01', `c` BIT DEFAULT NULL,
+PRIMARY KEY (`a`)) ENGINE= $engine;
+
+--echo ************* EXECUTION WITH INSERTS *************
+connection master;
+INSERT INTO t1(a,b,c) VALUES (1, null, b'01');
+INSERT INTO t1(a,b,c) VALUES (2,b'00', b'01');
+INSERT INTO t1(a,b) VALUES (3, null);
+INSERT INTO t1(a,c) VALUES (4, b'01');
+INSERT INTO t1(a) VALUES (5);
+
+--echo ************* SHOWING THE RESULT SETS WITH INSERTS *************
+--echo TABLES t1 and t2 must be different.
+sync_slave_with_master;
+connection master;
+SELECT a,b+0,c+0 FROM t1;
+connection slave;
+SELECT a,b+0,c+0 FROM t1;
+
+--echo ************* EXECUTION WITH UPDATES AND REPLACES *************
+connection master;
+DELETE FROM t1;
+INSERT INTO t1(a,b,c) VALUES (1,b'00', b'01');
+REPLACE INTO t1(a,b,c) VALUES (2,b'00',b'01');
+UPDATE t1 set b= NULL, c= b'00' where a= 1;
+REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00');
+
+--echo ************* SHOWING THE RESULT SETS WITH UPDATES AND REPLACES *************
+--echo TABLES t1 and t2 must be equal otherwise an error will be thrown. 
+sync_slave_with_master;
+let $diff_table_1=master:test.t1;
+let $diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+ 
+connection master;
+
+DROP TABLE t1;
+
+sync_slave_with_master;
+  
+--echo ################################################################################
+--echo #                       NULL ---> NOT NULL (STRICT MODE)
+--echo #                    UNCOMMENT THIS AFTER FIXING BUG#43992
+--echo ################################################################################
+#connection slave;
+#SET GLOBAL sql_mode="TRADITIONAL";
+#
+#STOP SLAVE;
+#--source include/wait_for_slave_to_stop.inc
+#START SLAVE;
+#--source include/wait_for_slave_to_start.inc
+#
+#let $y=0;
+#while (`select $y < 6`)
+#{
+#  connection master;
+#
+#  SET SQL_LOG_BIN= 0;
+#  eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT,
+#  PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+#  eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT,
+#  PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+#  eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT,
+#  PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+#  SET SQL_LOG_BIN= 1;
+#  
+#  connection slave;
+#  
+#  eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL, 
+#  `c` INT NOT NULL,
+#  PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+#  eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL,
+#  `c` INT, 
+#  PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+#  eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL,
+#  `c` INT DEFAULT 500, 
+#  PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+#  
+#  if (`select $y=0`)
+#  {
+#    --echo ************* EXECUTION WITH INSERTS *************
+#    connection master;
+#    INSERT INTO t1(a) VALUES (1);
+#  }
+#  
+#  if (`select $y=1`)
+#  {
+#    --echo ************* EXECUTION WITH INSERTS *************
+#    connection master;
+#    INSERT INTO t1(a, b) VALUES (1, NULL);
+#  }
+#  
+#  if (`select $y=2`)
+#  {
+#    --echo ************* EXECUTION WITH UPDATES *************
+#    connection master;
+#    INSERT INTO t3(a, b) VALUES (1, 1);
+#    INSERT INTO t3(a, b) VALUES (2, 1);
+#    UPDATE t3 SET b = NULL where a= 1;
+#  }
+#  
+#  if (`select $y=3`)
+#  {
+#    --echo ************* EXECUTION WITH INSERTS/REPLACES *************
+#    connection master;
+#    REPLACE INTO t3(a, b) VALUES (1, null);
+#  }
+#   
+#  if (`select $y=4`)
+#  {
+#    --echo ************* EXECUTION WITH UPDATES/REPLACES *************
+#    connection master;
+#    INSERT INTO t3(a, b) VALUES (1, 1);
+#    REPLACE INTO t3(a, b) VALUES (1, null);
+#  }
+#   
+#  if (`select $y=5`)
+#  {
+#    --echo ************* EXECUTION WITH MULTI-ROW INSERTS *************
+#    connection master;
+#
+#    SET SQL_LOG_BIN= 0;
+#    INSERT INTO t2(a, b) VALUES (1, 1);
+#    INSERT INTO t2(a, b) VALUES (2, 1);
+#    INSERT INTO t2(a, b) VALUES (3, null);
+#    INSERT INTO t2(a, b) VALUES (4, 1);
+#    INSERT INTO t2(a, b) VALUES (5, 1);
+#    SET SQL_LOG_BIN= 1;
+#
+#    INSERT INTO t2 SELECT a + 10, b from t2;
+#    --echo The statement below is just executed to stop processing
+#    INSERT INTO t1(a) VALUES (1);
+#  }
+#  
+#  --echo ************* SHOWING THE RESULT SETS *************
+#  connection slave;
+#  --source include/wait_for_slave_sql_to_stop.inc
+#  connection master;
+#  SELECT * FROM t1;
+#  connection slave;
+#  SELECT * FROM t1;
+#  connection master;
+#  SELECT * FROM t2;
+#  connection slave;
+#  SELECT * FROM t2;
+#  connection master;
+#  SELECT * FROM t3;
+#  connection slave;
+#  SELECT * FROM t3;
+#  --source include/reset_master_and_slave.inc
+#  
+#  connection master;
+#  
+#  DROP TABLE t1;
+#  DROP TABLE t2;
+#  DROP TABLE t3;
+#  
+#  sync_slave_with_master;
+#
+#  inc $y;
+#}
+#connection slave;
+#SET GLOBAL sql_mode="";
+#
+#STOP SLAVE;
+#source include/wait_for_slave_to_stop.inc;
+#START SLAVE;
+#--source include/wait_for_slave_to_start.inc
+
+--echo ################################################################################
+--echo #                       NULL ---> NOT NULL (NON-STRICT MODE)
+--echo ################################################################################
+connection master;
+
+SET SQL_LOG_BIN= 0;
+eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT,
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT,
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT,
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+SET SQL_LOG_BIN= 1;
+
+connection slave;
+
+eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL, 
+`c` INT NOT NULL,
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL,
+`c` INT, 
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL,
+`c` INT DEFAULT 500, 
+PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
+
+--echo ************* EXECUTION WITH INSERTS *************
+connection master;
+INSERT INTO t1(a) VALUES (1);
+INSERT INTO t1(a, b) VALUES (2, NULL);
+INSERT INTO t1(a, b) VALUES (3, 1);
+
+INSERT INTO t2(a) VALUES (1);
+INSERT INTO t2(a, b) VALUES (2, NULL);
+INSERT INTO t2(a, b) VALUES (3, 1);
+
+INSERT INTO t3(a) VALUES (1);
+INSERT INTO t3(a, b) VALUES (2, NULL);
+INSERT INTO t3(a, b) VALUES (3, 1);
+INSERT INTO t3(a, b) VALUES (4, 1);
+REPLACE INTO t3(a, b) VALUES (5, null);
+
+REPLACE INTO t3(a, b) VALUES (3, null);
+UPDATE t3 SET b = NULL where a = 4;
+
+--echo ************* SHOWING THE RESULT SETS *************
+connection master;
+sync_slave_with_master;
+
+connection master;
+SELECT * FROM t1;
+connection slave;
+SELECT * FROM t1;
+connection master;
+SELECT * FROM t2;
+connection slave;
+SELECT * FROM t2;
+connection master;
+SELECT * FROM t3;
+connection slave;
+SELECT * FROM t3;
+
+connection master;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+sync_slave_with_master;

=== added file 'mysql-test/suite/rpl/r/rpl_bug41902.result'
--- a/mysql-test/suite/rpl/r/rpl_bug41902.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_bug41902.result	2009-04-20 12:16:34 +0000
@@ -0,0 +1,34 @@
+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;
+stop slave;
+SET @@debug="d,simulate_find_log_pos_error";
+reset slave;
+ERROR HY000: Target log not found in binlog index
+show warnings;
+Level	Code	Message
+Error	1373	Target log not found in binlog index
+Error	1371	Failed purging old relay logs: Failed during log reset
+SET @@debug="";
+reset slave;
+change master to master_host='dummy';
+SET @@debug="d,simulate_find_log_pos_error";
+change master to master_host='dummy';
+ERROR HY000: Target log not found in binlog index
+SET @@debug="";
+reset slave;
+change master to master_host='dummy';
+SET @@debug="d,simulate_find_log_pos_error";
+reset master;
+ERROR HY000: Target log not found in binlog index
+SET @@debug="";
+reset master;
+SET @@debug="d,simulate_find_log_pos_error";
+purge binary logs to 'master-bin.000001';
+ERROR HY000: Target log not found in binlog index
+SET @@debug="";
+purge binary logs to 'master-bin.000001';
+End of the tests

=== modified file 'mysql-test/suite/rpl/r/rpl_change_master.result'
--- a/mysql-test/suite/rpl/r/rpl_change_master.result	2008-07-17 19:11:37 +0000
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result	2009-04-21 09:40:24 +0000
@@ -100,3 +100,20 @@ n
 1
 2
 drop table t1;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int);
+insert into t1 values (1);
+flush logs;
+insert into t1 values (2);
+include/stop_slave.inc
+delete from t1 where a=2;
+CHANGE MASTER TO relay_log_file='slave-relay-bin.000005', relay_log_pos=4;
+start slave sql_thread;
+start slave io_thread;
+set global relay_log_purge=1;
+drop table t1;

=== added file 'mysql-test/suite/rpl/r/rpl_not_null_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_not_null_innodb.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_not_null_innodb.result	2009-04-23 23:54:59 +0000
@@ -0,0 +1,202 @@
+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;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
+`c` INT DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+CREATE TABLE t3(`a` INT, `b` DATE DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+CREATE TABLE t4(`a` INT, `b` DATE DEFAULT NULL,
+`c` INT DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+SET SQL_LOG_BIN= 1;
+CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
+`c` INT DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+CREATE TABLE t3(`a` INT, `b` DATE DEFAULT '0000-00-00',
+`c` INT DEFAULT 500, 
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+CREATE TABLE t4(`a` INT, `b` DATE DEFAULT '0000-00-00',
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+************* EXECUTION WITH INSERTS *************
+INSERT INTO t1(a,b,c) VALUES (1, null, 1);
+INSERT INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
+INSERT INTO t1(a,b) VALUES (3, null);
+INSERT INTO t1(a,c) VALUES (4, 4);
+INSERT INTO t1(a) VALUES (5);
+INSERT INTO t2(a,b) VALUES (1, null);
+INSERT INTO t2(a,b) VALUES (2,'1111-11-11');
+INSERT INTO t2(a) VALUES (3);
+INSERT INTO t3(a,b) VALUES (1, null);
+INSERT INTO t3(a,b) VALUES (2,'1111-11-11');
+INSERT INTO t3(a) VALUES (3);
+INSERT INTO t4(a,b,c) VALUES (1, null, 1);
+INSERT INTO t4(a,b,c) VALUES (2,'1111-11-11', 2);
+INSERT INTO t4(a,b) VALUES (3, null);
+INSERT INTO t4(a,c) VALUES (4, 4);
+INSERT INTO t4(a) VALUES (5);
+************* SHOWING THE RESULT SETS WITH INSERTS *************
+TABLES t1 and t2 must be equal otherwise an error will be thrown. 
+Comparing tables master:test.t1 and slave:test.t1
+Comparing tables master:test.t2 and slave:test.t2
+TABLES t2 and t3 must be different.
+SELECT * FROM t3;
+a	b
+1	NULL
+2	1111-11-11
+3	NULL
+SELECT * FROM t3;
+a	b	c
+1	NULL	500
+2	1111-11-11	500
+3	0000-00-00	500
+SELECT * FROM t4;
+a	b	c
+1	NULL	1
+2	1111-11-11	2
+3	NULL	NULL
+4	NULL	4
+5	NULL	NULL
+SELECT * FROM t4;
+a	b
+1	NULL
+2	1111-11-11
+3	NULL
+4	0000-00-00
+5	0000-00-00
+************* EXECUTION WITH UPDATES and REPLACES *************
+DELETE FROM t1;
+INSERT INTO t1(a,b,c) VALUES (1,'1111-11-11', 1);
+REPLACE INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
+UPDATE t1 set b= NULL, c= 300 where a= 1;
+REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300);
+************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
+TABLES t1 and t2 must be equal otherwise an error will be thrown. 
+Comparing tables master:test.t1 and slave:test.t1
+************* CLEANING *************
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT NULL, `c` BIT DEFAULT NULL, 
+PRIMARY KEY (`a`)) ENGINE= Innodb;
+SET SQL_LOG_BIN= 1;
+CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT b'01', `c` BIT DEFAULT NULL,
+PRIMARY KEY (`a`)) ENGINE= Innodb;
+************* EXECUTION WITH INSERTS *************
+INSERT INTO t1(a,b,c) VALUES (1, null, b'01');
+INSERT INTO t1(a,b,c) VALUES (2,b'00', b'01');
+INSERT INTO t1(a,b) VALUES (3, null);
+INSERT INTO t1(a,c) VALUES (4, b'01');
+INSERT INTO t1(a) VALUES (5);
+************* SHOWING THE RESULT SETS WITH INSERTS *************
+TABLES t1 and t2 must be different.
+SELECT a,b+0,c+0 FROM t1;
+a	b+0	c+0
+1	NULL	1
+2	0	1
+3	NULL	NULL
+4	NULL	1
+5	NULL	NULL
+SELECT a,b+0,c+0 FROM t1;
+a	b+0	c+0
+1	NULL	1
+2	0	1
+3	NULL	NULL
+4	1	1
+5	1	NULL
+************* EXECUTION WITH UPDATES AND REPLACES *************
+DELETE FROM t1;
+INSERT INTO t1(a,b,c) VALUES (1,b'00', b'01');
+REPLACE INTO t1(a,b,c) VALUES (2,b'00',b'01');
+UPDATE t1 set b= NULL, c= b'00' where a= 1;
+REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00');
+************* SHOWING THE RESULT SETS WITH UPDATES AND REPLACES *************
+TABLES t1 and t2 must be equal otherwise an error will be thrown. 
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;
+################################################################################
+#                       NULL ---> NOT NULL (STRICT MODE)
+#                    UNCOMMENT THIS AFTER FIXING BUG#43992
+################################################################################
+################################################################################
+#                       NULL ---> NOT NULL (NON-STRICT MODE)
+################################################################################
+SET SQL_LOG_BIN= 0;
+CREATE TABLE t1(`a` INT NOT NULL, `b` INT,
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+CREATE TABLE t2(`a` INT NOT NULL, `b` INT,
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+CREATE TABLE t3(`a` INT NOT NULL, `b` INT,
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+SET SQL_LOG_BIN= 1;
+CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL, 
+`c` INT NOT NULL,
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL,
+`c` INT, 
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL,
+`c` INT DEFAULT 500, 
+PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
+************* EXECUTION WITH INSERTS *************
+INSERT INTO t1(a) VALUES (1);
+INSERT INTO t1(a, b) VALUES (2, NULL);
+INSERT INTO t1(a, b) VALUES (3, 1);
+INSERT INTO t2(a) VALUES (1);
+INSERT INTO t2(a, b) VALUES (2, NULL);
+INSERT INTO t2(a, b) VALUES (3, 1);
+INSERT INTO t3(a) VALUES (1);
+INSERT INTO t3(a, b) VALUES (2, NULL);
+INSERT INTO t3(a, b) VALUES (3, 1);
+INSERT INTO t3(a, b) VALUES (4, 1);
+REPLACE INTO t3(a, b) VALUES (5, null);
+REPLACE INTO t3(a, b) VALUES (3, null);
+UPDATE t3 SET b = NULL where a = 4;
+************* SHOWING THE RESULT SETS *************
+SELECT * FROM t1;
+a	b
+1	NULL
+2	NULL
+3	1
+SELECT * FROM t1;
+a	b	c
+1	0	0
+2	0	0
+3	1	0
+SELECT * FROM t2;
+a	b
+1	NULL
+2	NULL
+3	1
+SELECT * FROM t2;
+a	b	c
+1	0	NULL
+2	0	NULL
+3	1	NULL
+SELECT * FROM t3;
+a	b
+1	NULL
+2	NULL
+3	NULL
+4	NULL
+5	NULL
+SELECT * FROM t3;
+a	b	c
+1	0	500
+2	0	500
+3	0	500
+4	0	500
+5	0	500
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;

=== added file 'mysql-test/suite/rpl/r/rpl_not_null_myisam.result'
--- a/mysql-test/suite/rpl/r/rpl_not_null_myisam.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_not_null_myisam.result	2009-04-23 23:54:59 +0000
@@ -0,0 +1,202 @@
+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;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
+`c` INT DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+CREATE TABLE t3(`a` INT, `b` DATE DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+CREATE TABLE t4(`a` INT, `b` DATE DEFAULT NULL,
+`c` INT DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+SET SQL_LOG_BIN= 1;
+CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
+`c` INT DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+CREATE TABLE t3(`a` INT, `b` DATE DEFAULT '0000-00-00',
+`c` INT DEFAULT 500, 
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+CREATE TABLE t4(`a` INT, `b` DATE DEFAULT '0000-00-00',
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+************* EXECUTION WITH INSERTS *************
+INSERT INTO t1(a,b,c) VALUES (1, null, 1);
+INSERT INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
+INSERT INTO t1(a,b) VALUES (3, null);
+INSERT INTO t1(a,c) VALUES (4, 4);
+INSERT INTO t1(a) VALUES (5);
+INSERT INTO t2(a,b) VALUES (1, null);
+INSERT INTO t2(a,b) VALUES (2,'1111-11-11');
+INSERT INTO t2(a) VALUES (3);
+INSERT INTO t3(a,b) VALUES (1, null);
+INSERT INTO t3(a,b) VALUES (2,'1111-11-11');
+INSERT INTO t3(a) VALUES (3);
+INSERT INTO t4(a,b,c) VALUES (1, null, 1);
+INSERT INTO t4(a,b,c) VALUES (2,'1111-11-11', 2);
+INSERT INTO t4(a,b) VALUES (3, null);
+INSERT INTO t4(a,c) VALUES (4, 4);
+INSERT INTO t4(a) VALUES (5);
+************* SHOWING THE RESULT SETS WITH INSERTS *************
+TABLES t1 and t2 must be equal otherwise an error will be thrown. 
+Comparing tables master:test.t1 and slave:test.t1
+Comparing tables master:test.t2 and slave:test.t2
+TABLES t2 and t3 must be different.
+SELECT * FROM t3;
+a	b
+1	NULL
+2	1111-11-11
+3	NULL
+SELECT * FROM t3;
+a	b	c
+1	NULL	500
+2	1111-11-11	500
+3	0000-00-00	500
+SELECT * FROM t4;
+a	b	c
+1	NULL	1
+2	1111-11-11	2
+3	NULL	NULL
+4	NULL	4
+5	NULL	NULL
+SELECT * FROM t4;
+a	b
+1	NULL
+2	1111-11-11
+3	NULL
+4	0000-00-00
+5	0000-00-00
+************* EXECUTION WITH UPDATES and REPLACES *************
+DELETE FROM t1;
+INSERT INTO t1(a,b,c) VALUES (1,'1111-11-11', 1);
+REPLACE INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
+UPDATE t1 set b= NULL, c= 300 where a= 1;
+REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300);
+************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
+TABLES t1 and t2 must be equal otherwise an error will be thrown. 
+Comparing tables master:test.t1 and slave:test.t1
+************* CLEANING *************
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+SET SQL_LOG_BIN= 0;
+CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT NULL, `c` BIT DEFAULT NULL, 
+PRIMARY KEY (`a`)) ENGINE= MyISAM;
+SET SQL_LOG_BIN= 1;
+CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT b'01', `c` BIT DEFAULT NULL,
+PRIMARY KEY (`a`)) ENGINE= MyISAM;
+************* EXECUTION WITH INSERTS *************
+INSERT INTO t1(a,b,c) VALUES (1, null, b'01');
+INSERT INTO t1(a,b,c) VALUES (2,b'00', b'01');
+INSERT INTO t1(a,b) VALUES (3, null);
+INSERT INTO t1(a,c) VALUES (4, b'01');
+INSERT INTO t1(a) VALUES (5);
+************* SHOWING THE RESULT SETS WITH INSERTS *************
+TABLES t1 and t2 must be different.
+SELECT a,b+0,c+0 FROM t1;
+a	b+0	c+0
+1	NULL	1
+2	0	1
+3	NULL	NULL
+4	NULL	1
+5	NULL	NULL
+SELECT a,b+0,c+0 FROM t1;
+a	b+0	c+0
+1	NULL	1
+2	0	1
+3	NULL	NULL
+4	1	1
+5	1	NULL
+************* EXECUTION WITH UPDATES AND REPLACES *************
+DELETE FROM t1;
+INSERT INTO t1(a,b,c) VALUES (1,b'00', b'01');
+REPLACE INTO t1(a,b,c) VALUES (2,b'00',b'01');
+UPDATE t1 set b= NULL, c= b'00' where a= 1;
+REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00');
+************* SHOWING THE RESULT SETS WITH UPDATES AND REPLACES *************
+TABLES t1 and t2 must be equal otherwise an error will be thrown. 
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;
+################################################################################
+#                       NULL ---> NOT NULL (STRICT MODE)
+#                    UNCOMMENT THIS AFTER FIXING BUG#43992
+################################################################################
+################################################################################
+#                       NULL ---> NOT NULL (NON-STRICT MODE)
+################################################################################
+SET SQL_LOG_BIN= 0;
+CREATE TABLE t1(`a` INT NOT NULL, `b` INT,
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+CREATE TABLE t2(`a` INT NOT NULL, `b` INT,
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+CREATE TABLE t3(`a` INT NOT NULL, `b` INT,
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+SET SQL_LOG_BIN= 1;
+CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL, 
+`c` INT NOT NULL,
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL,
+`c` INT, 
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL,
+`c` INT DEFAULT 500, 
+PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
+************* EXECUTION WITH INSERTS *************
+INSERT INTO t1(a) VALUES (1);
+INSERT INTO t1(a, b) VALUES (2, NULL);
+INSERT INTO t1(a, b) VALUES (3, 1);
+INSERT INTO t2(a) VALUES (1);
+INSERT INTO t2(a, b) VALUES (2, NULL);
+INSERT INTO t2(a, b) VALUES (3, 1);
+INSERT INTO t3(a) VALUES (1);
+INSERT INTO t3(a, b) VALUES (2, NULL);
+INSERT INTO t3(a, b) VALUES (3, 1);
+INSERT INTO t3(a, b) VALUES (4, 1);
+REPLACE INTO t3(a, b) VALUES (5, null);
+REPLACE INTO t3(a, b) VALUES (3, null);
+UPDATE t3 SET b = NULL where a = 4;
+************* SHOWING THE RESULT SETS *************
+SELECT * FROM t1;
+a	b
+1	NULL
+2	NULL
+3	1
+SELECT * FROM t1;
+a	b	c
+1	0	0
+2	0	0
+3	1	0
+SELECT * FROM t2;
+a	b
+1	NULL
+2	NULL
+3	1
+SELECT * FROM t2;
+a	b	c
+1	0	NULL
+2	0	NULL
+3	1	NULL
+SELECT * FROM t3;
+a	b
+1	NULL
+2	NULL
+3	NULL
+4	NULL
+5	NULL
+SELECT * FROM t3;
+a	b	c
+1	0	500
+2	0	500
+3	0	500
+4	0	500
+5	0	500
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;

=== added file 'mysql-test/suite/rpl/r/rpl_row_record_find_falcon.result'
--- a/mysql-test/suite/rpl/r/rpl_row_record_find_falcon.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_record_find_falcon.result	2009-04-29 16:48:59 +0000
@@ -0,0 +1,828 @@
+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;
+#################################################################
+# CASE 2: Falcon - master, Falcon - slave
+#################################################################
+DROP TABLE IF EXISTS t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes (Falcon -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes (Falcon -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes (Falcon -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key (Falcon -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key (Falcon -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key (Falcon -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key (Falcon -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key (Falcon -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: One key (Falcon -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys (Falcon -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+#################################################################
+# CASE 3: Falcon - master, MyISAM - slave
+#################################################################
+DROP TABLE IF EXISTS t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes (Falcon -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes (Falcon -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes (Falcon -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key (Falcon -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key (Falcon -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key (Falcon -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key (Falcon -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key (Falcon -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: One key (Falcon -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys (Falcon -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= Falcon;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+#################################################################
+# CASE 4: MyISAM - master, Falcon - slave
+#################################################################
+DROP TABLE IF EXISTS t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes (MyISAM -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes (MyISAM -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes (MyISAM -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key (MyISAM -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key (MyISAM -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key (MyISAM -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key (MyISAM -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key (MyISAM -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: One key (MyISAM -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys (MyISAM -> Falcon)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= Falcon;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;

=== added file 'mysql-test/suite/rpl/r/rpl_row_record_find_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_row_record_find_innodb.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_record_find_innodb.result	2009-04-29 16:48:59 +0000
@@ -0,0 +1,828 @@
+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;
+#################################################################
+# CASE 5: InnoDB - master, MyISAM - slave
+#################################################################
+DROP TABLE IF EXISTS t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes (InnoDB -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes (InnoDB -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes (InnoDB -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key (InnoDB -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key (InnoDB -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key (InnoDB -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key (InnoDB -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key (InnoDB -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: One key (InnoDB -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys (InnoDB -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+#################################################################
+# CASE 6: InnoDB - master, InnoDB - slave
+#################################################################
+DROP TABLE IF EXISTS t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes (InnoDB -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes (InnoDB -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes (InnoDB -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key (InnoDB -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key (InnoDB -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key (InnoDB -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key (InnoDB -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key (InnoDB -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: One key (InnoDB -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys (InnoDB -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+#################################################################
+# CASE 7: MyISAM - master, InnoDB - slave
+#################################################################
+DROP TABLE IF EXISTS t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes (MyISAM -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes (MyISAM -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes (MyISAM -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key (MyISAM -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key (MyISAM -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key (MyISAM -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key (MyISAM -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key (MyISAM -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: One key (MyISAM -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys (MyISAM -> InnoDB)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;

=== added file 'mysql-test/suite/rpl/r/rpl_row_record_find_myisam.result'
--- a/mysql-test/suite/rpl/r/rpl_row_record_find_myisam.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_record_find_myisam.result	2009-04-29 16:48:59 +0000
@@ -0,0 +1,288 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 ( i1 int, c1 char(1), key ( i1 ));
+INSERT IGNORE INTO t1 VALUES (1, 'a');
+UPDATE t1 SET c1 = 'b' WHERE i1 = 1;
+DROP TABLE t1;
+CREATE TABLE table1_myisam ( `bit_key` bit, `int_key` int, key (`bit_key` ), key (`int_key` ));
+INSERT IGNORE INTO table1_myisam VALUES ('1', '-2146992385');
+UPDATE `table1_myisam` SET `bit_key` = 0 WHERE `bit_key` = 1;
+DROP TABLE table1_myisam;
+#################################################################
+# CASE 1: MyISAM - master, MyISAM - slave
+#################################################################
+DROP TABLE IF EXISTS t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes (MyISAM -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes (MyISAM -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes (MyISAM -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key (MyISAM -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key (MyISAM -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key (MyISAM -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key (MyISAM -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key (MyISAM -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: One key (MyISAM -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys (MyISAM -> MyISAM)
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+Comparing tables master:test.t and slave:test.t
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+Comparing tables master:test.t and slave:test.t
+DROP TABLE t;

=== modified file 'mysql-test/suite/rpl/t/disabled.def'
--- a/mysql-test/suite/rpl/t/disabled.def	2009-04-30 14:35:36 +0000
+++ b/mysql-test/suite/rpl/t/disabled.def	2009-05-12 08:58:44 +0000
@@ -10,12 +10,12 @@
 #
 ##############################################################################
 
-rpl_extraColmaster_innodb  : BUG#41097 2008-12-12 sven result files for rpl_extraColmaster_myisam, rpl_extraColmaster_innodb are gone
-rpl_extraColmaster_myisam  : BUG#41097 2008-12-12 sven result files for rpl_extraColmaster_myisam, rpl_extraColmaster_innodb are gone
+rpl_extraColmaster_innodb  : BUG#40796 2009-04-22 alfranio Crash due to heap corruption in rpl.rpl_extraColmaster_myisam
+rpl_extraColmaster_myisam  : BUG#40796 2009-04-22 alfranio Crash due to heap corruption in rpl.rpl_extraColmaster_myisam
 rpl_cross_version          : BUG#42311 2009-03-27 joro rpl_cross_version fails on macosx
 rpl_extraCol_falcon        : Bug#40930 2008-11-21 johnemb rpl.rpl_extraCol_falcon fails doing STOP SLAVE (on Windows PB2)
 rpl_cross_version          : Bug#42311 2009-01-23 aelkin
 rpl_heartbeat_basic        : Bug#43828 Sporadic failures (Serge.Kozlov@stripped)
-rpl_heartbeat_2slaves      : Bug#43828 Sporadic failrues (Serge.Kozlov@stripped)
+rpl_heartbeat_2slaves      : Bug#43828 Sporadic failures (Serge.Kozlov@stripped)
 rpl_failed_optimize        : WL#4284: Can't optimize table used by a pending transaction (there is metadata lock on the table).
 rpl_read_only              : WL#4284: Setting Read only won't succeed until all metadata locks are released.

=== added file 'mysql-test/suite/rpl/t/rpl_bug41902-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_bug41902-slave.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_bug41902-slave.opt	2009-04-20 12:16:34 +0000
@@ -0,0 +1 @@
+--loose-debug=-d,simulate_find_log_pos_error

=== added file 'mysql-test/suite/rpl/t/rpl_bug41902.test'
--- a/mysql-test/suite/rpl/t/rpl_bug41902.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_bug41902.test	2009-04-20 12:16:34 +0000
@@ -0,0 +1,53 @@
+# Test for Bug #41902 MYSQL_BIN_LOG::reset_logs() doesn't call my_error()
+#                     in face of an error
+#
+
+source include/have_debug.inc;
+source include/master-slave.inc;
+
+#
+# test checks that 
+# a. there is no crash when find_log_pos() returns with an error
+#    that tests expect to receive;
+# b. in the case of multiple error messages the first error message is 
+#    reported to the user and others are available as warnings.
+#
+
+connection slave;
+stop slave;
+
+SET @@debug="d,simulate_find_log_pos_error";
+
+--error ER_UNKNOWN_TARGET_BINLOG
+reset slave;
+show warnings;
+
+SET @@debug="";
+reset slave;
+change master to master_host='dummy';
+
+SET @@debug="d,simulate_find_log_pos_error";
+
+--error ER_UNKNOWN_TARGET_BINLOG
+change master to master_host='dummy';
+
+SET @@debug="";
+reset slave;
+change master to master_host='dummy';
+
+connection master;
+SET @@debug="d,simulate_find_log_pos_error";
+--error ER_UNKNOWN_TARGET_BINLOG
+reset master;
+
+SET @@debug="";
+reset master;
+
+SET @@debug="d,simulate_find_log_pos_error";
+--error ER_UNKNOWN_TARGET_BINLOG
+purge binary logs to 'master-bin.000001';
+
+SET @@debug="";
+purge binary logs to 'master-bin.000001';
+
+--echo End of the tests

=== modified file 'mysql-test/suite/rpl/t/rpl_change_master.test'
--- a/mysql-test/suite/rpl/t/rpl_change_master.test	2008-06-22 20:05:19 +0000
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test	2009-04-21 09:40:24 +0000
@@ -31,3 +31,56 @@ drop table t1;
 sync_slave_with_master;
 
 # End of 4.1 tests
+
+#
+# BUG#12190 CHANGE MASTER has differ path requiremts on MASTER_LOG_FILE and RELAY_LOG_FILE
+#
+
+source include/master-slave-reset.inc;
+
+connection master;
+create table t1 (a int);
+insert into t1 values (1);
+flush logs;
+insert into t1 values (2);
+
+# Note: the master positon saved by this will also be used by the
+# 'sync_with_master' below.
+sync_slave_with_master;
+
+# Check if the table t1 and t2 are identical on master and slave;
+let $diff_table_1= master:test.t1
+let $diff_table_2= slave:test.t1
+source include/diff_tables.inc;
+
+connection slave;
+source include/stop_slave.inc;
+delete from t1 where a=2;
+
+# start replication from the second insert, after fix of BUG#12190,
+# relay_log_file does not use absolute path, only the filename is
+# required
+#
+# Note: the follow change master will automatically reset
+# relay_log_purge to false, save the old value to restore
+let $relay_log_purge= `select @@global.relay_log_purge`;
+CHANGE MASTER TO relay_log_file='slave-relay-bin.000005', relay_log_pos=4;
+start slave sql_thread;
+source include/wait_for_slave_sql_to_start.inc;
+
+# Sync to the same position saved by the 'sync_slave_with_master' above.
+sync_with_master;
+
+# Check if the table t1 and t2 are identical on master and slave;
+let $diff_table_1= master:test.t1
+let $diff_table_2= slave:test.t1
+source include/diff_tables.inc;
+
+# clean up
+connection slave;
+start slave io_thread;
+source include/wait_for_slave_io_to_start.inc;
+eval set global relay_log_purge=$relay_log_purge;
+connection master;
+drop table t1;
+sync_slave_with_master;

=== added file 'mysql-test/suite/rpl/t/rpl_not_null_innodb.test'
--- a/mysql-test/suite/rpl/t/rpl_not_null_innodb.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_not_null_innodb.test	2009-04-23 23:54:59 +0000
@@ -0,0 +1,19 @@
+#################################################################################
+# This test checks if the replication between "null" fields to either "null"
+# fields or "not null" fields works properly. In the first case, the execution
+# should work fine. In the second case, it may fail according to the sql_mode
+# being used.
+#
+# The test is devided in three main parts:
+#
+# 1 - NULL --> NULL (no failures)
+# 2 - NULL --> NOT NULL ( sql-mode  = STRICT and failures)
+# 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures)
+#
+#################################################################################
+--source include/master-slave.inc
+--source include/have_innodb.inc
+--source include/have_binlog_format_row.inc
+
+let $engine=Innodb;
+--source suite/rpl/include/rpl_not_null.inc

=== added file 'mysql-test/suite/rpl/t/rpl_not_null_myisam.test'
--- a/mysql-test/suite/rpl/t/rpl_not_null_myisam.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_not_null_myisam.test	2009-04-23 23:54:59 +0000
@@ -0,0 +1,19 @@
+#################################################################################
+# This test checks if the replication between "null" fields to either "null"
+# fields or "not null" fields works properly. In the first case, the execution
+# should work fine. In the second case, it may fail according to the sql_mode
+# being used.
+#
+# The test is devided in three main parts:
+#
+# 1 - NULL --> NULL (no failures)
+# 2 - NULL --> NOT NULL ( sql-mode  = STRICT and failures)
+# 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures)
+#
+#################################################################################
+--source include/master-slave.inc
+--source include/have_myisam_or_maria_default.inc
+--source include/have_binlog_format_row.inc
+
+let $engine=MyISAM;
+--source suite/rpl/include/rpl_not_null.inc

=== added file 'mysql-test/suite/rpl/t/rpl_row_record_find_falcon.test'
--- a/mysql-test/suite/rpl/t/rpl_row_record_find_falcon.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_record_find_falcon.test	2009-04-29 16:48:59 +0000
@@ -0,0 +1,47 @@
+#
+# BUG#40045: Replication failure on RBR + no PK + UPDATE + integer key +
+#            char with no key
+#
+# BUG#40007: Replication failure with RBR + no PK + 2 indexed fields 
+#
+# Test Description
+# ================
+#  
+#   (see rpl_row_record_find_myisam.test)
+#
+
+source include/master-slave.inc;
+source include/have_binlog_format_row.inc;
+connection master;
+source include/have_falcon.inc;
+connection slave;
+source include/have_falcon.inc;
+connection master;
+
+--echo #################################################################
+--echo # CASE 2: Falcon - master, Falcon - slave
+--echo #################################################################
+
+let $master_engine= Falcon;
+let $slave_engine= Falcon;
+
+-- source extra/rpl_tests/rpl_row_record_find.test
+
+--echo #################################################################
+--echo # CASE 3: Falcon - master, MyISAM - slave
+--echo #################################################################
+
+let $master_engine= Falcon;
+let $slave_engine= MyISAM;
+
+-- source extra/rpl_tests/rpl_row_record_find.test
+
+--echo #################################################################
+--echo # CASE 4: MyISAM - master, Falcon - slave
+--echo #################################################################
+
+let $master_engine= MyISAM;
+let $slave_engine= Falcon;
+
+-- source extra/rpl_tests/rpl_row_record_find.test
+

=== added file 'mysql-test/suite/rpl/t/rpl_row_record_find_innodb.test'
--- a/mysql-test/suite/rpl/t/rpl_row_record_find_innodb.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_record_find_innodb.test	2009-04-29 16:48:59 +0000
@@ -0,0 +1,46 @@
+#
+# BUG#40045: Replication failure on RBR + no PK + UPDATE + integer key +
+#            char with no key
+#
+# BUG#40007: Replication failure with RBR + no PK + 2 indexed fields 
+#
+# Test Description
+# ================
+#  
+#   (see rpl_row_record_find_myisam.test)
+#
+
+source include/master-slave.inc;
+source include/have_binlog_format_row.inc;
+connection master;
+source include/have_innodb.inc;
+connection slave;
+source include/have_innodb.inc;
+connection master;
+
+--echo #################################################################
+--echo # CASE 5: InnoDB - master, MyISAM - slave
+--echo #################################################################
+
+let $master_engine= InnoDB;
+let $slave_engine= MyISAM;
+
+-- source extra/rpl_tests/rpl_row_record_find.test
+
+--echo #################################################################
+--echo # CASE 6: InnoDB - master, InnoDB - slave
+--echo #################################################################
+
+let $master_engine= InnoDB;
+let $slave_engine= InnoDB;
+
+-- source extra/rpl_tests/rpl_row_record_find.test
+
+--echo #################################################################
+--echo # CASE 7: MyISAM - master, InnoDB - slave
+--echo #################################################################
+
+let $master_engine= MyISAM;
+let $slave_engine= InnoDB;
+
+-- source extra/rpl_tests/rpl_row_record_find.test

=== added file 'mysql-test/suite/rpl/t/rpl_row_record_find_myisam.test'
--- a/mysql-test/suite/rpl/t/rpl_row_record_find_myisam.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_record_find_myisam.test	2009-04-29 16:48:59 +0000
@@ -0,0 +1,78 @@
+#
+# BUG#40045: Replication failure on RBR + no PK + UPDATE + integer key + char
+# with no key
+#
+# BUG#40007: Replication failure with RBR + no PK + 2 indexed fields 
+#
+# TEST DESCRIPTION
+# ================
+#
+#   This test is structure in seven cases. In all of them, roughly the same
+#   update and delete operations are performed, but what changes are the keys
+#   in the table: 
+#      no keys, one key, composite key (but only half is used in query),
+#      unique key, primary key
+#   
+#   The seven cases are distinct because the engine on both and master and
+#   slave varies:
+#      
+#      - On rpl_row_record_find_myisam.test (this) test file:
+#        CASE 1:  MyISAM - master, MyISAM - slave
+#           test without HA_PARTIAL_COLUMN_READ engine on master and on slave
+#
+#      - On rpl_row_record_find_falcon.test:
+#        CASE 2:  Falcon - master, Falcon - slave
+#           test with HA_PARTIAL_COLUMN_READ engine on master and on slave
+#        CASE 3:  Falcon - master, MyISAM - slave
+#           test with HA_PARTIAL_COLUMN_READ engine on master but not on slave
+#        CASE 4:  MyISAM - master, Falcon - slave
+#           test without HA_PARTIAL_COLUMN_READ engine on master but with it on slave
+#           (Falcon)
+#
+#      - On rpl_row_record_find_innodb.test:
+#        CASE 5:  InnoDB - master, MyISAM - slave
+#           test with HA_PARTIAL_COLUMN_READ engine on master but not on slave
+#           (InnoDB)
+#        CASE 6:  InnoDB - master, InnoDB - slave
+#           test with HA_PARTIAL_COLUMN_READ engine on master and on slave
+#           (InnoDB)
+#        CASE 7:  MyISAM - master, InnoDB - slave
+#           test without HA_PARTIAL_COLUMN_READ engine on master but with it on slave
+#           (InnoDB)
+#
+#   NOTE: In this file we also perform a sanity check by running the test
+#         cases to verify some of the BUGS.
+
+source include/master-slave.inc;
+source include/have_binlog_format_row.inc;
+connection master;
+
+### SANITY TESTS for BUG#40045 and BUG#40007
+
+# TEST CASE USED for verifying BUG#40045
+CREATE TABLE t1 ( i1 int, c1 char(1), key ( i1 ));
+INSERT IGNORE INTO t1 VALUES (1, 'a');
+UPDATE t1 SET c1 = 'b' WHERE i1 = 1;
+DROP TABLE t1;
+sync_slave_with_master;
+
+# TEST CASE USED for verifying BUG#40007
+connection master;
+CREATE TABLE table1_myisam ( `bit_key` bit, `int_key` int, key (`bit_key` ), key (`int_key` ));
+disable_warnings;
+INSERT IGNORE INTO table1_myisam VALUES ('1', '-2146992385');
+enable_warnings;
+UPDATE `table1_myisam` SET `bit_key` = 0 WHERE `bit_key` = 1;
+DROP TABLE table1_myisam;
+sync_slave_with_master;
+
+connection master;
+
+--echo #################################################################
+--echo # CASE 1: MyISAM - master, MyISAM - slave
+--echo #################################################################
+
+let $master_engine= MyISAM;
+let $slave_engine= MyISAM;
+
+-- source extra/rpl_tests/rpl_row_record_find.test

=== added file 'mysql-test/t/drop_debug.test'
--- a/mysql-test/t/drop_debug.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/drop_debug.test	2009-05-07 11:15:54 +0000
@@ -0,0 +1,38 @@
+# 
+# DROP-related tests which execution requires debug server.
+#
+--source include/have_debug.inc
+
+###########################################################################
+--echo
+--echo # --
+--echo # -- Bug#43138: DROP DATABASE failure does not clean up message list.
+--echo # --
+--echo
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysql_test;
+--enable_warnings
+
+--echo
+CREATE DATABASE mysql_test;
+CREATE TABLE mysql_test.t1(a INT);
+CREATE TABLE mysql_test.t2(b INT);
+CREATE TABLE mysql_test.t3(c INT);
+
+--echo
+SET SESSION DEBUG = "+d,bug43138";
+
+--echo
+--sorted_result
+DROP DATABASE mysql_test;
+
+--echo
+SET SESSION DEBUG = "-d,bug43138";
+
+--echo
+--echo # --
+--echo # -- End of Bug#43138.
+--echo # --
+
+###########################################################################

=== modified file 'mysql-test/t/init_file.test'
--- a/mysql-test/t/init_file.test	2009-02-01 09:18:09 +0000
+++ b/mysql-test/t/init_file.test	2009-04-02 11:00:44 +0000
@@ -14,7 +14,7 @@ SELECT * INTO @X FROM init_file.startup 
 SELECT * INTO @Y FROM init_file.startup limit 1,1;
 SELECT YEAR(@X)-YEAR(@Y);
 # Enable this DROP DATABASE only after resolving bug #42507
-# DROP DATABASE init_file;
+DROP DATABASE init_file;
 
 --echo ok
 --echo end of 4.1 tests
@@ -28,4 +28,9 @@ select * from t1;
 #   30, 3, 11, 13
 select * from t2;
 # Enable this DROP TABLE only after resolving bug #42507
-#drop table t1, t2;
+drop table t1, t2;
+
+# MTR will restart server anyway, but by forcing it we avoid being warned
+# about the apparent side effect
+
+call mtr.force_restart();

=== modified file 'mysql-test/t/log_state.test'
--- a/mysql-test/t/log_state.test	2009-01-26 16:32:29 +0000
+++ b/mysql-test/t/log_state.test	2009-04-01 18:00:07 +0000
@@ -1,16 +1,5 @@
 ### t/log_state.test ###
 #
-# This test suffers from server
-# Bug#38124 "general_log_file" variable silently unset when using expression
-# In short:
-#    SET GLOBAL general_log_file = @<whatever>
-#    SET GLOBAL slow_query_log = @<whatever>
-# cause that the value of these server system variables is set to default
-# instead of the assigned values. There comes no error message or warning.
-# If this bug is fixed please
-# 1. try this test with "let $fixed_bug38124 = 0;"
-# 2. remove all workarounds if 1. was successful.
-let $fixed_bug38124 = 0;
 
 --source include/not_embedded.inc
 --source include/have_csv.inc
@@ -166,16 +155,6 @@ SET @@global.general_log = @old_general_
 SET @@global.general_log_file = @old_general_log_file;
 SET @@global.slow_query_log = @old_slow_query_log;
 SET @@global.slow_query_log_file = @old_slow_query_log_file;
-if(!$fixed_bug38124)
-{
-   --disable_query_log
-   let $my_var = `SELECT @old_general_log_file`;
-   eval SET @@global.general_log_file = '$my_var';
-   let $my_var = `SELECT @old_slow_query_log_file`;
-   eval SET @@global.slow_query_log_file = '$my_var';
-   --enable_query_log
-}
-
 
 ###########################################################################
 
@@ -278,15 +257,6 @@ SET GLOBAL slow_query_log_file= NULL;
 # Reset to initial values in case a setting above was successful.
 SET GLOBAL general_log_file= @old_general_log_file;
 SET GLOBAL slow_query_log_file= @old_slow_query_log_file;
-if(!$fixed_bug38124)
-{
-   --disable_query_log
-   let $my_var = `SELECT @old_general_log_file`;
-   eval SET @@global.general_log_file = '$my_var';
-   let $my_var = `SELECT @old_slow_query_log_file`;
-   eval SET @@global.slow_query_log_file = '$my_var';
-   --enable_query_log
-}
 
 ###########################################################################
 
@@ -308,15 +278,6 @@ show variables like 'slow_query_log_file
 --echo
 SET GLOBAL general_log_file = @old_general_log_file;
 SET GLOBAL slow_query_log_file = @old_slow_query_log_file;
-if(!$fixed_bug38124)
-{
-   --disable_query_log
-   let $my_var = `SELECT @old_general_log_file`;
-   eval SET @@global.general_log_file = '$my_var';
-   let $my_var = `SELECT @old_slow_query_log_file`;
-   eval SET @@global.slow_query_log_file = '$my_var';
-   --enable_query_log
-}
 
 --echo
 --echo # -- End of Bug#32748.
@@ -352,19 +313,43 @@ SET @@global.general_log = @old_general_
 SET @@global.general_log_file = @old_general_log_file;
 SET @@global.slow_query_log = @old_slow_query_log;
 SET @@global.slow_query_log_file = @old_slow_query_log_file;
-if(!$fixed_bug38124)
-{
-   --disable_query_log
-   let $my_var = `SELECT @old_general_log_file`;
-   eval SET @@global.general_log_file = '$my_var';
-   let $my_var = `SELECT @old_slow_query_log_file`;
-   eval SET @@global.slow_query_log_file = '$my_var';
-   --enable_query_log
-}
-
 
 --echo End of 5.1 tests
 
+
+###########################################################################
+
+--echo
+--echo # --
+--echo # -- Bug#38124: "general_log_file" variable silently unset when
+--echo # --             using expression
+--echo # --
+
+# Store away the special DEFAULT value so we
+# can compare it later, then try to set the
+# general_log_file using different functions
+# and expressions.
+
+SET GLOBAL general_log_file = DEFAULT;
+SELECT @@general_log_file INTO @my_glf;
+
+SET GLOBAL general_log_file = 'BUG38124.LOG';
+SELECT @@general_log_file;
+
+SET GLOBAL general_log_file = concat('BUG38124-2.LOG');
+SELECT @@general_log_file;
+
+SET GLOBAL general_log_file = substr('BUG38124-2.LOG',3,6);
+SELECT @@general_log_file;
+
+SET GLOBAL general_log_file = DEFAULT;
+SELECT @@general_log_file = @my_glf;
+
+
+## Reset to initial values
+SET GLOBAL general_log_file = @old_general_log_file;
+
+
 --enable_ps_protocol
 
 #
@@ -381,17 +366,7 @@ SET global general_log = @old_general_lo
 SET global general_log_file = @old_general_log_file;
 SET global slow_query_log = @old_slow_query_log;
 SET global slow_query_log_file = @old_slow_query_log_file;
-if(!$fixed_bug38124)
-{
-   --disable_query_log
-   let $my_var = `SELECT @old_general_log_file`;
-   eval SET @@global.general_log_file = '$my_var';
-   let $my_var = `SELECT @old_slow_query_log_file`;
-   eval SET @@global.slow_query_log_file = '$my_var';
-   --enable_query_log
-}
 
-# Remove the log files that was created in the "default location"
+# Remove the log file that was created in the "default location"
 # i.e var/run
---remove_file $MYSQLTEST_VARDIR/run/mysqld.log
 --remove_file $MYSQLTEST_VARDIR/tmp/log.master

=== added file 'mysql-test/t/log_state_bug33693-master.opt'
--- a/mysql-test/t/log_state_bug33693-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/log_state_bug33693-master.opt	2009-04-01 18:00:07 +0000
@@ -0,0 +1 @@
+--pid-file=$MYSQLTEST_VARDIR/run/mysqld.1.pid --log=

=== added file 'mysql-test/t/log_state_bug33693.test'
--- a/mysql-test/t/log_state_bug33693.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/log_state_bug33693.test	2009-04-01 18:00:07 +0000
@@ -0,0 +1,18 @@
+### t/log_state_bug33693.test
+#
+# Regression test for bug #33693
+#   "general log name and location depend on PID 
+#    file, not on predefined values"
+#
+# The server is started with a hard-coded 
+# PID file in the $MYSQLTEST_VARDIR/run
+# directory, and an unspecified general log
+# file name.
+#
+# The correct result should show the log file to 
+# rest in the database directory. Unfixed, the 
+# log file will be in the same directory as the
+# PID.
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT INSTR(@@general_log_file, '$MYSQLTEST_VARDIR/run');

=== modified file 'mysql-test/t/lowercase_table2.test'
--- a/mysql-test/t/lowercase_table2.test	2006-06-06 06:25:31 +0000
+++ b/mysql-test/t/lowercase_table2.test	2009-05-15 08:00:35 +0000
@@ -150,3 +150,76 @@ select TABLE_SCHEMA,TABLE_NAME FROM info
 where TABLE_SCHEMA ='mysqltest_LC2';
 use test;
 drop database mysqltest_LC2;
+
+--echo # End of 5.1 tests
+
+--echo #
+--echo # Test for bug #44738 "fill_schema_table_from_frm() opens tables without
+--echo # lowercasing table name". Due to not properly normalizing table names
+--echo # in lower_case_table_names modes in this function queries to I_S which
+--echo # were executed through it left entries with incorrect key in table
+--echo # definition cache. This issue combined with a similar problem in
+--echo # CREATE TABLE (it also has peeked into table definition cache using
+--echo # non-normalized key) led to spurious ER_TABLE_EXISTS_ERROR errors
+--echo # when one tried to create table with the same name as a previously
+--echo # existing but dropped table.
+--echo #
+--disable_warnings
+drop database if exists mysqltest_UPPERCASE;
+drop table if exists t_bug44738_UPPERCASE;
+--enable_warnings
+create database mysqltest_UPPERCASE;
+use mysqltest_UPPERCASE;
+create table t_bug44738_UPPERCASE (i int);
+--echo # Ensure that we don't have any leftovers in table definition
+--echo # cache from previous tests.
+flush tables;
+--echo # There should be no entries for our table in table definition cache
+show open tables like 't_bug44738_%';
+select table_schema, table_name, table_comment from information_schema.tables
+  where table_schema like 'mysqltest_%' and table_name like 't_bug44738_%';
+--echo # Due to --lower-case-table-names > 0 mode database and table name for
+--echo # TDC entry for our table should be 'normalized' (i.e. lowercased).
+show open tables like 't_bug44738_%';
+drop table t_bug44738_UPPERCASE;
+--echo # After DROP TABLE this entry should be removed.
+show open tables like 't_bug44738_%';
+drop database mysqltest_UPPERCASE;
+use test;
+
+--echo # Let us check that the original test case which led to discovery
+--echo # of this problem also works.
+create table t_bug44738_UPPERCASE (i int);
+select table_schema, table_name, table_comment from information_schema.tables
+  where table_schema = 'test' and table_name like 't_bug44738_%';
+drop table t_bug44738_UPPERCASE;
+--echo # Check that after the above DROP TABLE there are no entries in TDC
+--echo # which correspond to our table.
+show open tables like 't_bug44738_%';
+--echo # Therefore the below statement should succeed.
+create table t_bug44738_UPPERCASE (i int);
+drop table t_bug44738_UPPERCASE;
+
+--echo # Finally, let us check that another issue which was exposed by
+--echo # the original test case is solved. I.e. that fuse in CREATE TABLE
+--echo # which ensures that table is not created if there is an entry for
+--echo # it in TDC even though it was removed from disk uses normalized
+--echo # version of the table name.
+create table t_bug44738_UPPERCASE (i int) engine = myisam;
+--echo # Load table definition in TDC.
+select table_schema, table_name, table_comment from information_schema.tables
+  where table_schema = 'test' and table_name like 't_bug44738_%';
+--echo # Simulate manual removal of the table.
+let $MYSQLD_DATADIR= `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.frm
+--remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.MYD
+--remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.MYI
+--echo # Check that still there is an entry for table in TDC.
+show open tables like 't_bug44738_%';
+--echo # So attempt to create table with the same name should fail.
+--error ER_TABLE_EXISTS_ERROR
+create table t_bug44738_UPPERCASE (i int);
+--echo # And should succeed after FLUSH TABLES.
+flush tables;
+create table t_bug44738_UPPERCASE (i int);
+drop table t_bug44738_UPPERCASE;

=== modified file 'mysql-test/t/myisam-system.test'
--- a/mysql-test/t/myisam-system.test	2007-12-12 17:19:24 +0000
+++ b/mysql-test/t/myisam-system.test	2009-04-30 15:31:30 +0000
@@ -12,11 +12,11 @@ let $MYSQLD_DATADIR= `select @@datadir`;
 drop table if exists t1;
 create table t1 (a int) engine=myisam;
 --remove_file $MYSQLD_DATADIR/test/t1.MYI
---error 1051,6
+--error ER_BAD_TABLE_ERROR,6
 drop table t1;
 create table t1 (a int) engine=myisam;
 --remove_file $MYSQLD_DATADIR/test/t1.MYD
---error 1105,6,29
+--error ER_BAD_TABLE_ERROR,6,29
 drop table t1;
---error 1051
+--error ER_BAD_TABLE_ERROR
 drop table t1;

=== modified file 'mysql-test/t/mysqlbinlog.test'
--- a/mysql-test/t/mysqlbinlog.test	2009-03-06 20:33:52 +0000
+++ b/mysql-test/t/mysqlbinlog.test	2009-04-21 09:28:48 +0000
@@ -368,3 +368,27 @@ eval SET @@global.server_id= $save_serve
 --remove_file $binlog_file
 
 --echo End of 5.1 tests
+
+#
+# BUG#38468 Memory leak detected when using mysqlbinlog utility;
+#
+disable_query_log;
+RESET MASTER;
+CREATE TABLE t1 SELECT 1;
+FLUSH LOGS;
+DROP TABLE t1;
+enable_query_log;
+
+# Write an empty file for comparison
+write_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
+EOF
+
+# Before fix of BUG#38468, this would generate some warnings
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 >/dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
+
+# Make sure the command above does not generate any error or warnings
+diff_files $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
+
+# Cleanup for this part of test
+remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
+remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn;

=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test	2009-03-06 20:33:52 +0000
+++ b/mysql-test/t/mysqltest.test	2009-04-01 08:16:35 +0000
@@ -1780,6 +1780,56 @@ remove_file $MYSQLTEST_VARDIR/tmp/file2.
 --error 1
 --exec echo "copy_file from_file;" | $MYSQL_TEST 2>&1
 
+
+# ----------------------------------------------------------------------------
+# test for move_file
+# ----------------------------------------------------------------------------
+
+# - Check that if source file does not exist, nothing will be created.
+
+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
+--error 1
+move_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp;
+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
+
+# - Check that if source file exists, everything works properly.
+
+--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
+file1
+EOF
+
+move_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp;
+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
+file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
+
+# - Check that if destination file exists, everything works properly.
+#   (file2.tmp exists from the previous check; file1.tmp needs to be created)
+
+--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
+file1
+EOF
+
+move_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp;
+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
+file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
+remove_file $MYSQLTEST_VARDIR/tmp/file2.tmp;
+
+# - Check usage.
+
+--error 1
+--exec echo "move_file ;" | $MYSQL_TEST 2>&1
+
+--error 1
+--exec echo "move_file from_file;" | $MYSQL_TEST 2>&1
+
 # ----------------------------------------------------------------------------
 # test for chmod
 # ----------------------------------------------------------------------------

=== modified file 'mysql-test/t/parser.test'
--- a/mysql-test/t/parser.test	2009-04-17 20:33:59 +0000
+++ b/mysql-test/t/parser.test	2009-05-11 17:58:07 +0000
@@ -754,6 +754,10 @@ UPDATE t3 SET a4={d '1789-07-14'} WHERE 
 SELECT a1, a4 FROM t2 WHERE a4 LIKE {fn UCASE('1789-07-14')};
 DROP TABLE t1, t2, t3;
 
+--echo #
+--echo # End of 5.1 tests
+--echo #
+
 #
 # Bug#31765 (BACKUP DATABASE broken syntax)
 #
@@ -764,6 +768,46 @@ BACKUP DATABASE *, test to 'broken.bak';
 --error ER_PARSE_ERROR
 BACKUP DATABASE *, db1, db2, db3 to 'broken.bak';
 
---echo #
---echo # End of 5.1 tests
---echo #
+#
+# Bug#31293 - Incorrect parser errors for create/alter/drop logfile group/tablespace
+#
+
+--echo # Should use myisam
+
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+create logfile group ndb_lg1 add undofile 'ndb_undo1' initial_size=32M; 
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+create logfile group ndb_lg1 add undofile 'ndb_undo1' engine=myisam;
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+create logfile group ndb_lg1 add undofile 'ndb_undo1';
+
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+create tablespace ndb_ts1 add datafile 'ndb_ts1.dat' use logfile group ndb_lg1 engine=myisam initial_size=32M;
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+create tablespace ndb_ts1 add datafile 'ndb_ts1.dat' use logfile group ndb_lg1 engine=myisam;
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+create tablespace ndb_ts1 add datafile 'ndb_ts1.dat' use logfile group ndb_lg1;
+
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+alter logfile group ndb_lg1 add undofile 'ndb_undo1' wait;
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+alter logfile group ndb_lg1 add undofile 'ndb_undo1' engine=myisam;
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+alter logfile group ndb_lg1 add undofile 'ndb_undo1';
+
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+alter tablespace ndb_ts1 add datafile 'ndb_ts1.dat' initial_size=32M;
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+alter tablespace ndb_ts1 add datafile 'ndb_ts1.dat' engine=myisam;
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+alter tablespace ndb_ts1 add datafile 'ndb_ts1.dat';
+
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+drop logfile group ndb_lg1 engine=myisam;
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+drop logfile group ndb_lg1;
+
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+drop tablespace ndb_ts1 engine=myisam;
+-- error ER_ILLEGAL_HA_CREATE_OPTION
+drop tablespace ndb_ts1;

=== modified file 'mysql-test/t/plugin.test'
--- a/mysql-test/t/plugin.test	2009-04-22 22:12:25 +0000
+++ b/mysql-test/t/plugin.test	2009-05-04 15:49:30 +0000
@@ -21,6 +21,12 @@ SELECT * FROM t1;
 
 DROP TABLE t1;
 
+# a couple of tests for variables
+set global example_ulong_var=500;
+set global example_enum_var= e1;
+show status like 'example%';
+show variables like 'example%';
+
 UNINSTALL PLUGIN example;
 --error 1305
 UNINSTALL PLUGIN EXAMPLE;

=== modified file 'mysys/default.c'
--- a/mysys/default.c	2009-03-24 14:24:44 +0000
+++ b/mysys/default.c	2009-04-23 10:06:29 +0000
@@ -41,6 +41,29 @@
 #include <winbase.h>
 #endif
 
+/**
+   arguments separator
+
+   load_defaults() loads arguments from config file and put them
+   before the arguments from command line, this separator is used to
+   separate the arguments loaded from config file and arguments user
+   provided on command line.
+
+   Options with value loaded from config file are always in the form
+   '--option=value', while for command line options, the value can be
+   given as the next argument. Thus we used a separator so that
+   handle_options() can distinguish them.
+
+   Note: any other places that does not need to distinguish them
+   should skip the separator.
+
+   The content of arguments separator does not matter, one should only
+   check the pointer, use "----args-separator----" here to ease debug
+   if someone misused it.
+
+   See BUG#25192
+*/
+const char *args_separator= "----args-separator----";
 const char *my_defaults_file=0;
 const char *my_defaults_group_suffix=0;
 char *my_defaults_extra_file=0;
@@ -454,10 +477,11 @@ int my_load_defaults(const char *conf_fi
       goto err;
     res= (char**) (ptr+sizeof(alloc));
     res[0]= **argv;				/* Copy program name */
+    /* set arguments separator */
+    res[1]= (char *)args_separator;
     for (i=2 ; i < (uint) *argc ; i++)
-      res[i-1]=argv[0][i];
-    res[i-1]=0;					/* End pointer */
-    (*argc)--;
+      res[i]=argv[0][i];
+    res[i]=0;					/* End pointer */
     *argv=res;
     *(MEM_ROOT*) ptr= alloc;			/* Save alloc root for free */
     if (default_directories)
@@ -487,7 +511,7 @@ int my_load_defaults(const char *conf_fi
     or a forced default file
   */
   if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+
-			       (args.elements + *argc +1) *sizeof(char*))))
+			       (args.elements + *argc + 1 + 1) *sizeof(char*))))
     goto err;
   res= (char**) (ptr+sizeof(alloc));
 
@@ -508,12 +532,16 @@ int my_load_defaults(const char *conf_fi
     --*argc; ++*argv;				/* skip argument */
   }
 
+  /* set arguments separator for arguments from config file and
+     command line */
+  res[args.elements+1]= (char *)args_separator;
+
   if (*argc)
-    memcpy((uchar*) (res+1+args.elements), (char*) ((*argv)+1),
+    memcpy((uchar*) (res+1+args.elements+1), (char*) ((*argv)+1),
 	   (*argc-1)*sizeof(char*));
-  res[args.elements+ *argc]=0;			/* last null */
+  res[args.elements+ *argc+1]=0;                /* last null */
 
-  (*argc)+=args.elements;
+  (*argc)+=args.elements+1;
   *argv= (char**) res;
   *(MEM_ROOT*) ptr= alloc;			/* Save alloc root for free */
   delete_dynamic(&args);
@@ -523,7 +551,8 @@ int my_load_defaults(const char *conf_fi
     printf("%s would have been started with the following arguments:\n",
 	   **argv);
     for (i=1 ; i < *argc ; i++)
-      printf("%s ", (*argv)[i]);
+      if ((*argv)[i] != args_separator) /* skip arguments separator */
+        printf("%s ", (*argv)[i]);
     puts("");
     exit(0);
   }

=== modified file 'mysys/lf_alloc-pin.c'
--- a/mysys/lf_alloc-pin.c	2009-03-31 15:30:19 +0000
+++ b/mysys/lf_alloc-pin.c	2009-04-23 21:17:43 +0000
@@ -3,8 +3,7 @@
 
    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; either version 2 of the License, or
-   (at your option) any later version.
+   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

=== modified file 'mysys/lf_dynarray.c'
--- a/mysys/lf_dynarray.c	2008-01-10 12:21:53 +0000
+++ b/mysys/lf_dynarray.c	2009-04-23 21:17:43 +0000
@@ -2,8 +2,7 @@
 
    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; either version 2 of the License, or
-   (at your option) any later version.
+   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

=== modified file 'mysys/lf_hash.c'
--- a/mysys/lf_hash.c	2009-02-23 11:55:35 +0000
+++ b/mysys/lf_hash.c	2009-04-23 21:17:43 +0000
@@ -2,8 +2,7 @@
 
    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; either version 2 of the License, or
-   (at your option) any later version.
+   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

=== removed file 'mysys/make-ccc'
--- a/mysys/make-ccc	2006-09-15 05:29:44 +0000
+++ b/mysys/make-ccc	1970-01-01 00:00:00 +0000
@@ -1,4 +0,0 @@
-rm -f .deps/* raid.o mf_iocache.o libmysys.a
-ccc -DDEFAULT_BASEDIR="\"/usr/local/mysql\"" -DDATADIR="\"/usr/local/mysql/var\"" -DHAVE_CONFIG_H -I./../include -I../include -I.. -DDBUG_OFF -fast -O3 -fomit-frame-pointer -c array.c checksum.c default.c errors.c getopt.c getopt1.c getvar.c hash.c list.c mf_brkhant.c mf_cache.c mf_casecnv.c mf_dirname.c mf_fn_ext.c mf_format.c mf_getdate.c mf_keycache.c mf_loadpath.c mf_pack.c mf_pack2.c mf_path.c mf_qsort.c mf_qsort2.c mf_radix.c mf_reccache.c mf_same.c mf_sort.c mf_soundex.c mf_stripp.c mf_unixpath.c mf_wcomp.c mf_wfile.c mulalloc.c my_alarm.c my_alloc.c my_append.c my_chsize.c my_clock.c my_compress.c my_copy.c my_create.c my_delete.c my_div.c my_error.c my_fopen.c my_fstream.c my_getwd.c my_init.c my_lib.c my_lockmem.c my_malloc.c my_messnc.c my_mkdir.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c my_quick.c my_read.c my_realloc.c my_redel.c my_rename.c my_seek.c my_static.c my_tempnam.c my_thr_init.c my_write.c ptr_cmp.c queues.c safemalloc.c string.c thr_alarm
 .c thr_lock.c thr_mutex.c thr_rwlock.c tree.c typelib.c
-make raid.o mf_iocache.o my_lock.o
-ar -cr libmysys.a array.o raid.o mf_iocache.o my_lock.o

=== modified file 'mysys/my_getopt.c'
--- a/mysys/my_getopt.c	2009-04-07 14:22:01 +0000
+++ b/mysys/my_getopt.c	2009-05-14 08:56:34 +0000
@@ -27,23 +27,15 @@ typedef void (*init_func_p)(const struct
 static void default_reporter(enum loglevel level, const char *format, ...);
 my_error_reporter my_getopt_error_reporter= &default_reporter;
 
-static int findopt(char *optpat, uint length,
-                   const struct my_option **opt_res,
-                   char **ffname);
-my_bool getopt_compare_strings(const char *s,
-                               const char *t,
-                               uint length);
-static longlong getopt_ll(char *arg, const struct my_option *optp, int *err);
-static ulonglong getopt_ull(char *arg, const struct my_option *optp,
-                            int *err);
-static double getopt_double(char *arg, const struct my_option *optp, int *err);
-static void init_variables(const struct my_option *options,
-                           init_func_p init_one_value);
-static void init_one_value(const struct my_option *opt, uchar* *, longlong);
-static void fini_one_value(const struct my_option *option, uchar* *variable,
-			   longlong value);
-static int setval(const struct my_option *opts, uchar **value, char *argument,
-                  my_bool set_maximum_value);
+static int findopt(char *, uint, const struct my_option **, char **);
+my_bool getopt_compare_strings(const char *, const char *, uint);
+static longlong getopt_ll(char *, const struct my_option *, int *);
+static ulonglong getopt_ull(char *, const struct my_option *, int *);
+static double getopt_double(char *, const struct my_option *, int *);
+static void init_variables(const struct my_option *, init_func_p);
+static void init_one_value(const struct my_option *opt, uchar **, longlong);
+static void fini_one_value(const struct my_option *, uchar **, longlong);
+static int setval(const struct my_option *, uchar **, char *, my_bool);
 static char *check_struct_option(char *cur_arg, char *key_name);
 
 /*
@@ -119,6 +111,7 @@ int handle_options(int *argc, char ***ar
   const struct my_option *optp;
   uchar* *value;
   int error, i;
+  my_bool is_cmdline_arg= 1;
 
   LINT_INIT(opt_found);
   /* handle_options() assumes arg0 (program name) always exists */
@@ -128,10 +121,34 @@ int handle_options(int *argc, char ***ar
   (*argv)++; /*      --- || ----      */
   init_variables(longopts, init_one_value);
 
+  /*
+    Search for args_separator, if found, then the first part of the
+    arguments are loaded from configs
+  */
+  for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++)
+  {
+    if (*pos == args_separator)
+    {
+      is_cmdline_arg= 0;
+      break;
+    }
+  }
+
   for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++)
   {
     char **first= pos;
     char *cur_arg= *pos;
+    if (!is_cmdline_arg && (cur_arg == args_separator))
+    {
+      is_cmdline_arg= 1;
+
+      /* save the separator too if skip unkown options  */
+      if (my_getopt_skip_unknown)
+        (*argv)[argvpos++]= cur_arg;
+      else
+        (*argc)--;
+      continue;
+    }
     if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */
     {
       char *argument=    0;
@@ -423,8 +440,12 @@ invalid value '%s'",
 	}
 	else if (optp->arg_type == REQUIRED_ARG && !optend)
 	{
-	  /* Check if there are more arguments after this one */
-	  if (!*++pos)
+	  /* Check if there are more arguments after this one,
+
+             Note: options loaded from config file that requires value
+             should always be in the form '--option=value'.
+           */
+	  if (!is_cmdline_arg || !*++pos)
 	  {
 	    if (my_getopt_print_errors)
               my_getopt_error_reporter(ERROR_LEVEL,

=== modified file 'mysys/my_getsystime.c'
--- a/mysys/my_getsystime.c	2008-05-29 15:44:11 +0000
+++ b/mysys/my_getsystime.c	2009-05-14 21:49:53 +0000
@@ -150,7 +150,7 @@ ulonglong my_micro_time()
     Value in microseconds from some undefined point in time
 */
 
-#define DELTA_FOR_SECONDS LL(500000000)  /* Half a second */
+#define DELTA_FOR_SECONDS 500000000LL  /* Half a second */
 
 ulonglong my_micro_time_and_time(time_t *time_arg)
 {

=== modified file 'mysys/my_pthread.c'
--- a/mysys/my_pthread.c	2008-12-04 21:02:09 +0000
+++ b/mysys/my_pthread.c	2009-04-06 18:36:46 +0000
@@ -494,11 +494,6 @@ int my_pthread_mutex_trylock(pthread_mut
 
 /* Some help functions */
 
-int pthread_no_free(void *not_used __attribute__((unused)))
-{
-  return 0;
-}
-
 int pthread_dummy(int ret)
 {
   return ret;

=== modified file 'mysys/my_safehash.c'
--- a/mysys/my_safehash.c	2009-01-27 02:08:48 +0000
+++ b/mysys/my_safehash.c	2009-04-23 21:17:43 +0000
@@ -2,8 +2,7 @@
 
    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; either version 2 of the License, or
-   (at your option) any later version.
+   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

=== modified file 'mysys/my_safehash.h'
--- a/mysys/my_safehash.h	2007-07-02 17:45:15 +0000
+++ b/mysys/my_safehash.h	2009-04-23 21:17:43 +0000
@@ -2,8 +2,7 @@
 
    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; either version 2 of the License, or
-   (at your option) any later version.
+   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

=== modified file 'mysys/typelib.c'
--- a/mysys/typelib.c	2008-03-27 18:40:00 +0000
+++ b/mysys/typelib.c	2009-05-14 21:49:53 +0000
@@ -185,7 +185,7 @@ my_ulonglong find_typeset(char *x, TYPEL
     while (*x && *x != field_separator) x++;
     if ((find= find_type(i, lib, 2 | 8) - 1) < 0)
       DBUG_RETURN(0);
-    result|= (ULL(1) << find);
+    result|= (1ULL << find);
   }
   *err= 0;
   DBUG_RETURN(result);

=== modified file 'mysys/waiting_threads.c'
--- a/mysys/waiting_threads.c	2009-02-23 11:55:35 +0000
+++ b/mysys/waiting_threads.c	2009-05-14 21:49:53 +0000
@@ -1072,7 +1072,7 @@ int wt_thd_cond_timedwait(WT_THD *thd, p
     ret= WT_OK;
   rc_unlock(rc);
 
-  set_timespec_time_nsec(timeout, starttime, (*thd->timeout_short)*ULL(1000));
+  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)
@@ -1084,7 +1084,7 @@ int wt_thd_cond_timedwait(WT_THD *thd, p
       ret= WT_DEADLOCK;
     else if (*thd->timeout_long > *thd->timeout_short)
     {
-      set_timespec_time_nsec(timeout, starttime, (*thd->timeout_long)*ULL(1000));
+      set_timespec_time_nsec(timeout, starttime, (*thd->timeout_long)*1000ULL);
       if (!thd->killed)
         ret= pthread_cond_timedwait(&rc->cond, mutex, &timeout);
     }

=== modified file 'plugin/daemon_example/Makefile.am'
--- a/plugin/daemon_example/Makefile.am	2009-01-07 10:58:33 +0000
+++ b/plugin/daemon_example/Makefile.am	2009-04-25 21:20:45 +0000
@@ -26,7 +26,7 @@ AM_CPPFLAGS =		-I$(top_srcdir)/include \
 
 EXTRA_LTLIBRARIES =	libdaemon_example.la
 pkgplugin_LTLIBRARIES =	@plugin_daemon_example_shared_target@
-libdaemon_example_la_LDFLAGS =	-module -rpath $(pkgplugindir)
+libdaemon_example_la_LDFLAGS =	-module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices
 libdaemon_example_la_CPPFLAGS=	$(AM_CPPFLAGS) -DMYSQL_DYNAMIC_PLUGIN
 libdaemon_example_la_SOURCES =	daemon_example.cc
 

=== removed file 'regex/make-ccc'
--- a/regex/make-ccc	2000-07-31 19:29:14 +0000
+++ b/regex/make-ccc	1970-01-01 00:00:00 +0000
@@ -1,3 +0,0 @@
-ccc -DHAVE_CONFIG_H -I. -I. -I.. -I./../include -I../include    -O -DDBUG_OFF -fast -O3 -c regerror.c regcomp.c regexec.c regfree.c reginit.c
-rm libregex.a
-ar -cr libregex.a regerror.o

=== modified file 'scripts/make_binary_distribution.sh'
--- a/scripts/make_binary_distribution.sh	2009-03-11 17:17:00 +0000
+++ b/scripts/make_binary_distribution.sh	2009-04-14 21:07:28 +0000
@@ -116,10 +116,15 @@ case $PLATFORM in
 esac
 
 # Change the distribution to a long descriptive name
+# For the cluster product, concentrate on the second part
+VERSION_NAME=@VERSION@
+case $VERSION_NAME in
+  *-ndb-* )  VERSION_NAME=`echo $VERSION_NAME | sed -e 's/[.0-9]*-ndb-//'` ;;
+esac
 if [ x"$SHORT_PRODUCT_TAG" != x"" ] ; then
-  NEW_NAME=mysql-$SHORT_PRODUCT_TAG-@VERSION@-$PLATFORM$SUFFIX
+  NEW_NAME=mysql-$SHORT_PRODUCT_TAG-$VERSION_NAME-$PLATFORM$SUFFIX
 else
-  NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-@VERSION@-$PLATFORM$SUFFIX
+  NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$VERSION_NAME-$PLATFORM$SUFFIX
 fi
 
 # ----------------------------------------------------------------------

=== modified file 'scripts/make_win_bin_dist'
--- a/scripts/make_win_bin_dist	2009-01-09 16:41:06 +0000
+++ b/scripts/make_win_bin_dist	2009-04-14 21:07:28 +0000
@@ -126,7 +126,7 @@ if [ -e $DESTDIR ] ; then
   usage
 fi
 
-trap 'echo "Clearning up and exiting..." ; rm -fr $DESTDIR; exit 1' ERR
+trap 'echo "Cleaning up and exiting..." ; rm -fr $DESTDIR; exit 1' ERR
 
 # ----------------------------------------------------------------------
 # Adjust target name if needed, release with debug info has another name

=== modified file 'scripts/mysqld_safe.sh'
--- a/scripts/mysqld_safe.sh	2009-03-18 21:59:44 +0000
+++ b/scripts/mysqld_safe.sh	2009-05-05 11:36:02 +0000
@@ -155,7 +155,13 @@ parse_arguments() {
   fi
 
   for arg do
-    val=`echo "$arg" | sed -e "s;--[^=]*=;;"`
+    # the parameter after "=", or the whole $arg if no match
+    val=`echo "$arg" | sed -e 's;^--[^=]*=;;'`
+    # what's before "=", or the whole $arg if no match
+    optname=`echo "$arg" | sed -e 's/^\(--[^=]*\)=.*$/\1/'`
+    # replace "_" by "-" ; mysqld_safe must accept "_" like mysqld does.
+    optname_subst=`echo "$optname" | sed 's/_/-/g'`
+    arg=`echo $arg | sed "s/^$optname/$optname_subst/"`
     case "$arg" in
       # these get passed explicitly to mysqld
       --basedir=*) MY_BASEDIR_VERSION="$val" ;;

=== modified file 'sql-common/client.c'
--- a/sql-common/client.c	2009-03-19 16:42:23 +0000
+++ b/sql-common/client.c	2009-04-21 09:27:46 +0000
@@ -1135,6 +1135,8 @@ void mysql_read_default_options(struct s
     char **option=argv;
     while (*++option)
     {
+      if (option[0] == args_separator)          /* skip arguments separator */
+        continue;
       /* DBUG_PRINT("info",("option: %s",option[0])); */
       if (option[0][0] == '-' && option[0][1] == '-')
       {

=== modified file 'sql-common/my_time.c'
--- a/sql-common/my_time.c	2009-02-13 18:07:03 +0000
+++ b/sql-common/my_time.c	2009-05-14 21:49:53 +0000
@@ -22,10 +22,10 @@
 ulonglong log_10_int[20]=
 {
   1, 10, 100, 1000, 10000UL, 100000UL, 1000000UL, 10000000UL,
-  ULL(100000000), ULL(1000000000), ULL(10000000000), ULL(100000000000),
-  ULL(1000000000000), ULL(10000000000000), ULL(100000000000000),
-  ULL(1000000000000000), ULL(10000000000000000), ULL(100000000000000000),
-  ULL(1000000000000000000), ULL(10000000000000000000)
+  100000000ULL, 1000000000ULL, 10000000000ULL, 100000000000ULL,
+  1000000000000ULL, 10000000000000ULL, 100000000000000ULL,
+  1000000000000000ULL, 10000000000000000ULL, 100000000000000000ULL,
+  1000000000000000000ULL, 10000000000000000000ULL
 };
 
 
@@ -1120,7 +1120,7 @@ longlong number_to_datetime(longlong nr,
   bzero((char*) time_res, sizeof(*time_res));
   time_res->time_type=MYSQL_TIMESTAMP_DATE;
 
-  if (nr == LL(0) || nr >= LL(10000101000000))
+  if (nr == 0LL || nr >= 10000101000000LL)
   {
     time_res->time_type=MYSQL_TIMESTAMP_DATETIME;
     goto ok;
@@ -1151,19 +1151,19 @@ longlong number_to_datetime(longlong nr,
 
   time_res->time_type=MYSQL_TIMESTAMP_DATETIME;
 
-  if (nr <= (YY_PART_YEAR-1)*LL(10000000000)+LL(1231235959))
+  if (nr <= (YY_PART_YEAR-1)*10000000000LL+1231235959LL)
   {
-    nr= nr+LL(20000000000000);                   /* YYMMDDHHMMSS, 2000-2069 */
+    nr= nr+20000000000000LL;                   /* YYMMDDHHMMSS, 2000-2069 */
     goto ok;
   }
-  if (nr <  YY_PART_YEAR*LL(10000000000)+ LL(101000000))
+  if (nr <  YY_PART_YEAR*10000000000LL+ 101000000LL)
     goto err;
-  if (nr <= LL(991231235959))
-    nr= nr+LL(19000000000000);		/* YYMMDDHHMMSS, 1970-1999 */
+  if (nr <= 991231235959LL)
+    nr= nr+19000000000000LL;		/* YYMMDDHHMMSS, 1970-1999 */
 
  ok:
-  part1=(long) (nr/LL(1000000));
-  part2=(long) (nr - (longlong) part1*LL(1000000));
+  part1=(long) (nr/1000000LL);
+  part2=(long) (nr - (longlong) part1*1000000LL);
   time_res->year=  (int) (part1/10000L);  part1%=10000L;
   time_res->month= (int) part1 / 100;
   time_res->day=   (int) part1 % 100;
@@ -1179,11 +1179,11 @@ longlong number_to_datetime(longlong nr,
 
   /* Don't want to have was_cut get set if NO_ZERO_DATE was violated. */
   if (!nr && (flags & TIME_NO_ZERO_DATE))
-    return LL(-1);
+    return -1LL;
 
  err:
   *was_cut= 1;
-  return LL(-1);
+  return -1LL;
 }
 
 
@@ -1193,7 +1193,7 @@ ulonglong TIME_to_ulonglong_datetime(con
 {
   return ((ulonglong) (my_time->year * 10000UL +
                        my_time->month * 100UL +
-                       my_time->day) * ULL(1000000) +
+                       my_time->day) * 1000000ULL +
           (ulonglong) (my_time->hour * 10000UL +
                        my_time->minute * 100UL +
                        my_time->second));
@@ -1254,7 +1254,7 @@ ulonglong TIME_to_ulonglong(const MYSQL_
     return TIME_to_ulonglong_time(my_time);
   case MYSQL_TIMESTAMP_NONE:
   case MYSQL_TIMESTAMP_ERROR:
-    return ULL(0);
+    return 0ULL;
   default:
     DBUG_ASSERT(0);
   }

=== modified file 'sql-common/pack.c'
--- a/sql-common/pack.c	2007-08-13 13:11:25 +0000
+++ b/sql-common/pack.c	2009-05-14 21:49:53 +0000
@@ -87,8 +87,6 @@ my_ulonglong net_field_length_ll(uchar *
 
   NOTES
     This is mostly used to store lengths of strings.
-    We have to cast the result for the LL() becasue of a bug in Forte CC
-    compiler.
 
   RETURN
    Position in 'pkg' after the packed length
@@ -96,19 +94,19 @@ my_ulonglong net_field_length_ll(uchar *
 
 uchar *net_store_length(uchar *packet, ulonglong length)
 {
-  if (length < (ulonglong) LL(251))
+  if (length < 251ULL)
   {
     *packet=(uchar) length;
     return packet+1;
   }
   /* 251 is reserved for NULL */
-  if (length < (ulonglong) LL(65536))
+  if (length < 65536ULL)
   {
     *packet++=252;
     int2store(packet,(uint) length);
     return packet+2;
   }
-  if (length < (ulonglong) LL(16777216))
+  if (length < 16777216ULL)
   {
     *packet++=253;
     int3store(packet,(ulong) length);

=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt	2009-04-20 17:08:21 +0000
+++ b/sql/CMakeLists.txt	2009-05-04 20:51:05 +0000
@@ -47,7 +47,7 @@ SET (SQL_SOURCE
                ../sql-common/client.c derror.cc des_key_file.cc
                discover.cc ../libmysql/errmsg.c field.cc field_conv.cc
                filesort.cc gstream.cc sha2.cc ha_partition.cc
-               handler.cc hash_filo.cc hash_filo.h 
+               handler.cc hash_filo.cc hash_filo.h sql_plugin_services.h
                hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc 
                item_create.cc item_func.cc item_geofunc.cc item_row.cc 
                item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc 

=== modified file 'sql/Makefile.am'
--- a/sql/Makefile.am	2009-04-02 16:14:14 +0000
+++ b/sql/Makefile.am	2009-05-04 20:51:05 +0000
@@ -1,245 +1,245 @@
-# Copyright (C) 2000-2006 MySQL AB
-# 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-#called from the top level Makefile
-
-MYSQLDATAdir =		$(localstatedir)
-MYSQLSHAREdir =		$(pkgdatadir)
-MYSQLBASEdir=		$(prefix)
-MYSQLLIBdir=            $(pkglibdir)
-pkgplugindir =		$(pkglibdir)/plugin
-AM_CPPFLAGS =		@ZLIB_INCLUDES@ \
-			-I$(top_srcdir)/include \
-			-I$(top_srcdir)/regex $(openssl_includes) \
-			$(libevent_includes)
-WRAPLIBS=		@WRAPLIBS@
-SUBDIRS =		share backup
-libexec_PROGRAMS =	mysqld
-EXTRA_PROGRAMS =	gen_lex_hash
-bin_PROGRAMS =		mysql_tzinfo_to_sql
-DTRACE =                @DTRACE@
-DTRACEFLAGS =           @DTRACEFLAGS@
-DTRACEFILES =           filesort.o \
-			handler.o \
-			mysqld.o \
-			net_serv.o \
-			scheduler.o \
-			sp_head.o \
-			sql_cache.o \
-			sql_connect.o \
-			sql_cursor.o \
-			sql_delete.o \
-			sql_insert.o \
-			sql_parse.o \
-			sql_prepare.o \
-			sql_select.o \
-			sql_update.o
-
-noinst_LTLIBRARIES=	libndb.la \
-			udf_example.la
-
-SUPPORTING_LIBS =	$(top_builddir)/vio/libvio.a \
-			$(top_builddir)/mysys/libmysyswrap.la \
-			$(top_builddir)/mysys/libmysyslt.la \
-			$(top_builddir)/dbug/libdbuglt.la \
-			$(top_builddir)/regex/libregex.a \
-			$(top_builddir)/strings/libmystringsextra.la \
-			$(top_builddir)/strings/libmystringslt.la
-mysqld_DEPENDENCIES=	@mysql_plugin_libs@ $(SUPPORTING_LIBS) backup/libbackup.la libndb.la
-LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@ @NDB_SCI_LIBS@
-mysqld_LDADD =		libndb.la \
-			@MYSQLD_EXTRA_LDFLAGS@ \
-			@pstack_libs@ $(libevent_libs) \
-			@mysql_plugin_libs@ \
-			$(LDADD)  $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \
-			$(yassl_libs) $(openssl_libs) @MYSQLD_EXTRA_LIBS@ \
-			backup/libbackup.la
-
-noinst_HEADERS =	item.h item_func.h item_sum.h item_cmpfunc.h \
-			item_strfunc.h item_timefunc.h \
-			item_xmlfunc.h \
-			item_create.h item_subselect.h item_row.h \
-			mysql_priv.h item_geofunc.h sql_bitmap.h \
-			procedure.h sql_class.h sql_lex.h sql_list.h \
-			sql_map.h sql_string.h unireg.h \
-			sql_error.h field.h handler.h mysqld_suffix.h \
-			sql_profile.h \
-			ha_ndbcluster.h ha_ndbcluster_cond.h \
-			ha_ndbcluster_binlog.h ha_ndbcluster_tables.h \
-			ha_ndbcluster_connection.h ha_ndbcluster_connection.h \
-			ha_ndbcluster_lock_ext.h \
-			ha_partition.h rpl_constants.h \
-			debug_sync.h \
-			opt_range.h protocol.h rpl_tblmap.h rpl_utility.h \
-			rpl_reporting.h \
-			log.h sql_show.h rpl_info.h \
-			rpl_rli.h rpl_rli_file.h rpl_mi.h rpl_mi_file.h \
-			sql_select.h structs.h table.h sql_udf.h hash_filo.h \
-			lex.h lex_symbol.h sql_acl.h sql_crypt.h  \
-			sql_repl.h slave.h rpl_filter.h rpl_injector.h \
-			log_event.h rpl_record.h \
-			log_event_old.h rpl_record_old.h \
-			sql_sort.h sql_cache.h set_var.h \
-			spatial.h gstream.h client_settings.h tzfile.h \
-			tztime.h my_decimal.h\
-			sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \
-			parse_file.h sql_view.h	sql_trigger.h \
-			sql_array.h sql_cursor.h events.h scheduler.h \
-                        event_db_repository.h event_queue.h \
-			sql_plugin.h authors.h event_parse_data.h \
-			event_data_objects.h event_scheduler.h \
-			sql_partition.h partition_info.h partition_element.h \
-			probes.h sql_audit.h transaction.h \
-			contributors.h sql_servers.h bml.h \
-			si_objects.h si_logs.h sql_plist.h mdl.h records.h \
-			sql_signal.h \
-			rpl_handler.h replication.h sql_prepare.h debug_sync.h
-
-mysqld_SOURCES =	sql_lex.cc sql_handler.cc sql_partition.cc \
-			item.cc item_sum.cc item_buff.cc item_func.cc \
-			item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
-			thr_malloc.cc item_create.cc item_subselect.cc \
-			item_row.cc item_geofunc.cc item_xmlfunc.cc \
-			field.cc strfunc.cc key.cc sql_class.cc sql_list.cc \
-			net_serv.cc protocol.cc sql_state.c \
-			lock.cc my_lock.c \
-			sql_string.cc sql_manager.cc sql_map.cc \
-			mysqld.cc password.c hash_filo.cc hostname.cc \
-			sql_connect.cc scheduler.cc sql_parse.cc \
-			set_var.cc sql_yacc.yy \
-                        sql_join_cache.cc \
-			sql_base.cc table.cc sql_select.cc sql_insert.cc \
-			sql_profile.cc \
-			sql_prepare.cc sql_error.cc sql_locale.cc \
-			sql_update.cc sql_delete.cc uniques.cc sql_do.cc \
-			procedure.cc sql_test.cc \
-			log.cc init.cc derror.cc sql_acl.cc \
-			unireg.cc des_key_file.cc \
-			log_event.cc rpl_record.cc \
-			log_event_old.cc rpl_record_old.cc \
-			discover.cc time.cc opt_range.cc opt_sum.cc \
-		   	records.cc filesort.cc handler.cc \
-		        ha_partition.cc \
-			debug_sync.cc \
-			sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \
-			sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
-			sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
-			slave.cc sql_repl.cc rpl_filter.cc rpl_tblmap.cc \
-			rpl_utility.cc rpl_injector.cc rpl_rli.cc rpl_mi.cc \
-			rpl_info.cc rpl_rli_file.cc rpl_mi_file.cc \
-			rpl_reporting.cc \
-                        sql_union.cc sql_derived.cc \
-			sql_client.cc \
-			repl_failsafe.h repl_failsafe.cc \
-			sql_olap.cc sql_view.cc \
-			gstream.cc spatial.cc sql_help.cc sql_cursor.cc \
-			tztime.cc my_decimal.cc\
-			sp_head.cc sp_pcontext.cc  sp_rcontext.cc sp.cc \
-			sp_cache.cc parse_file.cc sql_trigger.cc \
-                        event_scheduler.cc event_data_objects.cc \
-                        event_queue.cc event_db_repository.cc events.cc \
-			sql_plugin.cc sql_binlog.cc \
-			sql_builtin.cc sql_tablespace.cc partition_info.cc \
-			sql_servers.cc sql_audit.cc sha2.cc \
-			bml.cc si_objects.cc si_logs.cc \
-			event_parse_data.cc mdl.cc transaction.cc \
-			sql_signal.cc \
-			rpl_handler.cc
-
-if HAVE_DTRACE
-  mysqld_SOURCES += probes.d
-endif
-
-nodist_mysqld_SOURCES =	mini_client_errors.c pack.c client.c my_time.c my_user.c 
-
-libndb_la_CPPFLAGS=	@ndbcluster_includes@ $(AM_CPPFLAGS)
-libndb_la_SOURCES=	ha_ndbcluster.cc \
-			ha_ndbcluster_binlog.cc \
-			ha_ndbcluster_connection.cc \
-			ha_ndbcluster_cond.cc
-
-gen_lex_hash_SOURCES =	gen_lex_hash.cc
-gen_lex_hash_LDFLAGS =  @NOINST_LDFLAGS@
-
-mysql_tzinfo_to_sql_SOURCES = tztime.cc
-mysql_tzinfo_to_sql_CXXFLAGS= -DTZINFO2SQL
-
-DEFS =			-DMYSQL_SERVER \
-			-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-			-DDATADIR="\"$(MYSQLDATAdir)\"" \
-			-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-			-DPLUGINDIR="\"$(pkgplugindir)\"" \
-			-DHAVE_EVENT_SCHEDULER \
-			@DEFS@
-
-BUILT_MAINT_SRC =	sql_yacc.cc sql_yacc.h
-BUILT_SOURCES =		$(BUILT_MAINT_SRC) lex_hash.h link_sources
-EXTRA_DIST =		udf_example.c udf_example.def $(BUILT_MAINT_SRC) \
-			nt_servc.cc nt_servc.h CMakeLists.txt \
-			probes.d \
-			message.mc  message.h message.rc MSG00001.bin \
-			nt_servc.cc nt_servc.h \
-			CMakeLists.txt
-
-CLEANFILES =        	lex_hash.h sql_yacc.output link_sources
-DISTCLEANFILES =        $(EXTRA_PROGRAMS)
-MAINTAINERCLEANFILES =  $(BUILT_MAINT_SRC)
-AM_YFLAGS =		-d --verbose
-
-# These are listed in 'nodist_mysqld_SOURCES'
-link_sources:
-	rm -f mini_client_errors.c
-	@LN_CP_F@ $(top_srcdir)/libmysql/errmsg.c mini_client_errors.c
-	rm -f pack.c
-	@LN_CP_F@ $(top_srcdir)/sql-common/pack.c pack.c
-	rm -f client.c
-	@LN_CP_F@ $(top_srcdir)/sql-common/client.c client.c
-	rm -f my_time.c
-	@LN_CP_F@ $(top_srcdir)/sql-common/my_time.c my_time.c
-	rm -f my_user.c
-	@LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c
-	echo timestamp > link_sources
-
-# This generates lex_hash.h
-# NOTE Built sources should depend on their sources not the tool
-# this avoid the rebuild of the built files in a source dist
-lex_hash.h:	gen_lex_hash.cc lex.h
-		$(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
-		./gen_lex_hash$(EXEEXT) > $@-t
-		$(MV) $@-t $@
-
-# For testing of udf_example.so
-udf_example_la_SOURCES= udf_example.c
-udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
-
-probes.h: probes.d
-	$(DTRACE) $(DTRACEFLAGS) -h -s probes.d
-	mv probes.h probes.h.bak
-	sed "s/#include <unistd.h>//g" probes.h.bak > probes.h
-	rm probes.h.bak
-
-# We might have some stuff not built in this build, but that we want to install
-install-exec-hook:
-	$(mkinstalldirs) $(DESTDIR)$(libexecdir) $(DESTDIR)$(pkglibdir)
-	test ! -x mysqld-debug$(EXEEXT) || $(INSTALL_PROGRAM) mysqld-debug$(EXEEXT) $(DESTDIR)$(libexecdir)
-	test ! -f mysqld-debug.sym.gz   || $(INSTALL_DATA)    mysqld-debug.sym.gz   $(DESTDIR)$(pkglibdir)
-	test ! -f mysqld.sym.gz         || $(INSTALL_DATA)    mysqld.sym.gz         $(DESTDIR)$(pkglibdir)
-
-SUFFIXES : .d
-
-.d.o :
-	$(DTRACE) $(DTRACEFLAGS) -G -s $< $(DTRACEFILES)
-
-probes.o : $(DTRACEFILES)
+# Copyright (C) 2000-2006 MySQL AB
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+#called from the top level Makefile
+
+MYSQLDATAdir =		$(localstatedir)
+MYSQLSHAREdir =		$(pkgdatadir)
+MYSQLBASEdir=		$(prefix)
+MYSQLLIBdir=            $(pkglibdir)
+pkgplugindir =		$(pkglibdir)/plugin
+AM_CPPFLAGS =		@ZLIB_INCLUDES@ \
+			-I$(top_srcdir)/include \
+			-I$(top_srcdir)/regex $(openssl_includes) \
+			$(libevent_includes)
+WRAPLIBS=		@WRAPLIBS@
+SUBDIRS =		share backup
+libexec_PROGRAMS =	mysqld
+EXTRA_PROGRAMS =	gen_lex_hash
+bin_PROGRAMS =		mysql_tzinfo_to_sql
+DTRACE =                @DTRACE@
+DTRACEFLAGS =           @DTRACEFLAGS@
+DTRACEFILES =           filesort.o \
+			handler.o \
+			mysqld.o \
+			net_serv.o \
+			scheduler.o \
+			sp_head.o \
+			sql_cache.o \
+			sql_connect.o \
+			sql_cursor.o \
+			sql_delete.o \
+			sql_insert.o \
+			sql_parse.o \
+			sql_prepare.o \
+			sql_select.o \
+			sql_update.o
+
+noinst_LTLIBRARIES=	libndb.la \
+			udf_example.la
+
+SUPPORTING_LIBS =	$(top_builddir)/vio/libvio.a \
+			$(top_builddir)/mysys/libmysyswrap.la \
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/regex/libregex.a \
+			$(top_builddir)/strings/libmystringsextra.la \
+			$(top_builddir)/strings/libmystringslt.la
+mysqld_DEPENDENCIES=	@mysql_plugin_libs@ $(SUPPORTING_LIBS) backup/libbackup.la libndb.la
+LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@ @NDB_SCI_LIBS@
+mysqld_LDADD =		libndb.la \
+			@MYSQLD_EXTRA_LDFLAGS@ \
+			@pstack_libs@ $(libevent_libs) \
+			@mysql_plugin_libs@ \
+			$(LDADD)  $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \
+			$(yassl_libs) $(openssl_libs) @MYSQLD_EXTRA_LIBS@ \
+			backup/libbackup.la
+
+noinst_HEADERS =	item.h item_func.h item_sum.h item_cmpfunc.h \
+			item_strfunc.h item_timefunc.h \
+			item_xmlfunc.h sql_plugin_services.h \
+			item_create.h item_subselect.h item_row.h \
+			mysql_priv.h item_geofunc.h sql_bitmap.h \
+			procedure.h sql_class.h sql_lex.h sql_list.h \
+			sql_map.h sql_string.h unireg.h \
+			sql_error.h field.h handler.h mysqld_suffix.h \
+			sql_profile.h \
+			ha_ndbcluster.h ha_ndbcluster_cond.h \
+			ha_ndbcluster_binlog.h ha_ndbcluster_tables.h \
+			ha_ndbcluster_connection.h ha_ndbcluster_connection.h \
+			ha_ndbcluster_lock_ext.h \
+			ha_partition.h rpl_constants.h \
+			debug_sync.h \
+			opt_range.h protocol.h rpl_tblmap.h rpl_utility.h \
+			rpl_reporting.h \
+			log.h sql_show.h rpl_info.h \
+			rpl_rli.h rpl_rli_file.h rpl_mi.h rpl_mi_file.h \
+			sql_select.h structs.h table.h sql_udf.h hash_filo.h \
+			lex.h lex_symbol.h sql_acl.h sql_crypt.h  \
+			sql_repl.h slave.h rpl_filter.h rpl_injector.h \
+			log_event.h rpl_record.h \
+			log_event_old.h rpl_record_old.h \
+			sql_sort.h sql_cache.h set_var.h \
+			spatial.h gstream.h client_settings.h tzfile.h \
+			tztime.h my_decimal.h\
+			sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \
+			parse_file.h sql_view.h	sql_trigger.h \
+			sql_array.h sql_cursor.h events.h scheduler.h \
+                        event_db_repository.h event_queue.h \
+			sql_plugin.h authors.h event_parse_data.h \
+			event_data_objects.h event_scheduler.h \
+			sql_partition.h partition_info.h partition_element.h \
+			probes.h sql_audit.h transaction.h \
+			contributors.h sql_servers.h bml.h \
+			si_objects.h si_logs.h sql_plist.h mdl.h records.h \
+			sql_signal.h \
+			rpl_handler.h replication.h sql_prepare.h debug_sync.h
+
+mysqld_SOURCES =	sql_lex.cc sql_handler.cc sql_partition.cc \
+			item.cc item_sum.cc item_buff.cc item_func.cc \
+			item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
+			thr_malloc.cc item_create.cc item_subselect.cc \
+			item_row.cc item_geofunc.cc item_xmlfunc.cc \
+			field.cc strfunc.cc key.cc sql_class.cc sql_list.cc \
+			net_serv.cc protocol.cc sql_state.c \
+			lock.cc my_lock.c \
+			sql_string.cc sql_manager.cc sql_map.cc \
+			mysqld.cc password.c hash_filo.cc hostname.cc \
+			sql_connect.cc scheduler.cc sql_parse.cc \
+			set_var.cc sql_yacc.yy \
+                        sql_join_cache.cc \
+			sql_base.cc table.cc sql_select.cc sql_insert.cc \
+			sql_profile.cc \
+			sql_prepare.cc sql_error.cc sql_locale.cc \
+			sql_update.cc sql_delete.cc uniques.cc sql_do.cc \
+			procedure.cc sql_test.cc \
+			log.cc init.cc derror.cc sql_acl.cc \
+			unireg.cc des_key_file.cc \
+			log_event.cc rpl_record.cc \
+			log_event_old.cc rpl_record_old.cc \
+			discover.cc time.cc opt_range.cc opt_sum.cc \
+		   	records.cc filesort.cc handler.cc \
+		        ha_partition.cc \
+			debug_sync.cc \
+			sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \
+			sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
+			sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
+			slave.cc sql_repl.cc rpl_filter.cc rpl_tblmap.cc \
+			rpl_utility.cc rpl_injector.cc rpl_rli.cc rpl_mi.cc \
+			rpl_info.cc rpl_rli_file.cc rpl_mi_file.cc \
+			rpl_reporting.cc \
+                        sql_union.cc sql_derived.cc \
+			sql_client.cc \
+			repl_failsafe.h repl_failsafe.cc \
+			sql_olap.cc sql_view.cc \
+			gstream.cc spatial.cc sql_help.cc sql_cursor.cc \
+			tztime.cc my_decimal.cc\
+			sp_head.cc sp_pcontext.cc  sp_rcontext.cc sp.cc \
+			sp_cache.cc parse_file.cc sql_trigger.cc \
+                        event_scheduler.cc event_data_objects.cc \
+                        event_queue.cc event_db_repository.cc events.cc \
+			sql_plugin.cc sql_binlog.cc \
+			sql_builtin.cc sql_tablespace.cc partition_info.cc \
+			sql_servers.cc sql_audit.cc sha2.cc \
+			bml.cc si_objects.cc si_logs.cc \
+			event_parse_data.cc mdl.cc transaction.cc \
+			sql_signal.cc \
+			rpl_handler.cc
+
+if HAVE_DTRACE
+  mysqld_SOURCES += probes.d
+endif
+
+nodist_mysqld_SOURCES =	mini_client_errors.c pack.c client.c my_time.c my_user.c 
+
+libndb_la_CPPFLAGS=	@ndbcluster_includes@ $(AM_CPPFLAGS)
+libndb_la_SOURCES=	ha_ndbcluster.cc \
+			ha_ndbcluster_binlog.cc \
+			ha_ndbcluster_connection.cc \
+			ha_ndbcluster_cond.cc
+
+gen_lex_hash_SOURCES =	gen_lex_hash.cc
+gen_lex_hash_LDFLAGS =  @NOINST_LDFLAGS@
+
+mysql_tzinfo_to_sql_SOURCES = tztime.cc
+mysql_tzinfo_to_sql_CXXFLAGS= -DTZINFO2SQL
+
+DEFS =			-DMYSQL_SERVER \
+			-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
+			-DDATADIR="\"$(MYSQLDATAdir)\"" \
+			-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
+			-DPLUGINDIR="\"$(pkgplugindir)\"" \
+			-DHAVE_EVENT_SCHEDULER \
+			@DEFS@
+
+BUILT_MAINT_SRC =	sql_yacc.cc sql_yacc.h
+BUILT_SOURCES =		$(BUILT_MAINT_SRC) lex_hash.h link_sources
+EXTRA_DIST =		udf_example.c udf_example.def $(BUILT_MAINT_SRC) \
+			nt_servc.cc nt_servc.h CMakeLists.txt \
+			probes.d \
+			message.mc  message.h message.rc MSG00001.bin \
+			nt_servc.cc nt_servc.h \
+			CMakeLists.txt
+
+CLEANFILES =        	lex_hash.h sql_yacc.output link_sources
+DISTCLEANFILES =        $(EXTRA_PROGRAMS)
+MAINTAINERCLEANFILES =  $(BUILT_MAINT_SRC)
+AM_YFLAGS =		-d --verbose
+
+# These are listed in 'nodist_mysqld_SOURCES'
+link_sources:
+	rm -f mini_client_errors.c
+	@LN_CP_F@ $(top_srcdir)/libmysql/errmsg.c mini_client_errors.c
+	rm -f pack.c
+	@LN_CP_F@ $(top_srcdir)/sql-common/pack.c pack.c
+	rm -f client.c
+	@LN_CP_F@ $(top_srcdir)/sql-common/client.c client.c
+	rm -f my_time.c
+	@LN_CP_F@ $(top_srcdir)/sql-common/my_time.c my_time.c
+	rm -f my_user.c
+	@LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c
+	echo timestamp > link_sources
+
+# This generates lex_hash.h
+# NOTE Built sources should depend on their sources not the tool
+# this avoid the rebuild of the built files in a source dist
+lex_hash.h:	gen_lex_hash.cc lex.h
+		$(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
+		./gen_lex_hash$(EXEEXT) > $@-t
+		$(MV) $@-t $@
+
+# For testing of udf_example.so
+udf_example_la_SOURCES= udf_example.c
+udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
+
+probes.h: probes.d
+	$(DTRACE) $(DTRACEFLAGS) -h -s probes.d
+	mv probes.h probes.h.bak
+	sed "s/#include <unistd.h>//g" probes.h.bak > probes.h
+	rm probes.h.bak
+
+# We might have some stuff not built in this build, but that we want to install
+install-exec-hook:
+	$(mkinstalldirs) $(DESTDIR)$(libexecdir) $(DESTDIR)$(pkglibdir)
+	test ! -x mysqld-debug$(EXEEXT) || $(INSTALL_PROGRAM) mysqld-debug$(EXEEXT) $(DESTDIR)$(libexecdir)
+	test ! -f mysqld-debug.sym.gz   || $(INSTALL_DATA)    mysqld-debug.sym.gz   $(DESTDIR)$(pkglibdir)
+	test ! -f mysqld.sym.gz         || $(INSTALL_DATA)    mysqld.sym.gz         $(DESTDIR)$(pkglibdir)
+
+SUFFIXES : .d
+
+.d.o :
+	$(DTRACE) $(DTRACEFLAGS) -G -s $< $(DTRACEFILES)
+
+probes.o : $(DTRACEFILES)

=== modified file 'sql/field.cc'
--- a/sql/field.cc	2009-04-09 09:51:50 +0000
+++ b/sql/field.cc	2009-05-14 21:49:53 +0000
@@ -54,7 +54,7 @@ const char field_separator=',';
 #define LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE 128
 #define DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE 128
 #define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \
-((ulong) ((LL(1) << min(arg, 4) * 8) - LL(1)))
+((ulong) ((1LL << min(arg, 4) * 8) - 1LL))
 
 #define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(!table || (!table->read_set || bitmap_is_set(table->read_set, field_index)))
 #define ASSERT_COLUMN_MARKED_FOR_WRITE DBUG_ASSERT(!table || (!table->write_set || bitmap_is_set(table->write_set, field_index)))
@@ -3637,7 +3637,7 @@ int Field_long::store(longlong nr, bool 
       res=0;
       error= 1;
     }
-    else if ((ulonglong) nr >= (LL(1) << 32))
+    else if ((ulonglong) nr >= (1LL << 32))
     {
       res=(int32) (uint32) ~0L;
       error= 1;
@@ -4775,7 +4775,7 @@ int Field_timestamp::store(longlong nr, 
   longlong tmp= number_to_datetime(nr, &l_time, (thd->variables.sql_mode &
                                                  MODE_NO_ZERO_DATE) |
                                    MODE_NO_ZERO_IN_DATE, &error);
-  if (tmp == LL(-1))
+  if (tmp == -1LL)
   {
     error= 2;
   }
@@ -4831,7 +4831,7 @@ longlong Field_timestamp::val_int(void)
   
   thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, (my_time_t)temp);
   
-  return time_tmp.year * LL(10000000000) + time_tmp.month * LL(100000000) +
+  return time_tmp.year * 10000000000LL + time_tmp.month * 100000000LL +
          time_tmp.day * 1000000L + time_tmp.hour * 10000L +
          time_tmp.minute * 100 + time_tmp.second;
 }
@@ -5434,7 +5434,7 @@ int Field_date::store(double nr)
     nr=floor(nr/1000000.0);			// Timestamp to date
   if (nr < 0.0 || nr > 99991231.0)
   {
-    tmp= LL(0);
+    tmp= 0LL;
     set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
                          ER_WARN_DATA_OUT_OF_RANGE,
                          nr, MYSQL_TIMESTAMP_DATE);
@@ -5460,7 +5460,7 @@ int Field_date::store(longlong nr, bool 
                                            MODE_NO_ZERO_DATE |
                                            MODE_INVALID_DATES))), &error);
 
-  if (nr == LL(-1))
+  if (nr == -1LL)
   {
     nr= 0;
     error= 2;
@@ -5687,7 +5687,7 @@ int Field_newdate::store(longlong nr, bo
                           (thd->variables.sql_mode &
                            (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
                             MODE_INVALID_DATES))),
-                         &error) == LL(-1))
+                         &error) == -1LL)
   {
     tmp= 0L;
     error= 2;
@@ -5925,7 +5925,7 @@ int Field_datetime::store(longlong nr, b
                                            MODE_NO_ZERO_DATE |
                                            MODE_INVALID_DATES))), &error);
 
-  if (nr == LL(-1))
+  if (nr == -1LL)
   {
     nr= 0;
     error= 2;
@@ -5961,7 +5961,7 @@ int Field_datetime::store_time(MYSQL_TIM
   if (time_type == MYSQL_TIMESTAMP_DATE ||
       time_type == MYSQL_TIMESTAMP_DATETIME)
   {
-    tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*LL(1000000)+
+    tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*1000000LL+
 	 (ltime->hour*10000L+ltime->minute*100+ltime->second));
     if (check_date(ltime, tmp != 0,
                    (TIME_FUZZY_DATE |
@@ -6043,8 +6043,8 @@ String *Field_datetime::val_str(String *
     Avoid problem with slow longlong arithmetic and sprintf
   */
 
-  part1=(long) (tmp/LL(1000000));
-  part2=(long) (tmp - (ulonglong) part1*LL(1000000));
+  part1=(long) (tmp/1000000LL);
+  part2=(long) (tmp - (ulonglong) part1*1000000LL);
 
   pos=(char*) val_buffer->ptr() + MAX_DATETIME_WIDTH;
   *pos--=0;
@@ -6074,8 +6074,8 @@ bool Field_datetime::get_date(MYSQL_TIME
 {
   longlong tmp=Field_datetime::val_int();
   uint32 part1,part2;
-  part1=(uint32) (tmp/LL(1000000));
-  part2=(uint32) (tmp - (ulonglong) part1*LL(1000000));
+  part1=(uint32) (tmp/1000000LL);
+  part2=(uint32) (tmp - (ulonglong) part1*1000000LL);
 
   ltime->time_type=	MYSQL_TIMESTAMP_DATETIME;
   ltime->neg=		0;

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2009-04-01 21:36:07 +0000
+++ b/sql/ha_partition.cc	2009-04-25 21:24:53 +0000
@@ -1174,7 +1174,7 @@ bool ha_partition::check_and_repair(THD 
  
 
 /**
-  @breif Check if the table can be automatically repaired
+  Check if the table can be automatically repaired
 
   @retval TRUE  Can be auto repaired
   @retval FALSE Cannot be auto repaired
@@ -1193,7 +1193,7 @@ bool ha_partition::auto_repair() const
 
 
 /**
-  @breif Check if the table is crashed
+  Check if the table is crashed
 
   @retval TRUE  Crashed
   @retval FALSE Not crashed

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2009-03-28 00:27:25 +0000
+++ b/sql/handler.h	2009-05-14 21:49:53 +0000
@@ -168,21 +168,21 @@ typedef Bitmap<HA_MAX_ALTER_FLAGS> HA_AL
 #define HA_NO_VARCHAR	       (1 << 27)
 #define HA_CAN_BIT_FIELD       (1 << 28) /* supports bit fields */
 #define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
-#define HA_NO_COPY_ON_ALTER    (LL(1) << 31)
-#define HA_HAS_RECORDS	       (LL(1) << 32) /* records() gives exact count*/
+#define HA_NO_COPY_ON_ALTER    (1LL << 31)
+#define HA_HAS_RECORDS	       (1LL << 32) /* records() gives exact count*/
 /* Has it's own method of binlog logging */
-#define HA_HAS_OWN_BINLOGGING  (LL(1) << 33)
+#define HA_HAS_OWN_BINLOGGING  (1LL << 33)
 /*
   Engine is capable of row-format and statement-format logging,
   respectively
 */
-#define HA_BINLOG_ROW_CAPABLE  (LL(1) << 35)
-#define HA_BINLOG_STMT_CAPABLE (LL(1) << 36)
+#define HA_BINLOG_ROW_CAPABLE  (1LL << 35)
+#define HA_BINLOG_STMT_CAPABLE (1LL << 36)
 
-#define HA_ONLINE_ALTER        (LL(1) << 37)
-#define HA_CAN_READ_ORDER_IF_LIMIT (LL(1) << 38)
+#define HA_ONLINE_ALTER        (1LL << 37)
+#define HA_CAN_READ_ORDER_IF_LIMIT (1LL << 38)
 /* Has automatic checksums and uses the new checksum format */
-#define HA_HAS_NEW_CHECKSUM    (LL(1) << 39)
+#define HA_HAS_NEW_CHECKSUM    (1LL << 39)
 
 /*
     When a multiple key conflict happens in a REPLACE command mysql
@@ -206,7 +206,7 @@ typedef Bitmap<HA_MAX_ALTER_FLAGS> HA_AL
     This flag helps the underlying SE to inform the server that the keys are not
     ordered.
  */
-#define HA_DUPLICATE_KEY_NOT_IN_ORDER    (LL(1) << 40)
+#define HA_DUPLICATE_KEY_NOT_IN_ORDER    (1LL << 40)
 
 /*
   Set of all binlog flags. Currently only contain the capabilities

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2009-04-28 00:30:41 +0000
+++ b/sql/item.cc	2009-05-14 21:49:53 +0000
@@ -954,7 +954,7 @@ bool Item::get_date(MYSQL_TIME *ltime,ui
   {
     longlong value= val_int();
     int was_cut;
-    if (number_to_datetime(value, ltime, fuzzydate, &was_cut) == LL(-1))
+    if (number_to_datetime(value, ltime, fuzzydate, &was_cut) == -1LL)
     {
       char buff[22], *end;
       end= longlong10_to_str(value, buff, -10);

=== modified file 'sql/item.h'
--- a/sql/item.h	2009-04-07 14:22:01 +0000
+++ b/sql/item.h	2009-05-14 21:49:53 +0000
@@ -2564,7 +2564,7 @@ public:
   longlong val_int()
   {
     int err;
-    return null_value ? LL(0) : my_strntoll(str_value.charset(),str_value.ptr(),
+    return null_value ? 0LL : my_strntoll(str_value.charset(),str_value.ptr(),
                                             str_value.length(),10, (char**) 0,
                                             &err); 
   }

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2009-04-14 21:36:40 +0000
+++ b/sql/item_cmpfunc.cc	2009-05-07 14:10:24 +0000
@@ -157,7 +157,7 @@ static int agg_cmp_type(Item_result *typ
   @brief Aggregates field types from the array of items.
 
   @param[in] items  array of items to aggregate the type from
-  @paran[in] nitems number of items in the array
+  @param[in] nitems number of items in the array
 
   @details This function aggregates field types from the array of items.
     Found type is supposed to be used later as the result field type

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2009-04-30 14:35:36 +0000
+++ b/sql/item_func.cc	2009-05-14 21:49:53 +0000
@@ -1802,7 +1802,7 @@ longlong Item_func_shift_left::val_int()
     return 0;
   }
   null_value=0;
-  return (shift < sizeof(longlong)*8 ? (longlong) res : LL(0));
+  return (shift < sizeof(longlong)*8 ? (longlong) res : 0LL);
 }
 
 longlong Item_func_shift_right::val_int()
@@ -1817,7 +1817,7 @@ longlong Item_func_shift_right::val_int(
     return 0;
   }
   null_value=0;
-  return (shift < sizeof(longlong)*8 ? (longlong) res : LL(0));
+  return (shift < sizeof(longlong)*8 ? (longlong) res : 0LL);
 }
 
 
@@ -2733,7 +2733,7 @@ void Item_func_find_in_set::fix_length_a
 			      find->length(), 0);
 	enum_bit=0;
 	if (enum_value)
-	  enum_bit=LL(1) << (enum_value-1);
+	  enum_bit=1LL << (enum_value-1);
       }
     }
   }
@@ -2803,7 +2803,7 @@ longlong Item_func_find_in_set::val_int(
                wc == (my_wc_t) separator)
         return (longlong) ++position;
       else
-        return LL(0);
+        return 0LL;
     }
   }
   return 0;
@@ -3517,7 +3517,7 @@ void debug_sync_point(const char* lock_n
   @retval return value from pthread_cond_timedwait
 */
 
-#define INTERRUPT_INTERVAL (5 * ULL(1000000000))
+#define INTERRUPT_INTERVAL (5 * 1000000000ULL)
 
 static int interruptible_wait(THD *thd, pthread_cond_t *cond,
                               pthread_mutex_t *lock, double time)
@@ -4151,7 +4151,7 @@ double user_var_entry::val_real(my_bool 
 longlong user_var_entry::val_int(my_bool *null_value) const
 {
   if ((*null_value= (value == 0)))
-    return LL(0);
+    return 0LL;
 
   switch (type) {
   case REAL_RESULT:
@@ -4176,7 +4176,7 @@ longlong user_var_entry::val_int(my_bool
   default:
     break;
   }
-  return LL(0);					// Impossible
+  return 0LL;					// Impossible
 }
 
 
@@ -4628,7 +4628,7 @@ longlong Item_func_get_user_var::val_int
 {
   DBUG_ASSERT(fixed == 1);
   if (!var_entry)
-    return LL(0);				// No such variable
+    return 0LL;				// No such variable
   return (var_entry->val_int(&null_value));
 }
 

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2009-04-23 08:42:37 +0000
+++ b/sql/item_strfunc.cc	2009-05-14 21:49:53 +0000
@@ -3288,7 +3288,7 @@ String* Item_func_inet_ntoa::val_str(Str
 
     Also return null if n > 255.255.255.255
   */
-  if ((null_value= (args[0]->null_value || n > (ulonglong) LL(4294967295))))
+  if ((null_value= (args[0]->null_value || n > 4294967295ULL)))
     return 0;					// Null value
 
   str->length(0);

=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc	2009-03-11 12:52:04 +0000
+++ b/sql/item_sum.cc	2009-05-14 21:49:53 +0000
@@ -2765,7 +2765,7 @@ longlong Item_sum_count_distinct::val_in
   int error;
   DBUG_ASSERT(fixed == 1);
   if (!table)					// Empty query
-    return LL(0);
+    return 0LL;
   if (tree)
   {
     if (is_evaluated)

=== modified file 'sql/item_sum.h'
--- a/sql/item_sum.h	2008-12-10 09:02:11 +0000
+++ b/sql/item_sum.h	2009-05-14 21:49:53 +0000
@@ -930,7 +930,7 @@ public:
 class Item_sum_or :public Item_sum_bit
 {
 public:
-  Item_sum_or(Item *item_par) :Item_sum_bit(item_par,LL(0)) {}
+  Item_sum_or(Item *item_par) :Item_sum_bit(item_par,0LL) {}
   Item_sum_or(THD *thd, Item_sum_or *item) :Item_sum_bit(thd, item) {}
   bool add();
   const char *func_name() const { return "bit_or("; }
@@ -951,7 +951,7 @@ class Item_sum_and :public Item_sum_bit
 class Item_sum_xor :public Item_sum_bit
 {
   public:
-  Item_sum_xor(Item *item_par) :Item_sum_bit(item_par,LL(0)) {}
+  Item_sum_xor(Item *item_par) :Item_sum_bit(item_par,0LL) {}
   Item_sum_xor(THD *thd, Item_sum_xor *item) :Item_sum_bit(thd, item) {}
   bool add();
   const char *func_name() const { return "bit_xor("; }

=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc	2009-04-14 21:36:40 +0000
+++ b/sql/item_timefunc.cc	2009-05-14 21:49:53 +0000
@@ -880,7 +880,7 @@ static bool get_interval_info(const char
     longlong value;
     const char *start= str;
     for (value=0; str != end && my_isdigit(cs,*str) ; str++)
-      value= value*LL(10) + (longlong) (*str - '0');
+      value= value*10LL + (longlong) (*str - '0');
     msec_length= 6 - (str - start);
     values[i]= value;
     while (str != end && !my_isdigit(cs,*str))

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2009-05-11 07:36:07 +0000
+++ b/sql/log.cc	2009-05-25 06:46:00 +0000
@@ -55,7 +55,7 @@ LOGGER logger;
 MYSQL_BIN_LOG mysql_bin_log(&sync_binlog_period);
 
 static bool test_if_number(const char *str,
-			   long *res, bool allow_wildcards);
+			   ulong *res, bool allow_wildcards);
 static int binlog_init(void *p);
 static int binlog_close_connection(handlerton *hton, THD *thd);
 static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv);
@@ -65,6 +65,35 @@ static int binlog_rollback(handlerton *h
 static int binlog_prepare(handlerton *hton, THD *thd, bool all);
 
 /**
+   purge logs, master and slave sides both, related error code
+   convertor.
+   Called from @c purge_error_message(), @c MYSQL_BIN_LOG::reset_logs()
+
+   @param  res  an internal to purging routines error code 
+
+   @return the user level error code ER_*
+*/
+uint purge_log_get_error_code(int res)
+{
+  uint errcode= 0;
+
+  switch (res)  {
+  case 0: break;
+  case LOG_INFO_EOF:	errcode= ER_UNKNOWN_TARGET_BINLOG; break;
+  case LOG_INFO_IO:	errcode= ER_IO_ERR_LOG_INDEX_READ; break;
+  case LOG_INFO_INVALID:errcode= ER_BINLOG_PURGE_PROHIBITED; break;
+  case LOG_INFO_SEEK:	errcode= ER_FSEEK_FAIL; break;
+  case LOG_INFO_MEM:	errcode= ER_OUT_OF_RESOURCES; break;
+  case LOG_INFO_FATAL:	errcode= ER_BINLOG_PURGE_FATAL_ERR; break;
+  case LOG_INFO_IN_USE: errcode= ER_LOG_IN_USE; break;
+  case LOG_INFO_EMFILE: errcode= ER_BINLOG_PURGE_EMFILE; break;
+  default:		errcode= ER_LOG_PURGE_UNKNOWN_ERR; break;
+  }
+
+  return errcode;
+}
+
+/**
   Silence all errors and warnings reported when performing a write
   to a log table.
   Errors and warnings are not reported to the client or SQL exception
@@ -119,9 +148,16 @@ sql_print_message_func sql_print_message
 };
 
 
+/**
+  Create the name of the default general log file
+  
+  @param[IN] buff    Location for building new string.
+  @param[IN] log_ext The extension for the file (e.g .log)
+  @returns Pointer to a new string containing the name
+*/
 char *make_default_log_name(char *buff,const char* log_ext)
 {
-  strmake(buff, pidfile_name, FN_REFLEN-5);
+  strmake(buff, default_logfile_name, FN_REFLEN-5);
   return fn_format(buff, buff, mysql_data_home, log_ext,
                    MYF(MY_UNPACK_FILENAME|MY_REPLACE_EXT));
 }
@@ -2991,22 +3027,27 @@ static void setup_windows_event_source()
 /**
   Find a unique filename for 'filename.#'.
 
-  Set '#' to a number as low as possible.
+  Set '#' to the number next to the maximum found in the most
+  recent log file extension.
+
+  This function will return nonzero if: (i) the generated name
+  exceeds FN_REFLEN; (ii) if the number of extensions is exhausted;
+  or (iii) some other error happened while examining the filesystem.
 
   @return
-    nonzero if not possible to get unique filename
+    nonzero if not possible to get unique filename.
 */
 
 static int find_uniq_filename(char *name)
 {
-  long                  number;
   uint                  i;
-  char                  buff[FN_REFLEN];
+  char                  buff[FN_REFLEN], ext_buf[FN_REFLEN];
   struct st_my_dir     *dir_info;
   reg1 struct fileinfo *file_info;
-  ulong                 max_found=0;
+  ulong                 max_found= 0, next= 0, number= 0;
   size_t		buf_length, length;
   char			*start, *end;
+  int                   error= 0;
   DBUG_ENTER("find_uniq_filename");
 
   length= dirname_part(buff, name, &buf_length);
@@ -3014,15 +3055,15 @@ static int find_uniq_filename(char *name
   end=    strend(start);
 
   *end='.';
-  length= (size_t) (end-start+1);
+  length= (size_t) (end - start + 1);
 
-  if (!(dir_info = my_dir(buff,MYF(MY_DONT_SORT))))
+  if (!(dir_info= my_dir(buff,MYF(MY_DONT_SORT))))
   {						// This shouldn't happen
     strmov(end,".1");				// use name+1
-    DBUG_RETURN(0);
+    DBUG_RETURN(1);
   }
   file_info= dir_info->dir_entry;
-  for (i=dir_info->number_off_files ; i-- ; file_info++)
+  for (i= dir_info->number_off_files ; i-- ; file_info++)
   {
     if (bcmp((uchar*) file_info->name, (uchar*) start, length) == 0 &&
 	test_if_number(file_info->name+length, &number,0))
@@ -3032,9 +3073,44 @@ static int find_uniq_filename(char *name
   }
   my_dirend(dir_info);
 
+  /* check if reached the maximum possible extension number */
+  if ((max_found == MAX_LOG_UNIQUE_FN_EXT))
+  {
+    sql_print_error("Log filename extension number exhausted: %06lu. \
+Please fix this by archiving old logs and \
+updating the index files.", max_found);
+    error= 1;
+    goto end;
+  }
+
+  next= max_found + 1;
+  sprintf(ext_buf, "%06lu", next);
   *end++='.';
-  sprintf(end,"%06ld",max_found+1);
-  DBUG_RETURN(0);
+
+  /* 
+    Check if the generated extension size + the file name exceeds the
+    buffer size used. If one did not check this, then the filename might be
+    truncated, resulting in error.
+   */
+  if (((strlen(ext_buf) + (end - name)) >= FN_REFLEN))
+  {
+    sql_print_error("Log filename too large: %s%s (%lu). \
+Please fix this by archiving old logs and updating the \
+index files.", name, ext_buf, (strlen(ext_buf) + (end - name)));
+    error= 1;
+    goto end;
+  }
+
+  sprintf(end, "%06lu", next);
+
+  /* print warning if reaching the end of available extensions. */
+  if ((next > (MAX_LOG_UNIQUE_FN_EXT - LOG_WARN_UNIQUE_FN_EXT_LEFT)))
+    sql_print_warning("Next log extension: %lu. \
+Remaining log filename extensions: %lu. \
+Please consider archiving some logs.", next, (MAX_LOG_UNIQUE_FN_EXT - next));
+
+end:
+  DBUG_RETURN(error);
 }
 
 
@@ -3233,6 +3309,13 @@ int MYSQL_LOG::generate_new_name(char *n
     {
       if (find_uniq_filename(new_name))
       {
+        /* 
+          The warning below should turn into error once propagation of return
+          value, further up in the stack, gets proper handling.
+        */
+        push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, 
+                            ER_NO_UNIQUE_LOGFILE, ER(ER_NO_UNIQUE_LOGFILE),
+                            log_name);
 	sql_print_error(ER(ER_NO_UNIQUE_LOGFILE), log_name);
 	return 1;
       }
@@ -4526,8 +4609,10 @@ int MYSQL_BIN_LOG::find_log_pos(LOG_INFO
   {
     uint length;
     my_off_t offset= my_b_tell(&index_file);
-    /* If we get 0 or 1 characters, this is the end of the file */
 
+    DBUG_EXECUTE_IF("simulate_find_log_pos_error",
+                    error=  LOG_INFO_EOF; break;);
+    /* If we get 0 or 1 characters, this is the end of the file */
     if ((length= my_b_gets(&index_file, fname, FN_REFLEN)) <= 1)
     {
       /* Did not find the given entry; Return not found or error */
@@ -4629,6 +4714,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
 {
   LOG_INFO linfo;
   bool error=0;
+  int err;
   const char* save_name;
   DBUG_ENTER("reset_logs");
 
@@ -4659,9 +4745,12 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
 
   /* First delete all old log files */
 
-  if (find_log_pos(&linfo, NullS, 0))
+  if ((err= find_log_pos(&linfo, NullS, 0)) != 0)
   {
-    error=1;
+    uint errcode= purge_log_get_error_code(err);
+    sql_print_error("Failed to locate old binlog or relay log files");
+    my_message(errcode, ER(errcode), MYF(0));
+    error= 1;
     goto err;
   }
 
@@ -4730,6 +4819,8 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
   my_free((uchar*) save_name, MYF(0));
 
 err:
+  if (error == 1)
+    name= const_cast<char*>(save_name);
   pthread_mutex_unlock(&LOCK_thread_count);
   pthread_mutex_unlock(&LOCK_index);
   pthread_mutex_unlock(&LOCK_log);
@@ -6500,11 +6591,11 @@ void MYSQL_BIN_LOG::set_max_size(ulong m
   @retval
     1	String is a number
   @retval
-    0	Error
+    0	String is not a number
 */
 
 static bool test_if_number(register const char *str,
-			   long *res, bool allow_wildcards)
+			   ulong *res, bool allow_wildcards)
 {
   reg2 int flag;
   const char *start;

=== modified file 'sql/log.h'
--- a/sql/log.h	2009-01-26 16:32:29 +0000
+++ b/sql/log.h	2009-04-24 12:55:11 +0000
@@ -166,6 +166,19 @@ extern TC_LOG_DUMMY tc_log_dummy;
 #define LOG_CLOSE_TO_BE_OPENED	2
 #define LOG_CLOSE_STOP_EVENT	4
 
+/* 
+  Maximum unique log filename extension.
+  Note: setting to 0x7FFFFFFF due to atol windows 
+        overflow/truncate.
+ */
+#define MAX_LOG_UNIQUE_FN_EXT 0x7FFFFFFF
+
+/* 
+   Number of warnings that will be printed to error log
+   before extension number is exhausted.
+*/
+#define LOG_WARN_UNIQUE_FN_EXT_LEFT 1000
+
 class Relay_log_info;
 
 typedef struct st_log_info
@@ -813,4 +826,6 @@ enum enum_binlog_format {
 };
 extern TYPELIB binlog_format_typelib;
 
+uint purge_log_get_error_code(int res);
+
 #endif /* LOG_H */

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2009-04-30 14:35:36 +0000
+++ b/sql/log_event.cc	2009-05-13 16:04:01 +0000
@@ -7418,6 +7418,7 @@ int Rows_log_event::do_apply_event(Relay
 
     // Do event specific preparations 
     error= do_before_row_operations(rli);
+
     // row processing loop
 
     while (error == 0 && m_curr_row < m_rows_end)
@@ -8460,15 +8461,16 @@ Rows_log_event::write_row(const Relay_lo
      values filled in and one flag to handle the case that the default
      values should be checked. Maybe these two flags can be combined.
   */
+  bool abort_on_warnings= (rli->info_thd->variables.sql_mode &
+                           (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES));
   if ((error= prepare_record(table, &m_cols, m_width,
                              table->file->ht->db_type != DB_TYPE_NDBCLUSTER,
-                             (rli->info_thd->variables.sql_mode &
-                              (MODE_STRICT_TRANS_TABLES |
-                               MODE_STRICT_ALL_TABLES)))))
+                             abort_on_warnings, m_curr_row == m_rows_buf)))
     DBUG_RETURN(error);
   
   /* unpack row into table->record[0] */
-  error= unpack_current_row(rli, &m_cols);
+  if ((error= unpack_current_row(rli, &m_cols, abort_on_warnings)))
+    DBUG_RETURN(error);
 
   // Temporary fix to find out why it fails [/Matz]
   memcpy(m_table->write_set->bitmap, m_cols.bitmap, (m_table->write_set->n_bits + 7) / 8);
@@ -8694,7 +8696,7 @@ void Write_rows_log_event::print(FILE *f
 
   Returns TRUE if different.
 */
-static bool record_compare(TABLE *table)
+static bool record_compare(TABLE *table, const MY_BITMAP *cols_in_readset)
 {
   /*
     Need to set the X bit and the filler bits in both records since
@@ -8726,14 +8728,23 @@ static bool record_compare(TABLE *table)
     }
   }
 
-  if (table->s->blob_fields + table->s->varchar_fields == 0)
+  /* 
+     We can compare the record straight away if:
+      i) there are no blob and varchar fields
+     ii) all columns were read or the slave SE provides partial reads
+  */
+  if ((table->s->blob_fields + table->s->varchar_fields == 0) &&
+      (bitmap_is_set_all(cols_in_readset) || 
+      (table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ)))
   {
     result= cmp_record(table,record[1]);
     goto record_compare_exit;
   }
 
-  /* Compare null bits */
-  if (memcmp(table->null_flags,
+  /* Compare null bits only if all fields were read or slave SE has partial reads */
+  if ((bitmap_is_set_all