List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:January 17 2011 10:29am
Subject:bzr push into mysql-5.5-mtr branch (bjorn.munch:3144 to 3146)
View as plain text  
 3146 Bjorn Munch	2011-01-17 [merge]
      null upmerge

 3145 Bjorn Munch	2011-01-17 [merge]
      merge from 5.5 main

    added:
      mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc
      mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc
      mysql-test/suite/sys_vars/r/autocommit_func4.result
      mysql-test/suite/sys_vars/r/autocommit_func5.result
      mysql-test/suite/sys_vars/t/autocommit_func4-master.opt
      mysql-test/suite/sys_vars/t/autocommit_func4.test
      mysql-test/suite/sys_vars/t/autocommit_func5-master.opt
      mysql-test/suite/sys_vars/t/autocommit_func5.test
    modified:
      VERSION
      client/client_priv.h
      client/mysql.cc
      client/mysql_upgrade.c
      client/mysqladmin.cc
      client/mysqlbinlog.cc
      client/mysqlcheck.c
      client/mysqldump.c
      client/mysqlimport.c
      client/mysqlshow.c
      client/mysqlslap.c
      mysql-test/collections/default.experimental
      mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
      mysql-test/include/rpl_start_server.inc
      mysql-test/include/rpl_stop_server.inc
      mysql-test/include/setup_fake_relay_log.inc
      mysql-test/include/wait_for_status_var.inc
      mysql-test/r/client_xml.result
      mysql-test/r/func_math.result
      mysql-test/r/func_str.result
      mysql-test/r/gis.result
      mysql-test/r/join_outer.result
      mysql-test/r/mysqladmin.result
      mysql-test/r/mysqlbinlog_row_big.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/mysqldump.result
      mysql-test/r/plugin_auth.result
      mysql-test/r/select.result
      mysql-test/r/show_check.result
      mysql-test/r/type_timestamp.result
      mysql-test/suite/perfschema/r/server_init.result
      mysql-test/suite/perfschema/t/server_init.test
      mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
      mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
      mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
      mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
      mysql-test/t/func_math.test
      mysql-test/t/func_str.test
      mysql-test/t/gis.test
      mysql-test/t/join_outer.test
      mysql-test/t/mysqladmin.test
      mysql-test/t/mysqlbinlog_row_big.test
      mysql-test/t/mysqldump.test
      mysql-test/t/plugin_auth.test
      mysql-test/t/select.test
      mysql-test/t/show_check.test
      mysql-test/t/type_timestamp.test
      mysys/my_getopt.c
      mysys/my_getsystime.c
      mysys/my_init.c
      mysys/my_thr_init.c
      mysys/mysys_priv.h
      sql/item.cc
      sql/item_cmpfunc.cc
      sql/item_func.cc
      sql/item_geofunc.h
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/my_decimal.h
      sql/mysqld.cc
      sql/mysqld.h
      sql/sql_analyse.cc
      sql/sql_select.cc
      sql/sql_string.cc
      sql/sql_string.h
      strings/decimal.c
 3144 Bjorn Munch	2011-01-12 [merge]
      null upmerge

=== modified file 'VERSION'
--- a/VERSION	2010-12-16 10:13:58 +0000
+++ b/VERSION	2011-01-14 09:52:55 +0000
@@ -1,4 +1,4 @@
 MYSQL_VERSION_MAJOR=5
 MYSQL_VERSION_MINOR=5
-MYSQL_VERSION_PATCH=9
+MYSQL_VERSION_PATCH=10
 MYSQL_VERSION_EXTRA=

=== modified file 'client/client_priv.h'
--- a/client/client_priv.h	2010-08-09 08:32:50 +0000
+++ b/client/client_priv.h	2011-01-16 03:59:05 +0000
@@ -85,6 +85,7 @@ enum options_client
   OPT_WRITE_BINLOG, OPT_DUMP_DATE,
   OPT_INIT_COMMAND,
   OPT_PLUGIN_DIR,
+  OPT_DEFAULT_AUTH,
   OPT_DEFAULT_PLUGIN,
   OPT_MAX_CLIENT_OPTION
 };

=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	2010-11-26 14:22:06 +0000
+++ b/client/mysql.cc	2011-01-16 03:59:05 +0000
@@ -162,7 +162,7 @@ static int wait_time = 5;
 static STATUS status;
 static ulong select_limit,max_join_size,opt_connect_timeout=0;
 static char mysql_charsets_dir[FN_REFLEN+1];
-static char *opt_plugin_dir= 0, *opt_default_auth;
+static char *opt_plugin_dir= 0, *opt_default_auth= 0;
 static const char *xmlmeta[] = {
   "&", "&",
   "<", "&lt;",
@@ -1564,7 +1564,7 @@ static struct my_option my_long_options[
   {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
    (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"default_auth", OPT_PLUGIN_DIR,
+  {"default_auth", OPT_DEFAULT_AUTH,
     "Default authentication client-side plugin to use.",
    (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c	2010-10-06 15:06:13 +0000
+++ b/client/mysql_upgrade.c	2011-01-16 03:59:05 +0000
@@ -45,6 +45,8 @@ static DYNAMIC_STRING ds_args;
 static DYNAMIC_STRING conn_args;
 
 static char *opt_password= 0;
+static char *opt_plugin_dir= 0, *opt_default_auth= 0;
+
 static my_bool tty_password= 0;
 
 static char opt_tmpdir[FN_REFLEN] = "";
@@ -88,6 +90,10 @@ static struct my_option my_long_options[
   {"default-character-set", OPT_DEFAULT_CHARSET,
    "Set the default character set.", 0,
    0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"default_auth", OPT_DEFAULT_AUTH,
+   "Default authentication client-side plugin to use.",
+   (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade "
    "has already been executed for the current version of MySQL.",
    &opt_force, &opt_force, 0,
@@ -102,6 +108,9 @@ static struct my_option my_long_options[
   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0,
    GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
+  {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
+   (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"port", 'P', "Port number to use for connection or 0 for default to, in "
    "order of preference, my.cnf, $MYSQL_TCP_PORT, "
 #if MYSQL_PORT_DEFAULT == 0
@@ -283,6 +292,8 @@ get_one_option(int optid, const struct m
   case 'S': /* --socket */
   case OPT_MYSQL_PROTOCOL: /* --protocol */
   case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */
+  case OPT_PLUGIN_DIR:                          /* --plugin-dir */
+  case OPT_DEFAULT_AUTH:                        /* --default-auth */
     add_one_option(&conn_args, opt, argument);
     break;
   }

=== modified file 'client/mysqladmin.cc'
--- a/client/mysqladmin.cc	2011-01-11 09:07:37 +0000
+++ b/client/mysqladmin.cc	2011-01-16 03:59:05 +0000
@@ -42,7 +42,7 @@ static uint tcp_port = 0, option_wait =
 static uint opt_count_iterations= 0, my_end_arg;
 static ulong opt_connect_timeout, opt_shutdown_timeout;
 static char * unix_port=0;
-static char *opt_plugin_dir= 0, *opt_default_auth;
+static char *opt_plugin_dir= 0, *opt_default_auth= 0;
 
 #ifdef HAVE_SMEM
 static char *shared_memory_base_name=0;
@@ -208,7 +208,7 @@ static struct my_option my_long_options[
   {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
    (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"default_auth", OPT_PLUGIN_DIR,
+  {"default_auth", OPT_DEFAULT_AUTH,
    "Default authentication client-side plugin to use.",
    (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -413,6 +413,9 @@ int main(int argc,char *argv[])
 
       if (interval)                             /* --sleep=interval given */
       {
+        if (opt_count_iterations && --nr_iterations == 0)
+          break;
+
         /*
           If connection was dropped (unintentionally, or due to SHUTDOWN),
           re-establish it if --wait ("retry-connect") was given and user

=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc	2010-10-29 14:56:58 +0000
+++ b/client/mysqlbinlog.cc	2011-01-16 03:59:05 +0000
@@ -79,6 +79,8 @@ static char* host = 0;
 static int port= 0;
 static uint my_end_arg;
 static const char* sock= 0;
+static char *opt_plugin_dir= 0, *opt_default_auth= 0;
+
 #ifdef HAVE_SMEM
 static char *shared_memory_base_name= 0;
 #endif
@@ -1039,6 +1041,10 @@ static struct my_option my_long_options[
   {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
    &debug_info_flag, &debug_info_flag,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"default_auth", OPT_DEFAULT_AUTH,
+   "Default authentication client-side plugin to use.",
+   (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
     "enabled --to-last-log and are sending the output to the same MySQL server. "
     "This way you could avoid an endless loop. You would also like to use it "
@@ -1064,6 +1070,9 @@ static struct my_option my_long_options[
    0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"password", 'p', "Password to connect to remote server.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
+   (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"port", 'P', "Port number to use for connection or 0 for default to, in "
    "order of preference, my.cnf, $MYSQL_TCP_PORT, "
 #if MYSQL_PORT_DEFAULT == 0
@@ -1381,6 +1390,12 @@ static Exit_status safe_connect()
     return ERROR_STOP;
   }
 
+  if (opt_plugin_dir && *opt_plugin_dir)
+    mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
+
+  if (opt_default_auth && *opt_default_auth)
+    mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
+
   if (opt_protocol)
     mysql_options(mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
 #ifdef HAVE_SMEM

=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c	2010-10-08 07:09:47 +0000
+++ b/client/mysqlcheck.c	2011-01-16 03:59:05 +0000
@@ -40,6 +40,7 @@ static int my_end_arg;
 static char * opt_mysql_unix_port = 0;
 static char *opt_password = 0, *current_user = 0, 
 	    *default_charset= 0, *current_host= 0;
+static char *opt_plugin_dir= 0, *opt_default_auth= 0;
 static int first_error = 0;
 DYNAMIC_ARRAY tables4repair;
 #ifdef HAVE_SMEM
@@ -99,6 +100,10 @@ static struct my_option my_long_options[
   {"default-character-set", OPT_DEFAULT_CHARSET,
    "Set the default character set.", &default_charset,
    &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"default_auth", OPT_DEFAULT_AUTH,
+   "Default authentication client-side plugin to use.",
+   (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"fast",'F', "Check only tables that haven't been closed properly.",
    &opt_fast, &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
    0},
@@ -136,6 +141,9 @@ static struct my_option my_long_options[
   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
+  {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
+   (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"port", 'P', "Port number to use for connection or 0 for default to, in "
    "order of preference, my.cnf, $MYSQL_TCP_PORT, "
 #if MYSQL_PORT_DEFAULT == 0
@@ -796,6 +804,13 @@ static int dbConnect(char *host, char *u
   if (shared_memory_base_name)
     mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
 #endif
+
+  if (opt_plugin_dir && *opt_plugin_dir)
+    mysql_options(&mysql_connection, MYSQL_PLUGIN_DIR, opt_plugin_dir);
+
+  if (opt_default_auth && *opt_default_auth)
+    mysql_options(&mysql_connection, MYSQL_DEFAULT_AUTH, opt_default_auth);
+
   mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset);
   if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd,
          NULL, opt_mysql_port, opt_mysql_unix_port, 0)))

=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c	2010-12-07 12:07:07 +0000
+++ b/client/mysqldump.c	2011-01-16 03:59:05 +0000
@@ -137,7 +137,7 @@ FILE *stderror_file=0;
 static char *shared_memory_base_name=0;
 #endif
 static uint opt_protocol= 0;
-static char *opt_plugin_dir= 0, *opt_default_auth;
+static char *opt_plugin_dir= 0, *opt_default_auth= 0;
 
 /*
 Dynamic_string wrapper functions. In this file use these
@@ -503,7 +503,7 @@ static struct my_option my_long_options[
   {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
    (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"default_auth", OPT_PLUGIN_DIR,
+  {"default_auth", OPT_DEFAULT_AUTH,
    "Default authentication client-side plugin to use.",
    (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -2237,6 +2237,15 @@ static uint get_table_structure(char *ta
   const char *insert_option;
   char	     name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
   char       table_buff2[NAME_LEN*2+3], query_buff[QUERY_LENGTH];
+  const char *show_fields_stmt= "SELECT `COLUMN_NAME` AS `Field`, "
+                                "`COLUMN_TYPE` AS `Type`, "
+                                "`IS_NULLABLE` AS `Null`, "
+                                "`COLUMN_KEY` AS `Key`, "
+                                "`COLUMN_DEFAULT` AS `Default`, "
+                                "`EXTRA` AS `Extra`, "
+                                "`COLUMN_COMMENT` AS `Comment` "
+                                "FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE "
+                                "TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'";
   FILE       *sql_file= md_result_file;
   int        len;
   MYSQL_RES  *result;
@@ -2504,8 +2513,8 @@ static uint get_table_structure(char *ta
     verbose_msg("%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n",
                 my_progname, mysql_error(mysql));
 
-    my_snprintf(query_buff, sizeof(query_buff), "show fields from %s",
-                result_table);
+    my_snprintf(query_buff, sizeof(query_buff), show_fields_stmt, db, table);
+
     if (mysql_query_with_error_report(mysql, &result, query_buff))
       DBUG_RETURN(0);
 

=== modified file 'client/mysqlimport.c'
--- a/client/mysqlimport.c	2010-10-06 15:06:13 +0000
+++ b/client/mysqlimport.c	2011-01-16 03:59:05 +0000
@@ -60,6 +60,7 @@ static char	*opt_password=0, *current_us
 		*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
 static uint     opt_mysql_port= 0, opt_protocol= 0;
 static char * opt_mysql_unix_port=0;
+static char *opt_plugin_dir= 0, *opt_default_auth= 0;
 static longlong opt_ignore_lines= -1;
 #include <sslopt-vars.h>
 
@@ -90,6 +91,10 @@ static struct my_option my_long_options[
   {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
    &debug_info_flag, &debug_info_flag,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"default_auth", OPT_DEFAULT_AUTH,
+   "Default authentication client-side plugin to use.",
+   (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"delete", 'd', "First delete all rows from table.", &opt_delete,
    &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"fields-terminated-by", OPT_FTB,
@@ -139,6 +144,9 @@ static struct my_option my_long_options[
   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
+  {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
+   (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"port", 'P', "Port number to use for connection or 0 for default to, in "
    "order of preference, my.cnf, $MYSQL_TCP_PORT, "
 #if MYSQL_PORT_DEFAULT == 0
@@ -429,6 +437,13 @@ static MYSQL *db_connect(char *host, cha
   if (shared_memory_base_name)
     mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
 #endif
+
+  if (opt_plugin_dir && *opt_plugin_dir)
+    mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
+
+  if (opt_default_auth && *opt_default_auth)
+    mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
+
   mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
   if (!(mysql_real_connect(mysql,host,user,passwd,
                            database,opt_mysql_port,opt_mysql_unix_port,

=== modified file 'client/mysqlshow.c'
--- a/client/mysqlshow.c	2010-10-06 15:06:13 +0000
+++ b/client/mysqlshow.c	2011-01-16 03:59:05 +0000
@@ -34,6 +34,7 @@ static my_bool debug_info_flag= 0, debug
 static uint my_end_arg= 0;
 static uint opt_verbose=0;
 static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
+static char *opt_plugin_dir= 0, *opt_default_auth= 0;
 
 #ifdef HAVE_SMEM 
 static char *shared_memory_base_name=0;
@@ -124,6 +125,12 @@ int main(int argc, char **argv)
 #endif
   mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
 
+  if (opt_plugin_dir && *opt_plugin_dir)
+    mysql_options(&mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
+
+  if (opt_default_auth && *opt_default_auth)
+    mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
+
   if (!(mysql_real_connect(&mysql,host,user,opt_password,
 			   (first_argument_uses_wildcards) ? "" :
                            argv[0],opt_mysql_port,opt_mysql_unix_port,
@@ -182,6 +189,10 @@ static struct my_option my_long_options[
   {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
    &debug_info_flag, &debug_info_flag,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"default_auth", OPT_DEFAULT_AUTH,
+   "Default authentication client-side plugin to use.",
+   (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
    0, 0, 0, 0, 0, 0},
   {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
@@ -195,6 +206,9 @@ static struct my_option my_long_options[
    "Password to use when connecting to server. If password is not given, it's "
    "solicited on the tty.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
+   (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"port", 'P', "Port number to use for connection or 0 for default to, in "
    "order of preference, my.cnf, $MYSQL_TCP_PORT, "
 #if MYSQL_PORT_DEFAULT == 0

=== modified file 'client/mysqlslap.c'
--- a/client/mysqlslap.c	2010-10-06 15:06:13 +0000
+++ b/client/mysqlslap.c	2011-01-16 03:59:05 +0000
@@ -122,6 +122,7 @@ static char *host= NULL, *opt_password=
             *pre_system= NULL,
             *post_system= NULL,
             *opt_mysql_unix_port= NULL;
+static char *opt_plugin_dir= 0, *opt_default_auth= 0;
 
 const char *delimiter= "\n";
 
@@ -338,6 +339,12 @@ int main(int argc, char **argv)
 #endif
   mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
 
+  if (opt_plugin_dir && *opt_plugin_dir)
+    mysql_options(&mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
+
+  if (opt_default_auth && *opt_default_auth)
+    mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
+
   if (!opt_only_print) 
   {
     if (!(mysql_real_connect(&mysql, host, user, opt_password,
@@ -581,6 +588,10 @@ static struct my_option my_long_options[
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag,
    &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"default_auth", OPT_DEFAULT_AUTH,
+   "Default authentication client-side plugin to use.",
+   (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"delimiter", 'F',
     "Delimiter to use in SQL statements supplied in file or command line.",
     &delimiter, &delimiter, 0, GET_STR, REQUIRED_ARG,
@@ -620,6 +631,9 @@ static struct my_option my_long_options[
   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
     NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
+  {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
+   (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"port", 'P', "Port number to use for connection.", &opt_mysql_port,
     &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
     0},
@@ -1507,7 +1521,12 @@ generate_primary_key_list(MYSQL *mysql,
       exit(1);
     }
 
-    result= mysql_store_result(mysql);
+    if (!(result= mysql_store_result(mysql)))
+    {
+      fprintf(stderr, "%s: Error when storing result: %d %s\n",
+              my_progname, mysql_errno(mysql), mysql_error(mysql));
+      exit(1);
+    }
     primary_keys_number_of= mysql_num_rows(result);
 
     /* So why check this? Blackhole :) */
@@ -1879,10 +1898,15 @@ limit_not_met:
       {
         if (mysql_field_count(mysql))
         {
-          result= mysql_store_result(mysql);
-          while ((row = mysql_fetch_row(result)))
-            counter++;
-          mysql_free_result(result);
+          if (!(result= mysql_store_result(mysql)))
+            fprintf(stderr, "%s: Error when storing result: %d %s\n",
+                    my_progname, mysql_errno(mysql), mysql_error(mysql));
+          else
+          {
+            while ((row= mysql_fetch_row(result)))
+              counter++;
+            mysql_free_result(result);
+          }
         }
       } while(mysql_next_result(mysql) == 0);
       queries++;

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2011-01-12 14:25:59 +0000
+++ b/mysql-test/collections/default.experimental	2011-01-14 12:59:23 +0000
@@ -12,7 +12,6 @@ main.gis
 main.gis-rtree @freebsd                  # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
 main.information_schema                  # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically
 main.lock_multi_bug38499                 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically
-main.lowercase_table2 @darwin            # Bug#55509 2010-07-26 alik main.lowercase_table2 fails on Mac OSX (again)
 main.outfile_loaddata @solaris           # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible)
 main.signal_demo3 @solaris               # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
 main.sp @solaris                         # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun

=== added file 'mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc'
--- a/mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc	2011-01-13 12:21:57 +0000
@@ -0,0 +1,17 @@
+# Include file for rpl_show_relaylog_events.inc
+
+--let $log_type= BINLOG
+if ($is_relay_log) {
+  --let $log_type= RELAYLOG
+}
+--let $args=
+if ($binlog_file != '') {
+  --let $args= IN <FILE>
+}
+if ($binlog_limit) {
+  --let $args= $args LIMIT $binlog_limit
+}
+--echo ******** [$CURRENT_CONNECTION] SHOW $log_type EVENTS $args ********
+--source include/show_events.inc
+
+

=== added file 'mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc'
--- a/mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc	2011-01-13 12:21:57 +0000
@@ -0,0 +1,11 @@
+# Include file for rpl_show_log_events.inc 
+
+--let $binlog_limit=
+--source extra/rpl_tests/rpl_show_binlog_events.inc
+--let $binlog_limit= 1
+--source extra/rpl_tests/rpl_show_binlog_events.inc
+--let $binlog_limit= 1,3
+--source extra/rpl_tests/rpl_show_binlog_events.inc
+--let $binlog_limit=
+--let $binlog_file=
+--source extra/rpl_tests/rpl_show_binlog_events.inc 

=== modified file 'mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc'
--- a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc	2010-05-26 14:34:25 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc	2011-01-13 14:31:37 +0000
@@ -1,103 +1,62 @@
 -- connection master
+-- source include/rpl_reset.inc
+
+-- 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 ...  *********
--- source include/show_binlog_events.inc
-
--- echo [MASTER] ********* SOW BINLOG EVENTS         *********
-let $binlog_file= ;
--- source include/show_binlog_events.inc
-
--- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows  *********
-let $binlog_limit= 3;
--- source include/show_binlog_events.inc
-
--- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows  *********
-let $binlog_limit= 1,4;
--- source include/show_binlog_events.inc
-
-# clear show_binlog_event/show_relaylog_events parameters
-let $binlog_limit= ;
-
--- sync_slave_with_master
-
--- echo [SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
--- source include/show_binlog_events.inc
-
--- echo [SLAVE] ********* SOW BINLOG EVENTS          *********
-let $binlog_file= ;
--- source include/show_binlog_events.inc
-
--- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows  *********
-let $binlog_limit= 3;
--- source include/show_binlog_events.inc
-
--- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows  *********
-let $binlog_limit= 1,4;
--- source include/show_binlog_events.inc
-
-# clear show_binlog_event/show_relaylog_events parameters
-let $binlog_limit= ;
 
--- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
-let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
--- source include/show_relaylog_events.inc
-
--- echo [SLAVE] ********* SOW RELAYLOG EVENTS        *********
-let $binlog_file= ;
--- source include/show_relaylog_events.inc
-
--- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows  *********
-let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
-let $binlog_limit= 3;
--- source include/show_relaylog_events.inc
-
--- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows  *********
-let $binlog_limit= 1,3;
--- source include/show_relaylog_events.inc
+# PART I
+#
+# SHOWs contents of binary logs on the master and both, binary and
+# relay logs, on the slave.
+#
+
+--let $is_relay_log= 0
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc
+
+--sync_slave_with_master
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc
+
+--let $is_relay_log= 1
+--let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
+--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc
+
+#
+# PART II
+#
+# Although this second part of the test may seem redudant it is
+# actually needed to assert that SHOW RELAYLOG EVENTS works properly
+# with respect to the ordering of the relay log in relay-log.index. 
+#
+# If no file is specified with "IN" then first relay log file in
+# relay-log.index (ie, the oldest one) should be picked and its
+# contents displayed. The same happens for SHOW BINLOG EVENTS, so we
+# show them both. All in all, this is the reason for re-assert after
+# MASTER and SLAVE's FLUSH LOGS operations.
+#
 
 FLUSH LOGS;
-let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
-
 -- connection master
 FLUSH LOGS;
 DROP TABLE t1;
 
-# clear show_binlog_event/show_relaylog_events parameters
-let $binlog_file= ;
-let $binlog_limit= ;
+--let $is_relay_log= 0
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc
+
+--sync_slave_with_master
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc
+
+--let $is_relay_log= 1
+--let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
+--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc
 
--- echo [MASTER] ********* SOW BINLOG EVENTS IN ...  *********
-let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
--- source include/show_binlog_events.inc
-
--- echo [MASTER] ********* SOW BINLOG EVENTS         *********
-let $binlog_file= ;
--- source include/show_binlog_events.inc
-
--- sync_slave_with_master
-
--- echo [SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
-let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
--- source include/show_binlog_events.inc
-
--- echo [SLAVE] ********* SOW BINLOG EVENTS          *********
-let $binlog_file= ;
--- source include/show_binlog_events.inc
-
--- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
--- source include/show_relaylog_events.inc
-
--- echo [SLAVE] ********* SOW RELAYLOG EVENTS        *********
-let $binlog_file= ;
--- source include/show_relaylog_events.inc
 
 # clear show_binlog_event/show_relaylog_events parameters
 let $binlog_file= ;

=== modified file 'mysql-test/include/rpl_start_server.inc'
--- a/mysql-test/include/rpl_start_server.inc	2010-12-19 17:07:28 +0000
+++ b/mysql-test/include/rpl_start_server.inc	2011-01-14 10:33:12 +0000
@@ -45,7 +45,15 @@ if ($rpl_server_parameters)
 --source include/rpl_connection.inc
 
 # Write file to make mysql-test-run.pl start up the server again
---exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
+--let WRITE_TO_FILE= $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
+--let WRITE_TO_VAR= $_rpl_start_server_command
+perl;
+my $file= $ENV{'WRITE_TO_FILE'};
+my $var= $ENV{'WRITE_TO_VAR'};
+open WRITE_FILE, ">> $file" or die "Error opening $file: $!";
+print WRITE_FILE $var, "\n" or die "Error appending to $file: $!";
+close WRITE_FILE or die "Error closing $file: $!";
+EOF
 
 --source include/rpl_reconnect.inc
 

=== modified file 'mysql-test/include/rpl_stop_server.inc'
--- a/mysql-test/include/rpl_stop_server.inc	2010-12-19 17:07:28 +0000
+++ b/mysql-test/include/rpl_stop_server.inc	2011-01-14 10:33:12 +0000
@@ -44,7 +44,9 @@ if ($rpl_debug)
 
 # Write file to make mysql-test-run.pl expect the "crash", but don't start
 # it until it's told to
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
+wait
+EOF
 
 # Send shutdown to the connected server and give
 # it 10 seconds to die before zapping it

=== modified file 'mysql-test/include/setup_fake_relay_log.inc'
--- a/mysql-test/include/setup_fake_relay_log.inc	2010-12-19 17:15:12 +0000
+++ b/mysql-test/include/setup_fake_relay_log.inc	2011-01-12 18:35:06 +0000
@@ -74,6 +74,7 @@ let $_fake_relay_index= $_fake_datadir/$
 let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`;
 
 RESET SLAVE;
+let $_orphan_relay_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
 
 # Create relay log file.
 --copy_file $fake_relay_log $_fake_relay_log
@@ -102,6 +103,8 @@ RESET SLAVE;
 # Setup replication from existing relay log.
 eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4;
 
+# remove the orphan log file (became spurious)
+-- remove_file $_fake_datadir/$_orphan_relay_file
 
 --let $include_filename= setup_fake_relay_log.inc
 --source include/end_include_file.inc

=== modified file 'mysql-test/include/wait_for_status_var.inc'
--- a/mysql-test/include/wait_for_status_var.inc	2010-10-21 13:24:31 +0000
+++ b/mysql-test/include/wait_for_status_var.inc	2011-01-13 21:18:17 +0000
@@ -50,8 +50,23 @@ if (!$_status_var_comparsion)
   let $_status_var_comparsion= =;
 }
 
+# Get type of variable
+let $_is_number= 0;
+if (`SELECT '$status_var_value' REGEXP '^[\+\-]*[0-9]+(\.[0-9]+)*\$'`)
+{
+  let $_is_number= 1;
+}
+
 let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE '$status_var'", Value, 1);
-while (`SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_value')`)
+
+# Set way of comparing
+let $_query= SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_value');
+if ($is_number)
+{
+  let $_query= SELECT NOT($_show_status_value $_status_var_comparsion $status_var_value);
+}
+
+while (`$_query`)
 {
   if (!$_status_timeout_counter)
   {
@@ -65,4 +80,9 @@ while (`SELECT NOT('$_show_status_value'
   dec $_status_timeout_counter;
   sleep 0.1;
   let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE '$status_var'", Value, 1);
+  let $_query= SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_value');
+  if ($is_number)
+  {
+    let $_query= SELECT NOT($_show_status_value $_status_var_comparsion $status_var_value);
+  }
 }

=== modified file 'mysql-test/r/client_xml.result'
--- a/mysql-test/r/client_xml.result	2008-07-18 12:00:45 +0000
+++ b/mysql-test/r/client_xml.result	2011-01-14 14:20:34 +0000
@@ -21,9 +21,9 @@ insert into t1 values (1, 2, 'a&b a<b a>
 <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <database name="test">
 	<table_structure name="t1">
-		<field Field="a&amp;b" Type="int(11)" Null="YES" Key="" Extra="" />
-		<field Field="a&lt;b" Type="int(11)" Null="YES" Key="" Extra="" />
-		<field Field="a&gt;b" Type="text" Null="YES" Key="" Extra="" />
+		<field Field="a&amp;b" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+		<field Field="a&lt;b" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+		<field Field="a&gt;b" Type="text" Null="YES" Key="" Extra="" Comment="" />
 	</table_structure>
 	<table_data name="t1">
 	<row>

=== modified file 'mysql-test/r/func_math.result'
--- a/mysql-test/r/func_math.result	2010-12-24 11:21:44 +0000
+++ b/mysql-test/r/func_math.result	2011-01-14 14:03:37 +0000
@@ -641,3 +641,18 @@ INSERT INTO t1 (SELECT -pi());
 Warnings:
 Warning	1265	Data truncated for column 'a' at row 1
 DROP TABLE t1;
+#
+# Bug #59241 invalid memory read
+#            in do_div_mod with doubly assigned variables
+#
+SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa')));
+((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa')))
+NULL
+Warnings:
+Warning	1366	Incorrect decimal value: '' for column '' at row -1
+#
+# Bug #59498 div function broken in mysql-trunk
+#
+SELECT 1 div null;
+1 div null
+NULL

=== modified file 'mysql-test/r/func_str.result'
--- a/mysql-test/r/func_str.result	2010-12-14 16:26:18 +0000
+++ b/mysql-test/r/func_str.result	2011-01-13 08:07:21 +0000
@@ -2615,6 +2615,22 @@ CONVERT(('' IN (REVERSE(CAST(('') AS DEC
 1
 Warnings:
 Warning	1292	Truncated incorrect DECIMAL value: ''
+# 
+# Bug#58165: "my_empty_string" gets modified and causes LOAD DATA to fail
+# and other crashes
+#
+CREATE TABLE t1 ( a TEXT );
+SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE 'bug58165.txt';
+SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' );
+insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' )
+x
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: 'b'
+LOAD DATA INFILE 'bug58165.txt' INTO TABLE t1;
+SELECT * FROM t1;
+a
+aaaaaaaaaaaaaa
+DROP TABLE t1;
 End of 5.1 tests
 Start of 5.4 tests
 SELECT format(12345678901234567890.123, 3);

=== modified file 'mysql-test/r/gis.result'
--- a/mysql-test/r/gis.result	2010-09-29 14:26:32 +0000
+++ b/mysql-test/r/gis.result	2011-01-12 13:11:31 +0000
@@ -1014,6 +1014,14 @@ SET @a=0x0000000003000000010000000000000
 SET @a=POLYFROMWKB(@a);
 SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
 SET @a=POLYFROMWKB(@a);
+create table t1(a polygon NOT NULL)engine=myisam;
+insert into t1 values (geomfromtext("point(0 1)"));
+insert into t1 values (geomfromtext("point(1 0)"));
+select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
+p
+NULL
+NULL
+drop table t1;
 End of 5.1 tests
 CREATE TABLE t1(
 col0 BINARY NOT NULL,

=== modified file 'mysql-test/r/join_outer.result'
--- a/mysql-test/r/join_outer.result	2010-12-17 11:11:34 +0000
+++ b/mysql-test/r/join_outer.result	2011-01-13 08:33:30 +0000
@@ -1432,4 +1432,74 @@ WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AN
 GROUP BY t2.f1, t2.f2;
 f1	f1	f2
 DROP TABLE t1,t2;
+#
+# Bug#57034 incorrect OUTER JOIN result when joined on unique key
+#
+CREATE TABLE t1 (pk INT PRIMARY KEY, 
+col_int INT, 
+col_int_unique INT UNIQUE KEY);
+INSERT INTO t1 VALUES (1,NULL,2), (2,0,0);
+CREATE TABLE t2 (pk INT PRIMARY KEY,
+col_int INT,
+col_int_unique INT UNIQUE KEY);
+INSERT INTO t2 VALUES (1,0,1), (2,0,2);
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2
+ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int 
+WHERE t1.pk=1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	const	PRIMARY	PRIMARY	4	const	1	
+1	SIMPLE	t2	const	col_int_unique	col_int_unique	5	const	1	
+SELECT * FROM t1 LEFT JOIN t2
+ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int 
+WHERE t1.pk=1;
+pk	col_int	col_int_unique	pk	col_int	col_int_unique
+1	NULL	2	NULL	NULL	NULL
+DROP TABLE t1,t2;
+#
+# Bug#48046 Server incorrectly processing JOINs on NULL values
+#
+CREATE TABLE `BB` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`time_key` time DEFAULT NULL,
+`varchar_key` varchar(1) DEFAULT NULL,
+`varchar_nokey` varchar(1) DEFAULT NULL,
+PRIMARY KEY (`pk`),
+KEY `time_key` (`time_key`),
+KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
+INSERT INTO `BB` VALUES (10,'18:27:58',NULL,NULL);
+SELECT table1.time_key AS field1, table2.pk 
+FROM BB table1  LEFT JOIN BB table2 
+ON table2.varchar_nokey = table1.varchar_key
+HAVING field1;
+field1	pk
+18:27:58	NULL
+DROP TABLE BB;
+#
+# Bug#49600 Server incorrectly processing RIGHT JOIN with 
+#           constant WHERE clause and no index
+#
+CREATE TABLE `BB` (
+`col_datetime_key` datetime DEFAULT NULL,
+`col_varchar_key` varchar(1) DEFAULT NULL,
+`col_varchar_nokey` varchar(1) DEFAULT NULL,
+KEY `col_datetime_key` (`col_datetime_key`),
+KEY `col_varchar_key` (`col_varchar_key`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO `BB` VALUES ('1900-01-01 00:00:00',NULL,NULL);
+SELECT table1.col_datetime_key  
+FROM BB table1 RIGHT JOIN BB table2 
+ON table2 .col_varchar_nokey = table1.col_varchar_key
+WHERE 7;
+col_datetime_key
+NULL
+ALTER TABLE BB DISABLE KEYS;
+SELECT table1.col_datetime_key  
+FROM BB table1 RIGHT JOIN BB table2
+ON table2 .col_varchar_nokey = table1.col_varchar_key
+WHERE 7;
+col_datetime_key
+NULL
+DROP TABLE BB;
 End of 5.1 tests

=== modified file 'mysql-test/r/mysqladmin.result'
--- a/mysql-test/r/mysqladmin.result	2006-11-10 12:25:10 +0000
+++ b/mysql-test/r/mysqladmin.result	2011-01-15 20:34:08 +0000
@@ -2,3 +2,11 @@ mysqld is alive
 mysqladmin: unknown variable 'database=db1'
 Warning: mysqladmin: unknown variable 'loose-database=db2'
 mysqld is alive
+#
+# Bug#58221 : mysqladmin --sleep=x --count=x keeps looping
+#
+# Executing mysqladmin with --sleep=1 and --count=2.
+# Done.
+# Displaying the output :
+mysqld is alive
+mysqld is alive

=== modified file 'mysql-test/r/mysqlbinlog_row_big.result'
--- a/mysql-test/r/mysqlbinlog_row_big.result	2009-04-02 22:34:18 +0000
+++ b/mysql-test/r/mysqlbinlog_row_big.result	2011-01-12 19:32:45 +0000
@@ -36,8 +36,8 @@ c1 LONGTEXT
 #
 # Insert some big rows.
 #
-256MB
-INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 16777216));
+64MB
+INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 4194304));
 affected rows: 1
 32MB
 INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
@@ -53,7 +53,7 @@ affected rows: 1
 # Do not display the column value itself, just its length.
 #
 SELECT LENGTH(c1) FROM t1;
-LENGTH(c1)	268435456
+LENGTH(c1)	67108864
 LENGTH(c1)	33554432
 LENGTH(c1)	4194304
 LENGTH(c1)	524288
@@ -69,7 +69,7 @@ info: Rows matched: 4  Changed: 4  Warni
 # Do not display the column value itself, just its length.
 #
 SELECT LENGTH(c1) FROM t1;
-LENGTH(c1)	536870912
+LENGTH(c1)	134217728
 LENGTH(c1)	1048576
 LENGTH(c1)	67108864
 LENGTH(c1)	8388608

=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result	2010-12-03 01:06:56 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result	2011-01-14 13:21:46 +0000
@@ -20,6 +20,7 @@ The following options may be given as th
  Offset added to Auto-increment columns. Used when
  auto-increment-increment != 1
  --autocommit        Set default value for autocommit (0 or 1)
+ (Defaults to on; use --skip-autocommit to disable.)
  --automatic-sp-privileges 
  Creating and dropping stored procedures alters ACLs
  (Defaults to on; use --skip-automatic-sp-privileges to disable.)
@@ -732,6 +733,7 @@ abort-slave-event-count 0
 allow-suspicious-udfs FALSE
 auto-increment-increment 1
 auto-increment-offset 1
+autocommit TRUE
 automatic-sp-privileges TRUE
 back-log 50
 big-tables FALSE

=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result	2010-12-06 11:55:36 +0000
+++ b/mysql-test/r/mysqld--help-win.result	2011-01-14 13:21:46 +0000
@@ -20,6 +20,7 @@ The following options may be given as th
  Offset added to Auto-increment columns. Used when
  auto-increment-increment != 1
  --autocommit        Set default value for autocommit (0 or 1)
+ (Defaults to on; use --skip-autocommit to disable.)
  --automatic-sp-privileges 
  Creating and dropping stored procedures alters ACLs
  (Defaults to on; use --skip-automatic-sp-privileges to disable.)
@@ -736,6 +737,7 @@ abort-slave-event-count 0
 allow-suspicious-udfs FALSE
 auto-increment-increment 1
 auto-increment-offset 1
+autocommit TRUE
 automatic-sp-privileges TRUE
 back-log 50
 big-tables FALSE

=== modified file 'mysql-test/r/mysqldump.result'
--- a/mysql-test/r/mysqldump.result	2010-05-08 22:03:35 +0000
+++ b/mysql-test/r/mysqldump.result	2011-01-14 14:41:00 +0000
@@ -14,7 +14,7 @@ INSERT INTO t1 VALUES (1), (2);
 <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <database name="test">
 	<table_structure name="t1">
-		<field Field="a" Type="int(11)" Null="YES" Key="MUL" Extra="" />
+		<field Field="a" Type="int(11)" Null="YES" Key="MUL" Extra="" Comment="" />
 		<key Table="t1" Non_unique="1" Key_name="a" Seq_in_index="1" Column_name="a" Collation="A" Null="YES" Index_type="BTREE" Comment="" Index_comment="" />
 	</table_structure>
 	<table_data name="t1">
@@ -150,9 +150,9 @@ INSERT INTO t1 VALUES (1, "test", "tes")
 <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <database name="test">
 	<table_structure name="t1">
-		<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
-		<field Field="b" Type="text" Null="YES" Key="" Extra="" />
-		<field Field="c" Type="varchar(3)" Null="YES" Key="" Extra="" />
+		<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+		<field Field="b" Type="text" Null="YES" Key="" Extra="" Comment="" />
+		<field Field="c" Type="varchar(3)" Null="YES" Key="" Extra="" Comment="" />
 	</table_structure>
 	<table_data name="t1">
 	<row>
@@ -178,7 +178,7 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
 <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <database name="test">
 	<table_structure name="t1">
-		<field Field="a&quot;b&quot;" Type="char(2)" Null="YES" Key="" Extra="" />
+		<field Field="a&quot;b&quot;" Type="char(2)" Null="YES" Key="" Extra="" Comment="" />
 	</table_structure>
 	<table_data name="t1">
 	<row>
@@ -1612,10 +1612,10 @@ CREATE TABLE `t2` (
 <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <database name="mysqldump_test_db">
 	<table_structure name="t1">
-		<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
+		<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
 	</table_structure>
 	<table_structure name="t2">
-		<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
+		<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
 	</table_structure>
 </database>
 </mysqldump>
@@ -1623,10 +1623,10 @@ CREATE TABLE `t2` (
 <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <database name="mysqldump_test_db">
 	<table_structure name="t1">
-		<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
+		<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
 	</table_structure>
 	<table_structure name="t2">
-		<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
+		<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
 	</table_structure>
 </database>
 </mysqldump>
@@ -3644,8 +3644,8 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
 <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <database name="test">
 	<table_structure name="t1">
-		<field Field="f1" Type="int(10)" Null="YES" Key="" Extra="" />
-		<field Field="data" Type="mediumblob" Null="YES" Key="" Extra="" />
+		<field Field="f1" Type="int(10)" Null="YES" Key="" Extra="" Comment="" />
+		<field Field="data" Type="mediumblob" Null="YES" Key="" Extra="" Comment="" />
 	</table_structure>
 	<table_data name="t1">
 	<row>
@@ -4576,5 +4576,20 @@ LENGTH(a)
 800
 DROP TABLE t1, t2;
 #
+# Bug #13618 : mysqldump --xml ommit comment on table field
+#
+CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE COMMENT';
+<?xml version="1.0"?>
+<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<database name="test">
+	<table_structure name="comment_table">
+		<field Field="i" Type="int(11)" Null="YES" Key="" Extra="" Comment="FIELD COMMENT" />
+	</table_structure>
+	<table_data name="comment_table">
+	</table_data>
+</database>
+</mysqldump>
+DROP TABLE `comment_table`;
+#
 # End of 5.1 tests
 #

=== modified file 'mysql-test/r/plugin_auth.result'
--- a/mysql-test/r/plugin_auth.result	2010-12-17 11:11:34 +0000
+++ b/mysql-test/r/plugin_auth.result	2011-01-16 03:59:05 +0000
@@ -319,7 +319,7 @@ Proxied_user
 With_grant	1
 FLUSH PRIVILEGES;
 #
-# Bug#58139 : default-auth option not recognized in MySQL standardi
+# Bug#58139 : default-auth option not recognized in MySQL standard
 #             command line clients
 #
 # Executing 'mysql'
@@ -328,4 +328,6 @@ FLUSH PRIVILEGES;
 # Executing 'mysqladmin'
 mysqld is alive
 # Executing 'mysqldump'
+# Executing 'mysql_upgrade'
+The --upgrade-system-tables option was used, databases won't be touched.
 End of 5.5 tests

=== modified file 'mysql-test/r/select.result'
--- a/mysql-test/r/select.result	2010-10-19 06:45:18 +0000
+++ b/mysql-test/r/select.result	2011-01-13 10:42:48 +0000
@@ -4867,6 +4867,70 @@ SELECT 1 FROM t1 ORDER BY a COLLATE lati
 1
 1
 DROP TABLE t1;
+#
+# Bug #58422: Incorrect result when OUTER JOIN'ing 
+# with an empty table
+#
+CREATE TABLE t_empty(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
+CREATE TABLE t1(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+CREATE TABLE t2(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
+INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
+EXPLAIN
+SELECT *
+FROM 
+t1
+LEFT OUTER JOIN
+(t2 INNER JOIN t_empty ON TRUE)
+ON t1.pk=t2.pk
+WHERE t2.pk <> 2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT *
+FROM 
+t1
+LEFT OUTER JOIN
+(t2 INNER JOIN t_empty ON TRUE)
+ON t1.pk=t2.pk
+WHERE t2.pk <> 2;
+pk	i	pk	i	pk	i
+EXPLAIN
+SELECT *
+FROM 
+t1
+LEFT OUTER JOIN
+(t2 CROSS JOIN t_empty)
+ON t1.pk=t2.pk
+WHERE t2.pk <> 2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT *
+FROM 
+t1
+LEFT OUTER JOIN
+(t2 CROSS JOIN t_empty)
+ON t1.pk=t2.pk
+WHERE t2.pk <> 2;
+pk	i	pk	i	pk	i
+EXPLAIN
+SELECT *
+FROM 
+t1
+LEFT OUTER JOIN
+(t2 INNER JOIN t_empty ON t_empty.i=t2.i)
+ON t1.pk=t2.pk
+WHERE t2.pk <> 2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT *
+FROM 
+t1
+LEFT OUTER JOIN
+(t2 INNER JOIN t_empty ON t_empty.i=t2.i)
+ON t1.pk=t2.pk
+WHERE t2.pk <> 2;
+pk	i	pk	i	pk	i
+DROP TABLE t1,t2,t_empty;
 End of 5.1 tests
 #
 # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on 

=== modified file 'mysql-test/r/show_check.result'
--- a/mysql-test/r/show_check.result	2010-11-30 17:53:11 +0000
+++ b/mysql-test/r/show_check.result	2011-01-17 07:12:38 +0000
@@ -1325,6 +1325,17 @@ Tables_in_test	Table_type
 �mes latin1;
+#
+# Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection
+# Character set: Latin-1 (ISO-8859-1)
+#
+SET NAMES latin1;
+CREATE DATABASE `�`;
+CREATE TABLE `�`.`�` (a int) ENGINE=Memory;
+SHOW TABLE STATUS FROM `�` LIKE '�';
+Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
+�	MEMORY	10	Fixed	0	8	#	#	#	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL		
+DROP DATABASE `�`;
 show columns from `#mysql50#????????`;
 Got one of the listed errors
 DROP TABLE IF EXISTS t1;

=== modified file 'mysql-test/r/type_timestamp.result'
--- a/mysql-test/r/type_timestamp.result	2010-09-13 07:30:10 +0000
+++ b/mysql-test/r/type_timestamp.result	2011-01-12 12:58:47 +0000
@@ -540,3 +540,32 @@ a
 2010-03-05 11:08:02
 DROP TABLE t1;
 End of Bug#50888
+#
+# Bug59330: Incorrect result when comparing an aggregate
+#           function with TIMESTAMP
+#
+CREATE TABLE t1 (dt DATETIME, ts TIMESTAMP);
+INSERT INTO t1 VALUES('2011-01-06 12:34:30', '2011-01-06 12:34:30');
+SELECT MAX(dt), MAX(ts) FROM t1;
+MAX(dt)	MAX(ts)
+2011-01-06 12:34:30	2011-01-06 12:34:30
+SELECT MAX(ts) < '2010-01-01 00:00:00' FROM t1;
+MAX(ts) < '2010-01-01 00:00:00'
+0
+SELECT MAX(dt) < '2010-01-01 00:00:00' FROM t1;
+MAX(dt) < '2010-01-01 00:00:00'
+0
+SELECT MAX(ts) > '2010-01-01 00:00:00' FROM t1;
+MAX(ts) > '2010-01-01 00:00:00'
+1
+SELECT MAX(dt) > '2010-01-01 00:00:00' FROM t1;
+MAX(dt) > '2010-01-01 00:00:00'
+1
+SELECT MAX(ts) = '2011-01-06 12:34:30' FROM t1;
+MAX(ts) = '2011-01-06 12:34:30'
+1
+SELECT MAX(dt) = '2011-01-06 12:34:30' FROM t1;
+MAX(dt) = '2011-01-06 12:34:30'
+1
+DROP TABLE t1;
+End of 5.5 tests

=== modified file 'mysql-test/suite/perfschema/r/server_init.result'
--- a/mysql-test/suite/perfschema/r/server_init.result	2010-11-12 11:23:17 +0000
+++ b/mysql-test/suite/perfschema/r/server_init.result	2011-01-12 20:36:39 +0000
@@ -31,10 +31,6 @@ select count(name) from mutex_instances
 where name like "wait/synch/mutex/mysys/THR_LOCK_charset";
 count(name)
 1
-select count(name) from mutex_instances
-where name like "wait/synch/mutex/mysys/THR_LOCK_time";
-count(name)
-1
 select count(name) from cond_instances
 where name like "wait/synch/cond/mysys/THR_COND_threads";
 count(name)

=== modified file 'mysql-test/suite/perfschema/t/server_init.test'
--- a/mysql-test/suite/perfschema/t/server_init.test	2010-11-12 11:23:17 +0000
+++ b/mysql-test/suite/perfschema/t/server_init.test	2011-01-12 20:36:39 +0000
@@ -52,9 +52,6 @@ select count(name) from mutex_instances
 select count(name) from mutex_instances
  where name like "wait/synch/mutex/mysys/THR_LOCK_charset";
 
-select count(name) from mutex_instances
- where name like "wait/synch/mutex/mysys/THR_LOCK_time";
-
 # There are no global rwlock in mysys
 
 # Verify that these global conditions have been properly initilized in mysys

=== modified file 'mysql-test/suite/rpl/r/rpl_heartbeat_basic.result'
--- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result	2010-12-19 17:15:12 +0000
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result	2011-01-13 21:18:17 +0000
@@ -16,7 +16,7 @@ RESET SLAVE;
 
 *** Reset slave affect ***
 SET @@global.slave_net_timeout=30;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5;
 RESET SLAVE;
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 Variable_name	Value
@@ -24,7 +24,7 @@ Slave_heartbeat_period	15.000
 
 *** Default value if slave_net_timeout changed ***
 SET @@global.slave_net_timeout=50;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20;
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 Variable_name	Value
 Slave_heartbeat_period	25.000
@@ -39,14 +39,14 @@ SET @@global.slave_net_timeout=@restore_
 RESET SLAVE;
 
 *** Warning if updated slave_heartbeat_timeout > slave_net_timeout ***
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=SLAVE_NET_TIMEOUT;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=SLAVE_NET_TIMEOUT;
 Warnings:
 Warning	1704	The requested value for the heartbeat period exceeds the value of `slave_net_timeout' seconds. A sensible value for the period should be less than the timeout.
 RESET SLAVE;
 
 *** CHANGE MASTER statement only updates slave_heartbeat_period ***
 SET @@global.slave_net_timeout=20;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5;
 SHOW VARIABLES LIKE 'slave_net_timeout';
 Variable_name	Value
 slave_net_timeout	20
@@ -67,7 +67,7 @@ RESET SLAVE;
 SET @@global.slave_net_timeout=500;
 SET @@global.slave_net_timeout=200;
 RESET SLAVE;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20;
 include/start_slave.inc
 SHOW VARIABLES LIKE 'slave_net_timeout';
 Variable_name	Value
@@ -82,7 +82,7 @@ SET @@global.slave_net_timeout=@restore_
 
 *** Start/stop slave ***
 SET @@global.slave_net_timeout=100;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=20;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=20;
 include/start_slave.inc
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 Variable_name	Value
@@ -94,7 +94,7 @@ Slave_heartbeat_period	20.000
 
 *** Reload slave ***
 SET @@global.slave_net_timeout=50;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=30;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=30;
 include/rpl_restart_server.inc [server_number=2]
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 Variable_name	Value
@@ -102,7 +102,7 @@ Slave_heartbeat_period	30.000
 SET @restore_slave_net_timeout=@@global.slave_net_timeout;
 
 *** Disable heartbeat ***
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0;
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 Variable_name	Value
 Slave_heartbeat_period	0.000
@@ -129,12 +129,12 @@ Result
 0
 
 *** Min slave_heartbeat_timeout ***
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.001;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.001;
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 Variable_name	Value
 Slave_heartbeat_period	0.001
 RESET SLAVE;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.0009;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.0009;
 Warnings:
 Warning	1703	The requested value for the heartbeat period is less than 1 millisecond. The value is reset to 0, meaning that heartbeating will effectively be disabled.
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
@@ -143,36 +143,36 @@ Slave_heartbeat_period	0.000
 RESET SLAVE;
 
 *** Max slave_heartbeat_timeout ***
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=4294967;
 Warnings:
 Warning	1704	The requested value for the heartbeat period exceeds the value of `slave_net_timeout' seconds. A sensible value for the period should be less than the timeout.
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 Variable_name	Value
 Slave_heartbeat_period	4294967.000
 RESET SLAVE;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294968;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=4294968;
 ERROR HY000: The requested value for the heartbeat period is either negative or exceeds the maximum allowed (4294967 seconds).
 RESET SLAVE;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=8589935;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=8589935;
 ERROR HY000: The requested value for the heartbeat period is either negative or exceeds the maximum allowed (4294967 seconds).
 RESET SLAVE;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967296;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=4294967296;
 ERROR HY000: The requested value for the heartbeat period is either negative or exceeds the maximum allowed (4294967 seconds).
 RESET SLAVE;
 
 *** Misc incorrect values ***
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='-1';
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD='-1';
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''-1'' at line 1
 RESET SLAVE;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='123abc';
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD='123abc';
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''123abc'' at line 1
 RESET SLAVE;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='';
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD='';
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''' at line 1
 RESET SLAVE;
 
 *** Running slave ***
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1;
 include/start_slave.inc
 Heartbeat event received
 
@@ -218,7 +218,7 @@ BEGIN
 UPDATE test.t1 SET a = a + 1 WHERE a < 10;
 END|
 RESET SLAVE;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5;
 include/start_slave.inc
 SET @@global.event_scheduler=1;
 Number of received heartbeat events: 0
@@ -231,7 +231,7 @@ RESET SLAVE;
 DROP TABLE t1;
 DROP TABLE t1;
 RESET MASTER;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.5;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.5;
 include/start_slave.inc
 Heartbeat events are received while rotation of relay logs (1 means 'yes'): 1
 
@@ -240,7 +240,7 @@ SET @@global.slave_compressed_protocol=1
 include/stop_slave.inc
 RESET SLAVE;
 SET @@global.slave_compressed_protocol=1;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1;
 include/start_slave.inc
 Heartbeat event received
 SET @@global.slave_compressed_protocol=0;
@@ -249,7 +249,7 @@ SET @@global.slave_compressed_protocol=0
 *** Reset master ***
 STOP SLAVE;
 RESET SLAVE;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1;
 include/start_slave.inc
 RESET MASTER;
 Heartbeat events are received after reset of master (1 means 'yes'): 1
@@ -257,7 +257,7 @@ Heartbeat events are received after rese
 *** Reload master ***
 STOP SLAVE;
 RESET SLAVE;
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_CONNECT_RETRY = 5;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1;
 include/start_slave.inc
 Heartbeat event received
 include/rpl_restart_server.inc [server_number=1]

=== modified file 'mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result'
--- a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result	2010-12-19 17:15:12 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result	2011-01-13 12:21:57 +0000
@@ -1,14 +1,12 @@
 include/master-slave.inc
 [connection master]
+include/rpl_reset.inc
 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 from <binlog_start>;
+******** [master] SHOW BINLOG EVENTS IN <FILE> ********
+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
@@ -23,19 +21,17 @@ 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] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
+show binlog events in 'master-bin.000001' from <binlog_start> limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
+show binlog events in 'master-bin.000001' 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
-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         *********
+******** [master] SHOW 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)
@@ -51,33 +47,8 @@ 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,4;
-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
-master-bin.000001	#	Query	#	#	COMMIT
-[SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
-show binlog events from <binlog_start>;
+******** [slave] SHOW BINLOG EVENTS IN <FILE> ********
+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
@@ -92,19 +63,17 @@ 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] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
+show binlog events in 'slave-bin.000001' from <binlog_start> limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
+show binlog events in 'slave-bin.000001' 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-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          *********
+******** [slave] SHOW 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)
@@ -120,85 +89,53 @@ 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,4;
+******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start>;
 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-bin.000001	#	Query	#	#	COMMIT
-[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
-show relaylog events in 'slave-relay-bin.000002' from <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-relay-bin.000002	#	Rotate	#	#	master-bin.000001;pos=4
-slave-relay-bin.000002	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000002	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
-slave-relay-bin.000002	#	Query	#	#	BEGIN
-slave-relay-bin.000002	#	Table_map	#	#	table_id: # (test.t1)
-slave-relay-bin.000002	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-slave-relay-bin.000002	#	Query	#	#	COMMIT
-slave-relay-bin.000002	#	Query	#	#	BEGIN
-slave-relay-bin.000002	#	Table_map	#	#	table_id: # (test.t1)
-slave-relay-bin.000002	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-slave-relay-bin.000002	#	Query	#	#	COMMIT
-slave-relay-bin.000002	#	Query	#	#	BEGIN
-slave-relay-bin.000002	#	Table_map	#	#	table_id: # (test.t1)
-slave-relay-bin.000002	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-slave-relay-bin.000002	#	Query	#	#	COMMIT
-slave-relay-bin.000002	#	Query	#	#	BEGIN
-slave-relay-bin.000002	#	Table_map	#	#	table_id: # (test.t1)
-slave-relay-bin.000002	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-slave-relay-bin.000002	#	Query	#	#	COMMIT
-slave-relay-bin.000002	#	Query	#	#	BEGIN
-slave-relay-bin.000002	#	Table_map	#	#	table_id: # (test.t1)
-slave-relay-bin.000002	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-slave-relay-bin.000002	#	Query	#	#	COMMIT
-slave-relay-bin.000002	#	Query	#	#	BEGIN
-slave-relay-bin.000002	#	Table_map	#	#	table_id: # (test.t1)
-slave-relay-bin.000002	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-slave-relay-bin.000002	#	Query	#	#	COMMIT
-[SLAVE] ********* SOW RELAYLOG EVENTS        *********
+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] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000003	#	Rotate	#	#	master-bin.000001;pos=4
+******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ********
+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
+******** [slave] SHOW RELAYLOG EVENTS  ********
 show relaylog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-relay-bin.000001	#	Rotate	#	#	slave-relay-bin.000002;pos=4
-[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows  *********
-show relaylog events in 'slave-relay-bin.000002' from <binlog_start> limit 3;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-relay-bin.000002	#	Rotate	#	#	master-bin.000001;pos=4
-slave-relay-bin.000002	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000002	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
-[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows  *********
-show relaylog events in 'slave-relay-bin.000002' from <binlog_start> limit 1,3;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-relay-bin.000002	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000002	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
-slave-relay-bin.000002	#	Query	#	#	BEGIN
+slave-relay-bin.000002	#	Rotate	#	#	slave-relay-bin.000003;pos=4
 FLUSH LOGS;
 FLUSH LOGS;
 DROP TABLE t1;
-[MASTER] ********* SOW BINLOG EVENTS IN ...  *********
+******** [master] SHOW BINLOG EVENTS IN <FILE> ********
 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` /* generated by server */
-[MASTER] ********* SOW BINLOG EVENTS         *********
+******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
+show binlog events in 'master-bin.000002' from <binlog_start> limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000002	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
+show binlog events in 'master-bin.000002' from <binlog_start> limit 1,3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+******** [master] SHOW 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)
@@ -214,24 +151,19 @@ 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 ...   *********
+******** [slave] SHOW BINLOG EVENTS IN <FILE> ********
 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` /* generated by server */
-[SLAVE] ********* SOW BINLOG EVENTS          *********
+******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
+show binlog events in 'slave-bin.000002' from <binlog_start> limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000002	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
+show binlog events in 'slave-bin.000002' from <binlog_start> limit 1,3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+******** [slave] SHOW 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)
@@ -247,27 +179,25 @@ 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 from <binlog_start>;
+******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ********
+show relaylog events in 'slave-relay-bin.000006' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-relay-bin.000004	#	Rotate	#	#	master-bin.000002;pos=4
-slave-relay-bin.000004	#	Rotate	#	#	slave-relay-bin.000005;pos=4
-[SLAVE] ********* SOW RELAYLOG EVENTS        *********
+slave-relay-bin.000006	#	Rotate	#	#	master-bin.000002;pos=4
+slave-relay-bin.000006	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000006	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
+show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000006	#	Rotate	#	#	master-bin.000002;pos=4
+******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ********
+show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 1,3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000006	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000006	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+******** [slave] SHOW RELAYLOG EVENTS  ********
 show relaylog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-relay-bin.000004	#	Rotate	#	#	master-bin.000002;pos=4
-slave-relay-bin.000004	#	Rotate	#	#	slave-relay-bin.000005;pos=4
+slave-relay-bin.000005	#	Rotate	#	#	master-bin.000002;pos=4
+slave-relay-bin.000005	#	Rotate	#	#	slave-relay-bin.000006;pos=4
 include/rpl_end.inc

=== modified 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	2010-12-19 17:15:12 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result	2011-01-13 12:21:57 +0000
@@ -1,14 +1,12 @@
 include/master-slave.inc
 [connection master]
+include/rpl_reset.inc
 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 from <binlog_start>;
+******** [master] SHOW BINLOG EVENTS IN <FILE> ********
+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
@@ -20,16 +18,17 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
 master-bin.000001	#	Query	#	#	COMMIT
+******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
+show binlog events in 'master-bin.000001' from <binlog_start> limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
+show binlog events in 'master-bin.000001' 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	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
-[MASTER] ********* SOW BINLOG EVENTS         *********
+******** [master] SHOW 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)
@@ -42,30 +41,8 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
-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	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
-[MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows  *********
-show binlog events from <binlog_start> limit 1,4;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-[SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
-show binlog events from <binlog_start>;
+******** [slave] SHOW BINLOG EVENTS IN <FILE> ********
+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
@@ -77,16 +54,17 @@ slave-bin.000001	#	Query	#	#	COMMIT
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
 slave-bin.000001	#	Query	#	#	COMMIT
+******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
+show binlog events in 'slave-bin.000001' from <binlog_start> limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
+show binlog events in 'slave-bin.000001' 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	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
-slave-bin.000001	#	Query	#	#	COMMIT
-slave-bin.000001	#	Query	#	#	BEGIN
-slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
-slave-bin.000001	#	Query	#	#	COMMIT
-slave-bin.000001	#	Query	#	#	BEGIN
-slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
 slave-bin.000001	#	Query	#	#	COMMIT
-[SLAVE] ********* SOW BINLOG EVENTS          *********
+******** [slave] SHOW 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)
@@ -99,76 +77,50 @@ slave-bin.000001	#	Query	#	#	COMMIT
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
 slave-bin.000001	#	Query	#	#	COMMIT
-slave-bin.000001	#	Query	#	#	BEGIN
-slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
-slave-bin.000001	#	Query	#	#	COMMIT
-slave-bin.000001	#	Query	#	#	BEGIN
-slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
-slave-bin.000001	#	Query	#	#	COMMIT
-slave-bin.000001	#	Query	#	#	BEGIN
-slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
-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	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
-[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows  *********
-show binlog events from <binlog_start> limit 1,4;
+******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000001	#	Query	#	#	BEGIN
-slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
-slave-bin.000001	#	Query	#	#	COMMIT
-slave-bin.000001	#	Query	#	#	BEGIN
-[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
-show relaylog events in 'slave-relay-bin.000002' from <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-relay-bin.000002	#	Rotate	#	#	master-bin.000001;pos=4
-slave-relay-bin.000002	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000002	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
-slave-relay-bin.000002	#	Query	#	#	BEGIN
-slave-relay-bin.000002	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
-slave-relay-bin.000002	#	Query	#	#	COMMIT
-slave-relay-bin.000002	#	Query	#	#	BEGIN
-slave-relay-bin.000002	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
-slave-relay-bin.000002	#	Query	#	#	COMMIT
-slave-relay-bin.000002	#	Query	#	#	BEGIN
-slave-relay-bin.000002	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
-slave-relay-bin.000002	#	Query	#	#	COMMIT
-slave-relay-bin.000002	#	Query	#	#	BEGIN
-slave-relay-bin.000002	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
-slave-relay-bin.000002	#	Query	#	#	COMMIT
-slave-relay-bin.000002	#	Query	#	#	BEGIN
-slave-relay-bin.000002	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
-slave-relay-bin.000002	#	Query	#	#	COMMIT
-slave-relay-bin.000002	#	Query	#	#	BEGIN
-slave-relay-bin.000002	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
-slave-relay-bin.000002	#	Query	#	#	COMMIT
-[SLAVE] ********* SOW RELAYLOG EVENTS        *********
+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	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
+slave-relay-bin.000003	#	Query	#	#	COMMIT
+slave-relay-bin.000003	#	Query	#	#	BEGIN
+slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
+slave-relay-bin.000003	#	Query	#	#	COMMIT
+slave-relay-bin.000003	#	Query	#	#	BEGIN
+slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
+slave-relay-bin.000003	#	Query	#	#	COMMIT
+******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
+show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000003	#	Rotate	#	#	master-bin.000001;pos=4
+******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ********
+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
+******** [slave] SHOW RELAYLOG EVENTS  ********
 show relaylog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-relay-bin.000001	#	Rotate	#	#	slave-relay-bin.000002;pos=4
-[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows  *********
-show relaylog events in 'slave-relay-bin.000002' from <binlog_start> limit 3;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-relay-bin.000002	#	Rotate	#	#	master-bin.000001;pos=4
-slave-relay-bin.000002	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000002	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
-[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows  *********
-show relaylog events in 'slave-relay-bin.000002' from <binlog_start> limit 1,3;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-relay-bin.000002	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
-slave-relay-bin.000002	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
-slave-relay-bin.000002	#	Query	#	#	BEGIN
+slave-relay-bin.000002	#	Rotate	#	#	slave-relay-bin.000003;pos=4
 FLUSH LOGS;
 FLUSH LOGS;
 DROP TABLE t1;
-[MASTER] ********* SOW BINLOG EVENTS IN ...  *********
+******** [master] SHOW BINLOG EVENTS IN <FILE> ********
 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` /* generated by server */
-[MASTER] ********* SOW BINLOG EVENTS         *********
+******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
+show binlog events in 'master-bin.000002' from <binlog_start> limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000002	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
+show binlog events in 'master-bin.000002' from <binlog_start> limit 1,3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+******** [master] SHOW 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)
@@ -181,21 +133,19 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
-master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
-[SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
+******** [slave] SHOW BINLOG EVENTS IN <FILE> ********
 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` /* generated by server */
-[SLAVE] ********* SOW BINLOG EVENTS          *********
+******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
+show binlog events in 'slave-bin.000002' from <binlog_start> limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000002	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
+show binlog events in 'slave-bin.000002' from <binlog_start> limit 1,3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+******** [slave] SHOW 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)
@@ -208,24 +158,25 @@ slave-bin.000001	#	Query	#	#	COMMIT
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3)
 slave-bin.000001	#	Query	#	#	COMMIT
-slave-bin.000001	#	Query	#	#	BEGIN
-slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4)
-slave-bin.000001	#	Query	#	#	COMMIT
-slave-bin.000001	#	Query	#	#	BEGIN
-slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5)
-slave-bin.000001	#	Query	#	#	COMMIT
-slave-bin.000001	#	Query	#	#	BEGIN
-slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (6)
-slave-bin.000001	#	Query	#	#	COMMIT
 slave-bin.000001	#	Rotate	#	#	slave-bin.000002;pos=4
-[SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
-show relaylog events from <binlog_start>;
+******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ********
+show relaylog events in 'slave-relay-bin.000006' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-relay-bin.000004	#	Rotate	#	#	master-bin.000002;pos=4
-slave-relay-bin.000004	#	Rotate	#	#	slave-relay-bin.000005;pos=4
-[SLAVE] ********* SOW RELAYLOG EVENTS        *********
+slave-relay-bin.000006	#	Rotate	#	#	master-bin.000002;pos=4
+slave-relay-bin.000006	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000006	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
+show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 1;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000006	#	Rotate	#	#	master-bin.000002;pos=4
+******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ********
+show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 1,3;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-relay-bin.000006	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000006	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+******** [slave] SHOW RELAYLOG EVENTS  ********
 show relaylog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-relay-bin.000004	#	Rotate	#	#	master-bin.000002;pos=4
-slave-relay-bin.000004	#	Rotate	#	#	slave-relay-bin.000005;pos=4
+slave-relay-bin.000005	#	Rotate	#	#	master-bin.000002;pos=4
+slave-relay-bin.000005	#	Rotate	#	#	slave-relay-bin.000006;pos=4
 include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_heartbeat_basic.test'
--- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test	2010-12-19 17:15:12 +0000
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test	2011-01-13 21:18:17 +0000
@@ -18,6 +18,9 @@
 --source include/have_binlog_format_mixed.inc
 --echo
 
+# Set number of retries to connect to master
+let $connect_retry= 20;
+
 --echo *** Preparing ***
 --connection slave
 --source include/stop_slave.inc
@@ -57,7 +60,7 @@ RESET SLAVE;
 SET @@global.slave_net_timeout=30;
 --enable_warnings
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=5;
 RESET SLAVE;
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 --echo
@@ -68,7 +71,7 @@ SHOW GLOBAL STATUS LIKE 'slave_heartbeat
 SET @@global.slave_net_timeout=50;
 --enable_warnings
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root';
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry;
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 SET @@global.slave_net_timeout=@restore_slave_net_timeout;
 RESET SLAVE;
@@ -88,7 +91,7 @@ RESET SLAVE;
 let $slave_net_timeout= query_get_value(SHOW VARIABLES LIKE 'slave_net_timeout', Value, 1);
 inc $slave_net_timeout;
 --replace_result $MASTER_MYPORT MASTER_PORT $slave_net_timeout SLAVE_NET_TIMEOUT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=$slave_net_timeout;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=$slave_net_timeout;
 RESET SLAVE;
 --echo 
 
@@ -98,7 +101,7 @@ RESET SLAVE;
 SET @@global.slave_net_timeout=20;
 --enable_warnings
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=5;
 SHOW VARIABLES LIKE 'slave_net_timeout';
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 SET @@global.slave_net_timeout=2*@@global.slave_net_timeout;
@@ -118,7 +121,7 @@ SET @@global.slave_net_timeout=500;
 SET @@global.slave_net_timeout=200;
 RESET SLAVE;
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root';
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry;
 --source include/start_slave.inc
 --connection master
 --sync_slave_with_master
@@ -138,7 +141,7 @@ SET @@global.slave_net_timeout=@restore_
 SET @@global.slave_net_timeout=100;
 --enable_warnings
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=20;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=20;
 --source include/start_slave.inc
 --connection master
 --sync_slave_with_master
@@ -154,7 +157,7 @@ SHOW GLOBAL STATUS LIKE 'slave_heartbeat
 SET @@global.slave_net_timeout=50;
 --enable_warnings
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=30;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=30;
 --let $rpl_server_number= 2
 --source include/rpl_restart_server.inc
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
@@ -164,7 +167,7 @@ SET @restore_slave_net_timeout=@@global.
 # Disable heartbeat
 --echo *** Disable heartbeat ***
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0;
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 SHOW STATUS LIKE 'slave_received_heartbeats';
 --source include/start_slave.inc
@@ -188,48 +191,48 @@ let $slave_heartbeat_timeout= query_get_
 
 --echo *** Min slave_heartbeat_timeout ***
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.001;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.001;
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 RESET SLAVE;
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.0009;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.0009;
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 RESET SLAVE;
 --echo
 
 --echo *** Max slave_heartbeat_timeout ***
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=4294967;
 SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
 RESET SLAVE;
 --replace_result $MASTER_MYPORT MASTER_PORT
 --error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE 
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294968;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=4294968;
 RESET SLAVE;
 # Check double size of max allowed value for master_heartbeat_period
 --replace_result $MASTER_MYPORT MASTER_PORT
 --error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE 
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=8589935;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=8589935;
 RESET SLAVE;
 # Check 2^32
 --replace_result $MASTER_MYPORT MASTER_PORT
 --error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE 
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967296;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=4294967296;
 RESET SLAVE;
 --echo
 
 --echo *** Misc incorrect values ***
 --replace_result $MASTER_MYPORT MASTER_PORT
 --error ER_PARSE_ERROR
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='-1';
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD='-1';
 RESET SLAVE;
 --replace_result $MASTER_MYPORT MASTER_PORT
 --error ER_PARSE_ERROR
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='123abc';
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD='123abc';
 RESET SLAVE;
 --replace_result $MASTER_MYPORT MASTER_PORT
 --error ER_PARSE_ERROR
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='';
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD='';
 RESET SLAVE;
 --echo
 
@@ -240,7 +243,7 @@ RESET SLAVE;
 # Check received heartbeat events for running slave
 --echo *** Running slave ***
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.1;
 --source include/start_slave.inc
 --connection master
 --sync_slave_with_master
@@ -342,7 +345,7 @@ DELIMITER ;|
 --connection slave
 RESET SLAVE;
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=5;
 --source include/start_slave.inc
 --connection master
 # Enable scheduler
@@ -374,7 +377,7 @@ DROP TABLE t1;
 RESET MASTER;
 --connection slave
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.5;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.5;
 let $slave_param_comparison= =;
 --source include/start_slave.inc
 let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
@@ -401,7 +404,7 @@ SET @@global.slave_compressed_protocol=1
 RESET SLAVE;
 SET @@global.slave_compressed_protocol=1;
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.1;
 --source include/start_slave.inc
 let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
 let $status_var= slave_received_heartbeats;
@@ -420,7 +423,7 @@ SET @@global.slave_compressed_protocol=0
 STOP SLAVE;
 RESET SLAVE;
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.1;
 --source include/start_slave.inc
 let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
 --connection master
@@ -439,7 +442,7 @@ let $result= query_get_value(SELECT ($rc
 STOP SLAVE;
 RESET SLAVE;
 --replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_CONNECT_RETRY = 5;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.1;
 --source include/start_slave.inc
 # Wait until slave_received_heartbeats will be incremented
 let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
@@ -474,7 +477,7 @@ let $status_var_comparsion= >;
 #let $slave_binlog= query_get_value(SHOW MASTER STATUS, File, 1);
 --connection master
 #--replace_result $SLAVE_MYPORT SLAVE_PORT $slave_binlog SLAVE_BINLOG
-#eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='$slave_binlog';
+#eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='$slave_binlog';
 --source include/start_slave.inc
 
 # Insert data on master and on slave and make sure that it replicated for both directions

=== added file 'mysql-test/suite/sys_vars/r/autocommit_func4.result'
--- a/mysql-test/suite/sys_vars/r/autocommit_func4.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/autocommit_func4.result	2011-01-14 13:21:46 +0000
@@ -0,0 +1,46 @@
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name varchar(30)
+) ENGINE = INNODB;
+SELECT @@global.autocommit;
+@@global.autocommit
+1
+SELECT @@autocommit;
+@@autocommit
+1
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+id	name
+1	Record_1
+2	Record_2
+ROLLBACK;
+SELECT * from t1;
+id	name
+1	Record_1
+2	Record_2
+set @@global.autocommit = 1-@@global.autocommit;
+set @@autocommit = 1-@@autocommit;
+SELECT @@global.autocommit;
+@@global.autocommit
+0
+SELECT @@autocommit;
+@@autocommit
+0
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+id	name
+1	Record_1
+2	Record_2
+3	Record_1
+4	Record_2
+ROLLBACK;
+SELECT * from t1;
+id	name
+1	Record_1
+2	Record_2
+DROP TABLE t1;
+set @@global.autocommit = 1-@@global.autocommit;

=== added file 'mysql-test/suite/sys_vars/r/autocommit_func5.result'
--- a/mysql-test/suite/sys_vars/r/autocommit_func5.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/autocommit_func5.result	2011-01-14 13:21:46 +0000
@@ -0,0 +1,42 @@
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name varchar(30)
+) ENGINE = INNODB;
+SELECT @@global.autocommit;
+@@global.autocommit
+0
+SELECT @@autocommit;
+@@autocommit
+0
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+id	name
+1	Record_1
+2	Record_2
+ROLLBACK;
+SELECT * from t1;
+id	name
+set @@global.autocommit = 1-@@global.autocommit;
+set @@autocommit = 1-@@autocommit;
+SELECT @@global.autocommit;
+@@global.autocommit
+1
+SELECT @@autocommit;
+@@autocommit
+1
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+id	name
+3	Record_1
+4	Record_2
+ROLLBACK;
+SELECT * from t1;
+id	name
+3	Record_1
+4	Record_2
+DROP TABLE t1;
+set @@global.autocommit = 1-@@global.autocommit;

=== added file 'mysql-test/suite/sys_vars/t/autocommit_func4-master.opt'
--- a/mysql-test/suite/sys_vars/t/autocommit_func4-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/autocommit_func4-master.opt	2011-01-14 13:21:46 +0000
@@ -0,0 +1 @@
+--autocommit=on

=== added file 'mysql-test/suite/sys_vars/t/autocommit_func4.test'
--- a/mysql-test/suite/sys_vars/t/autocommit_func4.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/autocommit_func4.test	2011-01-14 13:21:46 +0000
@@ -0,0 +1 @@
+--source suite/sys_vars/inc/autocommit_func2.inc

=== added file 'mysql-test/suite/sys_vars/t/autocommit_func5-master.opt'
--- a/mysql-test/suite/sys_vars/t/autocommit_func5-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/autocommit_func5-master.opt	2011-01-14 13:21:46 +0000
@@ -0,0 +1 @@
+--autocommit=off

=== added file 'mysql-test/suite/sys_vars/t/autocommit_func5.test'
--- a/mysql-test/suite/sys_vars/t/autocommit_func5.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/autocommit_func5.test	2011-01-14 13:21:46 +0000
@@ -0,0 +1 @@
+--source suite/sys_vars/inc/autocommit_func2.inc

=== modified file 'mysql-test/t/func_math.test'
--- a/mysql-test/t/func_math.test	2010-12-24 11:21:44 +0000
+++ b/mysql-test/t/func_math.test	2011-01-14 14:03:37 +0000
@@ -489,3 +489,14 @@ as foo;
 CREATE TABLE t1(a char(0));
 INSERT INTO t1 (SELECT -pi());
 DROP TABLE t1;
+
+--echo #
+--echo # Bug #59241 invalid memory read
+--echo #            in do_div_mod with doubly assigned variables
+--echo #
+SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa')));
+
+--echo #
+--echo # Bug #59498 div function broken in mysql-trunk
+--echo #
+SELECT 1 div null;

=== modified file 'mysql-test/t/func_str.test'
--- a/mysql-test/t/func_str.test	2010-12-14 16:26:18 +0000
+++ b/mysql-test/t/func_str.test	2011-01-13 08:07:21 +0000
@@ -1370,6 +1370,17 @@ DROP TABLE t1;
 SELECT '1' IN ('1', SUBSTRING(-9223372036854775809, 1));
 SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3));
 
+--echo # 
+--echo # Bug#58165: "my_empty_string" gets modified and causes LOAD DATA to fail
+--echo # and other crashes
+--echo #
+CREATE TABLE t1 ( a TEXT );
+SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE 'bug58165.txt';
+SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' );
+LOAD DATA INFILE 'bug58165.txt' INTO TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
 --echo End of 5.1 tests
 
 --echo Start of 5.4 tests

=== modified file 'mysql-test/t/gis.test'
--- a/mysql-test/t/gis.test	2010-09-29 14:26:32 +0000
+++ b/mysql-test/t/gis.test	2011-01-14 21:02:02 +0000
@@ -361,7 +361,7 @@ t1 where object_id=85998;
 
 # Expected result is 36.3310176346905, but IA64 returns 36.3310176346904
 # due to fused multiply-add instructions.
---replace_result 36.3310176346904 36.3310176346905
+--replace_result 36.3310176346904 36.3310176346905 -114.87787186923326 -114.87787186923313 36.33101763469053 36.33101763469059 36.33101763469043 36.33101763469059
 select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
 t1 where object_id=85984;
 
@@ -747,6 +747,16 @@ SET @a=0x0000000003000000000000000000000
 SET @a=POLYFROMWKB(@a);
 
 
+#
+# Bug #57321    crashes and valgrind errors from spatial types
+#
+
+create table t1(a polygon NOT NULL)engine=myisam;
+insert into t1 values (geomfromtext("point(0 1)"));
+insert into t1 values (geomfromtext("point(1 0)"));
+select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
+drop table t1;
+
 --echo End of 5.1 tests
 
 #

=== modified file 'mysql-test/t/join_outer.test'
--- a/mysql-test/t/join_outer.test	2010-10-29 08:23:06 +0000
+++ b/mysql-test/t/join_outer.test	2011-01-13 08:33:30 +0000
@@ -1010,4 +1010,86 @@ GROUP BY t2.f1, t2.f2;
 
 DROP TABLE t1,t2;
 
+--echo #
+--echo # Bug#57034 incorrect OUTER JOIN result when joined on unique key
+--echo #
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, 
+                 col_int INT, 
+                 col_int_unique INT UNIQUE KEY);
+INSERT INTO t1 VALUES (1,NULL,2), (2,0,0);
+
+CREATE TABLE t2 (pk INT PRIMARY KEY,
+                 col_int INT,
+                 col_int_unique INT UNIQUE KEY);
+INSERT INTO t2 VALUES (1,0,1), (2,0,2);
+
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2
+  ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int 
+  WHERE t1.pk=1;
+
+SELECT * FROM t1 LEFT JOIN t2
+  ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int 
+  WHERE t1.pk=1;
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug#48046 Server incorrectly processing JOINs on NULL values
+--echo #
+
+# bug#48046 is a duplicate of bug#57034
+
+CREATE TABLE `BB` (
+  `pk` int(11) NOT NULL AUTO_INCREMENT,
+  `time_key` time DEFAULT NULL,
+  `varchar_key` varchar(1) DEFAULT NULL,
+  `varchar_nokey` varchar(1) DEFAULT NULL,
+  PRIMARY KEY (`pk`),
+  KEY `time_key` (`time_key`),
+  KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
+
+INSERT INTO `BB` VALUES (10,'18:27:58',NULL,NULL);
+
+SELECT table1.time_key AS field1, table2.pk 
+FROM BB table1  LEFT JOIN BB table2 
+ ON table2.varchar_nokey = table1.varchar_key
+ HAVING field1;
+
+DROP TABLE BB;
+
+--echo #
+--echo # Bug#49600 Server incorrectly processing RIGHT JOIN with 
+--echo #           constant WHERE clause and no index
+--echo #
+
+# bug#49600 is a duplicate of bug#57034
+
+CREATE TABLE `BB` (
+  `col_datetime_key` datetime DEFAULT NULL,
+  `col_varchar_key` varchar(1) DEFAULT NULL,
+  `col_varchar_nokey` varchar(1) DEFAULT NULL,
+  KEY `col_datetime_key` (`col_datetime_key`),
+  KEY `col_varchar_key` (`col_varchar_key`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+INSERT INTO `BB` VALUES ('1900-01-01 00:00:00',NULL,NULL);
+
+SELECT table1.col_datetime_key  
+FROM BB table1 RIGHT JOIN BB table2 
+ ON table2 .col_varchar_nokey = table1.col_varchar_key
+ WHERE 7;
+
+# Disable keys, and we get incorrect result for the same query
+ALTER TABLE BB DISABLE KEYS;
+
+SELECT table1.col_datetime_key  
+FROM BB table1 RIGHT JOIN BB table2
+ ON table2 .col_varchar_nokey = table1.col_varchar_key
+ WHERE 7;
+
+DROP TABLE BB;
+
 --echo End of 5.1 tests

=== modified file 'mysql-test/t/mysqladmin.test'
--- a/mysql-test/t/mysqladmin.test	2009-10-21 12:59:47 +0000
+++ b/mysql-test/t/mysqladmin.test	2011-01-15 20:38:24 +0000
@@ -33,3 +33,15 @@ EOF
 --exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root --password= ping 2>&1
 
 remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf;
+
+--echo #
+--echo # Bug#58221 : mysqladmin --sleep=x --count=x keeps looping
+--echo #
+
+--echo # Executing mysqladmin with --sleep=1 and --count=2.
+--exec $MYSQLADMIN -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --sleep=1 --count=2 ping > $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp
+--echo # Done.
+--echo # Displaying the output :
+--cat_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp
+
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp

=== modified file 'mysql-test/t/mysqlbinlog_row_big.test'
--- a/mysql-test/t/mysqlbinlog_row_big.test	2009-04-02 22:34:18 +0000
+++ b/mysql-test/t/mysqlbinlog_row_big.test	2011-01-12 19:32:45 +0000
@@ -79,8 +79,8 @@ eval CREATE TABLE t1 (
 --echo # Insert some big rows.
 --echo #
 
---echo 256MB
-INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 16777216));
+--echo 64MB
+INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 4194304));
 
 --echo 32MB
 INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));

=== modified file 'mysql-test/t/mysqldump.test'
--- a/mysql-test/t/mysqldump.test	2010-05-23 20:41:18 +0000
+++ b/mysql-test/t/mysqldump.test	2011-01-14 14:41:00 +0000
@@ -2169,6 +2169,15 @@ SELECT LENGTH(a) FROM t2;
 DROP TABLE t1, t2;
 
 ###########################################################################
+
+--echo #
+--echo # Bug #13618 : mysqldump --xml ommit comment on table field
+--echo #
+
+CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE COMMENT';
+--exec $MYSQL_DUMP --compact --skip-create --xml test
+DROP TABLE `comment_table`;
+
 --echo #
 --echo # End of 5.1 tests
 --echo #

=== modified file 'mysql-test/t/plugin_auth.test'
--- a/mysql-test/t/plugin_auth.test	2010-12-17 11:11:34 +0000
+++ b/mysql-test/t/plugin_auth.test	2011-01-16 03:59:05 +0000
@@ -395,7 +395,7 @@ FLUSH PRIVILEGES;
 FLUSH PRIVILEGES;
 
 --echo #
---echo # Bug#58139 : default-auth option not recognized in MySQL standardi
+--echo # Bug#58139 : default-auth option not recognized in MySQL standard
 --echo #             command line clients
 --echo #
 
@@ -408,4 +408,7 @@ FLUSH PRIVILEGES;
 --echo # Executing 'mysqldump'
 --exec $MYSQL_DUMP -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --compact --default-auth=auth_test_plugin $PLUGIN_AUTH_OPT test
 
+--echo # Executing 'mysql_upgrade'
+--exec $MYSQL_UPGRADE -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-auth=auth_test_plugin $PLUGIN_AUTH_OPT --skip-verbose --force --upgrade-system-tables
+
 --echo End of 5.5 tests

=== modified file 'mysql-test/t/select.test'
--- a/mysql-test/t/select.test	2010-10-19 06:45:18 +0000
+++ b/mysql-test/t/select.test	2011-01-13 10:42:48 +0000
@@ -4123,6 +4123,76 @@ SELECT 1 FROM t1 ORDER BY a COLLATE lati
 DROP TABLE t1;
 
 
+
+--echo #
+--echo # Bug #58422: Incorrect result when OUTER JOIN'ing 
+--echo # with an empty table
+--echo #
+
+CREATE TABLE t_empty(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
+CREATE TABLE t1(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+CREATE TABLE t2(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
+INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
+
+EXPLAIN
+SELECT *
+  FROM 
+    t1
+  LEFT OUTER JOIN
+    (t2 INNER JOIN t_empty ON TRUE)
+  ON t1.pk=t2.pk
+  WHERE t2.pk <> 2;
+
+SELECT *
+  FROM 
+    t1
+  LEFT OUTER JOIN
+    (t2 INNER JOIN t_empty ON TRUE)
+  ON t1.pk=t2.pk
+  WHERE t2.pk <> 2;
+
+
+EXPLAIN
+SELECT *
+  FROM 
+    t1
+  LEFT OUTER JOIN
+    (t2 CROSS JOIN t_empty)
+  ON t1.pk=t2.pk
+  WHERE t2.pk <> 2;
+
+SELECT *
+  FROM 
+    t1
+  LEFT OUTER JOIN
+    (t2 CROSS JOIN t_empty)
+  ON t1.pk=t2.pk
+  WHERE t2.pk <> 2;
+
+
+EXPLAIN
+SELECT *
+  FROM 
+    t1
+  LEFT OUTER JOIN
+    (t2 INNER JOIN t_empty ON t_empty.i=t2.i)
+  ON t1.pk=t2.pk
+  WHERE t2.pk <> 2;
+
+SELECT *
+  FROM 
+    t1
+  LEFT OUTER JOIN
+    (t2 INNER JOIN t_empty ON t_empty.i=t2.i)
+  ON t1.pk=t2.pk
+  WHERE t2.pk <> 2;
+
+
+
+DROP TABLE t1,t2,t_empty;
+
+
 --echo End of 5.1 tests
 
 --echo #

=== modified file 'mysql-test/t/show_check.test'
--- a/mysql-test/t/show_check.test	2011-01-07 13:37:46 +0000
+++ b/mysql-test/t/show_check.test	2011-01-17 07:12:38 +0000
@@ -1,3 +1,33 @@
+# Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2 of
+# the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301  USA
+#
+
+################################################################################
+#
+# NOTICE:
+#
+#  This file unfortunately contains characters in various different encodings. 
+#  Be careful when editing this file to ensure that you (or your editor) do
+#  not change things (such as encodings) on lines that you did not mean to 
+#  modify.
+#
+################################################################################
+
+
 # Uses GRANT commands that usually disabled in embedded server
 -- source include/not_embedded.inc
 
@@ -223,14 +253,6 @@ CREATE TABLE """a" (i INT);
 SHOW CREATE TABLE """a";
 DROP TABLE """a";
 
-# Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection
-#set names latin1;
-#create database `�`;
-#create table `�`.`�` (a int) engine=heap;
-#--replace_column 7 # 8 # 9 #
-#show table status from `�` LIKE '�';
-#drop database `�`;
-
 # to test quotes around keywords.. :
 
 SET sql_mode= '';
@@ -362,15 +384,6 @@ delete from mysql.db
 where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
 flush privileges;
 
-# This test fails on MAC OSX, so it is temporary disabled.
-# This needs WL#1324 to be done.
-#set names latin1;
-#create database `�`;
-#create table `9 #
-#show table status from `�` LIKE '�';
-#drop database `�`;
-
 # Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was
 # specified during table creation, but not otherwise. (Bug#7235)
 CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
@@ -1053,6 +1066,17 @@ show full tables;
 drop table `��t��`;
 set names latin1;
 
+--echo #
+--echo # Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection
+--echo # Character set: Latin-1 (ISO-8859-1)
+--echo #
+SET NAMES latin1;
+CREATE DATABASE `�`;
+CREATE TABLE `�`.`�` (a int) ENGINE=Memory;
+--replace_column 7 # 8 # 9 #
+SHOW TABLE STATUS FROM `�` LIKE '�';
+DROP DATABASE `�`;
+
 #
 # Bug#26402 Server crashes with old-style named table
 #

=== modified file 'mysql-test/t/type_timestamp.test'
--- a/mysql-test/t/type_timestamp.test	2010-09-13 07:30:10 +0000
+++ b/mysql-test/t/type_timestamp.test	2011-01-12 12:58:47 +0000
@@ -377,3 +377,21 @@ SELECT a FROM t1;
 DROP TABLE t1;
 
 --echo End of Bug#50888
+
+--echo #
+--echo # Bug59330: Incorrect result when comparing an aggregate
+--echo #           function with TIMESTAMP
+--echo #
+CREATE TABLE t1 (dt DATETIME, ts TIMESTAMP);
+INSERT INTO t1 VALUES('2011-01-06 12:34:30', '2011-01-06 12:34:30');
+SELECT MAX(dt), MAX(ts) FROM t1;
+SELECT MAX(ts) < '2010-01-01 00:00:00' FROM t1;
+SELECT MAX(dt) < '2010-01-01 00:00:00' FROM t1;
+SELECT MAX(ts) > '2010-01-01 00:00:00' FROM t1;
+SELECT MAX(dt) > '2010-01-01 00:00:00' FROM t1;
+SELECT MAX(ts) = '2011-01-06 12:34:30' FROM t1;
+SELECT MAX(dt) = '2011-01-06 12:34:30' FROM t1;
+DROP TABLE t1;
+
+--echo End of 5.5 tests
+

=== modified file 'mysys/my_getopt.c'
--- a/mysys/my_getopt.c	2011-01-10 14:18:20 +0000
+++ b/mysys/my_getopt.c	2011-01-14 22:18:22 +0000
@@ -611,13 +611,21 @@ static char *check_struct_option(char *c
    @param[in] argument The value argument
    @return boolean value
 */
-static my_bool get_bool_argument(const char *argument)
+static my_bool get_bool_argument(const struct my_option *opts,
+                                 const char *argument)
 {
   if (!my_strcasecmp(&my_charset_latin1, argument, "true") ||
-      !my_strcasecmp(&my_charset_latin1, argument, "on"))
+      !my_strcasecmp(&my_charset_latin1, argument, "on") ||
+      !my_strcasecmp(&my_charset_latin1, argument, "1"))
     return 1;
-  else
-    return (my_bool) atoi(argument);
+  else if (!my_strcasecmp(&my_charset_latin1, argument, "false") ||
+      !my_strcasecmp(&my_charset_latin1, argument, "off") ||
+      !my_strcasecmp(&my_charset_latin1, argument, "0"))
+    return 0;
+  my_getopt_error_reporter(WARNING_LEVEL,
+      "option '%s': boolean value '%s' wasn't recognized. Set to OFF.",
+      opts->name, argument);
+  return 0;
 }
 
 /*
@@ -647,7 +655,7 @@ static int setval(const struct my_option
 
     switch ((opts->var_type & GET_TYPE_MASK)) {
     case GET_BOOL: /* If argument differs from 0, enable option, else disable */
-      *((my_bool*) value)= get_bool_argument(argument);
+      *((my_bool*) value)= get_bool_argument(opts, argument);
       break;
     case GET_INT:
       *((int*) value)= (int) getopt_ll(argument, opts, &err);

=== modified file 'mysys/my_getsystime.c'
--- a/mysys/my_getsystime.c	2011-01-11 13:53:50 +0000
+++ b/mysys/my_getsystime.c	2011-01-12 20:36:39 +0000
@@ -25,13 +25,25 @@
 #include "mysys_priv.h"
 #include "my_static.h"
 
+/**
+  Get high-resolution time.
+
+  @remark For windows platforms we need the frequency value of
+          the CPU. This is initialized in my_init.c through
+          QueryPerformanceFrequency(). If the Windows platform
+          doesn't support QueryPerformanceFrequency(), zero is
+          returned.
+
+  @retval current high-resolution time.
+*/
+
 ulonglong my_getsystime()
 {
 #ifdef HAVE_CLOCK_GETTIME
   struct timespec tp;
   clock_gettime(CLOCK_REALTIME, &tp);
   return (ulonglong)tp.tv_sec*10000000+(ulonglong)tp.tv_nsec/100;
-#elif defined(__WIN__)
+#elif defined(_WIN32)
   LARGE_INTEGER t_cnt;
   if (query_performance_frequency)
   {
@@ -50,22 +62,17 @@ ulonglong my_getsystime()
 }
 
 
-/*
-  Return current time
+/**
+  Return current time.
 
-  SYNOPSIS
-    my_time()
-    flags	If MY_WME is set, write error if time call fails
+  @param  flags   If MY_WME is set, write error if time call fails.
 
+  @retval current time.
 */
 
-time_t my_time(myf flags __attribute__((unused)))
+time_t my_time(myf flags)
 {
   time_t t;
-#ifdef HAVE_GETHRTIME
-  (void) my_micro_time_and_time(&t);
-  return t;
-#else
   /* The following loop is here beacuse time() may fail on some systems */
   while ((t= time(0)) == (time_t) -1)
   {
@@ -73,39 +80,26 @@ time_t my_time(myf flags __attribute__((
       fprintf(stderr, "%s: Warning: time() call failed\n", my_progname);
   }
   return t;
-#endif
 }
 
 
-/*
-  Return time in micro seconds
-
-  SYNOPSIS
-    my_micro_time()
-
-  NOTES
-    This function is to be used to measure performance in micro seconds.
-    As it's not defined whats the start time for the clock, this function
-    us only useful to measure time between two moments.
+/**
+  Return time in microseconds.
 
-    For windows platforms we need the frequency value of the CUP. This is
-    initalized in my_init.c through QueryPerformanceFrequency().
+  @remark This function is to be used to measure performance in
+          micro seconds. As it's not defined whats the start time
+          for the clock, this function us only useful to measure
+          time between two moments.
 
-    If Windows platform doesn't support QueryPerformanceFrequency() we will
-    obtain the time via GetClockCount, which only supports milliseconds.
-
-  RETURN
-    Value in microseconds from some undefined point in time
+  @retval Value in microseconds from some undefined point in time.
 */
 
 ulonglong my_micro_time()
 {
-#if defined(__WIN__)
+#ifdef _WIN32
   ulonglong newtime;
   GetSystemTimeAsFileTime((FILETIME*)&newtime);
   return (newtime/10);
-#elif defined(HAVE_GETHRTIME)
-  return gethrtime()/1000;
 #else
   ulonglong newtime;
   struct timeval t;
@@ -116,69 +110,37 @@ ulonglong my_micro_time()
   {}
   newtime= (ulonglong)t.tv_sec * 1000000 + t.tv_usec;
   return newtime;
-#endif  /* defined(__WIN__) */
+#endif
 }
 
 
-/*
+/**
   Return time in seconds and timer in microseconds (not different start!)
 
-  SYNOPSIS
-    my_micro_time_and_time()
-    time_arg		Will be set to seconds since epoch (00:00:00 UTC,
-                        January 1, 1970)
-
-  NOTES
-    This function is to be useful when we need both the time and microtime.
-    For example in MySQL this is used to get the query time start of a query
-    and to measure the time of a query (for the slow query log)
-
-  IMPLEMENTATION
-    Value of time is as in time() call.
-    Value of microtime is same as my_micro_time(), which may be totally
-    unrealated to time()
+  @param  time_arg  Will be set to seconds since epoch.
 
-  RETURN
-    Value in microseconds from some undefined point in time
-*/
+  @remark This function is to be useful when we need both the time and
+          microtime. For example in MySQL this is used to get the query
+          time start of a query and to measure the time of a query (for
+          the slow query log)
+
+  @remark The time source is the same as for my_micro_time(), meaning
+          that time values returned by both functions can be intermixed
+          in meaningful ways (i.e. for comparison purposes).
 
-#define DELTA_FOR_SECONDS 500000000LL  /* Half a second */
+  @retval Value in microseconds from some undefined point in time.
+*/
 
 /* Difference between GetSystemTimeAsFileTime() and now() */
 #define OFFSET_TO_EPOCH 116444736000000000ULL
 
 ulonglong my_micro_time_and_time(time_t *time_arg)
 {
-#if defined(__WIN__)
+#ifdef _WIN32
   ulonglong newtime;
   GetSystemTimeAsFileTime((FILETIME*)&newtime);
   *time_arg= (time_t) ((newtime - OFFSET_TO_EPOCH) / 10000000);
   return (newtime/10);
-#elif defined(HAVE_GETHRTIME)
-  /*
-    Solaris has a very slow time() call. We optimize this by using the very
-    fast gethrtime() call and only calling time() every 1/2 second
-  */
-  static hrtime_t prev_gethrtime= 0;
-  static time_t cur_time= 0;
-  hrtime_t cur_gethrtime;
-
-  mysql_mutex_lock(&THR_LOCK_time);
-  cur_gethrtime= gethrtime();
-  /*
-    Due to bugs in the Solaris (x86) implementation of gethrtime(),
-    the time returned by it might not be monotonic. Don't use the
-    cached time(2) value if this is a case.
-  */
-  if ((prev_gethrtime > cur_gethrtime) ||
-      ((cur_gethrtime - prev_gethrtime) > DELTA_FOR_SECONDS))
-  {
-    cur_time= time(0);
-    prev_gethrtime= cur_gethrtime;
-  }
-  *time_arg= cur_time;
-  mysql_mutex_unlock(&THR_LOCK_time);
-  return cur_gethrtime/1000;
 #else
   ulonglong newtime;
   struct timeval t;
@@ -190,37 +152,31 @@ ulonglong my_micro_time_and_time(time_t
   *time_arg= t.tv_sec;
   newtime= (ulonglong)t.tv_sec * 1000000 + t.tv_usec;
   return newtime;
-#endif  /* defined(__WIN__) */
+#endif
 }
 
 
-/*
-  Returns current time
+/**
+  Returns current time.
 
-  SYNOPSIS
-    my_time_possible_from_micro()
-    microtime		Value from very recent my_micro_time()
-
-  NOTES
-    This function returns the current time. The microtime argument is only used
-    if my_micro_time() uses a function that can safely be converted to the
-    current time.
+  @param  microtime Value from very recent my_micro_time().
 
-  RETURN
-    current time
+  @remark This function returns the current time. The microtime argument
+          is only used if my_micro_time() uses a function that can safely
+          be converted to the current time.
+
+  @retval current time.
 */
 
 time_t my_time_possible_from_micro(ulonglong microtime __attribute__((unused)))
 {
-#if defined(__WIN__)
+#ifdef _WIN32
   time_t t;
   while ((t= time(0)) == (time_t) -1)
   {}
   return t;
-#elif defined(HAVE_GETHRTIME)
-  return my_time(0);                            /* Cached time */
 #else
   return (time_t) (microtime / 1000000);
-#endif  /* defined(__WIN__) */
+#endif
 }
 

=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c	2011-01-11 09:07:37 +0000
+++ b/mysys/my_init.c	2011-01-12 20:36:39 +0000
@@ -510,7 +510,7 @@ PSI_mutex_key key_BITMAP_mutex, key_IO_C
   key_my_thread_var_mutex, key_THR_LOCK_charset, key_THR_LOCK_heap,
   key_THR_LOCK_isam, key_THR_LOCK_lock, key_THR_LOCK_malloc,
   key_THR_LOCK_mutex, key_THR_LOCK_myisam, key_THR_LOCK_net,
-  key_THR_LOCK_open, key_THR_LOCK_threads, key_THR_LOCK_time,
+  key_THR_LOCK_open, key_THR_LOCK_threads,
   key_TMPDIR_mutex, key_THR_LOCK_myisam_mmap;
 
 static PSI_mutex_info all_mysys_mutexes[]=
@@ -540,7 +540,6 @@ static PSI_mutex_info all_mysys_mutexes[
   { &key_THR_LOCK_net, "THR_LOCK_net", PSI_FLAG_GLOBAL},
   { &key_THR_LOCK_open, "THR_LOCK_open", PSI_FLAG_GLOBAL},
   { &key_THR_LOCK_threads, "THR_LOCK_threads", PSI_FLAG_GLOBAL},
-  { &key_THR_LOCK_time, "THR_LOCK_time", PSI_FLAG_GLOBAL},
   { &key_TMPDIR_mutex, "TMPDIR_mutex", PSI_FLAG_GLOBAL},
   { &key_THR_LOCK_myisam_mmap, "THR_LOCK_myisam_mmap", PSI_FLAG_GLOBAL}
 };

=== modified file 'mysys/my_thr_init.c'
--- a/mysys/my_thr_init.c	2011-01-11 09:07:37 +0000
+++ b/mysys/my_thr_init.c	2011-01-12 20:36:39 +0000
@@ -25,7 +25,7 @@
 pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
 mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open,
               THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_myisam, THR_LOCK_heap,
-              THR_LOCK_net, THR_LOCK_charset, THR_LOCK_threads, THR_LOCK_time,
+              THR_LOCK_net, THR_LOCK_charset, THR_LOCK_threads,
               THR_LOCK_myisam_mmap;
 
 mysql_cond_t  THR_COND_threads;
@@ -219,7 +219,6 @@ my_bool my_thread_global_init(void)
   mysql_mutex_init(key_THR_LOCK_myisam_mmap, &THR_LOCK_myisam_mmap, MY_MUTEX_INIT_FAST);
   mysql_mutex_init(key_THR_LOCK_heap, &THR_LOCK_heap, MY_MUTEX_INIT_FAST);
   mysql_mutex_init(key_THR_LOCK_net, &THR_LOCK_net, MY_MUTEX_INIT_FAST);
-  mysql_mutex_init(key_THR_LOCK_time, &THR_LOCK_time, MY_MUTEX_INIT_FAST);
   mysql_cond_init(key_THR_COND_threads, &THR_COND_threads, NULL);
 
 #if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
@@ -288,7 +287,6 @@ void my_thread_global_end(void)
   mysql_mutex_destroy(&THR_LOCK_myisam_mmap);
   mysql_mutex_destroy(&THR_LOCK_heap);
   mysql_mutex_destroy(&THR_LOCK_net);
-  mysql_mutex_destroy(&THR_LOCK_time);
   mysql_mutex_destroy(&THR_LOCK_charset);
   if (all_threads_killed)
   {

=== modified file 'mysys/mysys_priv.h'
--- a/mysys/mysys_priv.h	2011-01-11 09:07:37 +0000
+++ b/mysys/mysys_priv.h	2011-01-12 20:36:39 +0000
@@ -45,7 +45,7 @@ extern PSI_mutex_key key_BITMAP_mutex, k
   key_my_thread_var_mutex, key_THR_LOCK_charset, key_THR_LOCK_heap,
   key_THR_LOCK_isam, key_THR_LOCK_lock, key_THR_LOCK_malloc,
   key_THR_LOCK_mutex, key_THR_LOCK_myisam, key_THR_LOCK_net,
-  key_THR_LOCK_open, key_THR_LOCK_threads, key_THR_LOCK_time,
+  key_THR_LOCK_open, key_THR_LOCK_threads,
   key_TMPDIR_mutex, key_THR_LOCK_myisam_mmap;
 
 extern PSI_cond_key key_COND_alarm, key_IO_CACHE_SHARE_cond,
@@ -60,7 +60,7 @@ extern PSI_thread_key key_thread_alarm;
 
 extern mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache;
 extern mysql_mutex_t THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_net;
-extern mysql_mutex_t THR_LOCK_charset, THR_LOCK_time;
+extern mysql_mutex_t THR_LOCK_charset;
 
 #include <mysql/psi/mysql_file.h>
 

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2010-12-21 11:50:03 +0000
+++ b/sql/item.cc	2011-01-12 12:58:47 +0000
@@ -7370,8 +7370,7 @@ Item_cache* Item_cache::get_cache(const
     return new Item_cache_decimal();
   case STRING_RESULT:
     /* Not all functions that return DATE/TIME are actually DATE/TIME funcs. */
-    if ((item->field_type() == MYSQL_TYPE_DATE ||
-         item->field_type() == MYSQL_TYPE_DATETIME ||
+    if ((item->is_datetime() ||
          item->field_type() == MYSQL_TYPE_TIME) &&
         (const_cast<Item*>(item))->result_as_longlong())
       return new Item_cache_datetime(item->field_type());

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2010-12-29 00:26:31 +0000
+++ b/sql/item_cmpfunc.cc	2011-01-14 09:05:14 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -2086,7 +2086,6 @@ void Item_func_interval::fix_length_and_
             if (dec != &range->dec)
             {
               range->dec= *dec;
-              range->dec.fix_buffer_pointer();
             }
           }
           else
@@ -5643,15 +5642,15 @@ longlong Item_equal::val_int()
     return 0;
   List_iterator_fast<Item_field> it(fields);
   Item *item= const_item ? const_item : it++;
+  eval_item->store_value(item);
   if ((null_value= item->null_value))
     return 0;
-  eval_item->store_value(item);
   while ((item_field= it++))
   {
     /* Skip fields of non-const tables. They haven't been read yet */
     if (item_field->field->table->const_table)
     {
-      if ((null_value= item_field->null_value) || eval_item->cmp(item_field))
+      if (eval_item->cmp(item_field) || (null_value= item_field->null_value))
         return 0;
     }
   }

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2010-12-29 00:26:31 +0000
+++ b/sql/item_func.cc	2011-01-14 14:03:37 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -1581,24 +1581,27 @@ longlong Item_func_int_div::val_int()
   if (args[0]->result_type() != INT_RESULT ||
       args[1]->result_type() != INT_RESULT)
   {
-    my_decimal value0, value1, tmp;
-    my_decimal *val0, *val1;
-    longlong res;
-    int err;
+    my_decimal tmp;
+    my_decimal *val0p= args[0]->val_decimal(&tmp);
+    if ((null_value= args[0]->null_value))
+      return 0;
+    my_decimal val0= *val0p;
 
-    val0= args[0]->val_decimal(&value0);
-    val1= args[1]->val_decimal(&value1);
-    if ((null_value= (args[0]->null_value || args[1]->null_value)))
+    my_decimal *val1p= args[1]->val_decimal(&tmp);
+    if ((null_value= args[1]->null_value))
       return 0;
+    my_decimal val1= *val1p;
 
+    int err;
     if ((err= my_decimal_div(E_DEC_FATAL_ERROR & ~E_DEC_DIV_ZERO, &tmp,
-                             val0, val1, 0)) > 3)
+                             &val0, &val1, 0)) > 3)
     {
       if (err == E_DEC_DIV_ZERO)
         signal_divide_by_null();
       return 0;
     }
 
+    longlong res;
     if (my_decimal2int(E_DEC_FATAL_ERROR, &tmp, unsigned_flag, &res) &
         E_DEC_OVERFLOW)
       raise_integer_overflow();

=== modified file 'sql/item_geofunc.h'
--- a/sql/item_geofunc.h	2010-09-09 12:43:45 +0000
+++ b/sql/item_geofunc.h	2011-01-12 13:11:31 +0000
@@ -181,6 +181,7 @@ public:
   String *val_str(String *);
   void fix_length_and_dec()
   {
+    Item_geometry_func::fix_length_and_dec();
     for (unsigned int i= 0; i < arg_count; ++i)
     {
       if (args[i]->fixed && args[i]->field_type() != MYSQL_TYPE_GEOMETRY)

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2010-12-17 11:11:34 +0000
+++ b/sql/item_strfunc.cc	2011-01-13 08:07:21 +0000
@@ -56,6 +56,9 @@ C_MODE_START
 #include "../mysys/my_static.h"			// For soundex_map
 C_MODE_END
 
+/**
+   @todo Remove this. It is not safe to use a shared String object.
+ */
 String my_empty_string("",default_charset_info);
 
 /*
@@ -642,7 +645,7 @@ String *Item_func_des_encrypt::val_str(S
   if ((null_value= args[0]->null_value))
     return 0;                                   // ENCRYPT(NULL) == NULL
   if ((res_length=res->length()) == 0)
-    return &my_empty_string;
+    return make_empty_result();
   if (arg_count == 1)
   {
     /* Protect against someone doing FLUSH DES_KEY_FILE */
@@ -832,7 +835,7 @@ String *Item_func_concat_ws::val_str(Str
     }
 
   if (i ==  arg_count)
-    return &my_empty_string;
+    return make_empty_result();
 
   for (i++; i < arg_count ; i++)
   {
@@ -978,7 +981,7 @@ String *Item_func_reverse::val_str(Strin
     return 0;
   /* An empty string is a special case as the string pointer may be null */
   if (!res->length())
-    return &my_empty_string;
+    return make_empty_result();
   if (tmp_value.alloced_length() < res->length() &&
       tmp_value.realloc(res->length()))
   {
@@ -1311,8 +1314,7 @@ String *Item_func_left::val_str(String *
 
   /* if "unsigned_flag" is set, we have a *huge* positive number. */
   if ((length <= 0) && (!args[1]->unsigned_flag))
-    return &my_empty_string;
-
+    return make_empty_result();
   if ((res->length() <= (ulonglong) length) ||
       (res->length() <= (char_pos= res->charpos((int) length))))
     return res;
@@ -1357,7 +1359,7 @@ String *Item_func_right::val_str(String
 
   /* if "unsigned_flag" is set, we have a *huge* positive number. */
   if ((length <= 0) && (!args[1]->unsigned_flag))
-    return &my_empty_string; /* purecov: inspected */
+    return make_empty_result(); /* purecov: inspected */
 
   if (res->length() <= (ulonglong) length)
     return res; /* purecov: inspected */
@@ -1397,7 +1399,7 @@ String *Item_func_substr::val_str(String
   /* Negative or zero length, will return empty string. */
   if ((arg_count == 3) && (length <= 0) && 
       (length == 0 || !args[2]->unsigned_flag))
-    return &my_empty_string;
+    return make_empty_result();
 
   /* Assumes that the maximum length of a String is < INT_MAX32. */
   /* Set here so that rest of code sees out-of-bound value as such. */
@@ -1408,12 +1410,12 @@ String *Item_func_substr::val_str(String
   /* Assumes that the maximum length of a String is < INT_MAX32. */
   if ((!args[1]->unsigned_flag && (start < INT_MIN32 || start > INT_MAX32)) ||
       (args[1]->unsigned_flag && ((ulonglong) start > INT_MAX32)))
-    return &my_empty_string;
+    return make_empty_result();
 
   start= ((start < 0) ? res->numchars() + start : start - 1);
   start= res->charpos((int) start);
   if ((start < 0) || ((uint) start + 1 > res->length()))
-    return &my_empty_string;
+    return make_empty_result();
 
   length= res->charpos((int) length, (uint32) start);
   tmp_length= res->length() - start;
@@ -1476,7 +1478,7 @@ String *Item_func_substr_index::val_str(
   null_value=0;
   uint delimiter_length= delimiter->length();
   if (!res->length() || !delimiter_length || !count)
-    return &my_empty_string;		// Wrong parameters
+    return make_empty_result();		// Wrong parameters
 
   res->set_charset(collation.collation);
 
@@ -1826,7 +1828,7 @@ String *Item_func_password::val_str_asci
   if ((null_value=args[0]->null_value))
     return 0;
   if (res->length() == 0)
-    return &my_empty_string;
+    return make_empty_result();
   my_make_scrambled_password(tmp_value, res->ptr(), res->length());
   str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, &my_charset_latin1);
   return str;
@@ -1850,7 +1852,7 @@ String *Item_func_old_password::val_str_
   if ((null_value=args[0]->null_value))
     return 0;
   if (res->length() == 0)
-    return &my_empty_string;
+    return make_empty_result();
   my_make_scrambled_password_323(tmp_value, res->ptr(), res->length());
   str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, &my_charset_latin1);
   return str;
@@ -1878,8 +1880,7 @@ String *Item_func_encrypt::val_str(Strin
   if ((null_value=args[0]->null_value))
     return 0;
   if (res->length() == 0)
-    return &my_empty_string;
-
+    return make_empty_result();
   if (arg_count == 1)
   {					// generate random salt
     time_t timestamp=current_thd->query_start();
@@ -2141,7 +2142,7 @@ String *Item_func_soundex::val_str(Strin
   for ( ; ; ) /* Skip pre-space */
   {
     if ((rc= cs->cset->mb_wc(cs, &wc, (uchar*) from, (uchar*) end)) <= 0)
-      return &my_empty_string; /* EOL or invalid byte sequence */
+      return make_empty_result(); /* EOL or invalid byte sequence */
     
     if (rc == 1 && cs->ctype)
     {
@@ -2166,7 +2167,7 @@ String *Item_func_soundex::val_str(Strin
         {
           /* Extra safety - should not really happen */
           DBUG_ASSERT(false);
-          return &my_empty_string;
+          return make_empty_result();
         }
         to+= rc;
         break;
@@ -2507,7 +2508,7 @@ String *Item_func_make_set::val_str(Stri
 	  else
 	  {
 	    if (tmp_str.copy(*res))		// Don't use 'str'
-	      return &my_empty_string;
+              return make_empty_result();
 	    result= &tmp_str;
 	  }
 	}
@@ -2517,11 +2518,11 @@ String *Item_func_make_set::val_str(Stri
 	  {					// Copy data to tmp_str
 	    if (tmp_str.alloc(result->length()+res->length()+1) ||
 		tmp_str.copy(*result))
-	      return &my_empty_string;
+              return make_empty_result();
 	    result= &tmp_str;
 	  }
 	  if (tmp_str.append(STRING_WITH_LEN(","), &my_charset_bin) || tmp_str.append(*res))
-	    return &my_empty_string;
+            return make_empty_result();
 	}
       }
     }
@@ -2666,7 +2667,7 @@ String *Item_func_repeat::val_str(String
   null_value= 0;
 
   if (count <= 0 && (count == 0 || !args[1]->unsigned_flag))
-    return &my_empty_string;
+    return make_empty_result();
 
   /* Assumes that the maximum length of a String is < INT_MAX32. */
   /* Bounds check on count:  If this is triggered, we will error. */
@@ -2948,7 +2949,7 @@ String *Item_func_conv::val_str(String *
 
   ptr= longlong2str(dec, ans, to_base);
   if (str->copy(ans, (uint32) (ptr-ans), default_charset()))
-    return &my_empty_string;
+    return make_empty_result();
   return str;
 }
 
@@ -3115,7 +3116,7 @@ String *Item_func_hex::val_str_ascii(Str
       return 0;
     ptr= longlong2str(dec,ans,16);
     if (str->copy(ans,(uint32) (ptr-ans), &my_charset_numeric))
-      return &my_empty_string;			// End of memory
+      return make_empty_result();		// End of memory
     return str;
   }
 

=== modified file 'sql/item_strfunc.h'
--- a/sql/item_strfunc.h	2010-11-26 10:44:39 +0000
+++ b/sql/item_strfunc.h	2011-01-13 08:07:21 +0000
@@ -27,6 +27,16 @@ class MY_LOCALE;
 
 class Item_str_func :public Item_func
 {
+protected:
+  /**
+     Sets the result value of the function an empty string, using the current
+     character set. No memory is allocated.
+     @retval A pointer to the str_value member.
+   */
+  String *make_empty_result() {
+    str_value.set("", 0, collation.collation);
+    return &str_value; 
+  }
 public:
   Item_str_func() :Item_func() { decimals=NOT_FIXED_DEC; }
   Item_str_func(Item *a) :Item_func(a) {decimals=NOT_FIXED_DEC; }

=== modified file 'sql/my_decimal.h'
--- a/sql/my_decimal.h	2010-10-19 22:51:34 +0000
+++ b/sql/my_decimal.h	2011-01-14 09:05:14 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2006 MySQL AB
+/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -102,6 +102,24 @@ class my_decimal :public decimal_t
 
 public:
 
+  my_decimal(const my_decimal &rhs) : decimal_t(rhs)
+  {
+    for (uint i= 0; i < DECIMAL_BUFF_LENGTH; i++)
+      buffer[i]= rhs.buffer[i];
+    fix_buffer_pointer();
+  }
+
+  my_decimal& operator=(const my_decimal &rhs)
+  {
+    if (this == &rhs)
+      return *this;
+    decimal_t::operator=(rhs);
+    for (uint i= 0; i < DECIMAL_BUFF_LENGTH; i++)
+      buffer[i]= rhs.buffer[i];
+    fix_buffer_pointer();
+    return *this;
+  }
+
   void init()
   {
     len= DECIMAL_BUFF_LENGTH;
@@ -248,7 +266,6 @@ inline
 void my_decimal2decimal(const my_decimal *from, my_decimal *to)
 {
   *to= *from;
-  to->fix_buffer_pointer();
 }
 
 

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-12-29 00:26:31 +0000
+++ b/sql/mysqld.cc	2011-01-14 13:21:46 +0000
@@ -283,6 +283,7 @@ const char *first_keyword= "first", *bin
 const char *my_localhost= "localhost", *delayed_user= "DELAYED";
 
 bool opt_large_files= sizeof(my_off_t) > 4;
+static my_bool opt_autocommit; ///< for --autocommit command-line option
 
 /*
   Used with --help for detailed option
@@ -5655,8 +5656,9 @@ struct my_option my_long_options[]=
     Because Sys_var_bit does not support command-line options, we need to
     explicitely add one for --autocommit
   */
-  {"autocommit", OPT_AUTOCOMMIT, "Set default value for autocommit (0 or 1)",
-   NULL, NULL, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, NULL},
+  {"autocommit", 0, "Set default value for autocommit (0 or 1)",
+   &opt_autocommit, &opt_autocommit, 0,
+   GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, NULL},
   {"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.",
    &my_bind_addr_str, &my_bind_addr_str, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -7111,13 +7113,6 @@ mysqld_get_one_option(int optid,
     if (argument == NULL) /* no argument */
       log_error_file_ptr= const_cast<char*>("");
     break;
-  case OPT_AUTOCOMMIT:
-    const ulonglong turn_bit_on= (argument && (atoi(argument) == 0)) ?
-      OPTION_NOT_AUTOCOMMIT : OPTION_AUTOCOMMIT;
-    global_system_variables.option_bits=
-      (global_system_variables.option_bits &
-       ~(OPTION_NOT_AUTOCOMMIT | OPTION_AUTOCOMMIT)) | turn_bit_on;
-    break;
   }
   return 0;
 }
@@ -7268,10 +7263,12 @@ static int get_options(int *argc_ptr, ch
   else
     global_system_variables.option_bits&= ~OPTION_BIG_SELECTS;
 
-  if (global_system_variables.option_bits & OPTION_AUTOCOMMIT)
-    global_system_variables.option_bits&= ~OPTION_NOT_AUTOCOMMIT;
-  else
-    global_system_variables.option_bits|= OPTION_NOT_AUTOCOMMIT;
+  // Synchronize @@global.autocommit on --autocommit
+  const ulonglong turn_bit_on= opt_autocommit ?
+    OPTION_AUTOCOMMIT : OPTION_NOT_AUTOCOMMIT;
+  global_system_variables.option_bits=
+    (global_system_variables.option_bits &
+     ~(OPTION_NOT_AUTOCOMMIT | OPTION_AUTOCOMMIT)) | turn_bit_on;
 
   global_system_variables.sql_mode=
     expand_sql_mode(global_system_variables.sql_mode);

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	2010-12-17 11:11:34 +0000
+++ b/sql/mysqld.h	2011-01-14 13:21:46 +0000
@@ -394,8 +394,7 @@ enum options_mysqld
   OPT_UPDATE_LOG,
   OPT_WANT_CORE,
   OPT_ENGINE_CONDITION_PUSHDOWN,
-  OPT_LOG_ERROR,
-  OPT_AUTOCOMMIT
+  OPT_LOG_ERROR
 };
 
 

=== modified file 'sql/sql_analyse.cc'
--- a/sql/sql_analyse.cc	2010-07-09 12:28:51 +0000
+++ b/sql/sql_analyse.cc	2011-01-14 09:05:14 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2006 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -521,9 +521,6 @@ void field_decimal::add()
   {
     found = 1;
     min_arg = max_arg = sum[0] = *dec;
-    min_arg.fix_buffer_pointer();
-    max_arg.fix_buffer_pointer();
-    sum[0].fix_buffer_pointer();
     my_decimal_mul(E_DEC_FATAL_ERROR, sum_sqr, dec, dec);
     cur_sum= 0;
     min_length = max_length = length;
@@ -545,12 +542,10 @@ void field_decimal::add()
     if (my_decimal_cmp(dec, &min_arg) < 0)
     {
       min_arg= *dec;
-      min_arg.fix_buffer_pointer();
     }
     if (my_decimal_cmp(dec, &max_arg) > 0)
     {
       max_arg= *dec;
-      max_arg.fix_buffer_pointer();
     }
   }
 }

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-01-12 09:31:41 +0000
+++ b/sql/sql_select.cc	2011-01-13 10:42:48 +0000
@@ -6480,7 +6480,7 @@ make_join_select(JOIN *join,SQL_SELECT *
               OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN)
           {
             COND *push_cond= 
-              make_cond_for_table(tmp, current_map, current_map);
+              make_cond_for_table(tmp, tab->table->map, tab->table->map);
             if (push_cond)
             {
               /* Push condition to handler */
@@ -12040,7 +12040,7 @@ join_read_const_table(JOIN_TAB *tab, POS
       /* Mark for EXPLAIN that the row was not found */
       pos->records_read=0.0;
       pos->ref_depend_map= 0;
-      if (!table->maybe_null || error > 0)
+      if (!table->pos_in_table_list->outer_join || error > 0)
 	DBUG_RETURN(error);
     }
   }
@@ -12061,7 +12061,7 @@ join_read_const_table(JOIN_TAB *tab, POS
       /* Mark for EXPLAIN that the row was not found */
       pos->records_read=0.0;
       pos->ref_depend_map= 0;
-      if (!table->maybe_null || error > 0)
+      if (!table->pos_in_table_list->outer_join || error > 0)
 	DBUG_RETURN(error);
     }
   }
@@ -13099,7 +13099,7 @@ make_cond_for_table(COND *cond, table_ma
 	new_cond->argument_list()->push_back(fix);
       }
       /*
-	Item_cond_and do not need fix_fields for execution, its parameters
+	Item_cond_or do not need fix_fields for execution, its parameters
 	are fixed or do not need fix_fields, too
       */
       new_cond->quick_fix_field();

=== modified file 'sql/sql_string.cc'
--- a/sql/sql_string.cc	2010-08-25 15:57:53 +0000
+++ b/sql/sql_string.cc	2011-01-13 08:07:21 +0000
@@ -51,11 +51,33 @@ bool String::real_alloc(uint32 length)
 }
 
 
-/*
-** Check that string is big enough. Set string[alloc_length] to 0
-** (for C functions)
-*/
+/**
+   Allocates a new buffer on the heap for this String.
+
+   - If the String's internal buffer is privately owned and heap allocated,
+     one of the following is performed.
+
+     - If the requested length is greater than what fits in the buffer, a new
+       buffer is allocated, data moved and the old buffer freed.
+
+     - If the requested length is less or equal to what fits in the buffer, a
+       null character is inserted at the appropriate position.
+
+   - If the String does not keep a private buffer on the heap, such a buffer
+     will be allocated and the string copied accoring to its length, as found
+     in String::length().
+ 
+   For C compatibility, the new string buffer is null terminated.
 
+   @param alloc_length The requested string size in characters, excluding any
+   null terminator.
+
+   @retval false Either the copy operation is complete or, if the size of the
+   new buffer is smaller than the currently allocated buffer (if one exists),
+   no allocation occured.
+
+   @retval true An error occured when attempting to allocate memory.
+*/
 bool String::realloc(uint32 alloc_length)
 {
   uint32 len=ALIGN_SIZE(alloc_length+1);
@@ -128,6 +150,17 @@ bool String::copy()
   return FALSE;
 }
 
+/**
+   Copies the internal buffer from str. If this String has a private heap
+   allocated buffer where new data does not fit, a new buffer is allocated
+   before copying and the old buffer freed. Character set information is also
+   copied.
+   
+   @param str The string whose internal buffer is to be copied.
+   
+   @retval false Success.
+   @retval true Memory allocation failed.
+*/
 bool String::copy(const String &str)
 {
   if (alloc(str.str_length))

=== modified file 'sql/sql_string.h'
--- a/sql/sql_string.h	2010-10-19 22:51:34 +0000
+++ b/sql/sql_string.h	2011-01-13 08:07:21 +0000
@@ -148,6 +148,16 @@ public:
       Alloced_length=0;
     str_charset=str.str_charset;
   }
+
+
+  /**
+     Points the internal buffer to the supplied one. The old buffer is freed.
+     @param str Pointer to the new buffer.
+     @param arg_length Length of the new buffer in characters, excluding any 
+            null character.
+     @param cs Character set to use for interpreting string data.
+     @note The new buffer will not be null terminated.
+  */
   inline void set(char *str,uint32 arg_length, CHARSET_INFO *cs)
   {
     free();

=== modified file 'strings/decimal.c'
--- a/strings/decimal.c	2010-07-20 19:30:10 +0000
+++ b/strings/decimal.c	2011-01-14 09:05:14 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -13,8 +13,6 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
-#line 18 "decimal.c"
-
 /*
 =======================================================================
   NOTE: this library implements SQL standard "exact numeric" type

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-mtr branch (bjorn.munch:3144 to 3146) Bjorn Munch17 Jan