List:Commits« Previous MessageNext Message »
From:Alexey Botchkov Date:June 25 2009 11:16am
Subject:bzr commit into mysql-5.4 branch (holyfoot:3355)
View as plain text  
#At file:///home/hf/work/mysql_common/wl4991/ based on revid:holyfoot@strippedh0aups4s8u2s2m5

 3355 Alexey Botchkov	2009-06-25 [merge]
      merging

    removed:
      mysql-test/suite/im/
      mysql-test/suite/im/r/
      mysql-test/suite/im/r/im_cmd_line.result
      mysql-test/suite/im/r/im_daemon_life_cycle.result
      mysql-test/suite/im/r/im_instance_conf.result
      mysql-test/suite/im/r/im_life_cycle.result
      mysql-test/suite/im/r/im_options.result
      mysql-test/suite/im/r/im_utils.result
      mysql-test/suite/im/t/
      mysql-test/suite/im/t/disabled.def
      mysql-test/suite/im/t/im_check_env.inc
      mysql-test/suite/im/t/im_cmd_line.imtest
      mysql-test/suite/im/t/im_daemon_life_cycle-im.opt
      mysql-test/suite/im/t/im_daemon_life_cycle.imtest
      mysql-test/suite/im/t/im_instance_conf-im.opt
      mysql-test/suite/im/t/im_instance_conf.imtest
      mysql-test/suite/im/t/im_life_cycle-im.opt
      mysql-test/suite/im/t/im_life_cycle.imtest
      mysql-test/suite/im/t/im_options-im.opt
      mysql-test/suite/im/t/im_options.imtest
      mysql-test/suite/im/t/im_utils-im.opt
      mysql-test/suite/im/t/im_utils.imtest
      mysql-test/suite/im/t/kill_n_check.sh
      mysql-test/suite/im/t/log.sh
      mysql-test/suite/im/t/utils.sh
      mysql-test/suite/im/t/wait_for_process.sh
      mysql-test/suite/im/t/wait_for_socket.sh
    added:
      mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
      mysql-test/include/have_semisync_plugin.inc
      mysql-test/include/show_relaylog_events.inc
      mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
      mysql-test/suite/rpl/r/rpl_semi_sync.result
      mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
      mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test
      mysql-test/suite/rpl/t/rpl_semi_sync-master.opt
      mysql-test/suite/rpl/t/rpl_semi_sync-slave.opt
      mysql-test/suite/rpl/t/rpl_semi_sync.test
      mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test
      plugin/semisync/
      plugin/semisync/Makefile.am
      plugin/semisync/configure.in
      plugin/semisync/plug.in
      plugin/semisync/semisync.cc
      plugin/semisync/semisync.h
      plugin/semisync/semisync_master.cc
      plugin/semisync/semisync_master.h
      plugin/semisync/semisync_master_plugin.cc
      plugin/semisync/semisync_slave.cc
      plugin/semisync/semisync_slave.h
      plugin/semisync/semisync_slave_plugin.cc
    renamed:
      mysql-test/include/have_community_features.inc => mysql-test/include/have_profiling.inc
      mysql-test/r/have_community_features.require => mysql-test/r/have_profiling.require
    modified:
      .bzr-mysql/default.conf
      client/mysqltest.cc
      configure.in
      dbug/dbug.c
      include/config-win.h
      include/my_dbug.h
      mysql-test/extra/rpl_tests/rpl_row_sp006.test
      mysql-test/include/show_binlog_events.inc
      mysql-test/mysql-test-run.pl
      mysql-test/r/alter_table.result
      mysql-test/r/create.result
      mysql-test/r/debug_sync.result
      mysql-test/r/events_bugs.result
      mysql-test/r/grant.result
      mysql-test/r/grant2.result
      mysql-test/r/information_schema_db.result
      mysql-test/r/information_schema_routines.result
      mysql-test/r/mysqldump.result
      mysql-test/r/show_check.result
      mysql-test/r/sp-security.result
      mysql-test/r/sp.result
      mysql-test/r/sql_mode.result
      mysql-test/r/strict.result
      mysql-test/r/system_mysql_db.result
      mysql-test/r/trigger.result
      mysql-test/r/trigger_notembedded.result
      mysql-test/r/view_grant.result
      mysql-test/suite/backup/r/backup_check_i_s.result
      mysql-test/suite/backup/r/backup_functions.result
      mysql-test/suite/backup/r/backup_security.result
      mysql-test/suite/binlog/r/binlog_grant.result
      mysql-test/suite/binlog/r/binlog_tmp_table.result
      mysql-test/suite/binlog/t/binlog_tmp_table.test
      mysql-test/suite/federated/federated_server.result
      mysql-test/suite/funcs_1/r/innodb_storedproc_07.result
      mysql-test/suite/funcs_1/r/innodb_trig_03e.result
      mysql-test/suite/funcs_1/r/is_columns_is.result
      mysql-test/suite/funcs_1/r/is_columns_mysql.result
      mysql-test/suite/funcs_1/r/is_routines.result
      mysql-test/suite/funcs_1/r/memory_storedproc_07.result
      mysql-test/suite/funcs_1/r/memory_trig_03e.result
      mysql-test/suite/funcs_1/r/myisam_storedproc_07.result
      mysql-test/suite/funcs_1/r/myisam_trig_03e.result
      mysql-test/suite/funcs_1/r/ndb_storedproc_07.result
      mysql-test/suite/funcs_1/r/ndb_trig_03e.result
      mysql-test/suite/funcs_1/r/storedproc.result
      mysql-test/suite/parts/t/disabled.def
      mysql-test/suite/rpl/r/rpl_heartbeat.result
      mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result
      mysql-test/suite/rpl/r/rpl_temporary.result
      mysql-test/suite/rpl/t/disabled.def
      mysql-test/suite/rpl/t/rpl000017.test
      mysql-test/suite/rpl/t/rpl_heartbeat.test
      mysql-test/suite/sys_vars/r/read_only_func.result
      mysql-test/t/alter_table.test
      mysql-test/t/create.test
      mysql-test/t/ctype_utf8.test
      mysql-test/t/disabled.def
      mysql-test/t/grant.test
      mysql-test/t/information_schema.test
      mysql-test/t/profiling.test
      mysql-test/t/sp.test
      mysql-test/t/sql_mode.test
      mysql-test/t/trigger.test
      mysql-test/t/variables+c.test
      scripts/mysql_system_tables.sql
      scripts/mysql_system_tables_fix.sql
      sql/lex.h
      sql/log.cc
      sql/log.h
      sql/mysql_priv.h
      sql/mysqld.cc
      sql/rpl_handler.cc
      sql/set_var.cc
      sql/share/errmsg.txt
      sql/slave.cc
      sql/sp_head.cc
      sql/sql_acl.cc
      sql/sql_acl.h
      sql/sql_base.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_insert.cc
      sql/sql_lex.h
      sql/sql_parse.cc
      sql/sql_partition.cc
      sql/sql_repl.cc
      sql/sql_show.cc
      sql/sql_table.cc
      sql/sql_yacc.yy
      sql/table.cc
      mysql-test/include/have_profiling.inc
      mysql-test/r/have_profiling.require
=== modified file '.bzr-mysql/default.conf'
--- a/.bzr-mysql/default.conf	2009-06-09 14:36:52 +0000
+++ b/.bzr-mysql/default.conf	2009-06-19 07:44:35 +0000
@@ -1,5 +1,5 @@
 [MYSQL]
-tree_location = "bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-pe"
+tree_location = "bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-azalea"
 post_commit_to = "commits@stripped"
 post_push_to = "commits@stripped"
-tree_name = "mysql-pe"
+tree_name = "mysql-5.4"

=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2009-06-09 14:36:52 +0000
+++ b/client/mysqltest.cc	2009-06-19 12:41:16 +0000
@@ -114,6 +114,8 @@ static uint my_end_arg= 0;
 /* Number of lines of the result to include in failure report */
 static uint opt_tail_lines= 0;
 
+static uint opt_connect_timeout= 0;
+
 static char delimiter[MAX_DELIMITER_LENGTH]= ";";
 static uint delimiter_length= 1;
 
@@ -5026,6 +5028,11 @@ void do_connect(struct st_command *comma
 #endif
   if (!mysql_init(&con_slot->mysql))
     die("Failed on mysql_init()");
+
+  if (opt_connect_timeout)
+    mysql_options(&con_slot->mysql, MYSQL_OPT_CONNECT_TIMEOUT,
+                  (void *) &opt_connect_timeout);
+
   if (opt_compress || con_compress)
     mysql_options(&con_slot->mysql, MYSQL_OPT_COMPRESS, NullS);
   mysql_options(&con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
@@ -5824,6 +5831,11 @@ static struct my_option my_long_options[
   {"view-protocol", OPT_VIEW_PROTOCOL, "Use views for select",
    (uchar**) &view_protocol, (uchar**) &view_protocol, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"connect_timeout", OPT_CONNECT_TIMEOUT,
+   "Number of seconds before connection timeout.",
+   (uchar**) &opt_connect_timeout,
+   (uchar**) &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG,
+   120, 0, 3600 * 12, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
@@ -7049,6 +7061,10 @@ int util_query(MYSQL* org_mysql, const c
     if (!(mysql= mysql_init(mysql)))
       die("Failed in mysql_init()");
 
+    if (opt_connect_timeout)
+      mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT,
+                    (void *) &opt_connect_timeout);
+
     /* enable local infile, in non-binary builds often disabled by default */
     mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, 0);
     safe_connect(mysql, "util", org_mysql->host, org_mysql->user,
@@ -7706,6 +7722,9 @@ int main(int argc, char **argv)
   st_connection *con= connections;
   if (!( mysql_init(&con->mysql)))
     die("Failed in mysql_init()");
+  if (opt_connect_timeout)
+    mysql_options(&con->mysql, MYSQL_OPT_CONNECT_TIMEOUT,
+                  (void *) &opt_connect_timeout);
   if (opt_compress)
     mysql_options(&con->mysql,MYSQL_OPT_COMPRESS,NullS);
   mysql_options(&con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);

=== modified file 'configure.in'
--- a/configure.in	2009-06-08 14:58:33 +0000
+++ b/configure.in	2009-06-17 07:30:19 +0000
@@ -639,24 +639,6 @@ then
   fi
 fi
 
-AC_MSG_CHECKING(whether features provided by the user community should be included.)
-AC_ARG_ENABLE(community-features,
-    AS_HELP_STRING(
-        [--enable-community-features], 
-        [Enable additional features provided by the user community.]),
-    [ ENABLE_COMMUNITY_FEATURES=$enableval ],
-    [ ENABLE_COMMUNITY_FEATURES=no ]
-    )
-
-if test "$ENABLE_COMMUNITY_FEATURES" = "yes"
-then
-  AC_DEFINE([COMMUNITY_SERVER], [1],
-            [Whether features provided by the user community should be included])
-  AC_MSG_RESULT([yes, community server])
-else
-  AC_MSG_RESULT([no, enterprise server])
-fi
-
 AC_ARG_WITH(server-suffix,
     [  --with-server-suffix    Append value to the version string.],
     [ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e  's/^\(...................................\)..*$/\1/'` ],

=== modified file 'dbug/dbug.c'
--- a/dbug/dbug.c	2009-03-25 16:51:28 +0000
+++ b/dbug/dbug.c	2009-05-15 13:43:56 +0000
@@ -1836,6 +1836,27 @@ BOOLEAN _db_keyword_(CODE_STATE *cs, con
 /*
  *  FUNCTION
  *
+ *      _db_keywords_    test keyword formed by a set of strings for member
+ *                       of keyword list
+ *
+ *  DESCRIPTION
+ *
+ *      This function is similar to _db_keyword but receives a set of strings to
+ *      be concatenated in order to make the keyword to be compared.
+ */
+
+BOOLEAN _db_keywords_(CODE_STATE *cs, int strict, const char *function, const char *type)
+{
+  char dest[_DBUG_MAX_FUNC_NAME_ + 1];
+
+  strxnmov(dest, _DBUG_MAX_FUNC_NAME_, function, type, NULL);
+
+  return _db_keyword_(cs, dest, strict);
+}
+
+/*
+ *  FUNCTION
+ *
  *      Indent    indent a line to the given indentation level
  *
  *  SYNOPSIS
@@ -2460,6 +2481,13 @@ void _db_unlock_file_()
   pthread_mutex_unlock(&THR_LOCK_dbug);
 }
 
+const char* _db_get_func_(void)
+{
+  CODE_STATE *cs;
+  get_code_state_or_return NULL;
+  return cs->func;
+}
+
 /*
  * Here we need the definitions of the clock routine.  Add your
  * own for whatever system that you have.

=== modified file 'include/config-win.h'
--- a/include/config-win.h	2009-06-08 14:58:33 +0000
+++ b/include/config-win.h	2009-06-17 07:30:19 +0000
@@ -386,7 +386,6 @@ inline ulonglong double2ulonglong(double
 #define HAVE_OPENSSL 1
 #define HAVE_YASSL 1
 
-#define COMMUNITY_SERVER 1
 #define ENABLED_PROFILING 1
 
 /*

=== modified file 'include/my_dbug.h'
--- a/include/my_dbug.h	2009-05-15 13:45:06 +0000
+++ b/include/my_dbug.h	2009-06-12 02:01:08 +0000
@@ -31,6 +31,8 @@ struct _db_stack_frame_ {
 struct  _db_code_state_;
 extern  my_bool _dbug_on_;
 extern  my_bool _db_keyword_(struct _db_code_state_ *, const char *, int);
+extern  my_bool _db_keywords_(struct _db_code_state_ *, int, const char *,
+                              const char *);
 extern  int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len);
 extern  int _db_explain_init_(char *buf, size_t len);
 extern	int _db_is_pushed_(void);
@@ -54,6 +56,7 @@ extern  void _db_lock_file_(void);
 extern  void _db_unlock_file_(void);
 extern  FILE *_db_fp_(void);
 extern  void _db_flush_();
+extern  const char* _db_get_func_(void);
 
 #define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_; \
         _db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_)
@@ -101,6 +104,20 @@ extern  void _db_flush_();
                      (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\
                      _exit(3))
 #endif
+#define _DBUG_MAX_FUNC_NAME_ 255
+#define DBUG_CHECK_CRASH(func, op) \
+        do { \
+          if (_db_keywords_(0, 0, (func), (op))) \
+            { (_db_flush_(), abort()); } \
+        } while (0)
+#define DBUG_CRASH_ENTER(func) \
+  DBUG_ENTER(func); DBUG_CHECK_CRASH(func, "_crash_enter")
+#define DBUG_CRASH_RETURN(val) \
+  do {DBUG_CHECK_CRASH(_db_get_func_(), "_crash_return"); \
+    DBUG_RETURN(val);} while(0)
+#define DBUG_CRASH_VOID_RETURN \
+  do {DBUG_CHECK_CRASH (_db_get_func_(), "_crash_return"); \
+    DBUG_VOID_RETURN;} while(0)
 
 #else                                           /* No debugger */
 
@@ -132,6 +149,9 @@ extern  void _db_flush_();
 #define DEBUGGER_ON                     do { } while(0)
 #define IF_DBUG(A)
 #define DBUG_ABORT()                    abort()
+#define DBUG_CRASH_ENTER(func)
+#define DBUG_CRASH_RETURN(val)          do { return(val); } while(0)
+#define DBUG_CRASH_VOID_RETURN          do { return; } while(0)
 
 #endif
 #ifdef  __cplusplus

=== modified file 'mysql-test/extra/rpl_tests/rpl_row_sp006.test'
--- a/mysql-test/extra/rpl_tests/rpl_row_sp006.test	2007-06-18 13:36:10 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp006.test	2009-06-18 04:03:12 +0000
@@ -11,12 +11,14 @@
 # Begin clean up test section
 connection master;
 --disable_warnings
-create database if not exists mysqltest1;
+drop database if exists mysqltest1;
+create database mysqltest1;
 DROP PROCEDURE IF EXISTS mysqltest1.p1;
 DROP PROCEDURE IF EXISTS mysqltest1.p2;
 DROP TABLE IF EXISTS mysqltest1.t2;
 DROP TABLE IF EXISTS mysqltest1.t1;
 --enable_warnings
+
 # End of cleanup
 
 # Begin test section 1

=== added file 'mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc'
--- a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc	2009-05-13 11:04:33 +0000
@@ -0,0 +1,121 @@
+-- connection master
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+
+-- echo [MASTER] ********* SOW BINLOG EVENTS IN ...  *********
+let $binary_log_file= master-bin.000001;
+-- source include/show_binlog_events.inc
+
+-- echo [MASTER] ********* SOW BINLOG EVENTS         *********
+let $binary_log_file= ;
+-- source include/show_binlog_events.inc
+
+-- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows  *********
+let $binary_log_file= ;
+let $binary_log_limit_row= 3;
+-- source include/show_binlog_events.inc
+
+-- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows  *********
+let $binary_log_file= ;
+let $binary_log_limit_row= 3;
+let $binary_log_limit_offset= 1;
+-- source include/show_binlog_events.inc
+
+# clear show_binlog_event/show_relaylog_events parameters
+let $binary_log_file= ;
+let $binary_log_limit_row= ;
+let $binary_log_limit_offset= ;
+
+-- sync_slave_with_master
+
+-- echo [SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
+let $binary_log_file= slave-bin.000001;
+-- source include/show_binlog_events.inc
+
+-- echo [SLAVE] ********* SOW BINLOG EVENTS          *********
+let $binary_log_file= ;
+-- source include/show_binlog_events.inc
+
+-- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows  *********
+let $binary_log_file= ;
+let $binary_log_limit_row= 3;
+-- source include/show_binlog_events.inc
+
+-- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows  *********
+let $binary_log_file= ;
+let $binary_log_limit_row= 3;
+let $binary_log_limit_offset= 1;
+-- source include/show_binlog_events.inc
+
+# clear show_binlog_event/show_relaylog_events parameters
+let $binary_log_file= ;
+let $binary_log_limit_row= ;
+let $binary_log_limit_offset= ;
+
+-- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
+let $binary_log_file= slave-relay-bin.000003;
+-- source include/show_relaylog_events.inc
+
+-- echo [SLAVE] ********* SOW RELAYLOG EVENTS        *********
+let $binary_log_file= ;
+-- source include/show_relaylog_events.inc
+
+-- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows  *********
+let $binary_log_file= slave-relay-bin.000003;
+let $binary_log_limit_row= 3;
+let $binary_log_limit_offset= ;
+-- source include/show_relaylog_events.inc
+
+-- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows  *********
+let $binary_log_file= slave-relay-bin.000003;
+let $binary_log_limit_offset= 1;
+let $binary_log_limit_row= 3;
+-- source include/show_relaylog_events.inc
+
+FLUSH LOGS;
+
+-- connection master
+FLUSH LOGS;
+DROP TABLE t1;
+
+# clear show_binlog_event/show_relaylog_events parameters
+let $binary_log_file= ;
+let $binary_log_limit_row= ;
+let $binary_log_limit_offset= ;
+
+-- echo [MASTER] ********* SOW BINLOG EVENTS IN ...  *********
+let $binary_log_file= master-bin.000002;
+-- source include/show_binlog_events.inc
+
+-- echo [MASTER] ********* SOW BINLOG EVENTS         *********
+let $binary_log_file= ;
+-- source include/show_binlog_events.inc
+
+-- sync_slave_with_master
+
+-- echo [SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
+let $binary_log_file= slave-bin.000002;
+-- source include/show_binlog_events.inc
+
+-- echo [SLAVE] ********* SOW BINLOG EVENTS          *********
+let $binary_log_file= ;
+-- source include/show_binlog_events.inc
+
+-- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
+let $binary_log_file= slave-relay-bin.000005;
+-- source include/show_relaylog_events.inc
+
+-- echo [SLAVE] ********* SOW RELAYLOG EVENTS        *********
+let $binary_log_file= ;
+-- source include/show_relaylog_events.inc
+
+# clear show_binlog_event/show_relaylog_events parameters
+let $binary_log_name= ;
+let $binary_log_limit_row= ;
+let $binary_log_limit_offset= ;

=== renamed file 'mysql-test/include/have_community_features.inc' => 'mysql-test/include/have_profiling.inc'
--- a/mysql-test/include/have_community_features.inc	2008-07-04 18:48:25 +0000
+++ b/mysql-test/include/have_profiling.inc	2009-06-10 07:55:29 +0000
@@ -1,4 +1,4 @@
---require r/have_community_features.require
+--require r/have_profiling.require
 --disable_query_log
-show variables like 'have_community_features';
+show variables like 'have_profiling';
 --enable_query_log

=== added file 'mysql-test/include/have_semisync_plugin.inc'
--- a/mysql-test/include/have_semisync_plugin.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/have_semisync_plugin.inc	2009-06-17 10:37:04 +0000
@@ -0,0 +1,15 @@
+#
+# Check if dynamic loading is supported
+#
+--require r/have_dynamic_loading.require
+disable_query_log;
+show variables like 'have_dynamic_loading';
+enable_query_log;
+
+#
+# Check if the variable SEMISYNC_MASTER_PLUGIN is set
+#
+if (`select LENGTH('$SEMISYNC_MASTER_PLUGIN') = 0`)
+{
+  skip Need semisync plugins;
+}

=== modified file 'mysql-test/include/show_binlog_events.inc'
--- a/mysql-test/include/show_binlog_events.inc	2008-09-06 07:22:50 +0000
+++ b/mysql-test/include/show_binlog_events.inc	2009-05-13 11:04:33 +0000
@@ -1,10 +1,35 @@
 # $binlog_start can be set by caller or take a default value
+# $binary_log_file the name of the log file show
+# $binary_log_limit_row - sets the number of binlog rows to be returned
+# $binary_log_limit_offset - sets the offset where to start returning events
+
+let $show_binlog_events= show binlog events;
 
 if (!$binlog_start)
 {
+  # defaults to chop the first event in the binary log
   let $binlog_start=107;
 }
+
+if (!`SELECT '$binary_log_file' = ''`)
+{
+    let $show_binlog_events= $show_binlog_events in '$binary_log_file';
+}
+let $show_binlog_events= $show_binlog_events from $binlog_start;
+
+if ($binary_log_limit_row)
+{
+  let $limit= limit;
+  if ($binary_log_limit_offset)
+  {
+    let $limit= $limit $binary_log_limit_offset, ;
+  }
+
+  let $limit= $limit $binary_log_limit_row;

+  let $show_binlog_events= $show_binlog_events $limit;
+}
+
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start>
 --replace_column 2 # 4 # 5 #
 --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
---eval show binlog events from $binlog_start
+--eval $show_binlog_events

=== added file 'mysql-test/include/show_relaylog_events.inc'
--- a/mysql-test/include/show_relaylog_events.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/show_relaylog_events.inc	2009-05-13 11:04:33 +0000
@@ -0,0 +1,35 @@
+# $binlog_start can be set by caller or take a default value
+# $binary_log_file the name of the log file show
+# $binary_log_limit_row - sets the number of binlog rows to be returned

+# $binary_log_limit_offset - sets the offset where to start returning events
+
+let $show_binlog_events= show relaylog events;
+
+if (!$binlog_start)
+{
+  # defaults to chop the first event in the binary log
+  let $binlog_start=107;
+}
+
+if (!`SELECT '$binary_log_file' = ''`)
+{
+    let $show_binlog_events= $show_binlog_events in '$binary_log_file';
+}
+let $show_binlog_events= $show_binlog_events from $binlog_start;
+
+if ($binary_log_limit_row)
+{
+  let $limit= limit;
+  if ($binary_log_limit_offset)
+  {
+    let $limit= $limit $binary_log_limit_offset, ;
+  }
+
+  let $limit= $limit $binary_log_limit_row;
+  let $show_binlog_events= $show_binlog_events $limit;
+}
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start>
+--replace_column 2 # 4 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /Server ver:.*$/SERVER_VERSION, BINLOG_VERSION/
+--eval $show_binlog_events

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2009-06-09 14:36:52 +0000
+++ b/mysql-test/mysql-test-run.pl	2009-06-18 08:23:14 +0000
@@ -1816,6 +1816,26 @@ sub environment_setup {
     $ENV{'EXAMPLE_PLUGIN_LOAD'}="";
   }
 
+  # --------------------------------------------------------------------------
+  # Add the path where mysqld will find semisync plugins
+  # --------------------------------------------------------------------------
+  my $lib_semisync_master_plugin=
+      mtr_file_exists("$basedir/plugin/semisync/.libs/libsemisync_master.so");
+  my $lib_semisync_slave_plugin=
+      mtr_file_exists("$basedir/plugin/semisync/.libs/libsemisync_slave.so");
+  if ($lib_semisync_master_plugin && $lib_semisync_slave_plugin)
+  {
+    $ENV{'SEMISYNC_MASTER_PLUGIN'}= basename($lib_semisync_master_plugin);
+    $ENV{'SEMISYNC_SLAVE_PLUGIN'}= basename($lib_semisync_slave_plugin);
+    $ENV{'SEMISYNC_PLUGIN_OPT'}= "--plugin-dir=".dirname($lib_semisync_master_plugin);
+  }
+  else
+  {
+    $ENV{'SEMISYNC_MASTER_PLUGIN'}= "";
+    $ENV{'SEMISYNC_SLAVE_PLUGIN'}= "";
+    $ENV{'SEMISYNC_PLUGIN_OPT'}="";
+  }
+
   # ----------------------------------------------------
   # Add the path where mysqld will find mypluglib.so
   # ----------------------------------------------------

=== modified file 'mysql-test/r/alter_table.result'
--- a/mysql-test/r/alter_table.result	2009-02-13 16:30:54 +0000
+++ b/mysql-test/r/alter_table.result	2009-06-24 09:53:11 +0000
@@ -1277,3 +1277,7 @@ DROP i,
 ADD i INT UNSIGNED NOT NULL AUTO_INCREMENT,
 AUTO_INCREMENT = 1;
 DROP TABLE t1;
+CREATE TABLE t1 (id int);
+INSERT INTO t1 VALUES (1), (2);
+ALTER TABLE t1 ADD COLUMN (f1 INT), ADD COLUMN (f2 INT), ADD KEY f2k(f2);
+DROP TABLE t1;

=== modified file 'mysql-test/r/create.result'
--- a/mysql-test/r/create.result	2009-03-17 15:50:17 +0000
+++ b/mysql-test/r/create.result	2009-05-28 21:29:31 +0000
@@ -1900,3 +1900,37 @@ create table `me:i`(id int);
 drop table `me:i`;
 
 End of 5.1 tests
+
+# --
+# -- Bug #43054 	Assertion `!table->auto_increment_field_not_null' 
+# --       failed when redefining trigger
+
+CREATE TABLE B (
+pk INTEGER AUTO_INCREMENT,
+int_key INTEGER NOT NULL,
+PRIMARY KEY (pk),
+KEY (int_key)
+);
+INSERT IGNORE INTO B VALUES ('9', '9');
+CREATE TABLE IF NOT EXISTS t1 ( 
+`pk` INTEGER NOT NULL AUTO_INCREMENT , 
+`int` INTEGER ,
+PRIMARY KEY ( `pk` ) 
+) SELECT `pk` , `int_key` FROM B ;
+CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW 
+BEGIN 
+INSERT INTO t1 ( `int` ) VALUES (4 ),( 8 ),( 2 ) ; 
+END ; |
+CREATE TABLE IF NOT EXISTS t1 ( 
+`pk` INTEGER NOT NULL AUTO_INCREMENT , 
+`int` INTEGER ,
+PRIMARY KEY ( `pk` ) 
+) SELECT `pk` , `int_key` FROM B ;
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW 
+BEGIN 
+UPDATE A SET `pk`=1 WHERE `pk`=0 ; 
+END ;|
+ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
+DROP TABLE t1;
+DROP TABLE B;

=== modified file 'mysql-test/r/debug_sync.result'
--- a/mysql-test/r/debug_sync.result	2009-06-08 14:58:33 +0000
+++ b/mysql-test/r/debug_sync.result	2009-06-12 02:01:08 +0000
@@ -228,7 +228,7 @@ GRANT ALL ON *.* TO mysqltest_2@localhos
 REVOKE SUPER ON *.* FROM mysqltest_2@localhost;
 connection con1, mysqltest_2
 SET DEBUG_SYNC= 'RESET';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 connection default
 DROP USER mysqltest_2@localhost;
 SET DEBUG_SYNC= 'RESET';

=== modified file 'mysql-test/r/events_bugs.result'
--- a/mysql-test/r/events_bugs.result	2009-05-13 08:42:27 +0000
+++ b/mysql-test/r/events_bugs.result	2009-06-17 07:30:19 +0000
@@ -77,7 +77,7 @@ set sql_mode='traditional';
 alter event e_16407 do select 1;
 select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
 event_schema	event_name	sql_mode
-events_test	e_16407	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+events_test	e_16407	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 drop event e_16407;
 set sql_mode="ansi";
 select get_lock('ee_16407_2', 60);
@@ -114,8 +114,8 @@ insert into events_test.events_smode_tes
 end|
 select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
 event_schema	event_name	sql_mode
-events_test	ee_16407_2	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
-events_test	ee_16407_3	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+events_test	ee_16407_2	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+events_test	ee_16407_3	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 events_test	ee_16407_4	
 select /*2*/ user, host, db, info from information_schema.processlist
 where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)';
@@ -138,8 +138,8 @@ ee_16407_4	0000-00-00
 "OK, last check before we drop them"
 select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
 event_schema	event_name	sql_mode
-events_test	ee_16407_2	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
-events_test	ee_16407_3	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+events_test	ee_16407_2	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+events_test	ee_16407_3	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 events_test	ee_16407_4	
 drop event ee_16407_2;
 drop event ee_16407_3;
@@ -185,8 +185,8 @@ ee_16407_6	2004-02-29
 "And here we check one more time before we drop the events"
 select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
 event_schema	event_name	sql_mode
-events_test	ee_16407_5	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
-events_test	ee_16407_6	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+events_test	ee_16407_5	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+events_test	ee_16407_6	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 drop event ee_16407_5;
 drop event ee_16407_6;
 drop procedure ee_16407_5_pendant;
@@ -375,7 +375,7 @@ SELECT event_name, definer FROM INFORMAT
 event_name	definer
 e1	mysqltest_u1@localhost
 ALTER DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 HOUR;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
 event_name	definer
 e1	mysqltest_u1@localhost
@@ -386,7 +386,7 @@ event_name	definer
 e1	mysqltest_u1@localhost
 DROP EVENT e1;
 CREATE DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 DROP EVENT e1;
 ERROR HY000: Unknown event 'e1'
 DROP USER mysqltest_u1@localhost;

=== modified file 'mysql-test/r/grant.result'
--- a/mysql-test/r/grant.result	2009-05-29 15:06:21 +0000
+++ b/mysql-test/r/grant.result	2009-06-17 07:30:19 +0000
@@ -2101,3 +2101,26 @@ DROP USER mysqltest_u1@localhost;
 
 # End of Bug#38347.
 
+#
+# Bug #25863 No database selected error, but documentation 
+#            says * for global allowed
+#
+GRANT ALL ON * TO mysqltest_1;
+ERROR 3D000: No database selected
+GRANT ALL ON *.* TO mysqltest_1;
+SHOW GRANTS FOR mysqltest_1;
+Grants for mysqltest_1@%
+GRANT ALL PRIVILEGES ON *.* TO 'mysqltest_1'@'%'
+DROP USER mysqltest_1;
+USE test;
+GRANT ALL ON * TO mysqltest_1;
+SHOW GRANTS FOR mysqltest_1;
+Grants for mysqltest_1@%
+GRANT USAGE ON *.* TO 'mysqltest_1'@'%'
+GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'%'
+DROP USER mysqltest_1;
+GRANT ALL ON *.* TO mysqltest_1;
+SHOW GRANTS FOR mysqltest_1;
+Grants for mysqltest_1@%
+GRANT ALL PRIVILEGES ON *.* TO 'mysqltest_1'@'%'
+DROP USER mysqltest_1;

=== modified file 'mysql-test/r/grant2.result'
--- a/mysql-test/r/grant2.result	2009-02-27 08:20:47 +0000
+++ b/mysql-test/r/grant2.result	2009-05-21 06:25:17 +0000
@@ -121,9 +121,9 @@ mysqltest_5@host5, mysqltest_6@host6, my
 create database mysqltest_1;
 grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost;
 set sql_log_off = 1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 set sql_log_bin = 0;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 delete from mysql.user where user like 'mysqltest\_1';
 delete from mysql.db where user like 'mysqltest\_1';
 drop database mysqltest_1;

=== renamed file 'mysql-test/r/have_community_features.require' => 'mysql-test/r/have_profiling.require'
--- a/mysql-test/r/have_community_features.require	2007-05-02 18:13:33 +0000
+++ b/mysql-test/r/have_profiling.require	2009-06-10 07:55:29 +0000
@@ -1,2 +1,2 @@
 Variable_name	Value
-have_community_features	YES
+have_profiling  YES

=== modified file 'mysql-test/r/information_schema_db.result'
--- a/mysql-test/r/information_schema_db.result	2009-05-15 15:59:57 +0000
+++ b/mysql-test/r/information_schema_db.result	2009-06-12 02:01:08 +0000
@@ -124,7 +124,7 @@ grant insert on v1 to testdb_2@localhost
 create view v5 as select f1 from t1;
 grant select, show view on v5 to testdb_2@localhost;
 create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 use testdb_1;
 create view v6 as select f1 from t1;
 grant select, show view on v6 to testdb_2@localhost;

=== modified file 'mysql-test/r/information_schema_routines.result'
--- a/mysql-test/r/information_schema_routines.result	2009-06-02 13:04:43 +0000
+++ b/mysql-test/r/information_schema_routines.result	2009-06-16 07:41:38 +0000
@@ -28,7 +28,7 @@ ROUTINES	CREATE TEMPORARY TABLE `ROUTINE
   `CREATED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
   `LAST_ALTERED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
   `SQL_MODE` varchar(8192) NOT NULL DEFAULT '',
-  `ROUTINE_COMMENT` varchar(64) NOT NULL DEFAULT '',
+  `ROUTINE_COMMENT` longtext NOT NULL,
   `DEFINER` varchar(77) NOT NULL DEFAULT '',
   `CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '',
   `COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '',
@@ -568,16 +568,16 @@ TABLE_SCHEMA	information_schema
 TABLE_NAME	routines
 COLUMN_NAME	ROUTINE_COMMENT
 ORDINAL_POSITION	26
-COLUMN_DEFAULT	
+COLUMN_DEFAULT	NULL
 IS_NULLABLE	NO
-DATA_TYPE	varchar
-CHARACTER_MAXIMUM_LENGTH	64
-CHARACTER_OCTET_LENGTH	192
+DATA_TYPE	longtext
+CHARACTER_MAXIMUM_LENGTH	4294967295
+CHARACTER_OCTET_LENGTH	4294967295
 NUMERIC_PRECISION	NULL
 NUMERIC_SCALE	NULL
 CHARACTER_SET_NAME	utf8
 COLLATION_NAME	utf8_general_ci
-COLUMN_TYPE	varchar(64)
+COLUMN_TYPE	longtext
 COLUMN_KEY	
 EXTRA	
 PRIVILEGES	#
@@ -695,7 +695,7 @@ SECURITY_TYPE	varchar(7)	NO			
 CREATED	datetime	NO		0000-00-00 00:00:00	
 LAST_ALTERED	datetime	NO		0000-00-00 00:00:00	
 SQL_MODE	varchar(8192)	NO			
-ROUTINE_COMMENT	varchar(64)	NO			
+ROUTINE_COMMENT	longtext	NO		NULL	
 DEFINER	varchar(77)	NO			
 CHARACTER_SET_CLIENT	varchar(32)	NO			
 COLLATION_CONNECTION	varchar(32)	NO			

=== modified file 'mysql-test/r/mysqldump.result'
--- a/mysql-test/r/mysqldump.result	2009-05-29 16:22:30 +0000
+++ b/mysql-test/r/mysqldump.result	2009-06-17 07:30:19 +0000
@@ -2392,7 +2392,7 @@ trg3	UPDATE	t1	begin
 if new.a = -1 then
 set @fired:= "Yes";
 end if;
-end	AFTER	0000-00-00 00:00:00	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	root@localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
+end	AFTER	0000-00-00 00:00:00	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	root@localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
 INSERT INTO t1 (a) VALUES (1),(2),(3),(22);
 update t1 set a = 4 where a=3;
 
@@ -2469,7 +2469,7 @@ DELIMITER ;
 /*!50003 SET character_set_results = latin1 */ ;
 /*!50003 SET collation_connection  = latin1_swedish_ci */ ;
 /*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
-/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER' */ ;
+/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
 DELIMITER ;;
 /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg3 after update on t1 for each row
 begin
@@ -2501,7 +2501,7 @@ UNLOCK TABLES;
 /*!50003 SET character_set_results = latin1 */ ;
 /*!50003 SET collation_connection  = latin1_swedish_ci */ ;
 /*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
-/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER' */ ;
+/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
 DELIMITER ;;
 /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg4 before insert on t2 for each row
 begin
@@ -2595,12 +2595,12 @@ trg3	UPDATE	t1	begin
 if new.a = -1 then
 set @fired:= "Yes";
 end if;
-end	AFTER	#	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	root@localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
+end	AFTER	#	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	root@localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
 trg4	INSERT	t2	begin
 if new.a > 10 then
 set @fired:= "No";
 end if;
-end	BEFORE	#	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	root@localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
+end	BEFORE	#	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	root@localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
 DROP TABLE t1, t2;
 #
 # Bug#9136  my_print_defaults changed behaviour between 4.1.7 and 4.1.10a
@@ -3555,11 +3555,11 @@ use test;
 create user mysqltest_1@localhost;
 create table t1(a int, b varchar(34));
 reset master;
-mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need the RELOAD privilege for this operation (1227)
-mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need the RELOAD privilege for this operation (1227)
+mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227)
+mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227)
 grant RELOAD on *.* to mysqltest_1@localhost;
-mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER|REPLICATION CLIENT privilege for this operation (1227)
-mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER|REPLICATION CLIENT privilege for this operation (1227)
+mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation (1227)
+mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation (1227)
 grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
 drop table t1;
 drop user mysqltest_1@localhost;

=== modified file 'mysql-test/r/show_check.result'
--- a/mysql-test/r/show_check.result	2009-06-02 13:04:43 +0000
+++ b/mysql-test/r/show_check.result	2009-06-16 07:41:38 +0000
@@ -1119,7 +1119,7 @@ def	information_schema	ROUTINES	ROUTINES
 def	information_schema	ROUTINES	ROUTINES	SQL_PATH	SQL_PATH	253	192	0	Y	0	0	33
 def	information_schema	ROUTINES	ROUTINES	SECURITY_TYPE	SECURITY_TYPE	253	21	7	N	1	0	33
 def	information_schema	ROUTINES	ROUTINES	SQL_MODE	SQL_MODE	253	24576	0	N	1	0	33
-def	information_schema	ROUTINES	ROUTINES	ROUTINE_COMMENT	ROUTINE_COMMENT	253	192	0	N	1	0	33
+def	information_schema	ROUTINES	ROUTINES	ROUTINE_COMMENT	ROUTINE_COMMENT	252	589815	0	N	17	0	33
 def	information_schema	ROUTINES	ROUTINES	DEFINER	DEFINER	253	231	14	N	1	0	33
 SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	SQL_MODE	ROUTINE_COMMENT	DEFINER
 p1	def	test	p1	PROCEDURE	NULL	SQL	SELECT 1	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER			root@localhost
@@ -1174,7 +1174,7 @@ def	information_schema	ROUTINES	ROUTINES
 def	information_schema	ROUTINES	ROUTINES	SQL_PATH	SQL_PATH	253	192	0	Y	0	0	33
 def	information_schema	ROUTINES	ROUTINES	SECURITY_TYPE	SECURITY_TYPE	253	21	7	N	1	0	33
 def	information_schema	ROUTINES	ROUTINES	SQL_MODE	SQL_MODE	253	24576	0	N	1	0	33
-def	information_schema	ROUTINES	ROUTINES	ROUTINE_COMMENT	ROUTINE_COMMENT	253	192	0	N	1	0	33
+def	information_schema	ROUTINES	ROUTINES	ROUTINE_COMMENT	ROUTINE_COMMENT	252	589815	0	N	17	0	33
 def	information_schema	ROUTINES	ROUTINES	DEFINER	DEFINER	253	231	14	N	1	0	33
 SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	SQL_MODE	ROUTINE_COMMENT	DEFINER
 f1	def	test	f1	FUNCTION	int(11)	SQL	RETURN 1	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER			root@localhost

=== modified file 'mysql-test/r/sp-security.result'
--- a/mysql-test/r/sp-security.result	2009-03-06 14:56:17 +0000
+++ b/mysql-test/r/sp-security.result	2009-05-21 06:25:17 +0000
@@ -349,9 +349,9 @@ CREATE FUNCTION wl2897_f1() RETURNS INT 
 ---> connection: mysqltest_1_con
 USE mysqltest;
 CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 
 ---> connection: mysqltest_2_con
 use mysqltest;

=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result	2009-06-04 13:50:05 +0000
+++ b/mysql-test/r/sp.result	2009-06-17 07:30:19 +0000
@@ -7009,6 +7009,19 @@ DROP FUNCTION f2;
 DROP FUNCTION f3;
 DROP FUNCTION f4;
 DROP TABLE t1;
+DROP PROCEDURE IF EXISTS p1;
+CREATE PROCEDURE p1 ()
+COMMENT
+'12345678901234567890123456789012345678901234567890123456789012345678901234567890'
+BEGIN
+END;
+SELECT comment FROM mysql.proc WHERE name = "p1";
+comment
+12345678901234567890123456789012345678901234567890123456789012345678901234567890
+SELECT routine_comment FROM information_schema.routines WHERE routine_name = "p1";
+routine_comment
+12345678901234567890123456789012345678901234567890123456789012345678901234567890
+DROP PROCEDURE p1;
 # ------------------------------------------------------------------
 # -- End of 6.0 tests
 # ------------------------------------------------------------------

=== modified file 'mysql-test/r/sql_mode.result'
--- a/mysql-test/r/sql_mode.result	2008-02-24 12:58:07 +0000
+++ b/mysql-test/r/sql_mode.result	2009-06-05 07:56:52 +0000
@@ -506,3 +506,9 @@ mysqltest_32753@localhost
 set session sql_mode=@OLD_SQL_MODE;
 flush privileges;
 drop user mysqltest_32753@localhost;
+SET @org_mode=@@sql_mode;
+SET @@sql_mode='traditional';
+SELECT @@sql_mode LIKE '%NO_ENGINE_SUBSTITUTION%';
+@@sql_mode LIKE '%NO_ENGINE_SUBSTITUTION%'
+1
+SET sql_mode=@org_mode;

=== modified file 'mysql-test/r/strict.result'
--- a/mysql-test/r/strict.result	2009-03-06 12:24:03 +0000
+++ b/mysql-test/r/strict.result	2009-06-05 07:56:52 +0000
@@ -2,7 +2,7 @@ set @org_mode=@@sql_mode;
 set @@sql_mode='ansi,traditional';
 select @@sql_mode;
 @@sql_mode
-REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 DROP TABLE IF EXISTS t1, t2;
 CREATE TABLE t1 (col1 date);
 INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');

=== modified file 'mysql-test/r/system_mysql_db.result'
--- a/mysql-test/r/system_mysql_db.result	2009-03-11 21:22:33 +0000
+++ b/mysql-test/r/system_mysql_db.result	2009-06-02 11:59:00 +0000
@@ -204,7 +204,7 @@ proc	CREATE TABLE `proc` (
   `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
   `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
-  `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+  `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
   `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
   `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
   `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,

=== modified file 'mysql-test/r/trigger.result'
--- a/mysql-test/r/trigger.result	2009-03-27 13:03:00 +0000
+++ b/mysql-test/r/trigger.result	2009-06-16 12:27:49 +0000
@@ -2121,4 +2121,31 @@ Warning	1265	Data truncated for column '
 DROP TRIGGER trg1;
 DROP TRIGGER trg2;
 DROP TABLE t1;
+#
+# Bug#34453 Can't change size of file (Errcode: 1224)
+#
+DROP TRIGGER IF EXISTS t1_bi;
+DROP TRIGGER IF EXISTS t1_bd;
+DROP TABLE IF EXISTS t1;
+DROP TEMPORARY TABLE IF EXISTS t2;
+CREATE TABLE t1 (s1 INT);
+CREATE TEMPORARY TABLE t2 (s1 INT);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (0);
+CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t2;
+INSERT INTO t1 VALUES (0);
+INSERT INTO t1 VALUES (0);
+SELECT * FROM t1;
+s1
+0
+0
+SELECT * FROM t2;
+s1
+0
+0
+# Reported to give ERROR 14 (HY000): 
+# Can't change size of file (Errcode: 1224)
+# on Windows 
+DELETE FROM t1;
+DROP TABLE t1;
+DROP TEMPORARY TABLE t2;
 End of 6.0 tests.

=== modified file 'mysql-test/r/trigger_notembedded.result'
--- a/mysql-test/r/trigger_notembedded.result	2009-02-16 14:47:53 +0000
+++ b/mysql-test/r/trigger_notembedded.result	2009-05-21 06:25:17 +0000
@@ -117,7 +117,7 @@ CREATE DEFINER='mysqltest_inv'@'localhos
   TRIGGER trg1 BEFORE INSERT ON t1
 FOR EACH ROW
 SET @new_sum = 0;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 
 ---> connection: default
 use mysqltest_db1;

=== modified file 'mysql-test/r/view_grant.result'
--- a/mysql-test/r/view_grant.result	2009-05-15 13:45:06 +0000
+++ b/mysql-test/r/view_grant.result	2009-06-12 02:01:08 +0000
@@ -16,7 +16,7 @@ create table mysqltest.t2 (a int, b int)
 grant select on mysqltest.t1 to mysqltest_1@localhost;
 grant create view,select on test.* to mysqltest_1@localhost;
 create definer=root@localhost view v1 as select * from mysqltest.t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 create view v1 as select * from mysqltest.t1;
 alter view v1 as select * from mysqltest.t1;
 ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1'
@@ -783,7 +783,7 @@ ERROR 42000: CREATE VIEW command denied 
 ALTER VIEW v2 AS SELECT f2 FROM t1;
 ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table 'v2'
 ALTER VIEW v3 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 SHOW CREATE VIEW v3;
 View	Create View	character_set_client	collation_connection
 v3	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f1` AS `f1` from `t1`	latin1	latin1_swedish_ci
@@ -807,9 +807,9 @@ GRANT DROP, CREATE VIEW ON mysqltest_299
 GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost;
 GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost;
 ALTER VIEW v1 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 ALTER VIEW v2 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 ALTER VIEW v1 AS SELECT f2 FROM t1;
 ALTER VIEW v2 AS SELECT f2 FROM t1;
 ALTER VIEW v1 AS SELECT f1 FROM t1;

=== modified file 'mysql-test/suite/backup/r/backup_check_i_s.result'
--- a/mysql-test/suite/backup/r/backup_check_i_s.result	2009-05-04 05:27:25 +0000
+++ b/mysql-test/suite/backup/r/backup_check_i_s.result	2009-06-16 07:41:38 +0000
@@ -99,7 +99,7 @@ SECURITY_TYPE	varchar(7)	NO			
 CREATED	datetime	NO		0000-00-00 00:00:00	
 LAST_ALTERED	datetime	NO		0000-00-00 00:00:00	
 SQL_MODE	varchar(8192)	NO			

-ROUTINE_COMMENT	varchar(64)	NO			
+ROUTINE_COMMENT	longtext	NO		NULL	
 DEFINER	varchar(77)	NO			
 CHARACTER_SET_CLIENT	varchar(32)	NO			
 COLLATION_CONNECTION	varchar(32)	NO			

=== modified file 'mysql-test/suite/backup/r/backup_functions.result'
--- a/mysql-test/suite/backup/r/backup_functions.result	2009-03-05 20:05:02 +0000
+++ b/mysql-test/suite/backup/r/backup_functions.result	2009-06-05 07:56:52 +0000
@@ -99,7 +99,7 @@ square_area(11)
 showing objects and create statements.
 SHOW CREATE FUNCTION number_of_players;;
 Function	number_of_players
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 Create Function	CREATE DEFINER=`root`@`localhost` FUNCTION `number_of_players`() RETURNS int(11)
 BEGIN
 RETURN (SELECT COUNT(*) FROM players);
@@ -191,14 +191,14 @@ backup_id
 #
 SELECT @@SQL_MODE;
 @@SQL_MODE
-STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 showing objects and create statements
 SHOW CREATE DATABASE bup_sfs;;
 Database	bup_sfs
 Create Database	CREATE DATABASE `bup_sfs` /*!40100 DEFAULT CHARACTER SET latin1 */
 SHOW CREATE FUNCTION number_of_players;;
 Function	number_of_players
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 Create Function	CREATE DEFINER=`root`@`localhost` FUNCTION `number_of_players`() RETURNS int(11)
 BEGIN
 RETURN (SELECT COUNT(*) FROM players);
@@ -310,7 +310,7 @@ Database	bup_sfs
 Create Database	CREATE DATABASE "bup_sfs" /*!40100 DEFAULT CHARACTER SET latin1 */
 SHOW CREATE FUNCTION number_of_players;;
 Function	number_of_players
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 Create Function	CREATE DEFINER=`root`@`localhost` FUNCTION `number_of_players`() RETURNS int(11)
 BEGIN
 RETURN (SELECT COUNT(*) FROM players);
@@ -398,7 +398,7 @@ Database	bup_sfs
 Create Database	CREATE DATABASE "bup_sfs" /*!40100 DEFAULT CHARACTER SET latin1 */
 SHOW CREATE FUNCTION number_of_players;;
 Function	number_of_players
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 Create Function	CREATE DEFINER=`root`@`localhost` FUNCTION `number_of_players`() RETURNS int(11)
 BEGIN
 RETURN (SELECT COUNT(*) FROM players);
@@ -493,7 +493,7 @@ Database	bup_sfs
 Create Database	CREATE DATABASE `bup_sfs` /*!40100 DEFAULT CHARACTER SET latin1 */
 SHOW CREATE FUNCTION number_of_players;;
 Function	number_of_players
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 Create Function	CREATE DEFINER=`root`@`localhost` FUNCTION `number_of_players`() RETURNS int(11)
 BEGIN
 RETURN (SELECT COUNT(*) FROM players);

=== modified file 'mysql-test/suite/backup/r/backup_security.result'
--- a/mysql-test/suite/backup/r/backup_security.result	2008-12-10 23:50:10 +0000
+++ b/mysql-test/suite/backup/r/backup_security.result	2009-05-21 06:25:17 +0000
@@ -24,16 +24,16 @@ backup_id
 default: Connect as user with no rights and attempt backup and restore.
 no_rights: Attempting backup. Should fail with error 1227
 BACKUP DATABASE backup_test to 'bup_no_rights.bak';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 SHOW ERRORS;
 Level	Code	Message
-Error	1227	Access denied; you need the SUPER privilege for this operation
+Error	1227	Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 no_rights: Attempting restore. Should fail with error 1227
 RESTORE FROM 'bup_no_rights.bak';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 SHOW ERRORS;
 Level	Code	Message
-Error	1227	Access denied; you need the SUPER privilege for this operation
+Error	1227	Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 SELECT * FROM backup_test.t1;
 a
 01 Test #1 - super privilege

=== modified file 'mysql-test/suite/binlog/r/binlog_grant.result'
--- a/mysql-test/suite/binlog/r/binlog_grant.result	2008-09-09 10:19:31 +0000
+++ b/mysql-test/suite/binlog/r/binlog_grant.result	2009-05-21 06:25:17 +0000
@@ -13,16 +13,16 @@ set session sql_log_bin = 1;
 set global sql_log_bin = 1;
 ERROR HY000: Variable 'sql_log_bin' is a SESSION variable and can't be used with SET GLOBAL
 set session sql_log_bin = 1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 **** Variable BINLOG_FORMAT ****
 [root]
 set global binlog_format = row;
 set session binlog_format = row;
 [plain]
 set global binlog_format = row;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 set session binlog_format = row;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 **** Clean up ****
 set global binlog_format = @saved_binlog_format;
 drop user mysqltest_1@localhost;

=== modified file 'mysql-test/suite/binlog/r/binlog_tmp_table.result'
--- a/mysql-test/suite/binlog/r/binlog_tmp_table.result	2009-01-28 14:35:12 +0000
+++ b/mysql-test/suite/binlog/r/binlog_tmp_table.result	2009-06-18 04:03:12 +0000
@@ -1,3 +1,4 @@
+reset master;
 create table foo (a int);
 flush logs;
 create temporary table tmp1_foo like foo;

=== modified file 'mysql-test/suite/binlog/t/binlog_tmp_table.test'
--- a/mysql-test/suite/binlog/t/binlog_tmp_table.test	2009-01-31 21:47:50 +0000
+++ b/mysql-test/suite/binlog/t/binlog_tmp_table.test	2009-06-18 04:03:12 +0000
@@ -31,6 +31,8 @@ source include/have_binlog_format_mixed_
 connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
 connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
 
+reset master;
+
 create table foo (a int);
 
 flush logs;

=== modified file 'mysql-test/suite/federated/federated_server.result'
--- a/mysql-test/suite/federated/federated_server.result	2009-02-02 11:36:03 +0000
+++ b/mysql-test/suite/federated/federated_server.result	2009-05-21 06:25:17 +0000
@@ -197,13 +197,13 @@ select * from federated.t1;
 id	name
 1	this is legitimate
 alter server s1 options (database 'db_bogus');
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 flush tables;
 select * from federated.t1;
 id	name
 1	this is legitimate
 alter server s1 options (database 'db_bogus');
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 flush tables;
 select * from federated.t1;
 id	name
@@ -214,7 +214,7 @@ select * from federated.t1;
 id	name
 2	this is bogus
 drop server if exists 's1';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 create server 's1' foreign data wrapper 'mysql' options
 (HOST '127.0.0.1',
 DATABASE 'db_legitimate',
@@ -223,7 +223,7 @@ PASSWORD '',
 PORT SLAVE_PORT,
 SOCKET '',
 OWNER 'root');
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 drop server 's1';
 create server 's1' foreign data wrapper 'mysql' options
 (HOST '127.0.0.1',

=== modified file 'mysql-test/suite/funcs_1/r/innodb_storedproc_07.result'
--- a/mysql-test/suite/funcs_1/r/innodb_storedproc_07.result	2009-01-31 19:22:59 +0000
+++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_07.result	2009-06-12 09:37:59 +0000
@@ -80,7 +80,7 @@ CREATE TABLE result (f1 text(200), f2 ch
 set @@sql_mode='traditional';
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 CREATE PROCEDURE sp1()
 BEGIN
 declare a tinyint;
@@ -97,7 +97,7 @@ END if;
 END//
 SHOW CREATE PROCEDURE sp1;
 Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
-sp1	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`()
+sp1	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`()
 BEGIN
 declare a tinyint;
 declare count_ int default 1;
@@ -117,10 +117,10 @@ Variable_name	Value
 sql_mode	
 CALL sp1();
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 SELECT * from result;
 f1	f2
-STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	value restored
+STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	value restored
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
 sql_mode	
@@ -142,7 +142,7 @@ DROP PROCEDURE IF EXISTS sp2;
 ... show initial value
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 CREATE PROCEDURE sp2()
 BEGIN
 SET @@sql_mode='MAXDB';
@@ -150,7 +150,7 @@ SHOW VARIABLES LIKE 'sql_mode';
 END//
 SHOW CREATE PROCEDURE sp2;
 Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
-sp2	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`()
+sp2	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`()
 BEGIN
 SET @@sql_mode='MAXDB';
 SHOW VARIABLES LIKE 'sql_mode';
@@ -158,7 +158,7 @@ END	latin1	latin1_swedish_ci	latin1_swed
 ... show value prior calling procedure
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 ... call procedure that changes sql_mode
 CALL sp2();
 Variable_name	Value
@@ -166,7 +166,7 @@ sql_mode	PIPES_AS_CONCAT,ANSI_QUOTES,IGN
 ... check whether old value is re-set
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 DROP PROCEDURE sp2;
 
 --source suite/funcs_1/storedproc/cleanup_sp_tb.inc

=== modified file 'mysql-test/suite/funcs_1/r/innodb_trig_03e.result'
--- a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result	2008-08-07 13:38:29 +0000
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result	2009-05-21 06:25:17 +0000
@@ -1251,7 +1251,7 @@ drop trigger trg1_0;
 create definer=not_ex_user@localhost trigger trg1_0
 before INSERT on t1 for each row
 set new.f1 = 'trig 1_0-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 create definer=current_user trigger trg1_1
 before INSERT on t1 for each row
 set new.f1 = 'trig 1_1-yes';
@@ -1284,7 +1284,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON
 create definer=not_ex_user@localhost trigger trg1_3
 after UPDATE on t1 for each row
 set @var1 = 'trig 1_3-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 select current_user;
 current_user
 root@localhost

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_is.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result	2009-06-05 13:21:53 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result	2009-06-16 07:41:38 +0000
@@ -216,7 +216,7 @@ def	information_schema	ROUTINES	NUMERIC_
 def	information_schema	ROUTINES	PARAMETER_STYLE	18		NO	varchar	8	24	NULL	NULL	utf8	utf8_general_ci	varchar(8)			select		Default	Default
 def	information_schema	ROUTINES	ROUTINE_BODY	14		NO	varchar	8	24	NULL	NULL	utf8	utf8_general_ci	varchar(8)			select		Default	Default
 def	information_schema	ROUTINES	ROUTINE_CATALOG	2		NO	varchar	512	1536	NULL	NULL	utf8	utf8_general_ci	varchar(512)			select		Default	Default
-def	information_schema	ROUTINES	ROUTINE_COMMENT	26		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)			select		Default	Default
+def	information_schema	ROUTINES	ROUTINE_COMMENT	26	NULL	NO	longtext	4294967295	4294967295	NULL	NULL	utf8	utf8_general_ci	longtext			select		Default	Default
 def	information_schema	ROUTINES	ROUTINE_DEFINITION	15	NULL	YES	longtext	4294967295	4294967295	NULL	NULL	utf8	utf8_general_ci	longtext			select		Default	Default
 def	information_schema	ROUTINES	ROUTINE_NAME	4		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)			select		Default	Default
 def	information_schema	ROUTINES	ROUTINE_SCHEMA	3		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)			select		Default	Default
@@ -611,7 +611,7 @@ NULL	information_schema	ROUTINES	NUMERIC
 NULL	information_schema	ROUTINES	CREATED	datetime	NULL	NULL	NULL	NULL	datetime
 NULL	information_schema	ROUTINES	LAST_ALTERED	datetime	NULL	NULL	NULL	NULL	datetime
 3.0000	information_schema	ROUTINES	SQL_MODE	varchar	8192	24576	utf8	utf8_general_ci	varchar(8192)
-3.0000	information_schema	ROUTINES	ROUTINE_COMMENT	varchar	64	192	utf8	utf8_general_ci	varchar(64)
+1.0000	information_schema	ROUTINES	ROUTINE_COMMENT	longtext	4294967295	4294967295	utf8	utf8_general_ci	longtext
 3.0000	information_schema	ROUTINES	DEFINER	varchar	77	231	utf8	utf8_general_ci	varchar(77)
 3.0000	information_schema	ROUTINES	CHARACTER_SET_CLIENT	varchar	32	96	utf8	utf8_general_ci	varchar(32)
 3.0000	information_schema	ROUTINES	COLLATION_CONNECTION	varchar	32	96	utf8	utf8_general_ci	varchar(32)

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result	2009-06-05 13:21:53 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result	2009-06-12 09:37:59 +0000
@@ -136,7 +136,7 @@ def	mysql	proc	body	11	NULL	NO	longblob	
 def	mysql	proc	body_utf8	20	NULL	YES	longblob	4294967295	4294967295	NULL	NULL	NULL	NULL	longblob			select,insert,update,references		Default	Default
 def	mysql	proc	character_set_client	17	NULL	YES	char	32	96	NULL	NULL	utf8	utf8_bin	char(32)			select,insert,update,references		Default	Default
 def	mysql	proc	collation_connection	18	NULL	YES	char	32	96	NULL	NULL	utf8	utf8_bin	char(32)			select,insert,update,references		Default	Default
-def	mysql	proc	comment	16		NO	char	64	192	NULL	NULL	utf8	utf8_bin	char(64)			select,insert,update,references		Default	Default
+def	mysql	proc	comment	16	NULL	NO	text	65535	65535	NULL	NULL	utf8	utf8_bin	text			select,insert,update,references		Default	Default
 def	mysql	proc	created	13	CURRENT_TIMESTAMP	NO	timestamp	NULL	NULL	NULL	NULL	NULL	NULL	timestamp		on update CURRENT_TIMESTAMP	select,insert,update,references		Default	Default
 def	mysql	proc	db	1		NO	char	64	192	NULL	NULL	utf8	utf8_bin	char(64)	PRI		select,insert,update,references		Default	Default
 def	mysql	proc	db_collation	19	NULL	YES	char	32	96	NULL	NULL	utf8	utf8_bin	char(32)			select,insert,update,references		Default	Default
@@ -260,6 +260,7 @@ COL_CML	DATA_TYPE	CHARACTER_SET_NAME	COL
 1.0000	char	latin1	latin1_bin
 1.0000	char	latin1	latin1_swedish_ci
 1.0000	varchar	latin1	latin1_swedish_ci
+1.0000	text	utf8	utf8_bin
 1.0000	mediumtext	utf8	utf8_general_ci
 1.0000	text	utf8	utf8_general_ci
 SELECT DISTINCT
@@ -456,7 +457,7 @@ NULL	mysql	ndb_binlog_index	gci	int	NULL
 NULL	mysql	proc	created	timestamp	NULL	NULL	NULL	NULL	timestamp
 NULL	mysql	proc	modified	timestamp	NULL	NULL	NULL	NULL	timestamp
 3.0000	mysql	proc	sql_mode	set	478	1434	utf8	utf8_general_ci	set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH')
-3.0000	mysql	proc	comment	char	64	192	utf8	utf8_bin	char(64)
+1.0000	mysql	proc	comment	text	65535	65535	utf8	utf8_bin	text
 3.0000	mysql	proc	character_set_client	char	32	96	utf8	utf8_bin	char(32)
 3.0000	mysql	proc	collation_connection	char	32	96	utf8	utf8_bin	char(32)
 3.0000	mysql	proc	db_collation	char	32	96	utf8	utf8_bin	char(32)

=== modified file 'mysql-test/suite/funcs_1/r/is_routines.result'
--- a/mysql-test/suite/funcs_1/r/is_routines.result	2009-04-01 09:37:16 +0000
+++ b/mysql-test/suite/funcs_1/r/is_routines.result	2009-06-16 07:41:38 +0000
@@ -53,7 +53,7 @@ SECURITY_TYPE	varchar(7)	NO			
 CREATED	datetime	NO		0000-00-00 00:00:00	
 LAST_ALTERED	datetime	NO		0000-00-00 00:00:00	
 SQL_MODE	varchar(8192)	NO			
-ROUTINE_COMMENT	varchar(64)	NO			
+ROUTINE_COMMENT	longtext	NO		NULL	
 DEFINER	varchar(77)	NO			
 CHARACTER_SET_CLIENT	varchar(32)	NO			
 COLLATION_CONNECTION	varchar(32)	NO			
@@ -86,7 +86,7 @@ ROUTINES	CREATE TEMPORARY TABLE `ROUTINE
   `CREATED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
   `LAST_ALTERED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
   `SQL_MODE` varchar(8192) NOT NULL DEFAULT '',
-  `ROUTINE_COMMENT` varchar(64) NOT NULL DEFAULT '',
+  `ROUTINE_COMMENT` longtext NOT NULL,
   `DEFINER` varchar(77) NOT NULL DEFAULT '',
   `CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '',
   `COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '',
@@ -119,7 +119,7 @@ SECURITY_TYPE	varchar(7)	NO			
 CREATED	datetime	NO		0000-00-00 00:00:00	
 LAST_ALTERED	datetime	NO		0000-00-00 00:00:00	
 SQL_MODE	varchar(8192)	NO			
-ROUTINE_COMMENT	varchar(64)	NO			
+ROUTINE_COMMENT	longtext	NO		NULL	
 DEFINER	varchar(77)	NO			
 CHARACTER_SET_CLIENT	varchar(32)	NO			
 COLLATION_CONNECTION	varchar(32)	NO			

=== modified file 'mysql-test/suite/funcs_1/r/memory_storedproc_07.result'
--- a/mysql-test/suite/funcs_1/r/memory_storedproc_07.result	2009-01-31 19:22:59 +0000
+++ b/mysql-test/suite/funcs_1/r/memory_storedproc_07.result	2009-06-12 09:37:59 +0000
@@ -81,7 +81,7 @@ CREATE TABLE result (f1 text(200), f2 ch
 set @@sql_mode='traditional';
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 CREATE PROCEDURE sp1()
 BEGIN
 declare a tinyint;
@@ -98,7 +98,7 @@ END if;
 END//
 SHOW CREATE PROCEDURE sp1;
 Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
-sp1	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`()
+sp1	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`()
 BEGIN
 declare a tinyint;
 declare count_ int default 1;
@@ -118,10 +118,10 @@ Variable_name	Value
 sql_mode	
 CALL sp1();
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 SELECT * from result;
 f1	f2
-STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	value restored
+STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	value restored
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
 sql_mode	
@@ -143,7 +143,7 @@ DROP PROCEDURE IF EXISTS sp2;
 ... show initial value
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 CREATE PROCEDURE sp2()
 BEGIN
 SET @@sql_mode='MAXDB';
@@ -151,7 +151,7 @@ SHOW VARIABLES LIKE 'sql_mode';
 END//
 SHOW CREATE PROCEDURE sp2;
 Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
-sp2	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`()
+sp2	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`()
 BEGIN
 SET @@sql_mode='MAXDB';
 SHOW VARIABLES LIKE 'sql_mode';
@@ -159,7 +159,7 @@ END	latin1	latin1_swedish_ci	latin1_swed
 ... show value prior calling procedure
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 ... call procedure that changes sql_mode
 CALL sp2();
 Variable_name	Value
@@ -167,7 +167,7 @@ sql_mode	PIPES_AS_CONCAT,ANSI_QUOTES,IGN
 ... check whether old value is re-set
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 DROP PROCEDURE sp2;
 
 --source suite/funcs_1/storedproc/cleanup_sp_tb.inc

=== modified file 'mysql-test/suite/funcs_1/r/memory_trig_03e.result'
--- a/mysql-test/suite/funcs_1/r/memory_trig_03e.result	2008-08-07 13:38:29 +0000
+++ b/mysql-test/suite/funcs_1/r/memory_trig_03e.result	2009-05-21 06:25:17 +0000
@@ -1252,7 +1252,7 @@ drop trigger trg1_0;
 create definer=not_ex_user@localhost trigger trg1_0
 before INSERT on t1 for each row
 set new.f1 = 'trig 1_0-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 create definer=current_user trigger trg1_1
 before INSERT on t1 for each row
 set new.f1 = 'trig 1_1-yes';
@@ -1285,7 +1285,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON
 create definer=not_ex_user@localhost trigger trg1_3
 after UPDATE on t1 for each row
 set @var1 = 'trig 1_3-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 select current_user;
 current_user
 root@localhost

=== modified file 'mysql-test/suite/funcs_1/r/myisam_storedproc_07.result'
--- a/mysql-test/suite/funcs_1/r/myisam_storedproc_07.result	2009-01-31 19:22:59 +0000
+++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_07.result	2009-06-12 09:37:59 +0000
@@ -81,7 +81,7 @@ CREATE TABLE result (f1 text(200), f2 ch
 set @@sql_mode='traditional';
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 CREATE PROCEDURE sp1()
 BEGIN
 declare a tinyint;
@@ -98,7 +98,7 @@ END if;
 END//
 SHOW CREATE PROCEDURE sp1;
 Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
-sp1	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`()
+sp1	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`()
 BEGIN
 declare a tinyint;
 declare count_ int default 1;
@@ -118,10 +118,10 @@ Variable_name	Value
 sql_mode	
 CALL sp1();
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 SELECT * from result;
 f1	f2
-STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	value restored
+STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	value restored
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
 sql_mode	
@@ -143,7 +143,7 @@ DROP PROCEDURE IF EXISTS sp2;
 ... show initial value
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 CREATE PROCEDURE sp2()
 BEGIN
 SET @@sql_mode='MAXDB';
@@ -151,7 +151,7 @@ SHOW VARIABLES LIKE 'sql_mode';
 END//
 SHOW CREATE PROCEDURE sp2;
 Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
-sp2	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`()
+sp2	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`()
 BEGIN
 SET @@sql_mode='MAXDB';
 SHOW VARIABLES LIKE 'sql_mode';
@@ -159,7 +159,7 @@ END	latin1	latin1_swedish_ci	latin1_swed
 ... show value prior calling procedure
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 ... call procedure that changes sql_mode
 CALL sp2();
 Variable_name	Value
@@ -167,7 +167,7 @@ sql_mode	PIPES_AS_CONCAT,ANSI_QUOTES,IGN
 ... check whether old value is re-set
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 DROP PROCEDURE sp2;
 
 --source suite/funcs_1/storedproc/cleanup_sp_tb.inc

=== modified file 'mysql-test/suite/funcs_1/r/myisam_trig_03e.result'
--- a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result	2008-08-07 13:38:29 +0000
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result	2009-05-21 06:25:17 +0000
@@ -1252,7 +1252,7 @@ drop trigger trg1_0;
 create definer=not_ex_user@localhost trigger trg1_0
 before INSERT on t1 for each row
 set new.f1 = 'trig 1_0-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 create definer=current_user trigger trg1_1
 before INSERT on t1 for each row
 set new.f1 = 'trig 1_1-yes';
@@ -1285,7 +1285,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON
 create definer=not_ex_user@localhost trigger trg1_3
 after UPDATE on t1 for each row
 set @var1 = 'trig 1_3-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 select current_user;
 current_user
 root@localhost

=== modified file 'mysql-test/suite/funcs_1/r/ndb_storedproc_07.result'
--- a/mysql-test/suite/funcs_1/r/ndb_storedproc_07.result	2009-02-02 15:58:48 +0000
+++ b/mysql-test/suite/funcs_1/r/ndb_storedproc_07.result	2009-06-12 09:37:59 +0000
@@ -80,7 +80,7 @@ CREATE TABLE result (f1 text(200), f2 ch
 set @@sql_mode='traditional';
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 CREATE PROCEDURE sp1()
 BEGIN
 declare a tinyint;
@@ -97,7 +97,7 @@ END if;
 END//
 SHOW CREATE PROCEDURE sp1;
 Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
-sp1	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`()
+sp1	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`()
 BEGIN
 declare a tinyint;
 declare count_ int default 1;
@@ -117,10 +117,10 @@ Variable_name	Value
 sql_mode	
 CALL sp1();
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 SELECT * from result;
 f1	f2
-STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	value restored
+STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	value restored
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
 sql_mode	
@@ -142,7 +142,7 @@ DROP PROCEDURE IF EXISTS sp2;
 ... show initial value
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 CREATE PROCEDURE sp2()
 BEGIN
 SET @@sql_mode='MAXDB';
@@ -150,7 +150,7 @@ SHOW VARIABLES LIKE 'sql_mode';
 END//
 SHOW CREATE PROCEDURE sp2;
 Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
-sp2	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`()
+sp2	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`()
 BEGIN
 SET @@sql_mode='MAXDB';
 SHOW VARIABLES LIKE 'sql_mode';
@@ -158,7 +158,7 @@ END	latin1	latin1_swedish_ci	latin1_swed
 ... show value prior calling procedure
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 ... call procedure that changes sql_mode
 CALL sp2();
 Variable_name	Value
@@ -166,7 +166,7 @@ sql_mode	PIPES_AS_CONCAT,ANSI_QUOTES,IGN
 ... check whether old value is re-set
 SHOW VARIABLES LIKE 'sql_mode';
 Variable_name	Value
-sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+sql_mode	STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 DROP PROCEDURE sp2;
 
 --source suite/funcs_1/storedproc/cleanup_sp_tb.inc

=== modified file 'mysql-test/suite/funcs_1/r/ndb_trig_03e.result'
--- a/mysql-test/suite/funcs_1/r/ndb_trig_03e.result	2008-08-16 05:15:49 +0000
+++ b/mysql-test/suite/funcs_1/r/ndb_trig_03e.result	2009-05-21 06:25:17 +0000
@@ -1251,7 +1251,7 @@ drop trigger trg1_0;
 create definer=not_ex_user@localhost trigger trg1_0
 before INSERT on t1 for each row
 set new.f1 = 'trig 1_0-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 create definer=current_user trigger trg1_1
 before INSERT on t1 for each row
 set new.f1 = 'trig 1_1-yes';
@@ -1284,7 +1284,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON
 create definer=not_ex_user@localhost trigger trg1_3
 after UPDATE on t1 for each row
 set @var1 = 'trig 1_3-yes';
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 select current_user;
 current_user
 root@localhost

=== modified file 'mysql-test/suite/funcs_1/r/storedproc.result'
--- a/mysql-test/suite/funcs_1/r/storedproc.result	2009-02-23 16:45:39 +0000
+++ b/mysql-test/suite/funcs_1/r/storedproc.result	2009-06-12 09:37:59 +0000
@@ -22113,7 +22113,7 @@ f1
 2005-03-14 01:01:02
 SELECT @@sql_mode;
 @@sql_mode
-STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 DROP PROCEDURE sp2;
 drop table temp_table;
 

=== removed directory 'mysql-test/suite/im'
=== removed directory 'mysql-test/suite/im/r'
=== removed file 'mysql-test/suite/im/r/im_cmd_line.result'
--- a/mysql-test/suite/im/r/im_cmd_line.result	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/r/im_cmd_line.result	1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	XXXXX
-mysqld2	offline
---> Listing users...
-im_admin
-
-==> Adding user 'testuser'...
-
---> IM password file:
-testuser:*0D3CED9BEC10A777AEC23CCC353A8C08A633045E
-im_admin:*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295
---> EOF
-
---> Printing out line for 'testuser'...
-testuser:*0D3CED9BEC10A777AEC23CCC353A8C08A633045E
-
---> Listing users...
-im_admin
-testuser
-
-==> Changing the password of 'testuser'...
-
---> IM password file:
-im_admin:*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295
-testuser:*39C549BDECFBA8AFC3CE6B948C9359A0ECE08DE2
---> EOF
-
---> Printing out line for 'testuser'...
-testuser:*39C549BDECFBA8AFC3CE6B948C9359A0ECE08DE2
-
---> Listing users...
-testuser
-im_admin
-
-==> Dropping user 'testuser'...
-
---> IM password file:
-im_admin:*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295
---> EOF
-
---> Listing users...
-im_admin
-

=== removed file 'mysql-test/suite/im/r/im_daemon_life_cycle.result'
--- a/mysql-test/suite/im/r/im_daemon_life_cycle.result	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/r/im_daemon_life_cycle.result	1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	XXXXX
-mysqld2	offline
-Killing the process...
-Waiting...
-Success: the process was restarted.
-Success: server is ready to accept connection on socket.
-
---------------------------------------------------------------------
--- Test for BUG#12751
---------------------------------------------------------------------
-START INSTANCE mysqld2;
-Success: the process has been started.
-Killing the process...
-Waiting...
-Success: the process was restarted.
-Success: server is ready to accept connection on socket.
-SHOW INSTANCE STATUS mysqld1;
-instance_name	state	version_number	version	mysqld_compatible
-mysqld1	STATE	VERSION_NUMBER	VERSION	no
-STOP INSTANCE mysqld2;
-Success: the process has been stopped.

=== removed file 'mysql-test/suite/im/r/im_instance_conf.result'
--- a/mysql-test/suite/im/r/im_instance_conf.result	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/r/im_instance_conf.result	1970-01-01 00:00:00 +0000
@@ -1,225 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	XXXXX
-mysqld2	offline
---------------------------------------------------------------------
-server_id           = 1
-server_id           = 2
---------------------------------------------------------------------
-CREATE INSTANCE mysqld3

-server_id = 3,
-socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld3	offline
-mysqld2	offline
-mysqld1	online
---------------------------------------------------------------------
-server_id           = 1
-server_id           = 2
-server_id=3
---------------------------------------------------------------------
-CREATE INSTANCE mysqld1;
-ERROR HY000: Instance already exists
-CREATE INSTANCE mysqld2;
-ERROR HY000: Instance already exists
-CREATE INSTANCE mysqld3;
-ERROR HY000: Instance already exists
---------------------------------------------------------------------
-nonguarded
---------------------------------------------------------------------
-CREATE INSTANCE mysqld4
-nonguarded,
-server_id = 4,
-socket = "$MYSQL_TMP_DIR/mysqld_4.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld3	offline
-mysqld4	offline
-mysqld1	online
-mysqld2	offline
---------------------------------------------------------------------
-nonguarded
-nonguarded
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-CREATE INSTANCE mysqld5
-test-A = 000,
-test-B = test,
-server_id = 5,
-socket = "$MYSQL_TMP_DIR/mysqld_5.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld4	offline
-mysqld5	offline
-mysqld2	offline
-mysqld3	offline
---------------------------------------------------------------------
-test-A=000
---------------------------------------------------------------------
-test-B=test
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-CREATE INSTANCE mysqld6
-test-C1  =  10  ,
-test-C2  =  02  ,
-server_id = 6,
-socket = "$MYSQL_TMP_DIR/mysqld_6.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
---------------------------------------------------------------------
-test-C1=10
---------------------------------------------------------------------
-test-C2=02

---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-CREATE INSTANCE mysqld7  test-D  =  test-D-value  ;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-CREATE INSTANCE mysqld8  test-E  0  ;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-CREATE INSTANCE mysqld8  test-F  =  ;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-CREATE INSTANCE mysqld9
-test-1=" hello world ",
-test-2='  ',
-server_id = 9,
-socket = "$MYSQL_TMP_DIR/mysqld_9.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-mysqld9	offline
-CREATE INSTANCE mysqld10
-test-3='\b\babc\sdef',
-server_id = 10,
-socket = "$MYSQL_TMP_DIR/mysqld_10.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld9	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-mysqld10	offline
-mysqld2	offline
-CREATE INSTANCE mysqld11
-test-4='abc\tdef',
-test-5='abc\ndef',
-server_id = 11,
-socket = "$MYSQL_TMP_DIR/mysqld_11.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld11	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-mysqld10	offline
-mysqld2	offline
-mysqld9	offline
-CREATE INSTANCE mysqld12
-test-6="abc\rdef",
-test-7="abc\\def",
-server_id = 12,
-socket = "$MYSQL_TMP_DIR/mysqld_12.sock";
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld9	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-mysqld10	offline
-mysqld2	offline
-mysqld12	offline
-mysqld11	offline
-CREATE INSTANCE mysqld13 test-bad=' \ ';
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld9	offline
-mysqld5	offline
-mysqld6	offline
-mysqld3	offline
-mysqld4	offline
-mysqld10	offline
-mysqld2	offline
-mysqld12	offline
-mysqld11	offline
---------------------------------------------------------------------
-test-1= hello world 
---------------------------------------------------------------------
-test-2=  
---------------------------------------------------------------------
-test-3=abc def
---------------------------------------------------------------------
-test-4=abc	def
---------------------------------------------------------------------
-test-5=abc
---------------------------------------------------------------------
-test-6=abc
def
---------------------------------------------------------------------
-test-7=abc\def
---------------------------------------------------------------------
---------------------------------------------------------------------
-CREATE INSTANCE qqq1;
-ERROR HY000: Malformed instance name.

=== removed file 'mysql-test/suite/im/r/im_life_cycle.result'
--- a/mysql-test/suite/im/r/im_life_cycle.result	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/r/im_life_cycle.result	1970-01-01 00:00:00 +0000
@@ -1,73 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	XXXXX
-mysqld2	offline
-
---------------------------------------------------------------------
--- 1.1.2.
---------------------------------------------------------------------
-START INSTANCE mysqld2;
-Success: the process has been started.
-SHOW VARIABLES LIKE 'port';
-Variable_name	Value
-port	IM_MYSQLD2_PORT
-
---------------------------------------------------------------------
--- 1.1.3.
---------------------------------------------------------------------
-STOP INSTANCE mysqld2;
-Success: the process has been stopped.
-
---------------------------------------------------------------------
--- 1.1.4.
---------------------------------------------------------------------
-START INSTANCE mysqld3;
-ERROR HY000: Unknown instance name
-START INSTANCE mysqld1;
-ERROR HY000: The instance is already started
-
---------------------------------------------------------------------
--- 1.1.5.
---------------------------------------------------------------------
-STOP INSTANCE mysqld3;
-ERROR HY000: Unknown instance name
-
---------------------------------------------------------------------
--- 1.1.6.
---------------------------------------------------------------------
-Killing the process...
-Waiting...
-Success: the process was restarted.
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-
---------------------------------------------------------------------
--- 1.1.7.
---------------------------------------------------------------------
-START INSTANCE mysqld2;
-Success: the process has been started.
-Killing the process...
-Waiting...
-Success: the process was killed.
-
---------------------------------------------------------------------
--- 1.1.8.
---------------------------------------------------------------------
-SHOW INSTANCE STATUS;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-
---------------------------------------------------------------------
--- BUG#12813
---------------------------------------------------------------------
-START INSTANCE mysqld1,mysqld2,mysqld3;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-STOP INSTANCE mysqld1,mysqld2,mysqld3;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-STOP INSTANCE mysqld2;
-ERROR HY000: Cannot stop instance. Perhaps the instance is not started, or was started manually, so IM cannot find the pidfile.
-End of 5.0 tests

=== removed file 'mysql-test/suite/im/r/im_options.result'
--- a/mysql-test/suite/im/r/im_options.result	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/r/im_options.result	1970-01-01 00:00:00 +0000
@@ -1,151 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	XXXXX
-mysqld2	offline
-UNSET mysqld1.server_id;
-ERROR HY000: The instance is active. Stop the instance first
-SET mysqld1.server_id = 11;
-ERROR HY000: The instance is active. Stop the instance first
-CREATE INSTANCE mysqld3
-datadir = '/',
-server_id = 3,
-socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
-START INSTANCE mysqld3;
-UNSET mysqld3.server_id;
-ERROR HY000: The instance is active. Stop the instance first
-SET mysqld3.server_id = 11;
-ERROR HY000: The instance is active. Stop the instance first
-STOP INSTANCE mysqld3;
-SHOW INSTANCE STATUS mysqld3;
-instance_name	state	version_number	version	mysqld_compatible
-mysqld3	offline	VERSION_NUMBER	VERSION	no
-UNSET mysqld2.server_id;
-UNSET mysqld2.server_id;
-SHOW INSTANCE OPTIONS mysqld2;
-option_name	value
-instance_name	option_value
-socket	option_value
-pid-file	option_value
-port	option_value
-datadir	option_value
-log	option_value
-log-error	option_value
-log-slow-queries	option_value
-language	option_value
-character-sets-dir	option_value
-basedir	option_value
-shutdown-delay	option_value
-skip-stack-trace	option_value
-loose-skip-innodb	option_value
-loose-skip-ndbcluster	option_value
-nonguarded	option_value
-log-output	option_value
-SET mysqld2.server_id = 2;
-SET mysqld2.server_id = 2;
-SHOW INSTANCE OPTIONS mysqld2;
-option_name	value
-instance_name	option_value
-socket	option_value
-pid-file	option_value
-port	option_value
-datadir	option_value
-log	option_value
-log-error	option_value
-log-slow-queries	option_value
-language	option_value
-character-sets-dir	option_value
-basedir	option_value
-shutdown-delay	option_value
-skip-stack-trace	option_value
-loose-skip-innodb	option_value
-loose-skip-ndbcluster	option_value
-nonguarded	option_value
-log-output	option_value
-server_id	option_value
-UNSET mysqld2.server_id = 11;
-ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
-SET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc = 0010, mysqld3.ddd = 0020;
---------------------------------------------------------------------
-aaa
---------------------------------------------------------------------
-bbb
---------------------------------------------------------------------
-ccc=0010
---------------------------------------------------------------------
-ddd=0020
---------------------------------------------------------------------
-UNSET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc, mysqld3.ddd;
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-SET mysqld2.aaa, mysqld3.bbb, mysqld.ccc = 0010;
-ERROR HY000: Unknown instance name
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-SET mysqld2.aaa, mysqld3.bbb, mysqld1.ccc = 0010;
-ERROR HY000: The instance is active. Stop the instance first
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-UNSET mysqld2.server_id, mysqld3.server_id, mysqld.ccc;
-ERROR HY000: Unknown instance name
---------------------------------------------------------------------
-server_id           = 1
-server_id=2
-server_id=3
---------------------------------------------------------------------
-UNSET mysqld2.server_id, mysqld3.server_id, mysqld1.ccc;
-ERROR HY000: The instance is active. Stop the instance first
---------------------------------------------------------------------
-server_id           = 1
-server_id=2
-server_id=3
---------------------------------------------------------------------
-DROP INSTANCE mysqld3;
-SET mysqld2.server_id=222;
-SET mysqld2.server_id = 222;
-SET   mysqld2.server_id   =  222  ;
-SET   mysqld2  .  server_id  =  222  ;
-SET   mysqld2  .  server_id  =  222  , mysqld2  .  aaa  , mysqld2  .  bbb  ;
---------------------------------------------------------------------
-server_id           = 1
-server_id=222
---------------------------------------------------------------------
-aaa
---------------------------------------------------------------------
-bbb
---------------------------------------------------------------------
-UNSET mysqld2  . aaa  ,  mysqld2  .  bbb ;
---------------------------------------------------------------------
-server_id           = 1
-server_id=222
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
-server_id           = 1
-server_id=222
---------------------------------------------------------------------
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	online
-mysqld2	offline
-FLUSH INSTANCES;
-ERROR HY000: At least one instance is active. Stop all instances first
-STOP INSTANCE mysqld1;
-SHOW INSTANCES;
-instance_name	state
-mysqld1	offline
-mysqld2	offline
-FLUSH INSTANCES;

=== removed file 'mysql-test/suite/im/r/im_utils.result'
--- a/mysql-test/suite/im/r/im_utils.result	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/r/im_utils.result	1970-01-01 00:00:00 +0000
@@ -1,96 +0,0 @@
-SHOW VARIABLES LIKE 'server_id';
-Variable_name	Value
-server_id	1
-SHOW INSTANCES;
-instance_name	state
-mysqld1	XXXXX
-mysqld2	offline
-SHOW INSTANCE OPTIONS mysqld1;
-option_name	value
-instance_name	VALUE
-socket	VALUE
-pid-file	VALUE
-port	VALUE
-datadir	VALUE
-log	VALUE
-log-error	VALUE
-log-slow-queries	VALUE
-language	VALUE
-character-sets-dir	VALUE
-basedir	VALUE
-server_id	VALUE
-shutdown-delay	VALUE
-skip-stack-trace	VALUE
-loose-skip-innodb	VALUE
-loose-skip-ndbcluster	VALUE
-log-output	VALUE
-SHOW INSTANCE OPTIONS mysqld2;
-option_name	value
-instance_name	VALUE
-socket	VALUE
-pid-file	VALUE
-port	VALUE
-datadir	VALUE
-log	VALUE
-log-error	VALUE
-log-slow-queries	VALUE
-language	VALUE
-character-sets-dir	VALUE
-basedir	VALUE
-server_id	VALUE
-shutdown-delay	VALUE
-skip-stack-trace	VALUE
-loose-skip-innodb	VALUE
-loose-skip-ndbcluster	VALUE
-nonguarded	VALUE
-log-output	VALUE
-START INSTANCE mysqld2;
-Success: the process has been started.
-STOP INSTANCE mysqld2;
-Success: the process has been stopped.
-SHOW mysqld1 LOG FILES;
-Logfile	Path	File size
-ERROR LOG	PATH	FILE_SIZE
-GENERAL LOG	PATH	FILE_SIZE
-SLOW LOG	PATH	FILE_SIZE
-SHOW mysqld2 LOG FILES;
-Logfile	Path	File size
-ERROR LOG	PATH	FILE_SIZE
-GENERAL LOG	PATH	FILE_SIZE
-SLOW LOG	PATH	FILE_SIZE
-SHOW mysqld1 LOG ERROR 10;
-Log
-LOG_DATA
-SHOW mysqld1 LOG SLOW 10;
-Log
-LOG_DATA
-SHOW mysqld1 LOG GENERAL 10;
-Log
-LOG_DATA
-SHOW mysqld1 LOG ERROR 10, 2;
-Log

-LOG_DATA
-SHOW mysqld1 LOG SLOW 10, 2;
-Log
-LOG_DATA
-SHOW mysqld1 LOG GENERAL 10, 2;
-Log
-LOG_DATA
-SHOW mysqld2 LOG ERROR 10;
-Log
-LOG_DATA
-SHOW mysqld2 LOG SLOW 10;
-Log
-LOG_DATA
-SHOW mysqld2 LOG GENERAL 10;
-Log
-LOG_DATA
-SHOW mysqld2 LOG ERROR 10, 2;
-Log
-LOG_DATA
-SHOW mysqld2 LOG SLOW 10, 2;
-Log
-LOG_DATA
-SHOW mysqld2 LOG GENERAL 10, 2;
-Log
-LOG_DATA

=== removed directory 'mysql-test/suite/im/t'
=== removed file 'mysql-test/suite/im/t/disabled.def'
--- a/mysql-test/suite/im/t/disabled.def	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/disabled.def	1970-01-01 00:00:00 +0000
@@ -1,20 +0,0 @@
-##############################################################################
-#
-#  List the test cases that are to be disabled temporarily.
-#
-#  Separate the test case name and the comment with ':'.
-#
-#    <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
-#
-#  Do not use any TAB characters for whitespace.
-#
-##############################################################################
-im_options               : Bug#20294 2006-07-24 stewart   Instance manager test im_options fails randomly
-im_daemon_life_cycle     : Bug#20294 2007-05-14 alik      Instance manager tests fail randomly
-im_cmd_line              : Bug#20294 2007-05-14 alik      Instance manager tests fail randomly
-im_utils                 : Bug#20294 2007-05-30 alik      Instance manager tests fail randomly
-im_instance_conf         : Bug#20294 2007-05-30 alik      Instance manager tests fail randomly
-im_life_cycle            : BUG#27851 Instance manager dies on ASSERT in ~Thread_registry() or from not being able to close a mysqld instance.
-im_instance_conf         : BUG#28743 Instance manager generates warnings in test suite
-im_utils                 : BUG#28743 Instance manager generates warnings in test suite
-

=== removed file 'mysql-test/suite/im/t/im_check_env.inc'
--- a/mysql-test/suite/im/t/im_check_env.inc	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/im_check_env.inc	1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-# This file is intended to be used in each IM-test. It contains stamements,
-# that ensure that starting conditions (environment) for the IM-test are as
-# expected.
-
-# Check the running instances.
-
---connect (mysql1_con,localhost,root,,mysql,$IM_MYSQLD1_PORT,$IM_MYSQLD1_SOCK)
-
---connection mysql1_con
-
-SHOW VARIABLES LIKE 'server_id';
-
---source include/not_windows.inc
-
---connection default
-
-# Let IM detect that mysqld1 is online. This delay should be longer than
-# monitoring interval.
-
---sleep 2
-
-# Check that IM understands that mysqld1 is online, while mysqld2 is
-# offline.
-
---replace_result starting XXXXX online XXXXX
-SHOW INSTANCES;

=== removed file 'mysql-test/suite/im/t/im_cmd_line.imtest'
--- a/mysql-test/suite/im/t/im_cmd_line.imtest	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/im_cmd_line.imtest	1970-01-01 00:00:00 +0000
@@ -1,68 +0,0 @@
-###########################################################################
-#
-# Tests for user-management command-line options.
-#
-###########################################################################
-
---source suite/im/t/im_check_env.inc
-
-###########################################################################
-
-# List users so we are sure about starting conditions.
-
---echo --> Listing users...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --list-users 2>&1 >/dev/null
---echo
-
-# Add a new user.
-
---echo ==> Adding user 'testuser'...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --add-user --username=testuser --password=abc 2>&1 >/dev/null
---echo
-
---echo --> IM password file:
---exec cat $IM_PASSWORD_PATH
---echo --> EOF
---echo
-
---echo --> Printing out line for 'testuser'...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --print-password-line --username=testuser --password=abc | tail -2 | head -1
---echo
-
---echo --> Listing users...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --list-users 2>&1 >/dev/null
---echo
-
-# Edit user's attributes.
-
---echo ==> Changing the password of 'testuser'...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --edit-user --username=testuser --password=xyz 2>&1 >/dev/null
---echo
-
---echo --> IM password file:
---exec cat $IM_PASSWORD_PATH
---echo --> EOF
---echo
-
---echo --> Printing out line for 'testuser'...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --print-password-line --username=testuser --password=xyz | tail -2 | head -1
---echo
-
---echo --> Listing users...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --list-users 2>&1 >/dev/null
---echo
-
-# Drop user.
-
---echo ==> Dropping user 'testuser'...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --drop-user --username=testuser 2>&1 >/dev/null
---echo
-
---echo --> IM password file:
---exec cat $IM_PASSWORD_PATH
---echo --> EOF
---echo
-
---echo --> Listing users...
---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --list-users 2>&1 >/dev/null
---echo

=== removed file 'mysql-test/suite/im/t/im_daemon_life_cycle-im.opt'
--- a/mysql-test/suite/im/t/im_daemon_life_cycle-im.opt	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/im_daemon_life_cycle-im.opt	1970-01-01 00:00:00 +0000
@@ -1,3 +0,0 @@
---run-as-service
---log=$MYSQLTEST_VARDIR/log/im.log
---monitoring-interval=1

=== removed file 'mysql-test/suite/im/t/im_daemon_life_cycle.imtest'
--- a/mysql-test/suite/im/t/im_daemon_life_cycle.imtest	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/im_daemon_life_cycle.imtest	1970-01-01 00:00:00 +0000
@@ -1,100 +0,0 @@
-let $UTIL=$MYSQL_TEST_DIR/suite/im/t;
-
-###########################################################################
-#
-# This file contains test for (1.2) test suite.
-#
-# Consult WL#2789 for more information.
-#
-###########################################################################
-
---exec $UTIL/log.sh im_daemon_life_cycle im_daemon_life_cycle.imtest started.
-
-###########################################################################
-
---source suite/im/t/im_check_env.inc
-
-# Turn on reconnect, not on by default anymore.
---enable_reconnect
-
-###########################################################################
-#
-# The main daemon-life-cycle test case -- check that IM-angel will restart
-# IM-main if it got killed:
-#   - kill IM-main and check that IM-angel will restart it;
-#   - wait for IM-main to start accepting connections before continue test
-#     case;
-#
-# NOTE: timeout is 55 seconds. Timeout should be more than shutdown-delay
-# specified for managed MySQL instance. Now shutdown-delay is 10 seconds
-# (set in mysql-test-run.pl). So, 55 seconds should be enough to make 5
-# attempts.
-#
-###########################################################################
-
---exec $UTIL/log.sh im_daemon_life_cycle Main-test: starting...
-
---exec $UTIL/log.sh im_daemon_life_cycle Killing IM-main...
---exec $UTIL/kill_n_check.sh $IM_PATH_PID restarted 55 im_daemon_life_cycle
-
---exec $UTIL/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
---exec $UTIL/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 55 im_daemon_life_cycle
-
---exec $UTIL/log.sh im_daemon_life_cycle Main-test: done.
-
-###########################################################################
-#
-# BUG#12751: Instance Manager: client hangs
-#   - start nonguarded instance (mysqld2);
-#   - kill IM-main and get it restarted by IM-angel;
-#   - check that guarded instance (mysqld1) is accepting connections.
-#   - check that non-guarded instance (mysqld2) were not stopped.
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- Test for BUG#12751
---echo --------------------------------------------------------------------
-
---exec $UTIL/log.sh im_daemon_life_cycle BUG12751: starting...
-
-# 1. Start mysqld;
-
---exec $UTIL/log.sh im_daemon_life_cycle mysqld2: starting...
-START INSTANCE mysqld2;
-
---exec $UTIL/log.sh im_daemon_life_cycle mysqld2: waiting to start...
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 55 started im_daemon_life_cycle
-
---exec $UTIL/log.sh im_daemon_life_cycle mysqld2: started.
-
-# 2. Restart IM-main;
-
---exec $UTIL/log.sh im_daemon_life_cycle Killing IM-main...
---exec $UTIL/kill_n_check.sh $IM_PATH_PID restarted 55 im_daemon_life_cycle
-
---exec $UTIL/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
---exec $UTIL/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 55 im_daemon_life_cycle
-
-# 3. Issue some statement -- connection should be re-established.
-
---exec $UTIL/log.sh im_daemon_life_cycle Checking that IM-main processing commands...
-
---replace_column 2 STATE 3 VERSION_NUMBER 4 VERSION
-SHOW INSTANCE STATUS mysqld1;
-
-# 4. Stop mysqld2, because it will not be stopped by IM, as it is nonguarded.
-# So, if it we do not stop it, it will be stopped by mysql-test-run.pl with
-# warning.
-
---exec $UTIL/log.sh im_daemon_life_cycle mysqld2: stopping...
-STOP INSTANCE mysqld2;
-
---exec $UTIL/log.sh im_daemon_life_cycle mysqld2: waiting to stop...
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 55 stopped im_daemon_life_cycle
---exec $UTIL/log.sh im_daemon_life_cycle mysqld2: stopped.
-
-###########################################################################
-
---exec $UTIL/log.sh im_daemon_life_cycle BUG12751: done.

=== removed file 'mysql-test/suite/im/t/im_instance_conf-im.opt'
--- a/mysql-test/suite/im/t/im_instance_conf-im.opt	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/im_instance_conf-im.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---monitoring-interval=1

=== removed file 'mysql-test/suite/im/t/im_instance_conf.imtest'
--- a/mysql-test/suite/im/t/im_instance_conf.imtest	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/im_instance_conf.imtest	1970-01-01 00:00:00 +0000
@@ -1,244 +0,0 @@
-###########################################################################
-#
-# This test suite checks the following statements:
-#   - CREATE INSTANCE <instance_name> [option1[=option1_value], ...];
-#   - DROP INSTANCE <instance_name>;
-#
-# For CREATE INSTANCE we check that:
-#   - CREATE INSTANCE succeeds for non-existing instance;
-#   - CREATE INSTANCE fails for existing instance;
-#   - CREATE INSTANCE can get additional options with and w/o values;
-#   - CREATE INSTANCE parses options and handles grammar errors correctly.
-#     Check that strings with spaces are handled correctly, unknown (for
-#     mysqld) options should also be handled;
-#   - CREATE INSTANCE updates both config file and internal configuration cache;
-#   - CREATE INSTANCE allows to create instances only with properly formed
-#     names (mysqld*);
-#
-# For DROP INSTANCE we check that:
-#   - DROP INSTANCE succeeds for existing instance;
-#   - DROP INSTANCE fails for non-existing instance;
-#   - DROP INSTANCE fails for active instance.
-#   - DROP INSTANCE updates both config file and internal configuration cache;
-#
-# NOTE: each CREATE INSTANCE statement must specify socket-file-name, otherwise
-# this results of the test can be affected by another running test suite.
-#
-###########################################################################
-
---source suite/im/t/im_check_env.inc
-
-###########################################################################
-#
-# Check starting conditions.
-#
-###########################################################################
-
-# Check that the configuration file contains only instances that we expect.
-
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_\-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-###########################################################################
-#
-# CREATE INSTANCE tests.
-#
-###########################################################################
-
-# Check that CREATE INSTANCE succeeds for non-existing instance and also check
-# that both config file and internal configuration cache have been updated.
-
-CREATE INSTANCE mysqld3
-  server_id = 3,
-  socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
-
-SHOW INSTANCES;
- 
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-# Check that CREATE INSTANCE fails for existing instance. Let's all three
-# existing instances (running one, stopped one and just created one). Just in
-# case...
-
---error 3012 # ER_CREATE_EXISTING_INSTANCE
-CREATE INSTANCE mysqld1;
-
---error 3012 # ER_CREATE_EXISTING_INSTANCE
-CREATE INSTANCE mysqld2;
-
---error 3012 # ER_CREATE_EXISTING_INSTANCE
-CREATE INSTANCE mysqld3;
-
-# Check that CREATE INSTANCE can get additional options with and w/o values.
-# Ensure that config file is updated properly.
-
-#   - without values;
-
---echo --------------------------------------------------------------------
---exec grep "^nonguarded\$" $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-CREATE INSTANCE mysqld4
-  nonguarded,
-  server_id = 4,
-  socket = "$MYSQL_TMP_DIR/mysqld_4.sock";
-
-SHOW INSTANCES;
-
---echo --------------------------------------------------------------------
---exec grep "^nonguarded\$" $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-#   - with value;
-
---echo --------------------------------------------------------------------
---exec grep '^test-A[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-B[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-CREATE INSTANCE mysqld5
-  test-A = 000,
-  test-B = test,
-  server_id = 5,
-  socket = "$MYSQL_TMP_DIR/mysqld_5.sock";
-
-SHOW INSTANCES;
-
---echo --------------------------------------------------------------------
---exec grep '^test-A[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-B[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-# Check that CREATE INSTANCE parses options and handles grammar errors
-# correctly. Check that strings with spaces are handled correctly,
-# unknown (for mysqld) options should also be handled.
-
-#   - check handling of extra spaces;
-
---echo --------------------------------------------------------------------
---exec grep '^test-C1[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-C2[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-CREATE INSTANCE mysqld6
-  test-C1  =  10  ,
-  test-C2  =  02  ,
-  server_id = 6,
-  socket = "$MYSQL_TMP_DIR/mysqld_6.sock";
-
-SHOW INSTANCES;
-
---echo --------------------------------------------------------------------
---exec grep '^test-C1[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-C2[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-#   - check handling of grammar error;
-
---echo --------------------------------------------------------------------
---exec grep '^test-D[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-E[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
---error ER_SYNTAX_ERROR
-CREATE INSTANCE mysqld7  test-D  =  test-D-value  ;
-SHOW INSTANCES;
-
---error ER_SYNTAX_ERROR
-CREATE INSTANCE mysqld8  test-E  0  ;
-SHOW INSTANCES;
-
---error ER_SYNTAX_ERROR
-CREATE INSTANCE mysqld8  test-F  =  ;
-SHOW INSTANCES;
-
---echo --------------------------------------------------------------------
---exec grep '^test-D[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-E[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-#   - check parsing of string option values
-
---echo --------------------------------------------------------------------
---exec grep '^test-1[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-2[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-3[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-4[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-5[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-6[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^test-7[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-CREATE INSTANCE mysqld9
-  test-1=" hello world ",
-  test-2='  ',
-  server_id = 9,
-  socket = "$MYSQL_TMP_DIR/mysqld_9.sock";
-SHOW INSTANCES;
-
-CREATE INSTANCE mysqld10
-  test-3='\b\babc\sdef',
-  server_id = 10,
-  socket = "$MYSQL_TMP_DIR/mysqld_10.sock";
-# test-3='abc def'
-SHOW INSTANCES;
-
-CREATE INSTANCE mysqld11
-  test-4='abc\tdef',
-  test-5='abc\ndef',
-  server_id = 11,
-  socket = "$MYSQL_TMP_DIR/mysqld_11.sock";
-SHOW INSTANCES;
-
-CREATE INSTANCE mysqld12
-  test-6="abc\rdef",
-  test-7="abc\\def",
-  server_id = 12,
-  socket = "$MYSQL_TMP_DIR/mysqld_12.sock";
-# test-6=abc
-SHOW INSTANCES;
-
---error ER_SYNTAX_ERROR
-CREATE INSTANCE mysqld13 test-bad=' \ ';
-SHOW INSTANCES;
-
---echo --------------------------------------------------------------------
---exec grep '^test-1[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-2[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-3[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-4[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-5[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-6[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-7[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
---exec grep '^test-bad' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-
-# Check that CREATE INSTANCE allows to create instances only with properly
-# formed names (mysqld*).
-
---error 3014 # ER_MALFORMED_INSTANCE_NAME
-CREATE INSTANCE qqq1;
-

=== removed file 'mysql-test/suite/im/t/im_life_cycle-im.opt'
--- a/mysql-test/suite/im/t/im_life_cycle-im.opt	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/im_life_cycle-im.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---monitoring-interval=1

=== removed file 'mysql-test/suite/im/t/im_life_cycle.imtest'
--- a/mysql-test/suite/im/t/im_life_cycle.imtest	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/im_life_cycle.imtest	1970-01-01 00:00:00 +0000
@@ -1,205 +0,0 @@
-let $UTIL=$MYSQL_TEST_DIR/suite/im/t;
-
-###########################################################################
-#
-# This file contains test for (1.1) test suite.
-#
-# Consult WL#2789 for more information.
-#
-###########################################################################
-
---source suite/im/t/im_check_env.inc
-
-###########################################################################
-#
-# 1.1.2. Check 'START INSTANCE' command:
-#  - start the second instance;
-#  - check that it is reported as online;
-#  - execute some SQL-statement on mysqld2 to ensure that it is really up and
-#    running;
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.2.
---echo --------------------------------------------------------------------
-
-START INSTANCE mysqld2;
-# FIXME: START INSTANCE should be synchronous.
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_life_cycle
-
-# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
-# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
-# its pid file is not enough, because it is unknown when IM detects that
-# mysqld has started.
-# SHOW INSTANCES;
-
---connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD2_PORT,$IM_MYSQLD2_SOCK)
---connection mysql_con
-
---replace_result $IM_MYSQLD2_PORT IM_MYSQLD2_PORT
-SHOW VARIABLES LIKE 'port';
-
---connection default
---disconnect mysql_con
-
-###########################################################################
-#
-# 1.1.3. Check 'STOP INSTANCE' command:
-#  - stop the second instance;
-#  - check that it is reported as offline;
-#  - TODO: try to execute some SQL-statement to ensure that it is really down;
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.3.
---echo --------------------------------------------------------------------
-
-STOP INSTANCE mysqld2;
-# FIXME: STOP INSTANCE should be synchronous.
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_life_cycle
-
-# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
-# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
-# its pid file is not enough, because it is unknown when IM detects that
-# mysqld has started.
-# SHOW INSTANCES;
-
-###########################################################################
-#
-# 1.1.4. Check that Instance Manager reports correct errors for 'START
-# INSTANCE' command:
-#   - if the client tries to start unregistered instance;
-#   - if the client tries to start already started instance;
-#   - if the client submits invalid arguments;
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.4.
---echo --------------------------------------------------------------------
-
---error 3000 # ER_BAD_INSTANCE_NAME
-START INSTANCE mysqld3;
-
---error 3002 # ER_INSTANCE_ALREADY_STARTED
-START INSTANCE mysqld1;
-
-###########################################################################
-#
-# 1.1.5. Check that Instance Manager reports correct errors for
-#        'STOP INSTANCE' command:
-#   - if the client tries to start unregistered instance;
-#   - if the client tries to start already stopped instance;
-#   - if the client submits invalid arguments;
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.5.
---echo --------------------------------------------------------------------
-
---error 3000 # ER_BAD_INSTANCE_NAME
-STOP INSTANCE mysqld3;
-
-# TODO: IM should be fixed.
-# BUG#12673: Instance Manager allows to stop the instance many times
-# --error 3002 # ER_INSTANCE_ALREADY_STARTED
-# STOP INSTANCE mysqld2;
-
-###########################################################################
-#
-# 1.1.6. Check that Instance Manager is able to restart guarded instances.
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.6.
---echo --------------------------------------------------------------------
-
---exec $UTIL/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30 im_life_cycle
-
-# Give some time to IM to detect that mysqld was restarted. It should be
-# longer than monitoring interval.
-
---sleep 3
-
-SHOW INSTANCES;
-
-###########################################################################
-#
-# 1.1.7. Check that Instance Manager does not restart non-guarded instance.
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.7.
---echo --------------------------------------------------------------------
-
-START INSTANCE mysqld2;
-# FIXME: START INSTANCE should be synchronous.
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_life_cycle
-
-# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
-# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
-# its pid file is not enough, because it is unknown when IM detects that
-# mysqld has started.
-# SHOW INSTANCES;
-
---exec $UTIL/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10 im_life_cycle
-
-# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
-# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
-# its pid file is not enough, because it is unknown when IM detects that
-# mysqld has started.
-# SHOW INSTANCES;
-
-###########################################################################
-#
-# 1.1.8. Check that Instance Manager returns an error on
-# incomplete SHOW INSTANCE STATUS command.
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.8.
---echo --------------------------------------------------------------------
-
---error ER_SYNTAX_ERROR
-SHOW INSTANCE STATUS;
-
-#
-# Tests for bug fixes
-#
-
-#
-# Bug #12813    Instance Manager: START/STOP INSTANCE commands accept
-#                                 a list as argument.
-#
-
---echo
---echo --------------------------------------------------------------------
---echo -- BUG#12813
---echo --------------------------------------------------------------------
-
---error ER_SYNTAX_ERROR
-START INSTANCE mysqld1,mysqld2,mysqld3;
-
---error ER_SYNTAX_ERROR
-STOP INSTANCE mysqld1,mysqld2,mysqld3;
-
-#
-# Bug #12673: Instance Manager: allows to stop the instance many times
-#
---error 3001
-STOP INSTANCE mysqld2;
-
---echo End of 5.0 tests

=== removed file 'mysql-test/suite/im/t/im_options-im.opt'
--- a/mysql-test/suite/im/t/im_options-im.opt	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/im_options-im.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---monitoring-interval=1

=== removed file 'mysql-test/suite/im/t/im_options.imtest'
--- a/mysql-test/suite/im/t/im_options.imtest	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/im_options.imtest	1970-01-01 00:00:00 +0000
@@ -1,248 +0,0 @@
-###########################################################################
-#
-# This test suite checks the following statements:
-#   - SET <instance id>.<option name> = <option value>;
-#   - UNSET <instance id>.<option name> = <option value>;
-#   - FLUSH INSTANCES;
-#
-# For SET/UNSET we check that:
-#   - SET ignores spaces correctly;
-#   - UNSET does not allow option-value part (= <option value>);
-#   - SET/UNSET can be applied several times w/o error;
-#   - SET/UNSET is allowed only for stopped instances;
-#   - SET/UNSET updates both the configuration cache in IM and
-#     the configuration file;
-#
-# For FLUSH INSTANCES we check that:
-#   - FLUSH INSTANCES is allowed only when all instances are stopped;
-#
-# According to the IM implementation details, we should play at least with the
-# following options:
-#   - server_id
-#   - port
-#   - nonguarded
-#
-# Let's test SET statement on the option 'server_id'. It's expected that
-# originally the instances have the following server ids and states:
-#  - mysqld1: server_id: 1; running (online)
-#  - mysqld2: server_id: 2; stopped (offline)
-#
-# NOTE: each CREATE INSTANCE statement must specify socket-file-name, otherwise
-# this results of the test can be affected by another running test suite.
-#
-###########################################################################
-
---source suite/im/t/im_check_env.inc
-
-###########################################################################
-#
-# Check that SET/UNSET is allowed only for stopped instances.
-#
-###########################################################################
-
-# - check that SET/UNSET is denied for running instances;
-
---error 3015 # ER_INSTANCE_IS_ACTIVE
-UNSET mysqld1.server_id;
-
---error 3015 # ER_INSTANCE_IS_ACTIVE
-SET mysqld1.server_id = 11;
-
-# - check that SET/UNSET is denied for active instances:
-#   - create dummy misconfigured instance;
-#   - start it;
-#   - try to set/unset options;
-
-CREATE INSTANCE mysqld3
-  datadir = '/',
-  server_id = 3,
-  socket = "$MYSQL_TMP_DIR/mysqld_3.sock";
-START INSTANCE mysqld3;
-
-# FIXME: START INSTANCE should be synchronous.
---sleep 3
-# should be longer than monitoring interval and enough to start instance.
-
-# NOTE: We can not analyze state of the instance here -- it can be Failed or
-# Starting because Instance Manager is trying to start the misconfigured
-# instance several times.
-
---error 3015 # ER_INSTANCE_IS_ACTIVE
-UNSET mysqld3.server_id;
-
---error 3015 # ER_INSTANCE_IS_ACTIVE
-SET mysqld3.server_id = 11;
-
-STOP INSTANCE mysqld3;
-
-# FIXME: STOP INSTANCE should be synchronous.
---sleep 3
-# should be longer than monitoring interval and enough to stop instance.
-
---replace_column 3 VERSION_NUMBER 4 VERSION
-SHOW INSTANCE STATUS mysqld3;
-
-# - check that SET/UNSET succeed for stopped instances;
-# - check that SET/UNSET can be applied multiple times;
-
-UNSET mysqld2.server_id;
-UNSET mysqld2.server_id;
-
---replace_column 2 option_value
-SHOW INSTANCE OPTIONS mysqld2;
-
-SET mysqld2.server_id = 2;
-SET mysqld2.server_id = 2;
-
---replace_column 2 option_value
-SHOW INSTANCE OPTIONS mysqld2;
-
-# - check that UNSET does not allow option-value part (= <option value>);
-
---error ER_SYNTAX_ERROR
-UNSET mysqld2.server_id = 11;
-
-# - check that SET/UNSET working properly with multiple options;
-
-SET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc = 0010, mysqld3.ddd = 0020;
-
---echo --------------------------------------------------------------------
---exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
---exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
---exec grep '^ccc[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
---exec grep '^ddd[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
-
-UNSET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc, mysqld3.ddd;
-
---echo --------------------------------------------------------------------
---exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^ccc[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^ddd[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-# - check that if some instance name is invalid or the active is active,
-#   whole SET-statement will not be executed;
-
---error 3000 # ER_BAD_INSTANCE_NAME
-SET mysqld2.aaa, mysqld3.bbb, mysqld.ccc = 0010;
-
---echo --------------------------------------------------------------------
---exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^ccc[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
---error 3015 # ER_INSTANCE_IS_ACTIVE
-SET mysqld2.aaa, mysqld3.bbb, mysqld1.ccc = 0010;
-
---echo --------------------------------------------------------------------
---exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep '^ccc[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-# - check that if some instance name is invalid or the active is active,
-#   whole UNSET-statement will not be executed;
-
---error 3000 # ER_BAD_INSTANCE_NAME
-UNSET mysqld2.server_id, mysqld3.server_id, mysqld.ccc;
-
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
---error 3015 # ER_INSTANCE_IS_ACTIVE
-UNSET mysqld2.server_id, mysqld3.server_id, mysqld1.ccc;
-
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf;
---echo --------------------------------------------------------------------
-
-DROP INSTANCE mysqld3;
-
-# - check that spaces are handled correctly;
-
-SET mysqld2.server_id=222;
-SET mysqld2.server_id = 222;
-SET   mysqld2.server_id   =  222  ;
-SET   mysqld2  .  server_id  =  222  ;
-SET   mysqld2  .  server_id  =  222  , mysqld2  .  aaa  , mysqld2  .  bbb  ;
-
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
---exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
---exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
-
-UNSET mysqld2  . aaa  ,  mysqld2  .  bbb ;
-
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
---exec grep "^aaa\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
---exec grep "^bbb\$" $MYSQLTEST_VARDIR/im.cnf || true;
---echo --------------------------------------------------------------------
-
-###########################################################################
-#
-# Check that SET/UNSET updates both the configuration cache in IM and
-# the configuration file.
-#
-###########################################################################
-
-#   - check that the configuration file has been updated (i.e. contains
-#     server_id=SERVER_ID for mysqld2);
-
---echo --------------------------------------------------------------------
---exec grep '^server_id[^a-zA-Z0-9_-]' $MYSQLTEST_VARDIR/im.cnf ;
---echo --------------------------------------------------------------------
-
-#   - (for mysqld1) check that the running instance has not been affected:
-#     connect to the instance and check that 'SHOW VARIABLES LIKE 'server_id''
-#     returns zero;
-
---connection mysql1_con
-
-SHOW VARIABLES LIKE 'server_id';
-
---connection default
-
-#   - check that internal cache of Instance Manager has been affected;
-#     TODO: we should check only server_id option here.
-
-# SHOW INSTANCE OPTIONS mysqld2;
-
-###########################################################################
-#
-# Check that FLUSH INSTANCES is allowed only when all instances are stopped.
-#
-###########################################################################
-
-SHOW INSTANCES;
-
---error 3016 # ER_THERE_IS_ACTIVE_INSTACE
-FLUSH INSTANCES;
-
-STOP INSTANCE mysqld1;
-# FIXME: STOP INSTANCE should be synchronous.
---sleep 3
-# should be longer than monitoring interval and enough to stop instance.
-
-SHOW INSTANCES;
-
-FLUSH INSTANCES;

=== removed file 'mysql-test/suite/im/t/im_utils-im.opt'
--- a/mysql-test/suite/im/t/im_utils-im.opt	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/im_utils-im.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---monitoring-interval=1

=== removed file 'mysql-test/suite/im/t/im_utils.imtest'
--- a/mysql-test/suite/im/t/im_utils.imtest	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/im_utils.imtest	1970-01-01 00:00:00 +0000
@@ -1,107 +0,0 @@
-###########################################################################
-#
-# This file contains test for (2) test suite.
-#
-# Consult WL#2789 for more information.
-#
-###########################################################################
-
---source suite/im/t/im_check_env.inc
-
-let $UTIL=$MYSQL_TEST_DIR/suite/im/t;
-
-###########################################################################
-
-#
-# Check 'SHOW INSTANCE OPTIONS' command.
-#
-# Since configuration of an mysqld-instance contains directories, we should
-# completely ignore the second column (values) in order to make the test
-# case produce the same results on different installations;
-# TODO: ignore values of only directory-specific options.
-#
-
---replace_column 2 VALUE
-SHOW INSTANCE OPTIONS mysqld1;
-
---replace_column 2 VALUE
-SHOW INSTANCE OPTIONS mysqld2;
-
-#
-# Before checking log files, we should start the second instance (mysqld2) to
-# give it a chance to create log files.
-#
-
-START INSTANCE mysqld2;
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_utils
-
-STOP INSTANCE mysqld2;
---exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_utils
-
-#
-# Check 'SHOW LOG FILES' command:
-#  - check that log files of both offline and online instances are accessible;
-#  - since placement of the log files is installation-specific, we should
-#    ignore it in comparisson;
-#  - also, we should ignore log file size, since it may depend on the version
-#    being tested;
-#
-
---replace_column 2 PATH 3 FILE_SIZE
-SHOW mysqld1 LOG FILES;
-
---replace_column 2 PATH 3 FILE_SIZE
-SHOW mysqld2 LOG FILES;
-
-#
-# Check 'SHOW LOG' command:
-#  - check that all three kinds of logs are available for both offline and
-#    online instances;
-#  - we should ignore the value, because it is very specific and depends on
-#    many factors; we only check that Instance Manager is able to provide log
-#    files.
-#
-
-# mysqld1 (online) w/o the optional argument.
-
---replace_column 1 LOG_DATA
-SHOW mysqld1 LOG ERROR 10;
-
---replace_column 1 LOG_DATA
-SHOW mysqld1 LOG SLOW 10;
-
---replace_column 1 LOG_DATA
-SHOW mysqld1 LOG GENERAL 10;
-
-# mysqld1 (online) with the optional argument.
-
---replace_column 1 LOG_DATA
-SHOW mysqld1 LOG ERROR 10, 2;
-
---replace_column 1 LOG_DATA
-SHOW mysqld1 LOG SLOW 10, 2;
-
---replace_column 1 LOG_DATA
-SHOW mysqld1 LOG GENERAL 10, 2;
-
-# mysqld2 (offline) w/o the optional argument.
-
---replace_column 1 LOG_DATA
-SHOW mysqld2 LOG ERROR 10;
-
---replace_column 1 LOG_DATA
-SHOW mysqld2 LOG SLOW 10;
-
---replace_column 1 LOG_DATA
-SHOW mysqld2 LOG GENERAL 10;
-
-# mysqld2 (offline) with the optional argument.
-
---replace_column 1 LOG_DATA
-SHOW mysqld2 LOG ERROR 10, 2;
-
---replace_column 1 LOG_DATA
-SHOW mysqld2 LOG SLOW 10, 2;
-
---replace_column 1 LOG_DATA
-SHOW mysqld2 LOG GENERAL 10, 2;

=== removed file 'mysql-test/suite/im/t/kill_n_check.sh'
--- a/mysql-test/suite/im/t/kill_n_check.sh	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/kill_n_check.sh	1970-01-01 00:00:00 +0000
@@ -1,147 +0,0 @@
-#!/bin/sh
-
-###########################################################################
-
-# NOTE: this script returns 0 (success) even in case of failure (except for
-# usage-error). This is because this script is executed under
-# mysql-test-run[.pl] and it's better to examine particular problem in log
-# file, than just having said that the test case has failed.
-
-###########################################################################
-
-basename=`basename "$0"`
-dirname=`dirname "$0"`
-
-###########################################################################
-
-. "$dirname/utils.sh"
-
-###########################################################################
-
-check_restart()
-{
-  if [ ! -r "$pid_path" ]; then
-    log_debug "No '$pid_path' found."
-    user_msg='the process was killed'
-    return 1
-  fi
-
-  new_pid=`cat "$pid_path" 2>/dev/null`
-  err_code=$?
-
-  log_debug "err_code: $err_code; original_pid: $original_pid; new_pid: $new_pid."
-
-  if [ $err_code -eq 0 -a "$original_pid" = "$new_pid" ]; then
-    log_debug "The process was not restarted."
-    user_msg='the process was not restarted'
-    return 1
-  fi
-
-  log_debug "The process was restarted."
-  user_msg='the process was restarted'
-  return 0
-}
-
-###########################################################################
-
-if [ $# -ne 4 ]; then
-  echo "Usage: $basename <pid file path> killed|restarted <timeout> <test id>"
-  exit 1
-fi
-
-pid_path="$1"
-expected_result="$2"
-total_timeout="$3"
-test_id="$4"
-log_file="$MYSQLTEST_VARDIR/log/$test_id.script.log"
-
-log_debug "-- $basename: starting --"
-log_debug "pid_path: '$pid_path'"
-log_debug "expected_result: '$expected_result'"
-log_debug "total_timeout: '$total_timeout'"
-log_debug "test_id: '$test_id'"
-log_debug "log_file: '$log_file'"
-
-###########################################################################
-
-if [ "$expected_result" != 'killed' -a \
-     "$expected_result" != 'restarted' ]; then
-  log_error "Invalid second argument ($expected_result): 'killed' or 'restarted' expected."
-  quit 0
-fi
-
-if [ -z "$pid_path" ]; then
-  log_error "Invalid PID path ($pid_path)."
-  quit 0
-fi
-
-if [ ! -r "$pid_path" ]; then
-  log_error "PID file ($pid_path) does not exist."
-  quit 0
-fi
-
-if [ -z "$total_timeout" ]; then
-  log_error "Timeout is not specified."
-  quit 0
-fi
-
-###########################################################################
-
-original_pid=`cat "$pid_path"`
-log_debug "original_pid: $original_pid."
-
-log_info "Killing the process..."
-
-kill -9 $original_pid
-
-###########################################################################
-
-log_info "Waiting..."
-
-if [ "$expected_result" = "restarted" ]; then
-
-  # Wait for the process to restart.
-
-  cur_attempt=1
-
-  while true; do
-
-    log_debug "cur_attempt: $cur_attempt."
-
-    if check_restart; then
-      log_info "Success: $user_msg."
-      quit 0
-    fi
-
-    [ $cur_attempt -ge $total_timeout ] && break
-
-    log_debug "Sleeping for 1 second..."
-    sleep 1
-
-    cur_attempt=`expr $cur_attempt + 1`
-
-  done
-
-  log_error "$user_msg."
-  quit 0
-
-else # $expected_result == killed
-
-  # Here we have to sleep for some long time to ensure that the process will
-  # not be restarted.
-
-  log_debug "Sleeping for $total_timeout seconds..."
-  sleep $total_timeout
-
-  new_pid=`cat "$pid_path" 2>/dev/null`
-  log_debug "new_pid: $new_pid."
-
-  if [ "$new_pid" -a "$new_pid" -ne "$original_pid" ]; then
-    log_error "The process was restarted."
-  else
-    log_info "Success: the process was killed."
-  fi
-
-  quit 0
-
-fi

=== removed file 'mysql-test/suite/im/t/log.sh'
--- a/mysql-test/suite/im/t/log.sh	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/log.sh	1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-###########################################################################
-
-basename=`basename "$0"`
-dirname=`dirname "$0"`
-
-###########################################################################
-
-. "$dirname/utils.sh"
-
-###########################################################################
-
-if [ $# -lt 2 ]; then
-  echo "Usage: $basename <test id> log message ..."
-  exit 1
-fi
-
-test_id="$1"
-log_file="$MYSQLTEST_VARDIR/log/$test_id.script.log"
-
-shift
-
-log_debug "$*"

=== removed file 'mysql-test/suite/im/t/utils.sh'
--- a/mysql-test/suite/im/t/utils.sh	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/utils.sh	1970-01-01 00:00:00 +0000
@@ -1,55 +0,0 @@
-###########################################################################
-#
-# This file provides utility functions and is included by other scripts.
-#
-# The following global variables must be set before calling functions from this
-# file:
-#   - basename -- base name of the calling script (main application);
-#   - log_file -- where to store log records;
-#
-###########################################################################
-
-log()
-{
-  [ -z "$log_file" ] && return;
-
-  log_level="$1"
-  log_msg="$2"
-  ts=`date`
-
-  echo "[$ts] [$basename] [$log_level] $log_msg" >> "$log_file";
-}
-
-###########################################################################
-
-log_debug()
-{
-  log 'DEBUG' "$1"
-}
-
-###########################################################################
-
-log_info()
-{
-  log 'INFO' "$1"
-  echo "$1"
-}
-
-###########################################################################
-
-log_error()
-{
-  log 'ERROR' "$1"
-  echo "Error: $1"
-}
-
-###########################################################################
-
-quit()
-{
-  exit_status="$1"
-
-  log_debug "-- $basename: finished (exit_status: $exit_status) --"
-
-  exit $exit_status
-}

=== removed file 'mysql-test/suite/im/t/wait_for_process.sh'
--- a/mysql-test/suite/im/t/wait_for_process.sh	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/wait_for_process.sh	1970-01-01 00:00:00 +0000
@@ -1,114 +0,0 @@
-#!/bin/sh
-
-###########################################################################
-
-# NOTE: this script returns 0 (success) even in case of failure (except for
-# usage-error). This is because this script is executed under
-# mysql-test-run[.pl] and it's better to examine particular problem in log
-# file, than just having said that the test case has failed.
-
-###########################################################################
-
-basename=`basename "$0"`
-dirname=`dirname "$0"`
-
-###########################################################################
-
-. "$dirname/utils.sh"
-
-###########################################################################
-
-check_started()
-{
-  if [ ! -r "$pid_path" ]; then
-    log_debug "No PID-file ($pid_path) found -- not started."
-    return 1
-  fi
-
-  new_pid=`cat "$pid_path" 2>/dev/null`
-  err_code=$?
-
-  log_debug "err_code: $err_code; new_pid: $new_pid."
-
-  if [ $? -ne 0 -o -z "$new_pid" ]; then
-    log_debug "The process was not started."
-    return 1
-  fi
-
-  log_debug "The process was started."
-  return 0
-}
-
-###########################################################################
-
-check_stopped()
-{
-  if [ -r "$pid_path" ]; then
-    log_debug "PID-file '$pid_path' exists -- not stopped."
-    return 1
-  fi
-
-  log_debug "No PID-file ($pid_path) found -- stopped."
-  return 0
-}
-
-###########################################################################
-
-if [ $# -ne 4 ]; then
-  echo "Usage: $basename <pid file path> <total attempts> started|stopped <test id>"
-  exit 1
-fi
-
-pid_path="$1"
-total_attempts="$2"
-event="$3"
-test_id="$4"
-log_file="$MYSQLTEST_VARDIR/log/$test_id.script.log"
-
-log_debug "-- $basename: starting --"
-log_debug "pid_path: '$pid_path'"
-log_debug "total_attempts: '$total_attempts'"
-log_debug "event: '$event'"
-log_debug "test_id: '$test_id'"
-log_debug "log_file: '$log_file'"
-
-###########################################################################
-
-case "$event" in
-  started)
-    check_fn='check_started';
-    ;;
-
-  stopped)
-    check_fn='check_stopped';
-    ;;
-
-  *)
-    log_error "Invalid third argument ('started' or 'stopped' expected)."
-    quit 0
-esac
-
-###########################################################################
-
-cur_attempt=1
-
-while true; do
-
-  log_debug "cur_attempt: $cur_attempt."
-
-  if ( eval $check_fn ); then
-    log_info "Success: the process has been $event."
-    quit 0
-  fi
-
-  [ $cur_attempt -ge $total_attempts ] && break
-
-  log_debug "Sleeping for 1 second..."
-  sleep 1
-
-  cur_attempt=`expr $cur_attempt + 1`
-
-done
-
-log_error "The process has not been $event in $total_attempts secs."
-quit 0

=== removed file 'mysql-test/suite/im/t/wait_for_socket.sh'
--- a/mysql-test/suite/im/t/wait_for_socket.sh	2007-08-29 17:02:33 +0000
+++ b/mysql-test/suite/im/t/wait_for_socket.sh	1970-01-01 00:00:00 +0000
@@ -1,94 +0,0 @@
-#!/bin/sh
-
-###########################################################################
-
-# NOTE: this script returns 0 (success) even in case of failure (except for
-# usage-error). This is because this script is executed under
-# mysql-test-run[.pl] and it's better to examine particular problem in log
-# file, than just having said that the test case has failed.
-
-###########################################################################
-
-basename=`basename "$0"`
-dirname=`dirname "$0"`
-
-###########################################################################
-
-. "$dirname/utils.sh"
-
-###########################################################################
-
-if [ $# -ne 7 ]; then
-  echo "Usage: wait_for_socket.sh <executable path> <socket path> <username> <password> <db> <timeout> <test id>"
-  exit 1
-fi
-
-client_exe="$1"
-socket_path="$2"
-username="$3"
-password="$4"
-db="$5"
-total_timeout="$6"
-test_id="$7"
-log_file="$MYSQLTEST_VARDIR/log/$test_id.script.log"
-
-log_debug "-- $basename: starting --"
-log_debug "client_exe: '$client_exe'"
-log_debug "socket_path: '$socket_path'"
-log_debug "username: '$username'"
-log_debug "password: '$password'"
-log_debug "db: '$db'"
-log_debug "total_timeout: '$total_timeout'"
-log_debug "test_id: '$test_id'"
-log_debug "log_file: '$log_file'"
-
-###########################################################################
-
-if [ -z "$client_exe" ]; then
-  log_error "Invalid path to client executable ($client_exe)."
-  quit 0;
-fi
-
-if [ ! -x "$client_exe" ]; then
-  log_error "Client by path '$client_exe' is not available."
-  quit 0;
-fi
-
-if [ -z "$socket_path" ]; then
-  log_error "Invalid socket patch ($socket_path)."
-  quit 0
-fi
-
-###########################################################################
-
-client_args="--no-defaults --silent --socket=$socket_path --connect_timeout=1 "
-
-[ -n "$username" ] && client_args="$client_args --user=$username "
-[ -n "$password" ] && client_args="$client_args --password=$password "
-[ -n "$db" ] && client_args="$client_args $db"
-
-log_debug "client_args: '$client_args'"
-
-###########################################################################
-
-cur_attempt=1
-
-while true; do
-
-  log_debug "cur_attempt: $cur_attempt."
-
-  if ( echo 'quit' | "$client_exe" $client_args >/dev/null 2>&1 ); then
-    log_info "Success: server is ready to accept connection on socket."
-    quit 0
-  fi
-
-  [ $cur_attempt -ge $total_timeout ] && break
-
-  sleep 1
-
-  cur_attempt=`expr $cur_attempt + 1`
-
-done
-
-log_error "Server does not accept connections after $total_timeout seconds."
-quit 0

=== modified file 'mysql-test/suite/parts/t/disabled.def'
--- a/mysql-test/suite/parts/t/disabled.def	2009-02-13 16:30:54 +0000
+++ b/mysql-test/suite/parts/t/disabled.def	2009-06-11 03:59:25 +0000
@@ -2,8 +2,8 @@ partition_basic_ndb            : Bug#198
 # http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-limitations-syntax.html
 partition_syntax_ndb           : Bug#36735 Not supported
 ndb_dd_backuprestore           : Bug#32659 2008-07-14 alik  Disabled to make 6.0 greaner (the test fails too often)
-partition_mgm_lc0_ndb          : Bug#38778 - master1 crashes
-partition_mgm_lc1_ndb          : Bug#38778 - master1 crashes
-partition_mgm_lc2_ndb          : Bug#38778 - master1 crashes
-partition_auto_increment_ndb   : Bug#39773 - auto_increment for NDB changed behavior
+partition_mgm_lc0_ndb          : Bug#44919 - master1 crashes
+partition_mgm_lc1_ndb          : Bug#44919 - master1 crashes
+partition_mgm_lc2_ndb          : Bug#44919 - master1 crashes
+partition_auto_increment_ndb   : Bug#44919 - auto_increment for NDB changed behavior
 #partition_engine_ndb           : cannot create t1

=== modified file 'mysql-test/suite/rpl/r/rpl_heartbeat.result'
--- a/mysql-test/suite/rpl/r/rpl_heartbeat.result	2009-04-03 16:24:50 +0000
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat.result	2009-06-15 14:00:15 +0000
@@ -45,7 +45,7 @@ Warnings:
 Warning	1624	The currect value for master_heartbeat_period exceeds the new value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout.
 reset slave;
 drop table if exists t1;
-set @@global.slave_net_timeout= 20;
+set @@global.slave_net_timeout= 10;
 change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 0.5;
 show status like 'Slave_heartbeat_period';;
 Variable_name	Slave_heartbeat_period
@@ -139,7 +139,5 @@ Variable_name	Slave_heartbeat_period
 Value	0.500
 A heartbeat has been received by the slave
 drop table t1;
-*** debug: 356 ***
-#connection slave
 set @@global.slave_net_timeout=@restore_slave_net_timeout;
 End of tests

=== added file 'mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result'
--- a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result	2009-06-12 05:41:25 +0000
@@ -0,0 +1,274 @@
+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);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+[MASTER] ********* SOW BINLOG EVENTS IN ...  *********
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+[MASTER] ********* SOW BINLOG EVENTS         *********
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+[MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows  *********
+show binlog events from <binlog_start> limit 3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+[MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows  *********
+show binlog events from <binlog_start> limit 1,  3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+[SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
+show binlog events in 'slave-bin.000001' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+[SLAVE] ********* SOW BINLOG EVENTS          *********
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows  *********
+show binlog events from <binlog_start> limit 3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows  *********
+show binlog events from <binlog_start> limit 1,  3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000003	#	Rotate	#	#	master-bin.000001;pos=4
+slave-relay-bin.000003	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-relay-bin.000003	#	Query	#	#	BEGIN
+slave-relay-bin.000003	#	Table_map	#	#	table_id: # (test.t1)
+slave-relay-bin.000003	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-relay-bin.000003	#	Query	#	#	COMMIT
+slave-relay-bin.000003	#	Query	#	#	BEGIN
+slave-relay-bin.000003	#	Table_map	#	#	table_id: # (test.t1)
+slave-relay-bin.000003	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-relay-bin.000003	#	Query	#	#	COMMIT
+slave-relay-bin.000003	#	Query	#	#	BEGIN
+slave-relay-bin.000003	#	Table_map	#	#	table_id: # (test.t1)
+slave-relay-bin.000003	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-relay-bin.000003	#	Query	#	#	COMMIT
+slave-relay-bin.000003	#	Query	#	#	BEGIN
+slave-relay-bin.000003	#	Table_map	#	#	table_id: # (test.t1)
+slave-relay-bin.000003	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-relay-bin.000003	#	Query	#	#	COMMIT
+slave-relay-bin.000003	#	Query	#	#	BEGIN
+slave-relay-bin.000003	#	Table_map	#	#	table_id: # (test.t1)
+slave-relay-bin.000003	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-relay-bin.000003	#	Query	#	#	COMMIT
+slave-relay-bin.000003	#	Query	#	#	BEGIN
+slave-relay-bin.000003	#	Table_map	#	#	table_id: # (test.t1)
+slave-relay-bin.000003	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-relay-bin.000003	#	Query	#	#	COMMIT
+[SLAVE] ********* SOW RELAYLOG EVENTS        *********
+show relaylog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000002	#	Rotate	#	#	slave-relay-bin.000003;pos=4
+[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows  *********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000003	#	Rotate	#	#	master-bin.000001;pos=4
+slave-relay-bin.000003	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows  *********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1,  3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000003	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-relay-bin.000003	#	Query	#	#	BEGIN
+FLUSH LOGS;
+FLUSH LOGS;
+DROP TABLE t1;
+[MASTER] ********* SOW BINLOG EVENTS IN ...  *********
+show binlog events in 'master-bin.000002' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000002	#	Query	#	#	use `test`; DROP TABLE t1
+[MASTER] ********* SOW BINLOG EVENTS         *********
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
+[SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
+show binlog events in 'slave-bin.000002' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000002	#	Query	#	#	use `test`; DROP TABLE t1
+[SLAVE] ********* SOW BINLOG EVENTS          *********
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Rotate	#	#	slave-bin.000002;pos=4
+[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
+show relaylog events in 'slave-relay-bin.000005' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000005	#	Rotate	#	#	master-bin.000002;pos=4
+slave-relay-bin.000005	#	Rotate	#	#	slave-relay-bin.000006;pos=4
+[SLAVE] ********* SOW RELAYLOG EVENTS        *********
+show relaylog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000005	#	Rotate	#	#	master-bin.000002;pos=4
+slave-relay-bin.000005	#	Rotate	#	#	slave-relay-bin.000006;pos=4

=== modified file 'mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result'
--- a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result	2009-06-18 04:03:12 +0000
@@ -4,7 +4,8 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-create database if not exists mysqltest1;
+drop database if exists mysqltest1;
+create database mysqltest1;
 DROP PROCEDURE IF EXISTS mysqltest1.p1;
 DROP PROCEDURE IF EXISTS mysqltest1.p2;
 DROP TABLE IF EXISTS mysqltest1.t2;

=== added file 'mysql-test/suite/rpl/r/rpl_semi_sync.result'
--- a/mysql-test/suite/rpl/r/rpl_semi_sync.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result	2009-06-17 10:37:04 +0000
@@ -0,0 +1,331 @@
+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;
+#
+# Uninstall semi-sync plugins on master and slave
+#
+include/stop_slave.inc
+reset slave;
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+reset master;
+set sql_log_bin=0;
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+set sql_log_bin=1;
+#
+# Main test of semi-sync replication start here
+#
+[ on master ]
+[ default state of semi-sync on master should be OFF ]
+show variables like 'rpl_semi_sync_master_enabled';
+Variable_name	Value
+rpl_semi_sync_master_enabled	OFF
+[ enable semi-sync on master ]
+set global rpl_semi_sync_master_enabled = 1;
+show variables like 'rpl_semi_sync_master_enabled';
+Variable_name	Value
+rpl_semi_sync_master_enabled	ON
+[ on slave ]
+[ default state of semi-sync on slave should be OFF ]
+show variables like 'rpl_semi_sync_slave_enabled';
+Variable_name	Value
+rpl_semi_sync_slave_enabled	OFF
+[ enable semi-sync on slave ]
+set global rpl_semi_sync_slave_enabled = 1;
+show variables like 'rpl_semi_sync_slave_enabled';
+Variable_name	Value
+rpl_semi_sync_slave_enabled	ON
+include/start_slave.inc
+[ on master ]
+[ initial master state after the semi-sync slave connected ]
+show status like 'Rpl_semi_sync_master_clients';
+Variable_name	Value
+Rpl_semi_sync_master_clients	1
+show status like 'Rpl_semi_sync_master_status';
+Variable_name	Value
+Rpl_semi_sync_master_status	ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name	Value
+Rpl_semi_sync_master_no_tx	0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name	Value
+Rpl_semi_sync_master_yes_tx	0
+create table t1(n int) engine = ENGINE_TYPE;
+[ master state after CREATE TABLE statement ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name	Value
+Rpl_semi_sync_master_status	ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name	Value
+Rpl_semi_sync_master_no_tx	0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name	Value
+Rpl_semi_sync_master_yes_tx	1
+[ insert records to table ]
+[ master status after inserts ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name	Value
+Rpl_semi_sync_master_status	ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name	Value
+Rpl_semi_sync_master_no_tx	0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name	Value
+Rpl_semi_sync_master_yes_tx	301
+[ on slave ]
+[ slave status after replicated inserts ]
+show status like 'Rpl_semi_sync_slave_status';
+Variable_name	Value
+Rpl_semi_sync_slave_status	ON
+select count(distinct n) from t1;
+count(distinct n)
+300
+select min(n) from t1;
+min(n)
+1
+select max(n) from t1;
+max(n)
+300
+include/stop_slave.inc
+[ on master ]
+[ master status should be ON ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name	Value
+Rpl_semi_sync_master_status	ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name	Value
+Rpl_semi_sync_master_no_tx	0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name	Value
+Rpl_semi_sync_master_yes_tx	301
+show status like 'Rpl_semi_sync_master_clients';
+Variable_name	Value
+Rpl_semi_sync_master_clients	1
+[ semi-sync replication of these transactions will fail ]
+insert into t1 values (500);
+delete from t1 where n < 500;
+insert into t1 values (100);
+[ master status should be OFF ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name	Value
+Rpl_semi_sync_master_status	OFF
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name	Value
+Rpl_semi_sync_master_no_tx	3
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name	Value
+Rpl_semi_sync_master_yes_tx	301
+[ on slave ]
+[ slave status should be OFF ]
+show status like 'Rpl_semi_sync_slave_status';
+Variable_name	Value
+Rpl_semi_sync_slave_status	OFF
+include/start_slave.inc
+[ slave status should be ON ]
+show status like 'Rpl_semi_sync_slave_status';
+Variable_name	Value
+Rpl_semi_sync_slave_status	ON
+select count(distinct n) from t1;
+count(distinct n)
+2
+select min(n) from t1;
+min(n)
+100
+select max(n) from t1;
+max(n)
+500
+[ on master ]
+[ do something to activate semi-sync ]
+drop table t1;
+[ master status should be ON again ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name	Value
+Rpl_semi_sync_master_status	ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name	Value
+Rpl_semi_sync_master_no_tx	3
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name	Value
+Rpl_semi_sync_master_yes_tx	302
+show status like 'Rpl_semi_sync_master_clients';
+Variable_name	Value
+Rpl_semi_sync_master_clients	1
+[ on slave ]
+include/stop_slave.inc
+[ on master ]
+show master logs;
+Log_name	master-bin.000001
+File_size	#
+show variables like 'rpl_semi_sync_master_enabled';
+Variable_name	Value
+rpl_semi_sync_master_enabled	ON
+[ disable semi-sync on the fly ]
+set global rpl_semi_sync_master_enabled=0;
+show variables like 'rpl_semi_sync_master_enabled';
+Variable_name	Value
+rpl_semi_sync_master_enabled	OFF
+show status like 'Rpl_semi_sync_master_status';
+Variable_name	Value
+Rpl_semi_sync_master_status	OFF
+[ enable semi-sync on the fly ]
+set global rpl_semi_sync_master_enabled=1;
+show variables like 'rpl_semi_sync_master_enabled';
+Variable_name	Value
+rpl_semi_sync_master_enabled	ON
+show status like 'Rpl_semi_sync_master_status';
+Variable_name	Value
+Rpl_semi_sync_master_status	ON
+[ on slave ]
+include/start_slave.inc
+[ on master ]
+create table t1 (a int) engine = ENGINE_TYPE;
+drop table t1;
+show status like 'Rpl_relay%';
+Variable_name	Value
+[ test reset master ]
+[ on master]
+reset master;
+show status like 'Rpl_semi_sync_master_status';
+Variable_name	Value
+Rpl_semi_sync_master_status	ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name	Value
+Rpl_semi_sync_master_no_tx	0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name	Value
+Rpl_semi_sync_master_yes_tx	0
+[ on slave ]
+include/stop_slave.inc
+reset slave;
+include/start_slave.inc
+[ on master ]
+create table t1 (a int) engine = ENGINE_TYPE;
+insert into t1 values (1);
+insert into t1 values (2), (3);
+[ on slave ]
+select * from t1;
+a
+1
+2
+3
+[ on master ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name	Value
+Rpl_semi_sync_master_status	ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name	Value
+Rpl_semi_sync_master_no_tx	0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name	Value
+Rpl_semi_sync_master_yes_tx	3
+#
+# Start semi-sync replication without SUPER privilege
+#
+reset master;
+include/stop_slave.inc
+reset slave;
+[ on master ]
+set sql_log_bin=0;
+grant replication slave on *.* to rpl@stripped identified by 'rpl';
+flush privileges;
+set sql_log_bin=1;
+[ on slave ]
+grant replication slave on *.* to rpl@stripped identified by 'rpl';
+flush privileges;
+change master to master_user='rpl',master_password='rpl';
+include/start_slave.inc
+[ on master ]
+show status like 'Rpl_semi_sync_master_status';
+Variable_name	Value
+Rpl_semi_sync_master_status	ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name	Value
+Rpl_semi_sync_master_no_tx	0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name	Value
+Rpl_semi_sync_master_yes_tx	0
+insert into t1 values (4);
+insert into t1 values (5);
+show status like 'Rpl_semi_sync_master_status';
+Variable_name	Value
+Rpl_semi_sync_master_status	ON
+show status like 'Rpl_semi_sync_master_no_tx';
+Variable_name	Value
+Rpl_semi_sync_master_no_tx	0
+show status like 'Rpl_semi_sync_master_yes_tx';
+Variable_name	Value
+Rpl_semi_sync_master_yes_tx	2
+#
+# Test semi-sync slave connect to non-semi-sync master
+#
+[ on slave ]
+include/stop_slave.inc
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+Variable_name	Value
+Rpl_semi_sync_slave_status	OFF
+[ on master ]
+set sql_log_bin=0;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+set sql_log_bin=1;
+SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled';
+Variable_name	Value
+[ on slave ]
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+Variable_name	Value
+rpl_semi_sync_slave_enabled	ON
+include/start_slave.inc
+[ on master ]
+insert into t1 values (10);
+[ on slave ]
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+Variable_name	Value
+Rpl_semi_sync_slave_status	OFF
+#
+# Test non-semi-sync slave connect to semi-sync master
+#
+set sql_log_bin=0;
+INSTALL PLUGIN rpl_semi_sync_master SONAME 'libsemisync_master.so';
+set global rpl_semi_sync_master_timeout= 5000;
+/* 5s */
+set sql_log_bin=1;
+set global rpl_semi_sync_master_enabled= 1;
+[ on slave ]
+include/stop_slave.inc
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+Variable_name	Value
+Rpl_semi_sync_slave_status	OFF
+[ uninstall semi-sync slave plugin ]
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+Variable_name	Value
+include/start_slave.inc
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+Variable_name	Value
+include/stop_slave.inc
+[ reinstall semi-sync slave plugin and disable semi-sync ]
+INSTALL PLUGIN rpl_semi_sync_slave SONAME 'libsemisync_slave.so';
+set global rpl_semi_sync_slave_enabled= 0;
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+Variable_name	Value
+rpl_semi_sync_slave_enabled	OFF
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+Variable_name	Value
+Rpl_semi_sync_slave_status	OFF
+include/start_slave.inc
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+Variable_name	Value
+Rpl_semi_sync_slave_status	OFF
+#
+# Clean up
+#
+include/stop_slave.inc
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+include/start_slave.inc
+drop table t1;
+drop user rpl@127.0.0.1;
+flush privileges;

=== added file 'mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result	2009-05-13 11:04:33 +0000
@@ -0,0 +1,148 @@
+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);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+[MASTER] ********* SOW BINLOG EVENTS IN ...  *********
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
+[MASTER] ********* SOW BINLOG EVENTS         *********
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
+[MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows  *********
+show binlog events from <binlog_start> limit 3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
+[MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows  *********
+show binlog events from <binlog_start> limit 1,  3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
+[SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
+show binlog events in 'slave-bin.000001' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
+[SLAVE] ********* SOW BINLOG EVENTS          *********
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
+[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows  *********
+show binlog events from <binlog_start> limit 3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
+[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows  *********
+show binlog events from <binlog_start> limit 1,  3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
+[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000003	#	Rotate	#	#	master-bin.000001;pos=4
+slave-relay-bin.000003	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
+slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
+slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
+slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
+slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
+[SLAVE] ********* SOW RELAYLOG EVENTS        *********
+show relaylog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000002	#	Rotate	#	#	slave-relay-bin.000003;pos=4
+[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows  *********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000003	#	Rotate	#	#	master-bin.000001;pos=4
+slave-relay-bin.000003	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows  *********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1,  3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000003	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+FLUSH LOGS;
+FLUSH LOGS;
+DROP TABLE t1;
+[MASTER] ********* SOW BINLOG EVENTS IN ...  *********
+show binlog events in 'master-bin.000002' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000002	#	Query	#	#	use `test`; DROP TABLE t1
+[MASTER] ********* SOW BINLOG EVENTS         *********
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
+master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
+[SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
+show binlog events in 'slave-bin.000002' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000002	#	Query	#	#	use `test`; DROP TABLE t1
+[SLAVE] ********* SOW BINLOG EVENTS          *********
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
+slave-bin.000001	#	Rotate	#	#	slave-bin.000002;pos=4
+[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
+show relaylog events in 'slave-relay-bin.000005' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000005	#	Rotate	#	#	master-bin.000002;pos=4
+slave-relay-bin.000005	#	Rotate	#	#	slave-relay-bin.000006;pos=4
+[SLAVE] ********* SOW RELAYLOG EVENTS        *********
+show relaylog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000005	#	Rotate	#	#	master-bin.000002;pos=4
+slave-relay-bin.000005	#	Rotate	#	#	slave-relay-bin.000006;pos=4

=== modified file 'mysql-test/suite/rpl/r/rpl_temporary.result'
--- a/mysql-test/suite/rpl/r/rpl_temporary.result	2009-05-22 23:44:08 +0000
+++ b/mysql-test/suite/rpl/r/rpl_temporary.result	2009-06-12 02:01:08 +0000
@@ -27,12 +27,12 @@ Warning	1265	Data truncated for column '
 DROP TABLE t1;
 SET @save_select_limit=@@session.sql_select_limit;
 SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 SELECT @@session.sql_select_limit = @save_select_limit;
 @@session.sql_select_limit = @save_select_limit
 1
 SET @@session.sql_select_limit=10, @@session.sql_log_bin=0;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 SELECT @@session.sql_select_limit = @save_select_limit;
 @@session.sql_select_limit = @save_select_limit
 1

=== modified file 'mysql-test/suite/rpl/t/disabled.def'
--- a/mysql-test/suite/rpl/t/disabled.def	2009-05-18 17:15:47 +0000
+++ b/mysql-test/suite/rpl/t/disabled.def	2009-06-11 14:24:28 +0000
@@ -13,8 +13,6 @@
 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 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).

=== modified file 'mysql-test/suite/rpl/t/rpl000017.test'
--- a/mysql-test/suite/rpl/t/rpl000017.test	2008-09-09 05:23:11 +0000
+++ b/mysql-test/suite/rpl/t/rpl000017.test	2009-06-15 13:30:20 +0000
@@ -16,6 +16,7 @@ grant replication slave on *.* to replic
 grant replication slave on *.* to replicate@stripped identified by 'aaaaaaaaaaaaaaab';
 connection slave;
 start slave;
+source include/wait_for_slave_to_start.inc;
 
 connection master;
 --disable_warnings

=== modified file 'mysql-test/suite/rpl/t/rpl_heartbeat.test'
--- a/mysql-test/suite/rpl/t/rpl_heartbeat.test	2009-04-03 16:24:50 +0000
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat.test	2009-06-15 14:00:15 +0000
@@ -113,7 +113,7 @@ drop table if exists t1;
 #
 
 connection slave;
-set @@global.slave_net_timeout= 20;
+set @@global.slave_net_timeout= 10;
 --replace_result $MASTER_MYPORT MASTER_PORT
 # no error this time but rather a warning
 eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 0.5;
@@ -133,7 +133,7 @@ source include/show_slave_status.inc;
 # That would cause reconnecting and relaylog rotation w/o the fix i.e
 # without a heartbeat received.
 
-real_sleep 30;
+real_sleep 15;
 
 # check (compare with the previous show's results) that no rotation happened
 source include/show_slave_status.inc;
@@ -173,10 +173,6 @@ while (`select $slave_value = 0`)
 connection master;
 drop table t1;
 
-# debug print out, todo: remove after bug#37714 is fixed
-let $last_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
-echo *** debug: $last_pos ***
-
 #connection slave;
 sync_slave_with_master;
 set @@global.slave_net_timeout=@restore_slave_net_timeout;

=== added file 'mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test'
--- a/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test	2009-05-13 11:04:33 +0000
@@ -0,0 +1,18 @@
+# BUG#28777 SHOW BINLOG EVENTS does not work on relay log files
+#
+# GOAL
+# ==== 
+# 
+#   Test that SHOW BINLOG EVENTS and the new SHOW RELAYLOG EVENTS works after
+#   the patch, both on master and slave.
+#
+# HOW
+# ===
+#
+#   This test issues SHOW [BINLOG|RELAYLOG] EVENTS both on master and slave after 
+#   some statements have been issued.
+
+-- source include/master-slave.inc
+-- source include/have_binlog_format_row.inc
+
+-- source extra/rpl_tests/rpl_show_relaylog_events.inc

=== added file 'mysql-test/suite/rpl/t/rpl_semi_sync-master.opt'
--- a/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt	2009-06-17 10:37:04 +0000
@@ -0,0 +1 @@
+$SEMISYNC_PLUGIN_OPT

=== added file 'mysql-test/suite/rpl/t/rpl_semi_sync-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_semi_sync-slave.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync-slave.opt	2009-06-17 10:37:04 +0000
@@ -0,0 +1 @@
+$SEMISYNC_PLUGIN_OPT

=== added file 'mysql-test/suite/rpl/t/rpl_semi_sync.test'
--- a/mysql-test/suite/rpl/t/rpl_semi_sync.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test	2009-06-17 10:37:04 +0000
@@ -0,0 +1,373 @@
+source include/have_semisync_plugin.inc;
+source include/not_embedded.inc;
+source include/not_windows.inc;
+source include/have_innodb.inc;
+source include/master-slave.inc;
+
+let $engine_type= InnoDB;
+#let $engine_type= MyISAM;
+
+--echo #
+--echo # Uninstall semi-sync plugins on master and slave
+--echo #
+connection slave;
+disable_query_log;
+source include/stop_slave.inc;
+reset slave;
+disable_warnings;
+error 0,1305;
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+error 0,1305;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+enable_warnings;
+
+connection master;
+reset master;
+set sql_log_bin=0;
+disable_warnings;
+error 0,1305;
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+error 0,1305;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+enable_warnings;
+set sql_log_bin=1;
+enable_query_log;
+
+--echo #
+--echo # Main test of semi-sync replication start here
+--echo #
+
+connection master;
+echo [ on master ];
+
+disable_query_log;
+let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1);
+if (`select '$value' = 'No such row'`)
+{
+    set sql_log_bin=0;
+    INSTALL PLUGIN rpl_semi_sync_master SONAME 'libsemisync_master.so';
+    set global rpl_semi_sync_master_timeout= 5000; /* 5s */
+    set sql_log_bin=1;
+}
+enable_query_log;
+
+echo [ default state of semi-sync on master should be OFF ];
+show variables like 'rpl_semi_sync_master_enabled';
+
+echo [ enable semi-sync on master ];
+set global rpl_semi_sync_master_enabled = 1;
+show variables like 'rpl_semi_sync_master_enabled';
+
+connection slave;
+echo [ on slave ];
+
+disable_query_log;
+let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1);
+if (`select '$value' = 'No such row'`)
+{
+    set sql_log_bin=0;
+    INSTALL PLUGIN rpl_semi_sync_slave SONAME 'libsemisync_slave.so';
+    set sql_log_bin=1;
+}
+enable_query_log;
+
+echo [ default state of semi-sync on slave should be OFF ];
+show variables like 'rpl_semi_sync_slave_enabled';
+
+echo [ enable semi-sync on slave ];
+set global rpl_semi_sync_slave_enabled = 1;
+show variables like 'rpl_semi_sync_slave_enabled';
+source include/start_slave.inc;
+
+connection master;
+echo [ on master ];
+
+# NOTE: Rpl_semi_sync_master_client will only be updated when
+# semi-sync slave has started binlog dump request
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 1;
+source include/wait_for_status_var.inc;
+
+echo [ initial master state after the semi-sync slave connected ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+replace_result $engine_type ENGINE_TYPE;
+eval create table t1(n int) engine = $engine_type;
+
+echo [ master state after CREATE TABLE statement ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+let $i=300;
+echo [ insert records to table ];
+disable_query_log;
+while ($i)
+{
+  eval insert into t1 values ($i);
+  dec $i;
+}
+enable_query_log;
+
+echo [ master status after inserts ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+sync_slave_with_master;
+echo [ on slave ];
+
+echo [ slave status after replicated inserts ];
+show status like 'Rpl_semi_sync_slave_status';
+
+select count(distinct n) from t1;
+select min(n) from t1;
+select max(n) from t1;
+
+source include/stop_slave.inc;
+
+connection master;
+echo [ on master ];
+
+# The first semi-sync check should be on because after slave stop,
+# there are no transactions on the master.
+echo [ master status should be ON ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+show status like 'Rpl_semi_sync_master_clients';
+
+echo [ semi-sync replication of these transactions will fail ];
+insert into t1 values (500);
+delete from t1 where n < 500;
+insert into t1 values (100);
+
+# The second semi-sync check should be off because one transaction
+# times out during waiting.
+echo [ master status should be OFF ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+# Save the master position for later use.
+save_master_pos;
+
+connection slave;
+echo [ on slave ];
+
+echo [ slave status should be OFF ];
+show status like 'Rpl_semi_sync_slave_status';
+source include/start_slave.inc;
+sync_with_master;
+
+echo [ slave status should be ON ];
+show status like 'Rpl_semi_sync_slave_status';
+
+select count(distinct n) from t1;
+select min(n) from t1;
+select max(n) from t1;
+
+connection master;
+echo [ on master ];
+
+echo [ do something to activate semi-sync ];
+drop table t1;
+
+# The third semi-sync check should be on again.
+echo [ master status should be ON again ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+show status like 'Rpl_semi_sync_master_clients';
+
+sync_slave_with_master;
+echo [ on slave ];
+
+source include/stop_slave.inc;
+
+connection master;
+echo [ on master ];
+
+source include/show_master_logs.inc;
+show variables like 'rpl_semi_sync_master_enabled';
+
+echo [ disable semi-sync on the fly ];
+set global rpl_semi_sync_master_enabled=0;
+show variables like 'rpl_semi_sync_master_enabled';
+show status like 'Rpl_semi_sync_master_status';
+
+echo [ enable semi-sync on the fly ];
+set global rpl_semi_sync_master_enabled=1;
+show variables like 'rpl_semi_sync_master_enabled';
+show status like 'Rpl_semi_sync_master_status';
+
+connection slave;
+echo [ on slave ];
+
+source include/start_slave.inc;
+
+connection master;
+echo [ on master ];
+
+replace_result $engine_type ENGINE_TYPE;
+eval create table t1 (a int) engine = $engine_type;
+drop table t1;
+
+##show status like 'Rpl_semi_sync_master_status';
+
+sync_slave_with_master;
+--replace_column 2 #
+show status like 'Rpl_relay%';
+
+echo [ test reset master ];
+connection master;
+echo [ on master];
+
+reset master;
+
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+connection slave;
+echo [ on slave ];
+
+source include/stop_slave.inc;
+reset slave;
+source include/start_slave.inc;
+
+connection master;
+echo [ on master ];
+
+replace_result $engine_type ENGINE_TYPE;
+eval create table t1 (a int) engine = $engine_type;
+insert into t1 values (1);
+insert into t1 values (2), (3);
+
+sync_slave_with_master;
+echo [ on slave ];
+
+select * from t1;
+
+connection master;
+echo [ on master ];
+
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+--echo #
+--echo # Start semi-sync replication without SUPER privilege
+--echo #
+connection master;
+reset master;
+sync_slave_with_master;
+source include/stop_slave.inc;
+reset slave;
+connection master;
+echo [ on master ];
+# Do not binlog the following statement because it will generate
+# different events for ROW and STATEMENT format
+set sql_log_bin=0;
+grant replication slave on *.* to rpl@stripped identified by 'rpl';
+flush privileges;
+set sql_log_bin=1;
+connection slave;
+echo [ on slave ];
+grant replication slave on *.* to rpl@stripped identified by 'rpl';
+flush privileges;
+change master to master_user='rpl',master_password='rpl';
+source include/start_slave.inc;
+connection master;
+echo [ on master ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+insert into t1 values (4);
+insert into t1 values (5);
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+--echo #
+--echo # Test semi-sync slave connect to non-semi-sync master
+--echo #
+
+connection slave;
+echo [ on slave ];
+source include/stop_slave.inc;
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+
+connection master;
+echo [ on master ];
+set sql_log_bin=0;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+set sql_log_bin=1;
+enable_query_log;
+SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled';
+
+connection slave;
+echo [ on slave ];
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+source include/start_slave.inc;
+
+connection master;
+echo [ on master ];
+insert into t1 values (10);
+sync_slave_with_master;
+echo [ on slave ];
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+
+--echo #
+--echo # Test non-semi-sync slave connect to semi-sync master
+--echo #
+
+connection master;
+set sql_log_bin=0;
+INSTALL PLUGIN rpl_semi_sync_master SONAME 'libsemisync_master.so';
+set global rpl_semi_sync_master_timeout= 5000; /* 5s */
+set sql_log_bin=1;
+set global rpl_semi_sync_master_enabled= 1;
+
+connection slave;
+echo [ on slave ];
+source include/stop_slave.inc;
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+
+echo [ uninstall semi-sync slave plugin ];
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+source include/start_slave.inc;
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+source include/stop_slave.inc;
+
+echo [ reinstall semi-sync slave plugin and disable semi-sync ];
+INSTALL PLUGIN rpl_semi_sync_slave SONAME 'libsemisync_slave.so';
+set global rpl_semi_sync_slave_enabled= 0;
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+source include/start_slave.inc;
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+
+--echo #
+--echo # Clean up
+--echo #
+
+connection slave;
+source include/stop_slave.inc;
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+
+connection master;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+
+connection slave;
+source include/start_slave.inc;
+
+connection master;
+drop table t1;
+drop user rpl@stripped.0.1;
+flush privileges;
+sync_slave_with_master;

=== added file 'mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test'
--- a/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test	2009-05-13 11:04:33 +0000
@@ -0,0 +1,18 @@
+# BUG#28777 SHOW BINLOG EVENTS does not work on relay log files
+#
+# GOAL
+# ==== 
+# 
+#   Test that SHOW BINLOG EVENTS and the new SHOW RELAYLOG EVENTS works after
+#   the patch, both on master and slave.
+#
+# HOW
+# ===
+#
+#   This test issues SHOW [BINLOG|RELAYLOG] EVENTS both on master and slave after 
+#   some statements have been issued.
+
+-- source include/master-slave.inc
+-- source include/have_binlog_format_mixed_or_statement.inc
+
+-- source extra/rpl_tests/rpl_show_relaylog_events.inc

=== modified file 'mysql-test/suite/sys_vars/r/read_only_func.result'
--- a/mysql-test/suite/sys_vars/r/read_only_func.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/read_only_func.result	2009-05-21 06:25:17 +0000
@@ -20,7 +20,7 @@ id	name
 CREATE user sameea;
 ** Connecting connn using username 'sameea' **
 SET Global read_ONLY=ON;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 CREATE TABLE t2
 (
 id INT NOT NULL auto_increment,

=== modified file 'mysql-test/t/alter_table.test'
--- a/mysql-test/t/alter_table.test	2009-02-13 16:30:54 +0000
+++ b/mysql-test/t/alter_table.test	2009-06-24 09:53:11 +0000
@@ -1016,3 +1016,14 @@ ALTER TABLE t1
   ADD i INT UNSIGNED NOT NULL AUTO_INCREMENT,
   AUTO_INCREMENT = 1;
 DROP TABLE t1;
+
+#
+# Bug #45052    ALTER TABLE ADD COLUMN crashes server with multiple foreign key columns
+#   The alter table fails if 2 or more new fields added and
+#   also added a key with these fields
+#
+CREATE TABLE t1 (id int);
+INSERT INTO t1 VALUES (1), (2);
+ALTER TABLE t1 ADD COLUMN (f1 INT), ADD COLUMN (f2 INT), ADD KEY f2k(f2);
+DROP TABLE t1;
+

=== modified file 'mysql-test/t/create.test'
--- a/mysql-test/t/create.test	2009-02-13 16:30:54 +0000
+++ b/mysql-test/t/create.test	2009-05-28 21:29:31 +0000
@@ -1547,3 +1547,56 @@ drop table `me:i`;
 
 --echo
 --echo End of 5.1 tests
+
+
+###########################################################################
+
+--echo
+--echo # --
+--echo # -- Bug #43054 	Assertion `!table->auto_increment_field_not_null' 
+--echo # --       failed when redefining trigger
+--echo
+
+#--disable_abort_on_error
+
+CREATE TABLE B (
+  pk INTEGER AUTO_INCREMENT,
+  int_key INTEGER NOT NULL,
+  PRIMARY KEY (pk),
+  KEY (int_key)
+);
+
+INSERT IGNORE INTO B VALUES ('9', '9');
+
+CREATE TABLE IF NOT EXISTS t1 ( 
+  `pk` INTEGER NOT NULL AUTO_INCREMENT , 
+  `int` INTEGER ,
+   PRIMARY KEY ( `pk` ) 
+) SELECT `pk` , `int_key` FROM B ;
+
+--delimiter |
+
+CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW 
+BEGIN 
+  INSERT INTO t1 ( `int` ) VALUES (4 ),( 8 ),( 2 ) ; 
+END ; |
+
+--delimiter ;
+--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
+CREATE TABLE IF NOT EXISTS t1 ( 
+  `pk` INTEGER NOT NULL AUTO_INCREMENT , 
+  `int` INTEGER ,
+  PRIMARY KEY ( `pk` ) 
+) SELECT `pk` , `int_key` FROM B ;
+
+--delimiter |
+--error ER_NOT_SUPPORTED_YET
+CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW 
+BEGIN 
+  UPDATE A SET `pk`=1 WHERE `pk`=0 ; 
+END ;|
+
+--delimiter ;
+
+DROP TABLE t1;
+DROP TABLE B;

=== modified file 'mysql-test/t/ctype_utf8.test'
--- a/mysql-test/t/ctype_utf8.test	2009-06-02 13:04:43 +0000
+++ b/mysql-test/t/ctype_utf8.test	2009-06-11 09:13:52 +0000
@@ -2,6 +2,8 @@
 # Tests with the utf8 character set
 #
 
+--source include/have_innodb.inc
+
 --disable_warnings
 drop table if exists t1,t2;
 --enable_warnings
@@ -256,9 +258,7 @@ drop table t1;
 # Bug 4521: unique key prefix interacts poorly with utf8
 # InnoDB: keys with prefix compression, case insensitive collation.
 #
---disable_warnings
 create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
---enable_warnings
 insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
 insert into t1 values ('aaaaaaaaaa');
 --error ER_DUP_ENTRY
@@ -306,9 +306,7 @@ drop table t1;
 # Bug 4521: unique key prefix interacts poorly with utf8
 # InnoDB: fixed length keys, case insensitive collation
 #
---disable_warnings
 create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb;
---enable_warnings
 insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
 insert into t1 values ('a');
 insert into t1 values ('aa');
@@ -383,12 +381,10 @@ drop table t1;
 # Bug 4531: unique key prefix interacts poorly with utf8
 # Check BDB, case insensitive collation
 #
---disable_warnings
 create table t1 (
 c char(10) character set utf8,
 unique key a (c(1))
 ) engine=innodb;
---enable_warnings
 insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
 --error ER_DUP_ENTRY
 insert into t1 values ('aa');
@@ -506,12 +502,10 @@ drop table t1;
 # Bug 4531: unique key prefix interacts poorly with utf8
 # Check BDB, binary collation
 #
---disable_warnings
 create table t1 (
 c char(10) character set utf8 collate utf8_bin,
 unique key a (c(1))
 ) engine=innodb;
---enable_warnings
 insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
 --error ER_DUP_ENTRY
 insert into t1 values ('aa');
@@ -543,12 +537,10 @@ drop table t1;
 # Bug#4594: column index make = failed for gbk, but like works
 # Check InnoDB
 #
---disable_warnings
 create table t1 (
   str varchar(255) character set utf8 not null,
   key str  (str(2))
 ) engine=innodb;
---enable_warnings
 INSERT INTO t1 VALUES ('str');
 INSERT INTO t1 VALUES ('str2');
 select * from t1 where str='str';
@@ -581,12 +573,10 @@ drop table t1;
 # the same for BDB
 #
 
---disable_warnings
 create table t1 (
   str varchar(255) character set utf8 not null,
   key str (str(2))
 ) engine=innodb;
---enable_warnings
 INSERT INTO t1 VALUES ('str');
 INSERT INTO t1 VALUES ('str2');
 select * from t1 where str='str';
@@ -603,14 +593,11 @@ DROP TABLE t1;
 #
 # Bug #5723: length(<varchar utf8 field>) returns varying results
 #
---disable_warnings
 SET NAMES utf8;
---disable_warnings
 CREATE TABLE t1 (
   subject varchar(255) character set utf8 collate utf8_unicode_ci,
   p varchar(15) character set utf8
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
---enable_warnings
 INSERT INTO t1 VALUES ('谷川俊二と申します INTO t1 VALUES ('aaa','bbb');
 SELECT length(subject) FROM t1;
@@ -661,18 +648,14 @@ DROP TABLE t1;
 # Bug #6019 SELECT tries to use too short prefix index on utf8 data
 #
 set names utf8;
---disable_warnings
 create table t1 (
   a int primary key,
   b varchar(6),
   index b3(b(3))
 ) engine=innodb character set=utf8;
---enable_warnings
 insert into t1 values(1,'foo'),(2,'foobar');
 select * from t1 where b like 'foob%';
---disable_warnings
 alter table t1 engine=innodb;
---enable_warnings
 select * from t1 where b like 'foob%';
 drop table t1;
 
@@ -841,14 +824,12 @@ INSERT INTO t1 VALUES 
 (1,'blah','464','aaa','fkc1c9ilc20x0hgae7lx6j09','ERR','ERR Имри.Афимим.Аеимимримдмримрмрирор имримримрад.Адимримримрмдиримримр05-06-01 17:30:43','1234567890'),
 (2,'blah','464','aaa','haxpl2ilc20x00bj4tt2m5ti','11','11 g','G',3,'2005-06-02 22:43:10','1234567890');
 
---disable_warnings
 CREATE TABLE t2 (
   `msisdn` varchar(15) NOT NULL default '',
   `operator_id` int(11) NOT NULL default '0',
   `created` datetime NOT NULL default '0000-00-00 00:00:00',
   UNIQUE KEY `PK_user` (`msisdn`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
---enable_warnings
 
 INSERT INTO t2 VALUES ('1234567890',2,'2005-05-24 13:53:25');
 
@@ -1013,10 +994,8 @@ drop table t1;
 # additional tests from duplicate bug#20744 MySQL return no result
 
 set names utf8;
---disable_warnings
 create table t1 (a varchar(30) not null primary key)
 engine=innodb  default character set utf8 collate utf8_general_ci;
---enable_warnings
 insert into t1 values ('あいうえおかきくけこさし as gci1 from t1 where a like 'さしすせそ03,8 @@ select a as gci2 from t1 where a like 'e_warnings
 create table t1 (a varchar(30) not null primary key)
 engine=innodb default character set utf8 collate utf8_unicode_ci;
---enable_warnings
 insert into t1 values ('あいうえおかきくけこさしすせそ');
 insert into t1 values ('さしすせそかきくけこあいうえお');
 select a as uci1 from t1 where a like 'さしすせそかきくけこあいうえお%';
@@ -1035,10 +1012,8 @@ select a as uci2 from t1 where a like '�drop table t1;
 
 set names utf8;
---disable_warnings
 create table t1 (a varchar(30) not null primary key)
 engine=innodb default character set utf8 collate utf8_bin;
---enable_warnings
 insert into t1 values ('あいうえおかきくけこさしす bin1 from t1 where a like 'さしすせそか22 @@ select concat(a, if(b>10, 'x' 'x', 'y' '
 select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1;
 drop table t1;
 
-
 #
 # Bug#19960: Inconsistent results when joining
 # InnoDB tables using partial UTF8 indexes
 #
---disable_warnings
+
 CREATE TABLE t1 (
   colA int(11) NOT NULL,
   colB varchar(255) character set utf8 NOT NULL,
    PRIMARY KEY  (colA)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
---enable_warnings
 INSERT INTO t1 (colA, colB) VALUES (1, 'foo'), (2, 'foo bar');
---disable_warnings
 CREATE TABLE t2 (
   colA int(11) NOT NULL,
   colB varchar(255) character set utf8 NOT NULL,
    KEY bad  (colA,colB(3))
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
---enable_warnings
 INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar');
 SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB
 WHERE t1.colA < 3;

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2009-05-18 17:15:47 +0000
+++ b/mysql-test/t/disabled.def	2009-06-11 14:24:28 +0000
@@ -10,8 +10,8 @@
 #
 ##############################################################################
 cast                 : Bug#35594 2008-03-27 main.cast fails on Windows2003-64
-kill                     : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
-innodb_bug39438          : BUG#42383 2009-01-28 lsoares "This fails in embedded and on windows.  Note that this test is not run on windows and on embedded in PB for main trees currently"
-query_cache_28249        : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
+kill                 : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
+innodb_bug39438      : Bug#42383 2009-01-28 lsoares "This fails in embedded and on windows.  Note that this test is not run on windows and on embedded in PB for main trees currently"
+query_cache_28249    : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
 information_schema   : Bug#42893 2009-03-26 alik main.information_schema times out sporadically
-init_connect             : Bug#44920 2009-05-18 pcrews MTR2 is not processing master.opt input properly on Windows
+init_connect         : Bug#44920 2009-05-18 pcrews MTR2 is not processing master.opt input properly on Windows

=== modified file 'mysql-test/t/grant.test'
--- a/mysql-test/t/grant.test	2009-05-29 15:06:21 +0000
+++ b/mysql-test/t/grant.test	2009-06-17 07:30:19 +0000
@@ -1850,3 +1850,29 @@ DROP USER mysqltest_u1@localhost;
 --echo
 --echo # End of Bug#38347.
 --echo
+
+--echo #
+--echo # Bug #25863 No database selected error, but documentation 
+--echo #            says * for global allowed
+--echo #
+
+connect(conn1,localhost,root,,*NO-ONE*);
+
+--error ER_NO_DB_ERROR
+GRANT ALL ON * TO mysqltest_1;
+
+GRANT ALL ON *.* TO mysqltest_1;
+SHOW GRANTS FOR mysqltest_1;
+DROP USER mysqltest_1;
+
+USE test;
+
+GRANT ALL ON * TO mysqltest_1;
+SHOW GRANTS FOR mysqltest_1;
+DROP USER mysqltest_1;
+
+GRANT ALL ON *.* TO mysqltest_1;
+SHOW GRANTS FOR mysqltest_1;
+DROP USER mysqltest_1;
+
+disconnect conn1;

=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test	2009-05-15 13:45:06 +0000
+++ b/mysql-test/t/information_schema.test	2009-06-24 09:41:25 +0000
@@ -1562,3 +1562,15 @@ disconnect con7;
 # Wait till all disconnects are completed
 --source include/wait_until_count_sessions.inc
 
+#
+# Bug #43834    Assertion in Natural_join_column::db_name() on an I_S query
+#
+
+SELECT *
+FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
+LEFT JOIN INFORMATION_SCHEMA.COLUMNS
+USING (TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME)
+WHERE COLUMNS.TABLE_SCHEMA = 'test'
+AND COLUMNS.TABLE_NAME = 't1';
+
+

=== modified file 'mysql-test/t/profiling.test'
--- a/mysql-test/t/profiling.test	2009-05-15 12:57:51 +0000
+++ b/mysql-test/t/profiling.test	2009-06-17 07:30:19 +0000
@@ -1,4 +1,4 @@
---source include/have_community_features.inc
+--source include/have_profiling.inc
 
 # Verify that the protocol isn't violated if we ask for profiling info
 # before profiling has recorded anything.

=== modified file 'mysql-test/t/sp.test'
--- a/mysql-test/t/sp.test	2009-06-04 13:50:05 +0000
+++ b/mysql-test/t/sp.test	2009-06-17 07:30:19 +0000
@@ -8372,6 +8372,27 @@ DROP FUNCTION f3;
 DROP FUNCTION f4;
 DROP TABLE t1;
 
+#
+# Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non 
+#            strict SQL mode
+#
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+
+CREATE PROCEDURE p1 ()
+COMMENT
+'12345678901234567890123456789012345678901234567890123456789012345678901234567890'
+BEGIN
+END;
+
+SELECT comment FROM mysql.proc WHERE name = "p1";
+
+SELECT routine_comment FROM information_schema.routines WHERE routine_name = "p1";
+
+DROP PROCEDURE p1;
+
 --echo # ------------------------------------------------------------------
 --echo # -- End of 6.0 tests
 --echo # ------------------------------------------------------------------

=== modified file 'mysql-test/t/sql_mode.test'
--- a/mysql-test/t/sql_mode.test	2008-02-24 12:58:07 +0000
+++ b/mysql-test/t/sql_mode.test	2009-06-05 07:56:52 +0000
@@ -308,3 +308,16 @@ flush privileges;
 
 --connection default
 drop user mysqltest_32753@localhost;
+
+#
+# Bug#21099 MySQL 5.0.22 silently creates MyISAM tables even though 
+#           InnoDB specified.
+#
+
+SET @org_mode=@@sql_mode;
+SET @@sql_mode='traditional';
+
+# Agreed change was to add NO_ENGINE_SUBSTITUTION to TRADITIONAL sql mode.
+SELECT @@sql_mode LIKE '%NO_ENGINE_SUBSTITUTION%';
+
+SET sql_mode=@org_mode;

=== modified file 'mysql-test/t/trigger.test'
--- a/mysql-test/t/trigger.test	2009-03-27 13:03:00 +0000
+++ b/mysql-test/t/trigger.test	2009-06-16 12:27:49 +0000
@@ -2435,4 +2435,31 @@ DROP TRIGGER trg1;
 DROP TRIGGER trg2;
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#34453 Can't change size of file (Errcode: 1224)
+--echo #
+
+--disable_warnings
+DROP TRIGGER IF EXISTS t1_bi;
+DROP TRIGGER IF EXISTS t1_bd;
+DROP TABLE IF EXISTS t1;
+DROP TEMPORARY TABLE IF EXISTS t2;
+--enable_warnings
+
+CREATE TABLE t1 (s1 INT);
+CREATE TEMPORARY TABLE t2 (s1 INT);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (0);
+CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t2;
+INSERT INTO t1 VALUES (0);
+INSERT INTO t1 VALUES (0);
+SELECT * FROM t1;
+SELECT * FROM t2;
+-- echo # Reported to give ERROR 14 (HY000): 
+-- echo # Can't change size of file (Errcode: 1224)
+-- echo # on Windows 
+DELETE FROM t1;
+
+DROP TABLE t1;
+DROP TEMPORARY TABLE t2;
+
 --echo End of 6.0 tests.

=== modified file 'mysql-test/t/variables+c.test'
--- a/mysql-test/t/variables+c.test	2007-05-02 18:13:33 +0000
+++ b/mysql-test/t/variables+c.test	2009-06-10 07:55:29 +0000
@@ -1,4 +1,4 @@
---source include/have_community_features.inc
+--source include/have_profiling.inc
 
 #
 # Bug#24822: Patch: uptime_since_flush_status

=== added directory 'plugin/semisync'
=== added file 'plugin/semisync/Makefile.am'
--- a/plugin/semisync/Makefile.am	1970-01-01 00:00:00 +0000
+++ b/plugin/semisync/Makefile.am	2009-06-16 05:36:36 +0000
@@ -0,0 +1,35 @@
+# 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
+
+## Makefile.am for semi-synchronous replication
+
+pkgplugindir =		$(pkglibdir)/plugin
+INCLUDES =              -I$(top_srcdir)/include \
+			-I$(top_srcdir)/sql \
+			-I$(srcdir)
+
+noinst_HEADERS = semisync.h semisync_master.h semisync_slave.h
+
+pkgplugin_LTLIBRARIES =	libsemisync_master.la libsemisync_slave.la
+
+libsemisync_master_la_LDFLAGS =	-module
+libsemisync_master_la_CXXFLAGS=	$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+libsemisync_master_la_CFLAGS =	$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+libsemisync_master_la_SOURCES = semisync.cc semisync_master.cc semisync_master_plugin.cc
+
+libsemisync_slave_la_LDFLAGS =	-module
+libsemisync_slave_la_CXXFLAGS=	$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+libsemisync_slave_la_CFLAGS =	$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
+libsemisync_slave_la_SOURCES = semisync.cc semisync_slave.cc semisync_slave_plugin.cc

=== added file 'plugin/semisync/configure.in'
--- a/plugin/semisync/configure.in	1970-01-01 00:00:00 +0000
+++ b/plugin/semisync/configure.in	2009-06-17 10:37:04 +0000
@@ -0,0 +1,9 @@
+# configure.in for semi-synchronous replication
+
+AC_INIT(mysql-semi-sync-plugin, 0.2)
+AM_INIT_AUTOMAKE
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+

=== added file 'plugin/semisync/plug.in'
--- a/plugin/semisync/plug.in	1970-01-01 00:00:00 +0000
+++ b/plugin/semisync/plug.in	2009-06-15 13:30:20 +0000
@@ -0,0 +1,3 @@
+MYSQL_PLUGIN(semisync,[Semi-synchronous Replication Plugin],
+        [Semi-synchronous replication plugin.])
+MYSQL_PLUGIN_DYNAMIC(semisync,   [libsemisync_master.la libsemisync_slave.la])

=== added file 'plugin/semisync/semisync.cc'
--- a/plugin/semisync/semisync.cc	1970-01-01 00:00:00 +0000
+++ b/plugin/semisync/semisync.cc	2009-06-15 13:30:20 +0000
@@ -0,0 +1,30 @@
+/* Copyright (C) 2007 Google Inc.
+   Copyright (C) 2008 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 "semisync.h"
+
+const unsigned char ReplSemiSyncBase::kPacketMagicNum = 0xef;
+const unsigned char ReplSemiSyncBase::kPacketFlagSync = 0x01;
+
+
+const unsigned long Trace::kTraceGeneral  = 0x0001;
+const unsigned long Trace::kTraceDetail   = 0x0010;
+const unsigned long Trace::kTraceNetWait  = 0x0020;
+const unsigned long Trace::kTraceFunction = 0x0040;
+
+const char  ReplSemiSyncBase::kSyncHeader[2] =
+  {ReplSemiSyncBase::kPacketMagicNum, 0};

=== added file 'plugin/semisync/semisync.h'
--- a/plugin/semisync/semisync.h	1970-01-01 00:00:00 +0000
+++ b/plugin/semisync/semisync.h	2009-06-17 10:37:04 +0000
@@ -0,0 +1,95 @@
+/* Copyright (C) 2007 Google Inc.
+   Copyright (C) 2008 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 */
+
+
+#ifndef SEMISYNC_H
+#define SEMISYNC_H
+
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+#include <sys/time.h>
+#include <time.h>
+#include <stdio.h>
+#include <pthread.h>
+#include <mysql.h>
+
+typedef uint32_t uint32;
+typedef unsigned long long my_off_t;
+#define FN_REFLEN	512	/* Max length of full path-name */
+void sql_print_error(const char *format, ...);
+void sql_print_warning(const char *format, ...);
+void sql_print_information(const char *format, ...);
+extern unsigned long max_connections;
+
+#define MYSQL_SERVER
+#define HAVE_REPLICATION
+#include <my_global.h>
+#include <my_pthread.h>
+#include <mysql/plugin.h>
+#include <replication.h>
+
+typedef struct st_mysql_show_var SHOW_VAR;
+typedef struct st_mysql_sys_var SYS_VAR;
+
+
+/**
+   This class is used to trace function calls and other process
+   information
+*/
+class Trace {
+public:
+  static const unsigned long kTraceFunction;
+  static const unsigned long kTraceGeneral;
+  static const unsigned long kTraceDetail;
+  static const unsigned long kTraceNetWait;
+

+  unsigned long           trace_level_;                      /* the level for tracing */
+
+  inline void function_enter(const char *func_name)
+  {
+    if (trace_level_ & kTraceFunction)
+      sql_print_information("---> %s enter", func_name);
+  }
+  inline int  function_exit(const char *func_name, int exit_code)
+  {
+    if (trace_level_ & kTraceFunction)
+      sql_print_information("<--- %s exit (%d)", func_name, exit_code);
+    return exit_code;
+  }
+
+  Trace()
+    :trace_level_(0L)
+  {}
+  Trace(unsigned long trace_level)
+    :trace_level_(trace_level)
+  {}
+};
+
+/**
+   Base class for semi-sync master and slave classes
+*/
+class ReplSemiSyncBase
+  :public Trace {
+public:
+  static const char  kSyncHeader[2];              /* three byte packet header */
+
+  /* Constants in network packet header. */
+  static const unsigned char kPacketMagicNum;
+  static const unsigned char kPacketFlagSync;
+};
+
+#endif /* SEMISYNC_H */

=== added file 'plugin/semisync/semisync_master.cc'
--- a/plugin/semisync/semisync_master.cc	1970-01-01 00:00:00 +0000
+++ b/plugin/semisync/semisync_master.cc	2009-06-17 10:37:04 +0000
@@ -0,0 +1,1184 @@
+/* Copyright (C) 2007 Google Inc.
+   Copyright (C) 2008 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 "semisync_master.h"
+
+#define TIME_THOUSAND 1000
+#define TIME_MILLION  1000000
+#define TIME_BILLION  1000000000
+
+/* This indicates whether semi-synchronous replication is enabled. */
+char rpl_semi_sync_master_enabled;
+unsigned long rpl_semi_sync_master_timeout;
+unsigned long rpl_semi_sync_master_trace_level;
+unsigned long rpl_semi_sync_master_status           = 0;
+unsigned long rpl_semi_sync_master_yes_transactions = 0;
+unsigned long rpl_semi_sync_master_no_transactions  = 0;
+unsigned long rpl_semi_sync_master_off_times        = 0;
+unsigned long rpl_semi_sync_master_timefunc_fails   = 0;
+unsigned long rpl_semi_sync_master_num_timeouts     = 0;
+unsigned long rpl_semi_sync_master_wait_sessions    = 0;
+unsigned long rpl_semi_sync_master_back_wait_pos    = 0;
+unsigned long rpl_semi_sync_master_trx_wait_time    = 0;
+unsigned long long rpl_semi_sync_master_trx_wait_num = 0;
+unsigned long rpl_semi_sync_master_net_wait_time    = 0;
+unsigned long long rpl_semi_sync_master_net_wait_num = 0;
+unsigned long rpl_semi_sync_master_clients          = 0;
+unsigned long long rpl_semi_sync_master_net_wait_total_time = 0;
+unsigned long long rpl_semi_sync_master_trx_wait_total_time = 0;
+
+
+static int getWaitTime(const struct timeval& start_tv);
+
+/*******************************************************************************
+ *
+ * <ActiveTranx> class : manage all active transaction nodes
+ *
+ ******************************************************************************/
+
+ActiveTranx::ActiveTranx(int max_connections,
+			 pthread_mutex_t *lock,
+			 unsigned long trace_level)
+  : Trace(trace_level), num_transactions_(max_connections),
+    num_entries_(max_connections << 1),
+    lock_(lock)
+{
+  /* Allocate the memory for the array */
+  node_array_ = new TranxNode[num_transactions_];
+  for (int idx = 0; idx < num_transactions_; ++idx)
+  {
+    node_array_[idx].log_pos_     = 0;
+    node_array_[idx].hash_next_   = NULL;
+    node_array_[idx].next_        = node_array_ + idx + 1;
+
+    node_array_[idx].log_name_    = new char[FN_REFLEN];
+    node_array_[idx].log_name_[0] = '\x0';
+  }
+  node_array_[num_transactions_-1].next_ = NULL;
+
+  /* All nodes in the array go to the pool initially. */
+  free_pool_ = node_array_;
+
+  /* No transactions are in the list initially. */
+  trx_front_ = NULL;
+  trx_rear_  = NULL;
+
+  /* Create the hash table to find a transaction's ending event. */
+  trx_htb_ = new TranxNode *[num_entries_];
+  for (int idx = 0; idx < num_entries_; ++idx)
+    trx_htb_[idx] = NULL;
+
+  sql_print_information("Semi-sync replication initialized for %d "
+                        "transactions.", num_transactions_);
+}
+
+ActiveTranx::~ActiveTranx()
+{
+  for (int idx = 0; idx < num_transactions_; ++idx)
+  {
+    delete node_array_[idx].log_name_;
+    node_array_[idx].log_name_ = NULL;
+  }
+
+  delete [] node_array_;
+  delete [] trx_htb_;
+
+  node_array_       = NULL;
+  trx_htb_          = NULL;
+  num_transactions_ = 0;
+  num_entries_      = 0;
+}
+
+unsigned int ActiveTranx::calc_hash(const unsigned char *key,
+                                    unsigned int length)
+{
+  unsigned int nr = 1, nr2 = 4;
+
+  /* The hash implementation comes from calc_hashnr() in mysys/hash.c. */
+  while (length--)
+  {
+    nr  ^= (((nr & 63)+nr2)*((unsigned int) (unsigned char) *key++))+ (nr << 8);
+    nr2 += 3;
+  }
+  return((unsigned int) nr);
+}
+
+unsigned int ActiveTranx::get_hash_value(const char *log_file_name,
+				 my_off_t    log_file_pos)
+{
+  unsigned int hash1 = calc_hash((const unsigned char *)log_file_name,
+                                 strlen(log_file_name));
+  unsigned int hash2 = calc_hash((const unsigned char *)(&log_file_pos),
+                                 sizeof(log_file_pos));
+
+  return (hash1 + hash2) % num_entries_;
+}
+
+ActiveTranx::TranxNode* ActiveTranx::alloc_tranx_node()
+{
+  TranxNode *ptr = free_pool_;
+
+  if (free_pool_)
+  {
+    free_pool_ = free_pool_->next_;
+    ptr->next_ = NULL;
+    ptr->hash_next_ = NULL;
+  }
+
+  return ptr;
+}
+
+int ActiveTranx::compare(const char *log_file_name1, my_off_t log_file_pos1,
+			 const char *log_file_name2, my_off_t log_file_pos2)
+{
+  int cmp = strcmp(log_file_name1, log_file_name2);
+
+  if (cmp != 0)
+    return cmp;
+
+  if (log_file_pos1 > log_file_pos2)
+    return 1;
+  else if (log_file_pos1 < log_file_pos2)
+    return -1;
+  return 0;
+}
+
+int ActiveTranx::insert_tranx_node(const char *log_file_name,
+				   my_off_t log_file_pos)
+{
+  const char *kWho = "ActiveTranx:insert_tranx_node";
+  TranxNode  *ins_node;
+  int         result = 0;
+  unsigned int        hash_val;
+
+  function_enter(kWho);
+
+  ins_node = alloc_tranx_node();
+  if (!ins_node)
+  {
+    sql_print_error("%s: transaction node allocation failed for: (%s, %lu)",
+                    kWho, log_file_name, (unsigned long)log_file_pos);
+    result = -1;
+    goto l_end;
+  }
+
+  /* insert the binlog position in the active transaction list. */
+  strcpy(ins_node->log_name_, log_file_name);
+  ins_node->log_pos_ = log_file_pos;
+
+  if (!trx_front_)
+  {
+    /* The list is empty. */
+    trx_front_ = trx_rear_ = ins_node;
+  }
+  else
+  {
+    int cmp = compare(ins_node, trx_rear_);
+    if (cmp > 0)
+    {
+      /* Compare with the tail first.  If the transaction happens later in
+       * binlog, then make it the new tail.
+       */
+      trx_rear_->next_ = ins_node;
+      trx_rear_        = ins_node;
+    }
+    else
+    {
+      /* Otherwise, it is an error because the transaction should hold the
+       * mysql_bin_log.LOCK_log when appending events.
+       */
+      sql_print_error("%s: binlog write out-of-order, tail (%s, %lu), "
+                      "new node (%s, %lu)", kWho,
+                      trx_rear_->log_name_, (unsigned long)trx_rear_->log_pos_,
+                      ins_node->log_name_, (unsigned long)ins_node->log_pos_);
+      result = -1;
+      goto l_end;
+    }
+  }
+
+  hash_val = get_hash_value(ins_node->log_name_, ins_node->log_pos_);
+  ins_node->hash_next_ = trx_htb_[hash_val];
+  trx_htb_[hash_val]   = ins_node;
+
+  if (trace_level_ & kTraceDetail)
+    sql_print_information("%s: insert (%s, %lu) in entry(%u)", kWho,
+                          ins_node->log_name_, (unsigned long)ins_node->log_pos_,
+                          hash_val);
+
+ l_end:
+  return function_exit(kWho, result);
+}
+
+bool ActiveTranx::is_tranx_end_pos(const char *log_file_name,
+				   my_off_t    log_file_pos)
+{
+  const char *kWho = "ActiveTranx::is_tranx_end_pos";
+  function_enter(kWho);
+
+  unsigned int hash_val = get_hash_value(log_file_name, log_file_pos);
+  TranxNode *entry = trx_htb_[hash_val];
+
+  while (entry != NULL)
+  {
+    if (compare(entry, log_file_name, log_file_pos) == 0)
+      break;
+
+    entry = entry->hash_next_;
+  }
+
+  if (trace_level_ & kTraceDetail)
+    sql_print_information("%s: probe (%s, %lu) in entry(%u)", kWho,
+                          log_file_name, (unsigned long)log_file_pos, hash_val);
+
+  function_exit(kWho, (entry != NULL));
+  return (entry != NULL);
+}
+
+int ActiveTranx::clear_active_tranx_nodes(const char *log_file_name,
+					  my_off_t log_file_pos)
+{
+  const char *kWho = "ActiveTranx::::clear_active_tranx_nodes";
+  TranxNode *new_front;
+
+  function_enter(kWho);
+
+  if (log_file_name != NULL)
+  {
+    new_front = trx_front_;
+
+    while (new_front)
+    {
+      if (compare(new_front, log_file_name, log_file_pos) > 0)
+        break;
+      new_front = new_front->next_;
+    }
+  }
+  else
+  {
+    /* If log_file_name is NULL, clear everything. */
+    new_front = NULL;
+  }
+
+  if (new_front == NULL)
+  {
+    /* No active transaction nodes after the call. */
+
+    /* Clear the hash table. */
+    memset(trx_htb_, 0, num_entries_ * sizeof(TranxNode *));
+
+    /* Clear the active transaction list. */
+    if (trx_front_ != NULL)
+    {
+      trx_rear_->next_ = free_pool_;
+      free_pool_ = trx_front_;
+      trx_front_ = NULL;
+      trx_rear_  = NULL;
+    }
+
+    if (trace_level_ & kTraceDetail)
+      sql_print_information("%s: free all nodes back to free list", kWho);
+  }
+  else if (new_front != trx_front_)
+  {
+    TranxNode *curr_node, *next_node;
+
+    /* Delete all transaction nodes before the confirmation point. */
+    int n_frees = 0;
+    curr_node = trx_front_;
+    while (curr_node != new_front)
+    {
+      next_node = curr_node->next_;
+
+      /* Put the node in the memory pool. */
+      curr_node->next_ = free_pool_;
+      free_pool_       = curr_node;
+      n_frees++;
+
+      /* Remove the node from the hash table. */
+      unsigned int hash_val = get_hash_value(curr_node->log_name_, curr_node->log_pos_);
+      TranxNode **hash_ptr = &(trx_htb_[hash_val]);
+      while ((*hash_ptr) != NULL)
+      {
+        if ((*hash_ptr) == curr_node)
+	{
+          (*hash_ptr) = curr_node->hash_next_;
+          break;
+        }
+        hash_ptr = &((*hash_ptr)->hash_next_);
+      }
+
+      curr_node = next_node;
+    }
+
+    trx_front_ = new_front;
+
+    if (trace_level_ & kTraceDetail)
+      sql_print_information("%s: free %d nodes back until pos (%s, %lu)",
+                            kWho, n_frees,
+                            trx_front_->log_name_, (unsigned long)trx_front_->log_pos_);
+  }
+
+  return function_exit(kWho, 0);
+}
+
+
+/*******************************************************************************
+ *
+ * <ReplSemiSyncMaster> class: the basic code layer for sync-replication master.
+ * <ReplSemiSyncSlave>  class: the basic code layer for sync-replication slave.
+ *
+ * The most important functions during semi-syn replication listed:
+ *
+ * Master:
+ *  . reportReplyBinlog(): called by the binlog dump thread when it receives
+ *                         the slave's status information.
+ *  . updateSyncHeader():  based on transaction waiting information, decide
+ *                         whether to request the slave to reply.
+ *  . writeTraxInBinlog(): called by the transaction thread when it finishes
+ *                         writing all transaction events in binlog.
+ *  . commitTrx():         transaction thread wait for the slave reply.
+ *
+ * Slave:
+ *  . slaveReadSyncHeader(): read the semi-sync header from the master, get the
+ *                         sync status and get the payload for events.
+ *  . slaveReply():        reply to the master about the replication progress.
+ *
+ ******************************************************************************/
+
+ReplSemiSyncMaster::ReplSemiSyncMaster()
+  : active_tranxs_(NULL),
+    init_done_(false),
+    reply_file_name_inited_(false),
+    reply_file_pos_(0L),
+    wait_file_name_inited_(false),
+    wait_file_pos_(0),
+    master_enabled_(false),
+    wait_timeout_(0L),
+    state_(0),
+    enabled_transactions_(0),
+    disabled_transactions_(0),
+    switched_off_times_(0),
+    timefunc_fails_(0),
+    wait_sessions_(0),
+    wait_backtraverse_(0),
+    total_trx_wait_num_(0),
+    total_trx_wait_time_(0),
+    total_net_wait_num_(0),
+    total_net_wait_time_(0),
+    max_transactions_(0L)
+{
+  strcpy(reply_file_name_, "");
+  strcpy(wait_file_name_, "");
+}
+
+int ReplSemiSyncMaster::initObject()
+{
+  int result;
+  const char *kWho = "ReplSemiSyncMaster::initObject";
+
+  if (init_done_)
+  {
+    fprintf(stderr, "%s called twice\n", kWho);
+    return 1;
+  }
+  init_done_ = true;
+
+  /* References to the parameter works after set_options(). */
+  setWaitTimeout(rpl_semi_sync_master_timeout);
+  setTraceLevel(rpl_semi_sync_master_trace_level);
+  max_transactions_ = (int)max_connections;
+
+  /* Mutex initialization can only be done after MY_INIT(). */
+  pthread_mutex_init(&LOCK_binlog_, MY_MUTEX_INIT_FAST);
+  pthread_cond_init(&COND_binlog_send_, NULL);
+
+  if (rpl_semi_sync_master_enabled)
+    result = enableMaster();
+  else
+    result = disableMaster();
+
+  return result;
+}
+
+int ReplSemiSyncMaster::enableMaster()
+{
+  int result = 0;
+
+  /* Must have the lock when we do enable of disable. */
+  lock();
+
+  if (!getMasterEnabled())
+  {
+    active_tranxs_ = new ActiveTranx(max_connections,
+				     &LOCK_binlog_,
+				     trace_level_);
+    if (active_tranxs_ != NULL)
+    {
+      commit_file_name_inited_ = false;
+      reply_file_name_inited_  = false;
+      wait_file_name_inited_   = false;
+
+      set_master_enabled(true);
+      state_ = true;
+      sql_print_information("Semi-sync replication enabled on the master.");
+    }
+    else
+    {
+      sql_print_information("Semi-sync replication not able to allocate memory.");
+      result = -1;
+    }
+  }
+
+  unlock();
+
+  return result;
+}
+
+int ReplSemiSyncMaster::disableMaster()
+{
+  /* Must have the lock when we do enable of disable. */
+  lock();
+
+  if (getMasterEnabled())
+  {
+    /* Switch off the semi-sync first so that waiting transaction will be
+     * waken up.
+     */
+    switch_off();
+
+    assert(active_tranxs_ != NULL);
+    delete active_tranxs_;
+    active_tranxs_ = NULL;
+
+    reply_file_name_inited_ = false;
+    wait_file_name_inited_  = false;
+    commit_file_name_inited_ = false;
+
+    set_master_enabled(false);
+    sql_print_information("Semi-sync replication disabled on the master.");
+  }
+
+  unlock();
+
+  return 0;
+}
+
+ReplSemiSyncMaster::~ReplSemiSyncMaster()
+{
+  if (init_done_)
+  {
+    pthread_mutex_destroy(&LOCK_binlog_);
+    pthread_cond_destroy(&COND_binlog_send_);
+  }
+
+  delete active_tranxs_;
+}
+
+void ReplSemiSyncMaster::lock()
+{
+  pthread_mutex_lock(&LOCK_binlog_);
+}
+
+void ReplSemiSyncMaster::unlock()
+{
+  pthread_mutex_unlock(&LOCK_binlog_);
+}
+
+void ReplSemiSyncMaster::cond_broadcast()
+{
+  pthread_cond_broadcast(&COND_binlog_send_);
+}
+
+int ReplSemiSyncMaster::cond_timewait(struct timespec *wait_time)
+{
+  const char *kWho = "ReplSemiSyncMaster::cond_timewait()";
+  int wait_res;
+
+  function_enter(kWho);
+  wait_res = pthread_cond_timedwait(&COND_binlog_send_,
+                                    &LOCK_binlog_, wait_time);
+  return function_exit(kWho, wait_res);
+}
+
+void ReplSemiSyncMaster::add_slave()
+{
+  lock();
+  rpl_semi_sync_master_clients++;
+  unlock();
+}
+
+void ReplSemiSyncMaster::remove_slave()
+{
+  lock();
+  rpl_semi_sync_master_clients--;
+  unlock();
+}
+
+bool ReplSemiSyncMaster::is_semi_sync_slave()
+{
+  int null_value;
+  long long val= 0;
+  get_user_var_int("rpl_semi_sync_slave", &val, &null_value);
+  return val;
+}
+
+int ReplSemiSyncMaster::reportReplyBinlog(const char *log_file_pos)
+{
+  char log_name[FN_REFLEN];
+  char *endptr;
+  my_off_t log_pos= strtoull(log_file_pos, &endptr, 10);
+  if (!log_pos || !endptr || *endptr != ':' )
+    return 1;
+  endptr++;                                     // skip the ':' seperator
+  strncpy(log_name, endptr, FN_REFLEN);
+  uint32 server_id= 0;
+  return reportReplyBinlog(server_id, log_name, log_pos);
+}
+
+int ReplSemiSyncMaster::reportReplyBinlog(uint32 server_id,
+					  const char *log_file_name,
+					  my_off_t log_file_pos)
+{
+  const char *kWho = "ReplSemiSyncMaster::reportReplyBinlog";
+  int   cmp;
+  bool  can_release_threads = false;
+  bool  need_copy_send_pos = true;
+
+  if (!(getMasterEnabled()))
+    return 0;
+
+  function_enter(kWho);
+
+  lock();
+
+  /* This is the real check inside the mutex. */
+  if (!getMasterEnabled())
+    goto l_end;
+
+  if (!is_on())
+    /* We check to see whether we can switch semi-sync ON. */
+    try_switch_on(server_id, log_file_name, log_file_pos);
+
+  /* The position should increase monotonically, if there is only one
+   * thread sending the binlog to the slave.
+   * In reality, to improve the transaction availability, we allow multiple
+   * sync replication slaves.  So, if any one of them get the transaction,
+   * the transaction session in the primary can move forward.
+   */
+  if (reply_file_name_inited_)
+  {
+    cmp = ActiveTranx::compare(log_file_name, log_file_pos,
+                               reply_file_name_, reply_file_pos_);
+
+    /* If the requested position is behind the sending binlog position,
+     * would not adjust sending binlog position.
+     * We based on the assumption that there are multiple semi-sync slave,
+     * and at least one of them shou/ld be up to date.
+     * If all semi-sync slaves are behind, at least initially, the primary
+     * can find the situation after the waiting timeout.  After that, some
+     * slaves should catch up quickly.
+     */
+    if (cmp < 0)
+    {
+      /* If the position is behind, do not copy it. */
+      need_copy_send_pos = false;
+    }
+  }
+
+  if (need_copy_send_pos)
+  {
+    strcpy(reply_file_name_, log_file_name);
+    reply_file_pos_ = log_file_pos;
+    reply_file_name_inited_ = true;
+
+    /* Remove all active transaction nodes before this point. */
+    assert(active_tranxs_ != NULL);
+    active_tranxs_->clear_active_tranx_nodes(log_file_name, log_file_pos);
+
+    if (trace_level_ & kTraceDetail)
+      sql_print_information("%s: Got reply at (%s, %lu)", kWho,
+                            log_file_name, (unsigned long)log_file_pos);
+  }
+
+  if (wait_sessions_ > 0)
+  {
+    /* Let us check if some of the waiting threads doing a trx
+     * commit can now proceed.
+     */
+    cmp = ActiveTranx::compare(reply_file_name_, reply_file_pos_,
+                               wait_file_name_, wait_file_pos_);
+    if (cmp >= 0)
+    {
+      /* Yes, at least one waiting thread can now proceed:
+       * let us release all waiting threads with a broadcast
+       */
+      can_release_threads = true;
+      wait_file_name_inited_ = false;
+    }
+  }
+
+ l_end:
+  unlock();
+
+  if (can_release_threads)
+  {
+    if (trace_level_ & kTraceDetail)
+      sql_print_information("%s: signal all waiting threads.", kWho);
+
+    cond_broadcast();
+  }
+
+  return function_exit(kWho, 0);
+}
+
+int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
+				  my_off_t trx_wait_binlog_pos)
+{
+  const char *kWho = "ReplSemiSyncMaster::commitTrx";
+
+  function_enter(kWho);
+
+  if (getMasterEnabled() && trx_wait_binlog_name)
+  {
+    struct timeval start_tv;
+    struct timespec abstime;
+    int wait_result, start_time_err;
+    const char *old_msg= 0;
+
+    start_time_err = gettimeofday(&start_tv, 0);
+
+    /* Acquire the mutex. */
+    lock();
+
+    /* This must be called after acquired the lock */
+    old_msg= thd_enter_cond(NULL, &COND_binlog_send_, &LOCK_binlog_,
+                            "Waiting for semi-sync ACK from slave");
+
+    /* This is the real check inside the mutex. */
+    if (!getMasterEnabled() || !is_on() || !rpl_semi_sync_master_clients)
+      goto l_end;
+
+    if (trace_level_ & kTraceDetail)
+    {
+      sql_print_information("%s: wait pos (%s, %lu), repl(%d)\n", kWho,
+                            trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos,
+                            (int)is_on());
+    }
+
+    while (is_on())
+    {
+      int cmp = ActiveTranx::compare(reply_file_name_, reply_file_pos_,
+                                     trx_wait_binlog_name, trx_wait_binlog_pos);
+      if (cmp >= 0)
+      {
+        /* We have already sent the relevant binlog to the slave: no need to
+         * wait here.
+         */
+        if (trace_level_ & kTraceDetail)
+          sql_print_information("%s: Binlog reply is ahead (%s, %lu),",
+                                kWho, reply_file_name_, (unsigned long)reply_file_pos_);
+        break;
+      }
+
+      /* Let us update the info about the minimum binlog position of waiting
+       * threads.
+       */
+      if (wait_file_name_inited_)
+      {
+        cmp = ActiveTranx::compare(trx_wait_binlog_name, trx_wait_binlog_pos,
+                                   wait_file_name_, wait_file_pos_);
+        if (cmp <= 0)
+	{
+          /* This thd has a lower position, let's update the minimum info. */
+          strcpy(wait_file_name_, trx_wait_binlog_name);
+          wait_file_pos_ = trx_wait_binlog_pos;
+
+          wait_backtraverse_++;
+          if (trace_level_ & kTraceDetail)
+            sql_print_information("%s: move back wait position (%s, %lu),",
+                                  kWho, wait_file_name_, (unsigned long)wait_file_pos_);
+        }
+      }
+      else
+      {
+        strcpy(wait_file_name_, trx_wait_binlog_name);
+        wait_file_pos_ = trx_wait_binlog_pos;
+        wait_file_name_inited_ = true;
+
+        if (trace_level_ & kTraceDetail)
+          sql_print_information("%s: init wait position (%s, %lu),",
+                                kWho, wait_file_name_, (unsigned long)wait_file_pos_);
+      }
+
+      if (start_time_err == 0)
+      {
+        int diff_usecs = start_tv.tv_usec + wait_timeout_ * TIME_THOUSAND;
+
+        /* Calcuate the waiting period. */
+        abstime.tv_sec = start_tv.tv_sec;
+        if (diff_usecs < TIME_MILLION)
+	{
+          abstime.tv_nsec = diff_usecs * TIME_THOUSAND;
+        }
+	else
+	{
+          while (diff_usecs >= TIME_MILLION)
+	  {
+            abstime.tv_sec++;
+            diff_usecs -= TIME_MILLION;
+          }
+          abstime.tv_nsec = diff_usecs * TIME_THOUSAND;
+        }
+
+        /* In semi-synchronous replication, we wait until the binlog-dump
+         * thread has received the reply on the relevant binlog segment from the
+         * replication slave.
+         *
+         * Let us suspend this thread to wait on the condition;
+         * when replication has progressed far enough, we will release
+         * these waiting threads.
+         */
+        wait_sessions_++;
+
+        if (trace_level_ & kTraceDetail)
+          sql_print_information("%s: wait %lu ms for binlog sent (%s, %lu)",
+                                kWho, wait_timeout_,
+                                wait_file_name_, (unsigned long)wait_file_pos_);
+
+        wait_result = cond_timewait(&abstime);
+        wait_sessions_--;
+
+        if (wait_result != 0)
+	{
+          if (trace_level_ & kTraceGeneral)
+	  {
+            /* This is a real wait timeout. */
+            sql_print_warning("Replication semi-sync not sent binlog to "
+                            "slave within the timeout %lu ms - OFF.",
+                            wait_timeout_);
+            sql_print_warning("          semi-sync up to file %s, position %lu",
+                            reply_file_name_, (unsigned long)reply_file_pos_);
+            sql_print_warning("          transaction needs file %s, position %lu",
+                            trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos);
+          }
+          total_wait_timeouts_++;
+
+          /* switch semi-sync off */
+          switch_off();
+        }
+	else
+	{
+          int wait_time;
+
+          wait_time = getWaitTime(start_tv);
+          if (wait_time < 0)
+	  {
+            if (trace_level_ & kTraceGeneral)
+	    {
+              /* This is a time/gettimeofday function call error. */
+              sql_print_error("Replication semi-sync gettimeofday fail1 at "
+                              "wait position (%s, %lu)",
+                              trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos);
+            }
+            timefunc_fails_++;
+          }
+	  else
+	  {
+            total_trx_wait_num_++;
+            total_trx_wait_time_ += wait_time;
+          }
+        }
+      }
+      else
+      {
+        if (trace_level_ & kTraceGeneral)
+	{
+          /* This is a gettimeofday function call error. */
+          sql_print_error("Replication semi-sync gettimeofday fail2 at "
+                          "wait position (%s, %lu)",
+                          trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos);
+        }
+        timefunc_fails_++;
+
+        /* switch semi-sync off */
+        switch_off();
+      }
+    }
+
+  l_end:
+    /* Update the status counter. */
+    if (is_on())
+      enabled_transactions_++;
+    else
+      disabled_transactions_++;
+
+    /* The lock held will be released by thd_exit_cond, so no need to
+       call unlock() here */
+    thd_exit_cond(NULL, old_msg);
+  }
+
+  return function_exit(kWho, 0);
+}
+
+/* Indicate that semi-sync replication is OFF now.
+ * 
+ * What should we do when it is disabled?  The problem is that we want
+ * the semi-sync replication enabled again when the slave catches up
+ * later.  But, it is not that easy to detect that the slave has caught
+ * up.  This is caused by the fact that MySQL's replication protocol is
+ * asynchronous, meaning that if the master does not use the semi-sync
+ * protocol, the slave would not send anything to the master.
+ * Still, if the master is sending (N+1)-th event, we assume that it is
+ * an indicator that the slave has received N-th event and earlier ones.
+ *
+ * If semi-sync is disabled, all transactions still update the wait
+ * position with the last position in binlog.  But no transactions will
+ * wait for confirmations and the active transaction list would not be
+ * maintained.  In binlog dump thread, updateSyncHeader() checks whether
+ * the current sending event catches up with last wait position.  If it
+ * does match, semi-sync will be switched on again.
+ */
+int ReplSemiSyncMaster::switch_off()
+{
+  const char *kWho = "ReplSemiSyncMaster::switch_off";
+  int result;
+
+  function_enter(kWho);
+  state_ = false;
+
+  /* Clear the active transaction list. */
+  assert(active_tranxs_ != NULL);
+  result = active_tranxs_->clear_active_tranx_nodes(NULL, 0);
+
+  switched_off_times_++;
+  wait_file_name_inited_   = false;
+  reply_file_name_inited_  = false;
+  commit_file_name_inited_ = false;
+  cond_broadcast();                            /* wake up all waiting threads */
+
+  return function_exit(kWho, result);
+}
+
+int ReplSemiSyncMaster::try_switch_on(int server_id,
+				      const char *log_file_name,
+				      my_off_t log_file_pos)
+{
+  const char *kWho = "ReplSemiSyncMaster::try_switch_on";
+  bool semi_sync_on = false;
+
+  function_enter(kWho);
+
+  /* If the current sending event's position is larger than or equal to the
+   * 'largest' commit transaction binlog position, the slave is already
+   * catching up now and we can switch semi-sync on here.
+   * If commit_file_name_inited_ indicates there are no recent transactions,
+   * we can enable semi-sync immediately.
+   */
+  if (commit_file_name_inited_)
+  {
+    int cmp = ActiveTranx::compare(log_file_name, log_file_pos,
+                                   commit_file_name_, commit_file_pos_);
+    semi_sync_on = (cmp >= 0);
+  }
+  else
+  {
+    semi_sync_on = true;
+  }
+
+  if (semi_sync_on)
+  {
+    /* Switch semi-sync replication on. */
+    state_ = true;
+
+    if (trace_level_ & kTraceGeneral)
+      sql_print_information("%s switch semi-sync ON with server(%d) "
+                            "at (%s, %lu), repl(%d)",
+                            kWho, server_id, log_file_name,
+                            (unsigned long)log_file_pos, (int)is_on());
+  }
+
+  return function_exit(kWho, 0);
+}
+
+int ReplSemiSyncMaster::reserveSyncHeader(unsigned char *header,
+					  unsigned long size)
+{
+  const char *kWho = "ReplSemiSyncMaster::reserveSyncHeader";
+  function_enter(kWho);
+
+  int hlen=0;
+  if (!is_semi_sync_slave())
+  {
+    hlen= 0;
+  }
+  else
+  {
+    /* No enough space for the extra header, disable semi-sync master */
+    if (sizeof(kSyncHeader) > size)
+    {
+      disableMaster();
+      return 0;
+    }
+    
+    /* Set the magic number and the sync status.  By default, no sync
+     * is required.
+     */
+    memcpy(header, kSyncHeader, sizeof(kSyncHeader));
+    hlen= sizeof(kSyncHeader);
+  }
+  return function_exit(kWho, hlen);
+}
+
+int ReplSemiSyncMaster::updateSyncHeader(unsigned char *packet,
+					 const char *log_file_name,
+					 my_off_t log_file_pos,
+					 uint32 server_id)
+{
+  const char *kWho = "ReplSemiSyncMaster::updateSyncHeader";
+  int  cmp = 0;
+  bool sync = false;
+
+  /* If the semi-sync master is not enabled, or the slave is not a semi-sync
+   * target, do not request replies from the slave.
+   */
+  if (!getMasterEnabled() || !is_semi_sync_slave())
+  {
+    sync = false;
+    return 0;
+  }
+
+  function_enter(kWho);
+
+  lock();
+
+  /* This is the real check inside the mutex. */
+  if (!getMasterEnabled())
+  {
+    sync = false;
+    goto l_end;
+  }
+
+  if (is_on())
+  {
+    /* semi-sync is ON */
+    sync = false;     /* No sync unless a transaction is involved. */
+
+    if (reply_file_name_inited_)
+    {
+      cmp = ActiveTranx::compare(log_file_name, log_file_pos,
+                                 reply_file_name_, reply_file_pos_);
+      if (cmp <= 0)
+      {
+        /* If we have already got the reply for the event, then we do
+         * not need to sync the transaction again.
+         */
+        goto l_end;
+      }
+    }
+
+    if (wait_file_name_inited_)
+    {
+      cmp = ActiveTranx::compare(log_file_name, log_file_pos,
+                                 wait_file_name_, wait_file_pos_);
+    }
+    else
+    {
+      cmp = 1;
+    }
+    
+    /* If we are already waiting for some transaction replies which
+     * are later in binlog, do not wait for this one event.
+     */
+    if (cmp >= 0)
+    {
+      /* 
+       * We only wait if the event is a transaction's ending event.
+       */
+      assert(active_tranxs_ != NULL);
+      sync = active_tranxs_->is_tranx_end_pos(log_file_name,
+                                               log_file_pos);
+    }
+  }
+  else
+  {
+    if (commit_file_name_inited_)
+    {
+      int cmp = ActiveTranx::compare(log_file_name, log_file_pos,
+                                     commit_file_name_, commit_file_pos_);
+      sync = (cmp >= 0);
+    }
+    else
+    {
+      sync = true;
+    }
+  }
+
+  if (trace_level_ & kTraceDetail)
+    sql_print_information("%s: server(%d), (%s, %lu) sync(%d), repl(%d)",
+                          kWho, server_id, log_file_name,
+                          (unsigned long)log_file_pos, sync, (int)is_on());
+
+ l_end:
+  unlock();
+
+  /* We do not need to clear sync flag because we set it to 0 when we
+   * reserve the packet header.
+   */
+  if (sync)
+    (packet)[2] = kPacketFlagSync;
+
+  return function_exit(kWho, 0);
+}
+
+int ReplSemiSyncMaster::writeTranxInBinlog(const char* log_file_name,
+					   my_off_t log_file_pos)
+{
+  const char *kWho = "ReplSemiSyncMaster::writeTranxInBinlog";
+  int result = 0;
+
+  function_enter(kWho);
+
+  lock();
+
+  /* This is the real check inside the mutex. */
+  if (!getMasterEnabled())
+    goto l_end;
+
+  /* Update the 'largest' transaction commit position seen so far even
+   * though semi-sync is switched off.
+   * It is much better that we update commit_file_* here, instead of
+   * inside commitTrx().  This is mostly because updateSyncHeader()
+   * will watch for commit_file_* to decide whether to switch semi-sync
+   * on. The detailed reason is explained in function updateSyncHeader().
+   */
+  if (commit_file_name_inited_)
+  {
+    int cmp = ActiveTranx::compare(log_file_name, log_file_pos,
+                                   commit_file_name_, commit_file_pos_);
+    if (cmp > 0)
+    {
+      /* This is a larger position, let's update the maximum info. */
+      strcpy(commit_file_name_, log_file_name);
+      commit_file_pos_ = log_file_pos;
+    }
+  }
+  else
+  {
+    strcpy(commit_file_name_, log_file_name);
+    commit_file_pos_ = log_file_pos;
+    commit_file_name_inited_ = true;
+  }
+
+  if (is_on())
+  {
+    assert(active_tranxs_ != NULL);
+    result = active_tranxs_->insert_tranx_node(log_file_name, log_file_pos);
+  }
+
+ l_end:
+  unlock();
+
+  return function_exit(kWho, result);
+}
+
+int ReplSemiSyncMaster::resetMaster()
+{
+  const char *kWho = "ReplSemiSyncMaster::resetMaster";
+  int result = 0;
+
+  function_enter(kWho);
+
+
+  lock();
+
+  state_ = getMasterEnabled()? 1 : 0;
+
+  wait_file_name_inited_   = false;
+  reply_file_name_inited_  = false;
+  commit_file_name_inited_ = false;
+
+  enabled_transactions_ = 0;
+  disabled_transactions_ = 0;
+  switched_off_times_ = 0;
+  timefunc_fails_ = 0;
+  wait_sessions_ = 0;
+  wait_backtraverse_ = 0;
+  total_trx_wait_num_ = 0;
+  total_trx_wait_time_ = 0;
+  total_net_wait_num_ = 0;
+  total_net_wait_time_ = 0;
+
+  unlock();
+
+  return function_exit(kWho, result);
+}
+
+void ReplSemiSyncMaster::setExportStats()
+{
+  lock();
+
+  rpl_semi_sync_master_status           = state_ ? 1 : 0;
+  rpl_semi_sync_master_yes_transactions = enabled_transactions_;
+  rpl_semi_sync_master_no_transactions  = disabled_transactions_;
+  rpl_semi_sync_master_off_times        = switched_off_times_;
+  rpl_semi_sync_master_timefunc_fails   = timefunc_fails_;
+  rpl_semi_sync_master_num_timeouts     = total_wait_timeouts_;
+  rpl_semi_sync_master_wait_sessions    = wait_sessions_;
+  rpl_semi_sync_master_back_wait_pos    = wait_backtraverse_;
+  rpl_semi_sync_master_trx_wait_num     = total_trx_wait_num_;
+  rpl_semi_sync_master_trx_wait_time    =
+    ((total_trx_wait_num_) ?
+     (unsigned long)((double)total_trx_wait_time_ /
+             ((double)total_trx_wait_num_)) : 0);
+  rpl_semi_sync_master_net_wait_num     = total_net_wait_num_;
+  rpl_semi_sync_master_net_wait_time    =
+    ((total_net_wait_num_) ?
+     (unsigned long)((double)total_net_wait_time_ /
+             ((double)total_net_wait_num_)) : 0);
+
+  rpl_semi_sync_master_net_wait_total_time = total_net_wait_time_;
+  rpl_semi_sync_master_trx_wait_total_time = total_trx_wait_time_;
+
+  unlock();
+}
+
+/* Get the waiting time given the wait's staring time.
+ * 
+ * Return:
+ *  >= 0: the waiting time in microsecons(us)
+ *   < 0: error in gettimeofday or time back traverse
+ */
+static int getWaitTime(const struct timeval& start_tv)
+{
+  unsigned long long start_usecs, end_usecs;
+  struct timeval end_tv;
+  int end_time_err;
+
+  /* Starting time in microseconds(us). */
+  start_usecs = start_tv.tv_sec * TIME_MILLION + start_tv.tv_usec;
+
+  /* Get the wait time interval. */
+  end_time_err = gettimeofday(&end_tv, 0);
+
+  /* Ending time in microseconds(us). */
+  end_usecs = end_tv.tv_sec * TIME_MILLION + end_tv.tv_usec;
+
+  if (end_time_err != 0 || end_usecs < start_usecs)
+    return -1;
+
+  return (int)(end_usecs - start_usecs);
+}

=== added file 'plugin/semisync/semisync_master.h'
--- a/plugin/semisync/semisync_master.h	1970-01-01 00:00:00 +0000
+++ b/plugin/semisync/semisync_master.h	2009-06-15 13:30:20 +0000
@@ -0,0 +1,366 @@
+/* Copyright (C) 2007 Google Inc.
+   Copyright (C) 2008 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 */
+
+
+#ifndef SEMISYNC_MASTER_H
+#define SEMISYNC_MASTER_H
+
+#include "semisync.h"
+
+/**
+   This class manages memory for active transaction list.
+
+   We record each active transaction with a TranxNode.  Because each
+   session can only have only one open transaction, the total active
+   transaction nodes can not exceed the maximum sessions.  Currently
+   in MySQL, sessions are the same as connections.
+*/
+class ActiveTranx
+  :public Trace {
+private:
+  struct TranxNode {
+    char             *log_name_;
+    my_off_t          log_pos_;
+    struct TranxNode *next_;            /* the next node in the sorted list */
+    struct TranxNode *hash_next_;    /* the next node during hash collision */
+  };
+
+  /* The following data structure maintains an active transaction list. */
+  TranxNode       *node_array_;
+  TranxNode       *free_pool_;
+
+  /* These two record the active transaction list in sort order. */
+  TranxNode       *trx_front_, *trx_rear_;
+
+  TranxNode      **trx_htb_;        /* A hash table on active transactions. */
+
+  int              num_transactions_;               /* maximum transactions */
+  int              num_entries_;              /* maximum hash table entries */
+  pthread_mutex_t *lock_;                                     /* mutex lock */
+
+  inline void assert_lock_owner();
+
+  inline TranxNode* alloc_tranx_node();
+
+  inline unsigned int calc_hash(const unsigned char *key,unsigned int length);
+  unsigned int get_hash_value(const char *log_file_name, my_off_t log_file_pos);
+
+  int compare(const char *log_file_name1, my_off_t log_file_pos1,
+	      const TranxNode *node2) {
+    return compare(log_file_name1, log_file_pos1,
+		   node2->log_name_, node2->log_pos_);
+  }
+  int compare(const TranxNode *node1,
+	      const char *log_file_name2, my_off_t log_file_pos2) {
+    return compare(node1->log_name_, node1->log_pos_,
+		   log_file_name2, log_file_pos2);
+  }
+  int compare(const TranxNode *node1, const TranxNode *node2) {
+    return compare(node1->log_name_, node1->log_pos_,
+		   node2->log_name_, node2->log_pos_);
+  }
+
+public:
+  ActiveTranx(int max_connections, pthread_mutex_t *lock,
+	      unsigned long trace_level);
+  ~ActiveTranx();
+
+  /* Insert an active transaction node with the specified position.
+   *
+   * Return:
+   *  0: success;  -1 or otherwise: error
+   */
+  int insert_tranx_node(const char *log_file_name, my_off_t log_file_pos);
+
+  /* Clear the active transaction nodes until(inclusive) the specified
+   * position.
+   * If log_file_name is NULL, everything will be cleared: the sorted
+   * list and the hash table will be reset to empty.
+   * 
+   * Return:
+   *  0: success;  -1 or otherwise: error
+   */
+  int clear_active_tranx_nodes(const char *log_file_name,
+			       my_off_t    log_file_pos);
+
+  /* Given a position, check to see whether the position is an active
+   * transaction's ending position by probing the hash table.
+   */
+  bool is_tranx_end_pos(const char *log_file_name, my_off_t log_file_pos);
+
+  /* Given two binlog positions, compare which one is bigger based on
+   * (file_name, file_position).
+   */
+  static int compare(const char *log_file_name1, my_off_t log_file_pos1,
+		     const char *log_file_name2, my_off_t log_file_pos2);
+
+};
+
+/**
+   The extension class for the master of semi-synchronous replication
+*/
+class ReplSemiSyncMaster
+  :public ReplSemiSyncBase {
+ private:
+  ActiveTranx    *active_tranxs_;  /* active transaction list: the list will
+                                      be cleared when semi-sync switches off. */
+
+  /* True when initObject has been called */
+  bool init_done_;
+
+  /* This cond variable is signaled when enough binlog has been sent to slave,
+   * so that a waiting trx can return the 'ok' to the client for a commit.
+   */
+  pthread_cond_t  COND_binlog_send_;
+
+  /* Mutex that protects the following state variables and the active
+   * transaction list.
+   * Under no cirumstances we can acquire mysql_bin_log.LOCK_log if we are
+   * already holding LOCK_binlog_ because it can cause deadlocks.
+   */
+  pthread_mutex_t LOCK_binlog_;
+
+  /* This is set to true when reply_file_name_ contains meaningful data. */
+  bool            reply_file_name_inited_;
+
+  /* The binlog name up to which we have received replies from any slaves. */
+  char            reply_file_name_[FN_REFLEN];
+
+  /* The position in that file up to which we have the reply from any slaves. */
+  my_off_t        reply_file_pos_;
+
+  /* This is set to true when we know the 'smallest' wait position. */
+  bool            wait_file_name_inited_;
+
+  /* NULL, or the 'smallest' filename that a transaction is waiting for
+   * slave replies.
+   */
+  char            wait_file_name_[FN_REFLEN];
+
+  /* The smallest position in that file that a trx is waiting for: the trx
+   * can proceed and send an 'ok' to the client when the master has got the
+   * reply from the slave indicating that it already got the binlog events.
+   */
+  my_off_t        wait_file_pos_;
+
+  /* This is set to true when we know the 'largest' transaction commit
+   * position in the binlog file.
+   * We always maintain the position no matter whether semi-sync is switched
+   * on switched off.  When a transaction wait timeout occurs, semi-sync will
+   * switch off.  Binlog-dump thread can use the three fields to detect when
+   * slaves catch up on replication so that semi-sync can switch on again.
+   */
+  bool            commit_file_name_inited_;
+
+  /* The 'largest' binlog filename that a commit transaction is seeing.       */
+  char            commit_file_name_[FN_REFLEN];
+
+  /* The 'largest' position in that file that a commit transaction is seeing. */
+  my_off_t        commit_file_pos_;
+
+  /* All global variables which can be set by parameters. */
+  volatile bool            master_enabled_;      /* semi-sync is enabled on the master */
+  unsigned long           wait_timeout_;      /* timeout period(ms) during tranx wait */
+
+  /* All status variables. */
+  bool            state_;                    /* whether semi-sync is switched */
+  unsigned long           enabled_transactions_;          /* semi-sync'ed tansactions */
+  unsigned long           disabled_transactions_;     /* non-semi-sync'ed tansactions */
+  unsigned long           switched_off_times_;    /* how many times are switched off? */
+  unsigned long           timefunc_fails_;           /* how many time function fails? */
+  unsigned long           total_wait_timeouts_;      /* total number of wait timeouts */
+  unsigned long           wait_sessions_;      /* how many sessions wait for replies? */
+  unsigned long           wait_backtraverse_;         /* wait position back traverses */
+  unsigned long long       total_trx_wait_num_;   /* total trx waits: non-timeout ones */
+  unsigned long long       total_trx_wait_time_;         /* total trx wait time: in us */
+  unsigned long long       total_net_wait_num_;                 /* total network waits */
+  unsigned long long       total_net_wait_time_;            /* total network wait time */
+
+  /* The number of maximum active transactions.  This should be the same as
+   * maximum connections because MySQL does not do connection sharing now.
+   */
+  int             max_transactions_;
+
+  void lock();
+  void unlock();
+  void cond_broadcast();
+  int  cond_timewait(struct timespec *wait_time);
+
+  /* Is semi-sync replication on? */
+  bool is_on() {
+    return (state_);
+  }
+
+  void set_master_enabled(bool enabled) {
+    master_enabled_ = enabled;
+  }
+
+  /* Switch semi-sync off because of timeout in transaction waiting. */
+  int switch_off();
+
+  /* Switch semi-sync on when slaves catch up. */
+  int try_switch_on(int server_id,
+                    const char *log_file_name, my_off_t log_file_pos);
+
+ public:
+  ReplSemiSyncMaster();
+  ~ReplSemiSyncMaster();
+
+  bool getMasterEnabled() {
+    return master_enabled_;
+  }
+  void setTraceLevel(unsigned long trace_level) {
+    trace_level_ = trace_level;
+    if (active_tranxs_)
+      active_tranxs_->trace_level_ = trace_level;
+  }
+
+  /* Set the transaction wait timeout period, in milliseconds. */
+  void setWaitTimeout(unsigned long wait_timeout) {
+    wait_timeout_ = wait_timeout;
+  }
+
+  /* Initialize this class after MySQL parameters are initialized. this
+   * function should be called once at bootstrap time.
+   */
+  int initObject();
+
+  /* Enable the object to enable semi-sync replication inside the master. */
+  int enableMaster();
+
+  /* Enable the object to enable semi-sync replication inside the master. */
+  int disableMaster();
+
+  /* Add a semi-sync replication slave */
+  void add_slave();
+    
+  /* Remove a semi-sync replication slave */
+  void remove_slave();
+
+  /* Is the slave servered by the thread requested semi-sync */
+  bool is_semi_sync_slave();
+
+  int reportReplyBinlog(const char *log_file_pos);
+  
+  /* In semi-sync replication, reports up to which binlog position we have
+   * received replies from the slave indicating that it already get the events.
+   *
+   * Input:
+   *  server_id     - (IN)  master server id number
+   *  log_file_name - (IN)  binlog file name
+   *  end_offset    - (IN)  the offset in the binlog file up to which we have
+   *                        the replies from the slave
+   *
+   * Return:
+   *  0: success;  -1 or otherwise: error
+   */
+  int reportReplyBinlog(uint32 server_id,
+                        const char* log_file_name,
+                        my_off_t end_offset);
+
+  /* Commit a transaction in the final step.  This function is called from
+   * InnoDB before returning from the low commit.  If semi-sync is switch on,
+   * the function will wait to see whether binlog-dump thread get the reply for
+   * the events of the transaction.  Remember that this is not a direct wait,
+   * instead, it waits to see whether the binlog-dump thread has reached the
+   * point.  If the wait times out, semi-sync status will be switched off and
+   * all other transaction would not wait either.
+   *
+   * Input:  (the transaction events' ending binlog position)
+   *  trx_wait_binlog_name - (IN)  ending position's file name
+   *  trx_wait_binlog_pos  - (IN)  ending position's file offset
+   *
+   * Return:
+   *  0: success;  -1 or otherwise: error
+   */
+  int commitTrx(const char* trx_wait_binlog_name,
+                my_off_t trx_wait_binlog_pos);
+
+  /* Reserve space in the replication event packet header:
+   *  . slave semi-sync off: 1 byte - (0)
+   *  . slave semi-sync on:  3 byte - (0, 0xef, 0/1}
+   * 
+   * Input:
+   *  header   - (IN)  the header buffer
+   *  size     - (IN)  size of the header buffer
+   *
+   * Return:
+   *  size of the bytes reserved for header
+   */
+  int reserveSyncHeader(unsigned char *header, unsigned long size);
+
+  /* Update the sync bit in the packet header to indicate to the slave whether
+   * the master will wait for the reply of the event.  If semi-sync is switched
+   * off and we detect that the slave is catching up, we switch semi-sync on.
+   * 
+   * Input:
+   *  packet        - (IN)  the packet containing the replication event
+   *  log_file_name - (IN)  the event ending position's file name
+   *  log_file_pos  - (IN)  the event ending position's file offset
+   *  server_id     - (IN)  master server id number
+   *
+   * Return:
+   *  0: success;  -1 or otherwise: error
+   */
+  int updateSyncHeader(unsigned char *packet,
+                       const char *log_file_name,
+		       my_off_t log_file_pos,
+		       uint32 server_id);
+
+  /* Called when a transaction finished writing binlog events.
+   *  . update the 'largest' transactions' binlog event position
+   *  . insert the ending position in the active transaction list if
+   *    semi-sync is on
+   * 
+   * Input:  (the transaction events' ending binlog position)
+   *  log_file_name - (IN)  transaction ending position's file name
+   *  log_file_pos  - (IN)  transaction ending position's file offset
+   *
+   * Return:
+   *  0: success;  -1 or otherwise: error
+   */
+  int writeTranxInBinlog(const char* log_file_name, my_off_t log_file_pos);
+
+  /* Export internal statistics for semi-sync replication. */
+  void setExportStats();
+
+  /* 'reset master' command is issued from the user and semi-sync need to
+   * go off for that.
+   */
+  int resetMaster();
+};
+
+/* System and status variables for the master component */
+extern char rpl_semi_sync_master_enabled;
+extern unsigned long rpl_semi_sync_master_timeout;
+extern unsigned long rpl_semi_sync_master_trace_level;
+extern unsigned long rpl_semi_sync_master_status;
+extern unsigned long rpl_semi_sync_master_yes_transactions;
+extern unsigned long rpl_semi_sync_master_no_transactions;
+extern unsigned long rpl_semi_sync_master_off_times;
+extern unsigned long rpl_semi_sync_master_timefunc_fails;
+extern unsigned long rpl_semi_sync_master_num_timeouts;
+extern unsigned long rpl_semi_sync_master_wait_sessions;
+extern unsigned long rpl_semi_sync_master_back_wait_pos;
+extern unsigned long rpl_semi_sync_master_trx_wait_time;
+extern unsigned long rpl_semi_sync_master_net_wait_time;
+extern unsigned long long rpl_semi_sync_master_net_wait_num;
+extern unsigned long long rpl_semi_sync_master_trx_wait_num;
+extern unsigned long long rpl_semi_sync_master_net_wait_total_time;
+extern unsigned long long rpl_semi_sync_master_trx_wait_total_time;
+extern unsigned long rpl_semi_sync_master_clients;
+
+#endif /* SEMISYNC_MASTER_H */

=== added file 'plugin/semisync/semisync_master_plugin.cc'
--- a/plugin/semisync/semisync_master_plugin.cc	1970-01-01 00:00:00 +0000
+++ b/plugin/semisync/semisync_master_plugin.cc	2009-06-17 10:37:04 +0000
@@ -0,0 +1,380 @@
+/* Copyright (C) 2007 Google Inc.
+   Copyright (C) 2008 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 "semisync_master.h"
+
+ReplSemiSyncMaster repl_semisync;
+
+int repl_semi_report_binlog_update(Binlog_storage_param *param,
+				   const char *log_file,
+				   my_off_t log_pos, uint32 flags)
+{
+  int  error= 0;
+
+  if (repl_semisync.getMasterEnabled())
+  {
+    /*
+      Let us store the binlog file name and the position, so that
+      we know how long to wait for the binlog to the replicated to
+      the slave in synchronous replication.
+    */
+    error= repl_semisync.writeTranxInBinlog(log_file,
+                                            log_pos);
+  }
+
+  return error;
+}
+
+int repl_semi_request_commit(Trans_param *param)
+{
+  return 0;
+}
+
+int repl_semi_report_commit(Trans_param *param)
+{
+
+  bool is_real_trans= param->flags & TRANS_IS_REAL_TRANS;
+
+  if (is_real_trans && param->log_pos)
+  {
+    const char *binlog_name= param->log_file;
+    return repl_semisync.commitTrx(binlog_name, param->log_pos);
+  }
+  return 0;
+}
+
+int repl_semi_report_rollback(Trans_param *param)
+{
+  return repl_semi_report_commit(param);
+}
+
+int repl_semi_binlog_dump_start(Binlog_transmit_param *param,
+				 const char *log_file,
+				 my_off_t log_pos)
+{
+  bool semi_sync_slave= repl_semisync.is_semi_sync_slave();
+  
+  if (semi_sync_slave)
+    /* One more semi-sync slave */
+    repl_semisync.add_slave();
+  sql_print_information("Start %s binlog_dump to slave (server_id: %d), pos(%s, %lu)",
+			semi_sync_slave ? "semi-sync" : "asynchronous",
+			param->server_id, log_file, (unsigned long)log_pos);
+  
+  return 0;
+}
+
+int repl_semi_binlog_dump_end(Binlog_transmit_param *param)
+{
+  bool semi_sync_slave= repl_semisync.is_semi_sync_slave();
+  
+  sql_print_information("Stop %s binlog_dump to slave (server_id: %d)",
+                        semi_sync_slave ? "semi-sync" : "asynchronous",
+                        param->server_id);
+  if (semi_sync_slave)
+  {
+    /* One less semi-sync slave */
+    repl_semisync.remove_slave();
+  }
+  return 0;
+}
+
+int repl_semi_reserve_header(Binlog_transmit_param *param,
+			     unsigned char *header,
+			     unsigned long size, unsigned long *len)
+{
+  *len +=  repl_semisync.reserveSyncHeader(header, size);
+  return 0;
+}
+
+int repl_semi_before_send_event(Binlog_transmit_param *param,
+                                unsigned char *packet, unsigned long len,
+                                const char *log_file, my_off_t log_pos)
+{
+  return repl_semisync.updateSyncHeader(packet,
+					log_file,
+					log_pos,
+					param->server_id);
+}
+
+int repl_semi_after_send_event(Binlog_transmit_param *param,
+                               const char *event_buf, unsigned long len)
+{
+  return 0;
+}
+
+int repl_semi_reset_master(Binlog_transmit_param *param)
+{
+  if (repl_semisync.resetMaster())
+    return 1;
+  return 0;
+}
+
+/*
+  semisync system variables
+ */
+static void fix_rpl_semi_sync_master_timeout(MYSQL_THD thd,
+				      SYS_VAR *var,
+				      void *ptr,
+				      const void *val);
+
+static void fix_rpl_semi_sync_master_trace_level(MYSQL_THD thd,
+					  SYS_VAR *var,
+					  void *ptr,
+					  const void *val);
+
+static void fix_rpl_semi_sync_master_enabled(MYSQL_THD thd,
+				      SYS_VAR *var,
+				      void *ptr,
+				      const void *val);
+
+static void fix_rpl_semi_sync_master_reply_log_file_pos(MYSQL_THD thd,
+                                                 SYS_VAR *var,
+                                                 void *ptr,
+                                                 const void *val);
+
+static MYSQL_SYSVAR_BOOL(enabled, rpl_semi_sync_master_enabled,
+  PLUGIN_VAR_OPCMDARG,
+ "Enable semi-synchronous replication master (disabled by default). ",
+  NULL, 			// check
+  &fix_rpl_semi_sync_master_enabled,	// update
+  0);
+
+static MYSQL_SYSVAR_ULONG(timeout, rpl_semi_sync_master_timeout,
+  PLUGIN_VAR_OPCMDARG,
+ "The timeout value (in ms) for semi-synchronous replication in the master",
+  NULL, 			// check
+  fix_rpl_semi_sync_master_timeout,	// update
+  10, 0, ~0L, 1);
+
+static MYSQL_SYSVAR_ULONG(trace_level, rpl_semi_sync_master_trace_level,
+  PLUGIN_VAR_OPCMDARG,
+ "The tracing level for semi-sync replication.",
+  NULL,				  // check
+  &fix_rpl_semi_sync_master_trace_level, // update
+  32, 0, ~0L, 1);
+
+/*
+  Use a SESSION instead of GLOBAL variable for slave to send reply to
+  avoid requiring SUPER privilege.
+*/
+static MYSQL_THDVAR_STR(reply_log_file_pos,
+  PLUGIN_VAR_NOCMDOPT,
+  "The log filename and position slave has queued to relay log.",
+  NULL,             // check
+  &fix_rpl_semi_sync_master_reply_log_file_pos,
+  "");
+
+static SYS_VAR* semi_sync_master_system_vars[]= {
+  MYSQL_SYSVAR(enabled),
+  MYSQL_SYSVAR(timeout),
+  MYSQL_SYSVAR(trace_level),
+  MYSQL_SYSVAR(reply_log_file_pos),
+  NULL,
+};
+
+
+static void fix_rpl_semi_sync_master_timeout(MYSQL_THD thd,
+				      SYS_VAR *var,
+				      void *ptr,
+				      const void *val)
+{
+  *(unsigned long *)ptr= *(unsigned long *)val;
+  repl_semisync.setWaitTimeout(rpl_semi_sync_master_timeout);
+  return;
+}
+
+static void fix_rpl_semi_sync_master_trace_level(MYSQL_THD thd,
+					  SYS_VAR *var,
+					  void *ptr,
+					  const void *val)
+{
+  *(unsigned long *)ptr= *(unsigned long *)val;
+  repl_semisync.setTraceLevel(rpl_semi_sync_master_trace_level);
+  return;
+}
+
+static void fix_rpl_semi_sync_master_enabled(MYSQL_THD thd,
+				      SYS_VAR *var,
+				      void *ptr,
+				      const void *val)
+{
+  *(char *)ptr= *(char *)val;
+  if (rpl_semi_sync_master_enabled)
+  {
+    if (repl_semisync.enableMaster() != 0)
+      rpl_semi_sync_master_enabled = false;
+  }
+  else
+  {
+    if (repl_semisync.disableMaster() != 0)
+      rpl_semi_sync_master_enabled = true;
+  }
+
+  return;
+}
+
+static void fix_rpl_semi_sync_master_reply_log_file_pos(MYSQL_THD thd,
+                                                 SYS_VAR *var,
+                                                 void *ptr,
+                                                 const void *val)
+{
+  const char *log_file_pos= *(char **)val;
+  
+  if (repl_semisync.reportReplyBinlog(log_file_pos))
+    sql_print_error("report slave binlog reply failed.");
+
+  return;
+}
+
+Trans_observer trans_observer = {
+  sizeof(Trans_observer),		// len
+
+  repl_semi_report_commit,	// after_commit
+  repl_semi_report_rollback,	// after_rollback
+};
+
+Binlog_storage_observer storage_observer = {
+  sizeof(Binlog_storage_observer), // len
+
+  repl_semi_report_binlog_update, // report_update
+};
+
+Binlog_transmit_observer transmit_observer = {
+  sizeof(Binlog_transmit_observer), // len
+
+  repl_semi_binlog_dump_start,	// start
+  repl_semi_binlog_dump_end,	// stop
+  repl_semi_reserve_header,	// reserve_header
+  repl_semi_before_send_event,	// before_send_event
+  repl_semi_after_send_event,	// after_send_event
+  repl_semi_reset_master,	// reset
+};
+
+
+#define SHOW_FNAME(name)			\
+  rpl_semi_sync_master_show_##name
+
+#define DEF_SHOW_FUNC(name, show_type)					\
+  static  int SHOW_FNAME(name)(MYSQL_THD thd, SHOW_VAR *var, char *buff) \
+  {									\
+    repl_semisync.setExportStats();					\
+    var->type= show_type;						\
+    var->value= (char *)&rpl_semi_sync_master_##name;				\
+    return 0;								\
+  }
+
+DEF_SHOW_FUNC(clients, SHOW_LONG)
+DEF_SHOW_FUNC(net_wait_time, SHOW_LONG)
+DEF_SHOW_FUNC(net_wait_total_time, SHOW_LONGLONG)
+DEF_SHOW_FUNC(net_wait_num, SHOW_LONGLONG)
+DEF_SHOW_FUNC(off_times, SHOW_LONG)
+DEF_SHOW_FUNC(no_transactions, SHOW_LONG)
+DEF_SHOW_FUNC(status, SHOW_BOOL)
+DEF_SHOW_FUNC(timefunc_fails, SHOW_LONG)
+DEF_SHOW_FUNC(trx_wait_time, SHOW_LONG)
+DEF_SHOW_FUNC(trx_wait_total_time, SHOW_LONGLONG)
+DEF_SHOW_FUNC(trx_wait_num, SHOW_LONGLONG)
+DEF_SHOW_FUNC(back_wait_pos, SHOW_LONG)
+DEF_SHOW_FUNC(wait_sessions, SHOW_LONG)
+DEF_SHOW_FUNC(yes_transactions, SHOW_LONG)
+
+
+/* plugin status variables */
+static SHOW_VAR semi_sync_master_status_vars[]= {
+  {"Rpl_semi_sync_master_clients",    (char*) &SHOW_FNAME(clients),         SHOW_FUNC},
+  {"Rpl_semi_sync_master_net_avg_wait_time",
+                               (char*) &SHOW_FNAME(net_wait_time),   SHOW_FUNC},
+  {"Rpl_semi_sync_master_net_wait_time",
+                               (char*) &SHOW_FNAME(net_wait_total_time),   SHOW_FUNC},
+  {"Rpl_semi_sync_master_net_waits",  (char*) &SHOW_FNAME(net_wait_num),    SHOW_FUNC},
+  {"Rpl_semi_sync_master_no_times",   (char*) &SHOW_FNAME(off_times),       SHOW_FUNC},
+  {"Rpl_semi_sync_master_no_tx",      (char*) &SHOW_FNAME(no_transactions), SHOW_FUNC},
+  {"Rpl_semi_sync_master_status",     (char*) &SHOW_FNAME(status),          SHOW_FUNC},
+  {"Rpl_semi_sync_master_timefunc_failures",
+                               (char*) &SHOW_FNAME(timefunc_fails),  SHOW_FUNC},
+  {"Rpl_semi_sync_master_tx_avg_wait_time",
+                               (char*) &SHOW_FNAME(trx_wait_time),   SHOW_FUNC},
+  {"Rpl_semi_sync_master_tx_wait_time",
+                               (char*) &SHOW_FNAME(trx_wait_total_time),   SHOW_FUNC},
+  {"Rpl_semi_sync_master_tx_waits",   (char*) &SHOW_FNAME(trx_wait_num),    SHOW_FUNC},
+  {"Rpl_semi_sync_master_wait_pos_backtraverse",
+                               (char*) &SHOW_FNAME(back_wait_pos),   SHOW_FUNC},
+  {"Rpl_semi_sync_master_wait_sessions",
+                               (char*) &SHOW_FNAME(wait_sessions),   SHOW_FUNC},
+  {"Rpl_semi_sync_master_yes_tx",     (char*) &SHOW_FNAME(yes_transactions), SHOW_FUNC},
+  {NULL, NULL, SHOW_LONG},
+};
+
+
+static int semi_sync_master_plugin_init(void *p)
+{
+  if (repl_semisync.initObject())
+    return 1;
+  if (register_trans_observer(&trans_observer, p))
+    return 1;
+  if (register_binlog_storage_observer(&storage_observer, p))
+    return 1;
+  if (register_binlog_transmit_observer(&transmit_observer, p))
+    return 1;
+  return 0;
+}
+
+static int semi_sync_master_plugin_deinit(void *p)
+{
+  if (unregister_trans_observer(&trans_observer, p))
+  {
+    sql_print_error("unregister_trans_observer failed");
+    return 1;
+  }
+  if (unregister_binlog_storage_observer(&storage_observer, p))
+  {
+    sql_print_error("unregister_binlog_storage_observer failed");
+    return 1;
+  }
+  if (unregister_binlog_transmit_observer(&transmit_observer, p))
+  {
+    sql_print_error("unregister_binlog_transmit_observer failed");
+    return 1;
+  }
+  sql_print_information("unregister_replicator OK");
+  return 0;
+}
+
+struct Mysql_replication semi_sync_master_plugin= {
+  MYSQL_REPLICATION_INTERFACE_VERSION
+};
+
+/*
+  Plugin library descriptor
+*/
+mysql_declare_plugin(semi_sync_master)
+{
+  MYSQL_REPLICATION_PLUGIN,
+  &semi_sync_master_plugin,
+  "rpl_semi_sync_master",
+  "He Zhenxing",
+  "Semi-synchronous replication master",
+  PLUGIN_LICENSE_GPL,
+  semi_sync_master_plugin_init, /* Plugin Init */
+  semi_sync_master_plugin_deinit, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+  semi_sync_master_status_vars,	/* status variables */
+  semi_sync_master_system_vars,	/* system variables */
+  NULL                        /* config options                  */
+}
+mysql_declare_plugin_end;

=== added file 'plugin/semisync/semisync_slave.cc'
--- a/plugin/semisync/semisync_slave.cc	1970-01-01 00:00:00 +0000
+++ b/plugin/semisync/semisync_slave.cc	2009-06-15 13:30:20 +0000
@@ -0,0 +1,122 @@
+/* Copyright (C) 2008 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 "semisync_slave.h"
+
+char rpl_semi_sync_slave_enabled;
+unsigned long rpl_semi_sync_slave_status= 0;
+unsigned long rpl_semi_sync_slave_trace_level;
+
+int ReplSemiSyncSlave::initObject()
+{
+  int result= 0;
+  const char *kWho = "ReplSemiSyncSlave::initObject";
+
+  if (init_done_)
+  {
+    fprintf(stderr, "%s called twice\n", kWho);
+    return 1;
+  }
+  init_done_ = true;
+
+  /* References to the parameter works after set_options(). */
+  setSlaveEnabled(rpl_semi_sync_slave_enabled);
+  setTraceLevel(rpl_semi_sync_slave_trace_level);
+
+  return result;
+}
+
+int ReplSemiSyncSlave::slaveReplyConnect()
+{
+  if (!mysql_reply && !(mysql_reply= rpl_connect_master(NULL)))
+  {
+    sql_print_error("Semisync slave connect to master for reply failed");
+    return 1;
+  }
+  return 0;
+}
+
+int ReplSemiSyncSlave::slaveReadSyncHeader(const char *header,
+                                      unsigned long total_len,
+                                      bool  *need_reply,
+                                      const char **payload,
+                                      unsigned long *payload_len)
+{
+  const char *kWho = "ReplSemiSyncSlave::slaveReadSyncHeader";
+  int read_res = 0;
+  function_enter(kWho);
+
+  if ((unsigned char)(header[0]) == kPacketMagicNum)
+  {
+    *need_reply  = (header[1] & kPacketFlagSync);
+    *payload_len = total_len - 2;
+    *payload     = header + 2;
+
+    if (trace_level_ & kTraceDetail)
+      sql_print_information("%s: reply - %d", kWho, *need_reply);
+  }
+  else
+  {
+    sql_print_error("Missing magic number for semi-sync packet, packet "
+                    "len: %lu", total_len);
+    read_res = -1;
+  }
+
+  return function_exit(kWho, read_res);
+}
+
+int ReplSemiSyncSlave::slaveStart(Binlog_relay_IO_param *param)
+{
+  bool semi_sync= getSlaveEnabled();
+  
+  sql_print_information("Slave I/O thread: Start %s replication to\
+ master '%s@%s:%d' in log '%s' at position %lu",
+			semi_sync ? "semi-sync" : "asynchronous",
+			param->user, param->host, param->port,
+			param->master_log_name[0] ? param->master_log_name : "FIRST",
+			(unsigned long)param->master_log_pos);
+
+  if (semi_sync && !rpl_semi_sync_slave_status)
+    rpl_semi_sync_slave_status= 1;
+  return 0;
+}
+
+int ReplSemiSyncSlave::slaveStop(Binlog_relay_IO_param *param)
+{
+  if (rpl_semi_sync_slave_status)
+    rpl_semi_sync_slave_status= 0;
+  if (mysql_reply)
+    mysql_close(mysql_reply);
+  mysql_reply= 0;
+  return 0;
+}
+
+int ReplSemiSyncSlave::slaveReply(const char *log_name, my_off_t log_pos)
+{
+  char query[FN_REFLEN + 100];
+  sprintf(query, "SET SESSION rpl_semi_sync_master_reply_log_file_pos='%llu:%s'",
+          (unsigned long long)log_pos, log_name);
+  if (mysql_real_query(mysql_reply, query, strlen(query)))
+  {
+    sql_print_error("Set 'rpl_semi_sync_master_reply_log_file_pos' on master failed");
+    mysql_free_result(mysql_store_result(mysql_reply));
+    mysql_close(mysql_reply);
+    mysql_reply= 0;
+    return 1;
+  }
+  mysql_free_result(mysql_store_result(mysql_reply));
+  return 0;
+}

=== added file 'plugin/semisync/semisync_slave.h'
--- a/plugin/semisync/semisync_slave.h	1970-01-01 00:00:00 +0000
+++ b/plugin/semisync/semisync_slave.h	2009-06-15 13:30:20 +0000
@@ -0,0 +1,99 @@
+/* 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 */
+
+
+#ifndef SEMISYNC_SLAVE_H
+#define SEMISYNC_SLAVE_H
+
+#include "semisync.h"
+
+/**
+   The extension class for the slave of semi-synchronous replication
+*/
+class ReplSemiSyncSlave
+  :public ReplSemiSyncBase {
+public:
+ ReplSemiSyncSlave()
+   :slave_enabled_(false)
+  {}
+  ~ReplSemiSyncSlave() {}
+
+  void setTraceLevel(unsigned long trace_level) {
+    trace_level_ = trace_level;
+  }
+
+  /* Initialize this class after MySQL parameters are initialized. this
+   * function should be called once at bootstrap time.
+   */
+  int initObject();
+
+  bool getSlaveEnabled() {
+    return slave_enabled_;
+  }
+  void setSlaveEnabled(bool enabled) {
+    slave_enabled_ = enabled;
+  }
+
+  /* A slave reads the semi-sync packet header and separate the metadata
+   * from the payload data.
+   * 
+   * Input:
+   *  header      - (IN)  packet header pointer
+   *  total_len   - (IN)  total packet length: metadata + payload
+   *  need_reply  - (IN)  whether the master is waiting for the reply
+   *  payload     - (IN)  payload: the replication event
+   *  payload_len - (IN)  payload length
+   *
+   * Return:
+   *  0: success;  -1 or otherwise: error
+   */
+  int slaveReadSyncHeader(const char *header, unsigned long total_len, bool *need_reply,
+                          const char **payload, unsigned long *payload_len);
+
+  /* A slave replies to the master indicating its replication process.  It
+   * indicates that the slave has received all events before the specified
+   * binlog position.
+   * 
+   * Input:
+   *  log_name         - (IN)  the reply point's binlog file name
+   *  log_pos   - (IN)  the reply point's binlog file offset
+   *
+   * Return:
+   *  0: success;  -1 or otherwise: error
+   */
+  int slaveReply(const char *log_name, my_off_t log_pos);
+
+  /*
+    Connect to master for sending reply
+   */
+  int slaveReplyConnect();
+  
+  int slaveStart(Binlog_relay_IO_param *param);
+  int slaveStop(Binlog_relay_IO_param *param);
+
+private:
+  /* True when initObject has been called */
+  bool init_done_;
+  bool slave_enabled_;        /* semi-sycn is enabled on the slave */
+  MYSQL *mysql_reply;         /* connection to send reply */
+};
+
+
+/* System and status variables for the slave component */
+extern char rpl_semi_sync_slave_enabled;
+extern unsigned long rpl_semi_sync_slave_trace_level;
+extern unsigned long rpl_semi_sync_slave_status;
+
+#endif /* SEMISYNC_SLAVE_H */

=== added file 'plugin/semisync/semisync_slave_plugin.cc'
--- a/plugin/semisync/semisync_slave_plugin.cc	1970-01-01 00:00:00 +0000
+++ b/plugin/semisync/semisync_slave_plugin.cc	2009-06-17 10:37:04 +0000
@@ -0,0 +1,224 @@
+/* Copyright (C) 2007 Google Inc.
+   Copyright (C) 2008 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 "semisync_slave.h"
+
+ReplSemiSyncSlave repl_semisync;
+
+/*
+  indicate whether or not the slave should send a reply to the master.
+
+  This is set to true in repl_semi_slave_read_event if the current
+  event read is the last event of a transaction. And the value is
+  checked in repl_semi_slave_queue_event.
+*/
+bool semi_sync_need_reply= false;
+
+int repl_semi_reset_slave(Binlog_relay_IO_param *param)
+{
+  // TODO: reset semi-sync slave status here
+  return 0;
+}
+
+int repl_semi_slave_request_dump(Binlog_relay_IO_param *param,
+				 uint32 flags)
+{
+  MYSQL *mysql= param->mysql;
+  MYSQL_RES *res= 0;
+  MYSQL_ROW row;
+  const char *query;
+
+  if (!repl_semisync.getSlaveEnabled())
+    return 0;
+
+  /*
+    Create the connection that is used to send slave ACK replies to
+    master
+  */
+  if (repl_semisync.slaveReplyConnect())
+    return 1;
+
+  /* Check if master server has semi-sync plugin installed */
+  query= "SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled'";
+  if (mysql_real_query(mysql, query, strlen(query)) ||
+      !(res= mysql_store_result(mysql)))
+  {
+    mysql_free_result(mysql_store_result(mysql));
+    sql_print_error("Execution failed on master: %s", query);
+    return 1;
+  }
+
+  row= mysql_fetch_row(res);
+  if (!row)
+  {
+    /* Master does not support or not configured semi-sync */
+    sql_print_warning("Master server does not support or not configured semi-sync replication, fallback to asynchronous");
+    rpl_semi_sync_slave_status= 0;
+    return 0;
+  }
+
+  /*
+    Tell master dump thread that we want to do semi-sync
+    replication
+  */
+  query= "SET @rpl_semi_sync_slave= 1";
+  if (mysql_real_query(mysql, query, strlen(query)))
+  {
+    sql_print_error("Set 'rpl_semi_sync_slave=1' on master failed");
+    mysql_free_result(mysql_store_result(mysql));
+    return 1;
+  }
+  mysql_free_result(mysql_store_result(mysql));
+  rpl_semi_sync_slave_status= 1;
+  return 0;
+}
+
+int repl_semi_slave_read_event(Binlog_relay_IO_param *param,
+			       const char *packet, unsigned long len,
+			       const char **event_buf, unsigned long *event_len)
+{
+  if (rpl_semi_sync_slave_status)
+    return repl_semisync.slaveReadSyncHeader(packet, len,
+					     &semi_sync_need_reply,
+					     event_buf, event_len);
+  *event_buf= packet;
+  *event_len= len;
+  return 0;
+}
+
+int repl_semi_slave_queue_event(Binlog_relay_IO_param *param,
+				const char *event_buf,
+				unsigned long event_len,
+				uint32 flags)
+{
+  if (rpl_semi_sync_slave_status && semi_sync_need_reply)
+    return repl_semisync.slaveReply(param->master_log_name,
+                                    param->master_log_pos);
+  return 0;
+}
+
+int repl_semi_slave_io_start(Binlog_relay_IO_param *param)
+{
+  return repl_semisync.slaveStart(param);
+}
+
+int repl_semi_slave_io_end(Binlog_relay_IO_param *param)
+{
+  return repl_semisync.slaveStop(param);
+}
+
+
+static void fix_rpl_semi_sync_slave_enabled(MYSQL_THD thd,
+					    SYS_VAR *var,
+					    void *ptr,
+					    const void *val)
+{
+  *(char *)ptr= *(char *)val;
+  repl_semisync.setSlaveEnabled(rpl_semi_sync_slave_enabled != 0);
+  return;
+}
+
+static void fix_rpl_semi_sync_trace_level(MYSQL_THD thd,
+					  SYS_VAR *var,
+					  void *ptr,
+					  const void *val)
+{
+  *(unsigned long *)ptr= *(unsigned long *)val;
+  repl_semisync.setTraceLevel(rpl_semi_sync_slave_trace_level);
+  return;
+}
+
+/* plugin system variables */
+static MYSQL_SYSVAR_BOOL(enabled, rpl_semi_sync_slave_enabled,
+  PLUGIN_VAR_OPCMDARG,
+ "Enable semi-synchronous replication slave (disabled by default). ",
+  NULL,				   // check
+  &fix_rpl_semi_sync_slave_enabled, // update
+  0);
+
+static MYSQL_SYSVAR_ULONG(trace_level, rpl_semi_sync_slave_trace_level,
+  PLUGIN_VAR_OPCMDARG,
+ "The tracing level for semi-sync replication.",
+  NULL,				  // check
+  &fix_rpl_semi_sync_trace_level, // update
+  32, 0, ~0L, 1);
+
+static SYS_VAR* semi_sync_slave_system_vars[]= {
+  MYSQL_SYSVAR(enabled),
+  MYSQL_SYSVAR(trace_level),
+  NULL,
+};
+
+
+/* plugin status variables */
+static SHOW_VAR semi_sync_slave_status_vars[]= {
+  {"Rpl_semi_sync_slave_status",
+   (char*) &rpl_semi_sync_slave_status,    SHOW_BOOL},
+  {NULL, NULL, SHOW_BOOL},
+};
+
+Binlog_relay_IO_observer relay_io_observer = {
+  sizeof(Binlog_relay_IO_observer), // len
+
+  repl_semi_slave_io_start,	// start
+  repl_semi_slave_io_end,	// stop
+  repl_semi_slave_request_dump,	// request_transmit
+  repl_semi_slave_read_event,	// after_read_event
+  repl_semi_slave_queue_event,	// after_queue_event
+  repl_semi_reset_slave,	// reset
+};
+
+static int semi_sync_slave_plugin_init(void *p)
+{
+  if (repl_semisync.initObject())
+    return 1;
+  if (register_binlog_relay_io_observer(&relay_io_observer, p))
+    return 1;
+  return 0;
+}
+
+static int semi_sync_slave_plugin_deinit(void *p)
+{
+  if (unregister_binlog_relay_io_observer(&relay_io_observer, p))
+    return 1;
+  return 0;
+}
+
+
+struct Mysql_replication semi_sync_slave_plugin= {
+  MYSQL_REPLICATION_INTERFACE_VERSION
+};
+
+/*
+  Plugin library descriptor
+*/
+mysql_declare_plugin(semi_sync_slave)
+{
+  MYSQL_REPLICATION_PLUGIN,
+  &semi_sync_slave_plugin,
+  "rpl_semi_sync_slave",
+  "He Zhenxing",
+  "Semi-synchronous replication slave",
+  PLUGIN_LICENSE_GPL,
+  semi_sync_slave_plugin_init, /* Plugin Init */
+  semi_sync_slave_plugin_deinit, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+  semi_sync_slave_status_vars,	/* status variables */
+  semi_sync_slave_system_vars,	/* system variables */
+  NULL                        /* config options                  */
+}
+mysql_declare_plugin_end;

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2009-06-08 14:58:33 +0000
+++ b/scripts/mysql_system_tables.sql	2009-06-17 07:30:19 +0000
@@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS time_zone_tra
 CREATE TABLE IF NOT EXISTS time_zone_leap_second (   Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8   comment='Leap seconds information for time zones';
 
 
-CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
+CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
 
 CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin   comment='Procedure privileges';
 

=== modified file 'scripts/mysql_system_tables_fix.sql'
--- a/scripts/mysql_system_tables_fix.sql	2009-05-21 13:17:37 +0000
+++ b/scripts/mysql_system_tables_fix.sql	2009-06-11 14:01:26 +0000
@@ -457,6 +457,9 @@ ALTER TABLE proc ADD body_utf8 longblob 
                      AFTER db_collation;
 ALTER TABLE proc MODIFY body_utf8 longblob DEFAULT NULL;
 
+# Change comment from char(64) to text
+ALTER TABLE proc MODIFY comment
+                        text collate utf8_bin NOT NULL;
 
 #
 # EVENT privilege

=== modified file 'sql/lex.h'
--- a/sql/lex.h	2009-03-09 14:00:03 +0000
+++ b/sql/lex.h	2009-05-13 11:04:33 +0000
@@ -444,6 +444,7 @@ static SYMBOL symbols[] = {
   { "REDUNDANT",	SYM(REDUNDANT_SYM)},
   { "REFERENCES",	SYM(REFERENCES)},
   { "REGEXP",		SYM(REGEXP)},
+  { "RELAYLOG",         SYM(RELAYLOG_SYM)},
   { "RELAY_LOG_FILE",   SYM(RELAY_LOG_FILE_SYM)},
   { "RELAY_LOG_POS",    SYM(RELAY_LOG_POS_SYM)},
   { "RELAY_THREAD",     SYM(RELAY_THREAD)},

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2009-06-08 14:58:33 +0000
+++ b/sql/log.cc	2009-06-15 14:00:15 +0000
@@ -4218,7 +4218,7 @@ MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_
   :bytes_written(0), prepared_xids(0), file_id(1), open_count(1),
    need_start_event(TRUE), m_table_map_version(0),
    sync_period_ptr(sync_period),
-   is_relay_log(0),
+   is_relay_log(0), signal_cnt(0),
    description_event_for_exec(0), description_event_for_queue(0)
 {
   /*
@@ -6687,6 +6687,7 @@ bool flush_error_log()
 void MYSQL_BIN_LOG::signal_update()
 {
   DBUG_ENTER("MYSQL_BIN_LOG::signal_update");
+  signal_cnt++;
   pthread_cond_broadcast(&update_cond);
   DBUG_VOID_RETURN;
 }

=== modified file 'sql/log.h'
--- a/sql/log.h	2009-06-08 14:58:33 +0000
+++ b/sql/log.h	2009-06-15 14:00:15 +0000
@@ -410,7 +410,7 @@ public:
 
   /* This is relay log */
   bool is_relay_log;
-
+  ulong signal_cnt;  // update of the counter is checked by heartbeat
   /*
     These describe the log's format. This is used only for relay logs.
     _for_exec is used by the SQL thread, _for_queue by the I/O thread. It's

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2009-06-08 14:58:33 +0000
+++ b/sql/mysql_priv.h	2009-06-17 07:30:19 +0000
@@ -974,100 +974,6 @@ struct Query_cache_query_flags
 #define query_cache_is_cacheable_query(L) 0
 #endif /*HAVE_QUERY_CACHE*/
 
-/*
-  Error injector Macros to enable easy testing of recovery after failures
-  in various error cases.
-*/
-#ifndef ERROR_INJECT_SUPPORT
-
-#define ERROR_INJECT(x) 0
-#define ERROR_INJECT_ACTION(x,action) 0
-#define ERROR_INJECT_CRASH(x) 0
-#define ERROR_INJECT_VALUE(x) 0
-#define ERROR_INJECT_VALUE_ACTION(x,action) 0
-#define ERROR_INJECT_VALUE_CRASH(x) 0
-#define SET_ERROR_INJECT_VALUE(x)
-
-#else
-
-inline bool check_and_unset_keyword(const char *dbug_str)
-{
-  const char *extra_str= "-d,";
-  char total_str[200];
-  if (_db_keyword_ (0, dbug_str, 1))
-  {
-    strxmov(total_str, extra_str, dbug_str, NullS);
-    DBUG_SET(total_str);
-    return 1;
-  }
-  return 0;
-}
-
-
-inline bool
-check_and_unset_inject_value(int value)
-{
-  THD *thd= current_thd;
-  if (thd->error_inject_value == (uint)value)
-  {
-    thd->error_inject_value= 0;
-    return 1;
-  }
-  return 0;
-}
-
-/*
-  ERROR INJECT MODULE:
-  --------------------
-  These macros are used to insert macros from the application code.
-  The event that activates those error injections can be activated
-  from SQL by using:
-  SET SESSION dbug=+d,code;
-
-  After the error has been injected, the macros will automatically
-  remove the debug code, thus similar to using:
-  SET SESSION dbug=-d,code
-  from SQL.
-
-  ERROR_INJECT_CRASH will inject a crash of the MySQL Server if code
-  is set when macro is called. ERROR_INJECT_CRASH can be used in
-  if-statements, it will always return FALSE unless of course it
-  crashes in which case it doesn't return at all.
-
-  ERROR_INJECT_ACTION will inject the action specified in the action
-  parameter of the macro, before performing the action the code will
-  be removed such that no more events occur. ERROR_INJECT_ACTION
-  can also be used in if-statements and always returns FALSE.
-  ERROR_INJECT can be used in a normal if-statement, where the action
-  part is performed in the if-block. The macro returns TRUE if the
-  error was activated and otherwise returns FALSE. If activated the
-  code is removed.
-
-  Sometimes it is necessary to perform error inject actions as a serie
-  of events. In this case one can use one variable on the THD object.
-  Thus one sets this value by using e.g. SET_ERROR_INJECT_VALUE(100).
-  Then one can later test for it by using ERROR_INJECT_CRASH_VALUE,
-  ERROR_INJECT_ACTION_VALUE and ERROR_INJECT_VALUE. This have the same
-  behaviour as the above described macros except that they use the
-  error inject value instead of a code used by DBUG macros.
-*/
-#define SET_ERROR_INJECT_VALUE(x) \
-  current_thd->error_inject_value= (x)
-#define ERROR_INJECT_CRASH(code) \
-  DBUG_EVALUATE_IF(code, (DBUG_ABORT(), 0), 0)
-#define ERROR_INJECT_ACTION(code, action) \
-  (check_and_unset_keyword(code) ? ((action), 0) : 0)
-#define ERROR_INJECT(code) \
-  check_and_unset_keyword(code)
-#define ERROR_INJECT_VALUE(value) \
-  check_and_unset_inject_value(value)
-#define ERROR_INJECT_VALUE_ACTION(value,action) \
-  (check_and_unset_inject_value(value) ? (action) : 0)
-#define ERROR_INJECT_VALUE_CRASH(value) \
-  ERROR_INJECT_VALUE_ACTION(value, (DBUG_ABORT(), 0))
-
-#endif
-
 void write_bin_log(THD *thd, bool clear_error,
                    char const *query, ulong query_length);
 
@@ -2131,6 +2037,7 @@ extern uint server_command_flags[];
 extern TYPELIB log_output_typelib;
 
 /* optional things, have_* variables */
+extern SHOW_COMP_OPTION have_profiling;
 extern SHOW_COMP_OPTION have_community_features;
 extern handlerton *partition_hton;
 extern handlerton *myisam_hton;

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2009-06-09 14:36:52 +0000
+++ b/sql/mysqld.cc	2009-06-17 07:30:19 +0000
@@ -710,7 +710,7 @@ MY_LOCALE *my_default_lc_time_names;
 SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache;
 SHOW_COMP_OPTION have_geometry, have_rtree_keys;
 SHOW_COMP_OPTION have_crypt, have_compress;
-SHOW_COMP_OPTION have_community_features;
+SHOW_COMP_OPTION have_profiling;
 
 /* Thread specific variables */
 
@@ -3284,6 +3284,7 @@ SHOW_VAR com_status_vars[]= {
   {"show_processlist",     (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROCESSLIST]), SHOW_LONG_STATUS},
   {"show_profile",         (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROFILE]), SHOW_LONG_STATUS},
   {"show_profiles",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROFILES]), SHOW_LONG_STATUS},
+  {"show_relaylog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_RELAYLOG_EVENTS]), SHOW_LONG_STATUS},
   {"show_slave_hosts",     (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_HOSTS]), SHOW_LONG_STATUS},
   {"show_slave_status",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS},
   {"show_status",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
@@ -4035,9 +4036,10 @@ with --log-bin instead.");
   {
     if (opt_binlog_format_id != BINLOG_FORMAT_UNSPEC)
     {
-      sql_print_error("You need to use --log-bin to make "
-                      "--binlog-format work.");
-      unireg_abort(1);
+      sql_print_warning("You need to use --log-bin to make "
+                        "--binlog-format work.");
+
+      global_system_variables.binlog_format= opt_binlog_format_id;
     }
     else
     {
@@ -6936,7 +6938,7 @@ log and this option does nothing anymore
   {"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
    "Can be used to restrict the total size used to cache a multi-transaction query.",
    (uchar**) &max_binlog_cache_size, (uchar**) &max_binlog_cache_size, 0,
-   GET_ULL, REQUIRED_ARG, ULONG_MAX, IO_SIZE, ULONGLONG_MAX, 0, IO_SIZE, 0},
+   GET_ULL, REQUIRED_ARG, ULONGLONG_MAX, IO_SIZE, ULONGLONG_MAX, 0, IO_SIZE, 0},
   {"max_binlog_size", OPT_MAX_BINLOG_SIZE,
    "Binary log will be rotated automatically when the size exceeds this \
 value. Will also apply to relay logs if max_relay_log_size is 0. \
@@ -7358,7 +7360,7 @@ static int show_starttime(THD *thd, SHOW
   return 0;
 }
 
-#ifdef COMMUNITY_SERVER
+#ifdef ENABLED_PROFILING
 static int show_flushstatustime(THD *thd, SHOW_VAR *var, char *buff)
 {
   var->type= SHOW_LONG;
@@ -7856,7 +7858,7 @@ SHOW_VAR status_vars[]= {
   {"Threads_created",	       (char*) &thread_created,		SHOW_LONG_NOFLUSH},
   {"Threads_running",          (char*) &thread_running,         SHOW_INT},
   {"Uptime",                   (char*) &show_starttime,         SHOW_FUNC},
-#ifdef COMMUNITY_SERVER
+#ifdef ENABLED_PROFILING
   {"Uptime_since_flush_status",(char*) &show_flushstatustime,   SHOW_FUNC},
 #endif
   {NullS, NullS, SHOW_LONG}
@@ -8094,10 +8096,10 @@ static int mysql_init_variables(void)
 			     "d:t:i:o,/tmp/mysqld.trace");
 #endif
   opt_error_log= IF_WIN(1,0);
-#ifdef COMMUNITY_SERVER
-    have_community_features = SHOW_OPTION_YES;
+#ifdef ENABLED_PROFILING
+    have_profiling = SHOW_OPTION_YES;
 #else
-    have_community_features = SHOW_OPTION_NO;
+    have_profiling = SHOW_OPTION_NO;
 #endif
   global_system_variables.ndb_index_stat_enable=FALSE;
   max_system_variables.ndb_index_stat_enable=TRUE;

=== modified file 'sql/rpl_handler.cc'
--- a/sql/rpl_handler.cc	2009-03-13 08:14:40 +0000
+++ b/sql/rpl_handler.cc	2009-06-17 10:37:04 +0000
@@ -153,8 +153,10 @@ void delegates_destroy()
         && ((Observer *)info->observer)->f args)                        \
     {                                                                   \
       r= 1;                                                             \
+      plugin_unlock(thd, plugin);                                       \
       break;                                                            \
     }                                                                   \
+    plugin_unlock(thd, plugin);                                         \
   }                                                                     \
   unlock()
 
@@ -304,8 +306,10 @@ int Binlog_transmit_delegate::reserve_he
                                                         &hlen))
     {
       ret= 1;
+      plugin_unlock(thd, plugin);
       break;
     }
+    plugin_unlock(thd, plugin);
     if (hlen == 0)
       continue;
     if (hlen > RESERVE_HEADER_SIZE || packet->append((char *)header, hlen))

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	2009-06-08 14:58:33 +0000
+++ b/sql/set_var.cc	2009-06-17 07:30:19 +0000
@@ -910,9 +910,9 @@ static sys_var_have_plugin sys_have_ndbc
 static sys_var_have_variable sys_have_openssl(&vars, "have_openssl", &have_ssl);
 static sys_var_have_variable sys_have_ssl(&vars, "have_ssl", &have_ssl);
 static sys_var_have_plugin sys_have_partition_db(&vars, "have_partitioning", C_STRING_WITH_LEN("partition"), MYSQL_STORAGE_ENGINE_PLUGIN);
+static sys_var_have_variable sys_have_profiling(&vars, "have_profiling", &have_profiling);
 static sys_var_have_variable sys_have_query_cache(&vars, "have_query_cache",
                                            &have_query_cache);
-static sys_var_have_variable sys_have_community_features(&vars, "have_community_features", &have_community_features);
 static sys_var_have_variable sys_have_rtree_keys(&vars, "have_rtree_keys", &have_rtree_keys);
 static sys_var_have_variable sys_have_symlink(&vars, "have_symlink", &have_symlink);
 /* Global read-only variable describing server license */
@@ -4545,7 +4545,8 @@ ulong fix_sql_mode(ulong sql_mode)
   if (sql_mode & MODE_TRADITIONAL)
     sql_mode|= (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES |
                 MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
-                MODE_ERROR_FOR_DIVISION_BY_ZERO | MODE_NO_AUTO_CREATE_USER);
+                MODE_ERROR_FOR_DIVISION_BY_ZERO | MODE_NO_AUTO_CREATE_USER | 
+                MODE_NO_ENGINE_SUBSTITUTION);
   return sql_mode;
 }
 

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2009-06-08 14:58:33 +0000
+++ b/sql/share/errmsg.txt	2009-06-12 02:01:08 +0000
@@ -4620,7 +4620,7 @@ ER_USER_LIMIT_REACHED 42000 
         swe "Anv�are '%-.64s' har �skridit '%s' (nuvarande v�e: %ld)"
 ER_SPECIFIC_ACCESS_DENIED_ERROR 42000 
         nla "Toegang geweigerd. U moet het %-.128s privilege hebben voor deze operatie"
-        eng "Access denied; you need the %-.128s privilege for this operation"
+        eng "Access denied; you need (at least one of) the %-.128s privilege(s) for this operation"
         ger "Kein Zugriff. Hierf�d die Berechtigung %-.128s ben�t"
         ita "Accesso non consentito. Serve il privilegio %-.128s per questa operazione"
         por "Acesso negado. Voc�recisa o privil�o %-.128s para essa opera�"

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2009-06-09 16:53:34 +0000
+++ b/sql/slave.cc	2009-06-15 13:30:20 +0000
@@ -2569,7 +2569,11 @@ pthread_handler_t handle_slave_io(void *
   my_pthread_setspecific_ptr(RPL_MASTER_INFO, mi);
 
   if (RUN_HOOK(binlog_relay_io, thread_start, (thd, mi)))
+  {
+    mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+               ER(ER_SLAVE_FATAL_ERROR), "Failed to run 'thread_start' hook");
     goto err;
+  }
 
   if (!(mi->mysql = mysql = mysql_init(NULL)))
   {
@@ -2726,7 +2730,9 @@ Stopping slave I/O thread due to out-of-
                  (thd, mi,(const char*)mysql->net.read_pos + 1,
                   event_len, &event_buf, &event_len)))
     {
-      sql_print_error("Failed to run 'after_read_event' hook");
+      mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+                 ER(ER_SLAVE_FATAL_ERROR),
+                 "Failed to run 'after_read_event' hook");
       goto err;
     }
 
@@ -2740,7 +2746,12 @@ Stopping slave I/O thread due to out-of-
 
     if (RUN_HOOK(binlog_relay_io, after_queue_event,
                  (thd, mi, event_buf, event_len, synced)))
+    {
+      mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+                 ER(ER_SLAVE_FATAL_ERROR),
+                 "Failed to run 'after_queue_event' hook");
       goto err;
+    }
 
     if (flush_master_info(mi))
     {
@@ -3061,7 +3072,6 @@ log '%s' at position %s, relay log '%s' 
     DBUG_ASSERT(rli->info_thd == thd);
     THD_CHECK_SENTRY(thd);
 
-    sql_print_information("new_mode %u", thd->variables.new_mode);
     if (exec_relay_log_event(thd,rli))
     {
       DBUG_PRINT("info", ("exec_relay_log_event() failed"));
@@ -3988,7 +3998,10 @@ MYSQL *rpl_connect_master(MYSQL *mysql)
   if (!mysql)
   {
     if(!(mysql= mysql_init(NULL)))
+    {
+      sql_print_error("rpl_connect_master: failed in mysql_init()");
       return NULL;
+    }
     allocated= true;
   }
 
@@ -4024,6 +4037,10 @@ MYSQL *rpl_connect_master(MYSQL *mysql)
       || !mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0,
                              mi->port, 0, 0))
   {
+    if (!io_slave_killed(thd, mi))
+      sql_print_error("rpl_connect_master: error connecting to master: %s (server_error: %d)",
+                      mysql_error(mysql), mysql_errno(mysql));
+    
     if (allocated)
       mysql_close(mysql);                       // this will free the object
     return NULL;

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2009-05-31 12:05:01 +0000
+++ b/sql/sp_head.cc	2009-06-12 02:01:08 +0000
@@ -175,6 +175,7 @@ sp_get_flags_for_command(LEX *lex)
   case SQLCOM_SHOW_AUTHORS:
   case SQLCOM_SHOW_BINLOGS:
   case SQLCOM_SHOW_BINLOG_EVENTS:
+  case SQLCOM_SHOW_RELAYLOG_EVENTS:
   case SQLCOM_SHOW_CHARSETS:
   case SQLCOM_SHOW_COLLATIONS:
   case SQLCOM_SHOW_CONTRIBUTORS:
@@ -1518,7 +1519,7 @@ sp_head::execute_trigger(THD *thd,
   if (!(grant_info->privilege & TRIGGER_ACL))
   {
     char priv_desc[128];
-    get_privilege_desc(priv_desc, sizeof(priv_desc), TRIGGER_ACL, FALSE);
+    get_privilege_desc(priv_desc, sizeof(priv_desc), TRIGGER_ACL);
 
     my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), priv_desc,
              thd->security_ctx->priv_user, thd->security_ctx->host_or_ip,

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2009-06-04 06:27:44 +0000
+++ b/sql/sql_acl.cc	2009-06-12 02:01:08 +0000
@@ -3022,7 +3022,7 @@ int mysql_table_grant(THD *thd, TABLE_LI
       {
         char command[128];
         get_privilege_desc(command, sizeof(command),
-                           table_list->grant.want_privilege, FALSE);
+                           table_list->grant.want_privilege);
         my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
                  command, thd->security_ctx->priv_user,
                  thd->security_ctx->host_or_ip, table_list->alias);
@@ -3993,7 +3993,7 @@ err:
   if (!no_errors)				// Not a silent skip of table
   {
     char command[128];
-    get_privilege_desc(command, sizeof(command), want_access, FALSE);
+    get_privilege_desc(command, sizeof(command), want_access);
     my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
              command,
              sctx->priv_user,
@@ -4149,7 +4149,7 @@ bool check_grant_column(THD *thd, GRANT_
 err:
   rw_unlock(&LOCK_grant);
   char command[128];
-  get_privilege_desc(command, sizeof(command), want_access, FALSE);
+  get_privilege_desc(command, sizeof(command), want_access);
   my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
            command,
            sctx->priv_user,
@@ -4311,7 +4311,7 @@ err:
   rw_unlock(&LOCK_grant);
 
   char command[128];
-  get_privilege_desc(command, sizeof(command), want_access, FALSE);
+  get_privilege_desc(command, sizeof(command), want_access);
   /*
     Do not give an error message listing a column name unless the user has
     privilege to see all columns.
@@ -5063,25 +5063,16 @@ static int show_routine_grants(THD* thd,
   return error;
 }
 
-/**
+/*
   Make a clear-text version of the requested privilege.
-
-  @param to         pointer to the buffer
-  @param max_length max length of the description message allowed
-  @param access     privileges to check for access
-  @param any        if TRUE, any of the privileges is sufficient,
-                    if FALSE, all privileges are required
 */
 
-void get_privilege_desc(char *to, uint max_length, ulong access, bool any)
+void get_privilege_desc(char *to, uint max_length, ulong access)
 {
   uint pos;
   char *start=to;
-  char sep=',';
   DBUG_ASSERT(max_length >= 30);		// For end ',' removal
 
-  if (any)
-    sep= '|';
   if (access)
   {
     max_length--;				// Reserve place for end-zero
@@ -5091,7 +5082,7 @@ void get_privilege_desc(char *to, uint m
 	  command_lengths[pos] + (uint) (to-start) < max_length)
       {
 	to= strmov(to, command_array[pos]);
-	*to++= sep;
+	*to++=',';
       }
     }
     to--;					// Remove end ','

=== modified file 'sql/sql_acl.h'
--- a/sql/sql_acl.h	2009-05-29 15:06:21 +0000
+++ b/sql/sql_acl.h	2009-06-12 02:01:08 +0000
@@ -261,7 +261,7 @@ ulong get_column_grant(THD *thd, GRANT_I
                        const char *db_name, const char *table_name,
                        const char *field_name);
 bool mysql_show_grants(THD *thd, LEX_USER *user);
-void get_privilege_desc(char *to, uint max_length, ulong access, bool any);
+void get_privilege_desc(char *to, uint max_length, ulong access);
 void get_mqh(const char *user, const char *host, USER_CONN *uc);
 bool mysql_create_user(THD *thd, List <LEX_USER> &list);
 bool mysql_drop_user(THD *thd, List <LEX_USER> &list);

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2009-05-31 12:05:01 +0000
+++ b/sql/sql_base.cc	2009-06-17 07:30:19 +0000
@@ -2799,7 +2799,8 @@ bool open_table(THD *thd, TABLE_LIST *ta
     table exists now we should downgrade our exclusive metadata
     lock on this table to shared metadata lock.
   */
-  if (table_list->lock_strategy == TABLE_LIST::EXCLUSIVE_DOWNGRADABLE_MDL)
+  if (table_list->lock_strategy == TABLE_LIST::EXCLUSIVE_DOWNGRADABLE_MDL &&
+      !(flags & MYSQL_OPEN_HAS_MDL_LOCK))
     mdl_ticket->downgrade_exclusive_lock();
 
   table->mdl_ticket= mdl_ticket;

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2009-06-09 14:36:52 +0000
+++ b/sql/sql_class.cc	2009-06-12 02:01:08 +0000
@@ -503,9 +503,6 @@ THD::THD()
   limit_found_rows= 0;
   row_count_func= -1;
   statement_id_counter= 0UL;
-#ifdef ERROR_INJECT_SUPPORT
-  error_inject_value= 0UL;
-#endif
   // Must be reset to handle error with THD's created for init of mysqld
   lex->current_select= 0;
   start_time=(time_t) 0;

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2009-06-09 14:36:52 +0000
+++ b/sql/sql_class.h	2009-06-12 02:01:08 +0000

@@ -1759,9 +1759,6 @@ public:
   query_id_t query_id;
   ulong      col_access;
 
-#ifdef ERROR_INJECT_SUPPORT
-  ulong      error_inject_value;
-#endif
   /* Statement id is thread-wide. This counter is used to generate ids */
   ulong      statement_id_counter;
   ulong	     rand_saved_seed1, rand_saved_seed2;

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2009-06-05 13:54:23 +0000
+++ b/sql/sql_insert.cc	2009-06-17 07:30:19 +0000
@@ -3900,6 +3900,7 @@ void select_create::abort()
   {
     table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
     table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
+    table->auto_increment_field_not_null= FALSE;
     if (!create_info->table_existed)
       drop_open_table(thd, table, create_table->db, create_table->table_name);
     table=0;                                    // Safety

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2009-05-29 08:09:00 +0000
+++ b/sql/sql_lex.h	2009-06-12 02:01:08 +0000
@@ -123,6 +123,7 @@ enum enum_sql_command {
 #endif
   SQLCOM_SHOW_PROFILE, SQLCOM_SHOW_PROFILES,
   SQLCOM_SIGNAL, SQLCOM_RESIGNAL,
+  SQLCOM_SHOW_RELAYLOG_EVENTS, 
 
   /*
     When a command is added here, be sure it's also added in mysqld.cc

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2009-06-08 14:58:33 +0000
+++ b/sql/sql_parse.cc	2009-06-17 07:30:19 +0000
@@ -413,7 +413,7 @@ void execute_init_command(THD *thd, sys_
   Vio* save_vio;
   ulong save_client_capabilities;
 
-#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
+#if defined(ENABLED_PROFILING)
   thd->profiling.start_new_query();
   thd->profiling.set_query_source(init_command_var->value,
                                   init_command_var->value_length);
@@ -441,7 +441,7 @@ void execute_init_command(THD *thd, sys_
   thd->client_capabilities= save_client_capabilities;
   thd->net.vio= save_vio;
 
-#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
+#if defined(ENABLED_PROFILING)
   thd->profiling.finish_current_query();
 #endif
 }
@@ -551,7 +551,7 @@ pthread_handler_t handle_bootstrap(void 
     bootstrap_error= thd->is_error();
     thd->protocol->end_statement();
 
-#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
+#if defined(ENABLED_PROFILING)
     thd->profiling.finish_current_query();
 #endif
 
@@ -2375,6 +2375,7 @@ mysql_execute_command(THD *thd)
     res = show_slave_hosts(thd);
     break;
   }
+  case SQLCOM_SHOW_RELAYLOG_EVENTS: /* fall through */
   case SQLCOM_SHOW_BINLOG_EVENTS:
   {
     if (check_global_access(thd, REPL_SLAVE_ACL))
@@ -5577,7 +5578,7 @@ bool check_global_access(THD *thd, ulong
   char command[128];
   if ((thd->security_ctx->master_access & want_access))
     return 0;
-  get_privilege_desc(command, sizeof(command), want_access, TRUE);
+  get_privilege_desc(command, sizeof(command), want_access);
   my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
   return 1;
 #else

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2009-05-14 21:49:53 +0000
+++ b/sql/sql_partition.cc	2009-05-18 08:41:20 +0000
@@ -41,6 +41,10 @@
 
 #ifdef WITH_PARTITION_STORAGE_ENGINE
 #include "ha_partition.h"
+
+#define ERROR_INJECT_CRASH(code) \
+  DBUG_EVALUATE_IF(code, (DBUG_ABORT(), 0), 0)
+
 /*
   Partition related functions declarations and some static constants;
 */

=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc	2009-06-09 19:11:12 +0000
+++ b/sql/sql_repl.cc	2009-06-16 12:47:31 +0000
@@ -817,18 +817,19 @@ impossible position";
 	case LOG_READ_EOF:
         {
           int ret;
+          ulong signal_cnt;
 	  DBUG_PRINT("wait",("waiting for data in binary log"));
 	  if (thd->server_id==0) // for mysqlbinlog (mysqlbinlog.server_id==0)
 	  {
 	    pthread_mutex_unlock(log_lock);
 	    goto end;
 	  }
-
+          signal_cnt= mysql_bin_log.signal_cnt;
+          do
+          {
 #ifndef DBUG_OFF
-          ulong hb_info_counter= 0;
+            ulong hb_info_counter= 0;
 #endif
-          do 
-          {
             if (coord)
             {
               DBUG_ASSERT(heartbeat_ts && heartbeat_period != 0LL);
@@ -860,12 +861,11 @@ impossible position";
             }
             else
             {
-              DBUG_ASSERT(ret == 0);
-              DBUG_PRINT("wait",("binary log received update"));
+              DBUG_PRINT("wait",("binary log received update or a broadcast signal caught"));
             }
-          } while (ret != 0 && coord != NULL && !thd->killed);
+          } while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed);
           pthread_mutex_unlock(log_lock);
-        }    
+        }
         break;
             
         default:
@@ -1695,6 +1695,7 @@ bool mysql_show_binlog_events(THD* thd)
   bool ret = TRUE;
   IO_CACHE log;
   File file = -1;
+  MYSQL_BIN_LOG *binary_log= NULL;
   DBUG_ENTER("mysql_show_binlog_events");
 
   Log_event::init_show_field_list(&field_list);
@@ -1705,14 +1706,30 @@ bool mysql_show_binlog_events(THD* thd)
   Format_description_log_event *description_event= new
     Format_description_log_event(3); /* MySQL 4.0 by default */
 
-  /*
-    Wait for handlers to insert any pending information
-    into the binlog.  For e.g. ndb which updates the binlog asynchronously
-    this is needed so that the uses sees all its own commands in the binlog
-  */
-  ha_binlog_wait(thd);
+  DBUG_ASSERT(thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS ||
+              thd->lex->sql_command == SQLCOM_SHOW_RELAYLOG_EVENTS);
 
-  if (mysql_bin_log.is_open())
+  /* select wich binary log to use: binlog or relay */
+  if ( thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS )
+  {
+    /*
+      Wait for handlers to insert any pending information
+      into the binlog.  For e.g. ndb which updates the binlog asynchronously
+      this is needed so that the uses sees all its own commands in the binlog
+    */
+    ha_binlog_wait(thd);
+
+    binary_log= &mysql_bin_log;
+  }
+  else  /* showing relay log contents */
+  {
+    if (!active_mi)
+      DBUG_RETURN(TRUE);
+
+    binary_log= &(active_mi->rli->relay_log);
+  }
+
+  if (binary_log->is_open())
   {
     LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
     SELECT_LEX_UNIT *unit= &thd->lex->unit;
@@ -1720,7 +1737,7 @@ bool mysql_show_binlog_events(THD* thd)
     my_off_t pos = max(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly
     char search_file_name[FN_REFLEN], *name;
     const char *log_file_name = lex_mi->log_file_name;
-    pthread_mutex_t *log_lock = mysql_bin_log.get_log_lock();
+    pthread_mutex_t *log_lock = binary_log->get_log_lock();
     LOG_INFO linfo;
     Log_event* ev;
 
@@ -1730,13 +1747,13 @@ bool mysql_show_binlog_events(THD* thd)
 
     name= search_file_name;
     if (log_file_name)
-      mysql_bin_log.make_log_name(search_file_name, log_file_name);
+      binary_log->make_log_name(search_file_name, log_file_name);
     else
       name=0;					// Find first log
 
     linfo.index_file_offset = 0;
 
-    if (mysql_bin_log.find_log_pos(&linfo, name, 1))
+    if (binary_log->find_log_pos(&linfo, name, 1))
     {
       errmsg = "Could not find target log";
       goto err;

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2009-05-25 10:10:18 +0000
+++ b/sql/sql_show.cc	2009-06-17 07:30:19 +0000
@@ -6767,7 +6767,7 @@ ST_FIELD_INFO proc_fields_info[]=
   {"CREATED", 0, MYSQL_TYPE_DATETIME, 0, 0, "Created", SKIP_OPEN_TABLE},
   {"LAST_ALTERED", 0, MYSQL_TYPE_DATETIME, 0, 0, "Modified", SKIP_OPEN_TABLE},
   {"SQL_MODE", 32*256, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
-  {"ROUTINE_COMMENT", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Comment",
+  {"ROUTINE_COMMENT", 65535, MYSQL_TYPE_STRING, 0, 0, "Comment",
    SKIP_OPEN_TABLE},
   {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, "Definer", SKIP_OPEN_TABLE},
   {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2009-06-02 11:46:19 +0000
+++ b/sql/sql_table.cc	2009-06-24 09:53:11 +0000
@@ -5937,18 +5937,16 @@ compare_tables(THD *thd,
       end= key_part + new_key->key_parts;
       for(; key_part != end; key_part++)
       {
-        /* Mark field to be part of new key */
-        if ((field= table->field[key_part->fieldnr]))
-          field->flags|= FIELD_IN_ADD_INDEX;
         /*
           Check if all fields in key are declared
           NOT NULL
          */
         if (key_part->fieldnr < table->s->fields)
         {
-          is_not_null=
-            (is_not_null && 
-             (!table->field[key_part->fieldnr]->maybe_null()));
+          /* Mark field to be part of new key */
+          field= table->field[key_part->fieldnr];
+          field->flags|= FIELD_IN_ADD_INDEX;
+          is_not_null= (is_not_null && (!field->maybe_null()));
         }
         else
         {

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2009-06-04 06:27:44 +0000
+++ b/sql/sql_yacc.yy	2009-06-12 02:01:08 +0000
@@ -1033,6 +1033,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
 %token  REDUNDANT_SYM
 %token  REFERENCES                    /* SQL-2003-R */
 %token  REGEXP
+%token  RELAYLOG_SYM
 %token  RELAY_LOG_FILE_SYM
 %token  RELAY_LOG_POS_SYM
 %token  RELAY_THREAD
@@ -10744,6 +10745,11 @@ show_param:
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_BINLOG_EVENTS;
           } opt_limit_clause_init
+        | RELAYLOG_SYM EVENTS_SYM binlog_in binlog_from
+          {
+            LEX *lex= Lex;
+            lex->sql_command= SQLCOM_SHOW_RELAYLOG_EVENTS;
+          } opt_limit_clause_init
         | keys_or_index from_or_in table_ident opt_db where_clause
           {
             LEX *lex= Lex;
@@ -12367,6 +12373,7 @@ keyword_sp:
         | REDO_BUFFER_SIZE_SYM     {}
         | REDOFILE_SYM             {}
         | REDUNDANT_SYM            {}
+        | RELAYLOG_SYM             {}
         | RELAY_LOG_FILE_SYM       {}
         | RELAY_LOG_POS_SYM        {}
         | RELAY_THREAD             {}

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2009-05-29 08:09:00 +0000
+++ b/sql/table.cc	2009-06-24 09:41:25 +0000
@@ -4036,7 +4036,7 @@ const char *Natural_join_column::db_name
   DBUG_ASSERT(!strcmp(table_ref->db,
                       table_ref->table->s->db.str) ||
               (table_ref->schema_table &&
-               table_ref->table->s->db.str[0] == 0));
+               is_schema_db(table_ref->table->s->db.str)));
   return table_ref->db;
 }
 
@@ -4254,7 +4254,7 @@ const char *Field_iterator_table_ref::ge
   */
   DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db.str) ||
               (table_ref->schema_table &&
-               table_ref->table->s->db.str[0] == 0));
+               is_schema_db(table_ref->table->s->db.str)));
 
   return table_ref->db;
 }

Attachment: [text/bzr-bundle] bzr/holyfoot@mysql.com-20090625111626-yx2awucpm7628c9z.bundle
Thread
bzr commit into mysql-5.4 branch (holyfoot:3355)Alexey Botchkov25 Jun