diff --git a/client/mysql.cc b/client/mysql.cc
index 45fabe9cf8c..58ef51f3fff 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1370,102 +1370,117 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"auto-rehash", OPT_AUTO_REHASH,
-   "Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
-   (uchar**) &opt_rehash, (uchar**) &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
+   "Enable automatic rehashing. One doesn't need to use 'rehash' to get table "
+   "and field completion, but startup and reconnecting may take a longer time. "
+   "Disable with --disable-auto-rehash.",
+   &opt_rehash, &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
    0, 0},
   {"no-auto-rehash", 'A',
-   "No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect.",
+   "No automatic rehashing. One has to use 'rehash' to get table and field "
+   "completion. This gives a quicker start of mysql and disables rehashing "
+   "on reconnect.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
    {"auto-vertical-output", OPT_AUTO_VERTICAL_OUTPUT,
-    "Automatically switch to vertical output mode if the result is wider than the terminal width.",
-    (uchar**) &auto_vertical_output, (uchar**) &auto_vertical_output, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+    "Automatically switch to vertical output mode if the result is wider "
+    "than the terminal width.",
+    &auto_vertical_output, &auto_vertical_output, 0, GET_BOOL, NO_ARG, 0,
+    0, 0, 0, 0, 0},
   {"batch", 'B',
-   "Don't use history file. Disable interactive behavior. (Enables --silent.)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+   "Don't use history file. Disable interactive behavior. (Enables --silent.)",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"character-sets-dir", OPT_CHARSETS_DIR,
-   "Directory for character set files.", (uchar**) &charsets_dir,
-   (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Directory for character set files.", &charsets_dir,
+   &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"column-type-info", OPT_COLUMN_TYPES, "Display column type information.",
-   (uchar**) &column_types_flag, (uchar**) &column_types_flag,
+   &column_types_flag, &column_types_flag,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"comments", 'c', "Preserve comments. Send comments to the server."
    " The default is --skip-comments (discard comments), enable with --comments.",
-   (uchar**) &preserve_comments, (uchar**) &preserve_comments,
+   &preserve_comments, &preserve_comments,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"compress", 'C', "Use compression in server/client protocol.",
-   (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
-
 #ifdef DBUG_OFF
   {"debug", '#', "This is a non-debug version. Catch this and exit.",
    0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #else
-  {"debug", '#', "Output debug log.", (uchar**) &default_dbug_option,
-   (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug", '#', "Output debug log.", &default_dbug_option,
+   &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
-   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   &debug_check_flag, &debug_check_flag, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,
-   (uchar**) &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"database", 'D', "Database to use.", (uchar**) &current_db,
-   (uchar**) &current_db, 0, GET_STR_ALLOC, REQUIRED_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},
+  {"database", 'D', "Database to use.", &current_db,
+   &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
-   "Set the default character set.", (uchar**) &default_charset,
-   (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"delimiter", OPT_DELIMITER, "Delimiter to be used.", (uchar**) &delimiter_str,
-   (uchar**) &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Set the default character set.", &default_charset,
+   &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"delimiter", OPT_DELIMITER, "Delimiter to be used.", &delimiter_str,
+   &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"execute", 'e', "Execute command and quit. (Disables --force and history file.)", 0,
    0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"vertical", 'E', "Print the output of a query (rows) vertically.",
-   (uchar**) &vertical, (uchar**) &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+   &vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
    0},
   {"force", 'f', "Continue even if we get an SQL error.",
-   (uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
+   &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
    0, 0, 0, 0},
   {"named-commands", 'G',
-   "Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
-   (uchar**) &named_cmds, (uchar**) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   "Enable named commands. Named commands mean this program's internal "
+   "commands; see mysql> help . When enabled, the named commands can be "
+   "used from any line of the query, otherwise only from the first line, "
+   "before an enter. Disable with --disable-named-commands. This option "
+   "is disabled by default.",
+   &named_cmds, &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"ignore-spaces", 'i', "Ignore space after function names.",
-   (uchar**) &ignore_spaces, (uchar**) &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
+   &ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
    0, 0, 0, 0},
   {"init-command", OPT_INIT_COMMAND,
-   "SQL Command to execute when connecting to MySQL server. Will automatically be re-executed when reconnecting.",
-   (uchar**) &opt_init_command, (uchar**) &opt_init_command, 0,
+   "SQL Command to execute when connecting to MySQL server. Will "
+   "automatically be re-executed when reconnecting.",
+   &opt_init_command, &opt_init_command, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
-   (uchar**) &opt_local_infile,
-   (uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"no-beep", 'b', "Turn off beep on error.", (uchar**) &opt_nobeep,
-   (uchar**) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 
-  {"host", 'h', "Connect to host.", (uchar**) &current_host,
-   (uchar**) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"html", 'H', "Produce HTML output.", (uchar**) &opt_html, (uchar**) &opt_html,
+   &opt_local_infile, &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"no-beep", 'b', "Turn off beep on error.", &opt_nobeep,
+   &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"host", 'h', "Connect to host.", &current_host,
+   &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"html", 'H', "Produce HTML output.", &opt_html, &opt_html,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"xml", 'X', "Produce XML output.", (uchar**) &opt_xml, (uchar**) &opt_xml, 0,
+  {"xml", 'X', "Produce XML output.", &opt_xml, &opt_xml, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.",
-   (uchar**) &line_numbers, (uchar**) &line_numbers, 0, GET_BOOL,
-   NO_ARG, 1, 0, 0, 0, 0, 0},  
+   &line_numbers, &line_numbers, 0, GET_BOOL,
+   NO_ARG, 1, 0, 0, 0, 0, 0},
   {"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"unbuffered", 'n', "Flush buffer after each query.", (uchar**) &unbuffered,
-   (uchar**) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"unbuffered", 'n', "Flush buffer after each query.", &unbuffered,
+   &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
-   (uchar**) &column_names, (uchar**) &column_names, 0, GET_BOOL,
+   &column_names, &column_names, 0, GET_BOOL,
    NO_ARG, 1, 0, 0, 0, 0, 0},
   {"skip-column-names", 'N',
    "Don't write column names in results.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"sigint-ignore", OPT_SIGINT_IGNORE, "Ignore SIGINT (CTRL-C).",
-   (uchar**) &opt_sigint_ignore,  (uchar**) &opt_sigint_ignore, 0, GET_BOOL,
+   &opt_sigint_ignore,  &opt_sigint_ignore, 0, GET_BOOL,
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"one-database", 'o',
-   "Only update the default database. This is useful for skipping updates to other database in the update log.",
+   "Only update the default database. This is useful for skipping updates "
+   "to other database in the update log.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef USE_POPEN
   {"pager", OPT_PAGER,
-   "Pager to use to display results. If you don't supply an option, the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode. Disable with --disable-pager. This option is disabled by default.",
+   "Pager to use to display results. If you don't supply an option, the "
+   "default pager is taken from your ENV variable PAGER. Valid pagers are "
+   "less, more, cat [> filename], etc. See interactive help (\\h) also. "
+   "This option does not work in batch mode. Disable with --disable-pager. "
+   "This option is disabled by default.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"password", 'p',
@@ -1481,46 +1496,50 @@ static struct my_option my_long_options[] =
    "/etc/services, "
 #endif
    "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
-   (uchar**) &opt_mysql_port,
-   (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,  0},
+   &opt_mysql_port,
+   &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,  0},
   {"prompt", OPT_PROMPT, "Set the mysql prompt to this value.",
-   (uchar**) &current_prompt, (uchar**) &current_prompt, 0, GET_STR_ALLOC,
+   &current_prompt, &current_prompt, 0, GET_STR_ALLOC,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).",
    0, 0, 0, GET_STR,  REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"quick", 'q',
-   "Don't cache result, print it row by row. This may slow down the server if the output is suspended. Doesn't use history file.",
-   (uchar**) &quick, (uchar**) &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   "Don't cache result, print it row by row. This may slow down the server "
+   "if the output is suspended. Doesn't use history file.",
+   &quick, &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"raw", 'r', "Write fields without conversion. Used with --batch.",
-   (uchar**) &opt_raw_data, (uchar**) &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_raw_data, &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
-  {"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable with --disable-reconnect. This option is enabled by default.", 
-   (uchar**) &opt_reconnect, (uchar**) &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
-  {"silent", 's', "Be more silent. Print results with a tab as separator, each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
-   0, 0},
+  {"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable "
+   "with --disable-reconnect. This option is enabled by default.",
+   &opt_reconnect, &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+  {"silent", 's', "Be more silent. Print results with a tab as separator, "
+   "each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef HAVE_SMEM
   {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
-   "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name, 
-   0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Base name of shared memory.", &shared_memory_base_name,
+   &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"socket", 'S', "The socket file to use for connection.",
-   (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR_ALLOC,
+   &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR_ALLOC,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #include "sslopt-longopts.h"
-  {"table", 't', "Output in table format.", (uchar**) &output_tables,
-   (uchar**) &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"table", 't', "Output in table format.", &output_tables,
+   &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"tee", OPT_TEE,
-   "Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default.",
+   "Append everything into outfile. See interactive help (\\h) also. "
+   "Does not work in batch mode. Disable with --disable-tee. "
+   "This option is disabled by default.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #ifndef DONT_ALLOW_USER_CHANGE
-  {"user", 'u', "User for login if not current user.", (uchar**) &current_user,
-   (uchar**) &current_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"user", 'u', "User for login if not current user.", &current_user,
+   &current_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.",
-   (uchar**) &safe_updates, (uchar**) &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
+   &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
    0, 0, 0, 0},
   {"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.",
-   (uchar**) &safe_updates, (uchar**) &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
+   &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
    0, 0, 0, 0},
   {"verbose", 'v', "Write more. (-v -v -v gives the table output format).", 0,
    0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -1530,35 +1549,32 @@ static struct my_option my_long_options[] =
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"connect_timeout", OPT_CONNECT_TIMEOUT,
    "Number of seconds before connection timeout.",
-   (uchar**) &opt_connect_timeout,
-   (uchar**) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
-   0, 0},
+   &opt_connect_timeout, &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG,
+   0, 0, 3600*12, 0, 0, 0},
   {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
    "The maximum packet length to send to or receive from server.",
-   (uchar**) &opt_max_allowed_packet, (uchar**) &opt_max_allowed_packet, 0,
+   &opt_max_allowed_packet, &opt_max_allowed_packet, 0,
    GET_ULONG, REQUIRED_ARG, 16 *1024L*1024L, 4096,
    (longlong) 2*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
   {"net_buffer_length", OPT_NET_BUFFER_LENGTH,
    "The buffer size for TCP/IP and socket communication.",
-   (uchar**) &opt_net_buffer_length, (uchar**) &opt_net_buffer_length, 0, GET_ULONG,
+   &opt_net_buffer_length, &opt_net_buffer_length, 0, GET_ULONG,
    REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
   {"select_limit", OPT_SELECT_LIMIT,
    "Automatic limit for SELECT when using --safe-updates.",
-   (uchar**) &select_limit,
-   (uchar**) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ULONG_MAX,
-   0, 1, 0},
+   &select_limit, &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L,
+   1, ULONG_MAX, 0, 1, 0},
   {"max_join_size", OPT_MAX_JOIN_SIZE,
    "Automatic limit for rows in a join when using --safe-updates.",
-   (uchar**) &max_join_size,
-   (uchar**) &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, 1, ULONG_MAX,
-   0, 1, 0},
+   &max_join_size, &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L,
+   1, ULONG_MAX, 0, 1, 0},
   {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it"
-    " uses old (pre-4.1.1) protocol.", (uchar**) &opt_secure_auth,
-    (uchar**) &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+    " uses old (pre-4.1.1) protocol.", &opt_secure_auth,
+    &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"server-arg", OPT_SERVER_ARG, "Send embedded server this as a parameter.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.",
-    (uchar**) &show_warnings, (uchar**) &show_warnings, 0, GET_BOOL, NO_ARG, 
+    &show_warnings, &show_warnings, 0, GET_BOOL, NO_ARG,
     0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 536bd6c8a49..0ad44f3d20d 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -69,7 +69,7 @@ static struct my_option my_long_options[]=
    "Directory for character set files.", 0,
    0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
-   (uchar**)&not_used, (uchar**)&not_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   &not_used, &not_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"datadir", 'd',
    "Not used by mysql_upgrade. Only for backward compatibility.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -77,26 +77,26 @@ static struct my_option my_long_options[]=
   {"debug", '#', "This is a non-debug version. Catch this and exit.",
    0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #else
-  {"debug", '#', "Output debug log.", (uchar* *) & default_dbug_option,
-   (uchar* *) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug", '#', "Output debug log.", &default_dbug_option,
+   &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
-   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   &debug_check_flag, &debug_check_flag, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,
-   (uchar**) &debug_info_flag, 0, 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-character-set", OPT_DEFAULT_CHARSET,
    "Set the default character set.", 0,
    0, 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.",
-   (uchar**)&opt_force, (uchar**)&opt_force, 0,
+   &opt_force, &opt_force, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"host",'h', "Connect to host.", 0,
    0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"password", 'p',
    "Password to use when connecting to server. If password is not given,"
-   " it's solicited on the tty.", (uchar**) &opt_password,(uchar**) &opt_password,
+   " it's solicited on the tty.", &opt_password,&opt_password,
    0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef __WIN__
   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0,
@@ -124,17 +124,17 @@ static struct my_option my_long_options[]=
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"upgrade-system-tables", 's', "Only upgrade the system tables "
    "do not try to upgrade the data.",
-   (uchar**)&opt_systables_only, (uchar**)&opt_systables_only, 0,
+   &opt_systables_only, &opt_systables_only, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"user", 'u', "User for login if not current user.", (uchar**) &opt_user,
-   (uchar**) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"user", 'u', "User for login if not current user.", &opt_user,
+   &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"verbose", 'v', "Display more output about the process.",
-   (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0,
+   &opt_verbose, &opt_verbose, 0,
    GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
   {"write-binlog", OPT_WRITE_BINLOG,
    "All commands including mysqlcheck are binlogged. Enabled by default;"
    "use --skip-write-binlog when commands should not be sent to replication slaves.",
-   (uchar**) &opt_write_binlog, (uchar**) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
+   &opt_write_binlog, &opt_write_binlog, 0, GET_BOOL, NO_ARG,
    1, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index b021c0f155e..64371224e2b 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -122,37 +122,38 @@ static struct my_option my_long_options[] =
 #endif
   {"count", 'c',
    "Number of iterations to make. This works with -i (--sleep) only.",
-   (uchar**) &nr_iterations, (uchar**) &nr_iterations, 0, GET_UINT,
+   &nr_iterations, &nr_iterations, 0, GET_UINT,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #ifndef DBUG_OFF
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
-   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   &debug_check_flag, &debug_check_flag, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
-   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   &debug_info_flag, &debug_info_flag,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"force", 'f',
-   "Don't ask for confirmation on drop database; with multiple commands, continue even if an error occurs.",
-   (uchar**) &option_force, (uchar**) &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
+   "Don't ask for confirmation on drop database; with multiple commands, "
+   "continue even if an error occurs.",
+   &option_force, &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
    0, 0, 0, 0},
   {"compress", 'C', "Use compression in server/client protocol.",
-   (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
   {"character-sets-dir", OPT_CHARSETS_DIR,
-   "Directory for character set files.", (uchar**) &charsets_dir,
-   (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Directory for character set files.", &charsets_dir,
+   &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
-   "Set the default character set.", (uchar**) &default_charset,
-   (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Set the default character set.", &default_charset,
+   &default_charset, 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.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
+  {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"no-beep", 'b', "Turn off beep on error.", (uchar**) &opt_nobeep,
-   (uchar**) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 
+  {"no-beep", 'b', "Turn off beep on error.", &opt_nobeep,
+   &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 
   {"password", 'p',
    "Password to use when connecting to server. If password is not given it's asked from the tty.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -166,47 +167,47 @@ static struct my_option my_long_options[] =
    "/etc/services, "
 #endif
    "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
-   (uchar**) &tcp_port,
-   (uchar**) &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   &tcp_port, &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).",
     0, 0, 0, GET_STR,  REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"relative", 'r',
-   "Show difference between current and previous values when used with -i. Currently only works with extended-status.",
-   (uchar**) &opt_relative, (uchar**) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   "Show difference between current and previous values when used with -i. "
+   "Currently only works with extended-status.",
+   &opt_relative, &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
   0, 0, 0},
 #ifdef HAVE_SMEM
   {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
-   "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
+   "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name,
    0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"silent", 's', "Silently exit if one can't connect to server.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"socket", 'S', "The socket file to use for connection.",
-   (uchar**) &unix_port, (uchar**) &unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+   &unix_port, &unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
    0, 0, 0},
   {"sleep", 'i', "Execute commands repeatedly with a sleep between.",
-   (uchar**) &interval, (uchar**) &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0,
+   &interval, &interval, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0,
    0, 0},
 #include <sslopt-longopts.h>
 #ifndef DONT_ALLOW_USER_CHANGE
-  {"user", 'u', "User for login if not current user.", (uchar**) &user,
-   (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"user", 'u', "User for login if not current user.", &user,
+   &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"verbose", 'v', "Write more information.", (uchar**) &opt_verbose,
-   (uchar**) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"verbose", 'v', "Write more information.", &opt_verbose,
+   &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"vertical", 'E',
    "Print output vertically. Is similar to --relative, but prints output vertically.",
-   (uchar**) &opt_vertical, (uchar**) &opt_vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_vertical, &opt_vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
   {"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_UINT,
    OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (uchar**) &opt_connect_timeout,
-   (uchar**) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0,
+  {"connect_timeout", OPT_CONNECT_TIMEOUT, "", &opt_connect_timeout,
+   &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0,
    3600*12, 0, 1, 0},
-  {"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", (uchar**) &opt_shutdown_timeout,
-   (uchar**) &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
+  {"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", &opt_shutdown_timeout,
+   &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
    SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index ecba818a156..9d85e24d03f 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1016,9 +1016,8 @@ static struct my_option my_long_options[] =
    "events); 'always' prints base64 whenever possible. 'always' is for "
    "debugging only and should not be used in a production system. If this "
    "argument is not given, the default is 'auto'; if it is given with no "
-   "argument, 'always' is used."
-   ,(uchar**) &opt_base64_output_mode_str,
-   (uchar**) &opt_base64_output_mode_str,
+   "argument, 'always' is used.",
+   &opt_base64_output_mode_str, &opt_base64_output_mode_str,
    0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
   /*
     mysqlbinlog needs charsets knowledge, to be able to convert a charset
@@ -1027,43 +1026,43 @@ static struct my_option my_long_options[] =
     SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`;
   */
   {"character-sets-dir", OPT_CHARSETS_DIR,
-   "Directory for character set files.", (uchar**) &charsets_dir,
-   (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Directory for character set files.", &charsets_dir,
+   &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"database", 'd', "List entries for just this database (local log only).",
-   (uchar**) &database, (uchar**) &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
+   &database, &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
 #ifndef DBUG_OFF
-  {"debug", '#', "Output debug log.", (uchar**) &default_dbug_option,
-   (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug", '#', "Output debug log.", &default_dbug_option,
+   &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
-   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   &debug_check_flag, &debug_check_flag, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
-   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   &debug_info_flag, &debug_info_flag,
    0, GET_BOOL, NO_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 "
     "when restoring after a crash to avoid duplication of the statements you "
     "already have. NOTE: you will need a SUPER privilege to use this option.",
-   (uchar**) &disable_log_bin, (uchar**) &disable_log_bin, 0, GET_BOOL,
+   &disable_log_bin, &disable_log_bin, 0, GET_BOOL,
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"force-if-open", 'F', "Force if binlog was not closed properly.",
-   (uchar**) &force_if_open_opt, (uchar**) &force_if_open_opt, 0, GET_BOOL, NO_ARG,
+   &force_if_open_opt, &force_if_open_opt, 0, GET_BOOL, NO_ARG,
    1, 0, 0, 0, 0, 0},
   {"force-read", 'f', "Force reading unknown binlog events.",
-   (uchar**) &force_opt, (uchar**) &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &force_opt, &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"hexdump", 'H', "Augment output with hexadecimal and ASCII event dump.",
-   (uchar**) &opt_hexdump, (uchar**) &opt_hexdump, 0, GET_BOOL, NO_ARG,
+   &opt_hexdump, &opt_hexdump, 0, GET_BOOL, NO_ARG,
    0, 0, 0, 0, 0, 0},
-  {"host", 'h', "Get the binlog from server.", (uchar**) &host, (uchar**) &host,
+  {"host", 'h', "Get the binlog from server.", &host, &host,
    0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"local-load", 'l', "Prepare local temporary files for LOAD DATA INFILE in the specified directory.",
-   (uchar**) &dirname_for_local_load, (uchar**) &dirname_for_local_load, 0,
+   &dirname_for_local_load, &dirname_for_local_load, 0,
    GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"offset", 'o', "Skip the first N entries.", (uchar**) &offset, (uchar**) &offset,
+  {"offset", 'o', "Skip the first N entries.", &offset, &offset,
    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},
@@ -1073,37 +1072,37 @@ static struct my_option my_long_options[] =
    "/etc/services, "
 #endif
    "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
-   (uchar**) &port, (uchar**) &port, 0, GET_INT, REQUIRED_ARG,
+   &port, &port, 0, GET_INT, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
   {"protocol", OPT_MYSQL_PROTOCOL,
    "The protocol to use for connection (tcp, socket, pipe, memory).",
    0, 0, 0, GET_STR,  REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"read-from-remote-server", 'R', "Read binary logs from a MySQL server.",
-   (uchar**) &remote_opt, (uchar**) &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &remote_opt, &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"server-id", OPT_SERVER_ID,
    "Extract only binlog entries created by the server having the given id.",
-   (uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG,
+   &server_id, &server_id, 0, GET_ULONG,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"set-charset", OPT_SET_CHARSET,
-   "Add 'SET NAMES character_set' to the output.", (uchar**) &charset,
-   (uchar**) &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Add 'SET NAMES character_set' to the output.", &charset,
+   &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef HAVE_SMEM
   {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
-   "Base name of shared memory.", (uchar**) &shared_memory_base_name, 
-   (uchar**) &shared_memory_base_name, 
+   "Base name of shared memory.", &shared_memory_base_name,
+   &shared_memory_base_name,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"short-form", 's', "Just show regular queries: no extra info and no "
    "row-based events. This is for testing only, and should not be used in "
    "production systems. If you want to suppress base64-output, consider "
    "using --base64-output=never instead.",
-   (uchar**) &short_form, (uchar**) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &short_form, &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"socket", 'S', "The socket file to use for connection.",
-   (uchar**) &sock, (uchar**) &sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 
+   &sock, &sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
    0, 0},
   {"start-datetime", OPT_START_DATETIME,
    "Start reading the binlog at first event having a datetime equal or "
@@ -1111,12 +1110,12 @@ static struct my_option my_long_options[] =
    "in the local time zone, in any format accepted by the MySQL server "
    "for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
    "(you should probably use quotes for your shell to set it properly).",
-   (uchar**) &start_datetime_str, (uchar**) &start_datetime_str,
+   &start_datetime_str, &start_datetime_str,
    0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"start-position", 'j',
    "Start reading the binlog at position N. Applies to the first binlog "
    "passed on the command line.",
-   (uchar**) &start_position, (uchar**) &start_position, 0, GET_ULL,
+   &start_position, &start_position, 0, GET_ULL,
    REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
    /* COM_BINLOG_DUMP accepts only 4 bytes for the position */
    (ulonglong)(~(uint32)0), 0, 0, 0},
@@ -1126,22 +1125,22 @@ static struct my_option my_long_options[] =
    "in the local time zone, in any format accepted by the MySQL server "
    "for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 "
    "(you should probably use quotes for your shell to set it properly).",
-   (uchar**) &stop_datetime_str, (uchar**) &stop_datetime_str,
+   &stop_datetime_str, &stop_datetime_str,
    0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"stop-position", OPT_STOP_POSITION,
    "Stop reading the binlog at position N. Applies to the last binlog "
    "passed on the command line.",
-   (uchar**) &stop_position, (uchar**) &stop_position, 0, GET_ULL,
+   &stop_position, &stop_position, 0, GET_ULL,
    REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
    (ulonglong)(~(my_off_t)0), 0, 0, 0},
   {"to-last-log", 't', "Requires -R. Will not stop at the end of the \
 requested binlog but rather continue printing until the end of the last \
 binlog of the MySQL server. If you send the output to the same MySQL server, \
 that may lead to an endless loop.",
-   (uchar**) &to_last_remote_log, (uchar**) &to_last_remote_log, 0, GET_BOOL,
+   &to_last_remote_log, &to_last_remote_log, 0, GET_BOOL,
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"user", 'u', "Connect to the remote server as username.",
-   (uchar**) &user, (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
+   &user, &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
    0, 0},
   {"verbose", 'v', "Reconstruct SQL statements out of row events. "
                    "-v -v adds comments on column data types.",
@@ -1150,7 +1149,7 @@ that may lead to an endless loop.",
    0, 0, 0, 0, 0},
   {"open_files_limit", OPT_OPEN_FILES_LIMIT,
    "Used to reserve file descriptors for use by this program.",
-   (uchar**) &open_files_limit, (uchar**) &open_files_limit, 0, GET_ULONG,
+   &open_files_limit, &open_files_limit, 0, GET_ULONG,
    REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
   {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 183ceb2d7f4..1fc9f179895 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -54,13 +54,13 @@ static struct my_option my_long_options[] =
 {
   {"all-databases", 'A',
    "Check all the databases. This is the same as --databases with all databases selected.",
-   (uchar**) &opt_alldbs, (uchar**) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &opt_alldbs, &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"analyze", 'a', "Analyze given tables.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
    0, 0, 0, 0},
   {"all-in-1", '1',
    "Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.",
-   (uchar**) &opt_all_in_1, (uchar**) &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_all_in_1, &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
 #ifdef __NETWARE__
   {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
@@ -68,11 +68,11 @@ static struct my_option my_long_options[] =
 #endif
   {"auto-repair", OPT_AUTO_REPAIR,
    "If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found.",
-   (uchar**) &opt_auto_repair, (uchar**) &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0,
+   &opt_auto_repair, &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0,
    0, 0, 0, 0, 0},
   {"character-sets-dir", OPT_CHARSETS_DIR,
-   "Directory for character set files.", (uchar**) &charsets_dir,
-   (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Directory for character set files.", &charsets_dir,
+   &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"check", 'c', "Check table for errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
    0, 0, 0, 0},
   {"check-only-changed", 'C',
@@ -82,11 +82,11 @@ static struct my_option my_long_options[] =
    "Check tables for version-dependent changes. May be used with --auto-repair to correct tables requiring version-dependent updates.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
-   (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
   {"databases", 'B',
    "Check several databases. Note the difference in usage; in this case no tables are given. All name arguments are regarded as database names.",
-   (uchar**) &opt_databases, (uchar**) &opt_databases, 0, GET_BOOL, NO_ARG,
+   &opt_databases, &opt_databases, 0, GET_BOOL, NO_ARG,
    0, 0, 0, 0, 0, 0},
 #ifdef DBUG_OFF
   {"debug", '#', "This is a non-debug version. Catch this and exit.",
@@ -96,40 +96,41 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
-   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   &debug_check_flag, &debug_check_flag, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
-   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   &debug_info_flag, &debug_info_flag,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
-   "Set the default character set.", (uchar**) &default_charset,
-   (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Set the default character set.", &default_charset,
+   &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"fast",'F', "Check only tables that haven't been closed properly.",
-   (uchar**) &opt_fast, (uchar**) &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+   &opt_fast, &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
    0},
   {"fix-db-names", OPT_FIX_DB_NAMES, "Fix database names.",
-    (uchar**) &opt_fix_db_names, (uchar**) &opt_fix_db_names,
+    &opt_fix_db_names, &opt_fix_db_names,
     0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"fix-table-names", OPT_FIX_TABLE_NAMES, "Fix table names.",
-    (uchar**) &opt_fix_table_names, (uchar**) &opt_fix_table_names,
+    &opt_fix_table_names, &opt_fix_table_names,
     0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"force", 'f', "Continue even if we get an SQL error.",
-   (uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
+   &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
    0, 0, 0, 0},
   {"extended", 'e',
    "If you are using this option with CHECK TABLE, it will ensure that the table is 100 percent consistent, but will take a long time. If you are using this option with REPAIR TABLE, it will force using old slow repair with keycache method, instead of much faster repair by sorting.",
-   (uchar**) &opt_extended, (uchar**) &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_extended, &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
   {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"host",'h', "Connect to host.", (uchar**) &current_host,
-   (uchar**) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"host",'h', "Connect to host.", &current_host,
+   &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"medium-check", 'm',
    "Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"write-binlog", OPT_WRITE_BINLOG,
-   "Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Use --skip-write-binlog when commands should not be sent to replication slaves.",
-   (uchar**) &opt_write_binlog, (uchar**) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
+   "Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Use --skip-write-binlog "
+   "when commands should not be sent to replication slaves.",
+   &opt_write_binlog, &opt_write_binlog, 0, GET_BOOL, NO_ARG,
    1, 0, 0, 0, 0, 0},
   {"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
    0, 0},
@@ -146,38 +147,37 @@ static struct my_option my_long_options[] =
    "/etc/services, "
 #endif
    "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
-   (uchar**) &opt_mysql_port,
-   (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+   &opt_mysql_port, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
    0},
   {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).",
    0, 0, 0, GET_STR,  REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"quick", 'q',
    "If you are using this option with CHECK TABLE, it prevents the check from scanning the rows to check for wrong links. This is the fastest check. If you are using this option with REPAIR TABLE, it will try to repair only the index tree. This is the fastest repair method for a table.",
-   (uchar**) &opt_quick, (uchar**) &opt_quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+   &opt_quick, &opt_quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
    0},
   {"repair", 'r',
    "Can fix almost anything except unique keys that aren't unique.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef HAVE_SMEM
   {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
-   "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
+   "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name,
    0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"silent", 's', "Print only error messages.", (uchar**) &opt_silent,
-   (uchar**) &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"silent", 's', "Print only error messages.", &opt_silent,
+   &opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"socket", 'S', "The socket file to use for connection.",
-   (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
+   &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #include <sslopt-longopts.h>
   {"tables", OPT_TABLES, "Overrides option --databases (-B).", 0, 0, 0,
    GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"use-frm", OPT_FRM,
    "When used with REPAIR, get table structure from .frm file, so the table can be repaired even if .MYI header is corrupted.",
-   (uchar**) &opt_frm, (uchar**) &opt_frm, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+   &opt_frm, &opt_frm, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
    0},
 #ifndef DONT_ALLOW_USER_CHANGE
-  {"user", 'u', "User for login if not current user.", (uchar**) &current_user,
-   (uchar**) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"user", 'u', "User for login if not current user.", &current_user,
+   &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"verbose", 'v', "Print info about the various stages.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 5b12e711331..2d92f0891eb 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -186,90 +186,98 @@ static struct my_option my_long_options[] =
 {
   {"all-databases", 'A',
    "Dump all the databases. This will be same as --databases with all databases selected.",
-   (uchar**) &opt_alldbs, (uchar**) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &opt_alldbs, &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"all-tablespaces", 'Y',
    "Dump all the tablespaces.",
-   (uchar**) &opt_alltspcs, (uchar**) &opt_alltspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &opt_alltspcs, &opt_alltspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"no-tablespaces", 'y',
    "Do not dump any tablespace information.",
-   (uchar**) &opt_notspcs, (uchar**) &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &opt_notspcs, &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"add-drop-database", OPT_DROP_DATABASE, "Add a DROP DATABASE before each create.",
-   (uchar**) &opt_drop_database, (uchar**) &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+   &opt_drop_database, &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
    0},
   {"add-drop-table", OPT_DROP, "Add a DROP TABLE before each create.",
-   (uchar**) &opt_drop, (uchar**) &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
+   &opt_drop, &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
    0},
   {"add-locks", OPT_LOCKS, "Add locks around INSERT statements.",
-   (uchar**) &opt_lock, (uchar**) &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
+   &opt_lock, &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
    0},
   {"allow-keywords", OPT_KEYWORDS,
-   "Allow creation of column names that are keywords.", (uchar**) &opt_keywords,
-   (uchar**) &opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   "Allow creation of column names that are keywords.", &opt_keywords,
+   &opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"apply-slave-statements", OPT_MYSQLDUMP_SLAVE_APPLY,
    "Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump.",
-   (uchar**) &opt_slave_apply, (uchar**) &opt_slave_apply, 0, GET_BOOL, NO_ARG,
+   &opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG,
    0, 0, 0, 0, 0, 0},
 #ifdef __NETWARE__
   {"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"character-sets-dir", OPT_CHARSETS_DIR,
-   "Directory for character set files.", (uchar**) &charsets_dir,
-   (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Directory for character set files.", &charsets_dir,
+   &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"comments", 'i', "Write additional information.",
-   (uchar**) &opt_comments, (uchar**) &opt_comments, 0, GET_BOOL, NO_ARG,
+   &opt_comments, &opt_comments, 0, GET_BOOL, NO_ARG,
    1, 0, 0, 0, 0, 0},
   {"compatible", OPT_COMPATIBLE,
-   "Change the dump to be compatible with a given mode. By default tables are dumped in a format optimized for MySQL. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option is ignored with earlier server versions.",
-   (uchar**) &opt_compatible_mode_str, (uchar**) &opt_compatible_mode_str, 0,
+   "Change the dump to be compatible with a given mode. By default tables "
+   "are dumped in a format optimized for MySQL. Legal modes are: ansi, "
+   "mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, "
+   "no_table_options, no_field_options. One can use several modes separated "
+   "by commas. Note: Requires MySQL server version 4.1.0 or higher. "
+   "This option is ignored with earlier server versions.",
+   &opt_compatible_mode_str, &opt_compatible_mode_str, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"compact", OPT_COMPACT,
-   "Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs.  Enables options --skip-add-drop-table --skip-add-locks --skip-comments --skip-disable-keys --skip-set-charset.",
-   (uchar**) &opt_compact, (uchar**) &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
-   0, 0},
+   "Give less verbose output (useful for debugging). Disables structure "
+   "comments and header/footer constructs.  Enables options --skip-add-"
+   "drop-table --skip-add-locks --skip-comments --skip-disable-keys "
+   "--skip-set-charset.",
+   &opt_compact, &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"complete-insert", 'c', "Use complete insert statements.",
-   (uchar**) &opt_complete_insert, (uchar**) &opt_complete_insert, 0, GET_BOOL,
+   &opt_complete_insert, &opt_complete_insert, 0, GET_BOOL,
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"compress", 'C', "Use compression in server/client protocol.",
-   (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
   {"create-options", 'a',
    "Include all MySQL specific create options.",
-   (uchar**) &create_options, (uchar**) &create_options, 0, GET_BOOL, NO_ARG, 1,
+   &create_options, &create_options, 0, GET_BOOL, NO_ARG, 1,
    0, 0, 0, 0, 0},
   {"databases", 'B',
    "Dump several databases. Note the difference in usage; in this case no tables are given. All name arguments are regarded as database names. 'USE db_name;' will be included in the output.",
-   (uchar**) &opt_databases, (uchar**) &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0,
+   &opt_databases, &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0,
    0, 0, 0, 0},
 #ifdef DBUG_OFF
   {"debug", '#', "This is a non-debug version. Catch this and exit.",
    0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #else
-  {"debug", '#', "Output debug log.", (uchar**) &default_dbug_option,
-   (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug", '#', "Output debug log.", &default_dbug_option,
+   &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
-   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   &debug_check_flag, &debug_check_flag, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
-   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   &debug_info_flag, &debug_info_flag,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
-   "Set the default character set.", (uchar**) &default_charset,
-   (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Set the default character set.", &default_charset,
+   &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED.",
-   (uchar**) &opt_delayed, (uchar**) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &opt_delayed, &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"delete-master-logs", OPT_DELETE_MASTER_LOGS,
    "Delete logs on master after backup. This automatically enables --master-data.",
-   (uchar**) &opt_delete_master_logs, (uchar**) &opt_delete_master_logs, 0,
+   &opt_delete_master_logs, &opt_delete_master_logs, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"disable-keys", 'K',
-   "'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (uchar**) &opt_disable_keys,
-   (uchar**) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+   "'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER "
+   "TABLE tb_name ENABLE KEYS */; will be put in the output.", &opt_disable_keys,
+   &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
   {"dump-slave", OPT_MYSQLDUMP_SLAVE_DATA,
    "This causes the binary log position and filename of the master to be "
    "appended to the dumped data output. Setting the value to 1, will print"
@@ -281,31 +289,28 @@ static struct my_option my_long_options[] =
    "- don't forget to read about --single-transaction below). In all cases "
    "any action on logs will happen at the exact moment of the dump."
    "Option automatically turns --lock-tables off.",
-   (uchar**) &opt_slave_data, (uchar**) &opt_slave_data, 0,
+   &opt_slave_data, &opt_slave_data, 0,
    GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL, 0, 0, 0},
   {"events", 'E', "Dump events.",
-     (uchar**) &opt_events, (uchar**) &opt_events, 0, GET_BOOL,
+     &opt_events, &opt_events, 0, GET_BOOL,
      NO_ARG, 0, 0, 0, 0, 0, 0},
   {"extended-insert", 'e',
    "Use multiple-row INSERT syntax that include several VALUES lists.",
-   (uchar**) &extended_insert, (uchar**) &extended_insert, 0, GET_BOOL, NO_ARG,
+   &extended_insert, &extended_insert, 0, GET_BOOL, NO_ARG,
    1, 0, 0, 0, 0, 0},
   {"fields-terminated-by", OPT_FTB,
-   "Fields in the output file are terminated by the given string.", 
-   (uchar**) &fields_terminated, (uchar**) &fields_terminated, 0, 
+   "Fields in the output file are terminated by the given string.",
+   &fields_terminated, &fields_terminated, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"fields-enclosed-by", OPT_ENC,
-   "Fields in the output file are enclosed by the given character.", 
-   (uchar**) &enclosed, (uchar**) &enclosed, 0, 
-   GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
+   "Fields in the output file are enclosed by the given character.",
+   &enclosed, &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
   {"fields-optionally-enclosed-by", OPT_O_ENC,
    "Fields in the output file are optionally enclosed by the given character.",
-   (uchar**) &opt_enclosed, (uchar**) &opt_enclosed, 0,
-   GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
+   &opt_enclosed, &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
   {"fields-escaped-by", OPT_ESC,
    "Fields in the output file are escaped by the given character.",
-   (uchar**) &escaped, (uchar**) &escaped, 0,
-   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   &escaped, &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"flush-logs", 'F', "Flush logs file in server before starting dump. "
    "Note that if you dump many databases at once (using the option "
    "--databases= or --all-databases), the logs will be flushed for "
@@ -315,24 +320,24 @@ static struct my_option my_long_options[] =
    "to the moment all tables are locked. So if you want your dump and "
    "the log flush to happen at the same exact moment you should use "
    "--lock-all-tables or --master-data with --flush-logs.",
-   (uchar**) &flush_logs, (uchar**) &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &flush_logs, &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"flush-privileges", OPT_ESC, "Emit a FLUSH PRIVILEGES statement "
    "after dumping the mysql database.  This option should be used any "
    "time the dump contains the mysql database and any other database "
    "that depends on the data in the mysql database for proper restore. ",
-   (uchar**) &flush_privileges, (uchar**) &flush_privileges, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &flush_privileges, &flush_privileges, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"force", 'f', "Continue even if we get an SQL error.",
-   (uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG,
+   &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG,
    0, 0, 0, 0, 0, 0},
   {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"hex-blob", OPT_HEXBLOB, "Dump binary strings (BINARY, "
     "VARBINARY, BLOB) in hexadecimal format.",
-   (uchar**) &opt_hex_blob, (uchar**) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"host", 'h', "Connect to host.", (uchar**) &current_host,
-   (uchar**) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   &opt_hex_blob, &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"host", 'h', "Connect to host.", &current_host,
+   &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"ignore-table", OPT_IGNORE_TABLE,
    "Do not dump the specified table. To specify more than one table to ignore, "
    "use the directive multiple times, once for each table.  Each table must "
@@ -340,27 +345,26 @@ static struct my_option my_long_options[] =
    "--ignore-table=database.table.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"include-master-host-port", OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT,
-   "Adds 'MASTER_HOST=<host>, MASTER_PORT=<port>' to 'CHANGE MASTER TO..' in dump produced with --dump-slave.",
-   (uchar**) &opt_include_master_host_port, 
-   (uchar**) &opt_include_master_host_port, 
-   0, GET_BOOL, NO_ARG,
+   "Adds 'MASTER_HOST=<host>, MASTER_PORT=<port>' to 'CHANGE MASTER TO..' "
+   "in dump produced with --dump-slave.", &opt_include_master_host_port,
+   &opt_include_master_host_port, 0, GET_BOOL, NO_ARG,
    0, 0, 0, 0, 0, 0},
   {"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.",
-   (uchar**) &opt_ignore, (uchar**) &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &opt_ignore, &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
-  {"lines-terminated-by", OPT_LTB, 
+  {"lines-terminated-by", OPT_LTB,
    "Lines in the output file are terminated by the given string.",
-   (uchar**) &lines_terminated, (uchar**) &lines_terminated, 0, GET_STR,
+   &lines_terminated, &lines_terminated, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"lock-all-tables", 'x', "Locks all tables across all databases. This "
    "is achieved by taking a global read lock for the duration of the whole "
    "dump. Automatically turns --single-transaction and --lock-tables off.",
-   (uchar**) &opt_lock_all_tables, (uchar**) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
+   &opt_lock_all_tables, &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
    0, 0, 0, 0, 0, 0},
-  {"lock-tables", 'l', "Lock all tables for read.", (uchar**) &lock_tables,
-   (uchar**) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+  {"lock-tables", 'l', "Lock all tables for read.", &lock_tables,
+   &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
   {"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.",
-   (uchar**) &log_error_file, (uchar**) &log_error_file, 0, GET_STR,
+   &log_error_file, &log_error_file, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"master-data", OPT_MASTER_DATA,
    "This causes the binary log position and filename to be appended to the "
@@ -372,41 +376,41 @@ static struct my_option my_long_options[] =
    "don't forget to read about --single-transaction below). In all cases, "
    "any action on logs will happen at the exact moment of the dump. "
    "Option automatically turns --lock-tables off.",
-   (uchar**) &opt_master_data, (uchar**) &opt_master_data, 0,
+   &opt_master_data, &opt_master_data, 0,
    GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0},
   {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, 
    "The maximum packet length to send to or receive from server.",
-    (uchar**) &opt_max_allowed_packet, (uchar**) &opt_max_allowed_packet, 0,
+    &opt_max_allowed_packet, &opt_max_allowed_packet, 0,
     GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
    (longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
   {"net_buffer_length", OPT_NET_BUFFER_LENGTH, 
    "The buffer size for TCP/IP and socket communication.",
-    (uchar**) &opt_net_buffer_length, (uchar**) &opt_net_buffer_length, 0,
+    &opt_net_buffer_length, &opt_net_buffer_length, 0,
     GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L,
    MALLOC_OVERHEAD-1024, 1024, 0},
   {"no-autocommit", OPT_AUTOCOMMIT,
    "Wrap tables with autocommit/commit statements.",
-   (uchar**) &opt_autocommit, (uchar**) &opt_autocommit, 0, GET_BOOL, NO_ARG,
+   &opt_autocommit, &opt_autocommit, 0, GET_BOOL, NO_ARG,
    0, 0, 0, 0, 0, 0},
   {"no-create-db", 'n',
    "Suppress the CREATE DATABASE ... IF EXISTS statement that normally is "
    "output for each dumped database if --all-databases or --databases is "
    "given.",
-   (uchar**) &opt_create_db, (uchar**) &opt_create_db, 0, 
+   &opt_create_db, &opt_create_db, 0, 
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"no-create-info", 't', "Don't write table creation info.",
-   (uchar**) &opt_no_create_info, (uchar**) &opt_no_create_info, 0, GET_BOOL,
+   &opt_no_create_info, &opt_no_create_info, 0, GET_BOOL,
    NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"no-data", 'd', "No row information.", (uchar**) &opt_no_data,
-   (uchar**) &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"no-set-names", 'N',  "Same as--skip-set-charset.",
+  {"no-data", 'd', "No row information.", &opt_no_data,
+   &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"no-set-names", 'N', "Same as --skip-set-charset.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"opt", OPT_OPTIMIZE,
    "Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"order-by-primary", OPT_ORDER_BY_PRIMARY,
    "Sorts each table's rows by primary key, or first unique key, if such a key exists.  Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.",
-   (uchar**) &opt_order_by_primary, (uchar**) &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   &opt_order_by_primary, &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"password", 'p',
    "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},
@@ -414,33 +418,35 @@ 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
-  {"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
-   (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+  {"port", 'P', "Port number to use for connection.", &opt_mysql_port,
+   &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
    0},
   {"protocol", OPT_MYSQL_PROTOCOL, 
    "The protocol to use for connection (tcp, socket, pipe, memory).",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"quick", 'q', "Don't buffer query, dump directly to stdout.",
-   (uchar**) &quick, (uchar**) &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+   &quick, &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
   {"quote-names",'Q', "Quote table and column names with backticks (`).",
-   (uchar**) &opt_quoted, (uchar**) &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
+   &opt_quoted, &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
    0, 0},
   {"replace", OPT_MYSQL_REPLACE_INTO, "Use REPLACE INTO instead of INSERT INTO.",
-   (uchar**) &opt_replace_into, (uchar**) &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &opt_replace_into, &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"result-file", 'r',
-   "Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).",
+   "Direct output to a given file. This option should be used in MSDOS, "
+   "because it prevents new line '\\n' from being converted to '\\r\\n' "
+   "(carriage return + line feed).",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"routines", 'R', "Dump stored routines (functions and procedures).",
-     (uchar**) &opt_routines, (uchar**) &opt_routines, 0, GET_BOOL,
-     NO_ARG, 0, 0, 0, 0, 0, 0},
+   &opt_routines, &opt_routines, 0, GET_BOOL,
+   NO_ARG, 0, 0, 0, 0, 0, 0},
   {"set-charset", OPT_SET_CHARSET,
    "Add 'SET NAMES default_character_set' to the output.",
-   (uchar**) &opt_set_charset, (uchar**) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
+   &opt_set_charset, &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
    0, 0, 0, 0, 0},
 #ifdef HAVE_SMEM
   {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
-   "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
+   "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name,
    0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   /*
@@ -458,42 +464,42 @@ static struct my_option my_long_options[] =
    "connection should use the following statements: ALTER TABLE, DROP "
    "TABLE, RENAME TABLE, TRUNCATE TABLE, as consistent snapshot is not "
    "isolated from them. Option automatically turns off --lock-tables.",
-   (uchar**) &opt_single_transaction, (uchar**) &opt_single_transaction, 0,
+   &opt_single_transaction, &opt_single_transaction, 0,
    GET_BOOL, NO_ARG,  0, 0, 0, 0, 0, 0},
   {"dump-date", OPT_DUMP_DATE, "Put a dump date to the end of the output.",
-   (uchar**) &opt_dump_date, (uchar**) &opt_dump_date, 0,
+   &opt_dump_date, &opt_dump_date, 0,
    GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
   {"skip-opt", OPT_SKIP_OPTIMIZATION,
    "Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"socket", 'S', "The socket file to use for connection.",
-   (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, 
+   &opt_mysql_unix_port, &opt_mysql_unix_port, 0, 
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #include <sslopt-longopts.h>
   {"tab",'T',
    "Create tab-separated textfile for each table to given path. (Create .sql "
    "and .txt files.) NOTE: This only works if mysqldump is run on the same "
    "machine as the mysqld server.",
-   (uchar**) &path, (uchar**) &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   &path, &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"tables", OPT_TABLES, "Overrides option --databases (-B).",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"triggers", OPT_TRIGGERS, "Dump triggers for each dumped table.",
-   (uchar**) &opt_dump_triggers, (uchar**) &opt_dump_triggers, 0, GET_BOOL,
+   &opt_dump_triggers, &opt_dump_triggers, 0, GET_BOOL,
    NO_ARG, 1, 0, 0, 0, 0, 0},
   {"tz-utc", OPT_TZ_UTC,
     "SET TIME_ZONE='+00:00' at top of dump to allow dumping of TIMESTAMP data when a server has data in different time zones or data is being moved between servers with different time zones.",
-    (uchar**) &opt_tz_utc, (uchar**) &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+    &opt_tz_utc, &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
 #ifndef DONT_ALLOW_USER_CHANGE
   {"user", 'u', "User for login if not current user.",
-   (uchar**) &current_user, (uchar**) &current_user, 0, GET_STR, REQUIRED_ARG,
+   &current_user, &current_user, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
 #endif
   {"verbose", 'v', "Print info about the various stages.",
-   (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   &verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"version",'V', "Output version information and exit.", 0, 0, 0,
    GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"where", 'w', "Dump only selected records. Quotes are mandatory.",
-   (uchar**) &where, (uchar**) &where, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   &where, &where, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index b25469b1955..3bf17cb1df7 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -72,68 +72,68 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"character-sets-dir", OPT_CHARSETS_DIR,
-   "Directory for character set files.", (uchar**) &charsets_dir,
-   (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Directory for character set files.", &charsets_dir,
+   &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
-   "Set the default character set.", (uchar**) &default_charset,
-   (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Set the default character set.", &default_charset,
+   &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"columns", 'c',
    "Use only these columns to import the data to. Give the column names in a comma separated list. This is same as giving columns to LOAD DATA INFILE.",
-   (uchar**) &opt_columns, (uchar**) &opt_columns, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+   &opt_columns, &opt_columns, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
    0, 0, 0},
   {"compress", 'C', "Use compression in server/client protocol.",
-   (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
   {"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0,
    GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
-   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   &debug_check_flag, &debug_check_flag, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
-   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   &debug_info_flag, &debug_info_flag,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"delete", 'd', "First delete all rows from table.", (uchar**) &opt_delete,
-   (uchar**) &opt_delete, 0, GET_BOOL, NO_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,
    "Fields in the input file are terminated by the given string.", 
-   (uchar**) &fields_terminated, (uchar**) &fields_terminated, 0, 
+   &fields_terminated, &fields_terminated, 0, 
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"fields-enclosed-by", OPT_ENC,
    "Fields in the import file are enclosed by the given character.", 
-   (uchar**) &enclosed, (uchar**) &enclosed, 0, 
+   &enclosed, &enclosed, 0, 
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"fields-optionally-enclosed-by", OPT_O_ENC,
    "Fields in the input file are optionally enclosed by the given character.", 
-   (uchar**) &opt_enclosed, (uchar**) &opt_enclosed, 0, 
+   &opt_enclosed, &opt_enclosed, 0, 
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"fields-escaped-by", OPT_ESC, 
    "Fields in the input file are escaped by the given character.",
-   (uchar**) &escaped, (uchar**) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
+   &escaped, &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
    0, 0},
   {"force", 'f', "Continue even if we get an SQL error.",
-   (uchar**) &ignore_errors, (uchar**) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
+   &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
    0, 0, 0, 0},
   {"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG, NO_ARG,
    0, 0, 0, 0, 0, 0},
-  {"host", 'h', "Connect to host.", (uchar**) &current_host,
-   (uchar**) &current_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"host", 'h', "Connect to host.", &current_host,
+   &current_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"ignore", 'i', "If duplicate unique key was found, keep old row.",
-   (uchar**) &ignore, (uchar**) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   &ignore, &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.",
-   (uchar**) &opt_ignore_lines, (uchar**) &opt_ignore_lines, 0, GET_LL,
+   &opt_ignore_lines, &opt_ignore_lines, 0, GET_LL,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"lines-terminated-by", OPT_LTB, 
    "Lines in the input file are terminated by the given string.",
-   (uchar**) &lines_terminated, (uchar**) &lines_terminated, 0, GET_STR,
+   &lines_terminated, &lines_terminated, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"local", 'L', "Read all files through the client.", (uchar**) &opt_local_file,
-   (uchar**) &opt_local_file, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"local", 'L', "Read all files through the client.", &opt_local_file,
+   &opt_local_file, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"lock-tables", 'l', "Lock all tables for write (this disables threads).",
-    (uchar**) &lock_tables, (uchar**) &lock_tables, 0, GET_BOOL, NO_ARG, 
+    &lock_tables, &lock_tables, 0, GET_BOOL, NO_ARG, 
     0, 0, 0, 0, 0, 0},
   {"low-priority", OPT_LOW_PRIORITY,
-   "Use LOW_PRIORITY when updating the table.", (uchar**) &opt_low_priority,
-   (uchar**) &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   "Use LOW_PRIORITY when updating the table.", &opt_low_priority,
+   &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"password", 'p',
    "Password to use when connecting to server. If password is not given it's asked from the tty.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -147,35 +147,35 @@ static struct my_option my_long_options[] =
    "/etc/services, "
 #endif
    "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
-   (uchar**) &opt_mysql_port,
-   (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+   &opt_mysql_port,
+   &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
    0},
   {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"replace", 'r', "If duplicate unique key was found, replace old row.",
-   (uchar**) &replace, (uchar**) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   &replace, &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef HAVE_SMEM
   {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
-   "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
+   "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name,
    0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"silent", 's', "Be more silent.", (uchar**) &silent, (uchar**) &silent, 0,
+  {"silent", 's', "Be more silent.", &silent, &silent, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"socket", 'S', "The socket file to use for connection.",
-   (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
+   &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #include <sslopt-longopts.h>
   {"use-threads", OPT_USE_THREADS,
    "Load files in parallel. The argument is the number "
    "of threads to use for loading data.",
-   (uchar**) &opt_use_threads, (uchar**) &opt_use_threads, 0, 
+   &opt_use_threads, &opt_use_threads, 0, 
    GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #ifndef DONT_ALLOW_USER_CHANGE
-  {"user", 'u', "User for login if not current user.", (uchar**) &current_user,
-   (uchar**) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"user", 'u', "User for login if not current user.", &current_user,
+   &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"verbose", 'v', "Print info about the various stages.", (uchar**) &verbose,
-   (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"verbose", 'v', "Print info about the various stages.", &verbose,
+   &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 36bf974158a..d8561d13b81 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -166,35 +166,35 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"character-sets-dir", 'c', "Directory for character set files.",
-   (uchar**) &charsets_dir, (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
+   &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
    0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
-   "Set the default character set.", (uchar**) &default_charset,
-   (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Set the default character set.", &default_charset,
+   &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"count", OPT_COUNT,
    "Show number of rows per table (may be slow for non-MyISAM tables).",
-   (uchar**) &opt_count, (uchar**) &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_count, &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
   {"compress", 'C', "Use compression in server/client protocol.",
-   (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
-   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   &debug_check_flag, &debug_check_flag, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
-   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   &debug_info_flag, &debug_info_flag,
    0, GET_BOOL, NO_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.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
+  {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"status", 'i', "Shows a lot of extra information about each table.",
-   (uchar**) &opt_status, (uchar**) &opt_status, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &opt_status, &opt_status, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
-  {"keys", 'k', "Show keys for table.", (uchar**) &opt_show_keys,
-   (uchar**) &opt_show_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"keys", 'k', "Show keys for table.", &opt_show_keys,
+   &opt_show_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"password", 'p',
    "Password to use when connecting to server. If password is not given, it's "
    "solicited on the tty.",
@@ -205,8 +205,8 @@ static struct my_option my_long_options[] =
    "/etc/services, "
 #endif
    "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
-   (uchar**) &opt_mysql_port,
-   (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
+   &opt_mysql_port,
+   &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
    0},
 #ifdef __WIN__
   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
@@ -217,19 +217,20 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_STR,  REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef HAVE_SMEM
   {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
-   "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
-   0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Base name of shared memory.", &shared_memory_base_name,
+   &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG,
+   0, 0, 0, 0, 0, 0},
 #endif
   {"show-table-type", 't', "Show table type column.",
-   (uchar**) &opt_table_type, (uchar**) &opt_table_type, 0, GET_BOOL,
+   &opt_table_type, &opt_table_type, 0, GET_BOOL,
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"socket", 'S', "The socket file to use for connection.",
-   (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
+   &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #include <sslopt-longopts.h>
 #ifndef DONT_ALLOW_USER_CHANGE
-  {"user", 'u', "User for login if not current user.", (uchar**) &user,
-   (uchar**) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"user", 'u', "User for login if not current user.", &user,
+   &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"verbose", 'v',
    "More verbose output; you can use this multiple times to get even more "
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index 0779b7a45e0..714a8cb9039 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -515,62 +515,62 @@ static struct my_option my_long_options[] =
     0, 0, 0, 0, 0, 0},
   {"auto-generate-sql", 'a',
     "Generate SQL where not supplied by file or command line.",
-    (uchar**) &auto_generate_sql, (uchar**) &auto_generate_sql,
+    &auto_generate_sql, &auto_generate_sql,
     0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"auto-generate-sql-add-autoincrement", OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
     "Add an AUTO_INCREMENT column to auto-generated tables.",
-    (uchar**) &auto_generate_sql_autoincrement, 
-    (uchar**) &auto_generate_sql_autoincrement,
+    &auto_generate_sql_autoincrement,
+    &auto_generate_sql_autoincrement,
     0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"auto-generate-sql-execute-number", OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES,
     "Set this number to generate a set number of queries to run.",
-    (uchar**) &auto_actual_queries, (uchar**) &auto_actual_queries,
+    &auto_actual_queries, &auto_actual_queries,
     0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"auto-generate-sql-guid-primary", OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY,
     "Add GUID based primary keys to auto-generated tables.",
-    (uchar**) &auto_generate_sql_guid_primary, 
-    (uchar**) &auto_generate_sql_guid_primary,
+    &auto_generate_sql_guid_primary,
+    &auto_generate_sql_guid_primary,
     0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"auto-generate-sql-load-type", OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE,
     "Specify test load type: mixed, update, write, key, or read; default is mixed.",
-    (uchar**) &auto_generate_sql_type, (uchar**) &auto_generate_sql_type,
+    &auto_generate_sql_type, &auto_generate_sql_type,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"auto-generate-sql-secondary-indexes", 
     OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES, 
     "Number of secondary indexes to add to auto-generated tables.",
-    (uchar**) &auto_generate_sql_secondary_indexes, 
-    (uchar**) &auto_generate_sql_secondary_indexes, 0,
+    &auto_generate_sql_secondary_indexes,
+    &auto_generate_sql_secondary_indexes, 0,
     GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"auto-generate-sql-unique-query-number", 
     OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM,
     "Number of unique queries to generate for automatic tests.",
-    (uchar**) &auto_generate_sql_unique_query_number, 
-    (uchar**) &auto_generate_sql_unique_query_number,
+    &auto_generate_sql_unique_query_number,
+    &auto_generate_sql_unique_query_number,
     0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
   {"auto-generate-sql-unique-write-number", 
     OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM,
     "Number of unique queries to generate for auto-generate-sql-write-number.",
-    (uchar**) &auto_generate_sql_unique_write_number, 
-    (uchar**) &auto_generate_sql_unique_write_number,
+    &auto_generate_sql_unique_write_number,
+    &auto_generate_sql_unique_write_number,
     0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
   {"auto-generate-sql-write-number", OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
     "Number of row inserts to perform for each thread (default is 100).",
-    (uchar**) &auto_generate_sql_number, (uchar**) &auto_generate_sql_number,
+    &auto_generate_sql_number, &auto_generate_sql_number,
     0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
   {"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.",
-    (uchar**) &commit_rate, (uchar**) &commit_rate, 0, GET_UINT, REQUIRED_ARG,
+    &commit_rate, &commit_rate, 0, GET_UINT, REQUIRED_ARG,
     0, 0, 0, 0, 0, 0},
   {"compress", 'C', "Use compression in server/client protocol.",
-    (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+    &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
     0, 0, 0},
   {"concurrency", 'c', "Number of clients to simulate for query to run.",
-    (uchar**) &concurrency_str, (uchar**) &concurrency_str, 0, GET_STR,
+    &concurrency_str, &concurrency_str, 0, GET_STR,
     REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"create", OPT_SLAP_CREATE_STRING, "File or string to use create tables.",
-    (uchar**) &create_string, (uchar**) &create_string, 0, GET_STR, REQUIRED_ARG,
+    &create_string, &create_string, 0, GET_STR, REQUIRED_ARG,
     0, 0, 0, 0, 0, 0},
   {"create-schema", OPT_CREATE_SLAP_SCHEMA, "Schema to run tests in.",
-    (uchar**) &create_schema_string, (uchar**) &create_schema_string, 0, GET_STR, 
+    &create_schema_string, &create_schema_string, 0, GET_STR, 
     REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"csv", OPT_SLAP_CSV,
 	"Generate CSV output to named file or to stdout if no file is named.",
@@ -580,45 +580,45 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #else
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
-    (uchar**) &default_dbug_option, (uchar**) &default_dbug_option, 0, GET_STR,
+    &default_dbug_option, &default_dbug_option, 0, GET_STR,
     OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
-   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   &debug_check_flag, &debug_check_flag, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,
-   (uchar**) &debug_info_flag, 0, 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},
   {"delimiter", 'F',
     "Delimiter to use in SQL statements supplied in file or command line.",
-    (uchar**) &delimiter, (uchar**) &delimiter, 0, GET_STR, REQUIRED_ARG,
+    &delimiter, &delimiter, 0, GET_STR, REQUIRED_ARG,
     0, 0, 0, 0, 0, 0},
   {"detach", OPT_SLAP_DETACH,
     "Detach (close and reopen) connections after X number of requests.",
-    (uchar**) &detach_rate, (uchar**) &detach_rate, 0, GET_UINT, REQUIRED_ARG, 
+    &detach_rate, &detach_rate, 0, GET_UINT, REQUIRED_ARG, 
     0, 0, 0, 0, 0, 0},
   {"engine", 'e', "Storage engine to use for creating the table.",
-    (uchar**) &default_engine, (uchar**) &default_engine, 0,
+    &default_engine, &default_engine, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"host", 'h', "Connect to host.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
+  {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
     REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"iterations", 'i', "Number of times to run the tests.", (uchar**) &iterations,
-    (uchar**) &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
+  {"iterations", 'i', "Number of times to run the tests.", &iterations,
+    &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
   {"number-char-cols", 'x', 
     "Number of VARCHAR columns to create in table if specifying --auto-generate-sql.",
-    (uchar**) &num_char_cols_opt, (uchar**) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
+    &num_char_cols_opt, &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG,
     0, 0, 0, 0, 0, 0},
   {"number-int-cols", 'y', 
     "Number of INT columns to create in table if specifying --auto-generate-sql.",
-    (uchar**) &num_int_cols_opt, (uchar**) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG, 
+    &num_int_cols_opt, &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG, 
     0, 0, 0, 0, 0, 0},
   {"number-of-queries", OPT_MYSQL_NUMBER_OF_QUERY, 
     "Limit each client to this number of queries (this is not exact).",
-    (uchar**) &num_of_query, (uchar**) &num_of_query, 0,
+    &num_of_query, &num_of_query, 0,
     GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"only-print", OPT_MYSQL_ONLY_PRINT,
     "Do not connect to the databases, but instead print out what would have "
      "been done.",
-    (uchar**) &opt_only_print, (uchar**) &opt_only_print, 0, GET_BOOL,  NO_ARG,
+    &opt_only_print, &opt_only_print, 0, GET_BOOL,  NO_ARG,
     0, 0, 0, 0, 0, 0},
   {"password", 'p',
     "Password to use when connecting to server. If password is not given it's "
@@ -627,58 +627,54 @@ 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
-  {"port", 'P', "Port number to use for connection.", (uchar**) &opt_mysql_port,
-    (uchar**) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 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},
   {"post-query", OPT_SLAP_POST_QUERY,
     "Query to run or file containing query to execute after tests have completed.",
-    (uchar**) &user_supplied_post_statements, 
-    (uchar**) &user_supplied_post_statements,
+    &user_supplied_post_statements, &user_supplied_post_statements,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"post-system", OPT_SLAP_POST_SYSTEM,
     "system() string to execute after tests have completed.",
-    (uchar**) &post_system, 
-    (uchar**) &post_system,
+    &post_system, &post_system,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"pre-query", OPT_SLAP_PRE_QUERY, 
     "Query to run or file containing query to execute before running tests.",
-    (uchar**) &user_supplied_pre_statements, 
-    (uchar**) &user_supplied_pre_statements,
+    &user_supplied_pre_statements, &user_supplied_pre_statements,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"pre-system", OPT_SLAP_PRE_SYSTEM, 
     "system() string to execute before running tests.",
-    (uchar**) &pre_system, 
-    (uchar**) &pre_system,
+    &pre_system, &pre_system,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"protocol", OPT_MYSQL_PROTOCOL,
     "The protocol to use for connection (tcp, socket, pipe, memory).",
     0, 0, 0, GET_STR,  REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"query", 'q', "Query to run or file containing query to run.",
-    (uchar**) &user_supplied_query, (uchar**) &user_supplied_query,
+    &user_supplied_query, &user_supplied_query,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef HAVE_SMEM
   {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
-    "Base name of shared memory.", (uchar**) &shared_memory_base_name,
-    (uchar**) &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG,
+    "Base name of shared memory.", &shared_memory_base_name,
+    &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG,
     0, 0, 0, 0, 0, 0},
 #endif
   {"silent", 's', "Run program in silent mode - no output.",
-    (uchar**) &opt_silent, (uchar**) &opt_silent, 0, GET_BOOL,  NO_ARG,
+    &opt_silent, &opt_silent, 0, GET_BOOL,  NO_ARG,
     0, 0, 0, 0, 0, 0},
   {"socket", 'S', "The socket file to use for connection.",
-    (uchar**) &opt_mysql_unix_port, (uchar**) &opt_mysql_unix_port, 0, GET_STR,
+    &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR,
     REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #include <sslopt-longopts.h>
 #ifndef DONT_ALLOW_USER_CHANGE
-  {"user", 'u', "User for login if not current user.", (uchar**) &user,
-    (uchar**) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"user", 'u', "User for login if not current user.", &user,
+    &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"verbose", 'v',
-    "More verbose output; you can use this multiple times to get even more "
-      "verbose output.", (uchar**) &verbose, (uchar**) &verbose, 0, 
-      GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
-    NO_ARG, 0, 0, 0, 0, 0, 0},
+   "More verbose output; you can use this multiple times to get even more "
+   "verbose output.", &verbose, &verbose, 0, GET_NO_ARG, NO_ARG,
+   0, 0, 0, 0, 0, 0},
+  {"version", 'V', "Output version information and exit.", 0, 0, 0,
+   GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 0312a0a030b..75b23ea9af7 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -5888,18 +5888,18 @@ static struct my_option my_long_options[] =
 {
   {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
    0, 0, 0, 0, 0, 0},
-  {"basedir", 'b', "Basedir for tests.", (uchar**) &opt_basedir,
-   (uchar**) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"basedir", 'b', "Basedir for tests.", &opt_basedir,
+   &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"character-sets-dir", OPT_CHARSETS_DIR,
-   "Directory for character set files.", (uchar**) &opt_charsets_dir,
-   (uchar**) &opt_charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Directory for character set files.", &opt_charsets_dir,
+   &opt_charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"compress", 'C', "Use the compressed server/client protocol.",
-   (uchar**) &opt_compress, (uchar**) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
   {"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.",
-   (uchar**) &cursor_protocol, (uchar**) &cursor_protocol, 0,
+   &cursor_protocol, &cursor_protocol, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"database", 'D', "Database to use.", (uchar**) &opt_db, (uchar**) &opt_db, 0,
+  {"database", 'D', "Database to use.", &opt_db, &opt_db, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef DBUG_OFF
   {"debug", '#', "This is a non-debug version. Catch this and exit",
@@ -5909,28 +5909,28 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
-   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   &debug_check_flag, &debug_check_flag, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
-   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   &debug_info_flag, &debug_info_flag,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"host", 'h', "Connect to host.", (uchar**) &opt_host, (uchar**) &opt_host, 0,
+  {"host", 'h', "Connect to host.", &opt_host, &opt_host, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"include", 'i', "Include SQL before each test case.", (uchar**) &opt_include,
-   (uchar**) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"logdir", OPT_LOG_DIR, "Directory for log files", (uchar**) &opt_logdir,
-   (uchar**) &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"include", 'i', "Include SQL before each test case.", &opt_include,
+   &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"logdir", OPT_LOG_DIR, "Directory for log files", &opt_logdir,
+   &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"mark-progress", OPT_MARK_PROGRESS,
    "Write line number and elapsed time to <testname>.progress.",
-   (uchar**) &opt_mark_progress, (uchar**) &opt_mark_progress, 0,
+   &opt_mark_progress, &opt_mark_progress, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"max-connect-retries", OPT_MAX_CONNECT_RETRIES,
    "Maximum number of attempts to connect to server.",
-   (uchar**) &opt_max_connect_retries, (uchar**) &opt_max_connect_retries, 0,
+   &opt_max_connect_retries, &opt_max_connect_retries, 0,
    GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
   {"max-connections", OPT_MAX_CONNECTIONS,
    "Max number of open connections to server",
-   (uchar**) &opt_max_connections, (uchar**) &opt_max_connections, 0,
+   &opt_max_connections, &opt_max_connections, 0,
    GET_INT, REQUIRED_ARG, 128, 8, 5120, 0, 0, 0},
   {"password", 'p', "Password to use when connecting to server.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -5940,18 +5940,17 @@ static struct my_option my_long_options[] =
    "/etc/services, "
 #endif
    "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
-   (uchar**) &opt_port,
-   (uchar**) &opt_port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   &opt_port, &opt_port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"ps-protocol", OPT_PS_PROTOCOL, 
    "Use prepared-statement protocol for communication.",
-   (uchar**) &ps_protocol, (uchar**) &ps_protocol, 0,
+   &ps_protocol, &ps_protocol, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"quiet", 's', "Suppress all normal output.", (uchar**) &silent,
-   (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"quiet", 's', "Suppress all normal output.", &silent,
+   &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"record", 'r', "Record output of test_file into result file.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"result-file", 'R', "Read/store result from/in this file.",
-   (uchar**) &result_file_name, (uchar**) &result_file_name, 0,
+   &result_file_name, &result_file_name, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"result-format-version", OPT_RESULT_FORMAT_VERSION,
    "Version of the result file format to use",
@@ -5963,27 +5962,27 @@ static struct my_option my_long_options[] =
   {"server-file", 'F', "Read embedded server arguments from file.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
-   "Base name of shared memory.", (uchar**) &shared_memory_base_name, 
-   (uchar**) &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 
+   "Base name of shared memory.", &shared_memory_base_name, 
+   &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 
    0, 0, 0},
   {"silent", 's', "Suppress all normal output. Synonym for --quiet.",
-   (uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   &silent, &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
    "Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG,
    0, 0, 0, 0, 0, 0},
   {"sleep", 'T', "Always sleep this many seconds on sleep commands.",
-   (uchar**) &opt_sleep, (uchar**) &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, -1, 0,
+   &opt_sleep, &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, -1, 0,
    0, 0, 0},
   {"socket", 'S', "The socket file to use for connection.",
-   (uchar**) &unix_sock, (uchar**) &unix_sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+   &unix_sock, &unix_sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
    0, 0, 0},
   {"sp-protocol", OPT_SP_PROTOCOL, "Use stored procedures for select.",
-   (uchar**) &sp_protocol, (uchar**) &sp_protocol, 0,
+   &sp_protocol, &sp_protocol, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 #include "sslopt-longopts.h"
   {"tail-lines", OPT_TAIL_LINES,
    "Number of lines of the result to include in a failure report.",
-   (uchar**) &opt_tail_lines, (uchar**) &opt_tail_lines, 0,
+   &opt_tail_lines, &opt_tail_lines, 0,
    GET_INT, REQUIRED_ARG, 0, 0, 10000, 0, 0, 0},
   {"test-file", 'x', "Read test from/in this file (default stdin).",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -5991,14 +5990,14 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"tmpdir", 't', "Temporary directory where sockets are put.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"user", 'u', "User for login.", (uchar**) &opt_user, (uchar**) &opt_user, 0,
+  {"user", 'u', "User for login.", &opt_user, &opt_user, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"verbose", 'v', "Write more.", (uchar**) &verbose, (uchar**) &verbose, 0,
+  {"verbose", 'v', "Write more.", &verbose, &verbose, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V', "Output version information and exit.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"view-protocol", OPT_VIEW_PROTOCOL, "Use views for select.",
-   (uchar**) &view_protocol, (uchar**) &view_protocol, 0,
+   &view_protocol, &view_protocol, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"connect_timeout", OPT_CONNECT_TIMEOUT,
    "Number of seconds before connection timeout.",
diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake
index 2bf9b561bba..b101c26e241 100644
--- a/cmake/ssl.cmake
+++ b/cmake/ssl.cmake
@@ -25,7 +25,7 @@ MACRO (MYSQL_USE_BUNDLED_SSL)
   SET(SSL_LIBRARIES  yassl taocrypt)
   SET(SSL_INCLUDE_DIRS ${INC_DIRS})
   SET(SSL_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
-  SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL")
+  SET(SSL_DEFINES"-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL -DYASSL_THREAD_SAFE")
   CHANGE_SSL_SETTINGS("bundled")
   #Remove -fno-implicit-templates 
   #(yassl sources cannot  be compiled with  it)
diff --git a/config/ac-macros/ssl.m4 b/config/ac-macros/ssl.m4
index 729115ffe88..fc55f93d8d6 100644
--- a/config/ac-macros/ssl.m4
+++ b/config/ac-macros/ssl.m4
@@ -38,11 +38,20 @@ AC_DEFUN([MYSQL_USE_BUNDLED_YASSL], [
   esac
   AC_SUBST([yassl_taocrypt_extra_cxxflags])
 
+  # Thread safe check
+  yassl_thread_cxxflags=""
+  yassl_thread_safe=""
+  if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no"; then
+    yassl_thread_cxxflags="-DYASSL_THREAD_SAFE"
+    yassl_thread_safe="(thread-safe)"
+  fi
+  AC_SUBST([yassl_thread_cxxflags])
+
   # Link extra/yassl/include/openssl subdir to include/
   yassl_h_ln_cmd="\$(LN) -s \$(top_srcdir)/extra/yassl/include/openssl openssl"
   AC_SUBST(yassl_h_ln_cmd)
 
-  AC_MSG_RESULT([using bundled yaSSL])
+  AC_MSG_RESULT([using bundled yaSSL $yassl_thread_safe])
 ])
 
 
diff --git a/configure.in b/configure.in
index b446edb10fe..5de43fc7951 100644
--- a/configure.in
+++ b/configure.in
@@ -844,8 +844,8 @@ AC_TYPE_SIZE_T
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h ieeefp.h limits.h \
- memory.h pwd.h select.h poll.h \
+AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h fpu_control.h \
+ ieeefp.h limits.h memory.h pwd.h select.h poll.h \
  stdlib.h stddef.h \
  strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
  sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
diff --git a/extra/comp_err.c b/extra/comp_err.c
index 362533d9781..53d8c18262b 100644
--- a/extra/comp_err.c
+++ b/extra/comp_err.c
@@ -99,31 +99,29 @@ static struct my_option my_long_options[]=
   {"debug", '#', "This is a non-debug version. Catch this and exit",
    0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #else
-  {"debug", '#', "Output debug log", (uchar**) & default_dbug_option,
-   (uchar**) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug", '#', "Output debug log", &default_dbug_option,
+   &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) & info_flag,
-   (uchar**) & info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", 'T', "Print some debug info at exit.", &info_flag,
+   &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V', "Prints version", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"charset", 'C', "Charset dir", (uchar**) & charsets_dir,
-   (uchar**) & charsets_dir,
+  {"charset", 'C', "Charset dir", &charsets_dir, &charsets_dir,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"in_file", 'F', "Input file", (uchar**) & TXTFILE, (uchar**) & TXTFILE,
+  {"in_file", 'F', "Input file", &TXTFILE, &TXTFILE,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"out_dir", 'D', "Output base directory", (uchar**) & DATADIRECTORY,
-   (uchar**) & DATADIRECTORY,
+  {"out_dir", 'D', "Output base directory", &DATADIRECTORY, &DATADIRECTORY,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"out_file", 'O', "Output filename (errmsg.sys)", (uchar**) & OUTFILE,
-   (uchar**) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"header_file", 'H', "mysqld_error.h file ", (uchar**) & HEADERFILE,
-   (uchar**) & HEADERFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"name_file", 'N', "mysqld_ername.h file ", (uchar**) & NAMEFILE,
-   (uchar**) & NAMEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"state_file", 'S', "sql_state.h file", (uchar**) & STATEFILE,
-   (uchar**) & STATEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"out_file", 'O', "Output filename (errmsg.sys)", &OUTFILE,
+   &OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"header_file", 'H', "mysqld_error.h file ", &HEADERFILE,
+   &HEADERFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"name_file", 'N', "mysqld_ername.h file ", &NAMEFILE,
+   &NAMEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"state_file", 'S', "sql_state.h file", &STATEFILE,
+   &STATEFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index 2614946a712..9595e1b2df8 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -46,31 +46,36 @@ static struct my_option my_long_options[] =
       searched for a file of this name (and standard filename extensions are
       added if the file has no extension)
   */
-  {"config-file", 'c', "Deprecated, please use --defaults-file instead.  Name of config file to read; if no extension is given, default extension (e.g., .ini or .cnf) will be added",
-   (uchar**) &config_file, (uchar**) &config_file, 0, GET_STR, REQUIRED_ARG,
+  {"config-file", 'c', "Deprecated, please use --defaults-file instead. "
+   "Name of config file to read; if no extension is given, default "
+   "extension (e.g., .ini or .cnf) will be added",
+   &config_file, &config_file, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
 #ifdef DBUG_OFF
   {"debug", '#', "This is a non-debug version. Catch this and exit",
    0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #else
-  {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
-   (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug", '#', "Output debug log", &default_dbug_option,
+   &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"defaults-file", 'c', "Like --config-file, except: if first option, then read this file only, do not read global or per-user config files; should be the first option",
-   (uchar**) &config_file, (uchar**) &config_file, 0, GET_STR, REQUIRED_ARG,
+  {"defaults-file", 'c', "Like --config-file, except: if first option, "
+   "then read this file only, do not read global or per-user config "
+   "files; should be the first option",
+   &config_file, &config_file, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
   {"defaults-extra-file", 'e',
-   "Read this file after the global config file and before the config file in the users home directory; should be the first option",
-   (uchar**) &my_defaults_extra_file, (uchar**) &my_defaults_extra_file, 0,
+   "Read this file after the global config file and before the config "
+   "file in the users home directory; should be the first option",
+   &my_defaults_extra_file, &my_defaults_extra_file, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"defaults-group-suffix", 'g',
    "In addition to the given groups, read also groups with this suffix",
-   (uchar**) &my_defaults_group_suffix, (uchar**) &my_defaults_group_suffix,
+   &my_defaults_group_suffix, &my_defaults_group_suffix,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"extra-file", 'e',
    "Deprecated. Synonym for --defaults-extra-file.",
-   (uchar**) &my_defaults_extra_file,
-   (uchar**) &my_defaults_extra_file, 0, GET_STR,
+   &my_defaults_extra_file,
+   &my_defaults_extra_file, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"no-defaults", 'n', "Return an empty string (useful for scripts).",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c
index 42465998862..e5c06ac9857 100644
--- a/extra/mysql_waitpid.c
+++ b/extra/mysql_waitpid.c
@@ -38,7 +38,7 @@ static struct my_option my_long_options[] =
    0, 0, 0, 0, 0},
   {"verbose", 'v',
    "Be more verbose. Give a warning, if kill can't handle signal 0.", 
-   (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   &verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V', "Print version information and exit.", 0, 0, 0,
    GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
diff --git a/extra/perror.c b/extra/perror.c
index eda0253129d..be9a47d63a4 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -60,18 +60,18 @@ static struct my_option my_long_options[] =
   {"info", 'I', "Synonym for --help.",  0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
-  {"ndb", 257, "Ndbcluster storage engine specific error codes.",  (uchar**) &ndb_code,
-   (uchar**) &ndb_code, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"ndb", 257, "Ndbcluster storage engine specific error codes.", &ndb_code,
+   &ndb_code, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
 #ifdef HAVE_SYS_ERRLIST
   {"all", 'a', "Print all the error messages and the number.",
-   (uchar**) &print_all_codes, (uchar**) &print_all_codes, 0, GET_BOOL, NO_ARG,
+   &print_all_codes, &print_all_codes, 0, GET_BOOL, NO_ARG,
    0, 0, 0, 0, 0, 0},
 #endif
   {"silent", 's', "Only print the error message.", 0, 0, 0, GET_NO_ARG, NO_ARG,
    0, 0, 0, 0, 0, 0},
-  {"verbose", 'v', "Print error code and message (default).", (uchar**) &verbose,
-   (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+  {"verbose", 'v', "Print error code and message (default).", &verbose,
+   &verbose, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
   {"version", 'V', "Displays version information and exits.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c
index 447d63890bd..4faca1653b2 100644
--- a/extra/resolve_stack_dump.c
+++ b/extra/resolve_stack_dump.c
@@ -53,10 +53,10 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V', "Output version information and exit.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"symbols-file", 's', "Use specified symbols file.", (uchar**) &sym_fname,
-   (uchar**) &sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"symbols-file", 's', "Use specified symbols file.", &sym_fname,
+   &sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"numeric-dump-file", 'n', "Read the dump from specified file.",
-   (uchar**) &dump_fname, (uchar**) &dump_fname, 0, GET_STR, REQUIRED_ARG,
+   &dump_fname, &dump_fname, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/extra/resolveip.c b/extra/resolveip.c
index 5f2a9269f62..90fda977848 100644
--- a/extra/resolveip.c
+++ b/extra/resolveip.c
@@ -45,7 +45,7 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"info", 'I', "Synonym for --help.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"silent", 's', "Be more silent.", (uchar**) &silent, (uchar**) &silent,
+  {"silent", 's', "Be more silent.", &silent, &silent,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V', "Displays version information and exits.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/extra/yassl/certs/ca-cert.pem b/extra/yassl/certs/ca-cert.pem
index 981dd004fc6..e353d118712 100644
--- a/extra/yassl/certs/ca-cert.pem
+++ b/extra/yassl/certs/ca-cert.pem
@@ -5,49 +5,49 @@ Certificate:
         Signature Algorithm: md5WithRSAEncryption
         Issuer: C=US, ST=Oregon, L=Portland, O=sawtooth, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
         Validity
-            Not Before: Jan 18 20:12:32 2005 GMT
-            Not After : Oct 15 20:12:32 2007 GMT
+            Not Before: Mar  7 03:10:11 2005 GMT
+            Not After : Apr  1 03:10:11 2046 GMT
         Subject: C=US, ST=Oregon, L=Portland, O=sawtooth, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
         Subject Public Key Info:
             Public Key Algorithm: rsaEncryption
             RSA Public Key: (512 bit)
                 Modulus (512 bit):
-                    00:cf:2b:14:00:b0:3c:df:6f:9e:91:40:ec:c8:f6:
-                    90:b2:5b:b4:70:80:a5:a4:0a:73:c7:44:f3:2a:26:
-                    c4:2f:f1:3a:f1:c3:c4:ac:fc:c3:d2:c3:bf:f5:d7:
-                    6a:38:42:ad:22:ab:c8:c4:4b:4c:1d:16:af:05:34:
-                    7d:79:97:5e:e1
+                    00:ef:c1:e3:9a:3c:6e:6e:cb:26:6f:05:be:e0:cb:
+                    57:a0:4b:68:e6:1b:f9:95:db:01:92:aa:6e:a6:b5:
+                    2d:b1:2b:50:fd:db:13:f2:c5:d8:b8:4f:75:28:53:
+                    72:e8:e5:11:9d:bb:c3:4f:4f:09:fd:4c:e7:46:d5:
+                    1d:bb:35:02:af
                 Exponent: 65537 (0x10001)
         X509v3 extensions:
             X509v3 Subject Key Identifier: 
-                CB:0F:1F:E9:A2:76:71:C9:E6:E8:23:A6:C1:18:B7:CC:44:CF:B9:84
+                1D:EF:A1:B8:81:78:12:47:E8:57:06:08:74:18:F7:D3:AA:D8:F7:BD
             X509v3 Authority Key Identifier: 
-                keyid:CB:0F:1F:E9:A2:76:71:C9:E6:E8:23:A6:C1:18:B7:CC:44:CF:B9:84
+                keyid:1D:EF:A1:B8:81:78:12:47:E8:57:06:08:74:18:F7:D3:AA:D8:F7:BD
                 DirName:/C=US/ST=Oregon/L=Portland/O=sawtooth/CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
                 serial:00
 
             X509v3 Basic Constraints: 
                 CA:TRUE
     Signature Algorithm: md5WithRSAEncryption
-        27:f7:3d:fb:39:6f:73:a4:86:f3:a0:48:22:60:84:e9:5c:3d:
-        28:36:05:16:44:98:07:87:e1:5d:b5:f3:a7:bc:33:5f:f4:29:
-        a9:5f:87:33:df:e6:8e:bd:e2:f3:0a:c8:00:69:ae:3d:41:47:
-        03:ea:0b:4c:67:45:4b:ab:f3:39
+        d9:77:e3:07:d9:2e:ec:2f:9b:8e:9e:ca:b4:00:0b:ef:c7:74:
+        cb:f4:f6:44:2f:02:75:17:a5:74:3e:26:b2:26:fd:1f:ab:3a:
+        df:d5:e3:05:14:08:d0:8c:1d:c9:3e:e1:59:6f:b3:38:5d:af:
+        78:60:e3:c5:6a:69:96:80:7d:00
 -----BEGIN CERTIFICATE-----
 MIIC7zCCApmgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBiTELMAkGA1UEBhMCVVMx
 DzANBgNVBAgTBk9yZWdvbjERMA8GA1UEBxMIUG9ydGxhbmQxETAPBgNVBAoTCHNh
 d3Rvb3RoMSQwIgYDVQQDExt3d3cuc2F3dG9vdGgtY29uc3VsdGluZy5jb20xHTAb
-BgkqhkiG9w0BCQEWDmluZm9AeWFzc2wuY29tMB4XDTA1MDExODIwMTIzMloXDTA3
-MTAxNTIwMTIzMlowgYkxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIEwZPcmVnb24xETAP
+BgkqhkiG9w0BCQEWDmluZm9AeWFzc2wuY29tMB4XDTA1MDMwNzAzMTAxMVoXDTQ2
+MDQwMTAzMTAxMVowgYkxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIEwZPcmVnb24xETAP
 BgNVBAcTCFBvcnRsYW5kMREwDwYDVQQKEwhzYXd0b290aDEkMCIGA1UEAxMbd3d3
 LnNhd3Rvb3RoLWNvbnN1bHRpbmcuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlh
-c3NsLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDPKxQAsDzfb56RQOzI9pCy
-W7RwgKWkCnPHRPMqJsQv8Trxw8Ss/MPSw7/112o4Qq0iq8jES0wdFq8FNH15l17h
-AgMBAAGjgekwgeYwHQYDVR0OBBYEFMsPH+midnHJ5ugjpsEYt8xEz7mEMIG2BgNV
-HSMEga4wgauAFMsPH+midnHJ5ugjpsEYt8xEz7mEoYGPpIGMMIGJMQswCQYDVQQG
+c3NsLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDvweOaPG5uyyZvBb7gy1eg
+S2jmG/mV2wGSqm6mtS2xK1D92xPyxdi4T3UoU3Lo5RGdu8NPTwn9TOdG1R27NQKv
+AgMBAAGjgekwgeYwHQYDVR0OBBYEFB3vobiBeBJH6FcGCHQY99Oq2Pe9MIG2BgNV
+HSMEga4wgauAFB3vobiBeBJH6FcGCHQY99Oq2Pe9oYGPpIGMMIGJMQswCQYDVQQG
 EwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDERMA8GA1UE
 ChMIc2F3dG9vdGgxJDAiBgNVBAMTG3d3dy5zYXd0b290aC1jb25zdWx0aW5nLmNv
 bTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb22CAQAwDAYDVR0TBAUwAwEB
-/zANBgkqhkiG9w0BAQQFAANBACf3Pfs5b3OkhvOgSCJghOlcPSg2BRZEmAeH4V21
-86e8M1/0KalfhzPf5o694vMKyABprj1BRwPqC0xnRUur8zk=
+/zANBgkqhkiG9w0BAQQFAANBANl34wfZLuwvm46eyrQAC+/HdMv09kQvAnUXpXQ+
+JrIm/R+rOt/V4wUUCNCMHck+4Vlvszhdr3hg48VqaZaAfQA=
 -----END CERTIFICATE-----
diff --git a/extra/yassl/certs/client-cert.der b/extra/yassl/certs/client-cert.der
index b28e2753376..c2a75119e54 100644
Binary files a/extra/yassl/certs/client-cert.der and b/extra/yassl/certs/client-cert.der differ
diff --git a/extra/yassl/certs/client-cert.pem b/extra/yassl/certs/client-cert.pem
index 81110f17252..4d2bbff7ca5 100644
--- a/extra/yassl/certs/client-cert.pem
+++ b/extra/yassl/certs/client-cert.pem
@@ -5,8 +5,8 @@ Certificate:
         Signature Algorithm: md5WithRSAEncryption
         Issuer: C=US, ST=Oregon, L=Portland, O=yaSSL, CN=www.yassl.com/emailAddress=info@yassl.com
         Validity
-            Not Before: Jan 18 19:33:15 2005 GMT
-            Not After : Oct 15 19:33:15 2007 GMT
+            Not Before: Mar  7 03:00:31 2005 GMT
+            Not After : Apr  1 03:00:31 2046 GMT
         Subject: C=US, ST=Oregon, L=Portland, O=yaSSL, CN=www.yassl.com/emailAddress=info@yassl.com
         Subject Public Key Info:
             Public Key Algorithm: rsaEncryption
@@ -29,15 +29,15 @@ Certificate:
             X509v3 Basic Constraints: 
                 CA:TRUE
     Signature Algorithm: md5WithRSAEncryption
-        c5:82:26:0c:1f:61:01:14:b0:ce:18:99:64:91:0e:f1:f8:90:
-        3e:a3:0e:be:38:7c:97:ba:05:c9:2a:dc:dd:62:2d:12:61:79:
-        7a:86:b1:97:5d:1e:e8:f7:e8:32:34:f7:8f:b1:08:3d:13:71:
-        a6:3c:15:91:85:12:35:6e:78:87
+        59:19:ae:1b:4e:65:9e:ca:f1:b8:3d:ff:c7:5e:15:86:10:97:
+        8c:3e:22:32:ab:4e:75:a7:70:83:f2:fb:2f:af:fe:26:28:e9:
+        4f:d4:c9:49:7c:6f:51:7e:2a:ff:a0:5b:25:45:2e:66:d9:0d:
+        92:94:e5:b8:60:c6:67:1a:f3:03
 -----BEGIN CERTIFICATE-----
 MIICtzCCAmGgAwIBAgIBADANBgkqhkiG9w0BAQQFADB4MQswCQYDVQQGEwJVUzEP
 MA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDEOMAwGA1UEChMFeWFT
 U0wxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkqhkiG9w0BCQEWDmluZm9A
-eWFzc2wuY29tMB4XDTA1MDExODE5MzMxNVoXDTA3MTAxNTE5MzMxNVoweDELMAkG
+eWFzc2wuY29tMB4XDTA1MDMwNzAzMDAzMVoXDTQ2MDQwMTAzMDAzMVoweDELMAkG
 A1UEBhMCVVMxDzANBgNVBAgTBk9yZWdvbjERMA8GA1UEBxMIUG9ydGxhbmQxDjAM
 BgNVBAoTBXlhU1NMMRYwFAYDVQQDEw13d3cueWFzc2wuY29tMR0wGwYJKoZIhvcN
 AQkBFg5pbmZvQHlhc3NsLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDNH3hH
@@ -47,6 +47,6 @@ wP/OtbStMIGiBgNVHSMEgZowgZeAFK4lXvpNo1srh97xKvVCwP/OtbStoXykejB4
 MQswCQYDVQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFu
 ZDEOMAwGA1UEChMFeWFTU0wxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkq
 hkiG9w0BCQEWDmluZm9AeWFzc2wuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZI
-hvcNAQEEBQADQQDFgiYMH2EBFLDOGJlkkQ7x+JA+ow6+OHyXugXJKtzdYi0SYXl6
-hrGXXR7o9+gyNPePsQg9E3GmPBWRhRI1bniH
+hvcNAQEEBQADQQBZGa4bTmWeyvG4Pf/HXhWGEJeMPiIyq051p3CD8vsvr/4mKOlP
+1MlJfG9Rfir/oFslRS5m2Q2SlOW4YMZnGvMD
 -----END CERTIFICATE-----
diff --git a/extra/yassl/certs/dsa-cert.pem b/extra/yassl/certs/dsa-cert.pem
index ecca18dae82..788d263bb9f 100644
--- a/extra/yassl/certs/dsa-cert.pem
+++ b/extra/yassl/certs/dsa-cert.pem
@@ -5,8 +5,8 @@ Certificate:
         Signature Algorithm: dsaWithSHA1
         Issuer: C=US, ST=Oregon, L=Portland, O=yaSSL DSA, CN=yaSSL DSA/emailAddress=info@yassl.com
         Validity
-            Not Before: Jan 23 22:54:51 2005 GMT
-            Not After : Oct 20 22:54:51 2007 GMT
+            Not Before: Mar  7 03:22:00 2005 GMT
+            Not After : Apr  1 03:22:00 2046 GMT
         Subject: C=US, ST=Oregon, L=Portland, O=yaSSL DSA, CN=yaSSL DSA/emailAddress=info@yassl.com
         Subject Public Key Info:
             Public Key Algorithm: dsaEncryption
@@ -43,14 +43,14 @@ Certificate:
             X509v3 Basic Constraints: 
                 CA:TRUE
     Signature Algorithm: dsaWithSHA1
-        30:2b:02:14:74:46:9f:91:7b:24:17:3b:ee:0f:10:e3:76:62:
-        f4:dc:81:e6:fd:fe:02:13:08:f4:87:0a:ab:ba:9c:de:3a:69:
-        72:59:b8:ec:e9:57:f4:bf:37
+        30:2c:02:14:7e:5e:94:fc:7f:ca:81:ab:b3:32:f7:21:83:48:
+        48:5f:0a:f1:13:ca:02:14:73:54:32:14:51:22:bf:0b:ec:d7:
+        6a:6a:fa:a7:1d:46:b4:c2:a3:b5
 -----BEGIN CERTIFICATE-----
-MIIDMTCCAvKgAwIBAgIBADAJBgcqhkjOOAQDMHgxCzAJBgNVBAYTAlVTMQ8wDQYD
+MIIDMjCCAvKgAwIBAgIBADAJBgcqhkjOOAQDMHgxCzAJBgNVBAYTAlVTMQ8wDQYD
 VQQIEwZPcmVnb24xETAPBgNVBAcTCFBvcnRsYW5kMRIwEAYDVQQKEwl5YVNTTCBE
 U0ExEjAQBgNVBAMTCXlhU1NMIERTQTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5YXNz
-bC5jb20wHhcNMDUwMTIzMjI1NDUxWhcNMDcxMDIwMjI1NDUxWjB4MQswCQYDVQQG
+bC5jb20wHhcNMDUwMzA3MDMyMjAwWhcNNDYwNDAxMDMyMjAwWjB4MQswCQYDVQQG
 EwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDESMBAGA1UE
 ChMJeWFTU0wgRFNBMRIwEAYDVQQDEwl5YVNTTCBEU0ExHTAbBgkqhkiG9w0BCQEW
 DmluZm9AeWFzc2wuY29tMIHwMIGoBgcqhkjOOAQBMIGcAkEAmSlpgMk8mGhFqYL+
@@ -63,6 +63,6 @@ IeRhRHPp4jCBogYDVR0jBIGaMIGXgBS++Yxd1hy07oHdNlYKIeRhRHPp4qF8pHow
 eDELMAkGA1UEBhMCVVMxDzANBgNVBAgTBk9yZWdvbjERMA8GA1UEBxMIUG9ydGxh
 bmQxEjAQBgNVBAoTCXlhU1NMIERTQTESMBAGA1UEAxMJeWFTU0wgRFNBMR0wGwYJ
 KoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbYIBADAMBgNVHRMEBTADAQH/MAkGByqG
-SM44BAMDLgAwKwIUdEafkXskFzvuDxDjdmL03IHm/f4CEwj0hwqrupzeOmlyWbjs
-6Vf0vzc=
+SM44BAMDLwAwLAIUfl6U/H/KgauzMvchg0hIXwrxE8oCFHNUMhRRIr8L7Ndqavqn
+HUa0wqO1
 -----END CERTIFICATE-----
diff --git a/extra/yassl/certs/server-cert.pem b/extra/yassl/certs/server-cert.pem
index 403dabdf5fa..30608f5f65b 100644
--- a/extra/yassl/certs/server-cert.pem
+++ b/extra/yassl/certs/server-cert.pem
@@ -5,8 +5,8 @@ Certificate:
         Signature Algorithm: md5WithRSAEncryption
         Issuer: C=US, ST=Oregon, L=Portland, O=sawtooth, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
         Validity
-            Not Before: Jan 18 20:50:59 2005 GMT
-            Not After : Oct 15 20:50:59 2007 GMT
+            Not Before: Mar  8 03:00:47 2005 GMT
+            Not After : Apr  2 03:00:47 2046 GMT
         Subject: C=US, ST=Oregon, L=Portland, O=taoSoftDev, CN=www.taosoftdev.com/emailAddress=info@yassl.com
         Subject Public Key Info:
             Public Key Algorithm: rsaEncryption
@@ -19,20 +19,20 @@ Certificate:
                     f2:25:93:22:e7
                 Exponent: 65537 (0x10001)
     Signature Algorithm: md5WithRSAEncryption
-        08:36:07:8c:3a:7f:f9:91:0a:82:d1:6a:c1:34:be:bc:2d:b2:
-        20:98:dc:45:50:53:9c:66:e6:26:71:bd:fa:d2:b4:91:d3:53:
-        c0:20:05:c0:b6:84:9a:5f:3f:61:75:f5:fd:c6:ec:e2:f6:9f:
-        a2:13:17:a9:b7:83:60:cc:cb:eb
+        36:72:12:3b:ac:e4:58:83:09:86:4f:71:2a:3a:0d:8a:05:27:
+        75:f3:3e:62:4f:ab:b8:70:20:cd:ad:70:ab:91:11:68:f8:82:
+        33:e2:78:85:a8:16:f5:66:bd:68:2c:5a:26:15:12:1e:6e:83:
+        c7:6d:62:b9:c3:ff:e1:86:e4:e6
 -----BEGIN CERTIFICATE-----
 MIIB9zCCAaECAQEwDQYJKoZIhvcNAQEEBQAwgYkxCzAJBgNVBAYTAlVTMQ8wDQYD
 VQQIEwZPcmVnb24xETAPBgNVBAcTCFBvcnRsYW5kMREwDwYDVQQKEwhzYXd0b290
 aDEkMCIGA1UEAxMbd3d3LnNhd3Rvb3RoLWNvbnN1bHRpbmcuY29tMR0wGwYJKoZI
-hvcNAQkBFg5pbmZvQHlhc3NsLmNvbTAeFw0wNTAxMTgyMDUwNTlaFw0wNzEwMTUy
-MDUwNTlaMIGCMQswCQYDVQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQH
+hvcNAQkBFg5pbmZvQHlhc3NsLmNvbTAeFw0wNTAzMDgwMzAwNDdaFw00NjA0MDIw
+MzAwNDdaMIGCMQswCQYDVQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQH
 EwhQb3J0bGFuZDETMBEGA1UEChMKdGFvU29mdERldjEbMBkGA1UEAxMSd3d3LnRh
 b3NvZnRkZXYuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTBcMA0G
 CSqGSIb3DQEBAQUAA0sAMEgCQQCkaLu8tydfPPV4xhqvuZX8fmEfqIEKykOImgPg
 0KZ5cBY0uXx1VMpwGWY4vm4ofqX/azyDLzlCwxXzvfIlkyLnAgMBAAEwDQYJKoZI
-hvcNAQEEBQADQQAINgeMOn/5kQqC0WrBNL68LbIgmNxFUFOcZuYmcb360rSR01PA
-IAXAtoSaXz9hdfX9xuzi9p+iExept4NgzMvr
+hvcNAQEEBQADQQA2chI7rORYgwmGT3EqOg2KBSd18z5iT6u4cCDNrXCrkRFo+IIz
+4niFqBb1Zr1oLFomFRIeboPHbWK5w//hhuTm
 -----END CERTIFICATE-----
diff --git a/extra/yassl/include/lock.hpp b/extra/yassl/include/lock.hpp
index 0525943e45d..99829b0b6de 100644
--- a/extra/yassl/include/lock.hpp
+++ b/extra/yassl/include/lock.hpp
@@ -23,13 +23,21 @@
 #ifndef yaSSL_LOCK_HPP
 #define yaSSL_LOCK_HPP
 
+/*
+  Visual Studio Source Annotations header (sourceannotations.h) fails
+  to compile if outside of the global namespace.
+*/
+#ifdef YASSL_THREAD_SAFE
+#ifdef _WIN32
+#include <windows.h>
+#endif
+#endif
 
 namespace yaSSL {
 
 
-#ifdef MULTI_THREADED
+#ifdef YASSL_THREAD_SAFE
     #ifdef _WIN32
-        #include <windows.h>
 
         class Mutex {
             CRITICAL_SECTION cs_;
@@ -69,7 +77,7 @@ namespace yaSSL {
         };
 
     #endif // _WIN32
-#else  // MULTI_THREADED (WE'RE SINGLE)
+#else  // YASSL_THREAD_SAFE (WE'RE SINGLE)
 
     class Mutex {
     public:
@@ -79,7 +87,7 @@ namespace yaSSL {
         };
     };
 
-#endif // MULTI_THREADED
+#endif // YASSL_THREAD_SAFE
 
 
 
diff --git a/extra/yassl/src/Makefile.am b/extra/yassl/src/Makefile.am
index 6efd2220c54..300cdcd096f 100644
--- a/extra/yassl/src/Makefile.am
+++ b/extra/yassl/src/Makefile.am
@@ -5,4 +5,4 @@ libyassl_la_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \
 	handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \
 	template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp
 EXTRA_DIST = $(wildcard ../include/*.hpp) $(wildcard ../include/openssl/*.h)
-AM_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX
+AM_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX @yassl_thread_cxxflags@
diff --git a/extra/yassl/src/lock.cpp b/extra/yassl/src/lock.cpp
index 6d8e9c17477..6e85fefa14d 100644
--- a/extra/yassl/src/lock.cpp
+++ b/extra/yassl/src/lock.cpp
@@ -26,7 +26,7 @@
 namespace yaSSL {
 
 
-#ifdef MULTI_THREADED
+#ifdef YASSL_THREAD_SAFE
     #ifdef _WIN32
         
         Mutex::Mutex()
@@ -79,7 +79,7 @@ namespace yaSSL {
          
 
     #endif // _WIN32
-#endif // MULTI_THREADED
+#endif // YASSL_THREAD_SAFE
 
 
 
diff --git a/extra/yassl/taocrypt/benchmark/Makefile.am b/extra/yassl/taocrypt/benchmark/Makefile.am
index f3f71379ff7..0171c7366bb 100644
--- a/extra/yassl/taocrypt/benchmark/Makefile.am
+++ b/extra/yassl/taocrypt/benchmark/Makefile.am
@@ -2,5 +2,5 @@ INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL
 noinst_PROGRAMS    = benchmark
 benchmark_SOURCES  = benchmark.cpp
 benchmark_LDADD    = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
-benchmark_CXXFLAGS = -DYASSL_PURE_C
+benchmark_CXXFLAGS = -DYASSL_PURE_C @yassl_thread_cxxflags@
 EXTRA_DIST = benchmark.dsp rsa1024.der dh1024.der dsa1024.der make.bat
diff --git a/extra/yassl/taocrypt/src/Makefile.am b/extra/yassl/taocrypt/src/Makefile.am
index c763d670928..a8d08b6e9d5 100644
--- a/extra/yassl/taocrypt/src/Makefile.am
+++ b/extra/yassl/taocrypt/src/Makefile.am
@@ -8,6 +8,7 @@ libtaocrypt_la_SOURCES  = aes.cpp aestables.cpp algebra.cpp arc4.cpp \
         random.cpp ripemd.cpp rsa.cpp sha.cpp template_instnt.cpp \
         tftables.cpp twofish.cpp
 
-libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C
+libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C \
+			  @yassl_thread_cxxflags@
 
 EXTRA_DIST = $(wildcard ../include/*.hpp)
diff --git a/extra/yassl/taocrypt/test/Makefile.am b/extra/yassl/taocrypt/test/Makefile.am
index 06b48cc42d5..38f04f1387f 100644
--- a/extra/yassl/taocrypt/test/Makefile.am
+++ b/extra/yassl/taocrypt/test/Makefile.am
@@ -2,5 +2,5 @@ INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL
 noinst_PROGRAMS = test
 test_SOURCES = test.cpp
 test_LDADD    = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
-test_CXXFLAGS = -DYASSL_PURE_C
+test_CXXFLAGS = -DYASSL_PURE_C @yassl_thread_cxxflags@
 EXTRA_DIST = make.bat
diff --git a/extra/yassl/taocrypt/test/memory.cpp b/extra/yassl/taocrypt/test/memory.cpp
index 726c9c0ef54..a879a497800 100644
--- a/extra/yassl/taocrypt/test/memory.cpp
+++ b/extra/yassl/taocrypt/test/memory.cpp
@@ -13,7 +13,7 @@
 To use MemoryTracker merely add this file to your project
 No need to instantiate anything
 
-If your app is multi threaded define MULTI_THREADED
+If your app is multi threaded define YASSL_THREAD_SAFE
 
 *********************************************************************/
 
diff --git a/extra/yassl/testsuite/Makefile.am b/extra/yassl/testsuite/Makefile.am
index 9c9ba9b375c..d74c972a084 100644
--- a/extra/yassl/testsuite/Makefile.am
+++ b/extra/yassl/testsuite/Makefile.am
@@ -4,7 +4,7 @@ testsuite_SOURCES  = testsuite.cpp ../taocrypt/test/test.cpp \
 	../examples/client/client.cpp ../examples/server/server.cpp \
 	../examples/echoclient/echoclient.cpp \
 	../examples/echoserver/echoserver.cpp
-testsuite_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX -DNO_MAIN_DRIVER
+testsuite_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX -DNO_MAIN_DRIVER @yassl_thread_cxxflags@
 testsuite_LDADD    = $(top_builddir)/extra/yassl/src/libyassl.la \
                      $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
 EXTRA_DIST = testsuite.dsp test.hpp input quit make.bat
diff --git a/include/my_getopt.h b/include/my_getopt.h
index 54ae5982ea1..5eb0004e9c3 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -64,8 +64,8 @@ struct my_option
                                            if it's NULL the option is not
                                            visible in --help.
                                          */
-  uchar      **value;                   /**< A pointer to the variable value */
-  uchar      **u_max_value;             /**< The user def. max variable value */
+  void       *value;                    /**< A pointer to the variable value */
+  void       *u_max_value;              /**< The user def. max variable value */
   struct st_typelib *typelib;           /**< Pointer to possible values */
   ulong     var_type;                   /**< GET_BOOL, GET_ULL, etc */
   enum get_opt_arg_type arg_type;       /**< e.g. REQUIRED_ARG or OPT_ARG */
@@ -77,8 +77,18 @@ struct my_option
   void       *app_type;                 /**< To be used by an application */
 };
 
-typedef my_bool (*my_get_one_option) (int, const struct my_option *, char * );
-typedef void (*my_error_reporter) (enum loglevel level, const char *format, ... );
+
+typedef my_bool (*my_get_one_option)(int, const struct my_option *, char *);
+typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...);
+/**
+  Used to retrieve a reference to the object (variable) that holds the value
+  for the given option. For example, if var_type is GET_UINT, the function
+  must return a pointer to a variable of type uint. A argument is stored in
+  the location pointed to by the returned pointer.
+*/
+typedef void *(*my_getopt_value)(const char *, uint, const struct my_option *,
+                                 int *);
+
 
 extern char *disabled_my_option;
 extern my_bool my_getopt_print_errors;
@@ -90,8 +100,7 @@ extern int handle_options (int *argc, char ***argv,
 extern void my_cleanup_options(const struct my_option *options);
 extern void my_print_help(const struct my_option *options);
 extern void my_print_variables(const struct my_option *options);
-extern void my_getopt_register_get_addr(uchar ** (*func_addr)(const char *, uint,
-                                        const struct my_option *, int *));
+extern void my_getopt_register_get_addr(my_getopt_value);
 
 ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
                                  my_bool *fix);
diff --git a/include/my_global.h b/include/my_global.h
index c21a8a1f9ea..7b9c34cd724 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -60,6 +60,10 @@
 #define USE_PRAGMA_INTERFACE
 #endif
 
+#if defined(__OpenBSD__) && (OpenBSD >= 200411)
+#define HAVE_ERRNO_AS_DEFINE
+#endif
+
 #if defined(i386) && !defined(__i386__)
 #define __i386__
 #endif
diff --git a/include/my_sys.h b/include/my_sys.h
index cca4d713ca6..29c78289a1b 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -54,7 +54,7 @@ extern int NEAR my_errno;		/* Last error in mysys */
 #include <malloc.h> /*for alloca*/
 #endif
 
-#define MY_INIT(name);		{ my_progname= name; my_init(); }
+#define MY_INIT(name)   { my_progname= name; my_init(); }
 
 /**
   Max length of an error message generated by mysys utilities.
diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h
index 151287e1718..5315b2e12b1 100644
--- a/include/sslopt-longopts.h
+++ b/include/sslopt-longopts.h
@@ -20,30 +20,30 @@
 
   {"ssl", OPT_SSL_SSL,
    "Enable SSL for connection (automatically enabled with other flags).",
- (uchar **) &opt_use_ssl, (uchar **) &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 0, 0, 0,
-   0, 0, 0},
+   &opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"ssl-ca", OPT_SSL_CA,
    "CA file in PEM format (check OpenSSL docs, implies --ssl).",
-   (uchar **) &opt_ssl_ca, (uchar **) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
+   &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
   {"ssl-capath", OPT_SSL_CAPATH,
    "CA directory (check OpenSSL docs, implies --ssl).",
-   (uchar **) &opt_ssl_capath, (uchar **) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
+   &opt_ssl_capath, &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
   {"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl).",
-   (uchar **) &opt_ssl_cert, (uchar **) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
+   &opt_ssl_cert, &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
   {"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use (implies --ssl).",
-   (uchar **) &opt_ssl_cipher, (uchar **) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
+   &opt_ssl_cipher, &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
   {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).",
-   (uchar **) &opt_ssl_key, (uchar **) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
+   &opt_ssl_key, &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
 #ifdef MYSQL_CLIENT
   {"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT,
-   "Verify server's \"Common Name\" in its cert against hostname used when connecting. This option is disabled by default.",
-   (uchar **) &opt_ssl_verify_server_cert, (uchar **) &opt_ssl_verify_server_cert,
-    0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
+   "Verify server's \"Common Name\" in its cert against hostname used "
+   "when connecting. This option is disabled by default.",
+   &opt_ssl_verify_server_cert, &opt_ssl_verify_server_cert,
+   0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
 #endif /* HAVE_OPENSSL */
 #endif /* SSLOPT_LONGOPTS_INCLUDED */
diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental
index 84fb2ac5e76..e58953c9e73 100644
--- a/mysql-test/collections/default.experimental
+++ b/mysql-test/collections/default.experimental
@@ -9,7 +9,6 @@ funcs_1.myisam_views @solaris            # Bug#50595 2010-03-05 alik funcs_1.myi
 innodb.innodb_information_schema         # Bug#48883 2010-05-11 alik Test "innodb_information_schema" takes fewer locks than expected
 
 main.func_math @freebsd                  # Bug#43020 2010-05-04 alik main.func_math fails on FreeBSD in PB2
-main.gis @solaris                        # Bug#52208 2010-04-26 alik gis fails on some platforms (Solaris, HP-UX, Linux)
 main.gis-rtree @freebsd                  # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
 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
@@ -25,6 +24,8 @@ main.sp @solaris                         # Bug#47791 2010-01-20 alik Several tes
 main.type_float @freebsd                 # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
 main.wait_timeout @solaris               # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris
 
+perfschema.pfs_upgrade                   # Bug#53102 2010-06-15 alik perfschema.pfs_upgrade fails on sol10 sparc64 max in parallel mode
+
 rpl.rpl_heartbeat_basic                  # BUG#43828 2009-10-22 luis fails sporadically
 rpl.rpl_heartbeat_2slaves                # BUG#43828 2009-10-22 luis fails sporadically
 rpl.rpl_innodb_bug28430*                 # Bug#46029
@@ -34,7 +35,7 @@ rpl.rpl_plugin_load*  @solaris           # Bug#47146
 rpl.rpl_row_sp011* @solaris              # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
 
 sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
-sys_vars.wait_timeout_func @solaris           # Bug#41255 2010-04-26 alik wait_timeout_func fails
+sys_vars.wait_timeout_func                    # Bug#41255 2010-04-26 alik wait_timeout_func fails
 
 # Declare all NDB-tests in ndb and rpl_ndb test suites experimental.
 # Usually the test cases from ndb and rpl_ndb test suites are not run in PB,
diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test
index b79093b6740..c6f9e928cc5 100644
--- a/mysql-test/extra/binlog_tests/binlog.test
+++ b/mysql-test/extra/binlog_tests/binlog.test
@@ -41,13 +41,10 @@ while ($1)
 --enable_query_log
 commit;
 drop table t1;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events in 'master-bin.000001' from 107;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
-show binlog events in 'master-bin.000002' from 107;
-
+--source include/show_binlog_events.inc
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--source include/show_binlog_events.inc
+--let $binlog_file=
 
 #
 # Bug#22540 - Incorrect value in column End_log_pos of
@@ -77,8 +74,7 @@ insert into t1 values (2);
 insert into t1 values (3);
 commit;
 drop table t1;
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
-show binlog events from 0;
+--source include/show_binlog_events.inc
 
 # now show that nothing breaks if we need to read from the cache more
 # than once, resulting in split event-headers
@@ -100,8 +96,7 @@ while ($1)
 commit;
 enable_query_log;
 
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
-show binlog events from 0;
+--source include/show_binlog_events.inc
 
 drop table t1;
 
@@ -122,8 +117,7 @@ set @b= 14632475938453979136;
 execute stmt using @a, @b;
 deallocate prepare stmt;
 drop table t1;
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
-show binlog events from 0;
+--source include/show_binlog_events.inc
 
 
 #
diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test
index 1bb30ab673c..c694c34622f 100644
--- a/mysql-test/extra/binlog_tests/blackhole.test
+++ b/mysql-test/extra/binlog_tests/blackhole.test
@@ -127,12 +127,7 @@ select * from t1;
 select * from t2;
 select * from t3;
 
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 4 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
---replace_regex /file_id=[0-9]+/file_id=#/
-show binlog events;
+--source include/show_binlog_events.inc
 
 drop table t1,t2,t3;
 
@@ -170,18 +165,21 @@ set autocommit=0;
 start transaction;
 insert into t1 values(1);
 commit;
+
+let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
+
 start transaction;
 insert into t1 values(2);
 rollback;
+
+let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
+if (`SELECT $master_log_pos_2 <> $master_log_pos_1`)
+{
+  echo $master_log_pos_1 $master_log_pos_2;
+  die Rollbacked transaction has been binlogged;
+}
+
 set autocommit=1;
-
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 4 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
---replace_regex /file_id=[0-9]+/file_id=#/
-show binlog events;
-
 drop table if exists t1;
 
 #
diff --git a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test
index 1b331cc948b..607348ae97b 100644
--- a/mysql-test/extra/rpl_tests/rpl_deadlock.test
+++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test
@@ -61,7 +61,7 @@ sync_with_master;
 SELECT * FROM t1;
 SELECT * FROM t3;
 # Check that no error is reported
---source include/show_slave_status2.inc
+source include/check_slave_is_running.inc;
 --echo
 
 # 2) Test lock wait timeout
@@ -89,7 +89,7 @@ sync_with_master;
 SELECT * FROM t1;
 SELECT * FROM t3;
 # Check that no error is reported
---source include/show_slave_status2.inc
+source include/check_slave_is_running.inc;
 --echo
 
 # 3) Test lock wait timeout and purged relay log
@@ -103,6 +103,7 @@ SET global max_relay_log_size=0;
 --source include/stop_slave.inc
 DELETE FROM t2;
 # Set slave position to the BEGIN log event
+--replace_result $master_pos_begin MASTER_POS_BEGIN
 eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin; 
 BEGIN;
 # Hold lock
@@ -119,7 +120,7 @@ sync_with_master;
 SELECT * FROM t1;
 SELECT * FROM t3;
 # Check that no error is reported
---source include/show_slave_status2.inc
+source include/check_slave_is_running.inc;
 --echo
 
 # Clean up
diff --git a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
index c426ac1fae8..d4310f50909 100644
--- a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
+++ b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
@@ -146,12 +146,7 @@ SELECT COUNT(*) FROM t1;
 --echo
 SELECT * FROM t1 ORDER BY f3 LIMIT 20;
 
---echo
---echo * Show Slave Status *
---echo
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical show slave status;
---echo
+--source include/check_slave_is_running.inc
 
 ### Altering table def scenario
 --echo
@@ -431,16 +426,14 @@ connection master;
    delete from t4;
    delete from t31;
 
---echo
---echo ** Check slave status **
---echo
 #connection slave;
    sync_slave_with_master;
    select * from t31;
 
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical show slave status;
+--echo
+--echo ** Check slave status **
+--echo
+--source include/check_slave_is_running.inc
 
 #### Clean Up ####
 
@@ -493,16 +486,15 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
 
 --echo
 --echo ********************************************
---echo *** Expect slave to fail with Error 1523 ***
+--echo *** Expect slave to fail with Error 1677 ***
 --echo ********************************************
 --echo
 connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+# 1677 = ER_SLAVE_CONVERSION_FAILED
+--let $slave_sql_errno= 1677
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
 
 --echo
 --echo *** Drop t10  ***
@@ -550,16 +542,15 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
 
 --echo
 --echo ********************************************
---echo *** Expect slave to fail with Error 1523 ***
+--echo *** Expect slave to fail with Error 1677 ***
 --echo ********************************************
 --echo
 connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+# 1677 = ER_SLAVE_CONVERSION_FAILED
+--let $slave_sql_errno= 1677
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
 
 --echo
 --echo *** Drop t11  ***
@@ -697,10 +688,10 @@ SELECT c1,c3,hex(c4),c5,c6 FROM t14 ORDER BY c1;
 # Remove below once fixed
 #***************************
 connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+# 1091 = ER_CANT_DROP_FIELD_OR_KEY
+--let $slave_sql_errno= 1091
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 #***************************
 
 STOP SLAVE;
@@ -763,10 +754,10 @@ SELECT c1,hex(c4),c5,c6,c7,c2 FROM t15 ORDER BY c1;
 --echo ********************************************
 --echo
 connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+# 1054 = ER_BAD_FIELD_ERROR
+--let $slave_sql_errno= 1054
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 STOP SLAVE;
 RESET SLAVE;
 
@@ -840,10 +831,10 @@ SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDER BY c1;
 --echo *****************
 --echo
 connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+# 1072 = ER_KEY_COLUMN_DOES_NOT_EXITS
+--let $slave_sql_errno= 1072
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 STOP SLAVE;
 RESET SLAVE;
 
diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
index 49f93a7394c..568cf802763 100644
--- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
+++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
@@ -101,9 +101,9 @@ SELECT * FROM t2 ORDER BY a;
 --echo *** Start Slave ***
 connection slave;
 START SLAVE;
-source include/wait_for_slave_sql_to_stop.inc;
---let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
---echo Slave failed with Error $errno
+--let $slave_sql_errno= 1677
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 STOP SLAVE;
 RESET SLAVE;
 SELECT * FROM t2 ORDER BY a;
@@ -153,11 +153,10 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST
 --echo *** Expect slave to fail with Error 1677 ***
 --echo ********************************************
 connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
---echo Slave failed with Error $errno
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_sql_errno= 1677
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
 
 --echo *** Drop t3  ***
 connection master;
@@ -197,11 +196,10 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
 --echo *** Expect slave to fail with Error 1677 ***
 --echo ********************************************
 connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
---echo Slave failed with Error $errno
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_sql_errno= 1677
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
 
 --echo *** Drop t4  ***
 connection master;
@@ -241,11 +239,10 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
 --echo *** Expect slave to fail with Error 1677 ***
 --echo ********************************************
 connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
---echo Slave failed with Error $errno
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_sql_errno= 1677
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
 
 --echo *** Drop t5  ***
 connection master;
@@ -286,9 +283,9 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
 --echo *** Expect slave to fail with Error 1677 ***
 --echo ********************************************
 connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
---echo Slave failed with Error $errno
+--let $slave_sql_errno= 1677
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
 #START SLAVE;
 
@@ -387,12 +384,10 @@ INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
 ### Uncomment once bug is fixed
 
 #connection slave;
-#wait_for_slave_to_stop;
-#--replace_result $MASTER_MYPORT MASTER_PORT
-#--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
-#--query_vertical SHOW SLAVE STATUS
-#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-#START SLAVE;
+#--let $slave_sql_errno= SOMETHING
+#--let $slave_skip_counter= 2
+#--let $show_slave_sql_error= 1
+#--source include/wait_for_slave_sql_error_and_skip.inc
 
 --echo *** Drop t8  ***
 connection master;
@@ -451,12 +446,10 @@ if (`SELECT $engine_type != 'NDB'`)
   # todo: fix Bug #43992 slave sql thread can't tune own sql_mode ...
   # and add/restore waiting for stop test
 
-  #--source include/wait_for_slave_sql_to_stop.inc
-  #--replace_result $MASTER_MYPORT MASTER_PORT
-  #--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
-  #--query_vertical SHOW SLAVE STATUS
-  #SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-  #START SLAVE;
+  #--let $slave_sql_errno= SOMETHING
+  #--let $slave_skip_counter= 2
+  #--let $show_slave_sql_error= 1
+  #--source include/wait_for_slave_sql_error_and_skip.inc
 }
 
 #--echo *** Drop t9  ***
@@ -494,11 +487,10 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
 --echo *** Expect slave to fail with Error 1677 ***
 --echo ********************************************
 connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
---echo Slave failed with Error $errno
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_sql_errno= 1677
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
 
 --echo *** Drop t10  ***
 connection master;
@@ -537,11 +529,10 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
 --echo *** Expect slave to fail with Error 1677 ***
 --echo ********************************************
 connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
---echo Slave failed with Error $errno
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_sql_errno= 1677
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
 
 --echo *** Drop t11  ***
 connection master;
@@ -808,11 +799,10 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
 --echo *** Expect slave to fail with Error 1060 ***
 --echo ********************************************
 connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
---echo Slave failed with Error $errno
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+--let $slave_sql_errno= 1060
+--let $slave_skip_counter= 1
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
 
 --echo *** Try to insert in master ****
 connection master;
@@ -918,11 +908,10 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
 --echo *** Expect slave to fail with Error 1677 ***
 --echo ********************************************
 connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
---echo Slave failed with Error $errno
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_sql_errno= 1677
+--let $slave_skip_counter= 2
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
 
 --echo ** DROP table t17 ***
 connection master;
diff --git a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
index 6de4a538e72..0a1a4503975 100644
--- a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
+++ b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
@@ -27,8 +27,8 @@ select * from t3;
 # This FLUSH should go into the binlog to not confuse the slave.
 flush tables;
 # Check that it's in the binlog.
-let $binlog_start= $rename_event_pos;
-source include/show_binlog_events.inc;
+let $wait_binlog_event= flush tables;
+source include/wait_for_binlog_event.inc;
 
 sync_slave_with_master;
 # Check that the slave is not confused.
diff --git a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
index c392686454d..66bd61a8ea9 100644
--- a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
+++ b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
@@ -68,19 +68,15 @@ eval SET DEBUG_SYNC=$debug_sync_action;
 
 # Show slave last IO errno
 connection slave;
-source include/wait_for_slave_io_error.inc;
-let $last_io_errno= query_get_value("show slave status", Last_IO_Errno, 1);
 --echo Check network error happened here
-if (`SELECT '$last_io_errno' = '2013' || # CR_SERVER_LOST
-            '$last_io_errno' = '2003' || # CR_CONN_HOST_ERROR
-            '$last_io_errno' = '2002' || # CR_CONNECTION_ERROR
-            '$last_io_errno' = '2006' || # CR_SERVER_GONE_ERROR
-            '$last_io_errno' = '1040' || # ER_CON_COUNT_ERROR
-            '$last_io_errno' = '1053'    # ER_SERVER_SHUTDOWN
-            `)
-{
-  --echo NETWORK ERROR
-}
+# '2013' CR_SERVER_LOST 
+# '2003' CR_CONN_HOST_ERROR 
+# '2002' CR_CONNECTION_ERROR 
+# '2006' CR_SERVER_GONE_ERROR 
+# '1040' ER_CON_COUNT_ERROR 
+# '1053' ER_SERVER_SHUTDOWN
+let $slave_io_errno= 1040, 1053, 2002, 2003, 2006, 2013;
+source include/wait_for_slave_io_error.inc;
 
 # deactivate the sync point of get_master_version_and_clock()
 # now to avoid restarting IO-thread to re-enter it.
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
index a6bf2b294d1..7fd3451184a 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
@@ -91,7 +91,7 @@ connection master;
 # Bug #29571: INSERT DELAYED IGNORE written to binary log on the master but
 # on the slave
 #
-if  (`SELECT @@global.binlog_format != 'ROW'`)
+if  (`SELECT @@global.binlog_format = 'STATEMENT'`)
 {
   #flush the logs before the test
   connection slave;
@@ -101,27 +101,42 @@ if  (`SELECT @@global.binlog_format != 'ROW'`)
 }
 
 CREATE TABLE t1(a int, UNIQUE(a));
+--let $_start= query_get_value(SHOW MASTER STATUS, Position, 1)
+
 INSERT DELAYED IGNORE INTO t1 VALUES(1);
 INSERT DELAYED IGNORE INTO t1 VALUES(1);
 flush table t1; # to wait for INSERT DELAYED to be done
-
-if  (`SELECT @@global.binlog_format != 'ROW'`)
+if  (`SELECT @@global.binlog_format = 'STATEMENT'`)
 {
   #must show two INSERT DELAYED
-  --replace_column 1 x 2 x 3 x 4 x 5 x
-  --replace_regex /table_id: [0-9]+/table_id: #/
-  show binlog events in 'master-bin.000002' LIMIT 2,2;
+  --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+
+  # The first INSERT DELAYED
+  --let $stmt= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $_start, Info, 2)
+  --echo $stmt
+
+# The second INSERT DELAYED statement is the 3 item if two INSERT DELAYED are
+# handled together
+  --let $stmt= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $_start, Info, 3)
+
+# The second INSERT DELAYED statement is the 5 item if two INSERT DELAYED are
+# handled separately
+  if (`SELECT '$stmt' = 'COMMIT'`)
+  {
+    --let $stmt= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $_start, Info, 5)
+  }
+  --echo $stmt
 }
 select * from t1;
 
 sync_slave_with_master;
 echo On slave;
-if  (`SELECT @@global.binlog_format != 'ROW'`)
+if  (`SELECT @@global.binlog_format = 'STATEMENT'`)
 {
   #must show two INSERT DELAYED
-  --replace_column 1 x 2 x 3 x 4 x 5 x
-  --replace_regex /table_id: [0-9]+/table_id: #/
-  show binlog events in 'slave-bin.000002' LIMIT 2,2;
+  --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+  --let $binlog_limit= 1,6
+  --source include/show_binlog_events.inc
 }
 select * from t1;
 
diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test
index 7efcb67b033..da251068ba1 100644
--- a/mysql-test/extra/rpl_tests/rpl_log.test
+++ b/mysql-test/extra/rpl_tests/rpl_log.test
@@ -31,19 +31,17 @@ eval create table t1 (word char(20) not null)ENGINE=$engine_type;
 --replace_result $LOAD_FILE LOAD_FILE
 eval load data infile '$LOAD_FILE' into table t1 ignore 1 lines;
 select count(*) from t1;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events;
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 107 limit 1;
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 107 limit 2;
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 107 limit 1,4;
+source include/show_binlog_events.inc;
+
+let $binlog_limit= 1;
+source include/show_binlog_events.inc;
+
+let $binlog_limit= 2;
+source include/show_binlog_events.inc;
+
+let $binlog_limit= 1,4;
+source include/show_binlog_events.inc;
+let $binlog_limit=;
 flush logs;
 
 # We need an extra update before doing save_master_pos.
@@ -84,27 +82,24 @@ connection master;
 eval create table t2 (n int)ENGINE=$engine_type;
 insert into t2 values (1);
 source include/show_binlog_events.inc;
---replace_result $VERSION VERSION
---replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /infile '.+'/infile 'words.dat'/
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events in 'master-bin.000002';
+
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+source include/show_binlog_events.inc;
+
 --replace_column 2 #
 show binary logs;
 sync_slave_with_master;
---source include/wait_for_slave_to_start.inc
 --replace_column 2 #
 show binary logs;
---replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /INFILE '.+'/INFILE 'words.dat'/
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events in 'slave-bin.000001' from 4;
---replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events in 'slave-bin.000002' from 4;
-source include/show_slave_status2.inc;
+
+let $binlog_file=;
+source include/show_binlog_events.inc;
+
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+source include/show_binlog_events.inc;
+let $binlog_file=;
+
+source include/check_slave_is_running.inc;
 
 # Need to recode the following
 
diff --git a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
index 5b546bbd891..8415522ec92 100644
--- a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
+++ b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
@@ -43,7 +43,7 @@ set global max_relay_log_size=8192-1; # mapped to 4096
 select @@global.max_relay_log_size;
 start slave;
 sync_with_master;
-source include/show_slave_status2.inc;
+--source include/check_slave_is_running.inc
 
 --echo #
 --echo # Test 2
@@ -55,7 +55,7 @@ set global max_relay_log_size=(5*4096);
 query_vertical select @@global.max_relay_log_size;
 start slave;
 sync_with_master;
-source include/show_slave_status2.inc;
+--source include/check_slave_is_running.inc
 
 --echo #
 --echo # Test 3: max_relay_log_size = 0
@@ -67,7 +67,7 @@ set global max_relay_log_size=0;
 query_vertical select @@global.max_relay_log_size;
 start slave;
 sync_with_master;
-source include/show_slave_status2.inc;
+--source include/check_slave_is_running.inc
 
 --echo #
 --echo # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
@@ -78,7 +78,6 @@ reset slave;
 # test of relay log rotation when the slave is stopped
 # (to make sure it does not crash).
 flush logs;
-source include/show_slave_status2.inc;
 
 --echo #
 --echo # Test 5
@@ -93,10 +92,8 @@ flush logs;
 # log we just closed. But a trick to achieve this is do an update on the master.
 connection master;
 create table t1 (a int);
-save_master_pos;
-connection slave;
-sync_with_master;
-source include/show_slave_status2.inc;
+sync_slave_with_master;
+--source include/check_slave_is_running.inc
 
 --echo #
 --echo # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
@@ -105,10 +102,8 @@ source include/show_slave_status2.inc;
 flush logs;
 connection master;
 drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-source include/show_slave_status2.inc;
+sync_slave_with_master;
+--source include/check_slave_is_running.inc
 
 connection master;
 # test that the absence of relay logs does not make a master crash
diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test
index 7ab99ef65dd..40439d59dee 100644
--- a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test
+++ b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test
@@ -56,24 +56,23 @@ connection master;
 --echo # since insert is done with transactional engine, expect a BEGIN
 --echo # at <start_pos>
 --echo
---replace_result $start_pos <start_pos>
---replace_column 5 #
---eval show binlog events from $start_pos limit 1
+--let $binlog_start= $start_pos
+--let $binlog_limit= 1
+--source include/show_binlog_events.inc
 
 --echo
 --echo # Now the insert, one step after
 --echo
---replace_result $start_pos <start_pos>
---replace_column 2 # 5 #
---eval show binlog events from $start_pos limit 1,1
+--let $binlog_start= $start_pos
+--let $binlog_limit= 1,1
+--source include/show_binlog_events.inc
 
 --echo
 --echo # and the COMMIT should be at <end_pos>
 --echo
---replace_result $start_pos <start_pos> $end_pos <end_pos>
---replace_column 2 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
---eval show binlog events from $start_pos limit 2,1
+--let $binlog_start= $start_pos
+--let $binlog_limit= 2,1
+--source include/show_binlog_events.inc
 
 --echo
 
@@ -89,18 +88,17 @@ commit;
 --source include/select_ndb_apply_status.inc
 
 connection master;
---replace_result $start_pos <start_pos>
---replace_column 5 #
---eval show binlog events from $start_pos limit 1
+--let $binlog_start= $start_pos
+--let $binlog_limit= 1
+--source include/show_binlog_events.inc
 --echo
---replace_result $start_pos <start_pos>
---replace_column 2 # 4 # 5 #
---eval show binlog events from $start_pos limit 1,2
+--let $binlog_start= $start_pos
+--let $binlog_limit= 1,2
+--source include/show_binlog_events.inc
 --echo
---replace_result $start_pos <start_pos> $end_pos <end_pos>
---replace_column 2 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
---eval show binlog events from $start_pos limit 3,1
+--let $binlog_start= $start_pos
+--let $binlog_limit= 3,1
+--source include/show_binlog_events.inc
 
 --echo
 
diff --git a/mysql-test/extra/rpl_tests/rpl_reset_slave.test b/mysql-test/extra/rpl_tests/rpl_reset_slave.test
index 428554ac598..e76cf1530ee 100644
--- a/mysql-test/extra/rpl_tests/rpl_reset_slave.test
+++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test
@@ -9,37 +9,33 @@
 # RESET SLAVE.
 
 -- source include/master-slave.inc
-connection master;
-save_master_pos;
-connection slave;
-sync_with_master;
-source include/show_slave_status2.inc;
+sync_slave_with_master;
+let $status_items= Master_User, Master_Host;
+source include/show_slave_status.inc;
 
-stop slave;
+source include/stop_slave.inc;
 change master to master_user='test';
-source include/show_slave_status2.inc;
+source include/show_slave_status.inc;
 
 reset slave;
-source include/show_slave_status2.inc;
+source include/show_slave_status.inc;
 
 change master to master_user='root';
-start slave;
+source include/start_slave.inc;
 sync_with_master;
-source include/show_slave_status2.inc;
+source include/show_slave_status.inc;
 
 # test of crash with temp tables & RESET SLAVE
 # (test to see if RESET SLAVE clears temp tables in memory and disk)
-stop slave;
+source include/stop_slave.inc;
 reset slave;
-start slave;
+source include/start_slave.inc;
 connection master;
 create temporary table t1 (a int);
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
+sync_slave_with_master;
+source include/stop_slave.inc;
 reset slave;
-start slave;
+source include/start_slave.inc;
 sync_with_master;
 show status like 'slave_open_temp_tables';
 
@@ -48,10 +44,9 @@ show status like 'slave_open_temp_tables';
 #
 
 # clearing the status
-stop slave;
+source include/stop_slave.inc;
 reset slave;
-let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
-echo *** errno must be zero: $last_io_errno ***;
+source include/check_slave_no_error.inc;
 
 #
 # verifying start slave resets Last_IO_Error and Last_IO_Errno.
@@ -59,40 +54,24 @@ echo *** errno must be zero: $last_io_errno ***;
 
 change master to master_user='impossible_user_name';
 start slave;
+let $slave_io_errno= 1045;
 source include/wait_for_slave_io_error.inc;
-let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
---disable_query_log
-eval SELECT $last_io_errno > 0 as ONE;
---enable_query_log
 
-source include/stop_slave.inc;
+stop slave;
 change master to master_user='root';
 source include/start_slave.inc;
-let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
-let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
---echo *** last errno must be  zero: $last_io_errno ***
---echo *** last error must be blank: $last_io_error ***
+source include/check_slave_no_error.inc;
 
 #
 # verifying reset slave resets Last_{IO,SQL}_Err{or,no}
 #
 
-source include/stop_slave.inc;
+stop slave;
 change master to master_user='impossible_user_name';
 start slave;
+let $slave_io_errno= 1045;
 source include/wait_for_slave_io_error.inc;
-let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
---disable_query_log
-eval SELECT $last_io_errno > 0 as ONE;
---enable_query_log
 
-source include/stop_slave.inc;
+stop slave;
 reset slave;
-let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
-let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
-let $last_sql_errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
-let $last_sql_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
---echo *** io  last errno must be  zero: $last_io_errno  ***
---echo *** io  last error must be blank: $last_io_error  ***
---echo *** sql last errno must be  zero: $last_sql_errno ***
---echo *** sql last error must be blank: $last_sql_error ***
+source include/check_slave_no_error.inc;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_basic.test b/mysql-test/extra/rpl_tests/rpl_row_basic.test
index a45527848be..72d4a8ac759 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_basic.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test
@@ -270,10 +270,7 @@ DELETE FROM t1;
 query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
 sync_slave_with_master;
 set @@global.slave_exec_mode= default;
-let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
-disable_query_log;
-eval SELECT "$last_error" AS Last_SQL_Error;
-enable_query_log;
+source include/check_slave_is_running.inc;
 query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
 
 # BUG#37076: TIMESTAMP/DATETIME values are not replicated correctly
@@ -412,11 +409,10 @@ INSERT INTO t5 VALUES (1, "", 1);
 INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
 
 connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
-let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
-disable_query_log;
-eval SELECT "$last_error" AS Last_SQL_Error;
-enable_query_log;
+# 1677 = ER_SLAVE_CONVERSION_FAILED 
+--let $slave_sql_errno= 1677 
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 connection master;
 RESET MASTER;
 connection slave;
@@ -431,11 +427,10 @@ INSERT INTO t6 VALUES (1, "", 1);
 INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
 
 connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
-let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
-disable_query_log;
-eval SELECT "$last_error" AS Last_SQL_Error;
-enable_query_log;
+# 1677 = ER_SLAVE_CONVERSION_FAILED 
+--let $slave_sql_errno= 1677 
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 connection master;
 RESET MASTER;
 connection slave;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
index 083088f12ff..9e752e4b69f 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
@@ -138,9 +138,7 @@ SELECT * FROM t2;
 sync_slave_with_master;
 --echo **** On Slave ****
 SELECT * FROM t2;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
---query_vertical SHOW SLAVE STATUS
+--source include/check_slave_is_running.inc
 
 connection master;
 INSERT INTO t9 VALUES (4);
@@ -149,12 +147,10 @@ sync_slave_with_master;
 connection master;
 INSERT INTO t4 VALUES (4);
 connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
---query_vertical SHOW SLAVE STATUS
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_skip_counter= 2
+--let $slave_sql_errno= 1677
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
 
 connection master;
 INSERT INTO t9 VALUES (5);
@@ -163,12 +159,10 @@ sync_slave_with_master;
 connection master;
 INSERT INTO t5 VALUES (5,10,25);
 connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
---query_vertical SHOW SLAVE STATUS
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_skip_counter= 2
+--let $slave_sql_errno= 1677
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
 
 connection master;
 INSERT INTO t9 VALUES (6);
@@ -177,19 +171,15 @@ sync_slave_with_master;
 connection master;
 INSERT INTO t6 VALUES (6,12,36);
 connection slave;
---source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
---query_vertical SHOW SLAVE STATUS
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--let $slave_skip_counter= 2
+--let $slave_sql_errno= 1677
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error_and_skip.inc
 
 connection master;
 INSERT INTO t9 VALUES (6);
 sync_slave_with_master;
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
---query_vertical SHOW SLAVE STATUS
+--source include/check_slave_is_running.inc
 
 # Testing some tables extra field that can be null and cannot be null
 # (but have default values)
diff --git a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
index cf68ba53caf..d32dd485e19 100644
--- a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
+++ b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
@@ -9,113 +9,96 @@ INSERT INTO t1 VALUES (5);
 INSERT INTO t1 VALUES (6);
 
 -- echo [MASTER] ********* SOW BINLOG EVENTS IN ...  *********
-let $binary_log_file= master-bin.000001;
 -- source include/show_binlog_events.inc
 
 -- echo [MASTER] ********* SOW BINLOG EVENTS         *********
-let $binary_log_file= ;
+let $binlog_file= ;
 -- source include/show_binlog_events.inc
 
 -- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows  *********
-let $binary_log_file= ;
-let $binary_log_limit_row= 3;
+let $binlog_limit= 3;
 -- source include/show_binlog_events.inc
 
 -- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows  *********
-let $binary_log_file= ;
-let $binary_log_limit_row= 4;
-let $binary_log_limit_offset= 1;
+let $binlog_limit= 1,4;
 -- source include/show_binlog_events.inc
 
 # clear show_binlog_event/show_relaylog_events parameters
-let $binary_log_file= ;
-let $binary_log_limit_row= ;
-let $binary_log_limit_offset= ;
+let $binlog_limit= ;
 
 -- sync_slave_with_master
 
 -- echo [SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
-let $binary_log_file= slave-bin.000001;
 -- source include/show_binlog_events.inc
 
 -- echo [SLAVE] ********* SOW BINLOG EVENTS          *********
-let $binary_log_file= ;
+let $binlog_file= ;
 -- source include/show_binlog_events.inc
 
 -- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows  *********
-let $binary_log_file= ;
-let $binary_log_limit_row= 3;
+let $binlog_limit= 3;
 -- source include/show_binlog_events.inc
 
 -- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows  *********
-let $binary_log_file= ;
-let $binary_log_limit_row= 4;
-let $binary_log_limit_offset= 1;
+let $binlog_limit= 1,4;
 -- source include/show_binlog_events.inc
 
 # clear show_binlog_event/show_relaylog_events parameters
-let $binary_log_file= ;
-let $binary_log_limit_row= ;
-let $binary_log_limit_offset= ;
+let $binlog_limit= ;
 
 -- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
-let $binary_log_file= slave-relay-bin.000003;
+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 $binary_log_file= ;
+let $binlog_file= ;
 -- source include/show_relaylog_events.inc
 
 -- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows  *********
-let $binary_log_file= slave-relay-bin.000003;
-let $binary_log_limit_row= 3;
-let $binary_log_limit_offset= ;
+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 $binary_log_file= slave-relay-bin.000003;
-let $binary_log_limit_offset= 1;
-let $binary_log_limit_row= 3;
+let $binlog_limit= 1,3;
 -- source include/show_relaylog_events.inc
 
 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 $binary_log_file= ;
-let $binary_log_limit_row= ;
-let $binary_log_limit_offset= ;
+let $binlog_file= ;
+let $binlog_limit= ;
 
 -- echo [MASTER] ********* SOW BINLOG EVENTS IN ...  *********
-let $binary_log_file= master-bin.000002;
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
 -- source include/show_binlog_events.inc
 
 -- echo [MASTER] ********* SOW BINLOG EVENTS         *********
-let $binary_log_file= ;
+let $binlog_file= ;
 -- source include/show_binlog_events.inc
 
 -- sync_slave_with_master
 
 -- echo [SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
-let $binary_log_file= slave-bin.000002;
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
 -- source include/show_binlog_events.inc
 
 -- echo [SLAVE] ********* SOW BINLOG EVENTS          *********
-let $binary_log_file= ;
+let $binlog_file= ;
 -- source include/show_binlog_events.inc
 
 -- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
-let $binary_log_file= slave-relay-bin.000005;
 -- source include/show_relaylog_events.inc
 
 -- echo [SLAVE] ********* SOW RELAYLOG EVENTS        *********
-let $binary_log_file= ;
+let $binlog_file= ;
 -- source include/show_relaylog_events.inc
 
 # clear show_binlog_event/show_relaylog_events parameters
-let $binary_log_name= ;
-let $binary_log_limit_row= ;
-let $binary_log_limit_offset= ;
+let $binlog_file= ;
+let $binlog_limit= ;
diff --git a/mysql-test/include/check_slave_is_running.inc b/mysql-test/include/check_slave_is_running.inc
new file mode 100644
index 00000000000..5fbbe0d684c
--- /dev/null
+++ b/mysql-test/include/check_slave_is_running.inc
@@ -0,0 +1,18 @@
+# ==== Purpose ====
+#
+# Assert that the slave threads are running and don't have any errors.
+#
+# ==== Usage ====
+#
+# --source include/check_slave_running.inc
+
+--echo Checking that both slave threads are running.
+
+--let $slave_sql_running = query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1)
+--let $slave_io_running = query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1)
+
+if (`SELECT '$slave_sql_running' != 'Yes' OR '$slave_io_running' != 'Yes'`) {
+  --echo Slave not running: Slave_SQL_Running = $slave_sql_running Slave_IO_Running = $slave_io_running
+  --source include/show_rpl_debug_info.inc
+  --die Expected slave to be running, but it was not running.
+}
diff --git a/mysql-test/include/check_slave_no_error.inc b/mysql-test/include/check_slave_no_error.inc
new file mode 100644
index 00000000000..371db5ed6a0
--- /dev/null
+++ b/mysql-test/include/check_slave_no_error.inc
@@ -0,0 +1,17 @@
+# ==== Purpose ====
+#
+# Assert that Slave_SQL_Error and Slave_IO_Error are empty.
+#
+# ==== Usage ====
+#
+# --let $slave_param= Exec_Master_Log_Pos
+# --let $slave_param_value= 4711
+# --source include/check_slave_running.inc
+
+--let $slave_param= Last_SQL_Errno
+--let $slave_param_value= 0
+--source include/check_slave_param.inc
+
+--let $slave_param= Last_IO_Errno
+--let $slave_param_value= 0
+--source include/check_slave_param.inc
diff --git a/mysql-test/include/check_slave_param.inc b/mysql-test/include/check_slave_param.inc
new file mode 100644
index 00000000000..d82c26851ea
--- /dev/null
+++ b/mysql-test/include/check_slave_param.inc
@@ -0,0 +1,16 @@
+# ==== Purpose ====
+#
+# Assert that a given column in SHOW SLAVE STATUS has a given value.
+#
+# ==== Usage ====
+#
+# --let $slave_param= Exec_Master_Log_Pos
+# --let $slave_param_value= 4711
+# --source include/check_slave_param.inc
+
+--let $_param_value= query_get_value(SHOW SLAVE STATUS, $slave_param, 1)
+if (`SELECT '$_param_value' != '$slave_param_value'`) {
+  --echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value'
+  --source include/show_rpl_debug_info.inc
+  --die Wrong value for slave parameter
+}
diff --git a/mysql-test/include/get_relay_log_pos.inc b/mysql-test/include/get_relay_log_pos.inc
new file mode 100644
index 00000000000..7ce36fd3c50
--- /dev/null
+++ b/mysql-test/include/get_relay_log_pos.inc
@@ -0,0 +1,70 @@
+# For a given event which is at position $master_log_pos in the the master's
+# binary log, returns its position in the slave's relay log file
+# $relay_log_file.  
+# The position is stored in the variable $relay_log_pos.
+
+# Usage:
+#   let $relay_log_file= 'relay-log-bin.000001'; 
+#   let $master_log_pos= 106; 
+#   source include/get_relay_log_pos.inc; 
+#   # at this point, get_relay_log_pos.inc sets $relay_log_pos. echo position
+#   # in $relay_log_file: $relay_log_pos. 
+
+if (`SELECT '$relay_log_file' = ''`)
+{
+  --die 'variable $relay_log_file is null'
+}
+
+if (`SELECT '$master_log_pos' = ''`)
+{
+  --die 'variable $master_log_pos is null'
+}
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $_suffix= `SELECT UUID()`;
+let $_tmp_file= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.$_suffix;
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$relay_log_file > $_tmp_file
+
+# All queries in this file should not be logged.
+--disable_query_log
+
+--disable_warnings
+DROP TEMPORARY TABLE IF EXISTS mysqlbinlog_events;
+DROP TEMPORARY TABLE IF EXISTS events_at;
+DROP TEMPORARY TABLE IF EXISTS events_pos;
+CREATE TEMPORARY TABLE mysqlbinlog_events(c1 INT AUTO_INCREMENT KEY, c2 varchar(256));
+
+# Event position is in the comments output by mysqlbinlog, we load this
+# comments into the table 
+# '# at 106' 
+# '# ....  end_log_pos 46'
+eval LOAD DATA LOCAL INFILE '$_tmp_file' INTO TABLE mysqlbinlog_events
+  LINES STARTING BY '#' (c2) SET c1 = NULL;
+--enable_warnings
+
+# Event pos in relay log file is inserted into table events_at
+CREATE TEMPORARY TABLE events_at(c1 INT AUTO_INCREMENT KEY, c2 varchar(256))
+  SELECT c2 FROM mysqlbinlog_events WHERE c2 LIKE ' at%' ORDER BY c1;
+
+# Event pos in master log file is inserted into table events_pos
+CREATE TEMPORARY TABLE events_pos(c1 INT AUTO_INCREMENT KEY, c2 varchar(256))
+  SELECT c2 FROM mysqlbinlog_events WHERE c2 LIKE '% end_log_pos %' ORDER BY c1;
+
+#  events_at                                events_pos
+#  c1------c2--------------------------     c1------c2------------------------
+#  1       ev1's begin pos in relay log     1      ev1's end pos in master log
+#  2       ev2's begin pos in relay log     2      ev2's end pos in master log
+#  3       ev3's begin pos in relay log     3      ev3's end pos in master log
+#  events always keep the same sequence.  
+#  Because event[N]'s end pos is equal to event[N+1]'s begin pos we want to
+#  find event's end pos in relay log, we can find the right relay_log_pos
+#  using the relationship that 'events_pos.c1 = events_at.c1 + 1'
+# 
+# There is a fault that we can't get the relay log position of the last event,
+# as it is not output by mysqlbinlog
+let $relay_log_pos= `SELECT SUBSTRING(a.c2, 5)
+  FROM events_at a, events_pos b
+  WHERE a.c1=b.c1+1 and b.c2 LIKE '% $master_log_pos%'`;
+DROP TEMPORARY TABLE mysqlbinlog_events, events_at, events_pos;
+--remove_file $_tmp_file
+--enable_query_log
diff --git a/mysql-test/include/not_parallel.inc b/mysql-test/include/not_parallel.inc
new file mode 100644
index 00000000000..39432c59813
--- /dev/null
+++ b/mysql-test/include/not_parallel.inc
@@ -0,0 +1,3 @@
+if (`SELECT '$MTR_PARALLEL' > 1`) {
+  --skip test requires --parallel=1
+}
diff --git a/mysql-test/include/rpl_stmt_seq.inc b/mysql-test/include/rpl_stmt_seq.inc
index 6c944dc4729..08f6e44aba0 100644
--- a/mysql-test/include/rpl_stmt_seq.inc
+++ b/mysql-test/include/rpl_stmt_seq.inc
@@ -80,9 +80,8 @@ eval INSERT INTO t1 SET f1= $MAX + 1;
 SELECT MAX(f1) FROM t1;
 if ($show_binlog)
 {
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
+  --let $binlog_file= master-bin.$_log_num_s
+  --source include/show_binlog_events.inc
 }
 sync_slave_with_master;
 
@@ -93,9 +92,8 @@ connection slave;
 SELECT MAX(f1) FROM t1;
 if ($show_binlog)
 {
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
+  --let $binlog_file= slave-bin.$_log_num_s
+  --source include/show_binlog_events.inc
 }
 
 ###############################################################
@@ -111,9 +109,8 @@ let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT;
 SELECT MAX(f1) FROM t1;
 if ($show_binlog)
 {
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
+  --let $binlog_file= master-bin.$_log_num_s
+  --source include/show_binlog_events.inc
 }
 sync_slave_with_master;
 
@@ -124,9 +121,8 @@ connection slave;
 SELECT MAX(f1) FROM t1;
 if ($show_binlog)
 {
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
+  --let $binlog_file= slave-bin.$_log_num_s
+  --source include/show_binlog_events.inc
 }
 
 ###############################################################
@@ -150,9 +146,8 @@ eval SELECT CONCAT(CONCAT('TEST-INFO: MASTER: The INSERT is ',
 --enable_query_log
 if ($show_binlog)
 {
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
+  --let $binlog_file= master-bin.$_log_num_s
+  --source include/show_binlog_events.inc
 }
 sync_slave_with_master;
 
@@ -171,9 +166,8 @@ eval SELECT CONCAT(CONCAT('TEST-INFO: SLAVE:  The INSERT is ',
 --enable_query_log
 if ($show_binlog)
 {
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
-eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
+  --let $binlog_file= slave-bin.$_log_num_s
+  --source include/show_binlog_events.inc
 }
 
 ###############################################################
diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc
index fcdc52eaf14..05f99f4a64d 100644
--- a/mysql-test/include/show_binlog_events.inc
+++ b/mysql-test/include/show_binlog_events.inc
@@ -1,35 +1,21 @@
-# $binlog_start can be set by caller or take a default value
-# $binary_log_file the name of the log file show
-# $binary_log_limit_row - sets the number of binlog rows to be returned
-# $binary_log_limit_offset - sets the offset where to start returning events
+##############################################################################
+# Show binary log events 
+#
+# Useage: 
+# let $binlog_file= master-bin.000002; 
+# let $binlog_start= 106; 
+# let $binlog_limit= 1, 3; 
+# source include/show_binlog_events.inc;
+#
+# It shows the first binary log file if $binlog_file is not given. 
+#
+# It shows events from the end position of the description event if
+# $binlog_start is not given.
+#
+# It shows all of the events if $binlog_limit is not given. 
+# $binlog_format has the same semantic with 'LIMIT' option.
+#
+##############################################################################
 
-let $show_binlog_events= show binlog events;
-
-if (!$binlog_start)
-{
-  # defaults to chop the first event in the binary log
-  let $binlog_start=107;
-}
-
-if (!`SELECT '$binary_log_file' = ''`)
-{
-    let $show_binlog_events= $show_binlog_events in '$binary_log_file';
-}
-let $show_binlog_events= $show_binlog_events from $binlog_start;
-
-if ($binary_log_limit_row)
-{
-  let $limit= limit;
-  if ($binary_log_limit_offset)
-  {
-    let $limit= $limit $binary_log_limit_offset, ;
-  }
-
-  let $limit= $limit $binary_log_limit_row;
-  let $show_binlog_events= $show_binlog_events $limit;
-}
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start>
---replace_column 2 # 4 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
---eval $show_binlog_events
+--let $is_relay_log= 0
+--source include/show_events.inc
diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc
new file mode 100644
index 00000000000..2fd0bc6dbd8
--- /dev/null
+++ b/mysql-test/include/show_events.inc
@@ -0,0 +1,36 @@
+##############################################################################
+# It's an auxiliary file used to show binary log events or relay log events.
+# It is only called by show_binlog_events.inc and show_relaylog_events.inc.
+##############################################################################
+
+if (!$binlog_start)
+{
+  # If $binlog_start is not set, we will set it as the second event's
+  # position.  The first event(Description Event) is always ignored. For
+  # description event's length might be changed because of adding new events,
+  # 'SHOW BINLOG EVENTS LIMIT 1' is used to get the right value.
+  --let $binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
+}
+
+--let $_statement=show binlog events
+if ($is_relay_log)
+{
+  --let $_statement=show relaylog events
+}
+
+if (`SELECT '$binlog_file' <> ''`)
+{
+  --let $_statement= $_statement in '$binlog_file'
+}
+
+--let $_statement= $_statement from $binlog_start
+
+if (`SELECT '$binlog_limit' <> ''`)
+{
+  --let $_statement= $_statement limit $binlog_limit
+}
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start>
+--replace_column 2 # 4 # 5 #
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /Server ver:.*$/SERVER_VERSION, BINLOG_VERSION/
+--eval $_statement
diff --git a/mysql-test/include/show_relaylog_events.inc b/mysql-test/include/show_relaylog_events.inc
index 6f63b055d58..d1bd11f1642 100644
--- a/mysql-test/include/show_relaylog_events.inc
+++ b/mysql-test/include/show_relaylog_events.inc
@@ -1,35 +1,21 @@
-# $binlog_start can be set by caller or take a default value
-# $binary_log_file the name of the log file show
-# $binary_log_limit_row - sets the number of binlog rows to be returned
-# $binary_log_limit_offset - sets the offset where to start returning events
+##############################################################################
+# Show relay log events 
+#
+# Useage: 
+# let $binlog_file= slave-relay-bin.000002; 
+# let $binlog_start= 106; 
+# let $binlog_limit= 1, 3; 
+# source include/show_relaylog_events.inc;
+#
+# It shows the first relay log file if $binlog_file is not given. 
+#
+# It shows events from the end position of the description event if
+# $binlog_start is not given.
+#
+# It shows all of the events if $binlog_limit is not given. 
+# $binlog_format has the same semantic with 'LIMIT' option.
+#
+##############################################################################
 
-let $show_binlog_events= show relaylog events;
-
-if (!$binlog_start)
-{
-  # defaults to chop the first event in the binary log
-  let $binlog_start=106;
-}
-
-if (!`SELECT '$binary_log_file' = ''`)
-{
-    let $show_binlog_events= $show_binlog_events in '$binary_log_file';
-}
-let $show_binlog_events= $show_binlog_events from $binlog_start;
-
-if ($binary_log_limit_row)
-{
-  let $limit= limit;
-  if ($binary_log_limit_offset)
-  {
-    let $limit= $limit $binary_log_limit_offset, ;
-  }
-
-  let $limit= $limit $binary_log_limit_row;
-  let $show_binlog_events= $show_binlog_events $limit;
-}
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start>
---replace_column 2 # 4 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /Server ver:.*$/SERVER_VERSION, BINLOG_VERSION/
---eval $show_binlog_events
+--let $is_relay_log= 1
+--source include/show_events.inc
diff --git a/mysql-test/include/show_rpl_debug_info.inc b/mysql-test/include/show_rpl_debug_info.inc
index 252d63f1bf4..148d11f3b02 100644
--- a/mysql-test/include/show_rpl_debug_info.inc
+++ b/mysql-test/include/show_rpl_debug_info.inc
@@ -36,6 +36,7 @@ let $_con= $CURRENT_CONNECTION;
 --echo
 --echo [on $_con]
 --echo
+SELECT NOW();
 --echo **** SHOW SLAVE STATUS on $_con ****
 query_vertical SHOW SLAVE STATUS;
 --echo
@@ -70,6 +71,7 @@ if (`SELECT '$_master_con' != ''`)
   --echo [on $_master_con]
   connection $_master_con;
   --echo
+  SELECT NOW();
   --echo **** SHOW MASTER STATUS on $_master_con ****
   query_vertical SHOW MASTER STATUS;
   --echo
diff --git a/mysql-test/include/show_slave_status.inc b/mysql-test/include/show_slave_status.inc
index b315b9e45ca..d66c068e19b 100644
--- a/mysql-test/include/show_slave_status.inc
+++ b/mysql-test/include/show_slave_status.inc
@@ -1,6 +1,25 @@
 # Include file to show the slave status, masking out some information
 # that varies depending on where the test is executed.
 
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+--let $_items=$status_items
+if (`SELECT "XX$status_items" = "XX"`)
+{
+  --die 'Variable status_items is NULL' 
+}
+
+--disable_query_log
+--vertical_results
+
+while (`SELECT "XX$_items" <> "XX"`) 
+{
+  --let $_name= `SELECT SUBSTRING_INDEX('$_items', ',', 1)`
+  --let $_items= `SELECT LTRIM(SUBSTRING('$_items', LENGTH('$_name') + 2))`
+
+  --let $_value= query_get_value(SHOW SLAVE STATUS, $_name, 1)
+
+  --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+  --eval SELECT "$_value" AS $_name
+}
+
+--horizontal_results
+--enable_query_log
diff --git a/mysql-test/include/show_slave_status2.inc b/mysql-test/include/show_slave_status2.inc
deleted file mode 100644
index 7e970b31d8e..00000000000
--- a/mysql-test/include/show_slave_status2.inc
+++ /dev/null
@@ -1,8 +0,0 @@
-# Include file to show the slave status, masking out some information
-# that varies depending on where the test is executed.
-
-# masked out log positions
-
---replace_result $MASTER_MYPORT MASTER_PORT $DEFAULT_MASTER_PORT 3306
---replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
diff --git a/mysql-test/include/test_fieldsize.inc b/mysql-test/include/test_fieldsize.inc
index 606bc63779d..105574b15b9 100644
--- a/mysql-test/include/test_fieldsize.inc
+++ b/mysql-test/include/test_fieldsize.inc
@@ -22,10 +22,9 @@ eval $test_insert;
 
 connection slave;
 START SLAVE;
---source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+--let $slave_sql_errno= 1677
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 
 # The following should be 0
 SELECT COUNT(*) FROM t1;
diff --git a/mysql-test/include/wait_for_binlog_event.inc b/mysql-test/include/wait_for_binlog_event.inc
index 2a57c191413..7a55c8c2182 100644
--- a/mysql-test/include/wait_for_binlog_event.inc
+++ b/mysql-test/include/wait_for_binlog_event.inc
@@ -18,7 +18,7 @@ while (`SELECT INSTR("$_last_event","$wait_binlog_event") = 0`)
   dec $_loop_count;
   if (!$_loop_count)
   {
-    SHOW BINLOG EVENTS;
+    --source include/show_rpl_debug_info.inc
     --die ERROR: failed while waiting for $wait_binlog_event in binlog 
   }
   real_sleep 0.1;
diff --git a/mysql-test/include/wait_for_slave_io_error.inc b/mysql-test/include/wait_for_slave_io_error.inc
index 094406e02b2..34cbf20a73b 100644
--- a/mysql-test/include/wait_for_slave_io_error.inc
+++ b/mysql-test/include/wait_for_slave_io_error.inc
@@ -1,23 +1,59 @@
 # ==== Purpose ====
 #
 # Waits until the IO thread of the current connection has got an
-# error, or until a timeout is reached.
+# error, or until a timeout is reached. Also waits until the IO
+# thread has completely stopped.
 #
 # ==== Usage ====
 #
+# # Wait several errors.  
+# let $slave_io_errno= 1, 2, 3; 
 # source include/wait_for_slave_io_error.inc;
 #
-# Parameters to this macro are $slave_timeout and
-# $slave_keep_connection. See wait_for_slave_param.inc for
-# descriptions.
+# # Print error message 
+# let $slave_io_errno= 1; 
+# let $show_slave_io_error= 1; 
+# source include/wait_for_slave_io_error.inc;
+#
+# Parameters:
+#
+# $slave_io_errno
+#   The expected IO error numbers.  This is required.
+#   (After BUG#41956 has been fixed, this will be required to be a
+#   symbolic name instead of a numbers.)
+#
+# $show_slave_io_error
+#   If set, will print the error to the query log.
+# 
+# $slave_timeout
+#   See wait_for_slave_param.inc for description.
+# 
+# $master_connection
+#   See wait_for_slave_param.inc for description.
+
+if (`SELECT '$slave_io_errno' = ''`) {
+  --die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc
+}
 
 let $old_slave_param_comparison= $slave_param_comparison;
-
 let $slave_param= Last_IO_Errno;
 let $slave_param_comparison= !=;
 let $slave_param_value= 0;
 let $slave_error_message= Failed while waiting for slave to produce an error in its sql thread;
 source include/wait_for_slave_param.inc;
 let $slave_error_message= ;
-
 let $slave_param_comparison= $old_slave_param_comparison;
+
+let $_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
+if (`SELECT $_error NOT IN ($slave_io_errno)`) {
+  --echo **** Slave stopped with wrong error code: $_error (expected $slave_io_errno) ****
+  source include/show_rpl_debug_info.inc;
+  --echo **** Slave stopped with wrong error code: $_error (expected $slave_io_errno) ****
+  --die Slave stopped with wrong error code
+}
+
+if ($show_slave_io_error)
+{
+  let $error= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1);
+  echo Last_IO_Error = $error;
+}
diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc
index 1e690bdfe9c..b0989c3264e 100644
--- a/mysql-test/include/wait_for_slave_param.inc
+++ b/mysql-test/include/wait_for_slave_param.inc
@@ -80,5 +80,5 @@ if (!$_slave_timeout_counter)
   --echo Current connection is '$CURRENT_CONNECTION'
   echo Note: the following output may have changed since the failure was detected;
   source include/show_rpl_debug_info.inc;
-  exit;
+  die;
 }
diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc
index ad1d7a9e639..aab04036eea 100644
--- a/mysql-test/include/wait_for_slave_sql_error.inc
+++ b/mysql-test/include/wait_for_slave_sql_error.inc
@@ -14,6 +14,9 @@
 #   The expected SQL error number.  This is required.
 #   (After BUG#41956 has been fixed, this will be required to be a
 #   symbolic name instead of a number.)
+#
+# $show_slave_sql_error
+#   If set, will print the error to the query log.
 # 
 # $slave_timeout
 #   See wait_for_slave_param.inc for description.
@@ -22,8 +25,7 @@
 #   See wait_for_slave_param.inc for description.
 
 if (`SELECT '$slave_sql_errno' = ''`) {
-  --echo !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_fro_slave_sql_error.inc
-  exit;
+  --die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc
 }
 
 let $slave_param= Slave_SQL_Running;
@@ -33,7 +35,14 @@ source include/wait_for_slave_param.inc;
 
 let $_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
 if (`SELECT '$_error' != '$slave_sql_errno'`) {
-  --echo Slave stopped with wrong error code: $_error (expected $slave_sql_errno)
+  --echo **** Slave stopped with wrong error code: $_error (expected $slave_sql_errno) ****
   source include/show_rpl_debug_info.inc;
-  exit;
+  --echo **** Slave stopped with wrong error code: $_error (expected $slave_sql_errno) ****
+  --die Slave stopped with wrong error code
+}
+
+if ($show_slave_sql_error)
+{
+  let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+  echo Last_SQL_Error = $error;
 }
diff --git a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
index 247de3a41a1..11c02c0b490 100644
--- a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
+++ b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
@@ -22,17 +22,30 @@
 # 
 # $master_connection
 #   See wait_for_slave_param.inc for description.
+#
+# $slave_skip_counter
+#   If set, skip this number of events. If not set, skip one event.
+#
+# $not_switch_connection If set, don't switch to slave and don't switch back
+# master.
+#
 
 echo --source include/wait_for_slave_sql_error_and_skip.inc;
-connection slave;
-source include/wait_for_slave_sql_error.inc;
-if ($show_sql_error)
+if (!$not_switch_connection)
 {
-  let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
-  echo Last_SQL_Error = $error;
+  connection slave;
 }
+source include/wait_for_slave_sql_error.inc;
 
 # skip the erroneous statement
-set global sql_slave_skip_counter=1;
+if ($slave_skip_counter) {
+  eval SET GLOBAL SQL_SLAVE_SKIP_COUNTER= $slave_skip_counter;
+}
+if (!$slave_skip_counter) {
+  SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
+}
 source include/start_slave.inc;
-connection master;
+if (!$not_switch_connection)
+{
+  connection master;
+}
diff --git a/mysql-test/include/wait_for_status_var.inc b/mysql-test/include/wait_for_status_var.inc
index 4c168da7f1a..8b644c2c3c5 100644
--- a/mysql-test/include/wait_for_status_var.inc
+++ b/mysql-test/include/wait_for_status_var.inc
@@ -35,7 +35,7 @@
 if (`SELECT STRCMP('$status_type', '') * STRCMP(UPPER('$status_type'), 'SESSION') * STRCMP(UPPER('$status_type'), 'GLOBAL')`)
 {
   --echo **** ERROR: Unknown type of variable status_type: allowed values are: SESSION or GLOBAL ****
-  exit;
+  die;
 }
 
 let $_status_timeout_counter= $status_timeout;
@@ -60,7 +60,7 @@ while (`SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_va
     --echo **** Showing STATUS, PROCESSLIST ****
     eval SHOW $status_type STATUS LIKE '$status_var';
     SHOW PROCESSLIST;
-    exit;
+    die;
   }
   dec $_status_timeout_counter;
   sleep 0.1;
diff --git a/mysql-test/include/wait_until_count_sessions.inc b/mysql-test/include/wait_until_count_sessions.inc
index de4f0eeb652..26b0d8f2633 100644
--- a/mysql-test/include/wait_until_count_sessions.inc
+++ b/mysql-test/include/wait_until_count_sessions.inc
@@ -122,5 +122,6 @@ if (!$success)
    --echo # Timeout in wait_until_count_sessions.inc
    --echo # Number of sessions   expected: <= $count_sessions   found: $current_sessions
    SHOW PROCESSLIST;
+   --die Timeout in wait_until_count_sessions.inc
 }
 
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index cb893402258..4039825be55 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -769,11 +769,13 @@ sub collect_one_test_case {
   # Check for disabled tests
   # ----------------------------------------------------------------------
   my $marked_as_disabled= 0;
-  if ( $disabled->{$tname} )
+  if ( $disabled->{$tname} or $disabled->{"$suitename.$tname"} )
   {
     # Test was marked as disabled in suites disabled.def file
     $marked_as_disabled= 1;
-    $tinfo->{'comment'}= $disabled->{$tname};
+    # Test name may have been disabled with or without suite name part
+    $tinfo->{'comment'}= $disabled->{$tname} || 
+                         $disabled->{"$suitename.$tname"};
   }
 
   my $disabled_file= "$testdir/$tname.disabled";
diff --git a/mysql-test/lib/v1/mtr_process.pl b/mysql-test/lib/v1/mtr_process.pl
index 8fd900330da..4a4e342bff6 100644
--- a/mysql-test/lib/v1/mtr_process.pl
+++ b/mysql-test/lib/v1/mtr_process.pl
@@ -264,8 +264,9 @@ sub spawn_parent_impl {
           if ( $timer_name eq "suite" )
           {
             # We give up here
-            # FIXME we should only give up the suite, not all of the run?
             print STDERR "\n";
+            kill(9, $pid); # Kill mysqltest
+            mtr_kill_leftovers(); # Kill servers the hard way
             mtr_error("Test suite timeout");
           }
           elsif ( $timer_name eq "testcase" )
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index fa2db663e1e..23a92828e2a 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -362,6 +362,7 @@ sub main {
     $opt_parallel= 1 if ($opt_parallel < 1);
     mtr_report("Using parallel: $opt_parallel");
   }
+  $ENV{MTR_PARALLEL} = $opt_parallel;
 
   # Create server socket on any free port
   my $server = new IO::Socket::INET
@@ -1826,7 +1827,7 @@ sub find_plugin($$)
     mtr_file_exists(vs_config_dirs($location,$plugin_filename),
                     "$basedir/lib/plugin/".$plugin_filename,
                     "$basedir/$location/.libs/".$plugin_filename,
-					"$basedir/lib/mysql/plugin/".$plugin_filename,
+                    "$basedir/lib/mysql/plugin/".$plugin_filename,
                     );
   return $lib_example_plugin;
 }
@@ -1943,6 +1944,16 @@ sub environment_setup {
     }
   }
 
+  # ----------------------------------------------------
+  # Add the paths where mysqld will find archive/blackhole/federated plugins.
+  # ----------------------------------------------------
+  $ENV{'ARCHIVE_PLUGIN_DIR'} =
+    dirname(find_plugin("ha_archive", "storage/archive"));
+  $ENV{'BLACKHOLE_PLUGIN_DIR'} =
+    dirname(find_plugin("ha_blackhole", "storage/blackhole"));
+  $ENV{'FEDERATED_PLUGIN_DIR'} =
+    dirname(find_plugin("ha_federated", "storage/federated"));
+
   # ----------------------------------------------------
   # Add the path where mysqld will find mypluglib.so
   # ----------------------------------------------------
diff --git a/mysql-test/r/alter_table-big.result b/mysql-test/r/alter_table-big.result
index 9761754a02f..d6b936bd5d7 100644
--- a/mysql-test/r/alter_table-big.result
+++ b/mysql-test/r/alter_table-big.result
@@ -12,11 +12,11 @@ alter table t1 enable keys;;
 insert into t2 values (1);
 insert into t1 values (1, 1, 1);
 set session debug="-d,sleep_alter_enable_indexes";
-show binlog events in 'master-bin.000001' from 106;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; insert into t2 values (1)
-master-bin.000001	#	Query	1	#	use `test`; alter table t1 enable keys
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (1, 1, 1)
+master-bin.000001	#	Query	#	#	use `test`; insert into t2 values (1)
+master-bin.000001	#	Query	#	#	use `test`; alter table t1 enable keys
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1, 1, 1)
 drop tables t1, t2;
 End of 5.0 tests
 drop table if exists t1, t2, t3;
@@ -41,17 +41,17 @@ alter table t2 change c vc varchar(100) default 'Test2', rename to t1;;
 rename table t1 to t3;
 drop table t3;
 set session debug="-d,sleep_alter_before_main_binlog";
-show binlog events in 'master-bin.000001' from 106;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; alter table t1 change i c char(10) default 'Test1'
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values ()
-master-bin.000001	#	Query	1	#	use `test`; alter table t1 change c vc varchar(100) default 'Test2'
-master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t2
-master-bin.000001	#	Query	1	#	use `test`; drop table t2
-master-bin.000001	#	Query	1	#	use `test`; create table t1 (i int)
-master-bin.000001	#	Query	1	#	use `test`; alter table t1 change i c char(10) default 'Test3', rename to t2
-master-bin.000001	#	Query	1	#	use `test`; insert into t2 values ()
-master-bin.000001	#	Query	1	#	use `test`; alter table t2 change c vc varchar(100) default 'Test2', rename to t1
-master-bin.000001	#	Query	1	#	use `test`; rename table t1 to t3
-master-bin.000001	#	Query	1	#	use `test`; drop table t3
+master-bin.000001	#	Query	#	#	use `test`; alter table t1 change i c char(10) default 'Test1'
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values ()
+master-bin.000001	#	Query	#	#	use `test`; alter table t1 change c vc varchar(100) default 'Test2'
+master-bin.000001	#	Query	#	#	use `test`; rename table t1 to t2
+master-bin.000001	#	Query	#	#	use `test`; drop table t2
+master-bin.000001	#	Query	#	#	use `test`; create table t1 (i int)
+master-bin.000001	#	Query	#	#	use `test`; alter table t1 change i c char(10) default 'Test3', rename to t2
+master-bin.000001	#	Query	#	#	use `test`; insert into t2 values ()
+master-bin.000001	#	Query	#	#	use `test`; alter table t2 change c vc varchar(100) default 'Test2', rename to t1
+master-bin.000001	#	Query	#	#	use `test`; rename table t1 to t3
+master-bin.000001	#	Query	#	#	use `test`; drop table t3
 End of 5.1 tests
diff --git a/mysql-test/r/create-big.result b/mysql-test/r/create-big.result
index eb57bf59084..d062b59a008 100644
--- a/mysql-test/r/create-big.result
+++ b/mysql-test/r/create-big.result
@@ -175,12 +175,12 @@ t2	CREATE TABLE `t2` (
   `i` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t2;
-show binlog events in 'master-bin.000001' from 106;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (1)
-master-bin.000001	#	Query	1	#	use `test`; create table t2 like t1
-master-bin.000001	#	Query	1	#	use `test`; drop table t1
-master-bin.000001	#	Query	1	#	use `test`; drop table t2
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1)
+master-bin.000001	#	Query	#	#	use `test`; create table t2 like t1
+master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; drop table t2
 create table t1 (i int);
 set session debug="-d,sleep_create_like_before_check_if_exists:+d,sleep_create_like_before_copy";
 create table t2 like t1;;
@@ -197,11 +197,11 @@ reset master;
 create table t2 like t1;;
 drop table t1;
 drop table t2;
-show binlog events in 'master-bin.000001' from 106;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t2 like t1
-master-bin.000001	#	Query	1	#	use `test`; drop table t1
-master-bin.000001	#	Query	1	#	use `test`; drop table t2
+master-bin.000001	#	Query	#	#	use `test`; create table t2 like t1
+master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; drop table t2
 create table t1 (i int);
 set session debug="-d,sleep_create_like_before_copy:+d,sleep_create_like_before_ha_create";
 reset master;
@@ -213,16 +213,16 @@ drop table t2;
 create table t2 like t1;;
 drop table t1;
 drop table t2;
-show binlog events in 'master-bin.000001' from 106;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t2 like t1
-master-bin.000001	#	Query	1	#	use `test`; insert into t2 values (1)
-master-bin.000001	#	Query	1	#	use `test`; drop table t2
-master-bin.000001	#	Query	1	#	use `test`; create table t2 like t1
-master-bin.000001	#	Query	1	#	use `test`; drop table t2
-master-bin.000001	#	Query	1	#	use `test`; create table t2 like t1
-master-bin.000001	#	Query	1	#	use `test`; drop table t1
-master-bin.000001	#	Query	1	#	use `test`; drop table t2
+master-bin.000001	#	Query	#	#	use `test`; create table t2 like t1
+master-bin.000001	#	Query	#	#	use `test`; insert into t2 values (1)
+master-bin.000001	#	Query	#	#	use `test`; drop table t2
+master-bin.000001	#	Query	#	#	use `test`; create table t2 like t1
+master-bin.000001	#	Query	#	#	use `test`; drop table t2
+master-bin.000001	#	Query	#	#	use `test`; create table t2 like t1
+master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; drop table t2
 create table t1 (i int);
 set session debug="-d,sleep_create_like_before_ha_create:+d,sleep_create_like_before_binlogging";
 reset master;
@@ -234,14 +234,14 @@ drop table t2;
 create table t2 like t1;;
 drop table t1;
 drop table t2;
-show binlog events in 'master-bin.000001' from 106;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t2 like t1
-master-bin.000001	#	Query	1	#	use `test`; insert into t2 values (1)
-master-bin.000001	#	Query	1	#	use `test`; drop table t2
-master-bin.000001	#	Query	1	#	use `test`; create table t2 like t1
-master-bin.000001	#	Query	1	#	use `test`; drop table t2
-master-bin.000001	#	Query	1	#	use `test`; create table t2 like t1
-master-bin.000001	#	Query	1	#	use `test`; drop table t1
-master-bin.000001	#	Query	1	#	use `test`; drop table t2
+master-bin.000001	#	Query	#	#	use `test`; create table t2 like t1
+master-bin.000001	#	Query	#	#	use `test`; insert into t2 values (1)
+master-bin.000001	#	Query	#	#	use `test`; drop table t2
+master-bin.000001	#	Query	#	#	use `test`; create table t2 like t1
+master-bin.000001	#	Query	#	#	use `test`; drop table t2
+master-bin.000001	#	Query	#	#	use `test`; create table t2 like t1
+master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; drop table t2
 set session debug="-d,sleep_create_like_before_binlogging";
diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result
index 083ad77446f..2794538e097 100644
--- a/mysql-test/r/ctype_cp932_binlog_stm.result
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
@@ -32,28 +32,22 @@ HEX(s1)	HEX(s2)	d
 466F6F2773206120426172	ED40ED41ED42	47.93
 DROP PROCEDURE bug18293|
 DROP TABLE t4|
-SHOW BINLOG EVENTS FROM 514|
+show binlog events from <binlog_start>|
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	514	Query	1	581	BEGIN
-master-bin.000001	581	Query	1	788	use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Error in Log_event::read_log_event()' COLLATE 'latin1_swedish_ci'))
-master-bin.000001	788	Query	1	856	COMMIT
-master-bin.000001	856	Query	1	923	BEGIN
-master-bin.000001	923	Query	1	1191	use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT' COLLATE 'latin1_swedish_ci'))
-master-bin.000001	1191	Query	1	1259	COMMIT
-master-bin.000001	1259	Query	1	1422	use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
 s2 CHAR(50) CHARACTER SET cp932,
 d DECIMAL(10,2))
-master-bin.000001	1422	Query	1	1668	use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug18293`(IN ins1 CHAR(50),
+master-bin.000001	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug18293`(IN ins1 CHAR(50),
 IN ins2 CHAR(50) CHARACTER SET cp932,
 IN ind DECIMAL(10,2))
 BEGIN
 INSERT INTO t4 VALUES (ins1, ins2, ind);
 END
-master-bin.000001	1668	Query	1	1736	BEGIN
-master-bin.000001	1736	Query	1	2000	use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'),  NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'),  NAME_CONST('ind',47.93))
-master-bin.000001	2000	Query	1	2069	COMMIT
-master-bin.000001	2069	Query	1	2155	use `test`; DROP PROCEDURE bug18293
-master-bin.000001	2155	Query	1	2231	use `test`; DROP TABLE t4
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'),  NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'),  NAME_CONST('ind',47.93))
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; DROP PROCEDURE bug18293
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t4
 End of 5.0 tests
 SHOW BINLOG EVENTS FROM 490;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result
index 27e51a33112..fc58687cc86 100644
--- a/mysql-test/r/error_simulation.result
+++ b/mysql-test/r/error_simulation.result
@@ -39,5 +39,14 @@ a
 2
 DROP TABLE t1;
 #
+# Bug#42064: low memory crash when importing hex strings, in Item_hex_string::Item_hex_string
+#
+CREATE TABLE t1(a BLOB);
+SET SESSION debug="+d,bug42064_simulate_oom";
+INSERT INTO t1 VALUES("");
+Got one of the listed errors
+SET SESSION debug=DEFAULT;
+DROP TABLE t1;
+#
 # End of 5.1 tests
 #
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index 7042a2c6f6c..b8dbb54e5fb 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -258,4 +258,17 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
 2	SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
 DROP TABLE t1, t2;
+#
+# Bug #48573: difference of index selection between rpm binary and
+#             .tar.gz, windows vs linux..
+#
+CREATE TABLE t1(c1 INT, c2 INT, c4 INT, c5 INT, KEY(c2, c5), KEY(c2, c4, c5));
+INSERT INTO t1 VALUES(4, 1, 1, 1);
+INSERT INTO t1 VALUES(3, 1, 1, 1);
+INSERT INTO t1 VALUES(2, 1, 1, 1);
+INSERT INTO t1 VALUES(1, 1, 1, 1);
+EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 AND c4 = 1 AND c5 = 1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ref	c2,c2_2	c2	10	const,const	3	Using where
+DROP TABLE t1;
 End of 5.1 tests.
diff --git a/mysql-test/r/flush_block_commit_notembedded.result b/mysql-test/r/flush_block_commit_notembedded.result
index 6d8af3f5864..08643527b75 100644
--- a/mysql-test/r/flush_block_commit_notembedded.result
+++ b/mysql-test/r/flush_block_commit_notembedded.result
@@ -10,15 +10,13 @@ SELECT 1;
 1
 # Switch to connection con2
 FLUSH TABLES WITH READ LOCK;
-SHOW MASTER STATUS;
-File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	107		
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 # Switch to connection con1
 INSERT INTO t1 VALUES (1);
 # Switch to connection con2
-SHOW MASTER STATUS;
-File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	107		
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 UNLOCK TABLES;
 # Switch to connection con1
 DROP TABLE t1;
diff --git a/mysql-test/r/func_isnull.result b/mysql-test/r/func_isnull.result
index 79aecc7d82b..2dbe3d036f9 100644
--- a/mysql-test/r/func_isnull.result
+++ b/mysql-test/r/func_isnull.result
@@ -5,6 +5,20 @@ flush tables;
 select * from t1 where isnull(to_days(mydate));
 id	mydate
 drop table t1;
+#
+# Bug#53933 crash when using uncacheable subquery in the having clause of outer query
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (0),(0);
+SELECT ISNULL((SELECT GET_LOCK('Bug#53933', 0) FROM t1 GROUP BY f1)) AS f2
+FROM t1 GROUP BY f1 HAVING f2 = f2;
+f2
+0
+SELECT RELEASE_LOCK('Bug#53933');
+RELEASE_LOCK('Bug#53933')
+1
+DROP TABLE t1;
+End of 5.0 tests
 CREATE TABLE t1 (id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY(id));
 INSERT INTO t1( id ) VALUES ( NULL );
 SELECT t1.id  FROM t1  WHERE (id  is not null and id is null );
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index 9c6575af16c..07b4c71cbe3 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -2767,6 +2767,19 @@ SELECT MIN( a ) FROM t1 WHERE a IS NULL;
 MIN( a )
 NULL
 DROP TABLE t1;
+#
+# Bug#53859: Valgrind: opt_sum_query(TABLE_LIST*, List<Item>&, Item*) at
+# opt_sum.cc:305
+#
+CREATE TABLE t1 ( a INT, KEY (a) );
+INSERT INTO t1 VALUES (1), (2), (3);
+SELECT MIN( a ) AS min_a
+FROM t1
+WHERE a > 1 AND a IS NULL
+ORDER BY min_a;
+min_a
+NULL
+DROP TABLE t1;
 End of 5.1 tests
 #
 # WL#3220 (Loose index scan for COUNT DISTINCT)
diff --git a/mysql-test/r/handler_myisam.result b/mysql-test/r/handler_myisam.result
index 028397b0b24..31bc828b0b9 100644
--- a/mysql-test/r/handler_myisam.result
+++ b/mysql-test/r/handler_myisam.result
@@ -1734,4 +1734,97 @@ a
 1
 HANDLER t1 CLOSE;
 DROP TABLE t1;
+#
+# Bug #54007: assert in ha_myisam::index_next , HANDLER
+#
+CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a), KEY b(b), KEY ab(a, b));
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+a	b
+HANDLER t1 READ `PRIMARY` NEXT;
+a	b
+HANDLER t1 READ ab NEXT;
+a	b
+HANDLER t1 READ b NEXT;
+a	b
+HANDLER t1 READ NEXT;
+a	b
+HANDLER t1 CLOSE;
+INSERT INTO t1 VALUES (2, 20), (1, 10), (4, 40), (3, 30);
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+a	b
+2	20
+HANDLER t1 READ NEXT;
+a	b
+1	10
+HANDLER t1 READ `PRIMARY` NEXT;
+a	b
+1	10
+HANDLER t1 READ `PRIMARY` NEXT;
+a	b
+2	20
+HANDLER t1 READ ab NEXT;
+a	b
+1	10
+HANDLER t1 READ ab NEXT;
+a	b
+2	20
+HANDLER t1 READ b NEXT;
+a	b
+1	10
+HANDLER t1 READ b NEXT;
+a	b
+2	20
+HANDLER t1 READ b NEXT;
+a	b
+3	30
+HANDLER t1 READ b NEXT;
+a	b
+4	40
+HANDLER t1 READ b NEXT;
+a	b
+HANDLER t1 READ NEXT;
+a	b
+4	40
+HANDLER t1 READ NEXT;
+a	b
+3	30
+HANDLER t1 READ NEXT;
+a	b
+HANDLER t1 CLOSE;
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+a	b
+2	20
+HANDLER t1 READ `PRIMARY` PREV;
+a	b
+4	40
+HANDLER t1 READ `PRIMARY` PREV;
+a	b
+3	30
+HANDLER t1 READ b PREV;
+a	b
+4	40
+HANDLER t1 READ b PREV;
+a	b
+3	30
+HANDLER t1 CLOSE;
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+a	b
+2	20
+HANDLER t1 READ `PRIMARY` PREV LIMIT 3;
+a	b
+4	40
+3	30
+2	20
+HANDLER t1 READ b NEXT LIMIT 5;
+a	b
+1	10
+2	20
+3	30
+4	40
+HANDLER t1 CLOSE;
+DROP TABLE t1;
 End of 5.1 tests
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 17363cbc989..847a00cad94 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -1342,4 +1342,63 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	tt9	ALL	NULL	NULL	NULL	NULL	2	Using join buffer
 SET optimizer_search_depth = DEFAULT;
 DROP TABLE t1;
+#
+# Bug#46091 STRAIGHT_JOIN + RIGHT JOIN returns different result
+#
+CREATE TABLE t1 (f1 INT NOT NULL);
+INSERT INTO t1 VALUES (9),(0);
+CREATE TABLE t2 (f1 INT NOT NULL);
+INSERT INTO t2 VALUES
+(5),(3),(0),(3),(1),(0),(1),(7),(1),(0),(0),(8),(4),(9),(0),(2),(0),(8),(5),(1);
+SELECT STRAIGHT_JOIN COUNT(*) FROM t1 TA1
+RIGHT JOIN t2 TA2 JOIN t2 TA3 ON TA2.f1 ON TA3.f1;
+COUNT(*)
+476
+EXPLAIN SELECT STRAIGHT_JOIN COUNT(*) FROM t1 TA1
+RIGHT JOIN t2 TA2 JOIN t2 TA3 ON TA2.f1 ON TA3.f1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	TA2	ALL	NULL	NULL	NULL	NULL	20	Using where
+1	SIMPLE	TA3	ALL	NULL	NULL	NULL	NULL	20	Using join buffer
+1	SIMPLE	TA1	ALL	NULL	NULL	NULL	NULL	2	
+DROP TABLE t1, t2;
+#
+# Bug#48971 Segfault in add_found_match_trig_cond () at sql_select.cc:5990
+#
+CREATE TABLE t1(f1 INT, PRIMARY KEY (f1));
+INSERT INTO t1 VALUES (1),(2);
+EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
+LEFT JOIN t1 AS jt2
+RIGHT JOIN t1 AS jt3
+JOIN t1 AS jt4 ON 1
+LEFT JOIN t1 AS jt5 ON 1
+ON 1
+RIGHT JOIN t1 AS jt6 ON jt6.f1
+ON 1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	jt1	index	NULL	PRIMARY	4	NULL	2	100.00	Using index
+1	SIMPLE	jt6	index	NULL	PRIMARY	4	NULL	2	100.00	Using index
+1	SIMPLE	jt3	index	NULL	PRIMARY	4	NULL	2	100.00	Using index
+1	SIMPLE	jt4	index	NULL	PRIMARY	4	NULL	2	100.00	Using index
+1	SIMPLE	jt5	index	NULL	PRIMARY	4	NULL	2	100.00	Using index
+1	SIMPLE	jt2	index	NULL	PRIMARY	4	NULL	2	100.00	Using index
+Warnings:
+Note	1003	select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on((`test`.`jt6`.`f1` and 1))) on(1) where 1
+EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
+RIGHT JOIN t1 AS jt2
+RIGHT JOIN t1 AS jt3
+JOIN t1 AS jt4 ON 1
+LEFT JOIN t1 AS jt5 ON 1
+ON 1
+RIGHT JOIN t1 AS jt6 ON jt6.f1
+ON 1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	jt6	index	NULL	PRIMARY	4	NULL	2	100.00	Using index
+1	SIMPLE	jt3	index	NULL	PRIMARY	4	NULL	2	100.00	Using index
+1	SIMPLE	jt4	index	NULL	PRIMARY	4	NULL	2	100.00	Using index
+1	SIMPLE	jt5	index	NULL	PRIMARY	4	NULL	2	100.00	Using index
+1	SIMPLE	jt2	index	NULL	PRIMARY	4	NULL	2	100.00	Using index
+1	SIMPLE	jt1	index	NULL	PRIMARY	4	NULL	2	100.00	Using index
+Warnings:
+Note	1003	select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on((`test`.`jt6`.`f1` and 1)) left join `test`.`t1` `jt1` on(1) where 1
+DROP TABLE t1;
 End of 5.1 tests
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index 7a79603adb3..a7407cfa699 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -496,4 +496,11 @@ SELECT * FROM t1;
 col0
 test
 DROP TABLE t1;
+#
+# Bug #52512 : Assertion `! is_set()' in 
+#  Diagnostics_area::set_ok_status on LOAD DATA
+#
+CREATE TABLE t1 (id INT NOT NULL);
+LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1;
+DROP TABLE t1;
 End of 5.1 tests
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index aae7ee6d6e0..66fe104ba0b 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -602,9 +602,11 @@ select * from t2 /* must be (3,1), (4,4) */;
 a	b
 3	1
 4	4
-show master status /* there must be the UPDATE query event */;
-File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	344		
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t2,t1 SET t2.a=t1.a+2
+master-bin.000001	#	Query	#	#	COMMIT
 delete from t1;
 delete from t2;
 insert into t1 values (1,2),(3,4),(4,4);
@@ -612,9 +614,11 @@ insert into t2 values (1,2),(3,4),(4,4);
 reset master;
 UPDATE t2,t1  SET t2.a=t2.b where t2.a=t1.a;
 ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
-show master status /* there must be the UPDATE query event */;
-File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	359		
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; UPDATE t2,t1  SET t2.a=t2.b where t2.a=t1.a
+master-bin.000001	#	Query	#	#	COMMIT
 drop table t1, t2;
 set @@session.binlog_format= @sav_binlog_format;
 drop table if exists t1, t2, t3;
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result
index 6c7b7127975..25addd7fdea 100644
--- a/mysql-test/r/partition_error.result
+++ b/mysql-test/r/partition_error.result
@@ -1,5 +1,29 @@
 drop table if exists t1;
 #
+# Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
+#
+CREATE TABLE t1 (a INT) PARTITION BY HASH (a);
+FLUSH TABLES;
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	Error	Failed to read from the .par file
+test.t1	check	Error	Incorrect information in file: './test/t1.frm'
+test.t1	check	error	Corrupt
+SELECT * FROM t1;
+ERROR HY000: Failed to read from the .par file
+# Note that it is currently impossible to drop a partitioned table
+# without the .par file
+DROP TABLE t1;
+ERROR 42S02: Unknown table 't1'
+#
+# Bug#49477: Assertion `0' failed in ha_partition.cc:5530
+# with temporary table and partitions
+#
+CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
+CREATE TEMPORARY TABLE tmp_t1 LIKE t1;
+ERROR HY000: Cannot create temporary table with partitions
+DROP TABLE t1;
+#
 # Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with
 #            subpartitions
 SET @org_mode=@@sql_mode;
diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result
index 117f6de754a..34d24f70848 100644
--- a/mysql-test/r/sp_trans_log.result
+++ b/mysql-test/r/sp_trans_log.result
@@ -14,5 +14,14 @@ end|
 reset master|
 insert into t2 values (bug23333(),1)|
 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+show binlog events from <binlog_start>|
+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
+select count(*),@a from t1 /* must be 1,1 */|
+count(*)	@a
+1	1
 drop table t1,t2;
 drop function if exists bug23333;
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
index a5880f2b452..f090eab97c8 100644
--- a/mysql-test/r/type_time.result
+++ b/mysql-test/r/type_time.result
@@ -139,6 +139,16 @@ CAST(c AS TIME)
 00:00:00
 DROP TABLE t1;
 End of 5.0 tests
+#
+# Bug#53942 valgrind warnings with timestamp() function and incomplete datetime values
+#
+CREATE TABLE t1(f1 TIME);
+INSERT INTO t1 VALUES ('23:38:57');
+SELECT TIMESTAMP(f1,'1') FROM t1;
+TIMESTAMP(f1,'1')
+NULL
+DROP TABLE t1;
+End of 5.1 tests
 CREATE TABLE t1 (f1 TIME);
 INSERT INTO t1 VALUES ('24:00:00');
 SELECT      '24:00:00' = (SELECT f1 FROM t1);
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index b4cfc28319b..b6ad1ff31bf 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -1026,6 +1026,13 @@ hostname	#
 # Test 'myisam_mmap_size' option is not dynamic
 SET @@myisam_mmap_size= 500M;
 ERROR HY000: Variable 'myisam_mmap_size' is a read only variable
+#
+# Bug #52315: utc_date() crashes when system time > year 2037
+#
+SET TIMESTAMP=2*1024*1024*1024;
+#Should not crash
+SELECT UTC_DATE();
+SET TIMESTAMP=DEFAULT;
 End of 5.0 tests
 set join_buffer_size=1;
 Warnings:
diff --git a/mysql-test/suite/binlog/r/binlog_innodb.result b/mysql-test/suite/binlog/r/binlog_innodb.result
index 65182405136..5f90dd5d3dd 100644
--- a/mysql-test/suite/binlog/r/binlog_innodb.result
+++ b/mysql-test/suite/binlog/r/binlog_innodb.result
@@ -156,10 +156,9 @@ select * from t2 /* must be (3,1), (4,4) */;
 a	b
 1	1
 4	4
-there must no UPDATE in binlog
-show master status;
-File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	#	<Binlog_Do_DB>	<Binlog_Ignore_DB>
+# There must no UPDATE in binlog;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 delete from t1;
 delete from t2;
 insert into t1 values (1,2),(3,4),(4,4);
@@ -167,9 +166,8 @@ insert into t2 values (1,2),(3,4),(4,4);
 reset master;
 UPDATE t2,t1  SET t2.a=t2.b where t2.a=t1.a;
 ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
-there must no UPDATE in binlog
-show master status;
-File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	#	<Binlog_Do_DB>	<Binlog_Ignore_DB>
+# There must be no UPDATE query event;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 drop table t1, t2;
 End of tests
diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result
index 89b70b2c77e..67a9869520b 100644
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result
@@ -26,215 +26,215 @@ create table t1 (n int) engine=innodb;
 begin;
 commit;
 drop table t1;
-show binlog events in 'master-bin.000001' from 107;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t1 (n int) engine=innodb
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Xid	1	#	COMMIT /* xid= */
-master-bin.000001	#	Rotate	1	#	master-bin.000002;pos=4
-show binlog events in 'master-bin.000002' from 107;
+master-bin.000001	#	Query	#	#	use `test`; create table t1 (n int) engine=innodb
+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	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
+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	1	#	use `test`; drop table t1
+master-bin.000002	#	Query	#	#	use `test`; drop table t1
 set @ac = @@autocommit;
 set autocommit= 0;
 reset master;
@@ -245,830 +245,828 @@ insert into t1 values (2);
 insert into t1 values (3);
 commit;
 drop table t1;
-show binlog events from 0;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	107	Server version, Binlog ver: 4
-master-bin.000001	107	Query	1	206	use `test`; create table t1(n int) engine=innodb
-master-bin.000001	206	Query	1	274	BEGIN
-master-bin.000001	274	Table_map	1	315	table_id: # (test.t1)
-master-bin.000001	315	Write_rows	1	349	table_id: # flags: STMT_END_F
-master-bin.000001	349	Table_map	1	390	table_id: # (test.t1)
-master-bin.000001	390	Write_rows	1	424	table_id: # flags: STMT_END_F
-master-bin.000001	424	Table_map	1	465	table_id: # (test.t1)
-master-bin.000001	465	Write_rows	1	499	table_id: # flags: STMT_END_F
-master-bin.000001	499	Xid	1	526	COMMIT /* XID */
-master-bin.000001	526	Query	1	602	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int) engine=innodb
+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	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; drop table t1
 set @bcs = @@binlog_cache_size;
 set global binlog_cache_size=4096;
 reset master;
 create table t1 (a int) engine=innodb;
-show binlog events from 0;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	107	Server version, Binlog ver: 4
-master-bin.000001	107	Query	1	207	use `test`; create table t1 (a int) engine=innodb
-master-bin.000001	207	Query	1	275	BEGIN
-master-bin.000001	275	Table_map	1	316	table_id: # (test.t1)
-master-bin.000001	316	Write_rows	1	350	table_id: # flags: STMT_END_F
-master-bin.000001	350	Table_map	1	391	table_id: # (test.t1)
-master-bin.000001	391	Write_rows	1	425	table_id: # flags: STMT_END_F
-master-bin.000001	425	Table_map	1	466	table_id: # (test.t1)
-master-bin.000001	466	Write_rows	1	500	table_id: # flags: STMT_END_F
-master-bin.000001	500	Table_map	1	541	table_id: # (test.t1)
-master-bin.000001	541	Write_rows	1	575	table_id: # flags: STMT_END_F
-master-bin.000001	575	Table_map	1	616	table_id: # (test.t1)
-master-bin.000001	616	Write_rows	1	650	table_id: # flags: STMT_END_F
-master-bin.000001	650	Table_map	1	691	table_id: # (test.t1)
-master-bin.000001	691	Write_rows	1	725	table_id: # flags: STMT_END_F
-master-bin.000001	725	Table_map	1	766	table_id: # (test.t1)
-master-bin.000001	766	Write_rows	1	800	table_id: # flags: STMT_END_F
-master-bin.000001	800	Table_map	1	841	table_id: # (test.t1)
-master-bin.000001	841	Write_rows	1	875	table_id: # flags: STMT_END_F
-master-bin.000001	875	Table_map	1	916	table_id: # (test.t1)
-master-bin.000001	916	Write_rows	1	950	table_id: # flags: STMT_END_F
-master-bin.000001	950	Table_map	1	991	table_id: # (test.t1)
-master-bin.000001	991	Write_rows	1	1025	table_id: # flags: STMT_END_F
-master-bin.000001	1025	Table_map	1	1066	table_id: # (test.t1)
-master-bin.000001	1066	Write_rows	1	1100	table_id: # flags: STMT_END_F
-master-bin.000001	1100	Table_map	1	1141	table_id: # (test.t1)
-master-bin.000001	1141	Write_rows	1	1175	table_id: # flags: STMT_END_F
-master-bin.000001	1175	Table_map	1	1216	table_id: # (test.t1)
-master-bin.000001	1216	Write_rows	1	1250	table_id: # flags: STMT_END_F
-master-bin.000001	1250	Table_map	1	1291	table_id: # (test.t1)
-master-bin.000001	1291	Write_rows	1	1325	table_id: # flags: STMT_END_F
-master-bin.000001	1325	Table_map	1	1366	table_id: # (test.t1)
-master-bin.000001	1366	Write_rows	1	1400	table_id: # flags: STMT_END_F
-master-bin.000001	1400	Table_map	1	1441	table_id: # (test.t1)
-master-bin.000001	1441	Write_rows	1	1475	table_id: # flags: STMT_END_F
-master-bin.000001	1475	Table_map	1	1516	table_id: # (test.t1)
-master-bin.000001	1516	Write_rows	1	1550	table_id: # flags: STMT_END_F
-master-bin.000001	1550	Table_map	1	1591	table_id: # (test.t1)
-master-bin.000001	1591	Write_rows	1	1625	table_id: # flags: STMT_END_F
-master-bin.000001	1625	Table_map	1	1666	table_id: # (test.t1)
-master-bin.000001	1666	Write_rows	1	1700	table_id: # flags: STMT_END_F
-master-bin.000001	1700	Table_map	1	1741	table_id: # (test.t1)
-master-bin.000001	1741	Write_rows	1	1775	table_id: # flags: STMT_END_F
-master-bin.000001	1775	Table_map	1	1816	table_id: # (test.t1)
-master-bin.000001	1816	Write_rows	1	1850	table_id: # flags: STMT_END_F
-master-bin.000001	1850	Table_map	1	1891	table_id: # (test.t1)
-master-bin.000001	1891	Write_rows	1	1925	table_id: # flags: STMT_END_F
-master-bin.000001	1925	Table_map	1	1966	table_id: # (test.t1)
-master-bin.000001	1966	Write_rows	1	2000	table_id: # flags: STMT_END_F
-master-bin.000001	2000	Table_map	1	2041	table_id: # (test.t1)
-master-bin.000001	2041	Write_rows	1	2075	table_id: # flags: STMT_END_F
-master-bin.000001	2075	Table_map	1	2116	table_id: # (test.t1)
-master-bin.000001	2116	Write_rows	1	2150	table_id: # flags: STMT_END_F
-master-bin.000001	2150	Table_map	1	2191	table_id: # (test.t1)
-master-bin.000001	2191	Write_rows	1	2225	table_id: # flags: STMT_END_F
-master-bin.000001	2225	Table_map	1	2266	table_id: # (test.t1)
-master-bin.000001	2266	Write_rows	1	2300	table_id: # flags: STMT_END_F
-master-bin.000001	2300	Table_map	1	2341	table_id: # (test.t1)
-master-bin.000001	2341	Write_rows	1	2375	table_id: # flags: STMT_END_F
-master-bin.000001	2375	Table_map	1	2416	table_id: # (test.t1)
-master-bin.000001	2416	Write_rows	1	2450	table_id: # flags: STMT_END_F
-master-bin.000001	2450	Table_map	1	2491	table_id: # (test.t1)
-master-bin.000001	2491	Write_rows	1	2525	table_id: # flags: STMT_END_F
-master-bin.000001	2525	Table_map	1	2566	table_id: # (test.t1)
-master-bin.000001	2566	Write_rows	1	2600	table_id: # flags: STMT_END_F
-master-bin.000001	2600	Table_map	1	2641	table_id: # (test.t1)
-master-bin.000001	2641	Write_rows	1	2675	table_id: # flags: STMT_END_F
-master-bin.000001	2675	Table_map	1	2716	table_id: # (test.t1)
-master-bin.000001	2716	Write_rows	1	2750	table_id: # flags: STMT_END_F
-master-bin.000001	2750	Table_map	1	2791	table_id: # (test.t1)
-master-bin.000001	2791	Write_rows	1	2825	table_id: # flags: STMT_END_F
-master-bin.000001	2825	Table_map	1	2866	table_id: # (test.t1)
-master-bin.000001	2866	Write_rows	1	2900	table_id: # flags: STMT_END_F
-master-bin.000001	2900	Table_map	1	2941	table_id: # (test.t1)
-master-bin.000001	2941	Write_rows	1	2975	table_id: # flags: STMT_END_F
-master-bin.000001	2975	Table_map	1	3016	table_id: # (test.t1)
-master-bin.000001	3016	Write_rows	1	3050	table_id: # flags: STMT_END_F
-master-bin.000001	3050	Table_map	1	3091	table_id: # (test.t1)
-master-bin.000001	3091	Write_rows	1	3125	table_id: # flags: STMT_END_F
-master-bin.000001	3125	Table_map	1	3166	table_id: # (test.t1)
-master-bin.000001	3166	Write_rows	1	3200	table_id: # flags: STMT_END_F
-master-bin.000001	3200	Table_map	1	3241	table_id: # (test.t1)
-master-bin.000001	3241	Write_rows	1	3275	table_id: # flags: STMT_END_F
-master-bin.000001	3275	Table_map	1	3316	table_id: # (test.t1)
-master-bin.000001	3316	Write_rows	1	3350	table_id: # flags: STMT_END_F
-master-bin.000001	3350	Table_map	1	3391	table_id: # (test.t1)
-master-bin.000001	3391	Write_rows	1	3425	table_id: # flags: STMT_END_F
-master-bin.000001	3425	Table_map	1	3466	table_id: # (test.t1)
-master-bin.000001	3466	Write_rows	1	3500	table_id: # flags: STMT_END_F
-master-bin.000001	3500	Table_map	1	3541	table_id: # (test.t1)
-master-bin.000001	3541	Write_rows	1	3575	table_id: # flags: STMT_END_F
-master-bin.000001	3575	Table_map	1	3616	table_id: # (test.t1)
-master-bin.000001	3616	Write_rows	1	3650	table_id: # flags: STMT_END_F
-master-bin.000001	3650	Table_map	1	3691	table_id: # (test.t1)
-master-bin.000001	3691	Write_rows	1	3725	table_id: # flags: STMT_END_F
-master-bin.000001	3725	Table_map	1	3766	table_id: # (test.t1)
-master-bin.000001	3766	Write_rows	1	3800	table_id: # flags: STMT_END_F
-master-bin.000001	3800	Table_map	1	3841	table_id: # (test.t1)
-master-bin.000001	3841	Write_rows	1	3875	table_id: # flags: STMT_END_F
-master-bin.000001	3875	Table_map	1	3916	table_id: # (test.t1)
-master-bin.000001	3916	Write_rows	1	3950	table_id: # flags: STMT_END_F
-master-bin.000001	3950	Table_map	1	3991	table_id: # (test.t1)
-master-bin.000001	3991	Write_rows	1	4025	table_id: # flags: STMT_END_F
-master-bin.000001	4025	Table_map	1	4066	table_id: # (test.t1)
-master-bin.000001	4066	Write_rows	1	4100	table_id: # flags: STMT_END_F
-master-bin.000001	4100	Table_map	1	4141	table_id: # (test.t1)
-master-bin.000001	4141	Write_rows	1	4175	table_id: # flags: STMT_END_F
-master-bin.000001	4175	Table_map	1	4216	table_id: # (test.t1)
-master-bin.000001	4216	Write_rows	1	4250	table_id: # flags: STMT_END_F
-master-bin.000001	4250	Table_map	1	4291	table_id: # (test.t1)
-master-bin.000001	4291	Write_rows	1	4325	table_id: # flags: STMT_END_F
-master-bin.000001	4325	Table_map	1	4366	table_id: # (test.t1)
-master-bin.000001	4366	Write_rows	1	4400	table_id: # flags: STMT_END_F
-master-bin.000001	4400	Table_map	1	4441	table_id: # (test.t1)
-master-bin.000001	4441	Write_rows	1	4475	table_id: # flags: STMT_END_F
-master-bin.000001	4475	Table_map	1	4516	table_id: # (test.t1)
-master-bin.000001	4516	Write_rows	1	4550	table_id: # flags: STMT_END_F
-master-bin.000001	4550	Table_map	1	4591	table_id: # (test.t1)
-master-bin.000001	4591	Write_rows	1	4625	table_id: # flags: STMT_END_F
-master-bin.000001	4625	Table_map	1	4666	table_id: # (test.t1)
-master-bin.000001	4666	Write_rows	1	4700	table_id: # flags: STMT_END_F
-master-bin.000001	4700	Table_map	1	4741	table_id: # (test.t1)
-master-bin.000001	4741	Write_rows	1	4775	table_id: # flags: STMT_END_F
-master-bin.000001	4775	Table_map	1	4816	table_id: # (test.t1)
-master-bin.000001	4816	Write_rows	1	4850	table_id: # flags: STMT_END_F
-master-bin.000001	4850	Table_map	1	4891	table_id: # (test.t1)
-master-bin.000001	4891	Write_rows	1	4925	table_id: # flags: STMT_END_F
-master-bin.000001	4925	Table_map	1	4966	table_id: # (test.t1)
-master-bin.000001	4966	Write_rows	1	5000	table_id: # flags: STMT_END_F
-master-bin.000001	5000	Table_map	1	5041	table_id: # (test.t1)
-master-bin.000001	5041	Write_rows	1	5075	table_id: # flags: STMT_END_F
-master-bin.000001	5075	Table_map	1	5116	table_id: # (test.t1)
-master-bin.000001	5116	Write_rows	1	5150	table_id: # flags: STMT_END_F
-master-bin.000001	5150	Table_map	1	5191	table_id: # (test.t1)
-master-bin.000001	5191	Write_rows	1	5225	table_id: # flags: STMT_END_F
-master-bin.000001	5225	Table_map	1	5266	table_id: # (test.t1)
-master-bin.000001	5266	Write_rows	1	5300	table_id: # flags: STMT_END_F
-master-bin.000001	5300	Table_map	1	5341	table_id: # (test.t1)
-master-bin.000001	5341	Write_rows	1	5375	table_id: # flags: STMT_END_F
-master-bin.000001	5375	Table_map	1	5416	table_id: # (test.t1)
-master-bin.000001	5416	Write_rows	1	5450	table_id: # flags: STMT_END_F
-master-bin.000001	5450	Table_map	1	5491	table_id: # (test.t1)
-master-bin.000001	5491	Write_rows	1	5525	table_id: # flags: STMT_END_F
-master-bin.000001	5525	Table_map	1	5566	table_id: # (test.t1)
-master-bin.000001	5566	Write_rows	1	5600	table_id: # flags: STMT_END_F
-master-bin.000001	5600	Table_map	1	5641	table_id: # (test.t1)
-master-bin.000001	5641	Write_rows	1	5675	table_id: # flags: STMT_END_F
-master-bin.000001	5675	Table_map	1	5716	table_id: # (test.t1)
-master-bin.000001	5716	Write_rows	1	5750	table_id: # flags: STMT_END_F
-master-bin.000001	5750	Table_map	1	5791	table_id: # (test.t1)
-master-bin.000001	5791	Write_rows	1	5825	table_id: # flags: STMT_END_F
-master-bin.000001	5825	Table_map	1	5866	table_id: # (test.t1)
-master-bin.000001	5866	Write_rows	1	5900	table_id: # flags: STMT_END_F
-master-bin.000001	5900	Table_map	1	5941	table_id: # (test.t1)
-master-bin.000001	5941	Write_rows	1	5975	table_id: # flags: STMT_END_F
-master-bin.000001	5975	Table_map	1	6016	table_id: # (test.t1)
-master-bin.000001	6016	Write_rows	1	6050	table_id: # flags: STMT_END_F
-master-bin.000001	6050	Table_map	1	6091	table_id: # (test.t1)
-master-bin.000001	6091	Write_rows	1	6125	table_id: # flags: STMT_END_F
-master-bin.000001	6125	Table_map	1	6166	table_id: # (test.t1)
-master-bin.000001	6166	Write_rows	1	6200	table_id: # flags: STMT_END_F
-master-bin.000001	6200	Table_map	1	6241	table_id: # (test.t1)
-master-bin.000001	6241	Write_rows	1	6275	table_id: # flags: STMT_END_F
-master-bin.000001	6275	Table_map	1	6316	table_id: # (test.t1)
-master-bin.000001	6316	Write_rows	1	6350	table_id: # flags: STMT_END_F
-master-bin.000001	6350	Table_map	1	6391	table_id: # (test.t1)
-master-bin.000001	6391	Write_rows	1	6425	table_id: # flags: STMT_END_F
-master-bin.000001	6425	Table_map	1	6466	table_id: # (test.t1)
-master-bin.000001	6466	Write_rows	1	6500	table_id: # flags: STMT_END_F
-master-bin.000001	6500	Table_map	1	6541	table_id: # (test.t1)
-master-bin.000001	6541	Write_rows	1	6575	table_id: # flags: STMT_END_F
-master-bin.000001	6575	Table_map	1	6616	table_id: # (test.t1)
-master-bin.000001	6616	Write_rows	1	6650	table_id: # flags: STMT_END_F
-master-bin.000001	6650	Table_map	1	6691	table_id: # (test.t1)
-master-bin.000001	6691	Write_rows	1	6725	table_id: # flags: STMT_END_F
-master-bin.000001	6725	Table_map	1	6766	table_id: # (test.t1)
-master-bin.000001	6766	Write_rows	1	6800	table_id: # flags: STMT_END_F
-master-bin.000001	6800	Table_map	1	6841	table_id: # (test.t1)
-master-bin.000001	6841	Write_rows	1	6875	table_id: # flags: STMT_END_F
-master-bin.000001	6875	Table_map	1	6916	table_id: # (test.t1)
-master-bin.000001	6916	Write_rows	1	6950	table_id: # flags: STMT_END_F
-master-bin.000001	6950	Table_map	1	6991	table_id: # (test.t1)
-master-bin.000001	6991	Write_rows	1	7025	table_id: # flags: STMT_END_F
-master-bin.000001	7025	Table_map	1	7066	table_id: # (test.t1)
-master-bin.000001	7066	Write_rows	1	7100	table_id: # flags: STMT_END_F
-master-bin.000001	7100	Table_map	1	7141	table_id: # (test.t1)
-master-bin.000001	7141	Write_rows	1	7175	table_id: # flags: STMT_END_F
-master-bin.000001	7175	Table_map	1	7216	table_id: # (test.t1)
-master-bin.000001	7216	Write_rows	1	7250	table_id: # flags: STMT_END_F
-master-bin.000001	7250	Table_map	1	7291	table_id: # (test.t1)
-master-bin.000001	7291	Write_rows	1	7325	table_id: # flags: STMT_END_F
-master-bin.000001	7325	Table_map	1	7366	table_id: # (test.t1)
-master-bin.000001	7366	Write_rows	1	7400	table_id: # flags: STMT_END_F
-master-bin.000001	7400	Table_map	1	7441	table_id: # (test.t1)
-master-bin.000001	7441	Write_rows	1	7475	table_id: # flags: STMT_END_F
-master-bin.000001	7475	Table_map	1	7516	table_id: # (test.t1)
-master-bin.000001	7516	Write_rows	1	7550	table_id: # flags: STMT_END_F
-master-bin.000001	7550	Table_map	1	7591	table_id: # (test.t1)
-master-bin.000001	7591	Write_rows	1	7625	table_id: # flags: STMT_END_F
-master-bin.000001	7625	Table_map	1	7666	table_id: # (test.t1)
-master-bin.000001	7666	Write_rows	1	7700	table_id: # flags: STMT_END_F
-master-bin.000001	7700	Table_map	1	7741	table_id: # (test.t1)
-master-bin.000001	7741	Write_rows	1	7775	table_id: # flags: STMT_END_F
-master-bin.000001	7775	Table_map	1	7816	table_id: # (test.t1)
-master-bin.000001	7816	Write_rows	1	7850	table_id: # flags: STMT_END_F
-master-bin.000001	7850	Table_map	1	7891	table_id: # (test.t1)
-master-bin.000001	7891	Write_rows	1	7925	table_id: # flags: STMT_END_F
-master-bin.000001	7925	Table_map	1	7966	table_id: # (test.t1)
-master-bin.000001	7966	Write_rows	1	8000	table_id: # flags: STMT_END_F
-master-bin.000001	8000	Table_map	1	8041	table_id: # (test.t1)
-master-bin.000001	8041	Write_rows	1	8075	table_id: # flags: STMT_END_F
-master-bin.000001	8075	Table_map	1	8116	table_id: # (test.t1)
-master-bin.000001	8116	Write_rows	1	8150	table_id: # flags: STMT_END_F
-master-bin.000001	8150	Table_map	1	8191	table_id: # (test.t1)
-master-bin.000001	8191	Write_rows	1	8225	table_id: # flags: STMT_END_F
-master-bin.000001	8225	Table_map	1	8266	table_id: # (test.t1)
-master-bin.000001	8266	Write_rows	1	8300	table_id: # flags: STMT_END_F
-master-bin.000001	8300	Table_map	1	8341	table_id: # (test.t1)
-master-bin.000001	8341	Write_rows	1	8375	table_id: # flags: STMT_END_F
-master-bin.000001	8375	Table_map	1	8416	table_id: # (test.t1)
-master-bin.000001	8416	Write_rows	1	8450	table_id: # flags: STMT_END_F
-master-bin.000001	8450	Table_map	1	8491	table_id: # (test.t1)
-master-bin.000001	8491	Write_rows	1	8525	table_id: # flags: STMT_END_F
-master-bin.000001	8525	Table_map	1	8566	table_id: # (test.t1)
-master-bin.000001	8566	Write_rows	1	8600	table_id: # flags: STMT_END_F
-master-bin.000001	8600	Table_map	1	8641	table_id: # (test.t1)
-master-bin.000001	8641	Write_rows	1	8675	table_id: # flags: STMT_END_F
-master-bin.000001	8675	Table_map	1	8716	table_id: # (test.t1)
-master-bin.000001	8716	Write_rows	1	8750	table_id: # flags: STMT_END_F
-master-bin.000001	8750	Table_map	1	8791	table_id: # (test.t1)
-master-bin.000001	8791	Write_rows	1	8825	table_id: # flags: STMT_END_F
-master-bin.000001	8825	Table_map	1	8866	table_id: # (test.t1)
-master-bin.000001	8866	Write_rows	1	8900	table_id: # flags: STMT_END_F
-master-bin.000001	8900	Table_map	1	8941	table_id: # (test.t1)
-master-bin.000001	8941	Write_rows	1	8975	table_id: # flags: STMT_END_F
-master-bin.000001	8975	Table_map	1	9016	table_id: # (test.t1)
-master-bin.000001	9016	Write_rows	1	9050	table_id: # flags: STMT_END_F
-master-bin.000001	9050	Table_map	1	9091	table_id: # (test.t1)
-master-bin.000001	9091	Write_rows	1	9125	table_id: # flags: STMT_END_F
-master-bin.000001	9125	Table_map	1	9166	table_id: # (test.t1)
-master-bin.000001	9166	Write_rows	1	9200	table_id: # flags: STMT_END_F
-master-bin.000001	9200	Table_map	1	9241	table_id: # (test.t1)
-master-bin.000001	9241	Write_rows	1	9275	table_id: # flags: STMT_END_F
-master-bin.000001	9275	Table_map	1	9316	table_id: # (test.t1)
-master-bin.000001	9316	Write_rows	1	9350	table_id: # flags: STMT_END_F
-master-bin.000001	9350	Table_map	1	9391	table_id: # (test.t1)
-master-bin.000001	9391	Write_rows	1	9425	table_id: # flags: STMT_END_F
-master-bin.000001	9425	Table_map	1	9466	table_id: # (test.t1)
-master-bin.000001	9466	Write_rows	1	9500	table_id: # flags: STMT_END_F
-master-bin.000001	9500	Table_map	1	9541	table_id: # (test.t1)
-master-bin.000001	9541	Write_rows	1	9575	table_id: # flags: STMT_END_F
-master-bin.000001	9575	Table_map	1	9616	table_id: # (test.t1)
-master-bin.000001	9616	Write_rows	1	9650	table_id: # flags: STMT_END_F
-master-bin.000001	9650	Table_map	1	9691	table_id: # (test.t1)
-master-bin.000001	9691	Write_rows	1	9725	table_id: # flags: STMT_END_F
-master-bin.000001	9725	Table_map	1	9766	table_id: # (test.t1)
-master-bin.000001	9766	Write_rows	1	9800	table_id: # flags: STMT_END_F
-master-bin.000001	9800	Table_map	1	9841	table_id: # (test.t1)
-master-bin.000001	9841	Write_rows	1	9875	table_id: # flags: STMT_END_F
-master-bin.000001	9875	Table_map	1	9916	table_id: # (test.t1)
-master-bin.000001	9916	Write_rows	1	9950	table_id: # flags: STMT_END_F
-master-bin.000001	9950	Table_map	1	9991	table_id: # (test.t1)
-master-bin.000001	9991	Write_rows	1	10025	table_id: # flags: STMT_END_F
-master-bin.000001	10025	Table_map	1	10066	table_id: # (test.t1)
-master-bin.000001	10066	Write_rows	1	10100	table_id: # flags: STMT_END_F
-master-bin.000001	10100	Table_map	1	10141	table_id: # (test.t1)
-master-bin.000001	10141	Write_rows	1	10175	table_id: # flags: STMT_END_F
-master-bin.000001	10175	Table_map	1	10216	table_id: # (test.t1)
-master-bin.000001	10216	Write_rows	1	10250	table_id: # flags: STMT_END_F
-master-bin.000001	10250	Table_map	1	10291	table_id: # (test.t1)
-master-bin.000001	10291	Write_rows	1	10325	table_id: # flags: STMT_END_F
-master-bin.000001	10325	Table_map	1	10366	table_id: # (test.t1)
-master-bin.000001	10366	Write_rows	1	10400	table_id: # flags: STMT_END_F
-master-bin.000001	10400	Table_map	1	10441	table_id: # (test.t1)
-master-bin.000001	10441	Write_rows	1	10475	table_id: # flags: STMT_END_F
-master-bin.000001	10475	Table_map	1	10516	table_id: # (test.t1)
-master-bin.000001	10516	Write_rows	1	10550	table_id: # flags: STMT_END_F
-master-bin.000001	10550	Table_map	1	10591	table_id: # (test.t1)
-master-bin.000001	10591	Write_rows	1	10625	table_id: # flags: STMT_END_F
-master-bin.000001	10625	Table_map	1	10666	table_id: # (test.t1)
-master-bin.000001	10666	Write_rows	1	10700	table_id: # flags: STMT_END_F
-master-bin.000001	10700	Table_map	1	10741	table_id: # (test.t1)
-master-bin.000001	10741	Write_rows	1	10775	table_id: # flags: STMT_END_F
-master-bin.000001	10775	Table_map	1	10816	table_id: # (test.t1)
-master-bin.000001	10816	Write_rows	1	10850	table_id: # flags: STMT_END_F
-master-bin.000001	10850	Table_map	1	10891	table_id: # (test.t1)
-master-bin.000001	10891	Write_rows	1	10925	table_id: # flags: STMT_END_F
-master-bin.000001	10925	Table_map	1	10966	table_id: # (test.t1)
-master-bin.000001	10966	Write_rows	1	11000	table_id: # flags: STMT_END_F
-master-bin.000001	11000	Table_map	1	11041	table_id: # (test.t1)
-master-bin.000001	11041	Write_rows	1	11075	table_id: # flags: STMT_END_F
-master-bin.000001	11075	Table_map	1	11116	table_id: # (test.t1)
-master-bin.000001	11116	Write_rows	1	11150	table_id: # flags: STMT_END_F
-master-bin.000001	11150	Table_map	1	11191	table_id: # (test.t1)
-master-bin.000001	11191	Write_rows	1	11225	table_id: # flags: STMT_END_F
-master-bin.000001	11225	Table_map	1	11266	table_id: # (test.t1)
-master-bin.000001	11266	Write_rows	1	11300	table_id: # flags: STMT_END_F
-master-bin.000001	11300	Table_map	1	11341	table_id: # (test.t1)
-master-bin.000001	11341	Write_rows	1	11375	table_id: # flags: STMT_END_F
-master-bin.000001	11375	Table_map	1	11416	table_id: # (test.t1)
-master-bin.000001	11416	Write_rows	1	11450	table_id: # flags: STMT_END_F
-master-bin.000001	11450	Table_map	1	11491	table_id: # (test.t1)
-master-bin.000001	11491	Write_rows	1	11525	table_id: # flags: STMT_END_F
-master-bin.000001	11525	Table_map	1	11566	table_id: # (test.t1)
-master-bin.000001	11566	Write_rows	1	11600	table_id: # flags: STMT_END_F
-master-bin.000001	11600	Table_map	1	11641	table_id: # (test.t1)
-master-bin.000001	11641	Write_rows	1	11675	table_id: # flags: STMT_END_F
-master-bin.000001	11675	Table_map	1	11716	table_id: # (test.t1)
-master-bin.000001	11716	Write_rows	1	11750	table_id: # flags: STMT_END_F
-master-bin.000001	11750	Table_map	1	11791	table_id: # (test.t1)
-master-bin.000001	11791	Write_rows	1	11825	table_id: # flags: STMT_END_F
-master-bin.000001	11825	Table_map	1	11866	table_id: # (test.t1)
-master-bin.000001	11866	Write_rows	1	11900	table_id: # flags: STMT_END_F
-master-bin.000001	11900	Table_map	1	11941	table_id: # (test.t1)
-master-bin.000001	11941	Write_rows	1	11975	table_id: # flags: STMT_END_F
-master-bin.000001	11975	Table_map	1	12016	table_id: # (test.t1)
-master-bin.000001	12016	Write_rows	1	12050	table_id: # flags: STMT_END_F
-master-bin.000001	12050	Table_map	1	12091	table_id: # (test.t1)
-master-bin.000001	12091	Write_rows	1	12125	table_id: # flags: STMT_END_F
-master-bin.000001	12125	Table_map	1	12166	table_id: # (test.t1)
-master-bin.000001	12166	Write_rows	1	12200	table_id: # flags: STMT_END_F
-master-bin.000001	12200	Table_map	1	12241	table_id: # (test.t1)
-master-bin.000001	12241	Write_rows	1	12275	table_id: # flags: STMT_END_F
-master-bin.000001	12275	Table_map	1	12316	table_id: # (test.t1)
-master-bin.000001	12316	Write_rows	1	12350	table_id: # flags: STMT_END_F
-master-bin.000001	12350	Table_map	1	12391	table_id: # (test.t1)
-master-bin.000001	12391	Write_rows	1	12425	table_id: # flags: STMT_END_F
-master-bin.000001	12425	Table_map	1	12466	table_id: # (test.t1)
-master-bin.000001	12466	Write_rows	1	12500	table_id: # flags: STMT_END_F
-master-bin.000001	12500	Table_map	1	12541	table_id: # (test.t1)
-master-bin.000001	12541	Write_rows	1	12575	table_id: # flags: STMT_END_F
-master-bin.000001	12575	Table_map	1	12616	table_id: # (test.t1)
-master-bin.000001	12616	Write_rows	1	12650	table_id: # flags: STMT_END_F
-master-bin.000001	12650	Table_map	1	12691	table_id: # (test.t1)
-master-bin.000001	12691	Write_rows	1	12725	table_id: # flags: STMT_END_F
-master-bin.000001	12725	Table_map	1	12766	table_id: # (test.t1)
-master-bin.000001	12766	Write_rows	1	12800	table_id: # flags: STMT_END_F
-master-bin.000001	12800	Table_map	1	12841	table_id: # (test.t1)
-master-bin.000001	12841	Write_rows	1	12875	table_id: # flags: STMT_END_F
-master-bin.000001	12875	Table_map	1	12916	table_id: # (test.t1)
-master-bin.000001	12916	Write_rows	1	12950	table_id: # flags: STMT_END_F
-master-bin.000001	12950	Table_map	1	12991	table_id: # (test.t1)
-master-bin.000001	12991	Write_rows	1	13025	table_id: # flags: STMT_END_F
-master-bin.000001	13025	Table_map	1	13066	table_id: # (test.t1)
-master-bin.000001	13066	Write_rows	1	13100	table_id: # flags: STMT_END_F
-master-bin.000001	13100	Table_map	1	13141	table_id: # (test.t1)
-master-bin.000001	13141	Write_rows	1	13175	table_id: # flags: STMT_END_F
-master-bin.000001	13175	Table_map	1	13216	table_id: # (test.t1)
-master-bin.000001	13216	Write_rows	1	13250	table_id: # flags: STMT_END_F
-master-bin.000001	13250	Table_map	1	13291	table_id: # (test.t1)
-master-bin.000001	13291	Write_rows	1	13325	table_id: # flags: STMT_END_F
-master-bin.000001	13325	Table_map	1	13366	table_id: # (test.t1)
-master-bin.000001	13366	Write_rows	1	13400	table_id: # flags: STMT_END_F
-master-bin.000001	13400	Table_map	1	13441	table_id: # (test.t1)
-master-bin.000001	13441	Write_rows	1	13475	table_id: # flags: STMT_END_F
-master-bin.000001	13475	Table_map	1	13516	table_id: # (test.t1)
-master-bin.000001	13516	Write_rows	1	13550	table_id: # flags: STMT_END_F
-master-bin.000001	13550	Table_map	1	13591	table_id: # (test.t1)
-master-bin.000001	13591	Write_rows	1	13625	table_id: # flags: STMT_END_F
-master-bin.000001	13625	Table_map	1	13666	table_id: # (test.t1)
-master-bin.000001	13666	Write_rows	1	13700	table_id: # flags: STMT_END_F
-master-bin.000001	13700	Table_map	1	13741	table_id: # (test.t1)
-master-bin.000001	13741	Write_rows	1	13775	table_id: # flags: STMT_END_F
-master-bin.000001	13775	Table_map	1	13816	table_id: # (test.t1)
-master-bin.000001	13816	Write_rows	1	13850	table_id: # flags: STMT_END_F
-master-bin.000001	13850	Table_map	1	13891	table_id: # (test.t1)
-master-bin.000001	13891	Write_rows	1	13925	table_id: # flags: STMT_END_F
-master-bin.000001	13925	Table_map	1	13966	table_id: # (test.t1)
-master-bin.000001	13966	Write_rows	1	14000	table_id: # flags: STMT_END_F
-master-bin.000001	14000	Table_map	1	14041	table_id: # (test.t1)
-master-bin.000001	14041	Write_rows	1	14075	table_id: # flags: STMT_END_F
-master-bin.000001	14075	Table_map	1	14116	table_id: # (test.t1)
-master-bin.000001	14116	Write_rows	1	14150	table_id: # flags: STMT_END_F
-master-bin.000001	14150	Table_map	1	14191	table_id: # (test.t1)
-master-bin.000001	14191	Write_rows	1	14225	table_id: # flags: STMT_END_F
-master-bin.000001	14225	Table_map	1	14266	table_id: # (test.t1)
-master-bin.000001	14266	Write_rows	1	14300	table_id: # flags: STMT_END_F
-master-bin.000001	14300	Table_map	1	14341	table_id: # (test.t1)
-master-bin.000001	14341	Write_rows	1	14375	table_id: # flags: STMT_END_F
-master-bin.000001	14375	Table_map	1	14416	table_id: # (test.t1)
-master-bin.000001	14416	Write_rows	1	14450	table_id: # flags: STMT_END_F
-master-bin.000001	14450	Table_map	1	14491	table_id: # (test.t1)
-master-bin.000001	14491	Write_rows	1	14525	table_id: # flags: STMT_END_F
-master-bin.000001	14525	Table_map	1	14566	table_id: # (test.t1)
-master-bin.000001	14566	Write_rows	1	14600	table_id: # flags: STMT_END_F
-master-bin.000001	14600	Table_map	1	14641	table_id: # (test.t1)
-master-bin.000001	14641	Write_rows	1	14675	table_id: # flags: STMT_END_F
-master-bin.000001	14675	Table_map	1	14716	table_id: # (test.t1)
-master-bin.000001	14716	Write_rows	1	14750	table_id: # flags: STMT_END_F
-master-bin.000001	14750	Table_map	1	14791	table_id: # (test.t1)
-master-bin.000001	14791	Write_rows	1	14825	table_id: # flags: STMT_END_F
-master-bin.000001	14825	Table_map	1	14866	table_id: # (test.t1)
-master-bin.000001	14866	Write_rows	1	14900	table_id: # flags: STMT_END_F
-master-bin.000001	14900	Table_map	1	14941	table_id: # (test.t1)
-master-bin.000001	14941	Write_rows	1	14975	table_id: # flags: STMT_END_F
-master-bin.000001	14975	Table_map	1	15016	table_id: # (test.t1)
-master-bin.000001	15016	Write_rows	1	15050	table_id: # flags: STMT_END_F
-master-bin.000001	15050	Table_map	1	15091	table_id: # (test.t1)
-master-bin.000001	15091	Write_rows	1	15125	table_id: # flags: STMT_END_F
-master-bin.000001	15125	Table_map	1	15166	table_id: # (test.t1)
-master-bin.000001	15166	Write_rows	1	15200	table_id: # flags: STMT_END_F
-master-bin.000001	15200	Table_map	1	15241	table_id: # (test.t1)
-master-bin.000001	15241	Write_rows	1	15275	table_id: # flags: STMT_END_F
-master-bin.000001	15275	Table_map	1	15316	table_id: # (test.t1)
-master-bin.000001	15316	Write_rows	1	15350	table_id: # flags: STMT_END_F
-master-bin.000001	15350	Table_map	1	15391	table_id: # (test.t1)
-master-bin.000001	15391	Write_rows	1	15425	table_id: # flags: STMT_END_F
-master-bin.000001	15425	Table_map	1	15466	table_id: # (test.t1)
-master-bin.000001	15466	Write_rows	1	15500	table_id: # flags: STMT_END_F
-master-bin.000001	15500	Table_map	1	15541	table_id: # (test.t1)
-master-bin.000001	15541	Write_rows	1	15575	table_id: # flags: STMT_END_F
-master-bin.000001	15575	Table_map	1	15616	table_id: # (test.t1)
-master-bin.000001	15616	Write_rows	1	15650	table_id: # flags: STMT_END_F
-master-bin.000001	15650	Table_map	1	15691	table_id: # (test.t1)
-master-bin.000001	15691	Write_rows	1	15725	table_id: # flags: STMT_END_F
-master-bin.000001	15725	Table_map	1	15766	table_id: # (test.t1)
-master-bin.000001	15766	Write_rows	1	15800	table_id: # flags: STMT_END_F
-master-bin.000001	15800	Table_map	1	15841	table_id: # (test.t1)
-master-bin.000001	15841	Write_rows	1	15875	table_id: # flags: STMT_END_F
-master-bin.000001	15875	Table_map	1	15916	table_id: # (test.t1)
-master-bin.000001	15916	Write_rows	1	15950	table_id: # flags: STMT_END_F
-master-bin.000001	15950	Table_map	1	15991	table_id: # (test.t1)
-master-bin.000001	15991	Write_rows	1	16025	table_id: # flags: STMT_END_F
-master-bin.000001	16025	Table_map	1	16066	table_id: # (test.t1)
-master-bin.000001	16066	Write_rows	1	16100	table_id: # flags: STMT_END_F
-master-bin.000001	16100	Table_map	1	16141	table_id: # (test.t1)
-master-bin.000001	16141	Write_rows	1	16175	table_id: # flags: STMT_END_F
-master-bin.000001	16175	Table_map	1	16216	table_id: # (test.t1)
-master-bin.000001	16216	Write_rows	1	16250	table_id: # flags: STMT_END_F
-master-bin.000001	16250	Table_map	1	16291	table_id: # (test.t1)
-master-bin.000001	16291	Write_rows	1	16325	table_id: # flags: STMT_END_F
-master-bin.000001	16325	Table_map	1	16366	table_id: # (test.t1)
-master-bin.000001	16366	Write_rows	1	16400	table_id: # flags: STMT_END_F
-master-bin.000001	16400	Table_map	1	16441	table_id: # (test.t1)
-master-bin.000001	16441	Write_rows	1	16475	table_id: # flags: STMT_END_F
-master-bin.000001	16475	Table_map	1	16516	table_id: # (test.t1)
-master-bin.000001	16516	Write_rows	1	16550	table_id: # flags: STMT_END_F
-master-bin.000001	16550	Table_map	1	16591	table_id: # (test.t1)
-master-bin.000001	16591	Write_rows	1	16625	table_id: # flags: STMT_END_F
-master-bin.000001	16625	Table_map	1	16666	table_id: # (test.t1)
-master-bin.000001	16666	Write_rows	1	16700	table_id: # flags: STMT_END_F
-master-bin.000001	16700	Table_map	1	16741	table_id: # (test.t1)
-master-bin.000001	16741	Write_rows	1	16775	table_id: # flags: STMT_END_F
-master-bin.000001	16775	Table_map	1	16816	table_id: # (test.t1)
-master-bin.000001	16816	Write_rows	1	16850	table_id: # flags: STMT_END_F
-master-bin.000001	16850	Table_map	1	16891	table_id: # (test.t1)
-master-bin.000001	16891	Write_rows	1	16925	table_id: # flags: STMT_END_F
-master-bin.000001	16925	Table_map	1	16966	table_id: # (test.t1)
-master-bin.000001	16966	Write_rows	1	17000	table_id: # flags: STMT_END_F
-master-bin.000001	17000	Table_map	1	17041	table_id: # (test.t1)
-master-bin.000001	17041	Write_rows	1	17075	table_id: # flags: STMT_END_F
-master-bin.000001	17075	Table_map	1	17116	table_id: # (test.t1)
-master-bin.000001	17116	Write_rows	1	17150	table_id: # flags: STMT_END_F
-master-bin.000001	17150	Table_map	1	17191	table_id: # (test.t1)
-master-bin.000001	17191	Write_rows	1	17225	table_id: # flags: STMT_END_F
-master-bin.000001	17225	Table_map	1	17266	table_id: # (test.t1)
-master-bin.000001	17266	Write_rows	1	17300	table_id: # flags: STMT_END_F
-master-bin.000001	17300	Table_map	1	17341	table_id: # (test.t1)
-master-bin.000001	17341	Write_rows	1	17375	table_id: # flags: STMT_END_F
-master-bin.000001	17375	Table_map	1	17416	table_id: # (test.t1)
-master-bin.000001	17416	Write_rows	1	17450	table_id: # flags: STMT_END_F
-master-bin.000001	17450	Table_map	1	17491	table_id: # (test.t1)
-master-bin.000001	17491	Write_rows	1	17525	table_id: # flags: STMT_END_F
-master-bin.000001	17525	Table_map	1	17566	table_id: # (test.t1)
-master-bin.000001	17566	Write_rows	1	17600	table_id: # flags: STMT_END_F
-master-bin.000001	17600	Table_map	1	17641	table_id: # (test.t1)
-master-bin.000001	17641	Write_rows	1	17675	table_id: # flags: STMT_END_F
-master-bin.000001	17675	Table_map	1	17716	table_id: # (test.t1)
-master-bin.000001	17716	Write_rows	1	17750	table_id: # flags: STMT_END_F
-master-bin.000001	17750	Table_map	1	17791	table_id: # (test.t1)
-master-bin.000001	17791	Write_rows	1	17825	table_id: # flags: STMT_END_F
-master-bin.000001	17825	Table_map	1	17866	table_id: # (test.t1)
-master-bin.000001	17866	Write_rows	1	17900	table_id: # flags: STMT_END_F
-master-bin.000001	17900	Table_map	1	17941	table_id: # (test.t1)
-master-bin.000001	17941	Write_rows	1	17975	table_id: # flags: STMT_END_F
-master-bin.000001	17975	Table_map	1	18016	table_id: # (test.t1)
-master-bin.000001	18016	Write_rows	1	18050	table_id: # flags: STMT_END_F
-master-bin.000001	18050	Table_map	1	18091	table_id: # (test.t1)
-master-bin.000001	18091	Write_rows	1	18125	table_id: # flags: STMT_END_F
-master-bin.000001	18125	Table_map	1	18166	table_id: # (test.t1)
-master-bin.000001	18166	Write_rows	1	18200	table_id: # flags: STMT_END_F
-master-bin.000001	18200	Table_map	1	18241	table_id: # (test.t1)
-master-bin.000001	18241	Write_rows	1	18275	table_id: # flags: STMT_END_F
-master-bin.000001	18275	Table_map	1	18316	table_id: # (test.t1)
-master-bin.000001	18316	Write_rows	1	18350	table_id: # flags: STMT_END_F
-master-bin.000001	18350	Table_map	1	18391	table_id: # (test.t1)
-master-bin.000001	18391	Write_rows	1	18425	table_id: # flags: STMT_END_F
-master-bin.000001	18425	Table_map	1	18466	table_id: # (test.t1)
-master-bin.000001	18466	Write_rows	1	18500	table_id: # flags: STMT_END_F
-master-bin.000001	18500	Table_map	1	18541	table_id: # (test.t1)
-master-bin.000001	18541	Write_rows	1	18575	table_id: # flags: STMT_END_F
-master-bin.000001	18575	Table_map	1	18616	table_id: # (test.t1)
-master-bin.000001	18616	Write_rows	1	18650	table_id: # flags: STMT_END_F
-master-bin.000001	18650	Table_map	1	18691	table_id: # (test.t1)
-master-bin.000001	18691	Write_rows	1	18725	table_id: # flags: STMT_END_F
-master-bin.000001	18725	Table_map	1	18766	table_id: # (test.t1)
-master-bin.000001	18766	Write_rows	1	18800	table_id: # flags: STMT_END_F
-master-bin.000001	18800	Table_map	1	18841	table_id: # (test.t1)
-master-bin.000001	18841	Write_rows	1	18875	table_id: # flags: STMT_END_F
-master-bin.000001	18875	Table_map	1	18916	table_id: # (test.t1)
-master-bin.000001	18916	Write_rows	1	18950	table_id: # flags: STMT_END_F
-master-bin.000001	18950	Table_map	1	18991	table_id: # (test.t1)
-master-bin.000001	18991	Write_rows	1	19025	table_id: # flags: STMT_END_F
-master-bin.000001	19025	Table_map	1	19066	table_id: # (test.t1)
-master-bin.000001	19066	Write_rows	1	19100	table_id: # flags: STMT_END_F
-master-bin.000001	19100	Table_map	1	19141	table_id: # (test.t1)
-master-bin.000001	19141	Write_rows	1	19175	table_id: # flags: STMT_END_F
-master-bin.000001	19175	Table_map	1	19216	table_id: # (test.t1)
-master-bin.000001	19216	Write_rows	1	19250	table_id: # flags: STMT_END_F
-master-bin.000001	19250	Table_map	1	19291	table_id: # (test.t1)
-master-bin.000001	19291	Write_rows	1	19325	table_id: # flags: STMT_END_F
-master-bin.000001	19325	Table_map	1	19366	table_id: # (test.t1)
-master-bin.000001	19366	Write_rows	1	19400	table_id: # flags: STMT_END_F
-master-bin.000001	19400	Table_map	1	19441	table_id: # (test.t1)
-master-bin.000001	19441	Write_rows	1	19475	table_id: # flags: STMT_END_F
-master-bin.000001	19475	Table_map	1	19516	table_id: # (test.t1)
-master-bin.000001	19516	Write_rows	1	19550	table_id: # flags: STMT_END_F
-master-bin.000001	19550	Table_map	1	19591	table_id: # (test.t1)
-master-bin.000001	19591	Write_rows	1	19625	table_id: # flags: STMT_END_F
-master-bin.000001	19625	Table_map	1	19666	table_id: # (test.t1)
-master-bin.000001	19666	Write_rows	1	19700	table_id: # flags: STMT_END_F
-master-bin.000001	19700	Table_map	1	19741	table_id: # (test.t1)
-master-bin.000001	19741	Write_rows	1	19775	table_id: # flags: STMT_END_F
-master-bin.000001	19775	Table_map	1	19816	table_id: # (test.t1)
-master-bin.000001	19816	Write_rows	1	19850	table_id: # flags: STMT_END_F
-master-bin.000001	19850	Table_map	1	19891	table_id: # (test.t1)
-master-bin.000001	19891	Write_rows	1	19925	table_id: # flags: STMT_END_F
-master-bin.000001	19925	Table_map	1	19966	table_id: # (test.t1)
-master-bin.000001	19966	Write_rows	1	20000	table_id: # flags: STMT_END_F
-master-bin.000001	20000	Table_map	1	20041	table_id: # (test.t1)
-master-bin.000001	20041	Write_rows	1	20075	table_id: # flags: STMT_END_F
-master-bin.000001	20075	Table_map	1	20116	table_id: # (test.t1)
-master-bin.000001	20116	Write_rows	1	20150	table_id: # flags: STMT_END_F
-master-bin.000001	20150	Table_map	1	20191	table_id: # (test.t1)
-master-bin.000001	20191	Write_rows	1	20225	table_id: # flags: STMT_END_F
-master-bin.000001	20225	Table_map	1	20266	table_id: # (test.t1)
-master-bin.000001	20266	Write_rows	1	20300	table_id: # flags: STMT_END_F
-master-bin.000001	20300	Table_map	1	20341	table_id: # (test.t1)
-master-bin.000001	20341	Write_rows	1	20375	table_id: # flags: STMT_END_F
-master-bin.000001	20375	Table_map	1	20416	table_id: # (test.t1)
-master-bin.000001	20416	Write_rows	1	20450	table_id: # flags: STMT_END_F
-master-bin.000001	20450	Table_map	1	20491	table_id: # (test.t1)
-master-bin.000001	20491	Write_rows	1	20525	table_id: # flags: STMT_END_F
-master-bin.000001	20525	Table_map	1	20566	table_id: # (test.t1)
-master-bin.000001	20566	Write_rows	1	20600	table_id: # flags: STMT_END_F
-master-bin.000001	20600	Table_map	1	20641	table_id: # (test.t1)
-master-bin.000001	20641	Write_rows	1	20675	table_id: # flags: STMT_END_F
-master-bin.000001	20675	Table_map	1	20716	table_id: # (test.t1)
-master-bin.000001	20716	Write_rows	1	20750	table_id: # flags: STMT_END_F
-master-bin.000001	20750	Table_map	1	20791	table_id: # (test.t1)
-master-bin.000001	20791	Write_rows	1	20825	table_id: # flags: STMT_END_F
-master-bin.000001	20825	Table_map	1	20866	table_id: # (test.t1)
-master-bin.000001	20866	Write_rows	1	20900	table_id: # flags: STMT_END_F
-master-bin.000001	20900	Table_map	1	20941	table_id: # (test.t1)
-master-bin.000001	20941	Write_rows	1	20975	table_id: # flags: STMT_END_F
-master-bin.000001	20975	Table_map	1	21016	table_id: # (test.t1)
-master-bin.000001	21016	Write_rows	1	21050	table_id: # flags: STMT_END_F
-master-bin.000001	21050	Table_map	1	21091	table_id: # (test.t1)
-master-bin.000001	21091	Write_rows	1	21125	table_id: # flags: STMT_END_F
-master-bin.000001	21125	Table_map	1	21166	table_id: # (test.t1)
-master-bin.000001	21166	Write_rows	1	21200	table_id: # flags: STMT_END_F
-master-bin.000001	21200	Table_map	1	21241	table_id: # (test.t1)
-master-bin.000001	21241	Write_rows	1	21275	table_id: # flags: STMT_END_F
-master-bin.000001	21275	Table_map	1	21316	table_id: # (test.t1)
-master-bin.000001	21316	Write_rows	1	21350	table_id: # flags: STMT_END_F
-master-bin.000001	21350	Table_map	1	21391	table_id: # (test.t1)
-master-bin.000001	21391	Write_rows	1	21425	table_id: # flags: STMT_END_F
-master-bin.000001	21425	Table_map	1	21466	table_id: # (test.t1)
-master-bin.000001	21466	Write_rows	1	21500	table_id: # flags: STMT_END_F
-master-bin.000001	21500	Table_map	1	21541	table_id: # (test.t1)
-master-bin.000001	21541	Write_rows	1	21575	table_id: # flags: STMT_END_F
-master-bin.000001	21575	Table_map	1	21616	table_id: # (test.t1)
-master-bin.000001	21616	Write_rows	1	21650	table_id: # flags: STMT_END_F
-master-bin.000001	21650	Table_map	1	21691	table_id: # (test.t1)
-master-bin.000001	21691	Write_rows	1	21725	table_id: # flags: STMT_END_F
-master-bin.000001	21725	Table_map	1	21766	table_id: # (test.t1)
-master-bin.000001	21766	Write_rows	1	21800	table_id: # flags: STMT_END_F
-master-bin.000001	21800	Table_map	1	21841	table_id: # (test.t1)
-master-bin.000001	21841	Write_rows	1	21875	table_id: # flags: STMT_END_F
-master-bin.000001	21875	Table_map	1	21916	table_id: # (test.t1)
-master-bin.000001	21916	Write_rows	1	21950	table_id: # flags: STMT_END_F
-master-bin.000001	21950	Table_map	1	21991	table_id: # (test.t1)
-master-bin.000001	21991	Write_rows	1	22025	table_id: # flags: STMT_END_F
-master-bin.000001	22025	Table_map	1	22066	table_id: # (test.t1)
-master-bin.000001	22066	Write_rows	1	22100	table_id: # flags: STMT_END_F
-master-bin.000001	22100	Table_map	1	22141	table_id: # (test.t1)
-master-bin.000001	22141	Write_rows	1	22175	table_id: # flags: STMT_END_F
-master-bin.000001	22175	Table_map	1	22216	table_id: # (test.t1)
-master-bin.000001	22216	Write_rows	1	22250	table_id: # flags: STMT_END_F
-master-bin.000001	22250	Table_map	1	22291	table_id: # (test.t1)
-master-bin.000001	22291	Write_rows	1	22325	table_id: # flags: STMT_END_F
-master-bin.000001	22325	Table_map	1	22366	table_id: # (test.t1)
-master-bin.000001	22366	Write_rows	1	22400	table_id: # flags: STMT_END_F
-master-bin.000001	22400	Table_map	1	22441	table_id: # (test.t1)
-master-bin.000001	22441	Write_rows	1	22475	table_id: # flags: STMT_END_F
-master-bin.000001	22475	Table_map	1	22516	table_id: # (test.t1)
-master-bin.000001	22516	Write_rows	1	22550	table_id: # flags: STMT_END_F
-master-bin.000001	22550	Table_map	1	22591	table_id: # (test.t1)
-master-bin.000001	22591	Write_rows	1	22625	table_id: # flags: STMT_END_F
-master-bin.000001	22625	Table_map	1	22666	table_id: # (test.t1)
-master-bin.000001	22666	Write_rows	1	22700	table_id: # flags: STMT_END_F
-master-bin.000001	22700	Table_map	1	22741	table_id: # (test.t1)
-master-bin.000001	22741	Write_rows	1	22775	table_id: # flags: STMT_END_F
-master-bin.000001	22775	Table_map	1	22816	table_id: # (test.t1)
-master-bin.000001	22816	Write_rows	1	22850	table_id: # flags: STMT_END_F
-master-bin.000001	22850	Table_map	1	22891	table_id: # (test.t1)
-master-bin.000001	22891	Write_rows	1	22925	table_id: # flags: STMT_END_F
-master-bin.000001	22925	Table_map	1	22966	table_id: # (test.t1)
-master-bin.000001	22966	Write_rows	1	23000	table_id: # flags: STMT_END_F
-master-bin.000001	23000	Table_map	1	23041	table_id: # (test.t1)
-master-bin.000001	23041	Write_rows	1	23075	table_id: # flags: STMT_END_F
-master-bin.000001	23075	Table_map	1	23116	table_id: # (test.t1)
-master-bin.000001	23116	Write_rows	1	23150	table_id: # flags: STMT_END_F
-master-bin.000001	23150	Table_map	1	23191	table_id: # (test.t1)
-master-bin.000001	23191	Write_rows	1	23225	table_id: # flags: STMT_END_F
-master-bin.000001	23225	Table_map	1	23266	table_id: # (test.t1)
-master-bin.000001	23266	Write_rows	1	23300	table_id: # flags: STMT_END_F
-master-bin.000001	23300	Table_map	1	23341	table_id: # (test.t1)
-master-bin.000001	23341	Write_rows	1	23375	table_id: # flags: STMT_END_F
-master-bin.000001	23375	Table_map	1	23416	table_id: # (test.t1)
-master-bin.000001	23416	Write_rows	1	23450	table_id: # flags: STMT_END_F
-master-bin.000001	23450	Table_map	1	23491	table_id: # (test.t1)
-master-bin.000001	23491	Write_rows	1	23525	table_id: # flags: STMT_END_F
-master-bin.000001	23525	Table_map	1	23566	table_id: # (test.t1)
-master-bin.000001	23566	Write_rows	1	23600	table_id: # flags: STMT_END_F
-master-bin.000001	23600	Table_map	1	23641	table_id: # (test.t1)
-master-bin.000001	23641	Write_rows	1	23675	table_id: # flags: STMT_END_F
-master-bin.000001	23675	Table_map	1	23716	table_id: # (test.t1)
-master-bin.000001	23716	Write_rows	1	23750	table_id: # flags: STMT_END_F
-master-bin.000001	23750	Table_map	1	23791	table_id: # (test.t1)
-master-bin.000001	23791	Write_rows	1	23825	table_id: # flags: STMT_END_F
-master-bin.000001	23825	Table_map	1	23866	table_id: # (test.t1)
-master-bin.000001	23866	Write_rows	1	23900	table_id: # flags: STMT_END_F
-master-bin.000001	23900	Table_map	1	23941	table_id: # (test.t1)
-master-bin.000001	23941	Write_rows	1	23975	table_id: # flags: STMT_END_F
-master-bin.000001	23975	Table_map	1	24016	table_id: # (test.t1)
-master-bin.000001	24016	Write_rows	1	24050	table_id: # flags: STMT_END_F
-master-bin.000001	24050	Table_map	1	24091	table_id: # (test.t1)
-master-bin.000001	24091	Write_rows	1	24125	table_id: # flags: STMT_END_F
-master-bin.000001	24125	Table_map	1	24166	table_id: # (test.t1)
-master-bin.000001	24166	Write_rows	1	24200	table_id: # flags: STMT_END_F
-master-bin.000001	24200	Table_map	1	24241	table_id: # (test.t1)
-master-bin.000001	24241	Write_rows	1	24275	table_id: # flags: STMT_END_F
-master-bin.000001	24275	Table_map	1	24316	table_id: # (test.t1)
-master-bin.000001	24316	Write_rows	1	24350	table_id: # flags: STMT_END_F
-master-bin.000001	24350	Table_map	1	24391	table_id: # (test.t1)
-master-bin.000001	24391	Write_rows	1	24425	table_id: # flags: STMT_END_F
-master-bin.000001	24425	Table_map	1	24466	table_id: # (test.t1)
-master-bin.000001	24466	Write_rows	1	24500	table_id: # flags: STMT_END_F
-master-bin.000001	24500	Table_map	1	24541	table_id: # (test.t1)
-master-bin.000001	24541	Write_rows	1	24575	table_id: # flags: STMT_END_F
-master-bin.000001	24575	Table_map	1	24616	table_id: # (test.t1)
-master-bin.000001	24616	Write_rows	1	24650	table_id: # flags: STMT_END_F
-master-bin.000001	24650	Table_map	1	24691	table_id: # (test.t1)
-master-bin.000001	24691	Write_rows	1	24725	table_id: # flags: STMT_END_F
-master-bin.000001	24725	Table_map	1	24766	table_id: # (test.t1)
-master-bin.000001	24766	Write_rows	1	24800	table_id: # flags: STMT_END_F
-master-bin.000001	24800	Table_map	1	24841	table_id: # (test.t1)
-master-bin.000001	24841	Write_rows	1	24875	table_id: # flags: STMT_END_F
-master-bin.000001	24875	Table_map	1	24916	table_id: # (test.t1)
-master-bin.000001	24916	Write_rows	1	24950	table_id: # flags: STMT_END_F
-master-bin.000001	24950	Table_map	1	24991	table_id: # (test.t1)
-master-bin.000001	24991	Write_rows	1	25025	table_id: # flags: STMT_END_F
-master-bin.000001	25025	Table_map	1	25066	table_id: # (test.t1)
-master-bin.000001	25066	Write_rows	1	25100	table_id: # flags: STMT_END_F
-master-bin.000001	25100	Table_map	1	25141	table_id: # (test.t1)
-master-bin.000001	25141	Write_rows	1	25175	table_id: # flags: STMT_END_F
-master-bin.000001	25175	Table_map	1	25216	table_id: # (test.t1)
-master-bin.000001	25216	Write_rows	1	25250	table_id: # flags: STMT_END_F
-master-bin.000001	25250	Table_map	1	25291	table_id: # (test.t1)
-master-bin.000001	25291	Write_rows	1	25325	table_id: # flags: STMT_END_F
-master-bin.000001	25325	Table_map	1	25366	table_id: # (test.t1)
-master-bin.000001	25366	Write_rows	1	25400	table_id: # flags: STMT_END_F
-master-bin.000001	25400	Table_map	1	25441	table_id: # (test.t1)
-master-bin.000001	25441	Write_rows	1	25475	table_id: # flags: STMT_END_F
-master-bin.000001	25475	Table_map	1	25516	table_id: # (test.t1)
-master-bin.000001	25516	Write_rows	1	25550	table_id: # flags: STMT_END_F
-master-bin.000001	25550	Table_map	1	25591	table_id: # (test.t1)
-master-bin.000001	25591	Write_rows	1	25625	table_id: # flags: STMT_END_F
-master-bin.000001	25625	Table_map	1	25666	table_id: # (test.t1)
-master-bin.000001	25666	Write_rows	1	25700	table_id: # flags: STMT_END_F
-master-bin.000001	25700	Table_map	1	25741	table_id: # (test.t1)
-master-bin.000001	25741	Write_rows	1	25775	table_id: # flags: STMT_END_F
-master-bin.000001	25775	Table_map	1	25816	table_id: # (test.t1)
-master-bin.000001	25816	Write_rows	1	25850	table_id: # flags: STMT_END_F
-master-bin.000001	25850	Table_map	1	25891	table_id: # (test.t1)
-master-bin.000001	25891	Write_rows	1	25925	table_id: # flags: STMT_END_F
-master-bin.000001	25925	Table_map	1	25966	table_id: # (test.t1)
-master-bin.000001	25966	Write_rows	1	26000	table_id: # flags: STMT_END_F
-master-bin.000001	26000	Table_map	1	26041	table_id: # (test.t1)
-master-bin.000001	26041	Write_rows	1	26075	table_id: # flags: STMT_END_F
-master-bin.000001	26075	Table_map	1	26116	table_id: # (test.t1)
-master-bin.000001	26116	Write_rows	1	26150	table_id: # flags: STMT_END_F
-master-bin.000001	26150	Table_map	1	26191	table_id: # (test.t1)
-master-bin.000001	26191	Write_rows	1	26225	table_id: # flags: STMT_END_F
-master-bin.000001	26225	Table_map	1	26266	table_id: # (test.t1)
-master-bin.000001	26266	Write_rows	1	26300	table_id: # flags: STMT_END_F
-master-bin.000001	26300	Table_map	1	26341	table_id: # (test.t1)
-master-bin.000001	26341	Write_rows	1	26375	table_id: # flags: STMT_END_F
-master-bin.000001	26375	Table_map	1	26416	table_id: # (test.t1)
-master-bin.000001	26416	Write_rows	1	26450	table_id: # flags: STMT_END_F
-master-bin.000001	26450	Table_map	1	26491	table_id: # (test.t1)
-master-bin.000001	26491	Write_rows	1	26525	table_id: # flags: STMT_END_F
-master-bin.000001	26525	Table_map	1	26566	table_id: # (test.t1)
-master-bin.000001	26566	Write_rows	1	26600	table_id: # flags: STMT_END_F
-master-bin.000001	26600	Table_map	1	26641	table_id: # (test.t1)
-master-bin.000001	26641	Write_rows	1	26675	table_id: # flags: STMT_END_F
-master-bin.000001	26675	Table_map	1	26716	table_id: # (test.t1)
-master-bin.000001	26716	Write_rows	1	26750	table_id: # flags: STMT_END_F
-master-bin.000001	26750	Table_map	1	26791	table_id: # (test.t1)
-master-bin.000001	26791	Write_rows	1	26825	table_id: # flags: STMT_END_F
-master-bin.000001	26825	Table_map	1	26866	table_id: # (test.t1)
-master-bin.000001	26866	Write_rows	1	26900	table_id: # flags: STMT_END_F
-master-bin.000001	26900	Table_map	1	26941	table_id: # (test.t1)
-master-bin.000001	26941	Write_rows	1	26975	table_id: # flags: STMT_END_F
-master-bin.000001	26975	Table_map	1	27016	table_id: # (test.t1)
-master-bin.000001	27016	Write_rows	1	27050	table_id: # flags: STMT_END_F
-master-bin.000001	27050	Table_map	1	27091	table_id: # (test.t1)
-master-bin.000001	27091	Write_rows	1	27125	table_id: # flags: STMT_END_F
-master-bin.000001	27125	Table_map	1	27166	table_id: # (test.t1)
-master-bin.000001	27166	Write_rows	1	27200	table_id: # flags: STMT_END_F
-master-bin.000001	27200	Table_map	1	27241	table_id: # (test.t1)
-master-bin.000001	27241	Write_rows	1	27275	table_id: # flags: STMT_END_F
-master-bin.000001	27275	Table_map	1	27316	table_id: # (test.t1)
-master-bin.000001	27316	Write_rows	1	27350	table_id: # flags: STMT_END_F
-master-bin.000001	27350	Table_map	1	27391	table_id: # (test.t1)
-master-bin.000001	27391	Write_rows	1	27425	table_id: # flags: STMT_END_F
-master-bin.000001	27425	Table_map	1	27466	table_id: # (test.t1)
-master-bin.000001	27466	Write_rows	1	27500	table_id: # flags: STMT_END_F
-master-bin.000001	27500	Table_map	1	27541	table_id: # (test.t1)
-master-bin.000001	27541	Write_rows	1	27575	table_id: # flags: STMT_END_F
-master-bin.000001	27575	Table_map	1	27616	table_id: # (test.t1)
-master-bin.000001	27616	Write_rows	1	27650	table_id: # flags: STMT_END_F
-master-bin.000001	27650	Table_map	1	27691	table_id: # (test.t1)
-master-bin.000001	27691	Write_rows	1	27725	table_id: # flags: STMT_END_F
-master-bin.000001	27725	Table_map	1	27766	table_id: # (test.t1)
-master-bin.000001	27766	Write_rows	1	27800	table_id: # flags: STMT_END_F
-master-bin.000001	27800	Table_map	1	27841	table_id: # (test.t1)
-master-bin.000001	27841	Write_rows	1	27875	table_id: # flags: STMT_END_F
-master-bin.000001	27875	Table_map	1	27916	table_id: # (test.t1)
-master-bin.000001	27916	Write_rows	1	27950	table_id: # flags: STMT_END_F
-master-bin.000001	27950	Table_map	1	27991	table_id: # (test.t1)
-master-bin.000001	27991	Write_rows	1	28025	table_id: # flags: STMT_END_F
-master-bin.000001	28025	Table_map	1	28066	table_id: # (test.t1)
-master-bin.000001	28066	Write_rows	1	28100	table_id: # flags: STMT_END_F
-master-bin.000001	28100	Table_map	1	28141	table_id: # (test.t1)
-master-bin.000001	28141	Write_rows	1	28175	table_id: # flags: STMT_END_F
-master-bin.000001	28175	Table_map	1	28216	table_id: # (test.t1)
-master-bin.000001	28216	Write_rows	1	28250	table_id: # flags: STMT_END_F
-master-bin.000001	28250	Table_map	1	28291	table_id: # (test.t1)
-master-bin.000001	28291	Write_rows	1	28325	table_id: # flags: STMT_END_F
-master-bin.000001	28325	Table_map	1	28366	table_id: # (test.t1)
-master-bin.000001	28366	Write_rows	1	28400	table_id: # flags: STMT_END_F
-master-bin.000001	28400	Table_map	1	28441	table_id: # (test.t1)
-master-bin.000001	28441	Write_rows	1	28475	table_id: # flags: STMT_END_F
-master-bin.000001	28475	Table_map	1	28516	table_id: # (test.t1)
-master-bin.000001	28516	Write_rows	1	28550	table_id: # flags: STMT_END_F
-master-bin.000001	28550	Table_map	1	28591	table_id: # (test.t1)
-master-bin.000001	28591	Write_rows	1	28625	table_id: # flags: STMT_END_F
-master-bin.000001	28625	Table_map	1	28666	table_id: # (test.t1)
-master-bin.000001	28666	Write_rows	1	28700	table_id: # flags: STMT_END_F
-master-bin.000001	28700	Table_map	1	28741	table_id: # (test.t1)
-master-bin.000001	28741	Write_rows	1	28775	table_id: # flags: STMT_END_F
-master-bin.000001	28775	Table_map	1	28816	table_id: # (test.t1)
-master-bin.000001	28816	Write_rows	1	28850	table_id: # flags: STMT_END_F
-master-bin.000001	28850	Table_map	1	28891	table_id: # (test.t1)
-master-bin.000001	28891	Write_rows	1	28925	table_id: # flags: STMT_END_F
-master-bin.000001	28925	Table_map	1	28966	table_id: # (test.t1)
-master-bin.000001	28966	Write_rows	1	29000	table_id: # flags: STMT_END_F
-master-bin.000001	29000	Table_map	1	29041	table_id: # (test.t1)
-master-bin.000001	29041	Write_rows	1	29075	table_id: # flags: STMT_END_F
-master-bin.000001	29075	Table_map	1	29116	table_id: # (test.t1)
-master-bin.000001	29116	Write_rows	1	29150	table_id: # flags: STMT_END_F
-master-bin.000001	29150	Table_map	1	29191	table_id: # (test.t1)
-master-bin.000001	29191	Write_rows	1	29225	table_id: # flags: STMT_END_F
-master-bin.000001	29225	Table_map	1	29266	table_id: # (test.t1)
-master-bin.000001	29266	Write_rows	1	29300	table_id: # flags: STMT_END_F
-master-bin.000001	29300	Table_map	1	29341	table_id: # (test.t1)
-master-bin.000001	29341	Write_rows	1	29375	table_id: # flags: STMT_END_F
-master-bin.000001	29375	Table_map	1	29416	table_id: # (test.t1)
-master-bin.000001	29416	Write_rows	1	29450	table_id: # flags: STMT_END_F
-master-bin.000001	29450	Table_map	1	29491	table_id: # (test.t1)
-master-bin.000001	29491	Write_rows	1	29525	table_id: # flags: STMT_END_F
-master-bin.000001	29525	Table_map	1	29566	table_id: # (test.t1)
-master-bin.000001	29566	Write_rows	1	29600	table_id: # flags: STMT_END_F
-master-bin.000001	29600	Table_map	1	29641	table_id: # (test.t1)
-master-bin.000001	29641	Write_rows	1	29675	table_id: # flags: STMT_END_F
-master-bin.000001	29675	Table_map	1	29716	table_id: # (test.t1)
-master-bin.000001	29716	Write_rows	1	29750	table_id: # flags: STMT_END_F
-master-bin.000001	29750	Table_map	1	29791	table_id: # (test.t1)
-master-bin.000001	29791	Write_rows	1	29825	table_id: # flags: STMT_END_F
-master-bin.000001	29825	Table_map	1	29866	table_id: # (test.t1)
-master-bin.000001	29866	Write_rows	1	29900	table_id: # flags: STMT_END_F
-master-bin.000001	29900	Table_map	1	29941	table_id: # (test.t1)
-master-bin.000001	29941	Write_rows	1	29975	table_id: # flags: STMT_END_F
-master-bin.000001	29975	Table_map	1	30016	table_id: # (test.t1)
-master-bin.000001	30016	Write_rows	1	30050	table_id: # flags: STMT_END_F
-master-bin.000001	30050	Table_map	1	30091	table_id: # (test.t1)
-master-bin.000001	30091	Write_rows	1	30125	table_id: # flags: STMT_END_F
-master-bin.000001	30125	Table_map	1	30166	table_id: # (test.t1)
-master-bin.000001	30166	Write_rows	1	30200	table_id: # flags: STMT_END_F
-master-bin.000001	30200	Table_map	1	30241	table_id: # (test.t1)
-master-bin.000001	30241	Write_rows	1	30275	table_id: # flags: STMT_END_F
-master-bin.000001	30275	Xid	1	30302	COMMIT /* XID */
-master-bin.000001	30302	Rotate	1	30346	master-bin.000002;pos=4
+master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int) engine=innodb
+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	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
 drop table t1;
 set global binlog_cache_size=@bcs;
 set session autocommit = @ac;
@@ -1081,15 +1079,14 @@ set @b= 14632475938453979136;
 execute stmt using @a, @b;
 deallocate prepare stmt;
 drop table t1;
-show binlog events from 0;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	107	Server version, Binlog ver: 4
-master-bin.000001	107	Query	1	228	use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
-master-bin.000001	228	Query	1	296	BEGIN
-master-bin.000001	296	Table_map	1	338	table_id: # (test.t1)
-master-bin.000001	338	Write_rows	1	384	table_id: # flags: STMT_END_F
-master-bin.000001	384	Query	1	453	COMMIT
-master-bin.000001	453	Query	1	529	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
+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	#	#	use `test`; drop table t1
 reset master;
 CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
 USE bug39182;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
index 961ba7217f4..e5efc26f0cb 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
@@ -2,13 +2,12 @@ create table t1 (a int, b int) engine=innodb;
 begin;
 insert into t1 values (1,2);
 commit;
-show binlog events;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	107	Server ver: #, Binlog ver: #
-master-bin.000001	107	Query	1	214	use `test`; create table t1 (a int, b int) engine=innodb
-master-bin.000001	214	Query	1	282	BEGIN
-master-bin.000001	282	Query	1	372	use `test`; insert into t1 values (1,2)
-master-bin.000001	372	Xid	1	399	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int, b int) engine=innodb
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1,2)
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 drop table t1;
 drop table if exists t1, t2;
 reset master;
@@ -36,115 +35,115 @@ create table t1 (n int) engine=innodb;
 begin;
 commit;
 drop table t1;
-show binlog events in 'master-bin.000001' from 107;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t1 (n int) engine=innodb
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(100 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(99 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(98 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(97 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(96 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(95 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(94 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(93 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(92 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(91 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(90 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(89 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(88 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(87 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(86 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(85 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(84 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(83 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(82 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(81 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(80 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(79 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(78 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(77 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(76 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(75 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(74 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(73 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(72 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(71 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(70 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(69 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(68 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(67 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(66 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(65 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(64 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(63 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(62 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(61 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(60 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(59 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(58 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(57 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(56 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(55 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(54 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(53 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(52 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(51 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(50 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(49 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(48 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(47 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(46 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(45 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(44 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(43 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(42 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(41 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(40 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(39 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(38 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(37 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(36 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(35 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(34 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(33 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(32 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(31 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(30 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(29 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(28 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(27 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(26 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(25 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(24 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(23 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(22 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(21 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(20 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(19 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(18 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(17 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(16 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(15 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(14 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(13 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(12 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(11 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(10 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(9 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(8 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(7 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(6 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(5 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(4 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(3 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(2 + 4)
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(1 + 4)
-master-bin.000001	#	Xid	1	#	COMMIT /* xid= */
-master-bin.000001	#	Rotate	1	#	master-bin.000002;pos=4
-show binlog events in 'master-bin.000002' from 107;
+master-bin.000001	#	Query	#	#	use `test`; create table t1 (n int) engine=innodb
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(100 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(99 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(98 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(97 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(96 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(95 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(94 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(93 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(92 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(91 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(90 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(89 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(88 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(87 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(86 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(85 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(84 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(83 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(82 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(81 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(80 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(79 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(78 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(77 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(76 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(75 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(74 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(73 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(72 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(71 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(70 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(69 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(68 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(67 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(66 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(65 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(64 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(63 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(62 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(61 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(60 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(59 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(58 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(57 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(56 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(55 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(54 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(53 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(52 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(51 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(50 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(49 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(48 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(47 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(46 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(45 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(44 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(43 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(42 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(41 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(40 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(39 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(38 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(37 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(36 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(35 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(34 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(33 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(32 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(31 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(30 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(29 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(28 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(27 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(26 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(25 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(24 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(23 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(22 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(21 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(20 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(19 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(18 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(17 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(16 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(15 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(14 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(13 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(12 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(11 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(10 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(9 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(8 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(7 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(6 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(5 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(4 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(3 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(2 + 4)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(1 + 4)
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
+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	1	#	use `test`; drop table t1
+master-bin.000002	#	Query	#	#	use `test`; drop table t1
 set @ac = @@autocommit;
 set autocommit= 0;
 reset master;
@@ -155,427 +154,425 @@ insert into t1 values (2);
 insert into t1 values (3);
 commit;
 drop table t1;
-show binlog events from 0;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	107	Server version, Binlog ver: 4
-master-bin.000001	107	Query	1	206	use `test`; create table t1(n int) engine=innodb
-master-bin.000001	206	Query	1	274	BEGIN
-master-bin.000001	274	Query	1	362	use `test`; insert into t1 values (1)
-master-bin.000001	362	Query	1	450	use `test`; insert into t1 values (2)
-master-bin.000001	450	Query	1	538	use `test`; insert into t1 values (3)
-master-bin.000001	538	Xid	1	565	COMMIT /* XID */
-master-bin.000001	565	Query	1	641	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int) engine=innodb
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (2)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (3)
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; drop table t1
 set @bcs = @@binlog_cache_size;
 set global binlog_cache_size=4096;
 reset master;
 create table t1 (a int) engine=innodb;
-show binlog events from 0;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	107	Server version, Binlog ver: 4
-master-bin.000001	107	Query	1	207	use `test`; create table t1 (a int) engine=innodb
-master-bin.000001	207	Query	1	275	BEGIN
-master-bin.000001	275	Query	1	366	use `test`; insert into t1 values( 400 )
-master-bin.000001	366	Query	1	457	use `test`; insert into t1 values( 399 )
-master-bin.000001	457	Query	1	548	use `test`; insert into t1 values( 398 )
-master-bin.000001	548	Query	1	639	use `test`; insert into t1 values( 397 )
-master-bin.000001	639	Query	1	730	use `test`; insert into t1 values( 396 )
-master-bin.000001	730	Query	1	821	use `test`; insert into t1 values( 395 )
-master-bin.000001	821	Query	1	912	use `test`; insert into t1 values( 394 )
-master-bin.000001	912	Query	1	1003	use `test`; insert into t1 values( 393 )
-master-bin.000001	1003	Query	1	1094	use `test`; insert into t1 values( 392 )
-master-bin.000001	1094	Query	1	1185	use `test`; insert into t1 values( 391 )
-master-bin.000001	1185	Query	1	1276	use `test`; insert into t1 values( 390 )
-master-bin.000001	1276	Query	1	1367	use `test`; insert into t1 values( 389 )
-master-bin.000001	1367	Query	1	1458	use `test`; insert into t1 values( 388 )
-master-bin.000001	1458	Query	1	1549	use `test`; insert into t1 values( 387 )
-master-bin.000001	1549	Query	1	1640	use `test`; insert into t1 values( 386 )
-master-bin.000001	1640	Query	1	1731	use `test`; insert into t1 values( 385 )
-master-bin.000001	1731	Query	1	1822	use `test`; insert into t1 values( 384 )
-master-bin.000001	1822	Query	1	1913	use `test`; insert into t1 values( 383 )
-master-bin.000001	1913	Query	1	2004	use `test`; insert into t1 values( 382 )
-master-bin.000001	2004	Query	1	2095	use `test`; insert into t1 values( 381 )
-master-bin.000001	2095	Query	1	2186	use `test`; insert into t1 values( 380 )
-master-bin.000001	2186	Query	1	2277	use `test`; insert into t1 values( 379 )
-master-bin.000001	2277	Query	1	2368	use `test`; insert into t1 values( 378 )
-master-bin.000001	2368	Query	1	2459	use `test`; insert into t1 values( 377 )
-master-bin.000001	2459	Query	1	2550	use `test`; insert into t1 values( 376 )
-master-bin.000001	2550	Query	1	2641	use `test`; insert into t1 values( 375 )
-master-bin.000001	2641	Query	1	2732	use `test`; insert into t1 values( 374 )
-master-bin.000001	2732	Query	1	2823	use `test`; insert into t1 values( 373 )
-master-bin.000001	2823	Query	1	2914	use `test`; insert into t1 values( 372 )
-master-bin.000001	2914	Query	1	3005	use `test`; insert into t1 values( 371 )
-master-bin.000001	3005	Query	1	3096	use `test`; insert into t1 values( 370 )
-master-bin.000001	3096	Query	1	3187	use `test`; insert into t1 values( 369 )
-master-bin.000001	3187	Query	1	3278	use `test`; insert into t1 values( 368 )
-master-bin.000001	3278	Query	1	3369	use `test`; insert into t1 values( 367 )
-master-bin.000001	3369	Query	1	3460	use `test`; insert into t1 values( 366 )
-master-bin.000001	3460	Query	1	3551	use `test`; insert into t1 values( 365 )
-master-bin.000001	3551	Query	1	3642	use `test`; insert into t1 values( 364 )
-master-bin.000001	3642	Query	1	3733	use `test`; insert into t1 values( 363 )
-master-bin.000001	3733	Query	1	3824	use `test`; insert into t1 values( 362 )
-master-bin.000001	3824	Query	1	3915	use `test`; insert into t1 values( 361 )
-master-bin.000001	3915	Query	1	4006	use `test`; insert into t1 values( 360 )
-master-bin.000001	4006	Query	1	4097	use `test`; insert into t1 values( 359 )
-master-bin.000001	4097	Query	1	4188	use `test`; insert into t1 values( 358 )
-master-bin.000001	4188	Query	1	4279	use `test`; insert into t1 values( 357 )
-master-bin.000001	4279	Query	1	4370	use `test`; insert into t1 values( 356 )
-master-bin.000001	4370	Query	1	4461	use `test`; insert into t1 values( 355 )
-master-bin.000001	4461	Query	1	4552	use `test`; insert into t1 values( 354 )
-master-bin.000001	4552	Query	1	4643	use `test`; insert into t1 values( 353 )
-master-bin.000001	4643	Query	1	4734	use `test`; insert into t1 values( 352 )
-master-bin.000001	4734	Query	1	4825	use `test`; insert into t1 values( 351 )
-master-bin.000001	4825	Query	1	4916	use `test`; insert into t1 values( 350 )
-master-bin.000001	4916	Query	1	5007	use `test`; insert into t1 values( 349 )
-master-bin.000001	5007	Query	1	5098	use `test`; insert into t1 values( 348 )
-master-bin.000001	5098	Query	1	5189	use `test`; insert into t1 values( 347 )
-master-bin.000001	5189	Query	1	5280	use `test`; insert into t1 values( 346 )
-master-bin.000001	5280	Query	1	5371	use `test`; insert into t1 values( 345 )
-master-bin.000001	5371	Query	1	5462	use `test`; insert into t1 values( 344 )
-master-bin.000001	5462	Query	1	5553	use `test`; insert into t1 values( 343 )
-master-bin.000001	5553	Query	1	5644	use `test`; insert into t1 values( 342 )
-master-bin.000001	5644	Query	1	5735	use `test`; insert into t1 values( 341 )
-master-bin.000001	5735	Query	1	5826	use `test`; insert into t1 values( 340 )
-master-bin.000001	5826	Query	1	5917	use `test`; insert into t1 values( 339 )
-master-bin.000001	5917	Query	1	6008	use `test`; insert into t1 values( 338 )
-master-bin.000001	6008	Query	1	6099	use `test`; insert into t1 values( 337 )
-master-bin.000001	6099	Query	1	6190	use `test`; insert into t1 values( 336 )
-master-bin.000001	6190	Query	1	6281	use `test`; insert into t1 values( 335 )
-master-bin.000001	6281	Query	1	6372	use `test`; insert into t1 values( 334 )
-master-bin.000001	6372	Query	1	6463	use `test`; insert into t1 values( 333 )
-master-bin.000001	6463	Query	1	6554	use `test`; insert into t1 values( 332 )
-master-bin.000001	6554	Query	1	6645	use `test`; insert into t1 values( 331 )
-master-bin.000001	6645	Query	1	6736	use `test`; insert into t1 values( 330 )
-master-bin.000001	6736	Query	1	6827	use `test`; insert into t1 values( 329 )
-master-bin.000001	6827	Query	1	6918	use `test`; insert into t1 values( 328 )
-master-bin.000001	6918	Query	1	7009	use `test`; insert into t1 values( 327 )
-master-bin.000001	7009	Query	1	7100	use `test`; insert into t1 values( 326 )
-master-bin.000001	7100	Query	1	7191	use `test`; insert into t1 values( 325 )
-master-bin.000001	7191	Query	1	7282	use `test`; insert into t1 values( 324 )
-master-bin.000001	7282	Query	1	7373	use `test`; insert into t1 values( 323 )
-master-bin.000001	7373	Query	1	7464	use `test`; insert into t1 values( 322 )
-master-bin.000001	7464	Query	1	7555	use `test`; insert into t1 values( 321 )
-master-bin.000001	7555	Query	1	7646	use `test`; insert into t1 values( 320 )
-master-bin.000001	7646	Query	1	7737	use `test`; insert into t1 values( 319 )
-master-bin.000001	7737	Query	1	7828	use `test`; insert into t1 values( 318 )
-master-bin.000001	7828	Query	1	7919	use `test`; insert into t1 values( 317 )
-master-bin.000001	7919	Query	1	8010	use `test`; insert into t1 values( 316 )
-master-bin.000001	8010	Query	1	8101	use `test`; insert into t1 values( 315 )
-master-bin.000001	8101	Query	1	8192	use `test`; insert into t1 values( 314 )
-master-bin.000001	8192	Query	1	8283	use `test`; insert into t1 values( 313 )
-master-bin.000001	8283	Query	1	8374	use `test`; insert into t1 values( 312 )
-master-bin.000001	8374	Query	1	8465	use `test`; insert into t1 values( 311 )
-master-bin.000001	8465	Query	1	8556	use `test`; insert into t1 values( 310 )
-master-bin.000001	8556	Query	1	8647	use `test`; insert into t1 values( 309 )
-master-bin.000001	8647	Query	1	8738	use `test`; insert into t1 values( 308 )
-master-bin.000001	8738	Query	1	8829	use `test`; insert into t1 values( 307 )
-master-bin.000001	8829	Query	1	8920	use `test`; insert into t1 values( 306 )
-master-bin.000001	8920	Query	1	9011	use `test`; insert into t1 values( 305 )
-master-bin.000001	9011	Query	1	9102	use `test`; insert into t1 values( 304 )
-master-bin.000001	9102	Query	1	9193	use `test`; insert into t1 values( 303 )
-master-bin.000001	9193	Query	1	9284	use `test`; insert into t1 values( 302 )
-master-bin.000001	9284	Query	1	9375	use `test`; insert into t1 values( 301 )
-master-bin.000001	9375	Query	1	9466	use `test`; insert into t1 values( 300 )
-master-bin.000001	9466	Query	1	9557	use `test`; insert into t1 values( 299 )
-master-bin.000001	9557	Query	1	9648	use `test`; insert into t1 values( 298 )
-master-bin.000001	9648	Query	1	9739	use `test`; insert into t1 values( 297 )
-master-bin.000001	9739	Query	1	9830	use `test`; insert into t1 values( 296 )
-master-bin.000001	9830	Query	1	9921	use `test`; insert into t1 values( 295 )
-master-bin.000001	9921	Query	1	10012	use `test`; insert into t1 values( 294 )
-master-bin.000001	10012	Query	1	10103	use `test`; insert into t1 values( 293 )
-master-bin.000001	10103	Query	1	10194	use `test`; insert into t1 values( 292 )
-master-bin.000001	10194	Query	1	10285	use `test`; insert into t1 values( 291 )
-master-bin.000001	10285	Query	1	10376	use `test`; insert into t1 values( 290 )
-master-bin.000001	10376	Query	1	10467	use `test`; insert into t1 values( 289 )
-master-bin.000001	10467	Query	1	10558	use `test`; insert into t1 values( 288 )
-master-bin.000001	10558	Query	1	10649	use `test`; insert into t1 values( 287 )
-master-bin.000001	10649	Query	1	10740	use `test`; insert into t1 values( 286 )
-master-bin.000001	10740	Query	1	10831	use `test`; insert into t1 values( 285 )
-master-bin.000001	10831	Query	1	10922	use `test`; insert into t1 values( 284 )
-master-bin.000001	10922	Query	1	11013	use `test`; insert into t1 values( 283 )
-master-bin.000001	11013	Query	1	11104	use `test`; insert into t1 values( 282 )
-master-bin.000001	11104	Query	1	11195	use `test`; insert into t1 values( 281 )
-master-bin.000001	11195	Query	1	11286	use `test`; insert into t1 values( 280 )
-master-bin.000001	11286	Query	1	11377	use `test`; insert into t1 values( 279 )
-master-bin.000001	11377	Query	1	11468	use `test`; insert into t1 values( 278 )
-master-bin.000001	11468	Query	1	11559	use `test`; insert into t1 values( 277 )
-master-bin.000001	11559	Query	1	11650	use `test`; insert into t1 values( 276 )
-master-bin.000001	11650	Query	1	11741	use `test`; insert into t1 values( 275 )
-master-bin.000001	11741	Query	1	11832	use `test`; insert into t1 values( 274 )
-master-bin.000001	11832	Query	1	11923	use `test`; insert into t1 values( 273 )
-master-bin.000001	11923	Query	1	12014	use `test`; insert into t1 values( 272 )
-master-bin.000001	12014	Query	1	12105	use `test`; insert into t1 values( 271 )
-master-bin.000001	12105	Query	1	12196	use `test`; insert into t1 values( 270 )
-master-bin.000001	12196	Query	1	12287	use `test`; insert into t1 values( 269 )
-master-bin.000001	12287	Query	1	12378	use `test`; insert into t1 values( 268 )
-master-bin.000001	12378	Query	1	12469	use `test`; insert into t1 values( 267 )
-master-bin.000001	12469	Query	1	12560	use `test`; insert into t1 values( 266 )
-master-bin.000001	12560	Query	1	12651	use `test`; insert into t1 values( 265 )
-master-bin.000001	12651	Query	1	12742	use `test`; insert into t1 values( 264 )
-master-bin.000001	12742	Query	1	12833	use `test`; insert into t1 values( 263 )
-master-bin.000001	12833	Query	1	12924	use `test`; insert into t1 values( 262 )
-master-bin.000001	12924	Query	1	13015	use `test`; insert into t1 values( 261 )
-master-bin.000001	13015	Query	1	13106	use `test`; insert into t1 values( 260 )
-master-bin.000001	13106	Query	1	13197	use `test`; insert into t1 values( 259 )
-master-bin.000001	13197	Query	1	13288	use `test`; insert into t1 values( 258 )
-master-bin.000001	13288	Query	1	13379	use `test`; insert into t1 values( 257 )
-master-bin.000001	13379	Query	1	13470	use `test`; insert into t1 values( 256 )
-master-bin.000001	13470	Query	1	13561	use `test`; insert into t1 values( 255 )
-master-bin.000001	13561	Query	1	13652	use `test`; insert into t1 values( 254 )
-master-bin.000001	13652	Query	1	13743	use `test`; insert into t1 values( 253 )
-master-bin.000001	13743	Query	1	13834	use `test`; insert into t1 values( 252 )
-master-bin.000001	13834	Query	1	13925	use `test`; insert into t1 values( 251 )
-master-bin.000001	13925	Query	1	14016	use `test`; insert into t1 values( 250 )
-master-bin.000001	14016	Query	1	14107	use `test`; insert into t1 values( 249 )
-master-bin.000001	14107	Query	1	14198	use `test`; insert into t1 values( 248 )
-master-bin.000001	14198	Query	1	14289	use `test`; insert into t1 values( 247 )
-master-bin.000001	14289	Query	1	14380	use `test`; insert into t1 values( 246 )
-master-bin.000001	14380	Query	1	14471	use `test`; insert into t1 values( 245 )
-master-bin.000001	14471	Query	1	14562	use `test`; insert into t1 values( 244 )
-master-bin.000001	14562	Query	1	14653	use `test`; insert into t1 values( 243 )
-master-bin.000001	14653	Query	1	14744	use `test`; insert into t1 values( 242 )
-master-bin.000001	14744	Query	1	14835	use `test`; insert into t1 values( 241 )
-master-bin.000001	14835	Query	1	14926	use `test`; insert into t1 values( 240 )
-master-bin.000001	14926	Query	1	15017	use `test`; insert into t1 values( 239 )
-master-bin.000001	15017	Query	1	15108	use `test`; insert into t1 values( 238 )
-master-bin.000001	15108	Query	1	15199	use `test`; insert into t1 values( 237 )
-master-bin.000001	15199	Query	1	15290	use `test`; insert into t1 values( 236 )
-master-bin.000001	15290	Query	1	15381	use `test`; insert into t1 values( 235 )
-master-bin.000001	15381	Query	1	15472	use `test`; insert into t1 values( 234 )
-master-bin.000001	15472	Query	1	15563	use `test`; insert into t1 values( 233 )
-master-bin.000001	15563	Query	1	15654	use `test`; insert into t1 values( 232 )
-master-bin.000001	15654	Query	1	15745	use `test`; insert into t1 values( 231 )
-master-bin.000001	15745	Query	1	15836	use `test`; insert into t1 values( 230 )
-master-bin.000001	15836	Query	1	15927	use `test`; insert into t1 values( 229 )
-master-bin.000001	15927	Query	1	16018	use `test`; insert into t1 values( 228 )
-master-bin.000001	16018	Query	1	16109	use `test`; insert into t1 values( 227 )
-master-bin.000001	16109	Query	1	16200	use `test`; insert into t1 values( 226 )
-master-bin.000001	16200	Query	1	16291	use `test`; insert into t1 values( 225 )
-master-bin.000001	16291	Query	1	16382	use `test`; insert into t1 values( 224 )
-master-bin.000001	16382	Query	1	16473	use `test`; insert into t1 values( 223 )
-master-bin.000001	16473	Query	1	16564	use `test`; insert into t1 values( 222 )
-master-bin.000001	16564	Query	1	16655	use `test`; insert into t1 values( 221 )
-master-bin.000001	16655	Query	1	16746	use `test`; insert into t1 values( 220 )
-master-bin.000001	16746	Query	1	16837	use `test`; insert into t1 values( 219 )
-master-bin.000001	16837	Query	1	16928	use `test`; insert into t1 values( 218 )
-master-bin.000001	16928	Query	1	17019	use `test`; insert into t1 values( 217 )
-master-bin.000001	17019	Query	1	17110	use `test`; insert into t1 values( 216 )
-master-bin.000001	17110	Query	1	17201	use `test`; insert into t1 values( 215 )
-master-bin.000001	17201	Query	1	17292	use `test`; insert into t1 values( 214 )
-master-bin.000001	17292	Query	1	17383	use `test`; insert into t1 values( 213 )
-master-bin.000001	17383	Query	1	17474	use `test`; insert into t1 values( 212 )
-master-bin.000001	17474	Query	1	17565	use `test`; insert into t1 values( 211 )
-master-bin.000001	17565	Query	1	17656	use `test`; insert into t1 values( 210 )
-master-bin.000001	17656	Query	1	17747	use `test`; insert into t1 values( 209 )
-master-bin.000001	17747	Query	1	17838	use `test`; insert into t1 values( 208 )
-master-bin.000001	17838	Query	1	17929	use `test`; insert into t1 values( 207 )
-master-bin.000001	17929	Query	1	18020	use `test`; insert into t1 values( 206 )
-master-bin.000001	18020	Query	1	18111	use `test`; insert into t1 values( 205 )
-master-bin.000001	18111	Query	1	18202	use `test`; insert into t1 values( 204 )
-master-bin.000001	18202	Query	1	18293	use `test`; insert into t1 values( 203 )
-master-bin.000001	18293	Query	1	18384	use `test`; insert into t1 values( 202 )
-master-bin.000001	18384	Query	1	18475	use `test`; insert into t1 values( 201 )
-master-bin.000001	18475	Query	1	18566	use `test`; insert into t1 values( 200 )
-master-bin.000001	18566	Query	1	18657	use `test`; insert into t1 values( 199 )
-master-bin.000001	18657	Query	1	18748	use `test`; insert into t1 values( 198 )
-master-bin.000001	18748	Query	1	18839	use `test`; insert into t1 values( 197 )
-master-bin.000001	18839	Query	1	18930	use `test`; insert into t1 values( 196 )
-master-bin.000001	18930	Query	1	19021	use `test`; insert into t1 values( 195 )
-master-bin.000001	19021	Query	1	19112	use `test`; insert into t1 values( 194 )
-master-bin.000001	19112	Query	1	19203	use `test`; insert into t1 values( 193 )
-master-bin.000001	19203	Query	1	19294	use `test`; insert into t1 values( 192 )
-master-bin.000001	19294	Query	1	19385	use `test`; insert into t1 values( 191 )
-master-bin.000001	19385	Query	1	19476	use `test`; insert into t1 values( 190 )
-master-bin.000001	19476	Query	1	19567	use `test`; insert into t1 values( 189 )
-master-bin.000001	19567	Query	1	19658	use `test`; insert into t1 values( 188 )
-master-bin.000001	19658	Query	1	19749	use `test`; insert into t1 values( 187 )
-master-bin.000001	19749	Query	1	19840	use `test`; insert into t1 values( 186 )
-master-bin.000001	19840	Query	1	19931	use `test`; insert into t1 values( 185 )
-master-bin.000001	19931	Query	1	20022	use `test`; insert into t1 values( 184 )
-master-bin.000001	20022	Query	1	20113	use `test`; insert into t1 values( 183 )
-master-bin.000001	20113	Query	1	20204	use `test`; insert into t1 values( 182 )
-master-bin.000001	20204	Query	1	20295	use `test`; insert into t1 values( 181 )
-master-bin.000001	20295	Query	1	20386	use `test`; insert into t1 values( 180 )
-master-bin.000001	20386	Query	1	20477	use `test`; insert into t1 values( 179 )
-master-bin.000001	20477	Query	1	20568	use `test`; insert into t1 values( 178 )
-master-bin.000001	20568	Query	1	20659	use `test`; insert into t1 values( 177 )
-master-bin.000001	20659	Query	1	20750	use `test`; insert into t1 values( 176 )
-master-bin.000001	20750	Query	1	20841	use `test`; insert into t1 values( 175 )
-master-bin.000001	20841	Query	1	20932	use `test`; insert into t1 values( 174 )
-master-bin.000001	20932	Query	1	21023	use `test`; insert into t1 values( 173 )
-master-bin.000001	21023	Query	1	21114	use `test`; insert into t1 values( 172 )
-master-bin.000001	21114	Query	1	21205	use `test`; insert into t1 values( 171 )
-master-bin.000001	21205	Query	1	21296	use `test`; insert into t1 values( 170 )
-master-bin.000001	21296	Query	1	21387	use `test`; insert into t1 values( 169 )
-master-bin.000001	21387	Query	1	21478	use `test`; insert into t1 values( 168 )
-master-bin.000001	21478	Query	1	21569	use `test`; insert into t1 values( 167 )
-master-bin.000001	21569	Query	1	21660	use `test`; insert into t1 values( 166 )
-master-bin.000001	21660	Query	1	21751	use `test`; insert into t1 values( 165 )
-master-bin.000001	21751	Query	1	21842	use `test`; insert into t1 values( 164 )
-master-bin.000001	21842	Query	1	21933	use `test`; insert into t1 values( 163 )
-master-bin.000001	21933	Query	1	22024	use `test`; insert into t1 values( 162 )
-master-bin.000001	22024	Query	1	22115	use `test`; insert into t1 values( 161 )
-master-bin.000001	22115	Query	1	22206	use `test`; insert into t1 values( 160 )
-master-bin.000001	22206	Query	1	22297	use `test`; insert into t1 values( 159 )
-master-bin.000001	22297	Query	1	22388	use `test`; insert into t1 values( 158 )
-master-bin.000001	22388	Query	1	22479	use `test`; insert into t1 values( 157 )
-master-bin.000001	22479	Query	1	22570	use `test`; insert into t1 values( 156 )
-master-bin.000001	22570	Query	1	22661	use `test`; insert into t1 values( 155 )
-master-bin.000001	22661	Query	1	22752	use `test`; insert into t1 values( 154 )
-master-bin.000001	22752	Query	1	22843	use `test`; insert into t1 values( 153 )
-master-bin.000001	22843	Query	1	22934	use `test`; insert into t1 values( 152 )
-master-bin.000001	22934	Query	1	23025	use `test`; insert into t1 values( 151 )
-master-bin.000001	23025	Query	1	23116	use `test`; insert into t1 values( 150 )
-master-bin.000001	23116	Query	1	23207	use `test`; insert into t1 values( 149 )
-master-bin.000001	23207	Query	1	23298	use `test`; insert into t1 values( 148 )
-master-bin.000001	23298	Query	1	23389	use `test`; insert into t1 values( 147 )
-master-bin.000001	23389	Query	1	23480	use `test`; insert into t1 values( 146 )
-master-bin.000001	23480	Query	1	23571	use `test`; insert into t1 values( 145 )
-master-bin.000001	23571	Query	1	23662	use `test`; insert into t1 values( 144 )
-master-bin.000001	23662	Query	1	23753	use `test`; insert into t1 values( 143 )
-master-bin.000001	23753	Query	1	23844	use `test`; insert into t1 values( 142 )
-master-bin.000001	23844	Query	1	23935	use `test`; insert into t1 values( 141 )
-master-bin.000001	23935	Query	1	24026	use `test`; insert into t1 values( 140 )
-master-bin.000001	24026	Query	1	24117	use `test`; insert into t1 values( 139 )
-master-bin.000001	24117	Query	1	24208	use `test`; insert into t1 values( 138 )
-master-bin.000001	24208	Query	1	24299	use `test`; insert into t1 values( 137 )
-master-bin.000001	24299	Query	1	24390	use `test`; insert into t1 values( 136 )
-master-bin.000001	24390	Query	1	24481	use `test`; insert into t1 values( 135 )
-master-bin.000001	24481	Query	1	24572	use `test`; insert into t1 values( 134 )
-master-bin.000001	24572	Query	1	24663	use `test`; insert into t1 values( 133 )
-master-bin.000001	24663	Query	1	24754	use `test`; insert into t1 values( 132 )
-master-bin.000001	24754	Query	1	24845	use `test`; insert into t1 values( 131 )
-master-bin.000001	24845	Query	1	24936	use `test`; insert into t1 values( 130 )
-master-bin.000001	24936	Query	1	25027	use `test`; insert into t1 values( 129 )
-master-bin.000001	25027	Query	1	25118	use `test`; insert into t1 values( 128 )
-master-bin.000001	25118	Query	1	25209	use `test`; insert into t1 values( 127 )
-master-bin.000001	25209	Query	1	25300	use `test`; insert into t1 values( 126 )
-master-bin.000001	25300	Query	1	25391	use `test`; insert into t1 values( 125 )
-master-bin.000001	25391	Query	1	25482	use `test`; insert into t1 values( 124 )
-master-bin.000001	25482	Query	1	25573	use `test`; insert into t1 values( 123 )
-master-bin.000001	25573	Query	1	25664	use `test`; insert into t1 values( 122 )
-master-bin.000001	25664	Query	1	25755	use `test`; insert into t1 values( 121 )
-master-bin.000001	25755	Query	1	25846	use `test`; insert into t1 values( 120 )
-master-bin.000001	25846	Query	1	25937	use `test`; insert into t1 values( 119 )
-master-bin.000001	25937	Query	1	26028	use `test`; insert into t1 values( 118 )
-master-bin.000001	26028	Query	1	26119	use `test`; insert into t1 values( 117 )
-master-bin.000001	26119	Query	1	26210	use `test`; insert into t1 values( 116 )
-master-bin.000001	26210	Query	1	26301	use `test`; insert into t1 values( 115 )
-master-bin.000001	26301	Query	1	26392	use `test`; insert into t1 values( 114 )
-master-bin.000001	26392	Query	1	26483	use `test`; insert into t1 values( 113 )
-master-bin.000001	26483	Query	1	26574	use `test`; insert into t1 values( 112 )
-master-bin.000001	26574	Query	1	26665	use `test`; insert into t1 values( 111 )
-master-bin.000001	26665	Query	1	26756	use `test`; insert into t1 values( 110 )
-master-bin.000001	26756	Query	1	26847	use `test`; insert into t1 values( 109 )
-master-bin.000001	26847	Query	1	26938	use `test`; insert into t1 values( 108 )
-master-bin.000001	26938	Query	1	27029	use `test`; insert into t1 values( 107 )
-master-bin.000001	27029	Query	1	27120	use `test`; insert into t1 values( 106 )
-master-bin.000001	27120	Query	1	27211	use `test`; insert into t1 values( 105 )
-master-bin.000001	27211	Query	1	27302	use `test`; insert into t1 values( 104 )
-master-bin.000001	27302	Query	1	27393	use `test`; insert into t1 values( 103 )
-master-bin.000001	27393	Query	1	27484	use `test`; insert into t1 values( 102 )
-master-bin.000001	27484	Query	1	27575	use `test`; insert into t1 values( 101 )
-master-bin.000001	27575	Query	1	27666	use `test`; insert into t1 values( 100 )
-master-bin.000001	27666	Query	1	27756	use `test`; insert into t1 values( 99 )
-master-bin.000001	27756	Query	1	27846	use `test`; insert into t1 values( 98 )
-master-bin.000001	27846	Query	1	27936	use `test`; insert into t1 values( 97 )
-master-bin.000001	27936	Query	1	28026	use `test`; insert into t1 values( 96 )
-master-bin.000001	28026	Query	1	28116	use `test`; insert into t1 values( 95 )
-master-bin.000001	28116	Query	1	28206	use `test`; insert into t1 values( 94 )
-master-bin.000001	28206	Query	1	28296	use `test`; insert into t1 values( 93 )
-master-bin.000001	28296	Query	1	28386	use `test`; insert into t1 values( 92 )
-master-bin.000001	28386	Query	1	28476	use `test`; insert into t1 values( 91 )
-master-bin.000001	28476	Query	1	28566	use `test`; insert into t1 values( 90 )
-master-bin.000001	28566	Query	1	28656	use `test`; insert into t1 values( 89 )
-master-bin.000001	28656	Query	1	28746	use `test`; insert into t1 values( 88 )
-master-bin.000001	28746	Query	1	28836	use `test`; insert into t1 values( 87 )
-master-bin.000001	28836	Query	1	28926	use `test`; insert into t1 values( 86 )
-master-bin.000001	28926	Query	1	29016	use `test`; insert into t1 values( 85 )
-master-bin.000001	29016	Query	1	29106	use `test`; insert into t1 values( 84 )
-master-bin.000001	29106	Query	1	29196	use `test`; insert into t1 values( 83 )
-master-bin.000001	29196	Query	1	29286	use `test`; insert into t1 values( 82 )
-master-bin.000001	29286	Query	1	29376	use `test`; insert into t1 values( 81 )
-master-bin.000001	29376	Query	1	29466	use `test`; insert into t1 values( 80 )
-master-bin.000001	29466	Query	1	29556	use `test`; insert into t1 values( 79 )
-master-bin.000001	29556	Query	1	29646	use `test`; insert into t1 values( 78 )
-master-bin.000001	29646	Query	1	29736	use `test`; insert into t1 values( 77 )
-master-bin.000001	29736	Query	1	29826	use `test`; insert into t1 values( 76 )
-master-bin.000001	29826	Query	1	29916	use `test`; insert into t1 values( 75 )
-master-bin.000001	29916	Query	1	30006	use `test`; insert into t1 values( 74 )
-master-bin.000001	30006	Query	1	30096	use `test`; insert into t1 values( 73 )
-master-bin.000001	30096	Query	1	30186	use `test`; insert into t1 values( 72 )
-master-bin.000001	30186	Query	1	30276	use `test`; insert into t1 values( 71 )
-master-bin.000001	30276	Query	1	30366	use `test`; insert into t1 values( 70 )
-master-bin.000001	30366	Query	1	30456	use `test`; insert into t1 values( 69 )
-master-bin.000001	30456	Query	1	30546	use `test`; insert into t1 values( 68 )
-master-bin.000001	30546	Query	1	30636	use `test`; insert into t1 values( 67 )
-master-bin.000001	30636	Query	1	30726	use `test`; insert into t1 values( 66 )
-master-bin.000001	30726	Query	1	30816	use `test`; insert into t1 values( 65 )
-master-bin.000001	30816	Query	1	30906	use `test`; insert into t1 values( 64 )
-master-bin.000001	30906	Query	1	30996	use `test`; insert into t1 values( 63 )
-master-bin.000001	30996	Query	1	31086	use `test`; insert into t1 values( 62 )
-master-bin.000001	31086	Query	1	31176	use `test`; insert into t1 values( 61 )
-master-bin.000001	31176	Query	1	31266	use `test`; insert into t1 values( 60 )
-master-bin.000001	31266	Query	1	31356	use `test`; insert into t1 values( 59 )
-master-bin.000001	31356	Query	1	31446	use `test`; insert into t1 values( 58 )
-master-bin.000001	31446	Query	1	31536	use `test`; insert into t1 values( 57 )
-master-bin.000001	31536	Query	1	31626	use `test`; insert into t1 values( 56 )
-master-bin.000001	31626	Query	1	31716	use `test`; insert into t1 values( 55 )
-master-bin.000001	31716	Query	1	31806	use `test`; insert into t1 values( 54 )
-master-bin.000001	31806	Query	1	31896	use `test`; insert into t1 values( 53 )
-master-bin.000001	31896	Query	1	31986	use `test`; insert into t1 values( 52 )
-master-bin.000001	31986	Query	1	32076	use `test`; insert into t1 values( 51 )
-master-bin.000001	32076	Query	1	32166	use `test`; insert into t1 values( 50 )
-master-bin.000001	32166	Query	1	32256	use `test`; insert into t1 values( 49 )
-master-bin.000001	32256	Query	1	32346	use `test`; insert into t1 values( 48 )
-master-bin.000001	32346	Query	1	32436	use `test`; insert into t1 values( 47 )
-master-bin.000001	32436	Query	1	32526	use `test`; insert into t1 values( 46 )
-master-bin.000001	32526	Query	1	32616	use `test`; insert into t1 values( 45 )
-master-bin.000001	32616	Query	1	32706	use `test`; insert into t1 values( 44 )
-master-bin.000001	32706	Query	1	32796	use `test`; insert into t1 values( 43 )
-master-bin.000001	32796	Query	1	32886	use `test`; insert into t1 values( 42 )
-master-bin.000001	32886	Query	1	32976	use `test`; insert into t1 values( 41 )
-master-bin.000001	32976	Query	1	33066	use `test`; insert into t1 values( 40 )
-master-bin.000001	33066	Query	1	33156	use `test`; insert into t1 values( 39 )
-master-bin.000001	33156	Query	1	33246	use `test`; insert into t1 values( 38 )
-master-bin.000001	33246	Query	1	33336	use `test`; insert into t1 values( 37 )
-master-bin.000001	33336	Query	1	33426	use `test`; insert into t1 values( 36 )
-master-bin.000001	33426	Query	1	33516	use `test`; insert into t1 values( 35 )
-master-bin.000001	33516	Query	1	33606	use `test`; insert into t1 values( 34 )
-master-bin.000001	33606	Query	1	33696	use `test`; insert into t1 values( 33 )
-master-bin.000001	33696	Query	1	33786	use `test`; insert into t1 values( 32 )
-master-bin.000001	33786	Query	1	33876	use `test`; insert into t1 values( 31 )
-master-bin.000001	33876	Query	1	33966	use `test`; insert into t1 values( 30 )
-master-bin.000001	33966	Query	1	34056	use `test`; insert into t1 values( 29 )
-master-bin.000001	34056	Query	1	34146	use `test`; insert into t1 values( 28 )
-master-bin.000001	34146	Query	1	34236	use `test`; insert into t1 values( 27 )
-master-bin.000001	34236	Query	1	34326	use `test`; insert into t1 values( 26 )
-master-bin.000001	34326	Query	1	34416	use `test`; insert into t1 values( 25 )
-master-bin.000001	34416	Query	1	34506	use `test`; insert into t1 values( 24 )
-master-bin.000001	34506	Query	1	34596	use `test`; insert into t1 values( 23 )
-master-bin.000001	34596	Query	1	34686	use `test`; insert into t1 values( 22 )
-master-bin.000001	34686	Query	1	34776	use `test`; insert into t1 values( 21 )
-master-bin.000001	34776	Query	1	34866	use `test`; insert into t1 values( 20 )
-master-bin.000001	34866	Query	1	34956	use `test`; insert into t1 values( 19 )
-master-bin.000001	34956	Query	1	35046	use `test`; insert into t1 values( 18 )
-master-bin.000001	35046	Query	1	35136	use `test`; insert into t1 values( 17 )
-master-bin.000001	35136	Query	1	35226	use `test`; insert into t1 values( 16 )
-master-bin.000001	35226	Query	1	35316	use `test`; insert into t1 values( 15 )
-master-bin.000001	35316	Query	1	35406	use `test`; insert into t1 values( 14 )
-master-bin.000001	35406	Query	1	35496	use `test`; insert into t1 values( 13 )
-master-bin.000001	35496	Query	1	35586	use `test`; insert into t1 values( 12 )
-master-bin.000001	35586	Query	1	35676	use `test`; insert into t1 values( 11 )
-master-bin.000001	35676	Query	1	35766	use `test`; insert into t1 values( 10 )
-master-bin.000001	35766	Query	1	35855	use `test`; insert into t1 values( 9 )
-master-bin.000001	35855	Query	1	35944	use `test`; insert into t1 values( 8 )
-master-bin.000001	35944	Query	1	36033	use `test`; insert into t1 values( 7 )
-master-bin.000001	36033	Query	1	36122	use `test`; insert into t1 values( 6 )
-master-bin.000001	36122	Query	1	36211	use `test`; insert into t1 values( 5 )
-master-bin.000001	36211	Query	1	36300	use `test`; insert into t1 values( 4 )
-master-bin.000001	36300	Query	1	36389	use `test`; insert into t1 values( 3 )
-master-bin.000001	36389	Query	1	36478	use `test`; insert into t1 values( 2 )
-master-bin.000001	36478	Query	1	36567	use `test`; insert into t1 values( 1 )
-master-bin.000001	36567	Xid	1	36594	COMMIT /* XID */
-master-bin.000001	36594	Rotate	1	36638	master-bin.000002;pos=4
+master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int) engine=innodb
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 400 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 399 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 398 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 397 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 396 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 395 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 394 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 393 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 392 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 391 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 390 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 389 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 388 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 387 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 386 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 385 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 384 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 383 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 382 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 381 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 380 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 379 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 378 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 377 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 376 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 375 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 374 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 373 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 372 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 371 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 370 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 369 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 368 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 367 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 366 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 365 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 364 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 363 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 362 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 361 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 360 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 359 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 358 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 357 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 356 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 355 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 354 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 353 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 352 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 351 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 350 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 349 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 348 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 347 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 346 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 345 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 344 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 343 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 342 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 341 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 340 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 339 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 338 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 337 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 336 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 335 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 334 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 333 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 332 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 331 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 330 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 329 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 328 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 327 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 326 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 325 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 324 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 323 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 322 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 321 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 320 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 319 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 318 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 317 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 316 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 315 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 314 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 313 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 312 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 311 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 310 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 309 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 308 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 307 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 306 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 305 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 304 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 303 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 302 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 301 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 300 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 299 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 298 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 297 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 296 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 295 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 294 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 293 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 292 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 291 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 290 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 289 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 288 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 287 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 286 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 285 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 284 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 283 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 282 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 281 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 280 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 279 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 278 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 277 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 276 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 275 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 274 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 273 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 272 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 271 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 270 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 269 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 268 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 267 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 266 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 265 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 264 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 263 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 262 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 261 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 260 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 259 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 258 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 257 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 256 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 255 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 254 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 253 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 252 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 251 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 250 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 249 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 248 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 247 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 246 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 245 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 244 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 243 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 242 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 241 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 240 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 239 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 238 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 237 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 236 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 235 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 234 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 233 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 232 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 231 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 230 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 229 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 228 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 227 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 226 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 225 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 224 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 223 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 222 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 221 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 220 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 219 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 218 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 217 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 216 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 215 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 214 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 213 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 212 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 211 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 210 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 209 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 208 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 207 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 206 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 205 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 204 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 203 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 202 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 201 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 200 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 199 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 198 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 197 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 196 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 195 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 194 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 193 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 192 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 191 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 190 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 189 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 188 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 187 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 186 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 185 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 184 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 183 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 182 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 181 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 180 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 179 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 178 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 177 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 176 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 175 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 174 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 173 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 172 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 171 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 170 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 169 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 168 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 167 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 166 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 165 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 164 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 163 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 162 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 161 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 160 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 159 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 158 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 157 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 156 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 155 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 154 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 153 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 152 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 151 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 150 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 149 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 148 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 147 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 146 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 145 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 144 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 143 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 142 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 141 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 140 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 139 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 138 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 137 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 136 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 135 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 134 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 133 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 132 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 131 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 130 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 129 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 128 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 127 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 126 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 125 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 124 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 123 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 122 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 121 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 120 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 119 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 118 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 117 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 116 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 115 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 114 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 113 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 112 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 111 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 110 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 109 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 108 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( <binlog_start> )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 106 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 105 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 104 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 103 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 102 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 101 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 100 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 99 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 98 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 97 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 96 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 95 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 94 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 93 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 92 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 91 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 90 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 89 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 88 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 87 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 86 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 85 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 84 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 83 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 82 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 81 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 80 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 79 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 78 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 77 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 76 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 75 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 74 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 73 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 72 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 71 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 70 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 69 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 68 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 67 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 66 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 65 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 64 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 63 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 62 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 61 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 60 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 59 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 58 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 57 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 56 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 55 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 54 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 53 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 52 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 51 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 50 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 49 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 48 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 47 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 46 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 45 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 44 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 43 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 42 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 41 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 40 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 39 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 38 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 37 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 36 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 35 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 34 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 33 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 32 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 31 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 30 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 29 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 28 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 27 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 26 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 25 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 24 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 23 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 22 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 21 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 20 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 19 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 18 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 17 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 16 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 15 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 14 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 13 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 12 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 11 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 10 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 9 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 8 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 7 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 6 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 5 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 4 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 3 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 2 )
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values( 1 )
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
 drop table t1;
 set global binlog_cache_size=@bcs;
 set session autocommit = @ac;
@@ -588,14 +585,13 @@ set @b= 14632475938453979136;
 execute stmt using @a, @b;
 deallocate prepare stmt;
 drop table t1;
-show binlog events from 0;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	107	Server version, Binlog ver: 4
-master-bin.000001	107	Query	1	228	use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
-master-bin.000001	228	Query	1	296	BEGIN
-master-bin.000001	296	Query	1	420	use `test`; insert into t1 values (9999999999999999,14632475938453979136)
-master-bin.000001	420	Query	1	489	COMMIT
-master-bin.000001	489	Query	1	565	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (9999999999999999,14632475938453979136)
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; drop table t1
 reset master;
 CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
 USE bug39182;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
index c2ab084ddc9..21798ea2456 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
@@ -105,9 +105,8 @@ select * from t2;
 a
 select * from t3;
 a
-show binlog events;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Format_desc	#	#	Server ver: VERSION, Binlog ver: 4
 master-bin.000001	#	Query	#	#	use `test`; drop table t1,t2
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int) engine=blackhole
 master-bin.000001	#	Query	#	#	BEGIN
@@ -127,7 +126,7 @@ master-bin.000001	#	Query	#	#	use `test`; replace into t1 values(100)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; create table t2 (a varchar(200)) engine=blackhole
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=581
+master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
 master-bin.000001	#	Execute_load_query	#	#	use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`) ;file_id=#
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; alter table t1 add b int
@@ -164,13 +163,6 @@ start transaction;
 insert into t1 values(2);
 rollback;
 set autocommit=1;
-show binlog events;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Format_desc	#	#	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int) engine=blackhole
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(1)
-master-bin.000001	#	Query	#	#	COMMIT
 drop table if exists t1;
 reset master;
 create table t1 (a int auto_increment, primary key (a)) engine=blackhole;
diff --git a/mysql-test/suite/binlog/t/binlog_innodb.test b/mysql-test/suite/binlog/t/binlog_innodb.test
index c33a31a30f2..482e787a724 100644
--- a/mysql-test/suite/binlog/t/binlog_innodb.test
+++ b/mysql-test/suite/binlog/t/binlog_innodb.test
@@ -155,8 +155,8 @@ reset master;
 UPDATE t2,t1 SET t2.a=t1.a+2;
 # check
 select * from t2 /* must be (3,1), (4,4) */;
---echo there must no UPDATE in binlog
-source include/show_master_status.inc;
+--echo # There must no UPDATE in binlog;
+source include/show_binlog_events.inc;
 
 # B. testing multi_update::send_error() execution branch
 delete from t1;
@@ -166,8 +166,8 @@ insert into t2 values (1,2),(3,4),(4,4);
 reset master;
 --error ER_DUP_ENTRY
 UPDATE t2,t1  SET t2.a=t2.b where t2.a=t1.a;
---echo there must no UPDATE in binlog
-source include/show_master_status.inc;
+--echo # There must be no UPDATE query event;
+source include/show_binlog_events.inc;
 
 # cleanup bug#27716
 drop table t1, t2;
diff --git a/mysql-test/suite/binlog/t/binlog_stm_binlog.test b/mysql-test/suite/binlog/t/binlog_stm_binlog.test
index 280b7a3aef9..d18c2b4cd77 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_binlog.test
+++ b/mysql-test/suite/binlog/t/binlog_stm_binlog.test
@@ -5,8 +5,7 @@ create table t1 (a int, b int) engine=innodb;
 begin;
 insert into t1 values (1,2);
 commit;
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-show binlog events;
+source include/show_binlog_events.inc;
 drop table t1;
 
 # This is a wrapper for binlog.test so that the same test case can be used 
diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test
index 11867f38444..cb0cac17930 100644
--- a/mysql-test/suite/binlog/t/binlog_unsafe.test
+++ b/mysql-test/suite/binlog/t/binlog_unsafe.test
@@ -607,9 +607,9 @@ INSERT INTO t2 SET a = func_modify_t1();
 
 SET SESSION binlog_format = MIXED;
 --echo # Check if the statement is logged in row format.
-let $pos0_master= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
 INSERT INTO t2 SET a = func_modify_t1();
-eval SHOW BINLOG EVENTS FROM $pos0_master;
+--source include/show_binlog_events.inc
 
 # clean up
 DROP TABLE t1,t2;
@@ -638,9 +638,9 @@ INSERT INTO t1 SET a = 1;
 
 SET SESSION binlog_format = MIXED;
 --echo # Check if the statement is logged in row format.
-let $pos1_master= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
 INSERT INTO t1 SET a = 2;
-eval SHOW BINLOG EVENTS FROM $pos1_master;
+--source include/show_binlog_events.inc
 
 # clean up
 DROP TABLE t1,t2,t3;
diff --git a/mysql-test/suite/bugs/r/rpl_bug12691.result b/mysql-test/suite/bugs/r/rpl_bug12691.result
index 69d5e8009b0..8feeb0effc3 100644
--- a/mysql-test/suite/bugs/r/rpl_bug12691.result
+++ b/mysql-test/suite/bugs/r/rpl_bug12691.result
@@ -16,12 +16,11 @@ LOAD DATA INFILE FILENAME
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 3
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Format_desc	1	#	Server ver: #
-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE t1 (b CHAR(10))
-master-bin.000001	#	Begin_load_query	1	#	;file_id=#;block_len=#
-master-bin.000001	#	Execute_load_query	1	#	use `test`; LOAD DATA INFILE FILENAME ;file_id=#
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (b CHAR(10))
+master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
+master-bin.000001	#	Execute_load_query	#	#	use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/rpl_bug12691.dat' INTO TABLE `t1` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`b`) ;file_id=#
 
 **** On Slave ****
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
diff --git a/mysql-test/suite/bugs/r/rpl_bug36391.result b/mysql-test/suite/bugs/r/rpl_bug36391.result
index 2d62837a87a..33175d89d30 100644
--- a/mysql-test/suite/bugs/r/rpl_bug36391.result
+++ b/mysql-test/suite/bugs/r/rpl_bug36391.result
@@ -13,5 +13,6 @@ Tables_in_test
 t1
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	278		
+master-bin.000001	#	<Binlog_Do_DB>	<Binlog_Ignore_DB>
 flush logs;
+drop table t1;
diff --git a/mysql-test/suite/bugs/t/rpl_bug12691.test b/mysql-test/suite/bugs/t/rpl_bug12691.test
index b29c85584a5..28d7f16935e 100644
--- a/mysql-test/suite/bugs/t/rpl_bug12691.test
+++ b/mysql-test/suite/bugs/t/rpl_bug12691.test
@@ -28,9 +28,7 @@ STOP SLAVE;
 
 SELECT COUNT(*) FROM t1;
 
---replace_column 2 # 5 #
---replace_regex /Server ver: .+/Server ver: #/ /table_id: [0-9]+/table_id: #/ /COMMIT.+xid=[0-9]+.+/#/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /'.+'/FILENAME/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
 
 --save_master_pos
 
diff --git a/mysql-test/suite/bugs/t/rpl_bug36391.test b/mysql-test/suite/bugs/t/rpl_bug36391.test
index 9f384304837..8bca9a46c5a 100644
--- a/mysql-test/suite/bugs/t/rpl_bug36391.test
+++ b/mysql-test/suite/bugs/t/rpl_bug36391.test
@@ -21,8 +21,10 @@ create table t1(id int);
 
 show tables;
 
-show master status;
+--source include/show_master_status.inc
 
 flush logs;
 
 --exec $MYSQL_BINLOG $MYSQL_TEST_DIR/var/log/master-bin.000001 | $MYSQL test
+
+drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_000015.result b/mysql-test/suite/engines/funcs/r/rpl_000015.result
index bb3620ebc84..cfb4f0ead5a 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_000015.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_000015.result
@@ -10,174 +10,25 @@ File	Position	Binlog_Do_DB	Binlog_Ignore_DB
 master-bin.000001	107		
 stop slave;
 reset slave;
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	#
 Master_Log_File	
 Read_Master_Log_Pos	4
-Relay_Log_File	#
-Relay_Log_Pos	#
 Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
 Exec_Master_Log_Pos	0
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 change master to master_host='127.0.0.1';
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	#
 Master_Log_File	
 Read_Master_Log_Pos	4
-Relay_Log_File	#
-Relay_Log_Pos	#
 Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
 Exec_Master_Log_Pos	0
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 change master to master_host='127.0.0.1',master_user='root',
 master_password='',master_port=MASTER_PORT;
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	#
 Master_Log_File	
 Read_Master_Log_Pos	4
-Relay_Log_File	#
-Relay_Log_Pos	#
 Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
 Exec_Master_Log_Pos	0
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 start slave;
-show slave status;
-Slave_IO_State	Waiting for master to send event
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
 Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	107
-Relay_Log_File	slave-relay-bin.000002
-Relay_Log_Pos	254
 Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	107
-Relay_Log_Space	410
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 drop table if exists t1;
 create table t1 (n int, PRIMARY KEY(n));
 insert into t1 values (10),(45),(90);
diff --git a/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result b/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result
index 7a901b65810..b6cb2c0e7de 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result
@@ -4,8 +4,7 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+SHOW SLAVE STATUS;;
 SHOW SLAVE HOSTS;
 Server_id	Host	Port	Rpl_recovery_rank	Master_id
 2	127.0.0.1	SLAVE_PORT	0	1
diff --git a/mysql-test/suite/engines/funcs/r/rpl_change_master.result b/mysql-test/suite/engines/funcs/r/rpl_change_master.result
index c187f16cc83..2258a35a869 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_change_master.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_change_master.result
@@ -11,13 +11,7 @@ stop slave sql_thread;
 insert into t1 values(1);
 insert into t1 values(2);
 stop slave;
-show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	#	#	#	master-bin.000001	No	No							0		0	192	#	None		0	No						#	No	0		0			1
 change master to master_user='root';
-show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	#	#	#	master-bin.000001	No	No							0		0	192	#	None		0	No						#	No	0		0			1
 start slave;
 select * from t1;
 n
diff --git a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result b/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result
index b5e14d3adac..f71411c68dd 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result
@@ -4,8 +4,6 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
 load table t1 from master;
 ERROR 08S01: Error connecting to master: Master is not configured
 load table t1 from master;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
index 53a521aaf85..ef4d7797dbf 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
@@ -17,45 +17,6 @@ let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%
 
 --source include/wait_slave_status.inc
 flush logs;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	SLAVE_PORT
-Connect_Retry	60
-Master_Log_File	slave-bin.000001
-Read_Master_Log_Pos	107
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	slave-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	107
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	2
+Relay_Log_File	mysqld-relay-bin.000003
+Checking that both slave threads are running.
 STOP SLAVE;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
index 8b2da7ff9a1..779a3af9631 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
@@ -10,6 +10,6 @@ load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
 select count(*) from test.t1;
 count(*)
 2
-show binlog events from 107;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 drop table test.t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result
index df4512fa0ea..1b2ded26f66 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result
@@ -4,39 +4,23 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-show master status;
-File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	107	<Binlog_Ignore_DB>	
-show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	107	#	#	master-bin.000001	Yes	Yes							0		0	107	#	None		0	No						#	No	0		0			1
 stop slave;
-change master to master_log_pos=107;
+change master to master_log_pos=MASTER_LOG_POS;
 start slave;
 stop slave;
-change master to master_log_pos=107;
-show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	107	#	#	master-bin.000001	No	No							0		0	107	#	None		0	No						#	No	0		0			1
+change master to master_log_pos=MASTER_LOG_POS;
 start slave;
-show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	107	#	#	master-bin.000001	Yes	Yes							0		0	107	#	None		0	No						#	No	0		0			1
 stop slave;
-change master to master_log_pos=178;
+# impossible position leads to an error
+change master to master_log_pos=MASTER_LOG_POS;
 start slave;
-show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	178	#	#	master-bin.000001	No	Yes							0		0	178	#	None		0	No						#	No	1236	Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position'	0			1
-show master status;
-File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	107	<Binlog_Ignore_DB>	
+Last_IO_Error = Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position'
 create table if not exists t1 (n int);
 drop table if exists t1;
 create table t1 (n int);
 insert into t1 values (1),(2),(3);
 stop slave;
-change master to master_log_pos=207;
+change master to master_log_pos=MASTER_LOG_POS;
 start slave;
 select * from t1 ORDER BY n;
 n
diff --git a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result b/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
index 13f7fbfbdeb..0eb3d7e8ff9 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
@@ -8,48 +8,17 @@ start slave;
 CREATE TABLE t1 (a INT, b LONG);
 INSERT INTO t1 VALUES (1,1), (2,2);
 INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
 **** On Slave ****
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-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, b LONG)
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+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
+show binlog events from <binlog_start>;
 DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result
index 89654ebf165..048e07271b3 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result
@@ -41,12 +41,11 @@ t1
 t2
 **** On Master ****
 DROP TABLE t1,t2;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	106	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	106	Query	1	192	use `test`; CREATE TABLE t1 (a int)
-master-bin.000001	192	Query	1	278	use `test`; CREATE TABLE t2 (a int)
-master-bin.000001	278	Query	1	382	use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a int)
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 (a int)
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 SHOW TABLES;
 Tables_in_test
 t2
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
index ad192b530a7..cd7528280d0 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
@@ -17,43 +17,5 @@ a
 0
 drop table t1;
 insert into t1 values (1);
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_MYPORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	test.t2
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1146
-Last_Error	Error 'Table 'test.t1' doesn't exist' on opening tables
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	1146
-Last_SQL_Error	Error 'Table 'test.t1' doesn't exist' on opening tables
+Last_SQL_Error = Error 'Table 'test.t1' doesn't exist' on opening tables
 drop table t1, t2;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result b/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
index a21bec6ae55..547dd8e1541 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
@@ -23,47 +23,7 @@ select @@global.max_relay_log_size;
 @@global.max_relay_log_size
 4096
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 2
 #
@@ -73,47 +33,7 @@ set global max_relay_log_size=(5*4096);
 select @@global.max_relay_log_size;
 @@global.max_relay_log_size	20480
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 3: max_relay_log_size = 0
 #
@@ -123,94 +43,13 @@ set global max_relay_log_size=0;
 select @@global.max_relay_log_size;
 @@global.max_relay_log_size	0
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
 #
 stop slave;
 reset slave;
 flush logs;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 #
 # Test 5
 #
@@ -218,93 +57,13 @@ reset slave;
 start slave;
 flush logs;
 create table t1 (a int);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
 #
 flush logs;
 drop table t1;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 flush logs;
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result b/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
index fa40d8760a8..7bf09df31ca 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
@@ -4,196 +4,37 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
 Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-stop slave;
+Master_Host	127.0.0.1
+include/stop_slave.inc
 change master to master_user='test';
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
 Master_User	test
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-reset slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
 Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-stop slave;
 reset slave;
-start slave;
+Master_User	root
+Master_Host	127.0.0.1
+include/start_slave.inc
+Master_User	root
+Master_Host	127.0.0.1
+include/stop_slave.inc
+reset slave;
+include/start_slave.inc
 create temporary table t1 (a int);
-stop slave;
+include/stop_slave.inc
 reset slave;
-start slave;
+include/start_slave.inc
 show status like 'slave_open_temp_tables';
 Variable_name	Value
 Slave_open_temp_tables	0
-stop slave;
+include/stop_slave.inc
 reset slave;
-*** errno must be zero: 0 ***
 change master to master_user='impossible_user_name';
 start slave;
-ONE
-1
 include/stop_slave.inc
 change master to master_user='root';
 include/start_slave.inc
-*** last errno must be  zero: 0 ***
-*** last error must be blank:  ***
 include/stop_slave.inc
 change master to master_user='impossible_user_name';
 start slave;
-ONE
-1
 include/stop_slave.inc
 reset slave;
-*** io  last errno must be  zero: 0  ***
-*** io  last error must be blank:   ***
-*** sql last errno must be  zero: 0 ***
-*** sql last error must be blank:  ***
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_until.result b/mysql-test/suite/engines/funcs/r/rpl_row_until.result
index 5091a9f6468..72dd1a6a7c3 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_until.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_until.result
@@ -12,193 +12,39 @@ create table t2(n int not null auto_increment primary key);
 insert into t2 values (1),(2);
 insert into t2 values (3),(4);
 drop table t2;
-start slave until master_log_file='master-bin.000001', master_log_pos=311;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
 select * from t1;
 n
 1
 2
 3
 4
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_MYPORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	slave-relay-bin.000004
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	#
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	Master
-Until_Log_File	master-bin.000001
-Until_Log_Pos	311
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=MASTER_LOG_POS;
 select * from t1;
-n	1
-n	2
-n	3
-n	4
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_MYPORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	slave-relay-bin.000004
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	#
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	Master
-Until_Log_File	master-no-such-bin.000001
-Until_Log_Pos	291
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
+n
+1
+2
+3
+4
+start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=RELAY_LOG_POS;
 select * from t2;
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_MYPORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	slave-relay-bin.000004
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	#
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	Relay
-Until_Log_File	slave-relay-bin.000004
-Until_Log_Pos	728
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
+n
+1
+2
 start slave;
 stop slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_MYPORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	slave-relay-bin.000004
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	Master
-Until_Log_File	master-bin.000001
-Until_Log_Pos	740
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
-start slave until master_log_file='master-bin', master_log_pos=561;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
+start slave until master_log_file='master-bin', master_log_pos=MASTER_LOG_POS;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS, relay_log_pos=RELAY_LOG_POS;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave until master_log_file='master-bin.000001';
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave until relay_log_file='slave-relay-bin.000002';
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=MASTER_LOG_POS;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave sql_thread;
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
 Warnings:
-Level	Note
-Code	1254
-Message	Slave is already running
+Note	1254	Slave is already running
diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
index 700bc270f07..1e7108d7961 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
@@ -8,10 +8,8 @@ create table t1 (n int);
 reset master;
 stop slave;
 change master to master_port=SLAVE_PORT;
-show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-	127.0.0.1	root	SLAVE_PORT	1		4	slave-relay-bin.000001	4		No	No				#		#	0		0	0	107	None		0	No						NULL	No	0		0			1
 start slave;
+Last_IO_Error = Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
 insert into t1 values (1);
 show status like "slave_running";
 Variable_name	Value
diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result
index f8d24f70776..066b563c4e8 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result
@@ -8,9 +8,6 @@ create table t1 (n int);
 reset master;
 stop slave;
 change master to master_port=SLAVE_PORT;
-show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-	127.0.0.1	root	SLAVE_PORT	1		4	slave-relay-bin.000001	4		No	No						#	0		0	0	107	None		0	No						NULL	No	0		0			1
 start slave;
 insert into t1 values (1);
 select * from t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
index 0e438d294fd..c4dc7686045 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
@@ -18,46 +18,5 @@ drop user rpl@127.0.0.1;
 flush privileges;
 stop slave;
 start slave;
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	rpl
-Master_Port	MASTER_MYPORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Connecting
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	NULL
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 drop table t1;
 drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result b/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
index a21bec6ae55..547dd8e1541 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
@@ -23,47 +23,7 @@ select @@global.max_relay_log_size;
 @@global.max_relay_log_size
 4096
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 2
 #
@@ -73,47 +33,7 @@ set global max_relay_log_size=(5*4096);
 select @@global.max_relay_log_size;
 @@global.max_relay_log_size	20480
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 3: max_relay_log_size = 0
 #
@@ -123,94 +43,13 @@ set global max_relay_log_size=0;
 select @@global.max_relay_log_size;
 @@global.max_relay_log_size	0
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
 #
 stop slave;
 reset slave;
 flush logs;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 #
 # Test 5
 #
@@ -218,93 +57,13 @@ reset slave;
 start slave;
 flush logs;
 create table t1 (a int);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
 #
 flush logs;
 drop table t1;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 flush logs;
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result b/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
index 94e8a31390d..c6c2c525098 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
@@ -4,205 +4,38 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
 Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-stop slave;
+Master_Host	127.0.0.1
+include/stop_slave.inc
 change master to master_user='test';
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
 Master_User	test
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Master_Host	127.0.0.1
 reset slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
 Master_User	test
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Master_Host	127.0.0.1
 change master to master_user='root';
-start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
+include/start_slave.inc
 Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-stop slave;
+Master_Host	127.0.0.1
+include/stop_slave.inc
 reset slave;
-start slave;
+include/start_slave.inc
 create temporary table t1 (a int);
-stop slave;
+include/stop_slave.inc
 reset slave;
-start slave;
+include/start_slave.inc
 show status like 'slave_open_temp_tables';
 Variable_name	Value
 Slave_open_temp_tables	1
-stop slave;
+include/stop_slave.inc
 reset slave;
-*** errno must be zero: 0 ***
 change master to master_user='impossible_user_name';
 start slave;
-ONE
-1
-include/stop_slave.inc
+stop slave;
 change master to master_user='root';
 include/start_slave.inc
-*** last errno must be  zero: 0 ***
-*** last error must be blank:  ***
-include/stop_slave.inc
+stop slave;
 change master to master_user='impossible_user_name';
 start slave;
-ONE
-1
-include/stop_slave.inc
+stop slave;
 reset slave;
-*** io  last errno must be  zero: 0  ***
-*** io  last error must be blank:   ***
-*** sql last errno must be  zero: 0 ***
-*** sql last error must be blank:  ***
diff --git a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
index b0d92f3ca3f..e7306cd6293 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
@@ -376,7 +376,7 @@ CREATE TABLE t12 (data LONG);
 LOCK TABLES t12 WRITE;
 INSERT INTO t12 VALUES(UUID());
 UNLOCK TABLES;
-show binlog events;
-show binlog events;
+show binlog events from <binlog_start>;
+show binlog events from <binlog_start>;
 drop database mysqltest1;
 set global binlog_format= @saved_binlog_format;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_000015.test b/mysql-test/suite/engines/funcs/t/rpl_000015.test
index 817ed6f407c..6c18e66a3a6 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_000015.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_000015.test
@@ -11,31 +11,25 @@ save_master_pos;
 connection slave;
 stop slave;
 reset slave;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 5 # 8 # 9 # 23 # 33 #
-show slave status;
+let $status_items= Master_Log_File, Read_Master_Log_Pos, Relay_Master_Log_File, Exec_Master_Log_Pos;
+source include/show_slave_status.inc;
 
 change master to master_host='127.0.0.1';
 # The following needs to be cleaned up when change master is fixed
---vertical_results
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 5 # 8 # 9 # 23 # 33 #
-show slave status;
+source include/show_slave_status.inc;
+
 --replace_result $MASTER_MYPORT MASTER_PORT
 eval change master to master_host='127.0.0.1',master_user='root',
  master_password='',master_port=$MASTER_MYPORT;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 5 # 8 # 9 # 23 # 33 #
-show slave status;
+source include/show_slave_status.inc;
+
 start slave;
 sync_with_master;
+let $status_items= Master_Log_File, Relay_Master_Log_File;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
+
 --vertical_results
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 5 # 8 # 9 # 23 # 33 #
---replace_column 33 #
-show slave status;
 connection master;
 --disable_warnings
 drop table if exists t1;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test b/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test
index 078d1048794..7644b18ee7e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test
@@ -7,15 +7,11 @@ source include/master-slave.inc;
 --disable_ps_protocol
 
 #first, make sure the slave has had enough time to register
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
 
 #discover slaves
 connection master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-SHOW SLAVE STATUS;
+--query_vertical SHOW SLAVE STATUS;
 --replace_result $SLAVE_MYPORT SLAVE_PORT
 SHOW SLAVE HOSTS;
 rpl_probe;
@@ -25,9 +21,7 @@ enable_rpl_parse;
 create table t1 ( n int);
 insert into t1 values (1),(2),(3),(4);
 disable_rpl_parse;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
 insert into t1 values(5);
 connection master;
 enable_rpl_parse;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_change_master.test b/mysql-test/suite/engines/funcs/t/rpl_change_master.test
index c031464c95e..ce8c921c2ad 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_change_master.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_change_master.test
@@ -18,13 +18,26 @@ save_master_pos;
 connection slave;
 --real_sleep 3 # wait for I/O thread to have read updates
 stop slave;
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 23 # 33 #
-show slave status;
+source include/wait_for_slave_to_stop.inc;
+
+let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
+let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
+if (`SELECT $read_pos = $exec_pos`)
+{
+  source include/show_rpl_debug_info.inc;
+  echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos';
+  die Failed because Read_Master_Log_Pos is equal to Exec_Master_Log_Pos;
+} 
 change master to master_user='root';
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 23 # 33 #
-show slave status;
+let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
+let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
+if (`SELECT $read_pos <> $exec_pos`)
+{
+  source include/show_rpl_debug_info.inc;
+  echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos';
+  die Failed because Read_Master_Log_Pos is not equal to Exec_Master_Log_Pos;
+}
+
 start slave;
 sync_with_master;
 select * from t1;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test b/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test
index 707d1eca8c2..863b450a6d9 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test
@@ -1,8 +1,5 @@
 source include/master-slave.inc;
 
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
-
 #
 # Load table should not succeed on the master as this is not a slave
 #
diff --git a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
index 2e481f5e5e7..0b71817226a 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
@@ -41,8 +41,7 @@ sleep 5;
 #
 #  Show status of slave
 #
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
---vertical_results
-SHOW SLAVE STATUS;
+--let status_items= Relay_Log_File
+--source include/show_slave_status.inc
+--source include/check_slave_is_running.inc
 STOP SLAVE;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
index a06df3bbfc9..2dd2218eb5c 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
@@ -20,9 +20,7 @@ save_master_pos;
 connection slave;
 sync_with_master;
 select count(*) from test.t1; # check that LOAD was replicated
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events from 107; # should be nothing
+source include/show_binlog_events.inc;
 
 # Cleanup
 connection master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test
index 3a762b19756..e07f0d5f2a7 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test
@@ -11,36 +11,41 @@
 # Passes with rbr no problem, removed statement include [jbm]
 
 source include/master-slave.inc;
---replace_column 3 <Binlog_Ignore_DB>
-show master status;
+let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
 sync_slave_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
 stop slave;
-change master to master_log_pos=107;
+
+--replace_result $master_log_pos MASTER_LOG_POS
+eval change master to master_log_pos=$master_log_pos;
 start slave;
 sleep 5;
 stop slave;
-change master to master_log_pos=107;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+
+--replace_result $master_log_pos MASTER_LOG_POS
+eval change master to master_log_pos=$master_log_pos;
+--let $slave_param= Read_Master_Log_Pos
+--let $slave_param_value= $master_log_pos
+--source include/wait_for_slave_param.inc
+
 start slave;
 sleep 5;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+--let $slave_param= Read_Master_Log_Pos
+--let $slave_param_value= $master_log_pos
+--source include/wait_for_slave_param.inc
+--source include/check_slave_no_error.inc
+
 stop slave;
-change master to master_log_pos=178;
+--echo # impossible position leads to an error
+--replace_result 177 MASTER_LOG_POS
+change master to master_log_pos=177;
 start slave;
 sleep 2;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+let $slave_io_errno= 1236;
+let $show_slave_io_error= 1;
+source include/wait_for_slave_io_error.inc;
 connection master;
---replace_column 3 <Binlog_Ignore_DB>
-show master status;
+
+let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
 create table if not exists t1 (n int);
 drop table if exists t1;
 create table t1 (n int);
@@ -48,7 +53,9 @@ insert into t1 values (1),(2),(3);
 save_master_pos;
 connection slave;
 stop slave;
-change master to master_log_pos=207;
+
+--replace_result $master_log_pos MASTER_LOG_POS
+eval change master to master_log_pos=$master_log_pos;
 start slave;
 sync_with_master;
 select * from t1 ORDER BY n;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
index 30d2688c3fb..e78c74ab423 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
@@ -9,25 +9,17 @@
 CREATE TABLE t1 (a INT, b LONG);
 INSERT INTO t1 VALUES (1,1), (2,2);
 INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
 # Different number of binlog events are generated by different engines
 --disable_result_log
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
 --enable_result_log
 sync_slave_with_master;
 --echo **** On Slave ****
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
+source include/show_binlog_events.inc;
+
 # Different number of binlog events are generated by different engines
 --disable_result_log
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
 --enable_result_log
 --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
 --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test
index 20c217a7c3a..d18ebc2846b 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test
@@ -30,10 +30,7 @@ connection master;
 --echo **** On Master ****
 # Should drop the non-temporary table t1 and the temporary table t2
 DROP TABLE t1,t2;
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
 SHOW TABLES;
 sync_slave_with_master;
 --echo **** On Slave ****
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
index 736071a8ece..dca2894c9da 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
@@ -22,13 +22,11 @@ connection master;
 insert into t1 values (1);
 
 connection slave;
-# slave should have stopped because can't find table t1
-wait_for_slave_to_stop;
+# slave should have stopped because can't find table t1 
 # see if we have a good error message:
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
---vertical_results
-show slave status;
+--let $slave_sql_errno= 1146
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 
 # cleanup
 connection master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_until.test b/mysql-test/suite/engines/funcs/t/rpl_row_until.test
index ccd9ce11637..b60734317c6 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_until.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_until.test
@@ -18,44 +18,50 @@ connection master;
 # create some events on master
 create table t1(n int not null auto_increment primary key);
 insert into t1 values (1),(2),(3),(4);
+let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
 drop table t1;
+
 create table t2(n int not null auto_increment primary key);
 insert into t2 values (1),(2);
+let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
 insert into t2 values (3),(4);
 drop table t2;
 
 # try to replicate all queries until drop of t1
 connection slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=311;
+--replace_result $master_log_pos_1 MASTER_LOG_POS
+eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_log_pos_1;
 sleep 2;
 wait_for_slave_to_stop;
 # here table should be still not deleted
 select * from t1;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
-show slave status;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_log_pos_1
+--source include/check_slave_param.inc
 
 # this should fail right after start
+--replace_result 291 MASTER_LOG_POS
 start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
 # again this table should be still not deleted
 select * from t1;
 sleep 2;
 wait_for_slave_to_stop;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
-show slave status;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_log_pos_1
+--source include/check_slave_param.inc
 
 # try replicate all up to and not including the second insert to t2;
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
+let $master_log_pos= $master_log_pos_2;
+let $relay_log_file= slave-relay-bin.000004;
+--source include/get_relay_log_pos.inc
+--replace_result $relay_log_pos RELAY_LOG_POS
+eval start slave until relay_log_file='$relay_log_file', relay_log_pos=$relay_log_pos;
 sleep 2;
 wait_for_slave_to_stop;
 select * from t2;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
-show slave status;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_log_pos
+--source include/check_slave_param.inc
 
 # clean up
 start slave;
@@ -65,27 +71,32 @@ connection slave;
 sync_with_master;
 stop slave;
 
+--let $exec_log_pos_1= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
 # this should stop immediately as we are already there
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
+--replace_result $master_log_pos_2 MASTER_LOG_POS
+eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_log_pos_2;
 sleep 2;
 wait_for_slave_to_stop;
 # here the sql slave thread should be stopped
---vertical_results
---replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
---replace_column 1 # 7 # 9 # 22 # 23 # 33 #
-show slave status;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $exec_log_pos_1
+--source include/check_slave_param.inc
 
 #testing various error conditions
+--replace_result 561 MASTER_LOG_POS
 --error 1277
 start slave until master_log_file='master-bin', master_log_pos=561;
+--replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
 --error 1277
 start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
 --error 1277
 start slave until master_log_file='master-bin.000001';
 --error 1277
 start slave until relay_log_file='slave-relay-bin.000002';
+--replace_result 561 MASTER_LOG_POS
 --error 1277
 start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
 # Warning should be given for second command
 start slave sql_thread;
+--replace_result 740 MASTER_LOG_POS
 start slave until master_log_file='master-bin.000001', master_log_pos=740;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
index 71310750b60..014f38d3544 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
@@ -12,10 +12,13 @@ reset master;
 stop slave;
 --replace_result $SLAVE_MYPORT SLAVE_PORT
 eval change master to master_port=$SLAVE_MYPORT;
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 16 # 18 #
-show slave status;
+source include/check_slave_no_error.inc;
+
 start slave;
+let $slave_io_errno= 1593;
+let $show_slave_io_error= 1;
+source include/wait_for_slave_io_error.inc;
+
 insert into t1 values (1);
 # can't MASTER_POS_WAIT(), it does not work in this weird setup
 # (when slave is its own master without --replicate-same-server-id)
diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test
index 0f2eb560d18..5b8683ecfb1 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test
@@ -9,9 +9,6 @@ reset master;
 stop slave;
 --replace_result $SLAVE_MYPORT SLAVE_PORT
 eval change master to master_port=$SLAVE_MYPORT;
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 18 #
-show slave status;
 start slave;
 insert into t1 values (1);
 save_master_pos;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test
index b3d6e49e215..cc3fbf6abee 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test
@@ -22,9 +22,7 @@ drop table if exists t1;
 --enable_warnings
 create table t1 (n int);
 insert into t1 values (1);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
 select * from t1;
 
 # 3. Delete new replication user
@@ -40,12 +38,8 @@ stop slave;
 start slave;
 
 # 5. Make sure Slave_IO_Running = No
---replace_result $MASTER_MYPORT MASTER_MYPORT
-# Column 1 is replaced, since the output can be either
-# "Connecting to master" or "Waiting for master update"
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 #
---vertical_results
-show slave status;
+let $slave_io_errno= 1045;
+source include/wait_for_slave_io_error.inc;
 
 # Cleanup (Note that slave IO thread is not running)
 connection slave;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
index b9df07101fb..c9e2ab6b703 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
@@ -510,9 +510,7 @@ INSERT INTO t12 VALUES(UUID());
 UNLOCK TABLES;
 
 --disable_result_log
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events;
+source include/show_binlog_events.inc;
 --enable_result_log
 sync_slave_with_master;
 
@@ -529,9 +527,7 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_
 
 connection master;
 --disable_result_log
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events;
+source include/show_binlog_events.inc;
 --enable_result_log
 
 # Now test that mysqlbinlog works fine on a binlog generated by the
diff --git a/mysql-test/suite/federated/federated_plugin-master.opt b/mysql-test/suite/federated/federated_plugin-master.opt
index ac2e9458e5f..fa9ad063fe1 100644
--- a/mysql-test/suite/federated/federated_plugin-master.opt
+++ b/mysql-test/suite/federated/federated_plugin-master.opt
@@ -1,2 +1 @@
---plugin_dir=../storage/federated/.libs
-
+--plugin_dir=$FEDERATED_PLUGIN_DIR
diff --git a/mysql-test/suite/federated/federated_plugin.test b/mysql-test/suite/federated/federated_plugin.test
index 81421e226b1..b9056f63352 100644
--- a/mysql-test/suite/federated/federated_plugin.test
+++ b/mysql-test/suite/federated/federated_plugin.test
@@ -1,6 +1,8 @@
 --source include/not_windows.inc
 --source include/have_federated_plugin.inc
 
+--skip federated plugin is disabled
+
 CREATE TABLE t1(a int) ENGINE=FEDERATED;
 DROP TABLE t1;
 
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index 90ced3c8b16..1624a9e64b7 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -2414,8 +2414,8 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	3	Using where
 DROP TABLE t1,t2;
 #
-# Bug#38999 valgrind warnings for update statement in function compare_record()
 #
+# Bug#38999 valgrind warnings for update statement in function compare_record()
 CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
 CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
 INSERT INTO t1 values (1),(2),(3),(4),(5);
@@ -2425,6 +2425,13 @@ a
 2
 UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1;
 DROP TABLE t1,t2;
+# Bug #53830: !table || (!table->read_set || bitmap_is_set(table->read_set, field_index))
+CREATE TABLE t1 (a INT, b INT, c INT, d INT,
+PRIMARY KEY(a,b,c), KEY(b,d))
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0, 77, 1, 3);
+UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25;
+DROP TABLE t1;
 End of 5.1 tests
 #
 # Test for bug #39932 "create table fails if column for FK is in different
diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test
index c49b215887b..09e076c0506 100644
--- a/mysql-test/suite/innodb/t/innodb_mysql.test
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test
@@ -663,6 +663,19 @@ UPDATE t1,t2 SET t1.a = t1.a + 100 WHERE t1.a = 1;
 
 DROP TABLE t1,t2;
 
+--echo #
+--echo # Bug #53830: !table || (!table->read_set || bitmap_is_set(table->read_set, field_index))
+--echo #
+
+CREATE TABLE t1 (a INT, b INT, c INT, d INT,
+                 PRIMARY KEY(a,b,c), KEY(b,d))
+                 ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0, 77, 1, 3);
+
+UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25;
+
+DROP TABLE t1;
+
 --echo End of 5.1 tests
 
 
diff --git a/mysql-test/suite/manual/r/rpl_replication_delay.result b/mysql-test/suite/manual/r/rpl_replication_delay.result
index a8fa6ce8265..73dd77cc647 100644
--- a/mysql-test/suite/manual/r/rpl_replication_delay.result
+++ b/mysql-test/suite/manual/r/rpl_replication_delay.result
@@ -4,45 +4,8 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-show slave status /* Second_behind reports 0 */;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	9306
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	106
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	106
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
+# Second_behind reports 0
 Seconds_Behind_Master	0
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
 drop table if exists t1;
 Warnings:
 Note	1051	Unknown table 't1'
@@ -50,87 +13,13 @@ create table t1 (f1 int);
 flush logs /* contaminate rli->last_master_timestamp */;
 lock table t1 write;
 insert into t1 values (1);
-show slave status /* bug emulated: reports slave threads starting time about 3*3 not 3 secs */;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	9306
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	367
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	279
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
+# bug emulated: reports slave threads starting time about 3*3 not 3 secs
 Seconds_Behind_Master	9
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
 unlock tables;
 flush logs /* this time rli->last_master_timestamp is not affected */;
 lock table t1 write;
 insert into t1 values (2);
-show slave status /* reports the correct diff with master query time about 3+3 secs */;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	9306
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	455
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	367
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
+# reports the correct diff with master query time about 3+3 secs
 Seconds_Behind_Master	7
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
 unlock tables;
 drop table t1;
diff --git a/mysql-test/suite/manual/t/rpl_replication_delay.test b/mysql-test/suite/manual/t/rpl_replication_delay.test
index 8230698c8f9..fc1db9bfe18 100644
--- a/mysql-test/suite/manual/t/rpl_replication_delay.test
+++ b/mysql-test/suite/manual/t/rpl_replication_delay.test
@@ -10,9 +10,9 @@ source include/master-slave.inc;
 connection master;
 #connection slave;
 sync_slave_with_master;
---replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
---replace_column 1 # 8 # 9 # 23 #
---query_vertical show slave status /* Second_behind reports 0 */;
+--echo # Second_behind reports 0
+let $status_items= Seconds_Behind_Master;
+source include/show_slave_status.inc;
 sleep 3;
 
 ### bug emulation
@@ -35,9 +35,8 @@ insert into t1 values (1);
 sleep 3;
 
 connection slave;
---replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
---replace_column 1 # 8 # 9 # 23 #
---query_vertical show slave status /* bug emulated: reports slave threads starting time about 3*3 not 3 secs */;
+--echo # bug emulated: reports slave threads starting time about 3*3 not 3 secs
+source include/show_slave_status.inc;
 unlock tables;
 
 connection master;
@@ -55,9 +54,8 @@ insert into t1 values (2);
 sleep 3;
 
 connection slave;
---replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT
---replace_column 1 # 8 # 9 # 23 #
---query_vertical show slave status /* reports the correct diff with master query time about 3+3 secs */;
+--echo # reports the correct diff with master query time about 3+3 secs
+source include/show_slave_status.inc;
 unlock tables;
 
 connection master;
diff --git a/mysql-test/suite/ndb_team/r/rpl_ndb_extraColMaster.result b/mysql-test/suite/ndb_team/r/rpl_ndb_extraColMaster.result
index 97300e7131b..55a95605839 100644
--- a/mysql-test/suite/ndb_team/r/rpl_ndb_extraColMaster.result
+++ b/mysql-test/suite/ndb_team/r/rpl_ndb_extraColMaster.result
@@ -91,49 +91,7 @@ f1	f2	f3	f4
 27	27	27	next
 29	29	29	second
 30	30	30	next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-
+Checking that both slave threads are running.
 
 ***** Testing Altering table def scenario *****
 
@@ -454,7 +412,9 @@ f1	f2	f3	f4
 update t31 set f5=555555555555555 where f3=6;
 update t31 set f2=2 where f3=2;
 update t31 set f1=NULL where f3=1;
-update t31 set f3=0, f27=NULL, f35='f35 new value' where f3=3;
+update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
+Warnings:
+Warning	1048	Column 'f3' cannot be null
 
 ** Delete from Master **
 
@@ -463,50 +423,12 @@ delete from t2;
 delete from t3;
 delete from t4;
 delete from t31;
+select * from t31;
+f1	f2	f3	f4
 
 ** Check slave status **
 
-select * from t31;
-f1	f2	f3	f4
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
+Checking that both slave threads are running.
 
 ****************************************
 * columns in master at middle of table *
@@ -539,50 +461,13 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
 (3,@b1,DEFAULT,'QA',DEFAULT);
 
 ********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1677 ***
 ********************************************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1535
-Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1535
-Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 
 *** Drop t10  ***
 DROP TABLE t10;
@@ -614,50 +499,13 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
 (3,@b1,DEFAULT,'QA',DEFAULT);
 
 ********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1677 ***
 ********************************************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1535
-Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1535
-Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 
 *** Drop t11  ***
 DROP TABLE t11;
@@ -768,45 +616,7 @@ c1	c3	hex(c4)	c5	c6
 ************
 * Bug30415 *
 ************
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1091
-Last_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1091
-Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Last_SQL_Error = Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
 STOP SLAVE;
 RESET SLAVE;
 
@@ -854,45 +664,7 @@ c1	hex(c4)	c5	c6	c7	c2
 *** Expect slave to fail with Error 1054 ***
 ********************************************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1054
-Last_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1054
-Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Last_SQL_Error = Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
 STOP SLAVE;
 RESET SLAVE;
 
@@ -940,45 +712,7 @@ c1	hex(c4)	c5	c6	c7
 *** BUG 30434 ***
 *****************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1072
-Last_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1072
-Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Last_SQL_Error = Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
 STOP SLAVE;
 RESET SLAVE;
 
@@ -1230,49 +964,7 @@ f1	f2	f3	f4
 27	27	27	next
 29	29	29	second
 30	30	30	next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-
+Checking that both slave threads are running.
 
 ***** Testing Altering table def scenario *****
 
@@ -1593,7 +1285,9 @@ f1	f2	f3	f4
 update t31 set f5=555555555555555 where f3=6;
 update t31 set f2=2 where f3=2;
 update t31 set f1=NULL where f3=1;
-update t31 set f3=0, f27=NULL, f35='f35 new value' where f3=3;
+update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
+Warnings:
+Warning	1048	Column 'f3' cannot be null
 
 ** Delete from Master **
 
@@ -1602,50 +1296,12 @@ delete from t2;
 delete from t3;
 delete from t4;
 delete from t31;
+select * from t31;
+f1	f2	f3	f4
 
 ** Check slave status **
 
-select * from t31;
-f1	f2	f3	f4
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
+Checking that both slave threads are running.
 
 ****************************************
 * columns in master at middle of table *
@@ -1678,50 +1334,13 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
 (3,@b1,DEFAULT,'QA',DEFAULT);
 
 ********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1677 ***
 ********************************************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1535
-Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1535
-Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 
 *** Drop t10  ***
 DROP TABLE t10;
@@ -1753,50 +1372,13 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
 (3,@b1,DEFAULT,'QA',DEFAULT);
 
 ********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1677 ***
 ********************************************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1535
-Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1535
-Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 
 *** Drop t11  ***
 DROP TABLE t11;
@@ -1907,45 +1489,7 @@ c1	c3	hex(c4)	c5	c6
 ************
 * Bug30415 *
 ************
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1091
-Last_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1091
-Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Last_SQL_Error = Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
 STOP SLAVE;
 RESET SLAVE;
 
@@ -1993,45 +1537,7 @@ c1	hex(c4)	c5	c6	c7	c2
 *** Expect slave to fail with Error 1054 ***
 ********************************************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1054
-Last_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1054
-Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Last_SQL_Error = Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
 STOP SLAVE;
 RESET SLAVE;
 
@@ -2079,45 +1585,7 @@ c1	hex(c4)	c5	c6	c7
 *** BUG 30434 ***
 *****************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1072
-Last_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1072
-Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Last_SQL_Error = Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
 STOP SLAVE;
 RESET SLAVE;
 
diff --git a/mysql-test/suite/ndb_team/r/rpl_ndb_mix_innodb.result b/mysql-test/suite/ndb_team/r/rpl_ndb_mix_innodb.result
index f9c077f38da..203a59b4613 100644
--- a/mysql-test/suite/ndb_team/r/rpl_ndb_mix_innodb.result
+++ b/mysql-test/suite/ndb_team/r/rpl_ndb_mix_innodb.result
@@ -26,21 +26,21 @@ from mysql.ndb_apply_status;
 # since insert is done with transactional engine, expect a BEGIN
 # at <start_pos>
 
-show binlog events from <start_pos> limit 1;
+show binlog events from <binlog_start> limit 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	<start_pos>	Query	1	#	BEGIN
+master-bin.000001	#	Query	#	#	BEGIN
 
 # Now the insert, one step after
 
-show binlog events from <start_pos> limit 1,1;
+show binlog events from <binlog_start> limit 1,1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (1,2)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1,2)
 
 # and the COMMIT should be at <end_pos>
 
-show binlog events from <start_pos> limit 2,1;
+show binlog events from <binlog_start> limit 2,1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Xid	1	<end_pos>	COMMIT /* XID */
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 
 begin;
 insert into t1 values (2,3);
@@ -51,18 +51,18 @@ select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
 from mysql.ndb_apply_status;
 @log_name:=log_name	@start_pos:=start_pos	@end_pos:=end_pos
 <log_name>	<start_pos>	<end_pos>
-show binlog events from <start_pos> limit 1;
+show binlog events from <binlog_start> limit 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	<start_pos>	Query	1	#	BEGIN
+master-bin.000001	#	Query	#	#	BEGIN
 
-show binlog events from <start_pos> limit 1,2;
+show binlog events from <binlog_start> limit 1,2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (2,3)
 master-bin.000001	#	Query	#	#	use `test`; insert into t2 values (3,4)
 
-show binlog events from <start_pos> limit 3,1;
+show binlog events from <binlog_start> limit 3,1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Xid	1	<end_pos>	COMMIT /* XID */
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 
 DROP TABLE test.t1, test.t2;
 SHOW TABLES;
diff --git a/mysql-test/suite/parts/r/rpl_partition.result b/mysql-test/suite/parts/r/rpl_partition.result
index 78d8beb17ed..abd3f7924df 100644
--- a/mysql-test/suite/parts/r/rpl_partition.result
+++ b/mysql-test/suite/parts/r/rpl_partition.result
@@ -149,47 +149,7 @@ SUBPARTITIONS 2
  PARTITION pa9 VALUES LESS THAN (90) ENGINE = InnoDB,
  PARTITION pa10 VALUES LESS THAN (100) ENGINE = InnoDB,
  PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_MYPORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 SELECT count(*) "Slave norm" FROM t1;
 Slave norm	500
 SELECT count(*) "Slave bykey" FROM t2;
diff --git a/mysql-test/suite/parts/t/rpl_partition.test b/mysql-test/suite/parts/t/rpl_partition.test
index 6a5a17ad5af..6be0a47e43f 100644
--- a/mysql-test/suite/parts/t/rpl_partition.test
+++ b/mysql-test/suite/parts/t/rpl_partition.test
@@ -157,9 +157,7 @@ SELECT count(*) as "Master byrange" FROM t3;
 --sync_slave_with_master
 connection slave;
 show create table t3; 
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
-show slave status;
+--source include/check_slave_is_running.inc
 SELECT count(*) "Slave norm" FROM t1;
 SELECT count(*) "Slave bykey" FROM t2;
 SELECT count(*) "Slave byrange" FROM t3;
diff --git a/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc b/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc
index 70e17cef9fe..79825016448 100644
--- a/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc
+++ b/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc
@@ -66,9 +66,7 @@ ALTER TABLE t2 DROP COLUMN d;
 --echo
 --echo
 --echo ******************** SHOW BINLOG EVENTS ********************
---replace_column 2 # 5 #
---replace_regex /Server ver: .+/Server ver: #/ /table_id: [0-9]+/table_id: #/
-show binlog events from 1;
+source include/show_binlog_events.inc;
 sync_slave_with_master;
 # as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
 --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test_rpl > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
diff --git a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
index e9adb805c99..d953397c0cb 100644
--- a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
+++ b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
@@ -326,10 +326,7 @@ DROP VIEW v2;
 --echo
 --echo
 --echo ******************** SHOW BINLOG EVENTS ********************
---replace_column 2 # 5 #
---replace_regex /Server ver: .+/Server ver: #/ /table_id: [0-9]+/table_id: #/ /COMMIT.+xid=[0-9]+.+/#/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show binlog events from 1;
+--source include/show_binlog_events.inc
 sync_slave_with_master;
 # as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
 --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test_rpl > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
diff --git a/mysql-test/suite/rpl/r/rpl_000015.result b/mysql-test/suite/rpl/r/rpl_000015.result
deleted file mode 100644
index 1b1249bc979..00000000000
--- a/mysql-test/suite/rpl/r/rpl_000015.result
+++ /dev/null
@@ -1,105 +0,0 @@
-reset master;
-show master status;
-File	Position	Binlog_Do_DB	Binlog_Ignore_DB
-master-bin.000001	#	<Binlog_Do_DB>	<Binlog_Ignore_DB>
-reset slave;
-SHOW SLAVE STATUS;
-change master to master_host='127.0.0.1',master_user='root',
-master_password='',master_port=MASTER_PORT, MASTER_CONNECT_RETRY=7;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	7
-Master_Log_File	
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	0
-start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	7
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-drop table if exists t1;
-create table t1 (n int, PRIMARY KEY(n));
-insert into t1 values (10),(45),(90);
-SELECT * FROM t1 ORDER BY n;
-n
-10
-45
-90
-SELECT * FROM t1 ORDER BY n;
-n
-10
-45
-90
-drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_grant.result b/mysql-test/suite/rpl/r/rpl_binlog_grant.result
index f747276b803..7a2e3183d5b 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_grant.result
@@ -17,16 +17,6 @@ show grants for x@y;
 Grants for x@y
 GRANT USAGE ON *.* TO 'x'@'y'
 GRANT SELECT ON `d1`.`t` TO 'x'@'y'
-show binlog events;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	107	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	107	Query	1	194	drop database if exists d1
-master-bin.000001	194	Query	1	273	create database d1
-master-bin.000001	273	Query	1	371	use `d1`; create table t (s1 int) engine=innodb
-master-bin.000001	371	Query	1	437	BEGIN
-master-bin.000001	437	Query	1	522	use `d1`; insert into t values (1)
-master-bin.000001	522	Xid	1	549	COMMIT /* XID */
-master-bin.000001	549	Query	1	634	use `d1`; grant select on t to x@y
 start transaction;
 insert into t values (2);
 revoke select on t from x@y;
@@ -38,19 +28,5 @@ s1
 show grants for x@y;
 Grants for x@y
 GRANT USAGE ON *.* TO 'x'@'y'
-show binlog events;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	107	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	107	Query	1	194	drop database if exists d1
-master-bin.000001	194	Query	1	273	create database d1
-master-bin.000001	273	Query	1	371	use `d1`; create table t (s1 int) engine=innodb
-master-bin.000001	371	Query	1	437	BEGIN
-master-bin.000001	437	Query	1	522	use `d1`; insert into t values (1)
-master-bin.000001	522	Xid	1	549	COMMIT /* XID */
-master-bin.000001	549	Query	1	634	use `d1`; grant select on t to x@y
-master-bin.000001	634	Query	1	700	BEGIN
-master-bin.000001	700	Query	1	785	use `d1`; insert into t values (2)
-master-bin.000001	785	Xid	1	812	COMMIT /* XID */
-master-bin.000001	812	Query	1	900	use `d1`; revoke select on t from x@y
 drop user x@y;
 drop database d1;
diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result
index 256238d35cd..a7f398f4546 100644
--- a/mysql-test/suite/rpl/r/rpl_bug33931.result
+++ b/mysql-test/suite/rpl/r/rpl_bug33931.result
@@ -3,45 +3,5 @@ reset slave;
 call mtr.add_suppression("Failed during slave I/O thread initialization");
 SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
 start slave;
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	
-Read_Master_Log_Pos	4
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	#
-Last_Error	Failed during slave thread initialization
-Skip_Counter	0
-Exec_Master_Log_Pos	0
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	#
-Last_SQL_Error	Failed during slave thread initialization
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	0
+Last_SQL_Error = Failed during slave thread initialization
 SET GLOBAL debug="";
diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result
index a51ba50475b..af09bed8dce 100644
--- a/mysql-test/suite/rpl/r/rpl_change_master.result
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result
@@ -10,90 +10,8 @@ n
 stop slave sql_thread;
 insert into t1 values(1);
 insert into t1 values(2);
-stop slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+include/stop_slave.inc
 change master to master_user='root';
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 start slave;
 select * from t1;
 n
diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
index 25c31675b53..1485389204b 100644
--- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
@@ -50,47 +50,7 @@ a
 SELECT * FROM t3;
 a
 3
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 
 *** Test lock wait timeout ***
 include/stop_slave.inc
@@ -114,54 +74,14 @@ SELECT * FROM t3;
 a
 3
 3
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 
 *** Test lock wait timeout and purged relay logs ***
 SET @my_max_relay_log_size= @@global.max_relay_log_size;
 SET global max_relay_log_size=0;
 include/stop_slave.inc
 DELETE FROM t2;
-CHANGE MASTER TO MASTER_LOG_POS=441;
+CHANGE MASTER TO MASTER_LOG_POS=MASTER_POS_BEGIN;
 BEGIN;
 SELECT * FROM t1 FOR UPDATE;
 a
@@ -183,47 +103,7 @@ a
 3
 3
 3
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 
 *** Clean up ***
 DROP TABLE t1,t2,t3;
diff --git a/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result b/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result
index 4c6323a61db..aa1a573d052 100644
--- a/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result
+++ b/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result
@@ -6,9 +6,9 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
 reset master;
 change master to master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root";
-start slave;
+include/start_slave.inc
 create table t1 (n int);
-stop slave;
+include/stop_slave.inc
 create table t2 (n int);
 show tables;
 Tables_in_test
@@ -22,20 +22,20 @@ insert into t3 values(2);
 insert into t3 values(3);
 commit;
 insert into t3 values(4);
-start slave until master_log_file="slave-bin.000001",master_log_pos=195;
+start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS;
 Warnings:
 Note	1278	It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart
 show tables;
 Tables_in_test
 t1
 t2
-start slave until master_log_file="slave-bin.000001",master_log_pos=438;
+start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS;
 Warnings:
 Note	1278	It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart
 select * from t3;
 n
 1
-start slave until master_log_file="slave-bin.000001",master_log_pos=663;
+start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS;
 Warnings:
 Note	1278	It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart
 select * from t3;
@@ -43,7 +43,7 @@ n
 1
 2
 3
-start slave;
+include/start_slave.inc
 create table t4 (n int);
 create table t5 (n int);
 create table t6 (n int);
@@ -55,6 +55,6 @@ t3
 t4
 t5
 t6
-stop slave;
+include/stop_slave.inc
 reset slave;
 drop table t1,t2,t3,t4,t5,t6;
diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
index 2a38ad05d0d..3f2256a65e0 100644
--- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result
@@ -57,7 +57,7 @@ a	b	c
 3	4	QA TESTING
 *** Start Slave ***
 START SLAVE;
-Slave failed with Error 1677
+Last_SQL_Error = Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)'
 STOP SLAVE;
 RESET SLAVE;
 SELECT * FROM t2 ORDER BY a;
@@ -86,9 +86,10 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t3  ***
 DROP TABLE t3;
 *** Create t4 on slave  ***
@@ -110,9 +111,10 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t4  ***
 DROP TABLE t4;
 *** Create t5 on slave  ***
@@ -134,9 +136,10 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t5  ***
 DROP TABLE t5;
 *** Create t6 on slave  ***
@@ -157,7 +160,7 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
+Last_SQL_Error = Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)'
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
 *** Drop t6  ***
 DROP TABLE t6;
@@ -255,9 +258,10 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t10  ***
 DROP TABLE t10;
 *** Create t11 on slave  ***
@@ -278,9 +282,10 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t11  ***
 DROP TABLE t11;
 *** Create t12 on slave  ***
@@ -490,9 +495,10 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
 ********************************************
 *** Expect slave to fail with Error 1060 ***
 ********************************************
-Slave failed with Error 1060
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1;
+include/start_slave.inc
 *** Try to insert in master ****
 INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
 SELECT * FROM t15 ORDER BY c1;
@@ -592,8 +598,9 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 ** DROP table t17 ***
 DROP TABLE t17;
diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
index d2b6ff60feb..af5d8539b7e 100644
--- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result
@@ -57,7 +57,7 @@ a	b	c
 3	4	QA TESTING
 *** Start Slave ***
 START SLAVE;
-Slave failed with Error 1677
+Last_SQL_Error = Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)'
 STOP SLAVE;
 RESET SLAVE;
 SELECT * FROM t2 ORDER BY a;
@@ -86,9 +86,10 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t3  ***
 DROP TABLE t3;
 *** Create t4 on slave  ***
@@ -110,9 +111,10 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t4  ***
 DROP TABLE t4;
 *** Create t5 on slave  ***
@@ -134,9 +136,10 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t5  ***
 DROP TABLE t5;
 *** Create t6 on slave  ***
@@ -157,7 +160,7 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
+Last_SQL_Error = Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)'
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
 *** Drop t6  ***
 DROP TABLE t6;
@@ -255,9 +258,10 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t10  ***
 DROP TABLE t10;
 *** Create t11 on slave  ***
@@ -278,9 +282,10 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t11  ***
 DROP TABLE t11;
 *** Create t12 on slave  ***
@@ -490,9 +495,10 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
 ********************************************
 *** Expect slave to fail with Error 1060 ***
 ********************************************
-Slave failed with Error 1060
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1;
+include/start_slave.inc
 *** Try to insert in master ****
 INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
 SELECT * FROM t15 ORDER BY c1;
@@ -592,8 +598,9 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 ** DROP table t17 ***
 DROP TABLE t17;
diff --git a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
index 6399e384d72..137253e68c0 100644
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
@@ -90,51 +90,7 @@ f1	f2	f3	f4
 27	27	27	next
 29	29	29	second
 30	30	30	next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-
+Checking that both slave threads are running.
 
 ***** Testing Altering table def scenario *****
 
@@ -466,52 +422,12 @@ delete from t2;
 delete from t3;
 delete from t4;
 delete from t31;
+select * from t31;
+f1	f2	f3	f4
 
 ** Check slave status **
 
-select * from t31;
-f1	f2	f3	f4
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 
 ****************************************
 * columns in master at middle of table *
@@ -544,52 +460,13 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
 (3,@b1,DEFAULT,'QA',DEFAULT);
 
 ********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1677 ***
 ********************************************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 
 *** Drop t10  ***
 DROP TABLE t10;
@@ -621,52 +498,13 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
 (3,@b1,DEFAULT,'QA',DEFAULT);
 
 ********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1677 ***
 ********************************************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 
 *** Drop t11  ***
 DROP TABLE t11;
@@ -777,47 +615,7 @@ c1	c3	hex(c4)	c5	c6
 ************
 * Bug30415 *
 ************
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1091
-Last_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1091
-Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
 STOP SLAVE;
 RESET SLAVE;
 
@@ -865,47 +663,7 @@ c1	hex(c4)	c5	c6	c7	c2
 *** Expect slave to fail with Error 1054 ***
 ********************************************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1054
-Last_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1054
-Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
 STOP SLAVE;
 RESET SLAVE;
 
@@ -953,47 +711,7 @@ c1	hex(c4)	c5	c6	c7
 *** BUG 30434 ***
 *****************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1072
-Last_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1072
-Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
 STOP SLAVE;
 RESET SLAVE;
 
diff --git a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
index f55df71d532..d55a6bcbbf2 100644
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
@@ -90,51 +90,7 @@ f1	f2	f3	f4
 27	27	27	next
 29	29	29	second
 30	30	30	next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-
+Checking that both slave threads are running.
 
 ***** Testing Altering table def scenario *****
 
@@ -466,52 +422,12 @@ delete from t2;
 delete from t3;
 delete from t4;
 delete from t31;
+select * from t31;
+f1	f2	f3	f4
 
 ** Check slave status **
 
-select * from t31;
-f1	f2	f3	f4
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 
 ****************************************
 * columns in master at middle of table *
@@ -544,52 +460,13 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
 (3,@b1,DEFAULT,'QA',DEFAULT);
 
 ********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1677 ***
 ********************************************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'double' to type 'char(5)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 
 *** Drop t10  ***
 DROP TABLE t10;
@@ -621,52 +498,13 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
 (3,@b1,DEFAULT,'QA',DEFAULT);
 
 ********************************************
-*** Expect slave to fail with Error 1523 ***
+*** Expect slave to fail with Error 1677 ***
 ********************************************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'tinyblob' to type 'varchar(254)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 
 *** Drop t11  ***
 DROP TABLE t11;
@@ -777,47 +615,7 @@ c1	c3	hex(c4)	c5	c6
 ************
 * Bug30415 *
 ************
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1091
-Last_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1091
-Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
 STOP SLAVE;
 RESET SLAVE;
 
@@ -865,47 +663,7 @@ c1	hex(c4)	c5	c6	c7	c2
 *** Expect slave to fail with Error 1054 ***
 ********************************************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1054
-Last_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1054
-Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
 STOP SLAVE;
 RESET SLAVE;
 
@@ -953,47 +711,7 @@ c1	hex(c4)	c5	c6	c7
 *** BUG 30434 ***
 *****************
 
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1072
-Last_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1072
-Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
 STOP SLAVE;
 RESET SLAVE;
 
diff --git a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
index 7eddaabc636..5f1f72a9a3a 100644
--- a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
+++ b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
@@ -49,82 +49,82 @@ UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id
 UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 [on slave]
 show tables like 't%';
diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
index 5e74a4eb999..93e74c20e28 100644
--- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
+++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
@@ -20,45 +20,9 @@ stop slave;
 change master to master_host='127.0.0.1',master_user='root',
 master_password='',master_port=SLAVE_PORT;
 include/start_slave.inc
+CREATE TABLE t1 (a INT KEY) ENGINE= MyISAM;
+INSERT INTO t1 VALUE(1);
 FLUSH LOGS;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	SLAVE_PORT
-Connect_Retry	60
-Master_Log_File	slave-bin.000001
-Read_Master_Log_Pos	POSITION
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	slave-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	POSITION
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	#
-Last_IO_Errno	#
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	2
+INSERT INTO t1 VALUE(2);
+Checking that both slave threads are running.
+Relay_Log_File	relay-log.000003
diff --git a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
index 9ce60796c5a..ba7db2d11e3 100644
--- a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
+++ b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
@@ -15,7 +15,6 @@ slave is going to hang in get_master_version_and_clock
 slave is unblocked
 SET DEBUG_SYNC='now SIGNAL signal.get_unix_timestamp';
 Check network error happened here
-NETWORK ERROR
 set @@global.debug = "-d,'debug_lock.before_get_UNIX_TIMESTAMP'";
 stop slave;
 SET @@global.debug= "+d,'debug_lock.before_get_SERVER_ID'";
@@ -24,7 +23,6 @@ slave is going to hang in get_master_version_and_clock
 slave is unblocked
 SET DEBUG_SYNC='now SIGNAL signal.get_server_id';
 Check network error happened here
-NETWORK ERROR
 set @@global.debug = "-d,'debug_lock.before_get_SERVER_ID'";
 set global debug= '';
 reset master;
@@ -32,6 +30,5 @@ include/stop_slave.inc
 change master to master_port=SLAVE_PORT;
 start slave;
 *** must be having the replicate-same-server-id IO thread error ***
-Slave_IO_Errno= 1593
-Slave_IO_Error= Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
+Last_IO_Error = Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
 SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/suite/rpl/r/rpl_grant.result b/mysql-test/suite/rpl/r/rpl_grant.result
index fc32dcefec7..285d52b7678 100644
--- a/mysql-test/suite/rpl/r/rpl_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_grant.result
@@ -41,44 +41,3 @@ user	host
 SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%';
 COUNT(*)
 0
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat.result b/mysql-test/suite/rpl/r/rpl_heartbeat.result
index 44b3964f632..05d37dc7d04 100644
--- a/mysql-test/suite/rpl/r/rpl_heartbeat.result
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat.result
@@ -52,88 +52,6 @@ Variable_name	Slave_heartbeat_period
 Value	0.500
 start slave;
 create table t1 (f1 int);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	60
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	280
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	280
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	60
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	280
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	280
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 show status like 'Slave_heartbeat_period';;
 Variable_name	Slave_heartbeat_period
 Value	0.500
diff --git a/mysql-test/suite/rpl/r/rpl_incident.result b/mysql-test/suite/rpl/r/rpl_incident.result
index a9b641b243b..6c226aaf2f7 100644
--- a/mysql-test/suite/rpl/r/rpl_incident.result
+++ b/mysql-test/suite/rpl/r/rpl_incident.result
@@ -19,53 +19,13 @@ a
 2
 3
 4
+Last_SQL_Error = The incident LOST_EVENTS occured on the master. Message: <none>
 **** On Slave ****
 SELECT * FROM t1;
 a
 1
 2
 3
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	#
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1590
-Last_Error	The incident LOST_EVENTS occured on the master. Message: <none>
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	1590
-Last_SQL_Error	The incident LOST_EVENTS occured on the master. Message: <none>
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 SELECT * FROM t1;
@@ -74,45 +34,5 @@ a
 2
 3
 4
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	#
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000002
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result
index fbb1e2355c3..549842198e8 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result
@@ -136,25 +136,24 @@ ALTER TABLE t2 DROP COLUMN d;
 
 
 ******************** SHOW BINLOG EVENTS ********************
-show binlog events from 1;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Format_desc	1	#	Server ver: #
-master-bin.000001	#	Query	1	#	DROP DATABASE IF EXISTS test_rpl
-master-bin.000001	#	Query	1	#	DROP DATABASE IF EXISTS test_rpl_1
-master-bin.000001	#	Query	1	#	CREATE DATABASE test_rpl_1 CHARACTER SET utf8 COLLATE utf8_general_ci
-master-bin.000001	#	Query	1	#	ALTER DATABASE test_rpl_1 CHARACTER SET latin1 COLLATE latin1_general_ci
-master-bin.000001	#	Query	1	#	DROP DATABASE test_rpl_1
-master-bin.000001	#	Query	1	#	CREATE DATABASE test_rpl CHARACTER SET utf8 COLLATE utf8_general_ci
-master-bin.000001	#	Query	1	#	ALTER DATABASE test_rpl CHARACTER SET latin1 COLLATE latin1_swedish_ci
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE TABLE t0 (a int auto_increment not null, c int not null, PRIMARY KEY(a), KEY index2 (c)) ENGINE=innodb
-master-bin.000001	#	Query	1	#	use `test_rpl`; ALTER TABLE t0 DROP INDEX index2
-master-bin.000001	#	Query	1	#	use `test_rpl`; ALTER TABLE t0 ADD COLUMN b char(254)
-master-bin.000001	#	Query	1	#	use `test_rpl`; ALTER TABLE t0 ADD INDEX index1 (b)
-master-bin.000001	#	Query	1	#	use `test_rpl`; ALTER TABLE t0 DROP COLUMN c
-master-bin.000001	#	Query	1	#	use `test_rpl`; RENAME TABLE t0 TO t1
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE TABLE t2 LIKE t1
-master-bin.000001	#	Query	1	#	use `test_rpl`; ALTER TABLE t2 ADD COLUMN d datetime
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE INDEX index2 on t2 (d)
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE INDEX index3 on t2 (a, d)
-master-bin.000001	#	Query	1	#	use `test_rpl`; ALTER TABLE t2 DROP COLUMN d
+master-bin.000001	#	Query	#	#	DROP DATABASE IF EXISTS test_rpl
+master-bin.000001	#	Query	#	#	DROP DATABASE IF EXISTS test_rpl_1
+master-bin.000001	#	Query	#	#	CREATE DATABASE test_rpl_1 CHARACTER SET utf8 COLLATE utf8_general_ci
+master-bin.000001	#	Query	#	#	ALTER DATABASE test_rpl_1 CHARACTER SET latin1 COLLATE latin1_general_ci
+master-bin.000001	#	Query	#	#	DROP DATABASE test_rpl_1
+master-bin.000001	#	Query	#	#	CREATE DATABASE test_rpl CHARACTER SET utf8 COLLATE utf8_general_ci
+master-bin.000001	#	Query	#	#	ALTER DATABASE test_rpl CHARACTER SET latin1 COLLATE latin1_swedish_ci
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE TABLE t0 (a int auto_increment not null, c int not null, PRIMARY KEY(a), KEY index2 (c)) ENGINE=innodb
+master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER TABLE t0 DROP INDEX index2
+master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER TABLE t0 ADD COLUMN b char(254)
+master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER TABLE t0 ADD INDEX index1 (b)
+master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER TABLE t0 DROP COLUMN c
+master-bin.000001	#	Query	#	#	use `test_rpl`; RENAME TABLE t0 TO t1
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE TABLE t2 LIKE t1
+master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER TABLE t2 ADD COLUMN d datetime
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE INDEX index2 on t2 (d)
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE INDEX index3 on t2 (a, d)
+master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER TABLE t2 DROP COLUMN d
 drop database test_rpl;
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
index 579c5489823..dd0a2d89d54 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
@@ -830,276 +830,275 @@ DELETE FROM t2;
 
 
 ******************** SHOW BINLOG EVENTS ********************
-show binlog events from 1;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Format_desc	1	#	Server ver: #
-master-bin.000001	#	Query	1	#	CREATE DATABASE test_rpl
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE TABLE t1 (a int auto_increment not null, b char(254), PRIMARY KEY(a)) ENGINE=innodb
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE TABLE t2 (a int auto_increment not null, b char(254), PRIMARY KEY(a)) ENGINE=innodb
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(2, 't1, text 2')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t2 VALUES(1, 't2, text 1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1 WHERE a = 1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test_rpl.t2)
-master-bin.000001	#	Delete_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test_rpl.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t2 SELECT * FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t2 VALUES (1, 't1, text 1') ON DUPLICATE KEY UPDATE b = 't2, text 1'
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1 WHERE a = 2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2 WHERE a = 2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Begin_load_query	1	#	;file_id=#;block_len=#
-master-bin.000001	#	Execute_load_query	1	#	use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE `t1` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, `b`) ;file_id=#
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(2, 't1, text 2')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(3, 't1, text 3')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; REPLACE INTO t1 VALUES(1, 't1, text 11')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test_rpl.t1)
-master-bin.000001	#	Update_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; REPLACE INTO t1 SET a=3, b='t1, text 33'
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1 WHERE a = 2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 'CCC')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(2, 'DDD')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t2 VALUES(1, 'DDD')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t2 VALUES(2, 'CCC')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t2 VALUES(1, 't2, text 1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	use `test_rpl`; TRUNCATE t1
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t2 VALUES(1, 't2, text 1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; UPDATE t1 SET b = 't1, text 1 updated' WHERE a = 1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; UPDATE t1, t2 SET t1.b = 'test', t2.b = 'test'
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES (1, 'start')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES (3, 'before savepoint s1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES (5, 'before savepoint s2')
-master-bin.000001	#	Query	1	#	SAVEPOINT s2
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES (6, 'after savepoint s2')
-master-bin.000001	#	Table_map	1	#	table_id: # (test_rpl.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1 WHERE a = 7
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE USER 'user_test_rpl'@'localhost' IDENTIFIED BY PASSWORD '*1111111111111111111111111111111111111111'
-master-bin.000001	#	Query	1	#	use `test_rpl`; GRANT SELECT ON *.* TO 'user_test_rpl'@'localhost'
-master-bin.000001	#	Query	1	#	use `test_rpl`; REVOKE SELECT ON *.* FROM 'user_test_rpl'@'localhost'
-master-bin.000001	#	Query	1	#	use `test_rpl`; SET PASSWORD FOR 'user_test_rpl'@'localhost'='*0000000000000000000000000000000000000000'
-master-bin.000001	#	Query	1	#	use `test_rpl`; RENAME USER 'user_test_rpl'@'localhost' TO 'user_test_rpl_2'@'localhost'
-master-bin.000001	#	Query	1	#	use `test_rpl`; DROP USER 'user_test_rpl_2'@'localhost'
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(100, 'test')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	use `test_rpl`; ANALYZE TABLE t1
-master-bin.000001	#	Query	1	#	use `test_rpl`; OPTIMIZE TABLE t1
-master-bin.000001	#	Query	1	#	use `test_rpl`; REPAIR TABLE t1
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+master-bin.000001	#	Query	#	#	CREATE DATABASE test_rpl
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE TABLE t1 (a int auto_increment not null, b char(254), PRIMARY KEY(a)) ENGINE=innodb
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE TABLE t2 (a int auto_increment not null, b char(254), PRIMARY KEY(a)) ENGINE=innodb
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(2, 't1, text 2')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t2 VALUES(1, 't2, text 1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1 WHERE a = 1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test_rpl.t2)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test_rpl.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t2 VALUES (1, 't1, text 1') ON DUPLICATE KEY UPDATE b = 't2, text 1'
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1 WHERE a = 2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2 WHERE a = 2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
+master-bin.000001	#	Execute_load_query	#	#	use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE `t1` FIELDS TERMINATED BY '|' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, `b`) ;file_id=#
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(2, 't1, text 2')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(3, 't1, text 3')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; REPLACE INTO t1 VALUES(1, 't1, text 11')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test_rpl.t1)
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; REPLACE INTO t1 SET a=3, b='t1, text 33'
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1 WHERE a = 2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 'CCC')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(2, 'DDD')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t2 VALUES(1, 'DDD')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t2 VALUES(2, 'CCC')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t2 VALUES(1, 't2, text 1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test_rpl`; TRUNCATE t1
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t2 VALUES(1, 't2, text 1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; UPDATE t1 SET b = 't1, text 1 updated' WHERE a = 1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; UPDATE t1, t2 SET t1.b = 'test', t2.b = 'test'
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES (1, 'start')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES (3, 'before savepoint s1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES (5, 'before savepoint s2')
+master-bin.000001	#	Query	#	#	SAVEPOINT s2
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES (6, 'after savepoint s2')
+master-bin.000001	#	Table_map	#	#	table_id: # (test_rpl.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1 WHERE a = 7
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE USER 'user_test_rpl'@'localhost' IDENTIFIED BY PASSWORD '*1111111111111111111111111111111111111111'
+master-bin.000001	#	Query	#	#	use `test_rpl`; GRANT SELECT ON *.* TO 'user_test_rpl'@'localhost'
+master-bin.000001	#	Query	#	#	use `test_rpl`; REVOKE SELECT ON *.* FROM 'user_test_rpl'@'localhost'
+master-bin.000001	#	Query	#	#	use `test_rpl`; SET PASSWORD FOR 'user_test_rpl'@'localhost'='*0000000000000000000000000000000000000000'
+master-bin.000001	#	Query	#	#	use `test_rpl`; RENAME USER 'user_test_rpl'@'localhost' TO 'user_test_rpl_2'@'localhost'
+master-bin.000001	#	Query	#	#	use `test_rpl`; DROP USER 'user_test_rpl_2'@'localhost'
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(100, 'test')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test_rpl`; ANALYZE TABLE t1
+master-bin.000001	#	Query	#	#	use `test_rpl`; OPTIMIZE TABLE t1
+master-bin.000001	#	Query	#	#	use `test_rpl`; REPAIR TABLE t1
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
 BEGIN
 UPDATE t1 SET b = 'test' WHERE a = 201;
 END
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
 BEGIN
 UPDATE t1 SET b = UUID() WHERE a = 202;
 END
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT  INTO t1 VALUES(201, 'test 201')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; UPDATE t1 SET b = 'test' WHERE a = 201
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT  INTO t1 VALUES(202, 'test 202')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test_rpl.t1)
-master-bin.000001	#	Update_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1 WHERE a = 202
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	use `test_rpl`; ALTER PROCEDURE p1 COMMENT 'p1'
-master-bin.000001	#	Query	1	#	use `test_rpl`; DROP PROCEDURE p1
-master-bin.000001	#	Query	1	#	use `test_rpl`; DROP PROCEDURE p2
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT  INTO t1 VALUES(201, 'test 201')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; UPDATE t1 SET b = 'test' WHERE a = 201
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT  INTO t1 VALUES(202, 'test 202')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test_rpl.t1)
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1 WHERE a = 202
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER PROCEDURE p1 COMMENT 'p1'
+master-bin.000001	#	Query	#	#	use `test_rpl`; DROP PROCEDURE p1
+master-bin.000001	#	Query	#	#	use `test_rpl`; DROP PROCEDURE p2
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1
 FOR EACH ROW BEGIN
 INSERT INTO t2 SET a = NEW.a, b = NEW.b;
 END
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test_rpl.t1)
-master-bin.000001	#	Table_map	1	#	table_id: # (test_rpl.t2)
-master-bin.000001	#	Write_rows	1	#	table_id: #
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	use `test_rpl`; DROP TRIGGER tr1
-master-bin.000001	#	Query	1	#	use `test_rpl`; GRANT EVENT ON *.* TO 'root'@'localhost'
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 'test1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE DEFINER=`root`@`localhost` EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1
-master-bin.000001	#	Query	1	#	use `test_rpl`; ALTER EVENT e1 RENAME TO e2
-master-bin.000001	#	Query	1	#	use `test_rpl`; DROP EVENT e2
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 'test1')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; INSERT INTO t1 VALUES(2, 'test2')
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT * FROM t1 WHERE a = 1
-master-bin.000001	#	Query	1	#	use `test_rpl`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS SELECT * FROM t1 WHERE b <> UUID()
-master-bin.000001	#	Query	1	#	use `test_rpl`; ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT * FROM t1 WHERE a = 2
-master-bin.000001	#	Query	1	#	use `test_rpl`; DROP VIEW v1
-master-bin.000001	#	Query	1	#	use `test_rpl`; DROP VIEW v2
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t1
-master-bin.000001	#	Xid	1	#	#
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test_rpl`; DELETE FROM t2
-master-bin.000001	#	Xid	1	#	#
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test_rpl.t1)
+master-bin.000001	#	Table_map	#	#	table_id: # (test_rpl.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test_rpl`; DROP TRIGGER tr1
+master-bin.000001	#	Query	#	#	use `test_rpl`; GRANT EVENT ON *.* TO 'root'@'localhost'
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 'test1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE DEFINER=`root`@`localhost` EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1
+master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER EVENT e1 RENAME TO e2
+master-bin.000001	#	Query	#	#	use `test_rpl`; DROP EVENT e2
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 'test1')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(2, 'test2')
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT * FROM t1 WHERE a = 1
+master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS SELECT * FROM t1 WHERE b <> UUID()
+master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT * FROM t1 WHERE a = 2
+master-bin.000001	#	Query	#	#	use `test_rpl`; DROP VIEW v1
+master-bin.000001	#	Query	#	#	use `test_rpl`; DROP VIEW v2
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t1
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test_rpl`; DELETE FROM t2
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 drop database test_rpl;
diff --git a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
index cc7cfa144ee..daefee9c669 100644
--- a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
+++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
@@ -11,47 +11,7 @@ SELECT * FROM t1;
 a	b
 1	10
 2	2
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1105
-Last_Error	Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10'
-Skip_Counter	0
-Exec_Master_Log_Pos	247
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	1105
-Last_SQL_Error	Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10'
 SELECT * FROM t1;
 a	b
 stop slave;
@@ -96,55 +56,11 @@ id	field_1	field_2	field_3
 4	4	d	4d
 5	5	e	5e
 6	6	f	6f
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1105
-Last_Error	Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1 (field_1, field_2, field_3)
+Last_SQL_Error = Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1 (field_1, field_2, field_3)
 SELECT t2.field_a, t2.field_b, t2.field_c
 FROM t2
 ON DUPLICATE KEY UPDATE
 t1.field_3 = t2.field_c'
-Skip_Counter	0
-Exec_Master_Log_Pos	1964
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	0
-Last_IO_Error	
-Last_SQL_Errno	1105
-Last_SQL_Error	Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1 (field_1, field_2, field_3)
-SELECT t2.field_a, t2.field_b, t2.field_c
-FROM t2
-ON DUPLICATE KEY UPDATE
-t1.field_3 = t2.field_c'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 SELECT * FROM t1;
 id	field_1	field_2	field_3
 drop table t1, t2;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
index 814b83e39f8..9acc1ad93ac 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
@@ -6,89 +6,9 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
 CREATE TABLE t1 (a INT, b INT);
 INSERT INTO t1 VALUES (1,10);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1593
-Last_Error	Fatal error: Not enough memory
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1593
-Last_SQL_Error	Fatal error: Not enough memory
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Fatal error: Not enough memory
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+include/start_slave.inc
 DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result
index 4da8b4c3a3c..9cbe22bfa56 100644
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result
@@ -9,91 +9,11 @@ show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
 master-bin.000001	#	<Binlog_Do_DB>	<Binlog_Ignore_DB>
 include/stop_slave.inc
-change master to master_log_pos=75;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+change master to master_log_pos=MASTER_LOG_POS;
+Read_Master_Log_Pos	75
 start slave;
+Last_IO_Error = Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event'
 include/stop_slave.inc
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
 master-bin.000001	#	<Binlog_Do_DB>	<Binlog_Ignore_DB>
@@ -101,7 +21,7 @@ create table if not exists t1 (n int);
 drop table if exists t1;
 create table t1 (n int);
 insert into t1 values (1),(2),(3);
-change master to master_log_pos=4;
+change master to master_log_pos=MASTER_LOG_POS;
 start slave;
 select * from t1 ORDER BY n;
 n
diff --git a/mysql-test/suite/rpl/r/rpl_mix_insert_delayed.result b/mysql-test/suite/rpl/r/rpl_mix_insert_delayed.result
index cda73c91c4e..b336fc12d42 100644
--- a/mysql-test/suite/rpl/r/rpl_mix_insert_delayed.result
+++ b/mysql-test/suite/rpl/r/rpl_mix_insert_delayed.result
@@ -45,24 +45,14 @@ id	name
 USE test;
 DROP SCHEMA mysqlslap;
 use test;
-FLUSH LOGS;
-FLUSH LOGS;
 CREATE TABLE t1(a int, UNIQUE(a));
 INSERT DELAYED IGNORE INTO t1 VALUES(1);
 INSERT DELAYED IGNORE INTO t1 VALUES(1);
 flush table t1;
-show binlog events in 'master-bin.000002' LIMIT 2,2;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-x	x	x	x	x	BEGIN
-x	x	x	x	x	table_id: # (test.t1)
 select * from t1;
 a
 1
 On slave
-show binlog events in 'slave-bin.000002' LIMIT 2,2;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-x	x	x	x	x	BEGIN
-x	x	x	x	x	table_id: # (test.t1)
 select * from t1;
 a
 1
diff --git a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
index 76db52c05b1..7f43869c3b7 100644
--- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
+++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
@@ -8,68 +8,25 @@ start slave;
 CREATE TABLE t1 (a INT, b LONG);
 INSERT INTO t1 VALUES (1,1), (2,2);
 INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	#	Query	1	#	use `test`; CREATE TABLE t1 (a INT, b LONG)
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Query	1	#	use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
-master-bin.000001	#	Query	1	#	COMMIT
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	1	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT, b LONG)
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+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
 **** On Slave ****
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	#
-Last_IO_Errno	#
-Last_IO_Error	
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
-slave-bin.000001	#	Query	1	#	use `test`; CREATE TABLE t1 (a INT, b LONG)
-slave-bin.000001	#	Query	1	#	BEGIN
-slave-bin.000001	#	Query	1	#	use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
-slave-bin.000001	#	Query	1	#	COMMIT
-slave-bin.000001	#	Query	1	#	BEGIN
-slave-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000001	#	Query	1	#	COMMIT
+slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT, b LONG)
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
+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
 DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/rpl/r/rpl_replicate_do.result b/mysql-test/suite/rpl/r/rpl_replicate_do.result
index 2fbd283a9c8..637047a883b 100644
--- a/mysql-test/suite/rpl/r/rpl_replicate_do.result
+++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result
@@ -26,47 +26,7 @@ n
 select * from t11;
 ERROR 42S02: Table 'test.t11' doesn't exist
 drop table if exists t1,t2,t11;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
 Replicate_Do_Table	test.t1
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 create table t1 (ts timestamp);
 set one_shot time_zone='met';
 insert into t1 values('2005-08-12 00:00:00');
diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result
index ba269344492..70e1d2f06e8 100644
--- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result
+++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result
@@ -14,47 +14,9 @@ create temporary table temp_table (a char(80) not null);
 insert into temp_table values ("testing temporary tables");
 create table t1 (s text);
 insert into t1 values('Could not break slave'),('Tried hard');
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	60
 Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 select * from t1;
 s
 Could not break slave
@@ -95,47 +57,9 @@ show binary logs;
 Log_name	File_size
 master-bin.000003	#
 insert into t2 values (65);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	60
 Master_Log_File	master-bin.000003
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000003
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 select * from t2;
 m
 34
@@ -164,47 +88,9 @@ master-bin.000008	#	<Binlog_Do_DB>	<Binlog_Ignore_DB>
 select * from t4;
 a
 testing temporary tables part 2
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	60
 Master_Log_File	master-bin.000008
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
 Relay_Master_Log_File	master-bin.000008
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 lock tables t3 read;
 select count(*) from t3 where n >= 4;
 count(*)
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
index 13ee20cb3a0..1051d907b26 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
@@ -58,14 +58,13 @@ DELETE FROM t1;
 INSERT INTO t1 VALUES (1),(2);
 DELETE FROM t1 WHERE a = 0;
 UPDATE t1 SET a=99 WHERE a = 0;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	107	Server ver: SERVER_VERSION, Binlog ver: 4
-master-bin.000001	107	Query	1	193	use `test`; CREATE TABLE t1 (a INT)
-master-bin.000001	193	Query	1	261	BEGIN
-master-bin.000001	261	Table_map	1	302	table_id: # (test.t1)
-master-bin.000001	302	Write_rows	1	341	table_id: # flags: STMT_END_F
-master-bin.000001	341	Query	1	410	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
 DROP TABLE t1;
 ================ Test for BUG#17620 ================
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
index 9c8f87af5af..350ce0ac2c9 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
@@ -436,8 +436,7 @@ DELETE FROM t1;
 SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
 COUNT(*)	0
 set @@global.slave_exec_mode= default;
-Last_SQL_Error
-
+Checking that both slave threads are running.
 SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
 COUNT(*)	0
 **** Test for BUG#37076 ****
@@ -498,8 +497,7 @@ Comparing tables master:test.t4 and slave:test.t4
 [expecting slave to stop]
 INSERT INTO t5 VALUES (1, "", 1);
 INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
-Last_SQL_Error
-Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)'
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)'
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;
@@ -507,8 +505,7 @@ START SLAVE;
 [expecting slave to stop]
 INSERT INTO t6 VALUES (1, "", 1);
 INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
-Last_SQL_Error
-Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)'
+Last_SQL_Error = Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)'
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
index 4cf4c9fb27d..59441ac5684 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
@@ -439,8 +439,7 @@ DELETE FROM t1;
 SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
 COUNT(*)	0
 set @@global.slave_exec_mode= default;
-Last_SQL_Error
-
+Checking that both slave threads are running.
 SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
 COUNT(*)	0
 **** Test for BUG#37076 ****
@@ -501,8 +500,7 @@ Comparing tables master:test.t4 and slave:test.t4
 [expecting slave to stop]
 INSERT INTO t5 VALUES (1, "", 1);
 INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
-Last_SQL_Error
-Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)'
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)'
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;
@@ -510,8 +508,7 @@ START SLAVE;
 [expecting slave to stop]
 INSERT INTO t6 VALUES (1, "", 1);
 INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
-Last_SQL_Error
-Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)'
+Last_SQL_Error = Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)'
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;
diff --git a/mysql-test/suite/rpl/r/rpl_row_colSize.result b/mysql-test/suite/rpl/r/rpl_row_colSize.result
index 1f2b5800228..0ef47b8752d 100644
--- a/mysql-test/suite/rpl/r/rpl_row_colSize.result
+++ b/mysql-test/suite/rpl/r/rpl_row_colSize.result
@@ -18,47 +18,7 @@ CREATE TABLE t1 (a DECIMAL(20, 10));
 RESET MASTER;
 INSERT INTO t1 VALUES (901251.90125);
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -74,47 +34,7 @@ CREATE TABLE t1 (a DECIMAL(27, 18));
 RESET MASTER;
 INSERT INTO t1 VALUES (901251.90125);
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'decimal(27,18)' to type 'decimal(27,9)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'decimal(27,18)' to type 'decimal(27,9)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'decimal(27,18)' to type 'decimal(27,9)'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -130,47 +50,7 @@ CREATE TABLE t1 (a NUMERIC(20, 10));
 RESET MASTER;
 INSERT INTO t1 VALUES (901251.90125);
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'decimal(20,10)' to type 'decimal(5,2)'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -187,47 +67,7 @@ CREATE TABLE t1 (a FLOAT(47));
 RESET MASTER;
 INSERT INTO t1 VALUES (901251.90125);
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'double' to type 'float'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'double' to type 'float'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'double' to type 'float'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -244,47 +84,7 @@ CREATE TABLE t1 (a BIT(64));
 RESET MASTER;
 INSERT INTO t1 VALUES (B'10101');
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'bit(64)' to type 'bit(5)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'bit(64)' to type 'bit(5)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'bit(64)' to type 'bit(5)'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -300,47 +100,7 @@ CREATE TABLE t1 (a BIT(12));
 RESET MASTER;
 INSERT INTO t1 VALUES (B'10101');
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'bit(12)' to type 'bit(11)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'bit(12)' to type 'bit(11)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'bit(12)' to type 'bit(11)'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -357,47 +117,7 @@ CREATE TABLE t1 (a SET('1','2','3','4','5','6','7','8','9'));
 RESET MASTER;
 INSERT INTO t1 VALUES ('4');
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'set' to type 'set('4')'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'set' to type 'set('4')'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'set' to type 'set('4')'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -414,47 +134,7 @@ CREATE TABLE t1 (a CHAR(20));
 RESET MASTER;
 INSERT INTO t1 VALUES ('This is a test.');
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'char(20)' to type 'char(10)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'char(20)' to type 'char(10)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'char(20)' to type 'char(10)'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -502,47 +182,7 @@ CREATE TABLE t1 (a ENUM(
 RESET MASTER;
 INSERT INTO t1 VALUES ('44');
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'enum' to type 'enum('44','54')'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'enum' to type 'enum('44','54')'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'enum' to type 'enum('44','54')'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -559,47 +199,7 @@ CREATE TABLE t1 (a VARCHAR(2000));
 RESET MASTER;
 INSERT INTO t1 VALUES ('This is a test.');
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(100)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(100)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(100)'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -615,47 +215,7 @@ CREATE TABLE t1 (a VARCHAR(200));
 RESET MASTER;
 INSERT INTO t1 VALUES ('This is a test.');
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'varchar(200)' to type 'varchar(10)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'varchar(200)' to type 'varchar(10)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'varchar(200)' to type 'varchar(10)'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -671,47 +231,7 @@ CREATE TABLE t1 (a VARCHAR(2000));
 RESET MASTER;
 INSERT INTO t1 VALUES ('This is a test.');
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(1000)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(1000)'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'varchar(2000)' to type 'varchar(1000)'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
@@ -728,47 +248,7 @@ CREATE TABLE t1 (a LONGBLOB);
 RESET MASTER;
 INSERT INTO t1 VALUES ('This is a test.');
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	Column 0 of table 'test.t1' cannot be converted from type 'tinyblob' to type 'tinyblob'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1677
-Last_SQL_Error	Column 0 of table 'test.t1' cannot be converted from type 'tinyblob' to type 'tinyblob'
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Last_SQL_Error = Column 0 of table 'test.t1' cannot be converted from type 'tinyblob' to type 'tinyblob'
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 0
diff --git a/mysql-test/suite/rpl/r/rpl_row_create_table.result b/mysql-test/suite/rpl/r/rpl_row_create_table.result
index 63bbf93262c..393e2fdb851 100644
--- a/mysql-test/suite/rpl/r/rpl_row_create_table.result
+++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result
@@ -13,31 +13,12 @@ CREATE TABLE t1 (a INT, b INT);
 CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
 CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
 CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
-SHOW BINLOG EVENTS FROM 107;
-Log_name	#
-Pos	107
-Event_type	Query
-Server_id	#
-End_log_pos	200
-Info	use `test`; CREATE TABLE t1 (a INT, b INT)
-Log_name	#
-Pos	200
-Event_type	Query
-Server_id	#
-End_log_pos	306
-Info	use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge
-Log_name	#
-Pos	306
-Event_type	Query
-Server_id	#
-End_log_pos	412
-Info	use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8
-Log_name	#
-Pos	412
-Event_type	Query
-Server_id	#
-End_log_pos	531
-Info	use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8
+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, b INT)
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8
 **** On Master ****
 SHOW CREATE TABLE t1;
 Table	t1
@@ -137,7 +118,7 @@ RESET MASTER;
 include/start_slave.inc
 CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
 ERROR 23000: Duplicate entry '2' for key 'b'
-SHOW BINLOG EVENTS FROM 107;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 CREATE TABLE t7 (a INT, b INT UNIQUE);
 INSERT INTO t7 SELECT a,b FROM tt3;
@@ -147,13 +128,13 @@ a	b
 1	2
 2	4
 3	6
-SHOW BINLOG EVENTS FROM 107;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-#	107	Query	#	207	use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
-#	207	Query	#	275	BEGIN
-#	275	Table_map	#	317	table_id: # (test.t7)
-#	317	Write_rows	#	373	table_id: # flags: STMT_END_F
-#	373	Query	#	442	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
 SELECT * FROM t7 ORDER BY a,b;
 a	b
 1	2
@@ -171,12 +152,12 @@ INSERT INTO t7 SELECT a,b FROM tt4;
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
-SHOW BINLOG EVENTS FROM 107;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-#	107	Query	#	175	BEGIN
-#	175	Table_map	#	217	table_id: # (test.t7)
-#	217	Write_rows	#	273	table_id: # flags: STMT_END_F
-#	273	Query	#	342	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t7)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
 SELECT * FROM t7 ORDER BY a,b;
 a	b
 1	2
@@ -216,10 +197,10 @@ Create Table	CREATE TABLE `t9` (
   `a` int(11) DEFAULT NULL,
   `b` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
-SHOW BINLOG EVENTS FROM 107;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-#	107	Query	#	193	use `test`; CREATE TABLE t8 LIKE t4
-#	193	Query	#	332	use `test`; CREATE TABLE `t9` (
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t8 LIKE t4
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE `t9` (
   `a` int(11) DEFAULT NULL,
   `b` int(11) DEFAULT NULL
 )
@@ -289,38 +270,38 @@ a
 1
 2
 3
-SHOW BINLOG EVENTS FROM 107;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-#	107	Query	#	193	use `test`; CREATE TABLE t1 (a INT)
-#	193	Query	#	261	BEGIN
-#	261	Table_map	#	302	table_id: # (test.t1)
-#	302	Write_rows	#	346	table_id: # flags: STMT_END_F
-#	346	Query	#	415	COMMIT
-#	415	Query	#	483	BEGIN
-#	483	Query	#	608	use `test`; CREATE TABLE `t2` (
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE `t2` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=InnoDB
-#	608	Table_map	#	649	table_id: # (test.t2)
-#	649	Write_rows	#	693	table_id: # flags: STMT_END_F
-#	693	Xid	#	720	COMMIT /* XID */
-#	720	Query	#	788	BEGIN
-#	788	Query	#	913	use `test`; CREATE TABLE `t3` (
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE `t3` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=InnoDB
-#	913	Table_map	#	954	table_id: # (test.t3)
-#	954	Write_rows	#	998	table_id: # flags: STMT_END_F
-#	998	Xid	#	1025	COMMIT /* XID */
-#	1025	Query	#	1093	BEGIN
-#	1093	Query	#	1218	use `test`; CREATE TABLE `t4` (
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t3)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE `t4` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=InnoDB
-#	1218	Table_map	#	1259	table_id: # (test.t4)
-#	1259	Write_rows	#	1303	table_id: # flags: STMT_END_F
-#	1303	Xid	#	1330	COMMIT /* XID */
-#	1330	Query	#	1398	BEGIN
-#	1398	Table_map	#	1439	table_id: # (test.t1)
-#	1439	Write_rows	#	1483	table_id: # flags: STMT_END_F
-#	1483	Query	#	1552	COMMIT
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t4)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+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
 SHOW TABLES;
 Tables_in_test
 t1
@@ -374,20 +355,20 @@ a
 4
 6
 9
-SHOW BINLOG EVENTS FROM 107;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-#	107	Query	#	193	use `test`; CREATE TABLE t1 (a INT)
-#	193	Query	#	261	BEGIN
-#	261	Table_map	#	302	table_id: # (test.t1)
-#	302	Write_rows	#	346	table_id: # flags: STMT_END_F
-#	346	Query	#	415	COMMIT
-#	415	Query	#	515	use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
-#	515	Query	#	583	BEGIN
-#	583	Table_map	#	624	table_id: # (test.t2)
-#	624	Write_rows	#	668	table_id: # flags: STMT_END_F
-#	668	Table_map	#	709	table_id: # (test.t2)
-#	709	Write_rows	#	748	table_id: # flags: STMT_END_F
-#	748	Xid	#	775	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 SELECT * FROM t2 ORDER BY a;
 a
 1
@@ -413,7 +394,7 @@ Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 SELECT * FROM t2 ORDER BY a;
 a
-SHOW BINLOG EVENTS FROM 107;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 SELECT * FROM t2 ORDER BY a;
 a
diff --git a/mysql-test/suite/rpl/r/rpl_row_drop.result b/mysql-test/suite/rpl/r/rpl_row_drop.result
index 84fa9b9e990..1ab262d087e 100644
--- a/mysql-test/suite/rpl/r/rpl_row_drop.result
+++ b/mysql-test/suite/rpl/r/rpl_row_drop.result
@@ -41,14 +41,13 @@ t1
 t2
 **** On Master ****
 DROP TABLE t1,t2;
-SHOW BINLOG EVENTS;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	4	Format_desc	1	107	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	107	Query	1	193	use `test`; CREATE TABLE t1 (a int)
-master-bin.000001	193	Query	1	279	use `test`; CREATE TABLE t2 (a int)
-master-bin.000001	279	Query	1	403	use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
-master-bin.000001	403	Query	1	507	use `test`; DROP TABLE `t1` /* generated by server */
-master-bin.000001	507	Query	1	631	use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a int)
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 (a int)
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
 SHOW TABLES;
 Tables_in_test
 t2
diff --git a/mysql-test/suite/rpl/r/rpl_row_disabled_slave_key.result b/mysql-test/suite/rpl/r/rpl_row_find_row.result
similarity index 62%
rename from mysql-test/suite/rpl/r/rpl_row_disabled_slave_key.result
rename to mysql-test/suite/rpl/r/rpl_row_find_row.result
index 01e3dfd6508..69516b47b7d 100644
--- a/mysql-test/suite/rpl/r/rpl_row_disabled_slave_key.result
+++ b/mysql-test/suite/rpl/r/rpl_row_find_row.result
@@ -24,3 +24,15 @@ INSERT INTO t VALUES (1,2,4);
 INSERT INTO t VALUES (4,3,4);
 DELETE FROM t;
 DROP TABLE t;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (c1 INT NOT NULL, c2 INT NOT NULL, c3 INT, UNIQUE KEY(c1,c3), KEY(c2));
+INSERT INTO t1(c1,c2) VALUES(1,1);
+INSERT INTO t1(c1,c2) VALUES(1,2);
+UPDATE t1 SET c1=1000 WHERE c2=2;
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
index e999f9c28f0..61fee130d49 100644
--- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
+++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
@@ -18,10 +18,6 @@ master-bin.000001	#	Query	#	#	use `test`; rename table t1 to t5, t2 to t1
 select * from t3;
 a
 flush tables;
-show binlog events from <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; rename table t1 to t5, t2 to t1
-master-bin.000001	#	Query	#	#	use `test`; flush tables
 select * from t3;
 a
 stop slave;
diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result
index 488ebb92a02..d94c0cdad10 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result
@@ -16,33 +16,32 @@ load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
 select count(*) from t1;
 count(*)
 69
-show binlog events;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	1	#	COMMIT
-master-bin.000001	#	Query	1	#	use `test`; drop table t1
-master-bin.000001	#	Query	1	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	1	#	COMMIT
-show binlog events from 107 limit 1;
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+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	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+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
+show binlog events from <binlog_start> limit 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-show binlog events from 107 limit 2;
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+show binlog events from <binlog_start> limit 2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-master-bin.000001	#	Query	1	#	BEGIN
-show binlog events from 107 limit 1,4;
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001	#	Query	#	#	BEGIN
+show binlog events from <binlog_start> limit 1,4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	1	#	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
 flush logs;
 create table t3 (a int)ENGINE=MyISAM;
 select * from t1 order by 1 asc;
@@ -206,15 +205,14 @@ 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
-show binlog events in 'master-bin.000002';
+show binlog events in 'master-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000002	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
-master-bin.000002	#	Query	1	#	use `test`; create table t3 (a int)ENGINE=MyISAM
-master-bin.000002	#	Query	1	#	use `test`; create table t2 (n int)ENGINE=MyISAM
-master-bin.000002	#	Query	1	#	BEGIN
-master-bin.000002	#	Table_map	1	#	table_id: # (test.t2)
-master-bin.000002	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000002	#	Query	1	#	COMMIT
+master-bin.000002	#	Query	#	#	use `test`; create table t3 (a int)ENGINE=MyISAM
+master-bin.000002	#	Query	#	#	use `test`; create table t2 (n int)ENGINE=MyISAM
+master-bin.000002	#	Query	#	#	BEGIN
+master-bin.000002	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000002	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000002	#	Query	#	#	COMMIT
 show binary logs;
 Log_name	File_size
 master-bin.000001	#
@@ -223,71 +221,29 @@ show binary logs;
 Log_name	File_size
 slave-bin.000001	#
 slave-bin.000002	#
-show binlog events in 'slave-bin.000001' from 4;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
-slave-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-slave-bin.000001	#	Query	1	#	BEGIN
-slave-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000001	#	Query	1	#	COMMIT
-slave-bin.000001	#	Query	1	#	use `test`; drop table t1
-slave-bin.000001	#	Query	1	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
-slave-bin.000001	#	Query	1	#	BEGIN
-slave-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000001	#	Query	1	#	COMMIT
-slave-bin.000001	#	Query	1	#	use `test`; create table t3 (a int)ENGINE=MyISAM
-slave-bin.000001	#	Rotate	2	#	slave-bin.000002;pos=4
-show binlog events in 'slave-bin.000002' from 4;
+slave-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+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	#	#	use `test`; drop table t1
+slave-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+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	#	#	use `test`; create table t3 (a int)ENGINE=MyISAM
+slave-bin.000001	#	Rotate	#	#	slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000002	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
-slave-bin.000002	#	Query	1	#	use `test`; create table t2 (n int)ENGINE=MyISAM
-slave-bin.000002	#	Query	1	#	BEGIN
-slave-bin.000002	#	Table_map	1	#	table_id: # (test.t2)
-slave-bin.000002	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000002	#	Query	1	#	COMMIT
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000002
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000002
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+slave-bin.000002	#	Query	#	#	use `test`; create table t2 (n int)ENGINE=MyISAM
+slave-bin.000002	#	Query	#	#	BEGIN
+slave-bin.000002	#	Table_map	#	#	table_id: # (test.t2)
+slave-bin.000002	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000002	#	Query	#	#	COMMIT
+Checking that both slave threads are running.
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
index 7a1615c0c7f..b594851be9b 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
@@ -16,33 +16,32 @@ load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
 select count(*) from t1;
 count(*)
 69
-show binlog events;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Xid	1	#	COMMIT /* XID */
-master-bin.000001	#	Query	1	#	use `test`; drop table t1
-master-bin.000001	#	Query	1	#	use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Xid	1	#	COMMIT /* XID */
-show binlog events from 107 limit 1;
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+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	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
+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	#	Xid	#	#	COMMIT /* XID */
+show binlog events from <binlog_start> limit 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
-show binlog events from 107 limit 2;
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+show binlog events from <binlog_start> limit 2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
-master-bin.000001	#	Query	1	#	BEGIN
-show binlog events from 107 limit 1,4;
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+master-bin.000001	#	Query	#	#	BEGIN
+show binlog events from <binlog_start> limit 1,4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Xid	1	#	COMMIT /* XID */
+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	#	Xid	#	#	COMMIT /* XID */
 flush logs;
 create table t3 (a int)ENGINE=InnoDB;
 select * from t1 order by 1 asc;
@@ -206,15 +205,14 @@ master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
-show binlog events in 'master-bin.000002';
+show binlog events in 'master-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000002	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
-master-bin.000002	#	Query	1	#	use `test`; create table t3 (a int)ENGINE=InnoDB
-master-bin.000002	#	Query	1	#	use `test`; create table t2 (n int)ENGINE=InnoDB
-master-bin.000002	#	Query	1	#	BEGIN
-master-bin.000002	#	Table_map	1	#	table_id: # (test.t2)
-master-bin.000002	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000002	#	Xid	1	#	COMMIT /* XID */
+master-bin.000002	#	Query	#	#	use `test`; create table t3 (a int)ENGINE=InnoDB
+master-bin.000002	#	Query	#	#	use `test`; create table t2 (n int)ENGINE=InnoDB
+master-bin.000002	#	Query	#	#	BEGIN
+master-bin.000002	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000002	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000002	#	Xid	#	#	COMMIT /* XID */
 show binary logs;
 Log_name	File_size
 master-bin.000001	#
@@ -223,71 +221,29 @@ show binary logs;
 Log_name	File_size
 slave-bin.000001	#
 slave-bin.000002	#
-show binlog events in 'slave-bin.000001' from 4;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
-slave-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
-slave-bin.000001	#	Query	1	#	BEGIN
-slave-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000001	#	Xid	1	#	COMMIT /* XID */
-slave-bin.000001	#	Query	1	#	use `test`; drop table t1
-slave-bin.000001	#	Query	1	#	use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
-slave-bin.000001	#	Query	1	#	BEGIN
-slave-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000001	#	Xid	1	#	COMMIT /* XID */
-slave-bin.000001	#	Query	1	#	use `test`; create table t3 (a int)ENGINE=InnoDB
-slave-bin.000001	#	Rotate	2	#	slave-bin.000002;pos=4
-show binlog events in 'slave-bin.000002' from 4;
+slave-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
+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	#	Xid	#	#	COMMIT /* XID */
+slave-bin.000001	#	Query	#	#	use `test`; drop table t1
+slave-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
+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	#	Xid	#	#	COMMIT /* XID */
+slave-bin.000001	#	Query	#	#	use `test`; create table t3 (a int)ENGINE=InnoDB
+slave-bin.000001	#	Rotate	#	#	slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000002	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
-slave-bin.000002	#	Query	1	#	use `test`; create table t2 (n int)ENGINE=InnoDB
-slave-bin.000002	#	Query	1	#	BEGIN
-slave-bin.000002	#	Table_map	1	#	table_id: # (test.t2)
-slave-bin.000002	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000002	#	Xid	1	#	COMMIT /* XID */
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000002
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000002
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+slave-bin.000002	#	Query	#	#	use `test`; create table t2 (n int)ENGINE=InnoDB
+slave-bin.000002	#	Query	#	#	BEGIN
+slave-bin.000002	#	Table_map	#	#	table_id: # (test.t2)
+slave-bin.000002	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000002	#	Xid	#	#	COMMIT /* XID */
+Checking that both slave threads are running.
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
index a21bec6ae55..547dd8e1541 100644
--- a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
+++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
@@ -23,47 +23,7 @@ select @@global.max_relay_log_size;
 @@global.max_relay_log_size
 4096
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 2
 #
@@ -73,47 +33,7 @@ set global max_relay_log_size=(5*4096);
 select @@global.max_relay_log_size;
 @@global.max_relay_log_size	20480
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 3: max_relay_log_size = 0
 #
@@ -123,94 +43,13 @@ set global max_relay_log_size=0;
 select @@global.max_relay_log_size;
 @@global.max_relay_log_size	0
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
 #
 stop slave;
 reset slave;
 flush logs;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 #
 # Test 5
 #
@@ -218,93 +57,13 @@ reset slave;
 start slave;
 flush logs;
 create table t1 (a int);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
 #
 flush logs;
 drop table t1;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 flush logs;
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
diff --git a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
index 028b73e6153..5499d41bc1f 100644
--- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
@@ -4,205 +4,38 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
 Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-stop slave;
+Master_Host	127.0.0.1
+include/stop_slave.inc
 change master to master_user='test';
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
 Master_User	test
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Master_Host	127.0.0.1
 reset slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
 Master_User	test
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Master_Host	127.0.0.1
 change master to master_user='root';
-start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
+include/start_slave.inc
 Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-stop slave;
+Master_Host	127.0.0.1
+include/stop_slave.inc
 reset slave;
-start slave;
+include/start_slave.inc
 create temporary table t1 (a int);
-stop slave;
+include/stop_slave.inc
 reset slave;
-start slave;
+include/start_slave.inc
 show status like 'slave_open_temp_tables';
 Variable_name	Value
 Slave_open_temp_tables	0
-stop slave;
+include/stop_slave.inc
 reset slave;
-*** errno must be zero: 0 ***
 change master to master_user='impossible_user_name';
 start slave;
-ONE
-1
-include/stop_slave.inc
+stop slave;
 change master to master_user='root';
 include/start_slave.inc
-*** last errno must be  zero: 0 ***
-*** last error must be blank:  ***
-include/stop_slave.inc
+stop slave;
 change master to master_user='impossible_user_name';
 start slave;
-ONE
-1
-include/stop_slave.inc
+stop slave;
 reset slave;
-*** io  last errno must be  zero: 0  ***
-*** io  last error must be blank:   ***
-*** sql last errno must be  zero: 0 ***
-*** sql last error must be blank:  ***
diff --git a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
index 5834c95b319..92b6592dcfb 100644
--- a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
+++ b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
@@ -12,7 +12,7 @@ INSERT INTO t1 VALUES (4);
 INSERT INTO t1 VALUES (5);
 INSERT INTO t1 VALUES (6);
 [MASTER] ********* SOW BINLOG EVENTS IN ...  *********
-show binlog events in 'master-bin.000001' from <binlog_start>;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 master-bin.000001	#	Query	#	#	BEGIN
@@ -74,14 +74,14 @@ 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;
+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 in 'slave-bin.000001' from <binlog_start>;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 slave-bin.000001	#	Query	#	#	BEGIN
@@ -143,7 +143,7 @@ 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;
+show binlog events from <binlog_start> limit 1,4;
 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)
@@ -190,7 +190,7 @@ slave-relay-bin.000003	#	Rotate	#	#	master-bin.000001;pos=4
 slave-relay-bin.000003	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
 slave-relay-bin.000003	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows  *********
-show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1,  3;
+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)
@@ -265,7 +265,7 @@ slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 slave-bin.000001	#	Query	#	#	COMMIT
 slave-bin.000001	#	Rotate	#	#	slave-bin.000002;pos=4
 [SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
-show relaylog events in 'slave-relay-bin.000005' from <binlog_start>;
+show relaylog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-relay-bin.000005	#	Rotate	#	#	master-bin.000002;pos=4
 slave-relay-bin.000005	#	Rotate	#	#	slave-relay-bin.000006;pos=4
diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
index 2974b9ad259..0e745feb3cd 100644
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
@@ -118,224 +118,27 @@ a	b
 SELECT * FROM t2;
 a
 2
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	<Last_Error>
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	<Last_IO_Errno>
-Last_IO_Error	<Last_IO_Error>
-Last_SQL_Errno	0
-Last_SQL_Error	<Last_SQL_Error>
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 INSERT INTO t9 VALUES (4);
 INSERT INTO t4 VALUES (4);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	<Last_Error>
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	<Last_IO_Errno>
-Last_IO_Error	<Last_IO_Error>
-Last_SQL_Errno	1677
-Last_SQL_Error	<Last_SQL_Error>
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 0 of table 'test.t4' cannot be converted from type 'int' to type 'float'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 INSERT INTO t9 VALUES (5);
 INSERT INTO t5 VALUES (5,10,25);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	<Last_Error>
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	<Last_IO_Errno>
-Last_IO_Error	<Last_IO_Error>
-Last_SQL_Errno	1677
-Last_SQL_Error	<Last_SQL_Error>
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'int' to type 'float'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 INSERT INTO t9 VALUES (6);
 INSERT INTO t6 VALUES (6,12,36);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	<Last_Error>
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	<Last_IO_Errno>
-Last_IO_Error	<Last_IO_Error>
-Last_SQL_Errno	1677
-Last_SQL_Error	<Last_SQL_Error>
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t6' cannot be converted from type 'int' to type 'float'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 INSERT INTO t9 VALUES (6);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	<Last_Error>
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	<Last_IO_Errno>
-Last_IO_Error	<Last_IO_Error>
-Last_SQL_Errno	0
-Last_SQL_Error	<Last_SQL_Error>
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 INSERT INTO t7 VALUES (1),(2),(3);
 INSERT INTO t8 VALUES (1),(2),(3);
 SELECT * FROM t7 ORDER BY a;
diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
index 04f22a864e1..7bd3be78c60 100644
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
@@ -118,224 +118,27 @@ a	b
 SELECT * FROM t2;
 a
 2
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	<Last_Error>
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	<Last_IO_Errno>
-Last_IO_Error	<Last_IO_Error>
-Last_SQL_Errno	0
-Last_SQL_Error	<Last_SQL_Error>
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 INSERT INTO t9 VALUES (4);
 INSERT INTO t4 VALUES (4);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	<Last_Error>
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	<Last_IO_Errno>
-Last_IO_Error	<Last_IO_Error>
-Last_SQL_Errno	1677
-Last_SQL_Error	<Last_SQL_Error>
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 0 of table 'test.t4' cannot be converted from type 'int' to type 'float'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 INSERT INTO t9 VALUES (5);
 INSERT INTO t5 VALUES (5,10,25);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	<Last_Error>
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	<Last_IO_Errno>
-Last_IO_Error	<Last_IO_Error>
-Last_SQL_Errno	1677
-Last_SQL_Error	<Last_SQL_Error>
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'int' to type 'float'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 INSERT INTO t9 VALUES (6);
 INSERT INTO t6 VALUES (6,12,36);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1677
-Last_Error	<Last_Error>
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	<Last_IO_Errno>
-Last_IO_Error	<Last_IO_Error>
-Last_SQL_Errno	1677
-Last_SQL_Error	<Last_SQL_Error>
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t6' cannot be converted from type 'int' to type 'float'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 INSERT INTO t9 VALUES (6);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	<Last_Error>
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	<Last_IO_Errno>
-Last_IO_Error	<Last_IO_Error>
-Last_SQL_Errno	0
-Last_SQL_Error	<Last_SQL_Error>
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 INSERT INTO t7 VALUES (1),(2),(3);
 INSERT INTO t8 VALUES (1),(2),(3);
 SELECT * FROM t7 ORDER BY a;
diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result
index e878456e296..81aeb0d645b 100644
--- a/mysql-test/suite/rpl/r/rpl_row_until.result
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result
@@ -20,196 +20,32 @@ n
 2
 3
 4
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	MASTER_POS_DROP_T1
-Relay_Log_Space	#
-Until_Condition	Master
-Until_Log_File	master-bin.000001
-Until_Log_Pos	MASTER_POS_DROP_T1
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
+START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
 SELECT * FROM t1;
 n
 1
 2
 3
 4
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	MASTER_POS_DROP_T1
-Relay_Log_Space	#
-Until_Condition	Master
-Until_Log_File	master-no-such-bin.000001
-Until_Log_Pos	291
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2
 SELECT * FROM t2;
 n
 1
 2
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	MASTER_POS_INSERT1_T2
-Relay_Log_Space	#
-Until_Condition	Relay
-Until_Log_File	slave-relay-bin.000002
-Until_Log_Pos	RELAY_POS_INSERT1_T2
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 START SLAVE;
 include/stop_slave.inc
 START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	MASTER_POS_DROP_T2
-Relay_Log_Space	#
-Until_Condition	Master
-Until_Log_File	master-bin.000001
-Until_Log_Pos	MASTER_POS_CREATE_T2
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=MASTER_LOG_POS;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS, RELAY_LOG_POS=RELAY_LOG_POS;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001';
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=MASTER_LOG_POS;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 START SLAVE;
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
 Warnings:
 Note	1254	Slave is already running
diff --git a/mysql-test/suite/rpl/r/rpl_skip_error.result b/mysql-test/suite/rpl/r/rpl_skip_error.result
index 7b2bd48515d..0aa8069a38c 100644
--- a/mysql-test/suite/rpl/r/rpl_skip_error.result
+++ b/mysql-test/suite/rpl/r/rpl_skip_error.result
@@ -31,47 +31,7 @@ n
 3
 7
 8
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 ==== Clean Up ====
 drop table t1;
 create table t1(a int primary key);
@@ -86,47 +46,7 @@ select * from t1;
 a
 1
 2
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 ==== Clean Up ====
 drop table t1;
 ==== Using Innodb ====
diff --git a/mysql-test/suite/rpl/r/rpl_slave_skip.result b/mysql-test/suite/rpl/r/rpl_slave_skip.result
index 24000df40d2..d6513d838c3 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_skip.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result
@@ -42,48 +42,7 @@ c	d
 2	8
 3	18
 **** On Slave ****
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	1116
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	763
-Relay_Log_Space	#
-Until_Condition	Master
-Until_Log_File	master-bin.000001
-Until_Log_Pos	762
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 SELECT * FROM t1;
@@ -108,50 +67,9 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	User var	#	#	@`foo`=12
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES(@foo, 2*@foo)
 master-bin.000001	#	Query	#	#	COMMIT
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=106;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	387
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	387
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 **** On Master ****
 DROP TABLE t1, t2;
 SET SESSION BINLOG_FORMAT=ROW;
diff --git a/mysql-test/suite/rpl/r/rpl_ssl.result b/mysql-test/suite/rpl/r/rpl_ssl.result
index c8e9e1a4911..1af4c5e227c 100644
--- a/mysql-test/suite/rpl/r/rpl_ssl.result
+++ b/mysql-test/suite/rpl/r/rpl_ssl.result
@@ -19,93 +19,23 @@ insert into t1 values(1);
 select * from t1;
 t
 1
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	replssl
-Master_Port	MASTER_MYPORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
 Master_SSL_Allowed	Yes
-Master_SSL_CA_File	MYSQL_TEST_DIR/std_data/cacert.pem
 Master_SSL_CA_Path	
+Master_SSL_CA_File	MYSQL_TEST_DIR/std_data/cacert.pem
 Master_SSL_Cert	MYSQL_TEST_DIR/std_data/client-cert.pem
-Master_SSL_Cipher	
 Master_SSL_Key	MYSQL_TEST_DIR/std_data/client-key.pem
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 STOP SLAVE;
 select * from t1;
 t
 1
 insert into t1 values (NULL);
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	replssl
-Master_Port	MASTER_MYPORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
 Master_SSL_Allowed	Yes
-Master_SSL_CA_File	MYSQL_TEST_DIR/std_data/cacert.pem
 Master_SSL_CA_Path	
+Master_SSL_CA_File	MYSQL_TEST_DIR/std_data/cacert.pem
 Master_SSL_Cert	MYSQL_TEST_DIR/std_data/client-cert.pem
-Master_SSL_Cipher	
 Master_SSL_Key	MYSQL_TEST_DIR/std_data/client-key.pem
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 drop user replssl@localhost;
 drop table t1;
 End of 5.0 tests
diff --git a/mysql-test/suite/rpl/r/rpl_ssl1.result b/mysql-test/suite/rpl/r/rpl_ssl1.result
index de255228aff..5b4aa126c77 100644
--- a/mysql-test/suite/rpl/r/rpl_ssl1.result
+++ b/mysql-test/suite/rpl/r/rpl_ssl1.result
@@ -18,93 +18,23 @@ start slave;
 select * from t1;
 t
 1
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	replssl
-Master_Port	MASTER_MYPORT
-Connect_Retry	1
-Master_Log_File	#
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	#
-Slave_IO_Running	#
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
 Master_SSL_Allowed	Yes
-Master_SSL_CA_File	MYSQL_TEST_DIR/std_data/cacert.pem
 Master_SSL_CA_Path	
+Master_SSL_CA_File	MYSQL_TEST_DIR/std_data/cacert.pem
 Master_SSL_Cert	MYSQL_TEST_DIR/std_data/client-cert.pem
-Master_SSL_Cipher	
 Master_SSL_Key	MYSQL_TEST_DIR/std_data/client-key.pem
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 stop slave;
 change master to master_user='root',master_password='', master_ssl=0;
 start slave;
 drop user replssl@localhost;
 drop table t1;
-show slave status;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_MYPORT
-Connect_Retry	1
-Master_Log_File	#
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	#
-Slave_IO_Running	#
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
 Master_SSL_Allowed	No
-Master_SSL_CA_File	MYSQL_TEST_DIR/std_data/cacert.pem
 Master_SSL_CA_Path	
+Master_SSL_CA_File	MYSQL_TEST_DIR/std_data/cacert.pem
 Master_SSL_Cert	MYSQL_TEST_DIR/std_data/client-cert.pem
-Master_SSL_Cipher	
 Master_SSL_Key	MYSQL_TEST_DIR/std_data/client-key.pem
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 stop slave;
 change master to
 master_host="localhost",
@@ -120,45 +50,10 @@ on slave
 select * from t1;
 t
 1
-show slave status;
-Slave_IO_State	#
-Master_Host	localhost
-Master_User	root
-Master_Port	MASTER_MYPORT
-Connect_Retry	1
-Master_Log_File	#
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	#
-Slave_IO_Running	#
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
 Master_SSL_Allowed	Yes
-Master_SSL_CA_File	MYSQL_TEST_DIR/std_data/cacert.pem
 Master_SSL_CA_Path	
+Master_SSL_CA_File	MYSQL_TEST_DIR/std_data/cacert.pem
 Master_SSL_Cert	MYSQL_TEST_DIR/std_data/client-cert.pem
-Master_SSL_Cipher	
 Master_SSL_Key	MYSQL_TEST_DIR/std_data/client-key.pem
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	Yes
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
index e999f9c28f0..61fee130d49 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
@@ -18,10 +18,6 @@ master-bin.000001	#	Query	#	#	use `test`; rename table t1 to t5, t2 to t1
 select * from t3;
 a
 flush tables;
-show binlog events from <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; rename table t1 to t5, t2 to t1
-master-bin.000001	#	Query	#	#	use `test`; flush tables
 select * from t3;
 a
 stop slave;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result b/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result
index 1bef1c89ec7..6b0c1c38c16 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result
@@ -51,18 +51,20 @@ CREATE TABLE t1(a int, UNIQUE(a));
 INSERT DELAYED IGNORE INTO t1 VALUES(1);
 INSERT DELAYED IGNORE INTO t1 VALUES(1);
 flush table t1;
-show binlog events in 'master-bin.000002' LIMIT 2,2;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-x	x	x	x	x	BEGIN
-x	x	x	x	x	use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
 select * from t1;
 a
 1
 On slave
-show binlog events in 'slave-bin.000002' LIMIT 2,2;
+show binlog events in 'slave-bin.000002' from <binlog_start> limit 1,6;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-x	x	x	x	x	BEGIN
-x	x	x	x	x	use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+slave-bin.000002	#	Query	#	#	BEGIN
+slave-bin.000002	#	Query	#	#	use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+slave-bin.000002	#	Query	#	#	COMMIT
+slave-bin.000002	#	Query	#	#	BEGIN
+slave-bin.000002	#	Query	#	#	use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+slave-bin.000002	#	Query	#	#	COMMIT
 select * from t1;
 a
 1
diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result
index 17134b1f02f..1dfd8f4eb3f 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result
@@ -16,33 +16,32 @@ load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
 select count(*) from t1;
 count(*)
 69
-show binlog events;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Intvar	1	#	INSERT_ID=1
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (NULL)
-master-bin.000001	#	Query	1	#	COMMIT
-master-bin.000001	#	Query	1	#	use `test`; drop table t1
-master-bin.000001	#	Query	1	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Begin_load_query	1	#	;file_id=1;block_len=581
-master-bin.000001	#	Execute_load_query	1	#	use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES  (`word`) ;file_id=1
-master-bin.000001	#	Query	1	#	COMMIT
-show binlog events from 107 limit 1;
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Intvar	#	#	INSERT_ID=1
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (NULL)
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
+master-bin.000001	#	Execute_load_query	#	#	use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES  (`word`) ;file_id=#
+master-bin.000001	#	Query	#	#	COMMIT
+show binlog events from <binlog_start> limit 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-show binlog events from 107 limit 2;
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+show binlog events from <binlog_start> limit 2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-master-bin.000001	#	Query	1	#	BEGIN
-show binlog events from 107 limit 1,4;
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001	#	Query	#	#	BEGIN
+show binlog events from <binlog_start> limit 1,4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Intvar	1	#	INSERT_ID=1
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (NULL)
-master-bin.000001	#	Query	1	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Intvar	#	#	INSERT_ID=1
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (NULL)
+master-bin.000001	#	Query	#	#	COMMIT
 flush logs;
 create table t3 (a int)ENGINE=MyISAM;
 select * from t1 order by 1 asc;
@@ -206,14 +205,13 @@ master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
 master-bin.000001	#	Execute_load_query	#	#	use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES  (`word`) ;file_id=#
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
-show binlog events in 'master-bin.000002';
+show binlog events in 'master-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000002	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
-master-bin.000002	#	Query	1	#	use `test`; create table t3 (a int)ENGINE=MyISAM
-master-bin.000002	#	Query	1	#	use `test`; create table t2 (n int)ENGINE=MyISAM
-master-bin.000002	#	Query	1	#	BEGIN
-master-bin.000002	#	Query	1	#	use `test`; insert into t2 values (1)
-master-bin.000002	#	Query	1	#	COMMIT
+master-bin.000002	#	Query	#	#	use `test`; create table t3 (a int)ENGINE=MyISAM
+master-bin.000002	#	Query	#	#	use `test`; create table t2 (n int)ENGINE=MyISAM
+master-bin.000002	#	Query	#	#	BEGIN
+master-bin.000002	#	Query	#	#	use `test`; insert into t2 values (1)
+master-bin.000002	#	Query	#	#	COMMIT
 show binary logs;
 Log_name	File_size
 master-bin.000001	#
@@ -222,70 +220,28 @@ show binary logs;
 Log_name	File_size
 slave-bin.000001	#
 slave-bin.000002	#
-show binlog events in 'slave-bin.000001' from 4;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
-slave-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
-slave-bin.000001	#	Query	1	#	BEGIN
-slave-bin.000001	#	Intvar	1	#	INSERT_ID=1
-slave-bin.000001	#	Query	1	#	use `test`; insert into t1 values (NULL)
-slave-bin.000001	#	Query	1	#	COMMIT
-slave-bin.000001	#	Query	1	#	use `test`; drop table t1
-slave-bin.000001	#	Query	1	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
-slave-bin.000001	#	Query	1	#	BEGIN
-slave-bin.000001	#	Begin_load_query	1	#	;file_id=1;block_len=581
-slave-bin.000001	#	Execute_load_query	1	#	use `test`; LOAD DATA INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES  (`word`) ;file_id=1
-slave-bin.000001	#	Query	1	#	COMMIT
-slave-bin.000001	#	Query	1	#	use `test`; create table t3 (a int)ENGINE=MyISAM
-slave-bin.000001	#	Rotate	2	#	slave-bin.000002;pos=4
-show binlog events in 'slave-bin.000002' from 4;
+slave-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=1
+slave-bin.000001	#	Query	#	#	use `test`; insert into t1 values (NULL)
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	use `test`; drop table t1
+slave-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
+slave-bin.000001	#	Execute_load_query	#	#	use `test`; LOAD DATA INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES  (`word`) ;file_id=#
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	use `test`; create table t3 (a int)ENGINE=MyISAM
+slave-bin.000001	#	Rotate	#	#	slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000002	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
-slave-bin.000002	#	Query	1	#	use `test`; create table t2 (n int)ENGINE=MyISAM
-slave-bin.000002	#	Query	1	#	BEGIN
-slave-bin.000002	#	Query	1	#	use `test`; insert into t2 values (1)
-slave-bin.000002	#	Query	1	#	COMMIT
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000002
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000002
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+slave-bin.000002	#	Query	#	#	use `test`; create table t2 (n int)ENGINE=MyISAM
+slave-bin.000002	#	Query	#	#	BEGIN
+slave-bin.000002	#	Query	#	#	use `test`; insert into t2 values (1)
+slave-bin.000002	#	Query	#	#	COMMIT
+Checking that both slave threads are running.
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
index a21bec6ae55..547dd8e1541 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result
@@ -23,47 +23,7 @@ select @@global.max_relay_log_size;
 @@global.max_relay_log_size
 4096
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 2
 #
@@ -73,47 +33,7 @@ set global max_relay_log_size=(5*4096);
 select @@global.max_relay_log_size;
 @@global.max_relay_log_size	20480
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 3: max_relay_log_size = 0
 #
@@ -123,94 +43,13 @@ set global max_relay_log_size=0;
 select @@global.max_relay_log_size;
 @@global.max_relay_log_size	0
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
 #
 stop slave;
 reset slave;
 flush logs;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 #
 # Test 5
 #
@@ -218,93 +57,13 @@ reset slave;
 start slave;
 flush logs;
 create table t1 (a int);
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 #
 # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
 #
 flush logs;
 drop table t1;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 flush logs;
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
diff --git a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
index 761ad7f42d4..d2b21099cd6 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
@@ -12,7 +12,7 @@ INSERT INTO t1 VALUES (4);
 INSERT INTO t1 VALUES (5);
 INSERT INTO t1 VALUES (6);
 [MASTER] ********* SOW BINLOG EVENTS IN ...  *********
-show binlog events in 'master-bin.000001' from <binlog_start>;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 master-bin.000001	#	Query	#	#	BEGIN
@@ -62,14 +62,14 @@ 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;
+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 in 'slave-bin.000001' from <binlog_start>;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 slave-bin.000001	#	Query	#	#	BEGIN
@@ -119,7 +119,7 @@ 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;
+show binlog events from <binlog_start> limit 1,4;
 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)
@@ -160,7 +160,7 @@ slave-relay-bin.000003	#	Rotate	#	#	master-bin.000001;pos=4
 slave-relay-bin.000003	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
 slave-relay-bin.000003	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows  *********
-show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1,  3;
+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)
@@ -223,7 +223,7 @@ 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 in 'slave-relay-bin.000005' from <binlog_start>;
+show relaylog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-relay-bin.000005	#	Rotate	#	#	master-bin.000002;pos=4
 slave-relay-bin.000005	#	Rotate	#	#	slave-relay-bin.000006;pos=4
diff --git a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
index 94e8a31390d..c6c2c525098 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
@@ -4,205 +4,38 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
 Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-stop slave;
+Master_Host	127.0.0.1
+include/stop_slave.inc
 change master to master_user='test';
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
 Master_User	test
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Master_Host	127.0.0.1
 reset slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
 Master_User	test
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	
-Slave_IO_Running	No
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Master_Host	127.0.0.1
 change master to master_user='root';
-start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
+include/start_slave.inc
 Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-stop slave;
+Master_Host	127.0.0.1
+include/stop_slave.inc
 reset slave;
-start slave;
+include/start_slave.inc
 create temporary table t1 (a int);
-stop slave;
+include/stop_slave.inc
 reset slave;
-start slave;
+include/start_slave.inc
 show status like 'slave_open_temp_tables';
 Variable_name	Value
 Slave_open_temp_tables	1
-stop slave;
+include/stop_slave.inc
 reset slave;
-*** errno must be zero: 0 ***
 change master to master_user='impossible_user_name';
 start slave;
-ONE
-1
-include/stop_slave.inc
+stop slave;
 change master to master_user='root';
 include/start_slave.inc
-*** last errno must be  zero: 0 ***
-*** last error must be blank:  ***
-include/stop_slave.inc
+stop slave;
 change master to master_user='impossible_user_name';
 start slave;
-ONE
-1
-include/stop_slave.inc
+stop slave;
 reset slave;
-*** io  last errno must be  zero: 0  ***
-*** io  last error must be blank:   ***
-*** sql last errno must be  zero: 0 ***
-*** sql last error must be blank:  ***
diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result
index b131cbc7e63..118d31d78c8 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_until.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_until.result
@@ -17,207 +17,43 @@ insert into t2 values (3),(4);
 drop table t2;
 ==== Replicate one event at a time on slave ====
 [on slave]
-start slave until master_log_file='master-bin.000001', master_log_pos=323;
+start slave until master_log_file='MASTER_LOG_FILE', master_log_pos=MASTER_LOG_POS;
 select * from t1;
 n
 1
 2
 3
 4
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	Master
-Until_Log_File	master-bin.000001
-Until_Log_Pos	323
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=MASTER_LOG_POS;
 select * from t1;
 n
 1
 2
 3
 4
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	Master
-Until_Log_File	master-no-such-bin.000001
-Until_Log_Pos	291
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=891;
+start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=RELAY_LOG_POS;
 select * from t2;
 n
 1
 2
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	Relay
-Until_Log_File	slave-relay-bin.000004
-Until_Log_Pos	891
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 start slave;
 [on master]
 [on slave]
 include/stop_slave.inc
-start slave until master_log_file='master-bin.000001', master_log_pos=776;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	Master
-Until_Log_File	master-bin.000001
-Until_Log_Pos	776
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+start slave until master_log_file='MASTER_LOG_FILE', master_log_pos=MASTER_LOG_POS;
 ==== Test various error conditions ====
-start slave until master_log_file='master-bin', master_log_pos=561;
+start slave until master_log_file='master-bin', master_log_pos=MASTER_LOG_POS;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS, relay_log_pos=RELAY_LOG_POS;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave until master_log_file='master-bin.000001';
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave until relay_log_file='slave-relay-bin.000002';
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=MASTER_LOG_POS;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave sql_thread;
-start slave until master_log_file='master-bin.000001', master_log_pos=776;
+start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
 Warnings:
 Note	1254	Slave is already running
 include/stop_slave.inc
@@ -238,7 +74,7 @@ insert into t1 set a=null;
 select count(*) as two from t1;
 two
 2
-start slave until master_log_file='master-bin.000001', master_log_pos= UNTIL_POS;;
+start slave until master_log_file='MASTER_LOG_FILE', master_log_pos= UNTIL_POS;;
 slave stopped at the prescribed position
 select 0 as zero;
 zero
diff --git a/mysql-test/suite/rpl/r/rpl_temporary_errors.result b/mysql-test/suite/rpl/r/rpl_temporary_errors.result
index 8ecbbde65b4..64fa4ed14ea 100644
--- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result
@@ -39,47 +39,7 @@ a	b
 2	2
 3	3
 4	4
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 DROP TABLE t1;
 **** On Master ****
 DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/t/rpl_000015-slave.opt b/mysql-test/suite/rpl/t/rpl_000015-slave.opt
deleted file mode 100644
index 178e9d781f6..00000000000
--- a/mysql-test/suite/rpl/t/rpl_000015-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---server-id=22
diff --git a/mysql-test/suite/rpl/t/rpl_000015.cnf b/mysql-test/suite/rpl/t/rpl_000015.cnf
deleted file mode 100644
index 46f8af242c2..00000000000
--- a/mysql-test/suite/rpl/t/rpl_000015.cnf
+++ /dev/null
@@ -1,2 +0,0 @@
-!include ../rpl_1slave_base.cnf
-
diff --git a/mysql-test/suite/rpl/t/rpl_000015.test b/mysql-test/suite/rpl/t/rpl_000015.test
deleted file mode 100644
index 446c2f06ae5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_000015.test
+++ /dev/null
@@ -1,38 +0,0 @@
--- source include/have_log_bin.inc
-#####################
-# Change Author: JBM
-# Change Date: 2006-01-17
-# Change: added order by in select
-##################### 
-
-connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK);
-connection master;
-reset master;
-source include/show_master_status.inc;
-save_master_pos;
-connection slave;
-reset slave;
-source include/show_slave_status2.inc;
-
---replace_result $MASTER_MYPORT MASTER_PORT
-eval change master to master_host='127.0.0.1',master_user='root',
- master_password='',master_port=$MASTER_MYPORT, MASTER_CONNECT_RETRY=7;
-source include/show_slave_status2.inc;
-start slave;
---source include/wait_for_slave_to_start.inc
-sync_with_master;
-source include/show_slave_status2.inc;
-connection master;
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (n int, PRIMARY KEY(n));
-insert into t1 values (10),(45),(90);
-sync_slave_with_master;
-connection slave;
-SELECT * FROM t1 ORDER BY n;
-connection master;
-SELECT * FROM t1 ORDER BY n;
-drop table t1;
-sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_grant.test b/mysql-test/suite/rpl/t/rpl_binlog_grant.test
index 31163927ce2..4c6402359fe 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_grant.test
@@ -20,26 +20,24 @@ set @@autocommit=0;
 start transaction;
 insert into t values (1);
 grant select on t to x@y;
+let $wait_binlog_event= grant select;
+source include/wait_for_binlog_event.inc;
 #
 # There is no active transaction here
 #
 rollback;
 show grants for x@y;
---replace_result $VERSION VERSION
---replace_regex /\/\* xid=.* \*\//\/* XID *\//
-show binlog events;
 start transaction;
 insert into t values (2);
 revoke select on t from x@y;
+let $wait_binlog_event= revoke select;
+source include/wait_for_binlog_event.inc;
 #
 # There is no active transaction here
 #
 commit;
 select * from t;
 show grants for x@y;
---replace_result $VERSION VERSION
---replace_regex /\/\* xid=.* \*\//\/* XID *\//
-show binlog events;
 drop user x@y;
 drop database d1;
 --sync_slave_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test
index 42d86a7fc1e..5dc06e6a605 100644
--- a/mysql-test/suite/rpl/t/rpl_bug33931.test
+++ b/mysql-test/suite/rpl/t/rpl_bug33931.test
@@ -39,9 +39,10 @@ connection slave;
 #
 source include/wait_for_slave_to_stop.inc;
 
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 19 # 23 # 33 # 37 #
-query_vertical show slave status;
+# 1593 = ER_SLAVE_FATAL_ERROR 
+--let $slave_sql_errno= 1593 
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 
 #
 # Cleanup
diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test
index 997cca42e82..514d6cf8c0f 100644
--- a/mysql-test/suite/rpl/t/rpl_change_master.test
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test
@@ -19,10 +19,26 @@ let $slave_param= Read_Master_Log_Pos;
 let $slave_param_value= query_get_value(SHOW MASTER STATUS, Position, 1);
 connection slave;
 source include/wait_for_slave_param.inc;
-stop slave;
-source include/show_slave_status2.inc;
+source include/stop_slave.inc;
+
+let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
+let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
+if (`SELECT $read_pos = $exec_pos`)
+{
+  source include/show_rpl_debug_info.inc;
+  echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos';
+  die Failed because Read_Master_Log_Pos is equal to Exec_Master_Log_Pos;
+} 
 change master to master_user='root';
-source include/show_slave_status2.inc;
+let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
+let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
+if (`SELECT $read_pos <> $exec_pos`)
+{
+  source include/show_rpl_debug_info.inc;
+  echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos';
+  die Failed because Read_Master_Log_Pos is not equal to Exec_Master_Log_Pos;
+}
+
 start slave;
 sync_with_master;
 select * from t1;
diff --git a/mysql-test/suite/rpl/t/rpl_critical_errors.test b/mysql-test/suite/rpl/t/rpl_critical_errors.test
index b35cd305f92..aa1f251b738 100644
--- a/mysql-test/suite/rpl/t/rpl_critical_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_critical_errors.test
@@ -53,15 +53,13 @@ KILL QUERY 2;
 connection slave;
 
 # Here the slave will only stop if the query above actually started
-# inserting some rows into t2. Otherwise, it will hang forever.
---source include/wait_for_slave_to_stop.inc
+# inserting some rows into t2. Otherwise, it will hang forever.  ... and there
+# the error code should be 1317 (ER_QUERY_INTERRUPTED)
+--let $slave_sql_errno= 1317
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 
 # The following should be 0
 SELECT COUNT(*) FROM t2;
 
-# ... and there the error code should be 1317 (ER_QUERY_INTERRUPTED)
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 20 # 22 # 23 # 33 #
-query_vertical SHOW SLAVE STATUS;
-
 enable_parsing;
diff --git a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
index b2530e83b89..ab1de6a2e9f 100644
--- a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
+++ b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
@@ -21,52 +21,51 @@ connection master;
 --replace_result $SLAVE_MYPORT SLAVE_PORT
 eval change master to master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root";
 
-start slave;
---source include/wait_for_slave_to_start.inc
+source include/start_slave.inc;
 
 # now we test it
 
 connection slave;
 
 create table t1 (n int);
+let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $master_log_pos_1= `SELECT $master_log_pos_1 + 3`;
 
-save_master_pos;
-connection master;
-sync_with_master;
+sync_slave_with_master master;
 
 #
 # BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if
 #             log-slave-updates and circul repl
 #
-stop slave;
---source include/wait_for_slave_to_stop.inc
+source include/stop_slave.inc;
 
 create table t2 (n int); # create one ignored event
 
 sync_slave_with_master;
 
-connection slave;
-
 show tables;
 
-save_master_pos;
-
 create table t3 (n int) engine=innodb;
+let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $master_log_pos_2= `SELECT $master_log_pos_2 + 5`;
 set @a=1;
 insert into t3 values(@a);
+let $master_log_pos_3= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $master_log_pos_3= `SELECT $master_log_pos_3 + 5`;
 begin;
 insert into t3 values(2);
 insert into t3 values(3);
 commit;
 insert into t3 values(4);
 
-
 connection master;
 
 # bug is that START SLAVE UNTIL may stop too late, we test that by
 # asking it to stop before creation of t3.
 
-start slave until master_log_file="slave-bin.000001",master_log_pos=195;
+--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_1 MASTER_LOG_POS
+eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_1;
 --source include/wait_for_slave_sql_to_stop.inc
 
 # then BUG#13861 causes t3 to show up below (because stopped too
@@ -75,17 +74,18 @@ start slave until master_log_file="slave-bin.000001",master_log_pos=195;
 show tables;
 
 # ensure that we do not break set @a=1; insert into t3 values(@a);
-start slave until master_log_file="slave-bin.000001",master_log_pos=438;
+--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_2 MASTER_LOG_POS
+eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_2;
 --source include/wait_for_slave_sql_to_stop.inc
 select * from t3;
 
 # ensure that we do not break transaction
-start slave until master_log_file="slave-bin.000001",master_log_pos=663;
+--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_3 MASTER_LOG_POS
+eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_3;
 --source include/wait_for_slave_sql_to_stop.inc
 select * from t3;
 
-start slave;
---source include/wait_for_slave_to_start.inc
+source include/start_slave.inc;
 
 # BUG#13023 is that Exec_master_log_pos may stay too low "forever":
 
@@ -96,24 +96,16 @@ create table t5 (n int);
 create table t6 (n int);
 
 sync_slave_with_master;
-
-connection slave;
-
-save_master_pos;
-
-connection master;
+sync_slave_with_master master;
 
 # then BUG#13023 caused hang below ("master" looks behind, while it's
 # not in terms of updates done).
 
-sync_with_master;
-
 show tables;
 
 # cleanup
 
-stop slave;
---source include/wait_for_slave_to_stop.inc
+source include/stop_slave.inc;
 reset slave;
 drop table t1,t2,t3,t4,t5,t6;
 
diff --git a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
index bf71ffbfd1e..aa2dee0fe57 100644
--- a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
+++ b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
@@ -126,7 +126,7 @@ connection master;
 
 # Parameters for include/wait_for_slave_sql_error_and_skip.inc:
 # Ask it to show SQL error message.
-let $show_sql_error= 1;
+let $show_slave_sql_error= 1;
 # The expected error will always be 1146 (ER_NO_SUCH_TABLE).
 let $slave_sql_errno= 1146;
 
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
index a873c1fa3a9..76cd73ba9e0 100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
@@ -40,7 +40,6 @@ source include/start_slave.inc;
 # 2. Insert into t1 on slave (2nd) when the event (1st) for t1 replicated.
 # 3. Master waits until the event (2nd) for t1 will be replicated.
 
---disable_query_log
 CREATE TABLE t1 (a INT KEY) ENGINE= MyISAM;
 let $wait_binlog_event= CREATE TABLE t1;
 --source include/wait_for_binlog_event.inc
@@ -48,31 +47,20 @@ sync_slave_with_master;
 
 connection master;
 INSERT INTO t1 VALUE(1);
---enable_query_log
 FLUSH LOGS;
-let $slave_param_value= query_get_value(SHOW MASTER STATUS, Position, 1);
+sync_slave_with_master;
 
-connection slave;
-let $slave_param= Exec_Master_Log_Pos;
-source include/wait_for_slave_param.inc;
-
---disable_query_log
 INSERT INTO t1 VALUE(2);
 let $slave_param_value= query_get_value(SHOW MASTER STATUS, Position, 1);
---enable_query_log
-
-connection master;
-let $slave_param= Exec_Master_Log_Pos;
-source include/wait_for_slave_param.inc;
-
---enable_query_log
+sync_slave_with_master master;
 
 #
-#  Show status of slave
+# Check that the master server's slave threads are still running and show
+# Relay_Log_File
 #
---replace_result $SLAVE_MYPORT SLAVE_PORT $slave_param_value POSITION
---replace_column 1 # 8 # 9 # 16 # 23 # 33 # 34 # 35 #
---query_vertical SHOW SLAVE STATUS
+--source include/check_slave_is_running.inc
+--let status_items= Relay_Log_File
+--source include/show_slave_status.inc
 
 --disable_query_log
 connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
index 050e43a6d08..60765581faf 100644
--- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
+++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
@@ -58,14 +58,10 @@ source include/stop_slave.inc;
 eval change master to master_port=$SLAVE_MYPORT;
 start slave;
 
-let $slave_param= Last_IO_Errno;
-let $slave_param_value= 1593;
-source include/wait_for_slave_param.inc;
 --echo *** must be having the replicate-same-server-id IO thread error ***
-let $last_io_errno= query_get_value("show slave status", Last_IO_Errno, 1);
-let $last_io_error= query_get_value("show slave status", Last_IO_Error, 1);
-echo Slave_IO_Errno= $last_io_errno;
-echo Slave_IO_Error= $last_io_error;
+let $slave_io_errno= 1593;
+let $show_slave_io_error= 1;
+source include/wait_for_slave_io_error.inc;
 
 # cleanup
 
diff --git a/mysql-test/suite/rpl/t/rpl_grant.test b/mysql-test/suite/rpl/t/rpl_grant.test
index 50b243eab92..6fbdafc0f9c 100644
--- a/mysql-test/suite/rpl/t/rpl_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_grant.test
@@ -36,5 +36,3 @@ sync_slave_with_master;
 --echo **** On Slave ****
 SELECT user,host FROM mysql.user WHERE user like 'dummy%';
 SELECT COUNT(*) FROM mysql.user WHERE user like 'dummy%';
-
-source include/show_slave_status2.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat.test b/mysql-test/suite/rpl/t/rpl_heartbeat.test
index 3b0d21052ee..59c3e10915e 100644
--- a/mysql-test/suite/rpl/t/rpl_heartbeat.test
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat.test
@@ -114,7 +114,8 @@ create table t1 (f1 int);
 
 #connection slave;
 sync_slave_with_master;
-source include/show_slave_status.inc;
+let $slave_param= Relay_Log_File;
+let $slave_param_value= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
 
 # there is an explicit sleep lasting longer than slave_net_timeout
 # to ensure that nothing will come to slave from master for that period.
@@ -124,7 +125,7 @@ source include/show_slave_status.inc;
 real_sleep 15;
 
 # check (compare with the previous show's results) that no rotation happened
-source include/show_slave_status.inc;
+source include/check_slave_param.inc;
 
 ###
 ### SHOW STATUS like 'Slave_heartbeat_period' and 'Slave_received_heartbeats'
diff --git a/mysql-test/suite/rpl/t/rpl_incident.test b/mysql-test/suite/rpl/t/rpl_incident.test
index 66893ebb93f..08096d03c11 100644
--- a/mysql-test/suite/rpl/t/rpl_incident.test
+++ b/mysql-test/suite/rpl/t/rpl_incident.test
@@ -16,6 +16,7 @@ SELECT * FROM t1;
 connection slave;
 # Wait until SQL thread stops with error LOST_EVENT on master
 let $slave_sql_errno= 1590;
+let $show_slave_sql_error= 1;
 source include/wait_for_slave_sql_error.inc;
 
 # The 4 should not be inserted into the table, since the incident log
@@ -23,10 +24,6 @@ source include/wait_for_slave_sql_error.inc;
 --echo **** On Slave ****
 SELECT * FROM t1;
 
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS
-
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 --sync_with_master
@@ -35,9 +32,7 @@ START SLAVE;
 # should be running. We should also have rotated to a new binary log.
 
 SELECT * FROM t1;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS
+source include/check_slave_is_running.inc;
 
 connection master;
 DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
index 60bccaad0d3..b48698baa47 100644
--- a/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
+++ b/mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
@@ -26,9 +26,11 @@ INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
 SELECT * FROM t1;
 connection slave;
 --source include/wait_for_slave_sql_to_stop.inc
-# show the error message
---replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
---query_vertical show slave status;
+# show the error message 
+#1105 = ER_UNKNOWN_ERROR
+--let $slave_sql_errno= 1105
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 # show that it was not replicated
 SELECT * FROM t1;
 
@@ -83,8 +85,10 @@ SELECT * FROM t1;
 connection slave;
 --source include/wait_for_slave_sql_to_stop.inc
 # show the error message
---replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
---query_vertical show slave status;
+#1105 = ER_UNKNOWN_ERROR
+--let $slave_sql_errno= 1105
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
 # show that it was not replicated
 SELECT * FROM t1;
 connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
index d1baaacb672..e80fc160d8f 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
@@ -8,7 +8,6 @@ connection master;
 CREATE TABLE t1 (a INT, b INT);
 INSERT INTO t1 VALUES (1,10);
 sync_slave_with_master;
-source include/show_slave_status2.inc;
 
 # Now we feed it a load data infile, which should make it stop with a
 # fatal error.
@@ -16,12 +15,9 @@ connection master;
 LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1;
 
 connection slave;
-wait_for_slave_to_stop;
-source include/show_slave_status2.inc;
-
-connection slave;
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+let $slave_sql_errno= 1593;
+let $show_slave_sql_error= 1;
+source include/wait_for_slave_sql_error_and_skip.inc;
 
 connection master;
 DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/t/rpl_log_pos.test b/mysql-test/suite/rpl/t/rpl_log_pos.test
index cc3f5d41a09..239ddc5c8d4 100644
--- a/mysql-test/suite/rpl/t/rpl_log_pos.test
+++ b/mysql-test/suite/rpl/t/rpl_log_pos.test
@@ -16,14 +16,16 @@ source include/show_master_status.inc;
 sync_slave_with_master;
 source include/stop_slave.inc;
 
+--replace_result 75 MASTER_LOG_POS
 change master to master_log_pos=75;
-source include/show_slave_status2.inc;
+let $status_items= Read_Master_Log_Pos;
+source include/show_slave_status.inc;
 start slave;
-source include/wait_for_slave_sql_to_start.inc;
-source include/wait_for_slave_io_to_stop.inc;
+let $slave_io_errno= 1236;
+let $show_slave_io_error= 1;
+source include/wait_for_slave_io_error.inc;
 source include/stop_slave.inc;
 
-source include/show_slave_status2.inc;
 connection master;
 source include/show_master_status.inc;
 create table if not exists t1 (n int);
@@ -32,6 +34,7 @@ create table t1 (n int);
 insert into t1 values (1),(2),(3);
 save_master_pos;
 connection slave;
+--replace_result 4 MASTER_LOG_POS
 change master to master_log_pos=4;
 start slave;
 sync_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
index 6a9a30fcb0e..4dca3e0880c 100644
--- a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
+++ b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
@@ -9,20 +9,10 @@
 CREATE TABLE t1 (a INT, b LONG);
 INSERT INTO t1 VALUES (1,1), (2,2);
 INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
 sync_slave_with_master;
 --echo **** On Slave ****
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 34 # 35 #
---query_vertical SHOW SLAVE STATUS
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
 
 --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
 --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql
diff --git a/mysql-test/suite/rpl/t/rpl_replicate_do.test b/mysql-test/suite/rpl/t/rpl_replicate_do.test
index 3e22984aef8..dd3ecc075cc 100644
--- a/mysql-test/suite/rpl/t/rpl_replicate_do.test
+++ b/mysql-test/suite/rpl/t/rpl_replicate_do.test
@@ -27,10 +27,8 @@ connection master;
 drop table if exists t1,t2,t11;
 sync_slave_with_master;
 # show slave status, just to see of it prints replicate-do-table
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
-
+let $status_items= Replicate_Do_Table;
+source include/show_slave_status.inc;
 #
 # BUG#12542
 # TEST: "SET ONE_SHOT should always be executed on slave"
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
index 2490471018b..e1d0966abfa 100644
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
@@ -67,7 +67,9 @@ insert into temp_table values ("testing temporary tables");
 create table t1 (s text);
 insert into t1 values('Could not break slave'),('Tried hard');
 sync_slave_with_master;
-source include/show_slave_status2.inc;
+let $status_items= Master_Log_File, Relay_Master_Log_File;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
 select * from t1;
 connection master;
 flush logs;
@@ -138,7 +140,8 @@ purge master logs before (@time_for_purge);
 source include/show_binary_logs.inc;
 insert into t2 values (65);
 sync_slave_with_master;
-source include/show_slave_status2.inc;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
 select * from t2;
 
 #
@@ -166,7 +169,8 @@ source include/show_master_status.inc;
 sync_slave_with_master;
 select * from t4;
 
-source include/show_slave_status2.inc;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
 # because of concurrent insert, the table may not be up to date
 # if we do not lock
 lock tables t3 read;
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
index 4a1e21f33bf..4522c73b77c 100644
--- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test
@@ -49,9 +49,7 @@ DELETE FROM t1;
 INSERT INTO t1 VALUES (1),(2);
 DELETE FROM t1 WHERE a = 0;
 UPDATE t1 SET a=99 WHERE a = 0;
---replace_result $SERVER_VERSION SERVER_VERSION
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
 
 DROP TABLE t1;
 
diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test
index 2810e11c940..6b051fb46e5 100644
--- a/mysql-test/suite/rpl/t/rpl_row_create_table.test
+++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test
@@ -38,9 +38,7 @@ CREATE TABLE t1 (a INT, b INT);
 CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
 CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
 CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
---query_vertical SHOW BINLOG EVENTS FROM 107
+--source include/show_binlog_events.inc
 --echo **** On Master ****
 --query_vertical SHOW CREATE TABLE t1
 --query_vertical SHOW CREATE TABLE t2
@@ -76,9 +74,7 @@ connection master;
 --error ER_DUP_ENTRY
 CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
 # Shouldn't be written to the binary log
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 107;
+--source include/show_binlog_events.inc
 
 # Test that INSERT-SELECT works the same way as for SBR.
 CREATE TABLE t7 (a INT, b INT UNIQUE);
@@ -86,9 +82,7 @@ CREATE TABLE t7 (a INT, b INT UNIQUE);
 INSERT INTO t7 SELECT a,b FROM tt3;
 SELECT * FROM t7 ORDER BY a,b;
 # Should be written to the binary log
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 107;
+--source include/show_binlog_events.inc
 sync_slave_with_master;
 SELECT * FROM t7 ORDER BY a,b;
 
@@ -100,9 +94,7 @@ INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
 BEGIN;
 INSERT INTO t7 SELECT a,b FROM tt4;
 ROLLBACK;
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 107;
+--source include/show_binlog_events.inc
 SELECT * FROM t7 ORDER BY a,b;
 sync_slave_with_master;
 SELECT * FROM t7 ORDER BY a,b;
@@ -118,9 +110,7 @@ CREATE TEMPORARY TABLE tt7 SELECT 1;
 --echo **** On Master ****
 --query_vertical SHOW CREATE TABLE t8
 --query_vertical SHOW CREATE TABLE t9
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 107;
+--source include/show_binlog_events.inc
 sync_slave_with_master;
 --echo **** On Slave ****
 --query_vertical SHOW CREATE TABLE t8
@@ -164,9 +154,7 @@ SELECT * FROM t1 ORDER BY a;
 SELECT * FROM t2 ORDER BY a;
 SELECT * FROM t3 ORDER BY a;
 SELECT * FROM t4 ORDER BY a;
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 107;
+--source include/show_binlog_events.inc
 sync_slave_with_master;
 SHOW TABLES;
 SELECT * FROM t1 ORDER BY a;
@@ -208,9 +196,7 @@ INSERT INTO t2 SELECT a+2 FROM tt1;
 COMMIT;
 
 SELECT * FROM t2 ORDER BY a;
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 107;
+--source include/show_binlog_events.inc
 sync_slave_with_master;
 SELECT * FROM t2 ORDER BY a;
 
@@ -231,9 +217,7 @@ INSERT INTO t2 SELECT a+2 FROM tt2;
 ROLLBACK;
 
 SELECT * FROM t2 ORDER BY a;
---replace_column 1 # 4 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS FROM 107;
+source include/show_binlog_events.inc;
 sync_slave_with_master;
 SELECT * FROM t2 ORDER BY a;
 
diff --git a/mysql-test/suite/rpl/t/rpl_row_drop.test b/mysql-test/suite/rpl/t/rpl_row_drop.test
index 20c217a7c3a..d18ebc2846b 100644
--- a/mysql-test/suite/rpl/t/rpl_row_drop.test
+++ b/mysql-test/suite/rpl/t/rpl_row_drop.test
@@ -30,10 +30,7 @@ connection master;
 --echo **** On Master ****
 # Should drop the non-temporary table t1 and the temporary table t2
 DROP TABLE t1,t2;
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
+source include/show_binlog_events.inc;
 SHOW TABLES;
 sync_slave_with_master;
 --echo **** On Slave ****
diff --git a/mysql-test/suite/rpl/t/rpl_row_disabled_slave_key.test b/mysql-test/suite/rpl/t/rpl_row_find_row.test
similarity index 64%
rename from mysql-test/suite/rpl/t/rpl_row_disabled_slave_key.test
rename to mysql-test/suite/rpl/t/rpl_row_find_row.test
index 1d7e134f4f4..9163ab54406 100644
--- a/mysql-test/suite/rpl/t/rpl_row_disabled_slave_key.test
+++ b/mysql-test/suite/rpl/t/rpl_row_find_row.test
@@ -71,3 +71,34 @@ DELETE FROM t;
 DROP TABLE t;
 
 -- sync_slave_with_master
+
+#
+# BUG#53893: RBR: nullable unique key can lead to out-of-sync slave
+#
+
+#
+# We insert two rows. Both with part of UNIQUE KEY set to null.
+# Then we update the last row inserted. On master the correct
+# row is updated. On the slave the wrong row would be updated
+# because the engine would look it up by the NULL Unique KEY.
+# As a consquence, the wrong row would be updated.
+#
+
+-- connection master
+-- source include/master-slave-reset.inc
+-- connection master
+
+CREATE TABLE t1 (c1 INT NOT NULL, c2 INT NOT NULL, c3 INT, UNIQUE KEY(c1,c3), KEY(c2));
+INSERT INTO t1(c1,c2) VALUES(1,1);
+INSERT INTO t1(c1,c2) VALUES(1,2);
+UPDATE t1 SET c1=1000 WHERE c2=2;
+-- sync_slave_with_master
+
+-- let $diff_table_1=master:test.t1
+-- let $diff_table_2=slave:test.t1
+-- source include/diff_tables.inc
+
+-- connection master
+DROP TABLE t1;
+-- sync_slave_with_master
+
diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test
index 52e38fa3e57..bcd8ba8612b 100644
--- a/mysql-test/suite/rpl/t/rpl_row_until.test
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test
@@ -14,7 +14,10 @@ INSERT INTO t1 VALUES (1),(2),(3),(4);
 # Save master log postion for query DROP TABLE t1
 let $master_pos_drop_t1= query_get_value(SHOW MASTER STATUS, Position, 1);
 DROP TABLE t1;
-#show binlog events;
+# Save master log postion for query DROP TABLE t1
+save_master_pos;
+let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7);
+let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 7);
 
 # Save master log postion for query CREATE TABLE t2
 let $master_pos_create_t2= query_get_value(SHOW MASTER STATUS, Position, 1);
@@ -48,26 +51,28 @@ eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='1
 # Try to replicate all queries until drop of t1
 
 connection slave;
-echo START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1;
+echo START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_drop_t1;
 --disable_query_log
-eval START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_pos_drop_t1;
+eval START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_drop_t1;
 --enable_query_log
 --source include/wait_for_slave_sql_to_stop.inc
 
 # Here table should be still not deleted
 SELECT * FROM t1;
---replace_result $master_pos_drop_t1 MASTER_POS_DROP_T1
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_pos_drop_t1
+--source include/check_slave_param.inc
 
 # This should fail right after start
+--replace_result 291 MASTER_LOG_POS
 START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
 --source include/wait_for_slave_sql_to_stop.inc
 # again this table should be still not deleted
 SELECT * FROM t1;
---replace_result $master_pos_drop_t1 MASTER_POS_DROP_T1
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_pos_drop_t1
+--source include/check_slave_param.inc
 
 # Try replicate all up to and not including the second insert to t2;
 echo START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2;
@@ -76,9 +81,10 @@ eval START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=$r
 --enable_query_log
 --source include/wait_for_slave_sql_to_stop.inc
 SELECT * FROM t2;
---replace_result $relay_pos_insert1_t2 RELAY_POS_INSERT1_T2 $master_pos_insert1_t2 MASTER_POS_INSERT1_T2
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_pos_insert1_t2
+--source include/check_slave_param.inc
 
 # clean up
 START SLAVE;
@@ -88,31 +94,34 @@ sync_slave_with_master;
 --source include/stop_slave.inc
 
 # This should stop immediately as we are already there
-echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2;
+echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_create_t2;
 --disable_query_log
-eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_pos_create_t2;
+eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_create_t2;
 --enable_query_log
 let $slave_param= Until_Log_Pos;
 let $slave_param_value= $master_pos_create_t2;
 --source include/wait_for_slave_param.inc
 --source include/wait_for_slave_sql_to_stop.inc
 # here the sql slave thread should be stopped
---replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
---replace_result $master_pos_create_t2 MASTER_POS_CREATE_T2 $master_pos_drop_t2 MASTER_POS_DROP_T2
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_pos_drop_t2
+--source include/check_slave_param.inc
 
 #testing various error conditions
+--replace_result 561 MASTER_LOG_POS
 --error 1277
 START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
+--replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
 --error 1277
 START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12;
 --error 1277
 START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001';
 --error 1277
 START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
+--replace_result 561 MASTER_LOG_POS
 --error 1277
 START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
 # Warning should be given for second command
 START SLAVE;
+--replace_result 740 MASTER_LOG_POS
 START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
diff --git a/mysql-test/suite/rpl/t/rpl_skip_error.test b/mysql-test/suite/rpl/t/rpl_skip_error.test
index 9c6aa3dcb57..8d176ac0c3b 100644
--- a/mysql-test/suite/rpl/t/rpl_skip_error.test
+++ b/mysql-test/suite/rpl/t/rpl_skip_error.test
@@ -55,7 +55,7 @@ insert into t1 values (7), (8), (9);
 --echo [on slave]
 sync_slave_with_master;
 select * from t1 order by n;
-source include/show_slave_status2.inc;
+source include/check_slave_is_running.inc;
 
 --echo ==== Clean Up ====
 connection master;
@@ -78,7 +78,7 @@ insert into t1 values (1), (2), (3);
 --echo [on slave]
 sync_slave_with_master;
 select * from t1;
-source include/show_slave_status2.inc;
+source include/check_slave_is_running.inc;
 
 
 --echo ==== Clean Up ====
diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test
index 587a812d0ae..fc0936cea09 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_skip.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test
@@ -21,6 +21,7 @@ CREATE TABLE t1 (a INT, b INT);
 CREATE TABLE t2 (c INT, d INT);
 INSERT INTO t1 VALUES (1,1),(2,4),(3,9);
 INSERT INTO t2 VALUES (1,1),(2,8),(3,27);
+let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
 UPDATE t1,t2 SET b = d, d = b * 2 WHERE a = c;
 source include/show_binlog_events.inc;
 
@@ -28,16 +29,17 @@ source include/show_binlog_events.inc;
 SELECT * FROM t1;
 SELECT * FROM t2;
 save_master_pos;
-
 --echo **** On Slave ****
 connection slave;
 
 # Stop when reaching the the first table map event.
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762;
---source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+--replace_result $master_log_pos MASTER_LOG_POS
+eval START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_log_pos;
+source include/wait_for_slave_sql_to_stop.inc;
+let $slave_param= Exec_Master_Log_Pos;
+let $slave_param_value= $master_log_pos;
+source include/check_slave_param.inc;
+source include/check_slave_no_error.inc;
 
 # Now we skip *one* table map event. If the execution starts right
 # after that table map event, *one* of the involved tables will be
@@ -62,20 +64,19 @@ RESET MASTER;
 
 SET SESSION BINLOG_FORMAT=STATEMENT;
 SET @foo = 12;
+let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
 INSERT INTO t1 VALUES(@foo, 2*@foo);
 save_master_pos;
 source include/show_binlog_events.inc;
 
 connection slave;
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=106;
---source include/wait_for_slave_sql_to_stop.inc
+--replace_result $master_log_pos MASTER_LOG_POS
+eval START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_log_pos;
+source include/wait_for_slave_sql_to_stop.inc;
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
 --source include/wait_for_slave_to_start.inc
 sync_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
 
 --echo **** On Master ****
 connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test
index db21ffb42fd..8ca4ff51eda 100644
--- a/mysql-test/suite/rpl/t/rpl_sp.test
+++ b/mysql-test/suite/rpl/t/rpl_sp.test
@@ -552,7 +552,7 @@ connection master;
 
 # Final inspection which verifies how all statements of this test file
 # were written to the binary log.
-source include/show_binlog_events.inc;
+--source include/show_binlog_events.inc
 
 
 # Restore log_bin_trust_function_creators to its original value.
diff --git a/mysql-test/suite/rpl/t/rpl_ssl.test b/mysql-test/suite/rpl/t/rpl_ssl.test
index fd4897586f6..0f216983a32 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl.test
@@ -30,9 +30,9 @@ select * from t1;
 
 # The slave is synced and waiting/reading from master
 # SHOW SLAVE STATUS will show "Waiting for master to send event"
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
-query_vertical show slave status;
+let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Cert, Master_SSL_Key;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
 
 # Stop the slave, as reported in bug#21871 it would hang
 STOP SLAVE;
@@ -70,9 +70,8 @@ let $master_count= `select count(*) from t1`;
 
 sync_slave_with_master;
 --source include/wait_for_slave_to_start.inc
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
-query_vertical show slave status;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
 
 let $slave_count= `select count(*) from t1`;
 
diff --git a/mysql-test/suite/rpl/t/rpl_ssl1.test b/mysql-test/suite/rpl/t/rpl_ssl1.test
index b28f7b11c03..152f307fd31 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl1.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl1.test
@@ -44,9 +44,9 @@ sync_slave_with_master;
 select * from t1;
 
 #checking show slave status
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
-query_vertical show slave status;
+let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Cert, Master_SSL_Key;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
 
 #checking if replication works without ssl also performing clean up
 stop slave;
@@ -58,10 +58,8 @@ connection master;
 drop user replssl@localhost;
 drop table t1;
 sync_slave_with_master;
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
-query_vertical show slave status;
-
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
 # End of 4.1 tests
 
 # Start replication with ssl_verify_server_cert turned on
@@ -90,9 +88,8 @@ echo on slave;
 select * from t1;
 
 #checking show slave status
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 # 35 # 36 #
-query_vertical show slave status;
+source include/show_slave_status.inc;
+--source include/check_slave_is_running.inc
 
 connection master;
 drop table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test
index 454ec9a0c42..07d4ee37579 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_until.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_until.test
@@ -37,9 +37,12 @@ sync_slave_with_master;
 connection master;
 create table t1(n int not null auto_increment primary key);
 insert into t1 values (1),(2),(3),(4);
+let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1);
 drop table t1;
 create table t2(n int not null auto_increment primary key);
 insert into t2 values (1),(2);
+let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
 insert into t2 values (3),(4);
 drop table t2;
 
@@ -48,27 +51,39 @@ drop table t2;
 # try to replicate all queries until drop of t1
 --echo [on slave]
 connection slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=323;
+--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_1 MASTER_LOG_POS
+eval start slave until master_log_file='$master_log_file', master_log_pos=$master_log_pos_1;
 --source include/wait_for_slave_io_to_start.inc
 --source include/wait_for_slave_sql_to_stop.inc
 # here table should be still not deleted
 select * from t1;
-source include/show_slave_status2.inc;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_log_pos_1
+--source include/check_slave_param.inc
 
 # this should fail right after start
+--replace_result 291 MASTER_LOG_POS
 start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
 --source include/wait_for_slave_io_to_start.inc
 --source include/wait_for_slave_sql_to_stop.inc
 # again this table should be still not deleted
 select * from t1;
-source include/show_slave_status2.inc;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_log_pos_1
+--source include/check_slave_param.inc
 
+let $relay_log_file= slave-relay-bin.000004;
+let $master_log_pos= $master_log_pos_2;
+source include/get_relay_log_pos.inc;
 # try replicate all up to and not including the second insert to t2;
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=891;
+--replace_result $relay_log_pos RELAY_LOG_POS
+eval start slave until relay_log_file='$relay_log_file', relay_log_pos=$relay_log_pos;
 --source include/wait_for_slave_io_to_start.inc
 --source include/wait_for_slave_sql_to_stop.inc
 select * from t2;
-source include/show_slave_status2.inc;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_log_pos
+--source include/check_slave_param.inc
 
 # clean up
 start slave;
@@ -78,27 +93,34 @@ connection master;
 sync_slave_with_master;
 --source include/stop_slave.inc
 
+--let $exec_log_pos_1= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
 # this should stop immediately as we are already there
-start slave until master_log_file='master-bin.000001', master_log_pos=776;
+--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_2 MASTER_LOG_POS
+eval start slave until master_log_file='$master_log_file', master_log_pos=$master_log_pos_2;
 --source include/wait_for_slave_io_to_start.inc
 --source include/wait_for_slave_sql_to_stop.inc
---replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
-source include/show_slave_status2.inc;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $exec_log_pos_1
+--source include/check_slave_param.inc
 
 --echo ==== Test various error conditions ====
 
+--replace_result 561 MASTER_LOG_POS
 --error 1277
 start slave until master_log_file='master-bin', master_log_pos=561;
+--replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
 --error 1277
 start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
 --error 1277
 start slave until master_log_file='master-bin.000001';
 --error 1277
 start slave until relay_log_file='slave-relay-bin.000002';
+--replace_result 561 MASTER_LOG_POS
 --error 1277
 start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
 # Warning should be given for second command
 start slave sql_thread;
+--replace_result 776 MASTER_LOG_POS
 start slave until master_log_file='master-bin.000001', master_log_pos=776;
 
 #
@@ -147,8 +169,8 @@ insert into t1 set a=null;
 select count(*) as two from t1;
 
 connection slave;
---replace_result $until_pos UNTIL_POS;
-eval start slave until master_log_file='master-bin.000001', master_log_pos= $until_pos;
+--replace_result $master_log_file MASTER_LOG_FILE $until_pos UNTIL_POS;
+eval start slave until master_log_file='$master_log_file', master_log_pos= $until_pos;
 source include/wait_for_slave_sql_to_stop.inc;
 let $slave_exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
 --echo slave stopped at the prescribed position
diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors.test b/mysql-test/suite/rpl/t/rpl_temporary_errors.test
index 30fe54d0e72..f05cf73c6ed 100644
--- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test
@@ -25,7 +25,7 @@ sync_slave_with_master;
 set @@global.slave_exec_mode= default;
 SHOW STATUS LIKE 'Slave_retried_transactions';
 SELECT * FROM t1;
-source include/show_slave_status2.inc;
+source include/check_slave_is_running.inc;
 DROP TABLE t1;
 
 --echo **** On Master ****
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
index 6680f3fd70f..d4abf899ca6 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
@@ -140,47 +140,6 @@ set GLOBAL slave_transaction_retries=1;
 **** On Master ****
 UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
 **** On Slave ****
-SHOW SLAVE STATUS;;
-Slave_IO_State	<Slave_IO_State>
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	<Read_Master_Log_Pos>
-Relay_Log_File	<Relay_Log_File>
-Relay_Log_Pos	<Relay_Log_Pos>
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	<Replicate_Ignore_Table>
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	<Last_Errno>
-Last_Error	<Last_Error>
-Skip_Counter	0
-Exec_Master_Log_Pos	<Exec_Master_Log_Pos>
-Relay_Log_Space	<Relay_Log_Space>
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	<Seconds_Behind_Master>
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	<Last_IO_Errno>
-Last_IO_Error	<Last_IO_Error>
-Last_SQL_Errno	<Last_SQL_Errno>
-Last_SQL_Error	<Last_SQL_Error>
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
 set GLOBAL slave_transaction_retries=10;
 include/start_slave.inc
 select * from t1 order by nid;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result
index 61f79804c65..64ab9a6d637 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result
@@ -58,7 +58,7 @@ INSERT INTO t_slave_stmt VALUES (1);
 [on slave]
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error executing row event: 'Cannot execute statement: impossible to write to binary log since statement is in row format and at least one table uses a storage engine limited to statement-based logging.'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 SELECT * FROM t_slave_stmt /* should be empty */;
 a
@@ -155,7 +155,7 @@ INSERT INTO t VALUES (COALESCE(1, UUID()));
 [on slave]
 --source include/wait_for_slave_sql_error_and_skip.inc
 Last_SQL_Error = Error executing row event: 'Cannot execute statement: impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT.'
-set global sql_slave_skip_counter=1;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 include/start_slave.inc
 SELECT * FROM t /* should be empty */;
 a
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
index aeb9e215d15..dfbd7a37d8e 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
@@ -17,91 +17,11 @@ SELECT * FROM t1 ORDER BY a;
 a	b
 1	2
 2	3
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 SELECT * FROM t1 ORDER BY a;
 a	b
 1	2
 2	3
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	60
-Master_Log_File	slave-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	slave-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	2
+Checking that both slave threads are running.
 STOP SLAVE;
 DROP TABLE t1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
index 8eb7df3f890..99438d663bb 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
@@ -14,47 +14,7 @@ INSERT INTO t1 VALUES (2,3);
 STOP SLAVE;
 CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=SLAVE_PORT,MASTER_USER="root";
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	SLAVE_PORT
-Connect_Retry	60
-Master_Log_File	slave-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	slave-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	2
+Checking that both slave threads are running.
 SELECT * FROM t1 ORDER BY a;
 a	b
 1	2
@@ -65,45 +25,5 @@ SELECT * FROM t1 ORDER BY a;
 a	b
 1	2
 2	3
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 DROP TABLE t1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
index ef9791210bc..e1fdf993c7c 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result
@@ -57,7 +57,7 @@ a	b	c
 3	4	QA TESTING
 *** Start Slave ***
 START SLAVE;
-Slave failed with Error 1677
+Last_SQL_Error = Column 2 of table 'test.t2' cannot be converted from type 'char(10)' to type 'char(5)'
 STOP SLAVE;
 RESET SLAVE;
 SELECT * FROM t2 ORDER BY a;
@@ -86,9 +86,10 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 0 of table 'test.t3' cannot be converted from type 'tinyblob' to type 'int(11)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t3  ***
 DROP TABLE t3;
 *** Create t4 on slave  ***
@@ -110,9 +111,10 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 0 of table 'test.t4' cannot be converted from type 'decimal(8,2)' to type 'int(11)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t4  ***
 DROP TABLE t4;
 *** Create t5 on slave  ***
@@ -134,9 +136,10 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'varchar(6)' to type 'char(5)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t5  ***
 DROP TABLE t5;
 *** Create t6 on slave  ***
@@ -157,7 +160,7 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
+Last_SQL_Error = Column 1 of table 'test.t6' cannot be converted from type 'varchar(6)' to type 'char(5)'
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
 *** Drop t6  ***
 DROP TABLE t6;
@@ -231,9 +234,10 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t10' cannot be converted from type 'char(5)' to type 'double'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t10  ***
 DROP TABLE t10;
 *** Create t11 on slave  ***
@@ -254,9 +258,10 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 2 of table 'test.t11' cannot be converted from type 'varchar(254)' to type 'int(11)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 *** Drop t11  ***
 DROP TABLE t11;
 *** Create t12 on slave  ***
@@ -466,9 +471,10 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
 ********************************************
 *** Expect slave to fail with Error 1060 ***
 ********************************************
-Slave failed with Error 1060
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1;
+include/start_slave.inc
 *** Try to insert in master ****
 INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
 SELECT * FROM t15 ORDER BY c1;
@@ -568,8 +574,9 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
 ********************************************
 *** Expect slave to fail with Error 1677 ***
 ********************************************
-Slave failed with Error 1677
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Column 0 of table 'test.t17' cannot be converted from type 'bigint' to type 'smallint(6)'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 2;
+include/start_slave.inc
 ** DROP table t17 ***
 DROP TABLE t17;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result
index 2df70ace0c1..e2755c04f28 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result
@@ -32,16 +32,11 @@ SELECT * FROM t1 ORDER BY c3;
 c1	c2	c3
 row3	C	3
 row4	D	4
-SHOW SLAVE STATUS;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	Yes	Yes				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>	No	<Last_IO_Errno>	<Last_IO_Error>	0			1
+Checking that both slave threads are running.
 STOP SLAVE;
 CHANGE MASTER TO
 master_log_file = 'master-bin.000001',
 master_log_pos = <the_pos> ;
-SHOW SLAVE STATUS;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	No	No				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>	No	<Last_IO_Errno>	<Last_IO_Error>	0			1
 START SLAVE;
 SELECT * FROM t1 ORDER BY c3;
 c1	c2	c3
@@ -67,7 +62,5 @@ COMMIT;
 SELECT * FROM t1;
 c1	c2	c3
 row2	new on slave	2
-SHOW SLAVE STATUS;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error	Replicate_Ignore_Server_Ids	Master_Server_Id
-<Slave_IO_State>	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	<Read_Master_Log_Pos>	<Relay_Log_File>	<Relay_Log_Pos>	master-bin.000001	Yes	Yes				<Replicate_Ignore_Table>			0		0	<Exec_Master_Log_Pos>	<Relay_Log_Space>	None		0	No						<Seconds_Behind_Master>	<Last_IO_Errno>	<Last_IO_Error>		0			1
+Checking that both slave threads are running.
 DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
index 67aa0955b71..375717ee171 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
@@ -16,37 +16,36 @@ load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
 select count(*) from t1;
 count(*)
 69
-show binlog events;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
-master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
-master-bin.000001	#	Write_rows	1	#	table_id: #
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	1	#	COMMIT
-master-bin.000001	#	Query	1	#	use `test`; drop table t1
-master-bin.000001	#	Query	1	#	use `test`; create table t1 (word char(20) not null)ENGINE=NDB
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
-master-bin.000001	#	Write_rows	1	#	table_id: #
-master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	1	#	COMMIT
-show binlog events from 107 limit 1;
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Table_map	#	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=NDB
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Table_map	#	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+show binlog events from <binlog_start> limit 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
-show binlog events from 107 limit 2;
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+show binlog events from <binlog_start> limit 2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
-master-bin.000001	#	Query	1	#	BEGIN
-show binlog events from 107 limit 1,4;
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+master-bin.000001	#	Query	#	#	BEGIN
+show binlog events from <binlog_start> limit 1,4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	BEGIN
-master-bin.000001	#	Table_map	1	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
-master-bin.000001	#	Write_rows	1	#	table_id: #
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Table_map	#	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000001	#	Write_rows	#	#	table_id: #
 flush logs;
 create table t3 (a int)ENGINE=NDB;
 select * from t1 order by 1 asc;
@@ -214,17 +213,16 @@ master-bin.000001	#	Write_rows	#	#	table_id: #
 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
-show binlog events in 'master-bin.000002';
+show binlog events in 'master-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000002	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
-master-bin.000002	#	Query	1	#	use `test`; create table t3 (a int)ENGINE=NDB
-master-bin.000002	#	Query	1	#	use `test`; create table t2 (n int)ENGINE=NDB
-master-bin.000002	#	Query	1	#	BEGIN
-master-bin.000002	#	Table_map	1	#	table_id: # (test.t2)
-master-bin.000002	#	Table_map	1	#	table_id: # (mysql.ndb_apply_status)
-master-bin.000002	#	Write_rows	1	#	table_id: #
-master-bin.000002	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-master-bin.000002	#	Query	1	#	COMMIT
+master-bin.000002	#	Query	#	#	use `test`; create table t3 (a int)ENGINE=NDB
+master-bin.000002	#	Query	#	#	use `test`; create table t2 (n int)ENGINE=NDB
+master-bin.000002	#	Query	#	#	BEGIN
+master-bin.000002	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000002	#	Table_map	#	#	table_id: # (mysql.ndb_apply_status)
+master-bin.000002	#	Write_rows	#	#	table_id: #
+master-bin.000002	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000002	#	Query	#	#	COMMIT
 show binary logs;
 Log_name	File_size
 master-bin.000001	#
@@ -233,77 +231,35 @@ show binary logs;
 Log_name	File_size
 slave-bin.000001	#
 slave-bin.000002	#
-show binlog events in 'slave-bin.000001' from 4;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000001	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
-slave-bin.000001	#	Query	1	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
-slave-bin.000001	#	Query	2	#	BEGIN
-slave-bin.000001	#	Table_map	2	#	table_id: # (test.t1)
-slave-bin.000001	#	Table_map	2	#	table_id: # (mysql.ndb_apply_status)
-slave-bin.000001	#	Write_rows	2	#	table_id: #
-slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000001	#	Query	2	#	COMMIT
-slave-bin.000001	#	Query	1	#	use `test`; drop table t1
-slave-bin.000001	#	Query	1	#	use `test`; create table t1 (word char(20) not null)ENGINE=NDB
-slave-bin.000001	#	Query	2	#	BEGIN
-slave-bin.000001	#	Table_map	2	#	table_id: # (test.t1)
-slave-bin.000001	#	Table_map	2	#	table_id: # (mysql.ndb_apply_status)
-slave-bin.000001	#	Write_rows	2	#	table_id: #
-slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000001	#	Query	2	#	COMMIT
-slave-bin.000001	#	Query	1	#	use `test`; create table t3 (a int)ENGINE=NDB
-slave-bin.000001	#	Rotate	2	#	slave-bin.000002;pos=4
-show binlog events in 'slave-bin.000002' from 4;
+slave-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Table_map	#	#	table_id: # (mysql.ndb_apply_status)
+slave-bin.000001	#	Write_rows	#	#	table_id: #
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	use `test`; drop table t1
+slave-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=NDB
+slave-bin.000001	#	Query	#	#	BEGIN
+slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+slave-bin.000001	#	Table_map	#	#	table_id: # (mysql.ndb_apply_status)
+slave-bin.000001	#	Write_rows	#	#	table_id: #
+slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Query	#	#	use `test`; create table t3 (a int)ENGINE=NDB
+slave-bin.000001	#	Rotate	#	#	slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000002	#	Format_desc	2	#	Server ver: VERSION, Binlog ver: 4
-slave-bin.000002	#	Query	1	#	use `test`; create table t2 (n int)ENGINE=NDB
-slave-bin.000002	#	Query	2	#	BEGIN
-slave-bin.000002	#	Table_map	2	#	table_id: # (test.t2)
-slave-bin.000002	#	Table_map	2	#	table_id: # (mysql.ndb_apply_status)
-slave-bin.000002	#	Write_rows	2	#	table_id: #
-slave-bin.000002	#	Write_rows	1	#	table_id: # flags: STMT_END_F
-slave-bin.000002	#	Query	2	#	COMMIT
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000002
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000002
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	#
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+slave-bin.000002	#	Query	#	#	use `test`; create table t2 (n int)ENGINE=NDB
+slave-bin.000002	#	Query	#	#	BEGIN
+slave-bin.000002	#	Table_map	#	#	table_id: # (test.t2)
+slave-bin.000002	#	Table_map	#	#	table_id: # (mysql.ndb_apply_status)
+slave-bin.000002	#	Write_rows	#	#	table_id: #
+slave-bin.000002	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+slave-bin.000002	#	Query	#	#	COMMIT
+Checking that both slave threads are running.
 show binlog events in 'slave-bin.000005' from 4;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
 DROP TABLE t1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result
index 5327bfde7e0..367738b21e5 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result
@@ -27,21 +27,21 @@ from mysql.ndb_apply_status;
 # since insert is done with transactional engine, expect a BEGIN
 # at <start_pos>
 
-show binlog events from <start_pos> limit 1;
+show binlog events from <binlog_start> limit 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	<start_pos>	Query	1	#	BEGIN
+master-bin.000001	#	Query	#	#	BEGIN
 
 # Now the insert, one step after
 
-show binlog events from <start_pos> limit 1,1;
+show binlog events from <binlog_start> limit 1,1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (1,2)
+master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1,2)
 
 # and the COMMIT should be at <end_pos>
 
-show binlog events from <start_pos> limit 2,1;
+show binlog events from <binlog_start> limit 2,1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Xid	1	<end_pos>	COMMIT /* XID */
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 
 begin;
 insert into t1 values (2,3);
@@ -52,18 +52,18 @@ select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
 from mysql.ndb_apply_status;
 @log_name:=log_name	@start_pos:=start_pos	@end_pos:=end_pos
 <log_name>	<start_pos>	<end_pos>
-show binlog events from <start_pos> limit 1;
+show binlog events from <binlog_start> limit 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	<start_pos>	Query	1	#	BEGIN
+master-bin.000001	#	Query	#	#	BEGIN
 
-show binlog events from <start_pos> limit 1,2;
+show binlog events from <binlog_start> limit 1,2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (2,3)
 master-bin.000001	#	Query	#	#	use `test`; insert into t2 values (3,4)
 
-show binlog events from <start_pos> limit 3,1;
+show binlog events from <binlog_start> limit 3,1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Xid	1	<end_pos>	COMMIT /* XID */
+master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 
 DROP TABLE test.t1, test.t2;
 SHOW TABLES;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
index b61f5550719..49d068d5fe4 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
@@ -68,47 +68,7 @@ CHANGE MASTER TO
 master_log_file = 'master-bin.000001',
 master_log_pos = <the_pos> ;
 START SLAVE;
-SHOW SLAVE STATUS;
-Slave_IO_State	<Slave_IO_State>
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	MASTER_PORT
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	<Read_Master_Log_Pos>
-Relay_Log_File	<Relay_Log_File>
-Relay_Log_Pos	<Relay_Log_Pos>
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	<Replicate_Ignore_Table>
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	<Exec_Master_Log_Pos>
-Relay_Log_Space	<Relay_Log_Space>
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	<Seconds_Behind_Master>
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	<Last_IO_Errno>
-Last_IO_Error	<Last_IO_Error>
-Last_SQL_Errno	0
-Last_SQL_Error	
-Replicate_Ignore_Server_Ids	
-Master_Server_Id	1
+Checking that both slave threads are running.
 SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
 hex(c1)	hex(c2)	c3
 1	1	row1
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result
index 603bb61e2d5..3839bfe0b2e 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result
@@ -436,8 +436,7 @@ DELETE FROM t1;
 SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
 COUNT(*)	0
 set @@global.slave_exec_mode= default;
-Last_SQL_Error
-
+Checking that both slave threads are running.
 SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
 COUNT(*)	0
 **** Test for BUG#37076 ****
@@ -498,8 +497,7 @@ Comparing tables master:test.t4 and slave:test.t4
 [expecting slave to stop]
 INSERT INTO t5 VALUES (1, "", 1);
 INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
-Last_SQL_Error
-Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)'
+Last_SQL_Error = Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)'
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;
@@ -507,8 +505,7 @@ START SLAVE;
 [expecting slave to stop]
 INSERT INTO t6 VALUES (1, "", 1);
 INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
-Last_SQL_Error
-Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)'
+Last_SQL_Error = Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)'
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
index 04ef7f31b7c..69f630c856a 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
@@ -195,9 +195,9 @@ source include/wait_for_slave_sql_to_stop.inc;
 
 # Replication should have stopped, since max retries were not enough.
 # verify with show slave status
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 19 <Last_Errno> 20 <Last_Error> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error> 37 <Last_SQL_Errno> 38 <Last_SQL_Error>
---query_vertical SHOW SLAVE STATUS;
+# 1205 = ER_LOCK_WAIT_TIMEOUT 
+--let $slave_sql_errno= 1205 
+--source include/wait_for_slave_sql_error.inc
 
 # now set max retries high enough to succeed, and start slave again
 set GLOBAL slave_transaction_retries=10;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test
index 4ba7e643779..1aae0d2d57f 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test
@@ -114,7 +114,7 @@ INSERT INTO t_slave_stmt VALUES (1);
 --connection slave
 # 1664 = ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE
 --let $slave_sql_errno= 1664
---let $show_sql_error= 1
+--let $show_slave_sql_error= 1
 --source include/wait_for_slave_sql_error_and_skip.inc
 --connection slave
 SELECT * FROM t_slave_stmt /* should be empty */;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
index bfa50537430..b8b7c520973 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
@@ -19,9 +19,7 @@ START SLAVE;
 --connection slave
 CREATE TABLE t1 (a int key, b int) ENGINE=ndb;
 #CREATE TABLE t2 (a int key, b int) ENGINE=ndb;
---save_master_pos
---connection master
---sync_with_master
+sync_slave_with_master master;
 # now we should have a table on the master as well
 SHOW TABLES;
 
@@ -33,25 +31,19 @@ INSERT INTO t1 VALUES (2,3);
 
 # ensure data has propagated both ways
 --connection slave
---save_master_pos
---connection master
---sync_with_master
+sync_slave_with_master master;
 --sync_slave_with_master
 
 # connect to slave and ensure data it there.
 --connection slave
 SELECT * FROM t1 ORDER BY a;
 #SELECT * FROM t2 ORDER BY a;
-# BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical show slave status;
+source include/check_slave_is_running.inc;
 # connect to master and ensure data it there.
 --connection master
 SELECT * FROM t1 ORDER BY a;
 #SELECT * FROM t2 ORDER BY a;
-# BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
---query_vertical show slave status;
+source include/check_slave_is_running.inc;
 
 # stop replication on "master" as not to replicate
 # shutdown circularly, eg drop table
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
index 92f7aaebcd4..74e841c6c4d 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
@@ -41,9 +41,7 @@ eval CHANGE MASTER TO MASTER_HOST="127.0.0.1",MASTER_PORT=$SLAVE_MYPORT,MASTER_U
 START SLAVE;
 
 connection slave;
-save_master_pos;
-connection master;
-sync_with_master;
+sync_slave_with_master master;
 
 # The statement is disabled since it cannot reliably show the same
 # info all the time.  Use it for debug purposes.
@@ -51,9 +49,7 @@ sync_with_master;
 #SHOW BINLOG EVENTS;
 
 # Check that there is no error in replication
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+source include/check_slave_is_running.inc;
 
 # Check that we have the data on the master
 SELECT * FROM t1 ORDER BY a;
@@ -78,9 +74,7 @@ sync_with_master;
 SELECT * FROM t1 ORDER BY a;
 
 # Check that there is no error in replication
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
-query_vertical SHOW SLAVE STATUS;
+source include/check_slave_is_running.inc;
 
 connection master;
 DROP TABLE t1;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test
index 3133ad34f0c..99c9df40094 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test
@@ -39,12 +39,9 @@ SELECT * FROM t1 ORDER BY c3;
 
 # check that we have it on the slave
 --sync_slave_with_master
---connection slave
 SELECT * FROM t1 ORDER BY c3;
 
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error>
-SHOW SLAVE STATUS;
+source include/check_slave_is_running.inc;
 
 # stop slave and reset position to before the last changes
 STOP SLAVE;
@@ -53,9 +50,7 @@ eval CHANGE MASTER TO
   master_log_file = '$the_file',
   master_log_pos = $the_pos ;
 
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error>
-SHOW SLAVE STATUS;
+source include/check_slave_no_error.inc;
 
 # start the slave again
 # -> same events should have been applied again
@@ -67,7 +62,6 @@ START SLAVE;
 --connection master
 SELECT * FROM t1 ORDER BY c3;
 --sync_slave_with_master
---connection slave
 SELECT * FROM t1 ORDER BY c3;
 
 STOP SLAVE;
@@ -106,9 +100,7 @@ COMMIT;
 --sync_slave_with_master
 --connection slave
 SELECT * FROM t1;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 34 <Last_IO_Errno> 35 <Last_IO_Error>
-SHOW SLAVE STATUS;
+source include/check_slave_is_running.inc;
 
 connection master;
 DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
index 88572c3e9a2..152839c8676 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
@@ -70,10 +70,7 @@ START SLAVE;
 #
 --connection master
 --sync_slave_with_master
---connection slave
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error>
-query_vertical SHOW SLAVE STATUS;
+--source include/check_slave_is_running.inc
 
 SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
 SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_func.result b/mysql-test/suite/sys_vars/r/slow_query_log_func.result
index eb7efe4a004..fb650399597 100644
--- a/mysql-test/suite/sys_vars/r/slow_query_log_func.result
+++ b/mysql-test/suite/sys_vars/r/slow_query_log_func.result
@@ -36,5 +36,78 @@ SELECT count(*) > 0 FROM mysql.slow_log;
 count(*) > 0
 1
 DROP PROCEDURE p_test;
+Bug53191 Lock_time in slow log is negative when logging stored routines
+TRUNCATE mysql.slow_log;
+CREATE TABLE t1 (c0 INT PRIMARY KEY AUTO_INCREMENT, c1 TIMESTAMP, c2 TIMESTAMP);
+CREATE FUNCTION f_slow_now() RETURNS TIMESTAMP
+BEGIN
+DO SLEEP(2);
+RETURN NOW();
+END//
+CREATE FUNCTION f_slow_current_time() RETURNS TIME
+BEGIN
+DO SLEEP(2);
+RETURN CURRENT_TIME();
+END
+//
+INSERT INTO t1 (c1,c2) VALUES (now(), f_slow_now())//
+CREATE TRIGGER tf_before BEFORE INSERT ON t1
+FOR EACH ROW BEGIN
+SET new.c2 = f_slow_now();
+END//
+CREATE PROCEDURE p1()
+BEGIN
+INSERT INTO t1 (c1,c2) values (now(),now());
+DO SLEEP(2);
+INSERT INTO t1 (c1,c2) values (now(),now());
+end//
+INSERT INTO t1 (c1,c2) VALUES (now(), now());
+CALL p1();
+SELECT c1-c2 FROM t1;
+c1-c2
+0
+0
+0
+0
+*** There shouldn't less than 1 s difference between each row
+SELECT t1.c1-self.c1 > 1 FROM t1, t1 as self WHERE t1.c0=self.c0+1 ORDER BY t1.c0;
+t1.c1-self.c1 > 1
+1
+1
+1
+DROP TRIGGER tf_before;
+DROP FUNCTION f_slow_now;
+DROP FUNCTION f_slow_current_time;
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note	1051	Unknown table 't1'
+CREATE TABLE t1(c1 INT) ENGINE=MyISAM;
+DROP PROCEDURE IF EXISTS p1;
+CREATE PROCEDURE p1()
+BEGIN
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) FROM t1 WHERE c1= 1;
+UPDATE t1 SET c1=c1*2;
+END|
+Connection 2
+LOCK TABLE t1 WRITE;
+Back to default connection
+CALL p1();
+Wait three seconds and unlock the table
+UNLOCK TABLES;
+COUNT(*)
+1
+Slow log:
+**** 1 == we have slow log entries
+SELECT count(*) > 0 FROM mysql.slow_log;
+count(*) > 0
+1
+**** 0 == None of the entries have a lock time greater than 10 s
+SELECT count(*) FROM mysql.slow_log WHERE lock_time > 10;
+count(*)
+0
+DROP TABLE t1;
+DROP PROCEDURE p1;
 SET @@global.log_output = @global_log_output;
 SET @global.slow_query_log = @global_slow_query_log;
diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_func.test
index 250d5210c46..dd202ec20ff 100644
--- a/mysql-test/suite/sys_vars/t/slow_query_log_func.test
+++ b/mysql-test/suite/sys_vars/t/slow_query_log_func.test
@@ -51,8 +51,93 @@ CALL p_test();
 SELECT count(*) > 0 FROM mysql.slow_log;
 DROP PROCEDURE p_test;
 
+#==============================================================================
+--echo Bug53191 Lock_time in slow log is negative when logging stored routines
+#==============================================================================
+TRUNCATE mysql.slow_log;
+connect (con2,localhost,root,,);
+connection default;
 
-#restore
+CREATE TABLE t1 (c0 INT PRIMARY KEY AUTO_INCREMENT, c1 TIMESTAMP, c2 TIMESTAMP);
+delimiter //;
+CREATE FUNCTION f_slow_now() RETURNS TIMESTAMP
+BEGIN
+  DO SLEEP(2);
+  RETURN NOW();
+END//
+
+CREATE FUNCTION f_slow_current_time() RETURNS TIME
+BEGIN
+  DO SLEEP(2);
+  RETURN CURRENT_TIME();
+END
+//
+
+INSERT INTO t1 (c1,c2) VALUES (now(), f_slow_now())//
+
+CREATE TRIGGER tf_before BEFORE INSERT ON t1
+FOR EACH ROW BEGIN
+   SET new.c2 = f_slow_now();
+END//
+
+CREATE PROCEDURE p1()
+BEGIN
+  INSERT INTO t1 (c1,c2) values (now(),now());
+  DO SLEEP(2);
+  INSERT INTO t1 (c1,c2) values (now(),now());
+end//
+
+delimiter ;//
+
+INSERT INTO t1 (c1,c2) VALUES (now(), now());
+CALL p1();
+
+SELECT c1-c2 FROM t1;
+--echo *** There shouldn't less than 1 s difference between each row
+SELECT t1.c1-self.c1 > 1 FROM t1, t1 as self WHERE t1.c0=self.c0+1 ORDER BY t1.c0; 
+
+DROP TRIGGER tf_before;
+DROP FUNCTION f_slow_now;
+DROP FUNCTION f_slow_current_time;
+DROP TABLE t1;
+
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(c1 INT) ENGINE=MyISAM;
+DROP PROCEDURE IF EXISTS p1;
+delimiter |; 
+CREATE PROCEDURE p1()
+BEGIN
+  INSERT INTO t1 VALUES (1);
+  SELECT COUNT(*) FROM t1 WHERE c1= 1;
+  UPDATE t1 SET c1=c1*2;
+END|
+delimiter ;|
+
+--echo Connection 2
+connection con2;
+LOCK TABLE t1 WRITE;
+
+--echo Back to default connection
+connection default;
+send CALL p1();
+
+--echo Wait three seconds and unlock the table
+connection con2;
+sleep 3;
+UNLOCK TABLES;
+connection default;
+reap;
+--echo Slow log:
+--echo **** 1 == we have slow log entries
+SELECT count(*) > 0 FROM mysql.slow_log;
+--echo **** 0 == None of the entries have a lock time greater than 10 s
+SELECT count(*) FROM mysql.slow_log WHERE lock_time > 10;
+disconnect con2;
+DROP TABLE t1;
+DROP PROCEDURE p1;
+
+
+#==================================================================   Restore
 SET @@global.log_output = @global_log_output;
 SET @global.slow_query_log = @global_slow_query_log;
 
diff --git a/mysql-test/t/alter_table-big.test b/mysql-test/t/alter_table-big.test
index 1dcc1f1c9bd..e007a3a55e0 100644
--- a/mysql-test/t/alter_table-big.test
+++ b/mysql-test/t/alter_table-big.test
@@ -31,7 +31,9 @@ create table t2 (i int);
 # statement execution, so we don't need many rows in 't1' to make
 # this test repeatable.
 alter table t1 disable keys;
+--disable_warnings
 insert into t1 values (RAND()*1000, RAND()*1000, RAND()*1000);
+--enable_warnings
 
 # Later we use binlog to check the order in which statements are
 # executed so let us reset it first.
@@ -50,8 +52,7 @@ connection default;
 --reap
 set session debug="-d,sleep_alter_enable_indexes";
 # Check that statements were executed/binlogged in correct order.
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
 
 # Clean up
 drop tables t1, t2;
@@ -111,8 +112,7 @@ drop table t3;
 set session debug="-d,sleep_alter_before_main_binlog";
 
 # Check that all statements were logged in correct order
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
 
 
 --echo End of 5.1 tests
diff --git a/mysql-test/t/archive_plugin-master.opt b/mysql-test/t/archive_plugin-master.opt
index 28e7a6a2831..36b21a74922 100644
--- a/mysql-test/t/archive_plugin-master.opt
+++ b/mysql-test/t/archive_plugin-master.opt
@@ -1 +1 @@
---plugin_dir=../storage/archive/.libs
+--plugin_dir=$ARCHIVE_PLUGIN_DIR
diff --git a/mysql-test/t/archive_plugin.test b/mysql-test/t/archive_plugin.test
index 18b7cddc7d3..567a0a58ce7 100644
--- a/mysql-test/t/archive_plugin.test
+++ b/mysql-test/t/archive_plugin.test
@@ -1,6 +1,10 @@
 --source include/not_windows.inc
 --source include/have_archive_plugin.inc
 
+# When running in parallel we get
+# Warning 1620 Plugin is busy and will be uninstalled on shutdown
+--source include/not_parallel.inc
+
 CREATE TABLE t1(a int) ENGINE=ARCHIVE;
 DROP TABLE t1;
 
diff --git a/mysql-test/t/blackhole_plugin-master.opt b/mysql-test/t/blackhole_plugin-master.opt
index dff15c6f136..e78cd2b1662 100644
--- a/mysql-test/t/blackhole_plugin-master.opt
+++ b/mysql-test/t/blackhole_plugin-master.opt
@@ -1 +1 @@
---plugin_dir=../storage/blackhole/.libs
+--plugin_dir=$BLACKHOLE_PLUGIN_DIR
diff --git a/mysql-test/t/blackhole_plugin.test b/mysql-test/t/blackhole_plugin.test
index 5c712233dc7..1de5b2d0499 100644
--- a/mysql-test/t/blackhole_plugin.test
+++ b/mysql-test/t/blackhole_plugin.test
@@ -1,6 +1,10 @@
 --source include/not_windows.inc
 --source include/have_blackhole_plugin.inc
 
+# When running in parallel we get
+# Warning 1620 Plugin is busy and will be uninstalled on shutdown
+--source include/not_parallel.inc
+
 CREATE TABLE t1(a int) ENGINE=BLACKHOLE;
 DROP TABLE t1;
 
diff --git a/mysql-test/t/create-big.test b/mysql-test/t/create-big.test
index 6cd6326cdb8..e1dfbbd4ac4 100644
--- a/mysql-test/t/create-big.test
+++ b/mysql-test/t/create-big.test
@@ -305,8 +305,7 @@ connection default;
 show create table t2;
 drop table t2;
 # Let us check that statements were executed/binlogged in correct order
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
 
 # Now let us check the gap between check for target table
 # existance and copying of .frm file. 
@@ -330,8 +329,7 @@ drop table t1;
 connection default;
 --reap
 drop table t2;
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
 
 # And now he gap between copying of .frm file and ha_create_table() call. 
 create table t1 (i int);
@@ -359,8 +357,7 @@ drop table t1;
 connection default;
 --reap
 drop table t2;
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
 
 # Finally we check the gap between ha_create_table() and binlogging
 create table t1 (i int);
@@ -386,7 +383,6 @@ drop table t1;
 connection default;
 --reap
 drop table t2;
---replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+source include/show_binlog_events.inc;
 
 set session debug="-d,sleep_create_like_before_binlogging";
diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test
index 38b51d265ad..c36dcf4dc2d 100644
--- a/mysql-test/t/ctype_cp932_binlog_stm.test
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
@@ -12,6 +12,7 @@ CALL mtr.add_suppression("Unsafe statement written to the binary log using state
 #
 # Bug#18293: Values in stored procedure written to binlog unescaped
 #
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
 
 delimiter |;
 CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
@@ -27,7 +28,7 @@ CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)|
 SELECT HEX(s1),HEX(s2),d FROM t4|
 DROP PROCEDURE bug18293|
 DROP TABLE t4|
-SHOW BINLOG EVENTS FROM 514|
+source include/show_binlog_events.inc|
 delimiter ;|
 
 --echo End of 5.0 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index cf64289bb5d..7b14c332233 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -13,5 +13,6 @@ kill                     : Bug#37780 2008-12-03 HHunger need some changes to be
 query_cache_28249        : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
 sp_sync                  : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution
 plugin_load              : Bug#42144 2009-12-21 alik plugin_load fails
+partition_innodb_plugin  : Bug#53307 2010-04-30 VasilDimov valgrind warnings
 mysqlhotcopy_myisam      : bug#54129 2010-06-04 Horst
 mysqlhotcopy_archive     : bug#54129 2010-06-04 Horst
diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test
index 7cd16a6bc5a..7a48a2e3231 100644
--- a/mysql-test/t/error_simulation.test
+++ b/mysql-test/t/error_simulation.test
@@ -46,6 +46,20 @@ SELECT * FROM t1;
 DROP TABLE t1;
 
 
+--echo #
+--echo # Bug#42064: low memory crash when importing hex strings, in Item_hex_string::Item_hex_string
+--echo #
+
+CREATE TABLE t1(a BLOB);
+
+SET SESSION debug="+d,bug42064_simulate_oom";
+# May fail with either ER_OUT_OF_RESOURCES or EE_OUTOFMEMORY
+--error ER_OUT_OF_RESOURCES, 5
+INSERT INTO t1 VALUES("");
+SET SESSION debug=DEFAULT;
+
+DROP TABLE t1;
+
 --echo #
 --echo # End of 5.1 tests
 --echo #
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
index 72406110de1..60108b3b038 100644
--- a/mysql-test/t/explain.test
+++ b/mysql-test/t/explain.test
@@ -223,4 +223,19 @@ EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND
 
 DROP TABLE t1, t2;
 
+--echo #
+--echo # Bug #48573: difference of index selection between rpm binary and
+--echo #             .tar.gz, windows vs linux..
+--echo #
+
+CREATE TABLE t1(c1 INT, c2 INT, c4 INT, c5 INT, KEY(c2, c5), KEY(c2, c4, c5));
+INSERT INTO t1 VALUES(4, 1, 1, 1);
+INSERT INTO t1 VALUES(3, 1, 1, 1);
+INSERT INTO t1 VALUES(2, 1, 1, 1);
+INSERT INTO t1 VALUES(1, 1, 1, 1);
+
+EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 AND c4 = 1 AND c5 = 1;
+
+DROP TABLE t1;
+
 --echo End of 5.1 tests.
diff --git a/mysql-test/t/flush_block_commit_notembedded.test b/mysql-test/t/flush_block_commit_notembedded.test
index d7ffbd475b4..7e3f4838ffb 100644
--- a/mysql-test/t/flush_block_commit_notembedded.test
+++ b/mysql-test/t/flush_block_commit_notembedded.test
@@ -28,14 +28,14 @@ SELECT 1;
 --echo # Switch to connection con2
 connection con2;
 FLUSH TABLES WITH READ LOCK;
-SHOW MASTER STATUS;
+--source include/show_binlog_events.inc
 --echo # Switch to connection con1
 connection con1;
 send INSERT INTO t1 VALUES (1);
 --echo # Switch to connection con2
 connection con2;
 sleep 1;
-SHOW MASTER STATUS;
+--source include/show_binlog_events.inc
 UNLOCK TABLES;
 --echo # Switch to connection con1
 connection con1;
diff --git a/mysql-test/t/func_isnull.test b/mysql-test/t/func_isnull.test
index 424f6dc6640..326574e0515 100644
--- a/mysql-test/t/func_isnull.test
+++ b/mysql-test/t/func_isnull.test
@@ -14,6 +14,21 @@ drop table t1;
 
 # End of 4.1 tests
 
+--echo #
+--echo # Bug#53933 crash when using uncacheable subquery in the having clause of outer query
+--echo #
+
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (0),(0);
+
+SELECT ISNULL((SELECT GET_LOCK('Bug#53933', 0) FROM t1 GROUP BY f1)) AS f2
+FROM t1 GROUP BY f1 HAVING f2 = f2;
+SELECT RELEASE_LOCK('Bug#53933');
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests
+
 #
 # Bug #41371    Select returns 1 row with condition "col is not null and col is null"
 #
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index 5701e975569..fa52da63195 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -1085,6 +1085,21 @@ INSERT INTO t1 VALUES (1), (2), (3);
 --source include/min_null_cond.inc
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#53859: Valgrind: opt_sum_query(TABLE_LIST*, List<Item>&, Item*) at
+--echo # opt_sum.cc:305
+--echo #
+CREATE TABLE t1 ( a INT, KEY (a) );
+INSERT INTO t1 VALUES (1), (2), (3); 
+
+SELECT MIN( a ) AS min_a
+FROM t1
+WHERE a > 1 AND a IS NULL
+ORDER BY min_a;
+
+DROP TABLE t1;
+
+
 --echo End of 5.1 tests
 
 
diff --git a/mysql-test/t/handler_myisam.test b/mysql-test/t/handler_myisam.test
index 868ba14480a..e78072ef8a0 100644
--- a/mysql-test/t/handler_myisam.test
+++ b/mysql-test/t/handler_myisam.test
@@ -48,4 +48,53 @@ HANDLER t1 READ a NEXT;
 HANDLER t1 CLOSE;
 DROP TABLE t1;
 
+
+--echo #
+--echo # Bug #54007: assert in ha_myisam::index_next , HANDLER
+--echo #
+CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a), KEY b(b), KEY ab(a, b));
+
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+HANDLER t1 READ `PRIMARY` NEXT;
+HANDLER t1 READ ab NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 CLOSE;
+
+INSERT INTO t1 VALUES (2, 20), (1, 10), (4, 40), (3, 30);
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ `PRIMARY` NEXT;
+HANDLER t1 READ `PRIMARY` NEXT;
+HANDLER t1 READ ab NEXT;
+HANDLER t1 READ ab NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 CLOSE;
+
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+HANDLER t1 READ `PRIMARY` PREV;
+HANDLER t1 READ `PRIMARY` PREV;
+HANDLER t1 READ b PREV;
+HANDLER t1 READ b PREV;
+HANDLER t1 CLOSE;
+
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST;
+HANDLER t1 READ `PRIMARY` PREV LIMIT 3;
+HANDLER t1 READ b NEXT LIMIT 5;
+HANDLER t1 CLOSE;
+
+DROP TABLE t1;
+
+
 --echo End of 5.1 tests
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index aaea8b3120b..cf881e6aaa2 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -936,4 +936,49 @@ FROM t1 tt3 LEFT  OUTER JOIN t1 tt4 ON 1
 
 SET optimizer_search_depth = DEFAULT;
 DROP TABLE t1;
+
+--echo #
+--echo # Bug#46091 STRAIGHT_JOIN + RIGHT JOIN returns different result
+--echo #
+CREATE TABLE t1 (f1 INT NOT NULL);
+INSERT INTO t1 VALUES (9),(0);
+
+CREATE TABLE t2 (f1 INT NOT NULL);
+INSERT INTO t2 VALUES
+(5),(3),(0),(3),(1),(0),(1),(7),(1),(0),(0),(8),(4),(9),(0),(2),(0),(8),(5),(1);
+
+SELECT STRAIGHT_JOIN COUNT(*) FROM t1 TA1
+RIGHT JOIN t2 TA2 JOIN t2 TA3 ON TA2.f1 ON TA3.f1;
+
+EXPLAIN SELECT STRAIGHT_JOIN COUNT(*) FROM t1 TA1
+RIGHT JOIN t2 TA2 JOIN t2 TA3 ON TA2.f1 ON TA3.f1;
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#48971 Segfault in add_found_match_trig_cond () at sql_select.cc:5990
+--echo #
+CREATE TABLE t1(f1 INT, PRIMARY KEY (f1));
+INSERT INTO t1 VALUES (1),(2);
+
+EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
+ LEFT JOIN t1 AS jt2
+  RIGHT JOIN t1 AS jt3
+    JOIN t1 AS jt4 ON 1
+   LEFT JOIN t1 AS jt5 ON 1
+  ON 1
+  RIGHT JOIN t1 AS jt6 ON jt6.f1
+ ON 1;
+
+EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
+ RIGHT JOIN t1 AS jt2
+  RIGHT JOIN t1 AS jt3
+    JOIN t1 AS jt4 ON 1
+   LEFT JOIN t1 AS jt5 ON 1
+  ON 1
+  RIGHT JOIN t1 AS jt6 ON jt6.f1
+ ON 1;
+
+DROP TABLE t1;
+
 --echo End of 5.1 tests
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index c10a7d82c43..27c4cc8a75c 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -550,4 +550,24 @@ let $MYSQLD_DATADIR= `select @@datadir`;
 remove_file $MYSQLD_DATADIR/test/t1.txt;
 
 
+--echo #
+--echo # Bug #52512 : Assertion `! is_set()' in 
+--echo #  Diagnostics_area::set_ok_status on LOAD DATA
+--echo #
+
+connect (con1,localhost,root,,test);
+
+CREATE TABLE t1 (id INT NOT NULL);
+--send LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1
+# please keep this is a spearate test file : it's important to have no
+# commands after this one
+
+connection default;
+dirty_close con1;
+
+connect (con1,localhost,root,,test);
+DROP TABLE t1;
+connection default;
+disconnect con1;
+
 --echo End of 5.1 tests
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 0db6c44873d..7a81ad496b4 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -586,7 +586,7 @@ reset master;
 UPDATE t2,t1 SET t2.a=t1.a+2;
 # check
 select * from t2 /* must be (3,1), (4,4) */;
-show master status /* there must be the UPDATE query event */;
+source include/show_binlog_events.inc;
 
 # B. testing multi_update::send_error() ineffective update
 # (as there is a policy described at mysql_update() still go to binlog)
@@ -597,7 +597,7 @@ insert into t2 values (1,2),(3,4),(4,4);
 reset master;
 --error ER_DUP_ENTRY
 UPDATE t2,t1  SET t2.a=t2.b where t2.a=t1.a;
-show master status /* there must be the UPDATE query event */;
+source include/show_binlog_events.inc;
 
 # cleanup
 drop table t1, t2;
diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test
index d1b152c8799..1496a626796 100644
--- a/mysql-test/t/partition_error.test
+++ b/mysql-test/t/partition_error.test
@@ -8,6 +8,34 @@
 drop table if exists t1;
 --enable_warnings
 
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+--echo #
+--echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
+--echo #
+CREATE TABLE t1 (a INT) PARTITION BY HASH (a);
+FLUSH TABLES;
+--remove_file $MYSQLD_DATADIR/test/t1.par
+--replace_result $MYSQLD_DATADIR ./
+CHECK TABLE t1;
+--error ER_FAILED_READ_FROM_PAR_FILE
+SELECT * FROM t1;
+--echo # Note that it is currently impossible to drop a partitioned table
+--echo # without the .par file
+--error ER_BAD_TABLE_ERROR
+DROP TABLE t1;
+--remove_file $MYSQLD_DATADIR/test/t1.frm
+--remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYI
+--remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYD
+
+--echo #
+--echo # Bug#49477: Assertion `0' failed in ha_partition.cc:5530
+--echo # with temporary table and partitions
+--echo #
+CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
+--error ER_PARTITION_NO_TEMPORARY
+CREATE TEMPORARY TABLE tmp_t1 LIKE t1;
+DROP TABLE t1;
 --echo #
 --echo # Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with
 --echo #            subpartitions
@@ -191,7 +219,6 @@ partitions 3
  partition x2 tablespace ts2,
  partition x3 tablespace ts3);
 
-let $MYSQLD_DATADIR= `select @@datadir`;
 select load_file('$MYSQLD_DATADIR/test/t1.par');
 #
 # Partition by hash, invalid field in function
diff --git a/mysql-test/t/sp_trans_log.test b/mysql-test/t/sp_trans_log.test
index 68467f71ee1..f162ee5cea6 100644
--- a/mysql-test/t/sp_trans_log.test
+++ b/mysql-test/t/sp_trans_log.test
@@ -34,7 +34,6 @@ end|
 reset master|
 --error ER_DUP_ENTRY
 insert into t2 values (bug23333(),1)| 
---replace_column 2 # 5 # 6 #
 # the following must show there is (are) events after the query */
 source include/show_binlog_events.inc|
 select count(*),@a from t1 /* must be 1,1 */|
diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test
index 3cec27d7782..84d6f58dea1 100644
--- a/mysql-test/t/type_time.test
+++ b/mysql-test/t/type_time.test
@@ -88,9 +88,18 @@ INSERT INTO t1 VALUES ('0:00:00');
 SELECT CAST(c AS TIME) FROM t1;
 DROP TABLE t1;
 
-
 --echo End of 5.0 tests
 
+--echo #
+--echo # Bug#53942 valgrind warnings with timestamp() function and incomplete datetime values
+--echo #
+
+CREATE TABLE t1(f1 TIME);
+INSERT INTO t1 VALUES ('23:38:57');
+SELECT TIMESTAMP(f1,'1') FROM t1;
+DROP TABLE t1;
+
+--echo End of 5.1 tests
 
 #
 # Bug#42664 - Sign ignored for TIME types when not comparing as longlong
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 5e9d8473b20..d865851841f 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -773,6 +773,21 @@ show variables like 'hostname';
 --echo # Test 'myisam_mmap_size' option is not dynamic
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 SET @@myisam_mmap_size= 500M;
+
+
+--echo #
+--echo # Bug #52315: utc_date() crashes when system time > year 2037
+--echo #
+
+--error 0, ER_UNKNOWN_ERROR
+SET TIMESTAMP=2*1024*1024*1024;
+--echo #Should not crash
+--disable_result_log
+SELECT UTC_DATE();
+--enable_result_log
+SET TIMESTAMP=DEFAULT;
+
+
 --echo End of 5.0 tests
 
 #
diff --git a/mysys/mf_wfile.c b/mysys/mf_wfile.c
index f98d348994e..4a4fb466600 100644
--- a/mysys/mf_wfile.c
+++ b/mysys/mf_wfile.c
@@ -119,6 +119,6 @@ void wf_end(WF_PACK *buffer)
 {
   DBUG_ENTER("wf_end");
   if (buffer)
-    my_free((uchar*) buffer,MYF(0));
+    my_free(buffer, MYF(0));
   DBUG_VOID_RETURN;
 } /* wf_end */
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index 9c45cdc2277..19e51880209 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -154,6 +154,14 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
 
   DBUG_ASSERT(alloc_root_inited(mem_root));
 
+  DBUG_EXECUTE_IF("simulate_out_of_memory",
+                  {
+                    if (mem_root->error_handler)
+                      (*mem_root->error_handler)();
+                    DBUG_SET("-d,simulate_out_of_memory");
+                    DBUG_RETURN((void*) 0); /* purecov: inspected */
+                  });
+
   length+=ALIGN_SIZE(sizeof(USED_MEM));
   if (!(next = (USED_MEM*) my_malloc(length,MYF(MY_WME | ME_FATALERROR))))
   {
@@ -176,6 +184,14 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
   DBUG_PRINT("enter",("root: 0x%lx", (long) mem_root));
   DBUG_ASSERT(alloc_root_inited(mem_root));
 
+  DBUG_EXECUTE_IF("simulate_out_of_memory",
+                  {
+                    /* Avoid reusing an already allocated block */
+                    if (mem_root->error_handler)
+                      (*mem_root->error_handler)();
+                    DBUG_SET("-d,simulate_out_of_memory");
+                    DBUG_RETURN((void*) 0); /* purecov: inspected */
+                  });
   length= ALIGN_SIZE(length);
   if ((*(prev= &mem_root->free)) != NULL)
   {
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 9a49d537ea2..1e94dd2d761 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -22,7 +22,7 @@
 #include <errno.h>
 #include <m_string.h>
 
-typedef void (*init_func_p)(const struct my_option *option, uchar **variable,
+typedef void (*init_func_p)(const struct my_option *option, void *variable,
                             longlong value);
 
 static void default_reporter(enum loglevel level, const char *format, ...);
@@ -34,9 +34,9 @@ static longlong getopt_ll(char *arg, const struct my_option *optp, int *err);
 static ulonglong getopt_ull(char *, const struct my_option *, int *);
 static double getopt_double(char *arg, const struct my_option *optp, int *err);
 static void init_variables(const struct my_option *, init_func_p);
-static void init_one_value(const struct my_option *, uchar **, longlong);
-static void fini_one_value(const struct my_option *, uchar **, longlong);
-static int setval(const struct my_option *, uchar **, char *, my_bool);
+static void init_one_value(const struct my_option *, void *, longlong);
+static void fini_one_value(const struct my_option *, void *, longlong);
+static int setval(const struct my_option *, void *, char *, my_bool);
 static char *check_struct_option(char *cur_arg, char *key_name);
 
 /*
@@ -83,10 +83,9 @@ static void default_reporter(enum loglevel level,
   fflush(stderr);
 }
 
-static uchar** (*getopt_get_addr)(const char *, uint, const struct my_option *, int *);
+static my_getopt_value getopt_get_addr;
 
-void my_getopt_register_get_addr(uchar** (*func_addr)(const char *, uint,
-						    const struct my_option *, int *))
+void my_getopt_register_get_addr(my_getopt_value func_addr)
 {
   getopt_get_addr= func_addr;
 }
@@ -117,7 +116,7 @@ int handle_options(int *argc, char ***argv,
   char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found),
        *opt_str, key_name[FN_REFLEN];
   const struct my_option *optp;
-  uchar* *value;
+  void *value;
   int error, i;
   my_bool is_cmdline_arg= 1;
 
@@ -333,7 +332,7 @@ int handle_options(int *argc, char ***argv,
           optp->value;
         if (error)
           return error;
-  
+
 	if (optp->arg_type == NO_ARG)
 	{
 	  if (optend && (optp->var_type & GET_TYPE_MASK) != GET_BOOL)
@@ -546,7 +545,7 @@ static char *check_struct_option(char *cur_arg, char *key_name)
   Will set the option value to given value
 */
 
-static int setval(const struct my_option *opts, uchar **value, char *argument,
+static int setval(const struct my_option *opts, void *value, char *argument,
 		  my_bool set_maximum_value)
 {
   int err= 0, res= 0;
@@ -1000,7 +999,7 @@ static double getopt_double(char *arg, const struct my_option *optp, int *err)
     value		Pointer to variable
 */
 
-static void init_one_value(const struct my_option *option, uchar* *variable,
+static void init_one_value(const struct my_option *option, void *variable,
 			   longlong value)
 {
   DBUG_ENTER("init_one_value");
@@ -1075,7 +1074,7 @@ static void init_one_value(const struct my_option *option, uchar* *variable,
     value		Pointer to variable
 */
 
-static void fini_one_value(const struct my_option *option, uchar* *variable,
+static void fini_one_value(const struct my_option *option, void *variable,
 			   longlong value __attribute__ ((unused)))
 {
   DBUG_ENTER("fini_one_value");
@@ -1116,7 +1115,7 @@ static void init_variables(const struct my_option *options,
   DBUG_ENTER("init_variables");
   for (; options->name; options++)
   {
-    uchar **value;
+    void *value;
     DBUG_PRINT("options", ("name: '%s'", options->name));
     /*
       We must set u_max_value first as for some variables
@@ -1261,7 +1260,7 @@ void my_print_variables(const struct my_option *options)
   
   for (optp= options; optp->name; optp++)
   {
-    uchar **value= (optp->var_type & GET_ASK_ADDR ?
+    void *value= (optp->var_type & GET_ASK_ADDR ?
 		  (*getopt_get_addr)("", 0, optp, 0) : optp->value);
     if (value)
     {
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index 12793ad451b..13d2375eb99 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -31,13 +31,23 @@ void *my_malloc(size_t size, myf my_flags)
 
   if (!size)
     size=1;					/* Safety */
-  if ((point = (char*)malloc(size)) == NULL)
+
+  point= (char *) malloc(size);
+  DBUG_EXECUTE_IF("simulate_out_of_memory",
+                  {
+                    free(point);
+                    point= NULL;
+                  });
+
+  if (point == NULL)
   {
     my_errno=errno;
     if (my_flags & MY_FAE)
       error_handler_hook=fatal_error_handler_hook;
     if (my_flags & (MY_FAE+MY_WME))
       my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH),size);
+    DBUG_EXECUTE_IF("simulate_out_of_memory",
+                    DBUG_SET("-d,simulate_out_of_memory"););
     if (my_flags & MY_FAE)
       exit(1);
   }
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index 936248677f5..6d0f7e5dd53 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -139,6 +139,11 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
 				     size +	/* size requested */
 				     4 +	/* overrun mark */
 				     sf_malloc_endhunc);
+    DBUG_EXECUTE_IF("simulate_out_of_memory",
+                    {
+                      free(irem);
+                      irem= NULL;
+                    });
   }
   /* Check if there isn't anymore memory avaiable */
   if (!irem)
@@ -159,6 +164,8 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
     }
     DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'",
 			(long)sf_malloc_max_memory,lineno, filename));
+    DBUG_EXECUTE_IF("simulate_out_of_memory",
+                    DBUG_SET("-d,simulate_out_of_memory"););
     if (MyFlags & MY_FAE)
       exit(1);
     DBUG_RETURN ((void*) 0);
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index 28fd1e240a2..c778d72a016 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -1447,7 +1447,10 @@ Event_job_data::execute(THD *thd, bool drop)
   thd->set_query(sp_sql.c_ptr_safe(), sp_sql.length());
 
   {
-    Parser_state parser_state(thd, thd->query(), thd->query_length());
+    Parser_state parser_state;
+    if (parser_state.init(thd, thd->query(), thd->query_length()))
+      goto end;
+
     lex_start(thd);
 
     if (parse_sql(thd, & parser_state, creation_ctx))
diff --git a/sql/field.cc b/sql/field.cc
index 88a7f43819d..bfaaf10b141 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5271,7 +5271,6 @@ String *Field_time::val_str(String *val_buffer,
  
 bool Field_time::get_date(MYSQL_TIME *ltime, uint fuzzydate)
 {
-  long tmp;
   THD *thd= table ? table->in_use : current_thd;
   if (!(fuzzydate & TIME_FUZZY_DATE))
   {
@@ -5281,19 +5280,7 @@ bool Field_time::get_date(MYSQL_TIME *ltime, uint fuzzydate)
                         thd->warning_info->current_row_for_warning());
     return 1;
   }
-  tmp=(long) sint3korr(ptr);
-  ltime->neg=0;
-  if (tmp < 0)
-  {
-    ltime->neg= 1;
-    tmp=-tmp;
-  }
-  ltime->hour=tmp/10000;
-  tmp-=ltime->hour*10000;
-  ltime->minute=   tmp/100;
-  ltime->second= tmp % 100;
-  ltime->year= ltime->month= ltime->day= ltime->second_part= 0;
-  return 0;
+  return Field_time::get_time(ltime);
 }
 
 
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index d38544f9b9f..a61f5b4feea 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -277,8 +277,9 @@ static void run_query(THD *thd, char *buf, char *end,
   DBUG_ASSERT(!thd->locked_tables_mode);
 
   {
-    Parser_state parser_state(thd, thd->query(), thd->query_length());
-    mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
+    Parser_state parser_state;
+    if (!parser_state.init(thd, thd->query(), thd->query_length()))
+      mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
   }
 
   if (no_print_error && thd->is_slave_error)
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 2506e2fc8b3..a6f106be3be 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -91,7 +91,9 @@ static int partition_initialize(void *p)
   partition_hton->create= partition_create_handler;
   partition_hton->partition_flags= partition_flags;
   partition_hton->alter_table_flags= alter_table_flags;
-  partition_hton->flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN;
+  partition_hton->flags= HTON_NOT_USER_SELECTABLE |
+                         HTON_HIDDEN |
+                         HTON_TEMPORARY_NOT_SUPPORTED;
 
   return 0;
 }
@@ -360,7 +362,7 @@ bool ha_partition::initialize_partition(MEM_ROOT *mem_root)
   }
   else if (get_from_handler_file(table_share->normalized_path.str, mem_root))
   {
-    mem_alloc_error(2);
+    my_error(ER_FAILED_READ_FROM_PAR_FILE, MYF(0));
     DBUG_RETURN(1);
   }
   /*
@@ -1897,6 +1899,13 @@ uint ha_partition::del_ren_cre_table(const char *from,
   handler **file, **abort_file;
   DBUG_ENTER("del_ren_cre_table()");
 
+  /* Not allowed to create temporary partitioned tables */
+  if (create_info && create_info->options & HA_LEX_CREATE_TMP_TABLE)
+  {
+    my_error(ER_PARTITION_NO_TEMPORARY, MYF(0));
+    DBUG_RETURN(TRUE);
+  }
+
   if (get_from_handler_file(from, ha_thd()->mem_root))
     DBUG_RETURN(TRUE);
   DBUG_ASSERT(m_file_buffer);
diff --git a/sql/handler.h b/sql/handler.h
index ad26534d91d..fc49d9e647d 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -988,7 +988,7 @@ typedef struct st_ha_create_information
   ulong avg_row_length;
   ulong used_fields;
   ulong key_block_size;
-  SQL_LIST merge_list;
+  SQL_I_List<TABLE_LIST> merge_list;
   handlerton *db_type;
   /**
     Row type of the table definition.
diff --git a/sql/item.cc b/sql/item.cc
index c59a17a0ea3..05363f41d07 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -4111,7 +4111,7 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
 {
   Item **group_by_ref= NULL;
   Item **select_ref= NULL;
-  ORDER *group_list= (ORDER*) select->group_list.first;
+  ORDER *group_list= select->group_list.first;
   bool ambiguous_fields= FALSE;
   uint counter;
   enum_resolution_type resolution;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index a0b3f2c29a1..8813324262c 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1324,8 +1324,8 @@ public:
     else
     {
       args[0]->update_used_tables();
-      if ((const_item_cache= !(used_tables_cache= args[0]->used_tables())) &&
-          !with_subselect)
+      if ((const_item_cache= !(used_tables_cache= args[0]->used_tables()) &&
+          !with_subselect))
       {
 	/* Remember if the value is always NULL or never NULL */
 	cached_value= (longlong) args[0]->is_null();
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 10ef992594e..809926338af 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -252,12 +252,12 @@ bool Item_subselect::walk(Item_processor processor, bool walk_subquery,
         if (item->walk(processor, walk_subquery, argument))
           return 1;
       }
-      for (order= (ORDER*) lex->order_list.first ; order; order= order->next)
+      for (order= lex->order_list.first ; order; order= order->next)
       {
         if ((*order->item)->walk(processor, walk_subquery, argument))
           return 1;
       }
-      for (order= (ORDER*) lex->group_list.first ; order; order= order->next)
+      for (order= lex->group_list.first ; order; order= order->next)
       {
         if ((*order->item)->walk(processor, walk_subquery, argument))
           return 1;
@@ -1784,15 +1784,15 @@ int subselect_single_select_engine::prepare()
   SELECT_LEX *save_select= thd->lex->current_select;
   thd->lex->current_select= select_lex;
   if (join->prepare(&select_lex->ref_pointer_array,
-		    (TABLE_LIST*) select_lex->table_list.first,
+		    select_lex->table_list.first,
 		    select_lex->with_wild,
 		    select_lex->where,
 		    select_lex->order_list.elements +
 		    select_lex->group_list.elements,
-		    (ORDER*) select_lex->order_list.first,
-		    (ORDER*) select_lex->group_list.first,
+		    select_lex->order_list.first,
+		    select_lex->group_list.first,
 		    select_lex->having,
-		    (ORDER*) 0, select_lex,
+		    NULL, select_lex,
 		    select_lex->master_unit()))
     return 1;
   thd->lex->current_select= save_select;
@@ -2455,14 +2455,13 @@ table_map subselect_engine::calc_const_tables(TABLE_LIST *table)
 
 table_map subselect_single_select_engine::upper_select_const_tables()
 {
-  return calc_const_tables((TABLE_LIST *) select_lex->outer_select()->
-			   leaf_tables);
+  return calc_const_tables(select_lex->outer_select()->leaf_tables);
 }
 
 
 table_map subselect_union_engine::upper_select_const_tables()
 {
-  return calc_const_tables((TABLE_LIST *) unit->outer_select()->leaf_tables);
+  return calc_const_tables(unit->outer_select()->leaf_tables);
 }
 
 
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 15927c4b11e..77c45ea85f7 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -2995,7 +2995,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
 Item_func_group_concat::
 Item_func_group_concat(Name_resolution_context *context_arg,
                        bool distinct_arg, List<Item> *select_list,
-                       SQL_LIST *order_list, String *separator_arg)
+                       SQL_I_List<ORDER> *order_list, String *separator_arg)
   :tmp_table_param(0), separator(separator_arg), tree(0),
    unique_filter(NULL), table(0),
    order(0), context(context_arg),
@@ -3039,7 +3039,7 @@ Item_func_group_concat(Name_resolution_context *context_arg,
   if (arg_count_order)
   {
     ORDER **order_ptr= order;
-    for (ORDER *order_item= (ORDER*) order_list->first;
+    for (ORDER *order_item= order_list->first;
          order_item != NULL;
          order_item= order_item->next)
     {
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 99fcb14d160..b4539995632 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -1375,7 +1375,7 @@ class Item_func_group_concat : public Item_sum
 public:
   Item_func_group_concat(Name_resolution_context *context_arg,
                          bool is_distinct, List<Item> *is_select,
-                         SQL_LIST *is_order, String *is_separator);
+                         SQL_I_List<ORDER> *is_order, String *is_separator);
 
   Item_func_group_concat(THD *thd, Item_func_group_concat *item);
   ~Item_func_group_concat();
diff --git a/sql/log_event.cc b/sql/log_event.cc
index f7c6d09f98f..7778ee18f5c 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -3254,9 +3254,12 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
       thd->table_map_for_update= (table_map)table_map_for_update;
       
       /* Execute the query (note that we bypass dispatch_command()) */
-      Parser_state parser_state(thd, thd->query(), thd->query_length());
-      mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
-      log_slow_statement(thd);
+      Parser_state parser_state;
+      if (!parser_state.init(thd, thd->query(), thd->query_length()))
+      {
+        mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
+        log_slow_statement(thd);
+      }
 
       /*
         Resetting the enable_slow_log thd variable.
@@ -9144,8 +9147,35 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
     */
     if (table->key_info->flags & HA_NOSAME)
     {
-      table->file->ha_index_end();
-      goto ok;
+      /* Unique does not have non nullable part */
+      if (!(table->key_info->flags & (HA_NULL_PART_KEY)))
+      {
+        table->file->ha_index_end();
+        goto ok;
+      }
+      else
+      {
+        KEY *keyinfo= table->key_info;
+        /*
+          Unique has nullable part. We need to check if there is any field in the
+          BI image that is null and part of UNNI.
+        */
+        bool null_found= FALSE;
+        for (uint i=0; i < keyinfo->key_parts && !null_found; i++)
+        {
+          uint fieldnr= keyinfo->key_part[i].fieldnr - 1;
+          Field **f= table->field+fieldnr;
+          null_found= (*f)->is_null();
+        }
+
+        if (!null_found)
+        {
+          table->file->ha_index_end();
+          goto ok;
+        }
+
+        /* else fall through to index scan */
+      }
     }
 
     /*
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 76eda43aa48..d9b48cd134e 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -2339,8 +2339,35 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli)
     */
     if (table->key_info->flags & HA_NOSAME)
     {
-      table->file->ha_index_end();
-      DBUG_RETURN(0);
+      /* Unique does not have non nullable part */
+      if (!(table->key_info->flags & (HA_NULL_PART_KEY)))
+      {
+        table->file->ha_index_end();
+        DBUG_RETURN(0);
+      }
+      else
+      {
+        KEY *keyinfo= table->key_info;
+        /*
+          Unique has nullable part. We need to check if there is any field in the
+          BI image that is null and part of UNNI.
+        */
+        bool null_found= FALSE;
+        for (uint i=0; i < keyinfo->key_parts && !null_found; i++)
+        {
+          uint fieldnr= keyinfo->key_part[i].fieldnr - 1;
+          Field **f= table->field+fieldnr;
+          null_found= (*f)->is_null();
+        }
+
+        if (!null_found)
+        {
+          table->file->ha_index_end();
+          DBUG_RETURN(0);
+        }
+
+        /* else fall through to index scan */
+      }
     }
 
     /*
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index db0080451f2..7968d637223 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -224,9 +224,9 @@ typedef fp_except fp_except_t;
 # define fpu_control_t unsigned int
 # define _FPU_EXTENDED 0x300
 # define _FPU_DOUBLE 0x200
-# ifdef __GNUC__
-#  define _FPU_GETCW(cw) __asm__ __volatile__("fnstcw %0" : "=m" (*&cw))
-#  define _FPU_SETCW(cw) __asm__ __volatile__("fldcw %0" : : "m" (*&cw))
+# if defined(__GNUC__) || defined(__SUNPRO_CC)
+#  define _FPU_GETCW(cw) asm volatile ("fnstcw %0" : "=m" (*&cw))
+#  define _FPU_SETCW(cw) asm volatile ("fldcw %0" : : "m" (*&cw))
 # else
 #  define _FPU_GETCW(cw) (cw= 0)
 #  define _FPU_SETCW(cw)
@@ -3113,6 +3113,10 @@ void my_message_sql(uint error, const char *str, myf MyFlags)
                                 MYSQL_ERROR::WARN_LEVEL_ERROR,
                                 str);
   }
+
+  /* When simulating OOM, skip writing to error log to avoid mtr errors */
+  DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_VOID_RETURN;);
+
   if (!thd || MyFlags & ME_NOREFRESH)
     sql_print_error("%s: %s",my_progname,str); /* purecov: inspected */
   DBUG_VOID_RETURN;
@@ -3131,7 +3135,7 @@ void *my_str_malloc_mysqld(size_t size)
 
 void my_str_free_mysqld(void *ptr)
 {
-  my_free((uchar*)ptr, MYF(MY_FAE));
+  my_free(ptr, MYF(MY_FAE));
 }
 #endif /* EMBEDDED_LIBRARY */
 
@@ -3366,6 +3370,13 @@ static int init_common_variables()
 
   max_system_variables.pseudo_thread_id= (ulong)~0;
   server_start_time= flush_status_time= my_time(0);
+  /* TODO: remove this when my_time_t is 64 bit compatible */
+  if (server_start_time >= (time_t) MY_TIME_T_MAX)
+  {
+    sql_print_error("This MySQL server doesn't support dates later then 2038");
+    return 1;
+  }
+
   rpl_filter= new Rpl_filter;
   binlog_filter= new Rpl_filter;
   if (!rpl_filter || !binlog_filter)
@@ -5949,12 +5960,12 @@ DYNAMIC_ARRAY all_options;
 struct my_option my_long_options[]=
 {
   {"help", '?', "Display this help and exit.", 
-   (uchar**) &opt_help, (uchar**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+   &opt_help, &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
 #ifdef HAVE_REPLICATION
   {"abort-slave-event-count", 0,
    "Option used by mysql-test for debugging and testing of replication.",
-   (uchar**) &abort_slave_event_count,  (uchar**) &abort_slave_event_count,
+   &abort_slave_event_count,  &abort_slave_event_count,
    0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif /* HAVE_REPLICATION */
   {"allow-suspicious-udfs", 0,
@@ -5962,15 +5973,17 @@ struct my_option my_long_options[]=
    "without corresponding xxx_init() or xxx_deinit(). That also means "
    "that one can load any function from any library, for example exit() "
    "from libc.so",
-   (uchar**) &opt_allow_suspicious_udfs, (uchar**) &opt_allow_suspicious_udfs,
+   &opt_allow_suspicious_udfs, &opt_allow_suspicious_udfs,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode will also set transaction isolation level 'serializable'.", 0, 0, 0,
+  {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode "
+   "will also set transaction isolation level 'serializable'.", 0, 0, 0,
    GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.",
-   (uchar**) &my_bind_addr_str, (uchar**) &my_bind_addr_str, 0, GET_STR,
+   &my_bind_addr_str, &my_bind_addr_str, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"binlog-do-db", OPT_BINLOG_DO_DB,
-   "Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.",
+   "Tells the master it should log updates for the specified database, "
+   "and exclude all others not explicitly mentioned.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"binlog-ignore-db", OPT_BINLOG_IGNORE_DB,
    "Tells the master that updates to the given database should not be logged to the binary log.",
@@ -5979,9 +5992,8 @@ struct my_option my_long_options[]=
    "The maximum size of a row-based binary log event in bytes. Rows will be "
    "grouped into events smaller than this size if possible. "
    "The value has to be a multiple of 256.",
-   (uchar**) &opt_binlog_rows_event_max_size, 
-   (uchar**) &opt_binlog_rows_event_max_size, 0, 
-   GET_ULONG, REQUIRED_ARG, 
+   &opt_binlog_rows_event_max_size, &opt_binlog_rows_event_max_size,
+   0, GET_ULONG, REQUIRED_ARG,
    /* def_value */ 1024, /* min_value */  256, /* max_value */ ULONG_MAX, 
    /* sub_size */     0, /* block_size */ 256, 
    /* app_type */ 0
@@ -5992,25 +6004,25 @@ struct my_option my_long_options[]=
 #endif
   {"character-set-client-handshake", 0,
    "Don't ignore client side character set value sent during handshake.",
-   (uchar**) &opt_character_set_client_handshake,
-   (uchar**) &opt_character_set_client_handshake,
+   &opt_character_set_client_handshake,
+   &opt_character_set_client_handshake,
     0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
   {"character-set-filesystem", 0,
    "Set the filesystem character set.",
-   (uchar**) &character_set_filesystem_name,
-   (uchar**) &character_set_filesystem_name,
+   &character_set_filesystem_name,
+   &character_set_filesystem_name,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   {"character-set-server", 'C', "Set the default character set.",
-   (uchar**) &default_character_set_name, (uchar**) &default_character_set_name,
+   &default_character_set_name, &default_character_set_name,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   {"chroot", 'r', "Chroot mysqld daemon during startup.",
-   (uchar**) &mysqld_chroot, (uchar**) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG,
+   &mysqld_chroot, &mysqld_chroot, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
   {"collation-server", 0, "Set the default collation.",
-   (uchar**) &default_collation_name, (uchar**) &default_collation_name,
+   &default_collation_name, &default_collation_name,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   {"console", OPT_CONSOLE, "Write error output on screen; don't remove the console window on windows.",
-   (uchar**) &opt_console, (uchar**) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   &opt_console, &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0,
    0, 0, 0},
   {"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -6018,128 +6030,126 @@ struct my_option my_long_options[]=
      of initializing it here it is done in init_common_variables() due
      to a compiler bug in Sun Studio compiler. */
   {"default-storage-engine", 0, "The default storage engine for new tables",
-   (uchar**) &default_storage_engine, 0, 0, GET_STR, REQUIRED_ARG,
+   &default_storage_engine, 0, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0 },
   {"default-time-zone", 0, "Set the default time zone.",
-   (uchar**) &default_tz_name, (uchar**) &default_tz_name,
+   &default_tz_name, &default_tz_name,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
 #ifdef HAVE_OPENSSL
   {"des-key-file", 0,
    "Load keys for des_encrypt() and des_encrypt from given file.",
-   (uchar**) &des_key_file, (uchar**) &des_key_file, 0, GET_STR, REQUIRED_ARG,
+   &des_key_file, &des_key_file, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
 #endif /* HAVE_OPENSSL */
 #ifdef HAVE_REPLICATION
   {"disconnect-slave-event-count", 0,
    "Option used by mysql-test for debugging and testing of replication.",
-   (uchar**) &disconnect_slave_event_count,
-   (uchar**) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
-   0, 0, 0},
+   &disconnect_slave_event_count, &disconnect_slave_event_count,
+   0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif /* HAVE_REPLICATION */
 #ifdef HAVE_STACK_TRACE_ON_SEGV
   {"enable-pstack", 0, "Print a symbolic stack trace on failure.",
-   (uchar**) &opt_do_pstack, (uchar**) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0,
+   &opt_do_pstack, &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0,
    0, 0, 0, 0},
 #endif /* HAVE_STACK_TRACE_ON_SEGV */
-  /* See how it's handled in get_one_option() */
   {"exit-info", 'T', "Used for debugging. Use at your own risk.", 0, 0, 0,
    GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"external-locking", 0, "Use system (external) locking (disabled by default).  With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running. Disable with --skip-external-locking.",
-   (uchar**) &opt_external_locking, (uchar**) &opt_external_locking,
+
+  {"external-locking", 0, "Use system (external) locking (disabled by "
+   "default).  With this option enabled you can run myisamchk to test "
+   "(not repair) tables while the MySQL server is running. Disable with "
+   "--skip-external-locking.", &opt_external_locking, &opt_external_locking,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   /* We must always support the next option to make scripts like mysqltest
      easier to do */
   {"gdb", 0,
    "Set up signals usable for debugging.",
-   (uchar**) &opt_debugging, (uchar**) &opt_debugging,
+   &opt_debugging, &opt_debugging,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef HAVE_LARGE_PAGE_OPTION
   {"super-large-pages", 0, "Enable support for super large pages.",
-   (uchar**) &opt_super_large_pages, (uchar**) &opt_super_large_pages, 0,
+   &opt_super_large_pages, &opt_super_large_pages, 0,
    GET_BOOL, OPT_ARG, 0, 0, 1, 0, 1, 0},
 #endif
   {"language", 'L',
    "Client error messages in given language. May be given as a full path. "
    "Deprecated. Use --lc-messages-dir instead.",
-   (uchar**) &lc_messages_dir_ptr, (uchar**) &lc_messages_dir_ptr, 0,
+   &lc_messages_dir_ptr, &lc_messages_dir_ptr, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"lc-messages", 0,
    "Set the language used for the error messages.",
-   (uchar**) &lc_messages, (uchar**) &lc_messages, 0, GET_STR, REQUIRED_ARG,
+   &lc_messages, &lc_messages, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0 },
   {"lc-time-names", 0,
    "Set the language used for the month names and the days of the week.",
-   (uchar**) &lc_time_names_name,
-   (uchar**) &lc_time_names_name,
+   &lc_time_names_name, &lc_time_names_name,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   {"log", 'l', "Log connections and queries to file (deprecated option, use "
-   "--general-log/--general-log-file instead).", (uchar**) &opt_logname,
-   (uchar**) &opt_logname, 0, GET_STR_ALLOC, OPT_ARG, 0, 0, 0, 0, 0, 0},
+   "--general-log/--general-log-file instead).", &opt_logname, &opt_logname,
+   0, GET_STR_ALLOC, OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"log-bin", OPT_BIN_LOG,
    "Log update queries in binary format. Optional (but strongly recommended "
    "to avoid replication problems if server's hostname changes) argument "
    "should be the chosen location for the binary log files.",
-   (uchar**) &opt_bin_logname, (uchar**) &opt_bin_logname, 0, GET_STR_ALLOC,
+   &opt_bin_logname, &opt_bin_logname, 0, GET_STR_ALLOC,
    OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"log-bin-index", 0,
    "File that holds the names for last binary log files.",
-   (uchar**) &opt_binlog_index_name, (uchar**) &opt_binlog_index_name, 0, GET_STR,
+   &opt_binlog_index_name, &opt_binlog_index_name, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.",
-   (uchar**) &myisam_log_filename, (uchar**) &myisam_log_filename, 0, GET_STR,
+   &myisam_log_filename, &myisam_log_filename, 0, GET_STR,
    OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"log-short-format", 0,
    "Don't log extra information to update and slow-query logs.",
-   (uchar**) &opt_short_log_format, (uchar**) &opt_short_log_format,
+   &opt_short_log_format, &opt_short_log_format,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"log-slow-admin-statements", 0,
-   "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open.",
-   (uchar**) &opt_log_slow_admin_statements,
-   (uchar**) &opt_log_slow_admin_statements,
-   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to "
+   "the slow log if it is open.", &opt_log_slow_admin_statements,
+   &opt_log_slow_admin_statements, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
  {"log-slow-slave-statements", 0,
   "Log slow statements executed by slave thread to the slow log if it is open.",
-  (uchar**) &opt_log_slow_slave_statements,
-  (uchar**) &opt_log_slow_slave_statements,
+  &opt_log_slow_slave_statements, &opt_log_slow_slave_statements,
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"log-slow-queries", OPT_SLOW_QUERY_LOG,
    "Log slow queries to a table or log file. Defaults logging to table "
    "mysql.slow_log or hostname-slow.log if --log-output=file is used. "
    "Must be enabled to activate other slow log options. "
    "Deprecated option, use --slow-query-log/--slow-query-log-file instead.",
-   (uchar**) &opt_slow_logname, (uchar**) &opt_slow_logname, 0, GET_STR_ALLOC, OPT_ARG,
+   &opt_slow_logname, &opt_slow_logname, 0, GET_STR_ALLOC, OPT_ARG,
    0, 0, 0, 0, 0, 0},
   {"log-tc", 0,
    "Path to transaction coordinator log (used for transactions that affect "
    "more than one storage engine, when binary log is disabled).",
-   (uchar**) &opt_tc_log_file, (uchar**) &opt_tc_log_file, 0, GET_STR,
+   &opt_tc_log_file, &opt_tc_log_file, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef HAVE_MMAP
   {"log-tc-size", 0, "Size of transaction coordinator log.",
-   (uchar**) &opt_tc_log_size, (uchar**) &opt_tc_log_size, 0, GET_ULONG,
+   &opt_tc_log_size, &opt_tc_log_size, 0, GET_ULONG,
    REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ULONG_MAX, 0,
    TC_LOG_PAGE_SIZE, 0},
 #endif
   {"master-info-file", 0,
-   "The location and name of the file that remembers the master and where the I/O replication \
-thread is in the master's binlogs.",
-   (uchar**) &master_info_file, (uchar**) &master_info_file, 0, GET_STR,
+   "The location and name of the file that remembers the master and where "
+   "the I/O replication thread is in the master's binlogs.",
+   &master_info_file, &master_info_file, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"master-retry-count", 0,
    "The number of tries the slave will make to connect to the master before giving up.",
-   (uchar**) &master_retry_count, (uchar**) &master_retry_count, 0, GET_ULONG,
+   &master_retry_count, &master_retry_count, 0, GET_ULONG,
    REQUIRED_ARG, 3600*24, 0, 0, 0, 0, 0},
 #ifdef HAVE_REPLICATION
   {"init-rpl-role", 0, "Set the replication role.",
-    (uchar**)&rpl_status, (uchar**)&rpl_status, &rpl_role_typelib,
+   &rpl_status, &rpl_status, &rpl_role_typelib,
    GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"max-binlog-dump-events", 0,
    "Option used by mysql-test for debugging and testing of replication.",
-   (uchar**) &max_binlog_dump_events, (uchar**) &max_binlog_dump_events, 0,
+   &max_binlog_dump_events, &max_binlog_dump_events, 0,
    GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif /* HAVE_REPLICATION */
-  {"memlock", 0, "Lock mysqld in memory.", (uchar**) &locked_in_memory,
-   (uchar**) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"memlock", 0, "Lock mysqld in memory.", &locked_in_memory,
+   &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"one-thread", OPT_ONE_THREAD,
    "(Deprecated): Only use one thread (for debugging under Linux). Use "
    "thread-handling=no-threads instead.",
@@ -6147,67 +6157,88 @@ thread is in the master's binlogs.",
   {"old-style-user-limits", 0,
    "Enable old-style user limits (before 5.0.3, user resources were counted "
    "per each user+host vs. per account).",
-   (uchar**) &opt_old_style_user_limits, (uchar**) &opt_old_style_user_limits,
+   &opt_old_style_user_limits, &opt_old_style_user_limits,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"port-open-timeout", 0,
    "Maximum time in seconds to wait for the port to become free. "
-   "(Default: No wait).", (uchar**) &mysqld_port_timeout,
-   (uchar**) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "(Default: No wait).", &mysqld_port_timeout, &mysqld_port_timeout, 0,
+   GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"replicate-do-db", OPT_REPLICATE_DO_DB,
-   "Tells the slave thread to restrict replication to the specified database. To specify more than one database, use the directive multiple times, once for each database. Note that this will only work if you do not use cross-database queries such as UPDATE some_db.some_table SET foo='bar' while having selected a different or no database. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-do-table=db_name.%.",
+   "Tells the slave thread to restrict replication to the specified database. "
+   "To specify more than one database, use the directive multiple times, "
+   "once for each database. Note that this will only work if you do not use "
+   "cross-database queries such as UPDATE some_db.some_table SET foo='bar' "
+   "while having selected a different or no database. If you need cross "
+   "database updates to work, make sure you have 3.23.28 or later, and use "
+   "replicate-wild-do-table=db_name.%.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"replicate-do-table", OPT_REPLICATE_DO_TABLE,
-   "Tells the slave thread to restrict replication to the specified table. To specify more than one table, use the directive multiple times, once for each table. This will work for cross-database updates, in contrast to replicate-do-db.",
-   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Tells the slave thread to restrict replication to the specified table. "
+   "To specify more than one table, use the directive multiple times, once "
+   "for each table. This will work for cross-database updates, in contrast "
+   "to replicate-do-db.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"replicate-ignore-db", OPT_REPLICATE_IGNORE_DB,
-   "Tells the slave thread to not replicate to the specified database. To specify more than one database to ignore, use the directive multiple times, once for each database. This option will not work if you use cross database updates. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-ignore-table=db_name.%. ",
-   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Tells the slave thread to not replicate to the specified database. To "
+   "specify more than one database to ignore, use the directive multiple "
+   "times, once for each database. This option will not work if you use "
+   "cross database updates. If you need cross database updates to work, "
+   "make sure you have 3.23.28 or later, and use replicate-wild-ignore-"
+   "table=db_name.%. ", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"replicate-ignore-table", OPT_REPLICATE_IGNORE_TABLE,
    "Tells the slave thread to not replicate to the specified table. To specify "
    "more than one table to ignore, use the directive multiple times, once for "
    "each table. This will work for cross-database updates, in contrast to "
-   "replicate-ignore-db.",
-   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "replicate-ignore-db.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB,
-   "Updates to a database with a different name than the original. Example: replicate-rewrite-db=master_db_name->slave_db_name.",
+   "Updates to a database with a different name than the original. Example: "
+   "replicate-rewrite-db=master_db_name->slave_db_name.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef HAVE_REPLICATION
   {"replicate-same-server-id", 0,
-   "In replication, if set to 1, do not skip events having our server id. \
-Default value is 0 (to break infinite loops in circular replication). \
-Can't be set to 1 if --log-slave-updates is used.",
-   (uchar**) &replicate_same_server_id,
-   (uchar**) &replicate_same_server_id,
+   "In replication, if set to 1, do not skip events having our server id. "
+   "Default value is 0 (to break infinite loops in circular replication). "
+   "Can't be set to 1 if --log-slave-updates is used.",
+   &replicate_same_server_id, &replicate_same_server_id,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"replicate-wild-do-table", OPT_REPLICATE_WILD_DO_TABLE,
-   "Tells the slave thread to restrict replication to the tables that match the specified wildcard pattern. To specify more than one table, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-do-table=foo%.bar% will replicate only updates to tables in all databases that start with foo and whose table names start with bar.",
+   "Tells the slave thread to restrict replication to the tables that match "
+   "the specified wildcard pattern. To specify more than one table, use the "
+   "directive multiple times, once for each table. This will work for cross-"
+   "database updates. Example: replicate-wild-do-table=foo%.bar% will "
+   "replicate only updates to tables in all databases that start with foo "
+   "and whose table names start with bar.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"replicate-wild-ignore-table", OPT_REPLICATE_WILD_IGNORE_TABLE,
-   "Tells the slave thread to not replicate to the tables that match the given wildcard pattern. To specify more than one table to ignore, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-ignore-table=foo%.bar% will not do updates to tables in databases that start with foo and whose table names start with bar.",
+   "Tells the slave thread to not replicate to the tables that match the "
+   "given wildcard pattern. To specify more than one table to ignore, use "
+   "the directive multiple times, once for each table. This will work for "
+   "cross-database updates. Example: replicate-wild-ignore-table=foo%.bar% "
+   "will not do updates to tables in databases that start with foo and whose "
+   "table names start with bar.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"safe-user-create", 0,
    "Don't allow new user creation by the user who has no write privileges to the mysql.user table.",
-   (uchar**) &opt_safe_user_create, (uchar**) &opt_safe_user_create, 0, GET_BOOL,
+   &opt_safe_user_create, &opt_safe_user_create, 0, GET_BOOL,
    NO_ARG, 0, 0, 0, 0, 0, 0},
 #if !defined(DBUG_OFF) && defined(SAFEMALLOC)
   {"safemalloc", 0, "Enable the memory allocation checking.",
-   (uchar**) &sf_malloc_quick, (uchar**) &sf_malloc_quick, 0,
+   &sf_malloc_quick, &sf_malloc_quick, 0,
    GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
   {"safemalloc-mem-limit", 0, "Simulate memory shortage.",
-   (uchar**)&sf_malloc_mem_limit, (uchar**)&sf_malloc_mem_limit, 0, GET_UINT,
+   &sf_malloc_mem_limit, &sf_malloc_mem_limit, 0, GET_UINT,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"show-slave-auth-info", 0,
    "Show user and password in SHOW SLAVE HOSTS on this master.",
-   (uchar**) &opt_show_slave_auth_info, (uchar**) &opt_show_slave_auth_info, 0,
+   &opt_show_slave_auth_info, &opt_show_slave_auth_info, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 #ifndef DISABLE_GRANT_OPTIONS
   {"skip-grant-tables", 0,
    "Start without grant tables. This gives all users FULL ACCESS to all tables.",
-   (uchar**) &opt_noacl, (uchar**) &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+   &opt_noacl, &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
    0},
 #endif
   {"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names.", 0, 0, 0,
@@ -6215,8 +6246,8 @@ Can't be set to 1 if --log-slave-updates is used.",
   {"skip-new", OPT_SKIP_NEW, "Don't use new, possibly wrong routines.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"skip-slave-start", 0,
-   "If set, slave is not autostarted.", (uchar**) &opt_skip_slave_start,
-   (uchar**) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   "If set, slave is not autostarted.", &opt_skip_slave_start,
+   &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"skip-stack-trace", OPT_SKIP_STACK_TRACE,
    "Don't print a stack trace on failure.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
    0, 0, 0, 0},
@@ -6227,14 +6258,14 @@ Can't be set to 1 if --log-slave-updates is used.",
 #ifdef HAVE_REPLICATION
   {"sporadic-binlog-dump-fail", 0,
    "Option used by mysql-test for debugging and testing of replication.",
-   (uchar**) &opt_sporadic_binlog_dump_fail,
-   (uchar**) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+   &opt_sporadic_binlog_dump_fail,
+   &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
    0},
 #endif /* HAVE_REPLICATION */
 #ifdef HAVE_OPENSSL
   {"ssl", 0,
    "Enable SSL for connection (automatically enabled with other flags).",
-   (uchar **) &opt_use_ssl, (uchar **) &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 0, 0, 0,
+   &opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 0, 0, 0,
    0, 0, 0},
 #endif
 #ifdef __WIN__
@@ -6243,7 +6274,7 @@ Can't be set to 1 if --log-slave-updates is used.",
    NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"symbolic-links", 's', "Enable symbolic link support.",
-   (uchar**) &my_use_symdir, (uchar**) &my_use_symdir, 0, GET_BOOL, NO_ARG,
+   &my_use_symdir, &my_use_symdir, 0, GET_BOOL, NO_ARG,
    /*
      The system call realpath() produces warnings under valgrind and
      purify. These are not suppressed: instead we disable symlinks
@@ -6251,49 +6282,51 @@ Can't be set to 1 if --log-slave-updates is used.",
    */
    IF_PURIFY(0,1), 0, 0, 0, 0, 0},
   {"sysdate-is-now", 0,
-   "Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. Since 5.0, SYSDATE() returns a `dynamic' value different for different invocations, even within the same statement.",
-   (uchar**) &global_system_variables.sysdate_is_now,
+   "Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. "
+   "Since 5.0, SYSDATE() returns a `dynamic' value different for different "
+   "invocations, even within the same statement.",
+   &global_system_variables.sysdate_is_now,
    0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
   {"tc-heuristic-recover", 0,
-   "Decision to use in heuristic recover process. Possible values are COMMIT or ROLLBACK.",
-   (uchar**) &tc_heuristic_recover, (uchar**) &tc_heuristic_recover,
+   "Decision to use in heuristic recover process. Possible values are COMMIT "
+   "or ROLLBACK.", &tc_heuristic_recover, &tc_heuristic_recover,
    &tc_heuristic_recover_typelib, GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #if defined(ENABLED_DEBUG_SYNC)
   {"debug-sync-timeout", OPT_DEBUG_SYNC_TIMEOUT,
    "Enable the debug sync facility "
    "and optionally specify a default wait timeout in seconds. "
    "A zero value keeps the facility disabled.",
-   (uchar**) &opt_debug_sync_timeout, 0,
+   &opt_debug_sync_timeout, 0,
    0, GET_UINT, OPT_ARG, 0, 0, UINT_MAX, 0, 0, 0},
 #endif /* defined(ENABLED_DEBUG_SYNC) */
   {"temp-pool", 0,
 #if (ENABLE_TEMP_POOL)
-   "Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.",
+   "Using this option will cause most temporary files created to use a small "
+   "set of names, rather than a unique name for each new file.",
 #else
    "This option is ignored on this OS.",
 #endif
-   (uchar**) &use_temp_pool, (uchar**) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1,
+   &use_temp_pool, &use_temp_pool, 0, GET_BOOL, NO_ARG, 1,
    0, 0, 0, 0, 0},
   {"transaction-isolation", 0,
    "Default transaction isolation level.",
-   (uchar**)&global_system_variables.tx_isolation,
-   (uchar**)&global_system_variables.tx_isolation, &tx_isolation_typelib,
+   &global_system_variables.tx_isolation,
+   &global_system_variables.tx_isolation, &tx_isolation_typelib,
    GET_ENUM, REQUIRED_ARG, ISO_REPEATABLE_READ, 0, 0, 0, 0, 0},
   {"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG,
    0, 0, 0, 0, 0, 0},
   {"verbose", 'v', "Used with --help option for detailed help.",
-   (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
-   0, 0},
+   &opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"plugin-load", 0,
    "Optional semicolon-separated list of plugins to load, where each plugin is "
    "identified as name=library, where name is the plugin name and library "
    "is the plugin library in plugin_dir.",
-   (uchar**) &opt_plugin_load, (uchar**) &opt_plugin_load, 0,
+   &opt_plugin_load, &opt_plugin_load, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"table_cache", 0, "Deprecated; use --table-open-cache instead.",
-   (uchar**) &table_cache_size, (uchar**) &table_cache_size, 0, GET_ULONG,
+   &table_cache_size, &table_cache_size, 0, GET_ULONG,
    REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
   {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
@@ -7425,7 +7458,7 @@ mysqld_get_one_option(int optid,
 
 C_MODE_START
 
-static uchar* *
+static void*
 mysql_getopt_value(const char *keyname, uint key_length,
 		   const struct my_option *option, int *error)
 {
@@ -7446,13 +7479,13 @@ mysql_getopt_value(const char *keyname, uint key_length,
     }
     switch (option->id) {
     case OPT_KEY_BUFFER_SIZE:
-      return (uchar**) &key_cache->param_buff_size;
+      return &key_cache->param_buff_size;
     case OPT_KEY_CACHE_BLOCK_SIZE:
-      return (uchar**) &key_cache->param_block_size;
+      return &key_cache->param_block_size;
     case OPT_KEY_CACHE_DIVISION_LIMIT:
-      return (uchar**) &key_cache->param_division_limit;
+      return &key_cache->param_division_limit;
     case OPT_KEY_CACHE_AGE_THRESHOLD:
-      return (uchar**) &key_cache->param_age_threshold;
+      return &key_cache->param_age_threshold;
     }
   }
   }
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 28ed4cbdbaf..918798529de 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -16,11 +16,7 @@
 /**
   @file
 
-  This file is the net layer API for the MySQL client/server protocol,
-  which is a tightly coupled, proprietary protocol owned by MySQL AB.
-  @note
-  Any re-implementations of this protocol must also be under GPL
-  unless one has got an license from MySQL AB stating otherwise.
+  This file is the net layer API for the MySQL client/server protocol.
 
   Write and read of logical packets to/from socket.
 
@@ -924,7 +920,13 @@ my_real_read(NET *net, size_t *complen)
 		       ("Packets out of order (Found: %d, expected %u)",
 			(int) net->buff[net->where_b + 3],
 			net->pkt_nr));
-#ifdef EXTRA_DEBUG
+            /* 
+              We don't make noise server side, since the client is expected
+              to break the protocol for e.g. --send LOAD DATA .. LOCAL where
+              the server expects the client to send a file, but the client
+              may reply with a new command instead.
+            */
+#if defined (EXTRA_DEBUG) && !defined (MYSQL_SERVER)
             fflush(stdout);
 	    fprintf(stderr,"Error: Packets out of order (Found: %d, expected %d)\n",
 		    (int) net->buff[net->where_b + 3],
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 0c79c8dc797..e020c94a3bd 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -143,7 +143,10 @@ static int get_index_min_value(TABLE *table, TABLE_REF *ref,
         1) We have only MIN() and the argument column is nullable, or
         2) there is a > predicate on it, nullability is irrelevant.
         We need to scan the next bigger record first.
+        Open interval is not used if the search key involves the last keypart,
+        and it would not work.
       */
+      DBUG_ASSERT(prefix_len < ref->key_length);
       error= table->file->index_read_map(table->record[0],
                                          ref->key_buff,
                                          make_prev_keypart_map(ref->key_parts),
@@ -596,18 +599,19 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
                           key_part_map *key_part_used, uint *range_fl,
                           uint *prefix_len)
 {
+  DBUG_ENTER("matching_cond");
   if (!cond)
-    return 1;
+    DBUG_RETURN(TRUE);
   Field *field= field_part->field;
   if (!(cond->used_tables() & field->table->map))
   {
     /* Condition doesn't restrict the used table */
-    return 1;
+    DBUG_RETURN(TRUE);
   }
   if (cond->type() == Item::COND_ITEM)
   {
     if (((Item_cond*) cond)->functype() == Item_func::COND_OR_FUNC)
-      return 0;
+      DBUG_RETURN(FALSE);
 
     /* AND */
     List_iterator_fast<Item> li(*((Item_cond*) cond)->argument_list());
@@ -616,13 +620,13 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
     {
       if (!matching_cond(max_fl, ref, keyinfo, field_part, item,
                          key_part_used, range_fl, prefix_len))
-        return 0;
+        DBUG_RETURN(FALSE);
     }
-    return 1;
+    DBUG_RETURN(TRUE);
   }
 
   if (cond->type() != Item::FUNC_ITEM)
-    return 0;                                 // Not operator, can't optimize
+    DBUG_RETURN(FALSE);                                 // Not operator, can't optimize
 
   bool eq_type= 0;                            // =, <=> or IS NULL
   bool is_null_safe_eq= FALSE;                // The operator is NULL safe, e.g. <=> 
@@ -656,7 +660,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
     eq_type= 1;
     break;
   default:
-    return 0;                                        // Can't optimize function
+    DBUG_RETURN(FALSE);                                        // Can't optimize function
   }
   
   Item *args[3];
@@ -664,11 +668,11 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
 
   /* Test if this is a comparison of a field and constant */
   if (!simple_pred((Item_func*) cond, args, &inv))
-    return 0;
+    DBUG_RETURN(FALSE);
 
   if (!is_null_safe_eq && !is_null &&
       (args[1]->is_null() || (between && args[2]->is_null())))
-    return FALSE;
+    DBUG_RETURN(FALSE);
 
   if (inv && !eq_type)
     less_fl= 1-less_fl;                         // Convert '<' -> '>' (etc)
@@ -680,14 +684,14 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
 
   {
     if (part > field_part)
-      return 0;                     // Field is beyond the tested parts
+      DBUG_RETURN(FALSE);                     // Field is beyond the tested parts
     if (part->field->eq(((Item_field*) args[0])->field))
       break;                        // Found a part of the key for the field
   }
 
   bool is_field_part= part == field_part;
   if (!(is_field_part || eq_type))
-    return 0;
+    DBUG_RETURN(FALSE);
 
   key_part_map org_key_part_used= *key_part_used;
   if (eq_type || between || max_fl == less_fl)
@@ -707,6 +711,17 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
     *key_part_used|= (key_part_map) 1 << (part - keyinfo->key_part);
   }
 
+  if (org_key_part_used == *key_part_used &&
+    /*
+      The current search key is not being extended with a new key part.  This
+      means that the a condition is added a key part for which there was a
+      previous condition. We can only overwrite such key parts in some special
+      cases, e.g. a > 2 AND a > 1 (here range_fl must be set to something). In
+      all other cases the WHERE condition is always false anyway.
+    */
+      (eq_type || *range_fl == 0))
+      DBUG_RETURN(FALSE);
+
   if (org_key_part_used != *key_part_used ||
       (is_field_part && 
        (between || eq_type || max_fl == less_fl) && !cond->val_int()))
@@ -752,11 +767,11 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
   {
     if ((!is_null && !cond->val_int()) ||
         (is_null && !test(part->field->is_null())))
-     return 0;                       // Impossible test
+     DBUG_RETURN(FALSE);                       // Impossible test
   }
   else if (is_field_part)
     *range_fl&= ~(max_fl ? NO_MIN_RANGE : NO_MAX_RANGE);
-  return 1;  
+  DBUG_RETURN(TRUE);  
 }
 
 
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 9c2cb40badc..9e7fdbfeae5 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -6343,3 +6343,6 @@ ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN
 ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN
   eng "Cannot change the sql_log_bin inside a stored function or trigger"
 
+ER_FAILED_READ_FROM_PAR_FILE
+  eng "Failed to read from the .par file"
+  swe "Misslyckades läsa från .par filen"
diff --git a/sql/sp.cc b/sql/sp.cc
index e7bf15c56d5..5328471f4c0 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -720,11 +720,18 @@ static sp_head *sp_compile(THD *thd, String *defstr, ulong sql_mode,
   ha_rows old_select_limit= thd->variables.select_limit;
   sp_rcontext *old_spcont= thd->spcont;
   Silence_deprecated_warning warning_handler;
+  Parser_state parser_state;
 
   thd->variables.sql_mode= sql_mode;
   thd->variables.select_limit= HA_POS_ERROR;
 
-  Parser_state parser_state(thd, defstr->c_ptr(), defstr->length());
+  if (parser_state.init(thd, defstr->c_ptr(), defstr->length()))
+  {
+    thd->variables.sql_mode= old_sql_mode;
+    thd->variables.select_limit= old_select_limit;
+    return NULL;
+  }
+
   lex_start(thd);
   thd->push_internal_handler(&warning_handler);
   thd->spcont= 0;
@@ -1716,7 +1723,7 @@ bool sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena,
     rn->mdl_request.init(key, MDL_SHARED);
     if (my_hash_insert(&prelocking_ctx->sroutines, (uchar *)rn))
       return FALSE;
-    prelocking_ctx->sroutines_list.link_in_list((uchar *)rn, (uchar **)&rn->next);
+    prelocking_ctx->sroutines_list.link_in_list(rn, &rn->next);
     rn->belong_to_view= belong_to_view;
     rn->m_sp_cache_version= 0;
     return TRUE;
@@ -1766,8 +1773,7 @@ void sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena,
 void sp_remove_not_own_routines(Query_tables_list *prelocking_ctx)
 {
   Sroutine_hash_entry *not_own_rt, *next_rt;
-  for (not_own_rt= 
-         *(Sroutine_hash_entry **)prelocking_ctx->sroutines_list_own_last;
+  for (not_own_rt= *prelocking_ctx->sroutines_list_own_last;
        not_own_rt; not_own_rt= next_rt)
   {
     /*
@@ -1778,7 +1784,7 @@ void sp_remove_not_own_routines(Query_tables_list *prelocking_ctx)
     my_hash_delete(&prelocking_ctx->sroutines, (uchar *)not_own_rt);
   }
 
-  *(Sroutine_hash_entry **)prelocking_ctx->sroutines_list_own_last= NULL;
+  *prelocking_ctx->sroutines_list_own_last= NULL;
   prelocking_ctx->sroutines_list.next= prelocking_ctx->sroutines_list_own_last;
   prelocking_ctx->sroutines_list.elements= 
                     prelocking_ctx->sroutines_list_own_elements;
@@ -1863,10 +1869,10 @@ sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx,
 */
 
 void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx,
-                                  SQL_LIST *src, TABLE_LIST *belong_to_view)
+                                  SQL_I_List<Sroutine_hash_entry> *src,
+                                  TABLE_LIST *belong_to_view)
 {
-  for (Sroutine_hash_entry *rt= (Sroutine_hash_entry *)src->first;
-       rt; rt= rt->next)
+  for (Sroutine_hash_entry *rt= src->first; rt; rt= rt->next)
     (void)sp_add_used_routine(prelocking_ctx, thd->stmt_arena,
                               &rt->mdl_request.key, belong_to_view);
 }
@@ -1892,8 +1898,7 @@ int sp_cache_routine(THD *thd, Sroutine_hash_entry *rt,
     in sroutines_list has an MDL lock unless it's a top-level call, or a
     trigger, but triggers can't occur here (see the preceding assert).
   */
-  DBUG_ASSERT(rt->mdl_request.ticket ||
-              rt == (Sroutine_hash_entry*) thd->lex->sroutines_list.first);
+  DBUG_ASSERT(rt->mdl_request.ticket || rt == thd->lex->sroutines_list.first);
 
   return sp_cache_routine(thd, type, &name, lookup_only, sp);
 }
diff --git a/sql/sp.h b/sql/sp.h
index e16c0718f3f..10e70261b86 100644
--- a/sql/sp.h
+++ b/sql/sp.h
@@ -34,7 +34,8 @@ struct LEX;
 struct TABLE;
 struct TABLE_LIST;
 typedef struct st_hash HASH;
-typedef struct st_sql_list SQL_LIST;
+template <typename T> class SQL_I_List;
+
 
 /* Tells what SP_DEFAULT_ACCESS should be mapped to */
 #define SP_DEFAULT_ACCESS_MAPPING SP_CONTAINS_SQL
@@ -164,7 +165,8 @@ bool sp_update_sp_used_routines(HASH *dst, HASH *src);
 void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx,
                                   HASH *src, TABLE_LIST *belong_to_view);
 void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx,
-                                  SQL_LIST *src, TABLE_LIST *belong_to_view);
+                                  SQL_I_List<Sroutine_hash_entry> *src,
+                                  TABLE_LIST *belong_to_view);
 
 extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen,
                                   my_bool first);
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 9395146f18f..1e708bcb083 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -50,6 +50,32 @@
 
 extern "C" uchar *sp_table_key(const uchar *ptr, size_t *plen, my_bool first);
 
+/**
+  Helper function which operates on a THD object to set the query start_time to
+  the current time.
+
+  @param[in, out] thd The session object
+
+*/
+
+static void reset_start_time_for_sp(THD *thd)
+{
+  if (!thd->in_sub_stmt)
+  {
+    /*
+      First investigate if there is a cached time stamp
+    */
+    if (thd->user_time)
+    {
+      thd->start_time= thd->user_time;
+    }
+    else
+    {
+      my_micro_time_and_time(&thd->start_time);
+    }
+  }
+}
+
 Item_result
 sp_map_result_type(enum enum_field_types type)
 {
@@ -1240,11 +1266,11 @@ sp_head::execute(THD *thd)
     DBUG_PRINT("execute", ("Instruction %u", ip));
 
     /*
-      Make current_time() et al work. But don't change NOW() in FUNCTION
-      or TRIGGER.
+      We need to reset start_time to allow for time to flow inside a stored
+      procedure. This is only done for SP since time is suppose to be constant
+      during execution of triggers and functions.
     */
-    if (!thd->in_sub_stmt)
-      thd->set_time();
+    reset_start_time_for_sp(thd);
 
     /*
       We have to set thd->stmt_arena before executing the instruction
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index ac092756a74..8c147421363 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -878,6 +878,9 @@ THD::raise_condition_no_handler(uint sql_errno,
   if (no_warnings_for_error && (level == MYSQL_ERROR::WARN_LEVEL_ERROR))
     DBUG_RETURN(NULL);
 
+  /* When simulating OOM, skip writing to error log to avoid mtr errors */
+  DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_RETURN(NULL););
+
   cond= warning_info->push_warning(this, sql_errno, sqlstate, level, msg);
   DBUG_RETURN(cond);
 }
diff --git a/sql/sql_class.h b/sql/sql_class.h
index f1fce5ef472..25b136bc4ca 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2355,6 +2355,11 @@ public:
     start_time= user_time= t;
     start_utime= utime_after_lock= my_micro_time();
   }
+  /*TODO: this will be obsolete when we have support for 64 bit my_time_t */
+  inline bool	is_valid_time() 
+  { 
+    return (start_time < (time_t) MY_TIME_T_MAX); 
+  }
   void set_time_after_lock()  { utime_after_lock= my_micro_time(); }
   ulonglong current_utime()  { return my_micro_time(); }
   inline ulonglong found_rows(void)
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index c0081c13366..7b0ef3eb226 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -496,6 +496,7 @@ check_user(THD *thd, enum enum_server_command command,
       }
       my_ok(thd);
       thd->password= test(passwd_len);          // remember for error messages 
+#ifndef EMBEDDED_LIBRARY
       /*
         Allow the network layer to skip big packets. Although a malicious
         authenticated session might use this to trick the server to read
@@ -503,6 +504,7 @@ check_user(THD *thd, enum enum_server_command command,
         that needs to be preserved as to not break backwards compatibility.
       */
       thd->net.skip_big_packet= TRUE;
+#endif
       /* Ready to handle queries */
       DBUG_RETURN(0);
     }
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 2e86315d072..d71d5c56980 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -47,7 +47,7 @@
 */
 
 bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
-                  SQL_LIST *order, ha_rows limit, ulonglong options,
+                  SQL_I_List<ORDER> *order, ha_rows limit, ulonglong options,
                   bool reset_auto_increment)
 {
   bool          will_batch;
@@ -98,7 +98,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
 
       if (select_lex->setup_ref_array(thd, order->elements) ||
 	  setup_order(thd, select_lex->ref_pointer_array, &tables,
-                    fields, all_fields, (ORDER*) order->first))
+                    fields, all_fields, order->first))
     {
       delete select;
       free_underlaid_joins(thd, &thd->lex->select_lex);
@@ -243,14 +243,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
     ha_rows examined_rows;
     
     if ((!select || table->quick_keys.is_clear_all()) && limit != HA_POS_ERROR)
-      usable_index= get_index_for_order(table, (ORDER*)(order->first), limit);
+      usable_index= get_index_for_order(table, order->first, limit);
 
     if (usable_index == MAX_KEY)
     {
       table->sort.io_cache= (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
                                                    MYF(MY_FAE | MY_ZEROFILL));
     
-      if (!(sortorder= make_unireg_sortorder((ORDER*) order->first,
+      if (!(sortorder= make_unireg_sortorder(order->first,
                                              &length, NULL)) ||
 	  (table->sort.found_records = filesort(thd, table, sortorder, length,
                                                 select, HA_POS_ERROR, 1,
@@ -546,7 +546,7 @@ extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b)
 int mysql_multi_delete_prepare(THD *thd)
 {
   LEX *lex= thd->lex;
-  TABLE_LIST *aux_tables= (TABLE_LIST *)lex->auxiliary_table_list.first;
+  TABLE_LIST *aux_tables= lex->auxiliary_table_list.first;
   TABLE_LIST *target_tbl;
   DBUG_ENTER("mysql_multi_delete_prepare");
 
diff --git a/sql/sql_delete.h b/sql/sql_delete.h
index d1c1b363abd..0e09120f557 100644
--- a/sql/sql_delete.h
+++ b/sql/sql_delete.h
@@ -23,11 +23,11 @@ struct TABLE_LIST;
 class Item;
 
 typedef class Item COND;
-typedef struct st_sql_list SQL_LIST;
+template <typename T> class SQL_I_List;
 
 int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
 bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
-                  SQL_LIST *order, ha_rows rows, ulonglong options,
+                  SQL_I_List<ORDER> *order, ha_rows rows, ulonglong options,
                   bool reset_auto_increment);
 bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
 
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index e86ae52e501..47bc13beb53 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -285,13 +285,13 @@ bool mysql_derived_filling(THD *thd, LEX *lex, TABLE_LIST *orig_table_list)
 
       lex->current_select= first_select;
       res= mysql_select(thd, &first_select->ref_pointer_array,
-			(TABLE_LIST*) first_select->table_list.first,
+			first_select->table_list.first,
 			first_select->with_wild,
 			first_select->item_list, first_select->where,
 			(first_select->order_list.elements+
 			 first_select->group_list.elements),
-			(ORDER *) first_select->order_list.first,
-			(ORDER *) first_select->group_list.first,
+			first_select->order_list.first,
+			first_select->group_list.first,
 			first_select->having, (ORDER*) NULL,
 			(first_select->options | thd->variables.option_bits |
 			 SELECT_NO_UNLOCK),
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 23177b8f51a..b9cc0ef477d 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -607,6 +607,14 @@ retry:
       my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), keyname, tables->alias);
       goto err;
     }
+    /* Check if the same index involved. */
+    if ((uint) keyno != table->file->get_index())
+    {
+      if (mode == RNEXT)
+        mode= RFIRST;
+      else if (mode == RPREV)
+        mode= RLAST;
+    }
   }
 
   if (insert_fields(thd, &thd->lex->select_lex.context,
@@ -629,9 +637,16 @@ retry:
     case RNEXT:
       if (table->file->inited != handler::NONE)
       {
-        error=keyname ?
-	  table->file->index_next(table->record[0]) :
-	  table->file->rnd_next(table->record[0]);
+        if (keyname)
+        {
+          /* Check if we read from the same index. */
+          DBUG_ASSERT((uint) keyno == table->file->get_index());
+          error= table->file->index_next(table->record[0]);
+        }
+        else
+        {
+          error= table->file->rnd_next(table->record[0]);
+        }
         break;
       }
       /* else fall through */
@@ -652,6 +667,8 @@ retry:
       break;
     case RPREV:
       DBUG_ASSERT(keyname != 0);
+      /* Check if we read from the same index. */
+      DBUG_ASSERT((uint) keyno == table->file->get_index());
       if (table->file->inited != handler::NONE)
       {
         error=table->file->index_prev(table->record[0]);
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 88cba22d115..16b4c727689 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -147,20 +147,30 @@ st_parsing_options::reset()
   Perform initialization of Lex_input_stream instance.
 
   Basically, a buffer for pre-processed query. This buffer should be large
-  enough to keep multi-statement query. The allocation is done once in the
-  Lex_input_stream constructor in order to prevent memory pollution when
+  enough to keep multi-statement query. The allocation is done once in
+  Lex_input_stream::init() in order to prevent memory pollution when
   the server is processing large multi-statement queries.
-
-  @todo Check return value of THD::alloc().
 */
 
-Lex_input_stream::Lex_input_stream(THD *thd,
-                                   const char* buffer,
-                                   unsigned int length)
-  :m_thd(thd)
+bool Lex_input_stream::init(THD *thd,
+			    const char* buff,
+			    unsigned int length)
 {
+  DBUG_EXECUTE_IF("bug42064_simulate_oom",
+                  DBUG_SET("+d,simulate_out_of_memory"););
+
   m_cpp_buf= (char*) thd->alloc(length + 1);
-  reset(buffer, length);
+
+  DBUG_EXECUTE_IF("bug42064_simulate_oom",
+                  DBUG_SET("-d,bug42064_simulate_oom");); 
+
+  if (m_cpp_buf == NULL)
+    return TRUE;
+
+  m_thd= thd;
+  reset(buff, length);
+
+  return FALSE;
 }
 
 
@@ -203,8 +213,6 @@ Lex_input_stream::reset(const char *buffer, unsigned int length)
   m_cpp_ptr= m_cpp_buf;
 }
 
-Lex_input_stream::~Lex_input_stream()
-{}
 
 /**
   The operation is called from the parser in order to
@@ -1753,7 +1761,7 @@ void st_select_lex::init_select()
   linkage= UNSPECIFIED_TYPE;
   order_list.elements= 0;
   order_list.first= 0;
-  order_list.next= (uchar**) &order_list.first;
+  order_list.next= &order_list.first;
   /* Set limit and offset to default values */
   select_limit= 0;      /* denotes the default limit = HA_POS_ERROR */
   offset_limit= 0;      /* denotes the default offset = 0 */
@@ -2075,7 +2083,7 @@ uint st_select_lex::get_in_sum_expr()
 
 TABLE_LIST* st_select_lex::get_table_list()
 {
-  return (TABLE_LIST*) table_list.first;
+  return table_list.first;
 }
 
 List<Item>* st_select_lex::get_item_list()
@@ -2132,9 +2140,8 @@ void st_select_lex_unit::print(String *str, enum_query_type query_type)
     if (fake_select_lex->order_list.elements)
     {
       str->append(STRING_WITH_LEN(" order by "));
-      fake_select_lex->print_order(
-        str,
-        (ORDER *) fake_select_lex->order_list.first,
+      fake_select_lex->print_order(str,
+        fake_select_lex->order_list.first,
         query_type);
     }
     fake_select_lex->print_limit(thd, str, query_type);
@@ -2779,7 +2786,7 @@ TABLE_LIST *LEX::unlink_first_table(bool *link_to_local)
     {
       select_lex.context.table_list= 
         select_lex.context.first_name_resolution_table= first->next_local;
-      select_lex.table_list.first= (uchar*) (first->next_local);
+      select_lex.table_list.first= first->next_local;
       select_lex.table_list.elements--;	//safety
       first->next_local= 0;
       /*
@@ -2811,7 +2818,7 @@ TABLE_LIST *LEX::unlink_first_table(bool *link_to_local)
 
 void LEX::first_lists_tables_same()
 {
-  TABLE_LIST *first_table= (TABLE_LIST*) select_lex.table_list.first;
+  TABLE_LIST *first_table= select_lex.table_list.first;
   if (query_tables != first_table && first_table != 0)
   {
     TABLE_LIST *next;
@@ -2858,9 +2865,9 @@ void LEX::link_first_table_back(TABLE_LIST *first,
 
     if (link_to_local)
     {
-      first->next_local= (TABLE_LIST*) select_lex.table_list.first;
+      first->next_local= select_lex.table_list.first;
       select_lex.context.table_list= first;
-      select_lex.table_list.first= (uchar*) first;
+      select_lex.table_list.first= first;
       select_lex.table_list.elements++;	//safety
     }
   }
@@ -3026,7 +3033,7 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds,
       prep_having= *having_conds;
       *having_conds= having= prep_having->copy_andor_structure(thd);
     }
-    fix_prepare_info_in_table_list(thd, (TABLE_LIST *)table_list.first);
+    fix_prepare_info_in_table_list(thd, table_list.first);
   }
 }
 
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 40bd3875793..985edd42496 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -640,8 +640,8 @@ public:
   LEX *parent_lex;
   enum olap_type olap;
   /* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */
-  SQL_LIST	      table_list;
-  SQL_LIST	      group_list; /* GROUP BY clause. */
+  SQL_I_List<TABLE_LIST>  table_list;
+  SQL_I_List<ORDER>       group_list; /* GROUP BY clause. */
   List<Item>          item_list;  /* list of fields & expressions */
   List<String>        interval_list;
   bool	              is_item_list_lookup;
@@ -663,8 +663,8 @@ public:
   TABLE_LIST *leaf_tables;
   const char *type;               /* type of select for EXPLAIN          */
 
-  SQL_LIST order_list;                /* ORDER clause */
-  SQL_LIST *gorder_list;
+  SQL_I_List<ORDER> order_list;   /* ORDER clause */
+  SQL_I_List<ORDER> *gorder_list;
   Item *select_limit, *offset_limit;  /* LIMIT clause parameters */
   // Arrays of pointers to top elements of all_fields list
   Item **ref_pointer_array;
@@ -814,7 +814,7 @@ public:
   {
     order_list.elements= 0;
     order_list.first= 0;
-    order_list.next= (uchar**) &order_list.first;
+    order_list.next= &order_list.first;
   }
   /*
     This method created for reiniting LEX in mysql_admin_table() and can be
@@ -996,6 +996,8 @@ extern const LEX_STRING null_lex_str;
 extern const LEX_STRING empty_lex_str;
 
 
+struct Sroutine_hash_entry;
+
 /*
   Class representing list of all tables used by statement and other
   information which is necessary for opening and locking its tables,
@@ -1046,9 +1048,9 @@ public:
     We use these two members for restoring of 'sroutines_list' to the state
     in which it was right after query parsing.
   */
-  SQL_LIST sroutines_list;
-  uchar    **sroutines_list_own_last;
-  uint     sroutines_list_own_elements;
+  SQL_I_List<Sroutine_hash_entry> sroutines_list;
+  Sroutine_hash_entry **sroutines_list_own_last;
+  uint sroutines_list_own_elements;
 
   /*
     These constructor and destructor serve for creation/destruction
@@ -1376,8 +1378,21 @@ enum enum_comment_state
 class Lex_input_stream
 {
 public:
-  Lex_input_stream(THD *thd, const char* buff, unsigned int length);
-  ~Lex_input_stream();
+  Lex_input_stream()
+  {
+  }
+
+  ~Lex_input_stream()
+  {
+  }
+
+  /**
+     Object initializer. Must be called before usage.
+
+     @retval FALSE OK
+     @retval TRUE  Error
+  */
+  bool init(THD *thd, const char *buff, unsigned int length);
 
   void reset(const char *buff, unsigned int length);
 
@@ -1901,7 +1916,8 @@ struct LEX: public Query_tables_list
   */
   List<Name_resolution_context> context_stack;
 
-  SQL_LIST	      proc_list, auxiliary_table_list, save_list;
+  SQL_I_List<ORDER> proc_list;
+  SQL_I_List<TABLE_LIST> auxiliary_table_list, save_list;
   Create_field	      *last_field;
   Item_sum *in_sum_func;
   udf_func udf;
@@ -2032,7 +2048,7 @@ struct LEX: public Query_tables_list
     fields to TABLE object at table open (altough for latter pointer to table
     being opened is probably enough).
   */
-  SQL_LIST trg_table_fields;
+  SQL_I_List<Item_trigger_field> trg_table_fields;
 
   /*
     stmt_definition_begin is intended to point to the next word after
@@ -2314,10 +2330,21 @@ public:
 class Parser_state
 {
 public:
-  Parser_state(THD *thd, const char* buff, unsigned int length)
-    : m_lip(thd, buff, length), m_yacc()
+  Parser_state()
+    : m_yacc()
   {}
 
+  /**
+     Object initializer. Must be called before usage.
+
+     @retval FALSE OK
+     @retval TRUE  Error
+  */
+  bool init(THD *thd, const char *buff, unsigned int length)
+  {
+    return m_lip.init(thd, buff, length);
+  }
+
   ~Parser_state()
   {}
 
diff --git a/sql/sql_list.h b/sql/sql_list.h
index 60d9697a606..d57534b0999 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -67,45 +67,61 @@ public:
 
 
 /**
-   Struct to handle simple linked lists.
-
-   @todo What is the relation between this class and list_node, below?
-   /Matz
-
-   @see list_node, base_list, List
+  Simple intrusive linked list.
 
+  @remark Similar in nature to base_list, but intrusive. It keeps a
+          a pointer to the first element in the list and a indirect
+          reference to the last element.
 */
-typedef struct st_sql_list {
+template <typename T>
+class SQL_I_List :public Sql_alloc
+{
+public:
   uint elements;
-  uchar *first;
-  uchar **next;
+  /** The first element in the list. */
+  T *first;
+  /** A reference to the next element in the list. */
+  T **next;
+
+  SQL_I_List() { empty(); }
+
+  SQL_I_List(const SQL_I_List &tmp)
+  {
+    elements= tmp.elements;
+    first= tmp.first;
+    next= elements ? tmp.next : &first;
+  }
 
-  st_sql_list() {}                              /* Remove gcc warning */
   inline void empty()
   {
-    elements=0;
-    first=0;
+    elements= 0;
+    first= NULL;
     next= &first;
   }
-  inline void link_in_list(uchar *element,uchar **next_ptr)
+
+  inline void link_in_list(T *element, T **next_ptr)
   {
     elements++;
-    (*next)=element;
+    (*next)= element;
     next= next_ptr;
-    *next=0;
+    *next= NULL;
   }
-  inline void save_and_clear(struct st_sql_list *save)
+
+  inline void save_and_clear(SQL_I_List<T> *save)
   {
     *save= *this;
     empty();
   }
-  inline void push_front(struct st_sql_list *save)
+
+  inline void push_front(SQL_I_List<T> *save)
   {
-    *save->next= first;				/* link current list last */
+    /* link current list last */
+    *save->next= first;
     first= save->first;
     elements+= save->elements;
   }
-  inline void push_back(struct st_sql_list *save)
+
+  inline void push_back(SQL_I_List<T> *save)
   {
     if (save->first)
     {
@@ -114,7 +130,7 @@ typedef struct st_sql_list {
       elements+= save->elements;
     }
   }
-} SQL_LIST;
+};
 
 
 /*
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 2c42f29ae71..7e540ffbe4b 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -995,6 +995,10 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
         DBUG_RETURN(1);
       }
     }
+
+    if (thd->is_error())
+      read_info.error= 1;
+
     if (read_info.error)
       break;
     if (skip_lines)
diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc
index cdfa5e3f496..b957d1e9be4 100644
--- a/sql/sql_olap.cc
+++ b/sql/sql_olap.cc
@@ -147,14 +147,14 @@ int handle_olaps(LEX *lex, SELECT_LEX *select_lex)
 
   lex->last_selects=select_lex;
 
-  for (ORDER *order=(ORDER *)select_lex->group_list.first ; order ; order=order->next)
+  for (ORDER *order= select_lex->group_list.first ; order ; order=order->next)
     item_list_copy.push_back(*(order->item));
 
   List<Item>	all_fields(select_lex->item_list);
 
 
   if (setup_tables(lex->thd, &select_lex->context, &select_lex->top_join_list,
-                   (TABLE_LIST *)select_lex->table_list.first
+                   select_lex->table_list.first
                    &select_lex->leaf_tables, FALSE) ||
       setup_fields(lex->thd, 0, select_lex->item_list, MARK_COLUMNS_READ,
                    &all_fields,1) ||
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 06bebe76842..bdee13372d5 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -559,7 +559,14 @@ static void handle_bootstrap_impl(THD *thd)
       mode we have only one thread.
     */
     thd->set_time();
-    Parser_state parser_state(thd, thd->query(), length);
+    Parser_state parser_state;
+    if (parser_state.init(thd, thd->query(), length))
+    {
+      thd->protocol->end_statement();
+      bootstrap_error= 1;
+      break;
+    }
+
     mysql_parse(thd, thd->query(), length, &parser_state);
     close_thread_tables(thd);			// Free tables
 
@@ -916,6 +923,18 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
   thd->enable_slow_log= TRUE;
   thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
   thd->set_time();
+  if (!thd->is_valid_time())
+  {
+    /*
+     If the time has got past 2038 we need to shut this server down
+     We do this by making sure every command is a shutdown and we 
+     have enough privileges to shut the server down
+
+     TODO: remove this when we have full 64 bit my_time_t support
+    */
+    thd->security_ctx->master_access|= SHUTDOWN_ACL;
+    command= COM_SHUTDOWN;
+  }
   thd->set_query_id(get_query_id());
   if (!(server_command_flags[command] & CF_SKIP_QUERY_ID))
     next_query_id();
@@ -1109,7 +1128,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
 #if defined(ENABLED_PROFILING)
     thd->profiling.set_query_source(thd->query(), thd->query_length());
 #endif
-    Parser_state parser_state(thd, thd->query(), thd->query_length());
+    Parser_state parser_state;
+    if (parser_state.init(thd, thd->query(), thd->query_length()))
+      break;
 
     mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
 
@@ -1238,8 +1259,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
     mysql_reset_thd_for_next_command(thd);
 
     thd->lex->
-      select_lex.table_list.link_in_list((uchar*) &table_list,
-                                         (uchar**) &table_list.next_local);
+      select_lex.table_list.link_in_list(&table_list,
+                                         &table_list.next_local);
     thd->lex->add_to_query_tables(&table_list);
     init_mdl_requests(&table_list);
 
@@ -1341,8 +1362,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
       SHUTDOWN_DEFAULT is 0. If client is >= 4.1.3, the shutdown level is in
       packet[0].
     */
-    enum mysql_enum_shutdown_level level=
-      (enum mysql_enum_shutdown_level) (uchar) packet[0];
+    enum mysql_enum_shutdown_level level;
+    if (!thd->is_valid_time())
+      level= SHUTDOWN_DEFAULT;
+    else
+      level= (enum mysql_enum_shutdown_level) (uchar) packet[0];
     if (level == SHUTDOWN_DEFAULT)
       level= SHUTDOWN_WAIT_ALL_BUFFERS; // soon default will be configurable
     else if (level != SHUTDOWN_WAIT_ALL_BUFFERS)
@@ -1688,7 +1712,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
   {
     DBUG_RETURN(1);
   }
-  TABLE_LIST *table_list= (TABLE_LIST*) select_lex->table_list.first;
+  TABLE_LIST *table_list= select_lex->table_list.first;
   table_list->schema_select_lex= schema_select_lex;
   table_list->schema_table_reformed= 1;
   DBUG_RETURN(0);
@@ -2011,7 +2035,7 @@ mysql_execute_command(THD *thd)
   /* first SELECT_LEX (have special meaning for many of non-SELECTcommands) */
   SELECT_LEX *select_lex= &lex->select_lex;
   /* first table of first SELECT_LEX */
-  TABLE_LIST *first_table= (TABLE_LIST*) select_lex->table_list.first;
+  TABLE_LIST *first_table= select_lex->table_list.first;
   /* list of all tables in query */
   TABLE_LIST *all_tables;
   /* most outer SELECT_LEX_UNIT of query */
@@ -2046,7 +2070,7 @@ mysql_execute_command(THD *thd)
   all_tables= lex->query_tables;
   /* set context for commands which do not use setup_tables */
   select_lex->
-    context.resolve_in_table_list_only((TABLE_LIST*)select_lex->
+    context.resolve_in_table_list_only(select_lex->
                                        table_list.first);
 
   /*
@@ -2678,7 +2702,7 @@ case SQLCOM_PREPARE:
         if (create_info.used_fields & HA_CREATE_USED_UNION)
         {
           TABLE_LIST *tab;
-          for (tab= (TABLE_LIST*) create_info.merge_list.first;
+          for (tab= create_info.merge_list.first;
                tab;
                tab= tab->next_local)
           {
@@ -2861,7 +2885,6 @@ end_with_restore_list:
                        NULL, /* Do not use first_table->grant with select_lex->db */
                        0, 0) ||
 	  check_merge_table_access(thd, first_table->db,
-				   (TABLE_LIST *)
 				   create_info.merge_list.first))
 	goto error;				/* purecov: inspected */
       if (check_grant(thd, priv_needed, all_tables, FALSE, UINT_MAX, FALSE))
@@ -2895,7 +2918,7 @@ end_with_restore_list:
                              first_table,
                              &alter_info,
                              select_lex->order_list.elements,
-                             (ORDER *) select_lex->order_list.first,
+                             select_lex->order_list.first,
                              lex->ignore);
       break;
     }
@@ -3034,7 +3057,7 @@ end_with_restore_list:
       */
       res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
     }
-    select_lex->table_list.first= (uchar*) first_table;
+    select_lex->table_list.first= first_table;
     lex->query_tables=all_tables;
     break;
   }
@@ -3046,7 +3069,7 @@ end_with_restore_list:
       goto error; /* purecov: inspected */
     thd->enable_slow_log= opt_log_slow_admin_statements;
     res = mysql_check_table(thd, first_table, &lex->check_opt);
-    select_lex->table_list.first= (uchar*) first_table;
+    select_lex->table_list.first= first_table;
     lex->query_tables=all_tables;
     break;
   }
@@ -3066,7 +3089,7 @@ end_with_restore_list:
       */
       res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
     }
-    select_lex->table_list.first= (uchar*) first_table;
+    select_lex->table_list.first= first_table;
     lex->query_tables=all_tables;
     break;
   }
@@ -3089,7 +3112,7 @@ end_with_restore_list:
       */
       res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
     }
-    select_lex->table_list.first= (uchar*) first_table;
+    select_lex->table_list.first= first_table;
     lex->query_tables=all_tables;
     break;
   }
@@ -3107,7 +3130,7 @@ end_with_restore_list:
                                   lex->value_list,
                                   select_lex->where,
                                   select_lex->order_list.elements,
-                                  (ORDER *) select_lex->order_list.first,
+                                  select_lex->order_list.first,
                                   unit->select_limit_cnt,
                                   lex->duplicates, lex->ignore,
                                   &found, &updated));
@@ -3267,7 +3290,7 @@ end_with_restore_list:
       MYSQL_INSERT_SELECT_START(thd->query());
       /* Skip first table, which is the table we are inserting in */
       TABLE_LIST *second_table= first_table->next_local;
-      select_lex->table_list.first= (uchar*) second_table;
+      select_lex->table_list.first= second_table;
       select_lex->context.table_list= 
         select_lex->context.first_name_resolution_table= second_table;
       res= mysql_insert_select_prepare(thd);
@@ -3299,7 +3322,7 @@ end_with_restore_list:
       }
       /* revert changes for SP */
       MYSQL_INSERT_SELECT_DONE(res, (ulong) thd->get_row_count_func());
-      select_lex->table_list.first= (uchar*) first_table;
+      select_lex->table_list.first= first_table;
     }
     /*
       If we have inserted into a VIEW, and the base table has
@@ -3350,8 +3373,7 @@ end_with_restore_list:
   case SQLCOM_DELETE_MULTI:
   {
     DBUG_ASSERT(first_table == all_tables && first_table != 0);
-    TABLE_LIST *aux_tables=
-      (TABLE_LIST *)thd->lex->auxiliary_table_list.first;
+    TABLE_LIST *aux_tables= thd->lex->auxiliary_table_list.first;
     multi_delete *del_result;
 
     if ((res= multi_delete_precheck(thd, all_tables)))
@@ -5178,7 +5200,7 @@ static bool check_show_access(THD *thd, TABLE_LIST *table)
   case SCH_STATISTICS:
   {
     TABLE_LIST *dst_table;
-    dst_table= (TABLE_LIST *) table->schema_select_lex->table_list.first;
+    dst_table= table->schema_select_lex->table_list.first;
 
     DBUG_ASSERT(dst_table);
 
@@ -5894,14 +5916,17 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
   bool error= 0;
   DBUG_ENTER("mysql_test_parse_for_slave");
 
-  Parser_state parser_state(thd, inBuf, length);
-  lex_start(thd);
-  mysql_reset_thd_for_next_command(thd);
+  Parser_state parser_state;
+  if (!(error= parser_state.init(thd, inBuf, length)))
+  {
+    lex_start(thd);
+    mysql_reset_thd_for_next_command(thd);
 
-  if (!parse_sql(thd, & parser_state, NULL) &&
-      all_tables_not_ok(thd,(TABLE_LIST*) lex->select_lex.table_list.first))
-    error= 1;                  /* Ignore question */
-  thd->end_statement();
+    if (!parse_sql(thd, & parser_state, NULL) &&
+        all_tables_not_ok(thd, lex->select_lex.table_list.first))
+      error= 1;                  /* Ignore question */
+    thd->end_statement();
+  }
   thd->cleanup_after_query();
   DBUG_RETURN(error);
 }
@@ -6026,7 +6051,7 @@ add_proc_to_list(THD* thd, Item *item)
   *item_ptr= item;
   order->item=item_ptr;
   order->free_me=0;
-  thd->lex->proc_list.link_in_list((uchar*) order,(uchar**) &order->next);
+  thd->lex->proc_list.link_in_list(order, &order->next);
   return 0;
 }
 
@@ -6035,7 +6060,7 @@ add_proc_to_list(THD* thd, Item *item)
   save order by and tables in own lists.
 */
 
-bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc)
+bool add_to_list(THD *thd, SQL_I_List<ORDER> &list, Item *item,bool asc)
 {
   ORDER *order;
   DBUG_ENTER("add_to_list");
@@ -6047,7 +6072,7 @@ bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc)
   order->free_me=0;
   order->used=0;
   order->counter_used= 0;
-  list.link_in_list((uchar*) order,(uchar**) &order->next);
+  list.link_in_list(order, &order->next);
   DBUG_RETURN(0);
 }
 
@@ -6177,7 +6202,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
   /* check that used name is unique */
   if (lock_type != TL_IGNORE)
   {
-    TABLE_LIST *first_table= (TABLE_LIST*) table_list.first;
+    TABLE_LIST *first_table= table_list.first;
     if (lex->sql_command == SQLCOM_CREATE_VIEW)
       first_table= first_table ? first_table->next_local : NULL;
     for (TABLE_LIST *tables= first_table ;
@@ -6219,7 +6244,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
     previous table reference to 'ptr'. Here we also add one element to the
     list 'table_list'.
   */
-  table_list.link_in_list((uchar*) ptr, (uchar**) &ptr->next_local);
+  table_list.link_in_list(ptr, &ptr->next_local);
   ptr->next_name_resolution_table= NULL;
   /* Link table in global list (all used tables) */
   lex->add_to_query_tables(ptr);
@@ -6455,7 +6480,7 @@ void st_select_lex::set_lock_for_tables(thr_lock_type lock_type)
   DBUG_ENTER("set_lock_for_tables");
   DBUG_PRINT("enter", ("lock_type: %d  for_update: %d", lock_type,
 		       for_update));
-  for (TABLE_LIST *tables= (TABLE_LIST*) table_list.first;
+  for (TABLE_LIST *tables= table_list.first;
        tables;
        tables= tables->next_local)
   {
@@ -7193,8 +7218,7 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables)
 bool multi_delete_precheck(THD *thd, TABLE_LIST *tables)
 {
   SELECT_LEX *select_lex= &thd->lex->select_lex;
-  TABLE_LIST *aux_tables=
-    (TABLE_LIST *)thd->lex->auxiliary_table_list.first;
+  TABLE_LIST *aux_tables= thd->lex->auxiliary_table_list.first;
   TABLE_LIST **save_query_tables_own_last= thd->lex->query_tables_own_last;
   DBUG_ENTER("multi_delete_precheck");
 
@@ -7297,13 +7321,13 @@ static TABLE_LIST *multi_delete_table_match(LEX *lex, TABLE_LIST *tbl,
 
 bool multi_delete_set_locks_and_link_aux_tables(LEX *lex)
 {
-  TABLE_LIST *tables= (TABLE_LIST*)lex->select_lex.table_list.first;
+  TABLE_LIST *tables= lex->select_lex.table_list.first;
   TABLE_LIST *target_tbl;
   DBUG_ENTER("multi_delete_set_locks_and_link_aux_tables");
 
   lex->table_count= 0;
 
-  for (target_tbl= (TABLE_LIST *)lex->auxiliary_table_list.first;
+  for (target_tbl= lex->auxiliary_table_list.first;
        target_tbl; target_tbl= target_tbl->next_local)
   {
     lex->table_count++;
@@ -7475,8 +7499,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
                    &create_table->grant.m_internal,
                    0, 0) ||
       check_merge_table_access(thd, create_table->db,
-			       (TABLE_LIST *)
-			       lex->create_info.merge_list.first))
+                               lex->create_info.merge_list.first))
     goto err;
   if (want_priv != CREATE_TMP_ACL &&
       check_grant(thd, want_priv, create_table, FALSE, 1, FALSE))
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index 6d968033ccd..de0a3035e9a 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -116,7 +116,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum enum_field_types t
 		       char *change, List<String> *interval_list,
 		       CHARSET_INFO *cs,
 		       uint uint_geom_type);
-bool add_to_list(THD *thd, SQL_LIST &list,Item *group,bool asc);
+bool add_to_list(THD *thd, SQL_I_List<ORDER> &list, Item *group, bool asc);
 void add_join_on(TABLE_LIST *b,Item *expr);
 void add_join_natural(TABLE_LIST *a,TABLE_LIST *b,List<String> *using_fields,
                       SELECT_LEX *lex);
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index fa9c698622b..bc9a7d8ee65 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -4199,7 +4199,9 @@ bool mysql_unpack_partition(THD *thd,
 
   thd->variables.character_set_client= system_charset_info;
 
-  Parser_state parser_state(thd, part_buf, part_info_len);
+  Parser_state parser_state;
+  if (parser_state.init(thd, part_buf, part_info_len))
+    goto end;
 
   if (init_lex_with_single_table(thd, table, &lex))
     goto end;
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 0282053ce7e..c87da592210 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -2001,10 +2001,6 @@ typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_uint_t, uint);
 typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulong_t, ulong);
 typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulonglong_t, ulonglong);
 
-#define SET_PLUGIN_VAR_RESOLVE(opt)\
-  *(mysql_sys_var_ptr_p*)&((opt)->resolve)= mysql_sys_var_ptr
-typedef uchar *(*mysql_sys_var_ptr_p)(void* a_thd, int offset);
-
 
 /****************************************************************************
   default variable data check and update functions
@@ -2539,11 +2535,49 @@ static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
   return (uchar*)thd->variables.dynamic_variables_ptr + offset;
 }
 
-static uchar *mysql_sys_var_ptr(void* a_thd, int offset)
+
+/**
+  For correctness and simplicity's sake, a pointer to a function
+  must be compatible with pointed-to type, that is, the return and
+  parameters types must be the same. Thus, a callback function is
+  defined for each scalar type. The functions are assigned in
+  construct_options to their respective types.
+*/
+
+static char *mysql_sys_var_char(THD* thd, int offset)
 {
-  return intern_sys_var_ptr((THD *)a_thd, offset, true);
+  return (char *) intern_sys_var_ptr(thd, offset, true);
 }
 
+static int *mysql_sys_var_int(THD* thd, int offset)
+{
+  return (int *) intern_sys_var_ptr(thd, offset, true);
+}
+
+static long *mysql_sys_var_long(THD* thd, int offset)
+{
+  return (long *) intern_sys_var_ptr(thd, offset, true);
+}
+
+static unsigned long *mysql_sys_var_ulong(THD* thd, int offset)
+{
+  return (unsigned long *) intern_sys_var_ptr(thd, offset, true);
+}
+
+static long long *mysql_sys_var_longlong(THD* thd, int offset)
+{
+  return (long long *) intern_sys_var_ptr(thd, offset, true);
+}
+
+static unsigned long long *mysql_sys_var_ulonglong(THD* thd, int offset)
+{
+  return (unsigned long long *) intern_sys_var_ptr(thd, offset, true);
+}
+
+static char **mysql_sys_var_str(THD* thd, int offset)
+{
+  return (char **) intern_sys_var_ptr(thd, offset, true);
+}
 
 void plugin_thdvar_init(THD *thd)
 {
@@ -3088,25 +3122,25 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
       continue;
     switch (opt->flags & PLUGIN_VAR_TYPEMASK) {
     case PLUGIN_VAR_BOOL:
-      SET_PLUGIN_VAR_RESOLVE((thdvar_bool_t *) opt);
+      ((thdvar_bool_t *) opt)->resolve= mysql_sys_var_char;
       break;
     case PLUGIN_VAR_INT:
-      SET_PLUGIN_VAR_RESOLVE((thdvar_int_t *) opt);
+      ((thdvar_int_t *) opt)->resolve= mysql_sys_var_int;
       break;
     case PLUGIN_VAR_LONG:
-      SET_PLUGIN_VAR_RESOLVE((thdvar_long_t *) opt);
+      ((thdvar_long_t *) opt)->resolve= mysql_sys_var_long;
       break;
     case PLUGIN_VAR_LONGLONG:
-      SET_PLUGIN_VAR_RESOLVE((thdvar_longlong_t *) opt);
+      ((thdvar_longlong_t *) opt)->resolve= mysql_sys_var_longlong;
       break;
     case PLUGIN_VAR_STR:
-      SET_PLUGIN_VAR_RESOLVE((thdvar_str_t *) opt);
+      ((thdvar_str_t *) opt)->resolve= mysql_sys_var_str;
       break;
     case PLUGIN_VAR_ENUM:
-      SET_PLUGIN_VAR_RESOLVE((thdvar_enum_t *) opt);
+      ((thdvar_enum_t *) opt)->resolve= mysql_sys_var_ulong;
       break;
     case PLUGIN_VAR_SET:
-      SET_PLUGIN_VAR_RESOLVE((thdvar_set_t *) opt);
+      ((thdvar_set_t *) opt)->resolve= mysql_sys_var_ulonglong;
       break;
     default:
       sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index c2d3c595d95..296fcf301d3 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1330,7 +1330,7 @@ static int mysql_test_update(Prepared_statement *stmt,
 
   if (mysql_prepare_update(thd, table_list, &select->where,
                            select->order_list.elements,
-                           (ORDER *) select->order_list.first))
+                           select->order_list.first))
     goto error;
 
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -1845,11 +1845,10 @@ error:
 static int mysql_insert_select_prepare_tester(THD *thd)
 {
   SELECT_LEX *first_select= &thd->lex->select_lex;
-  TABLE_LIST *second_table= ((TABLE_LIST*)first_select->table_list.first)->
-    next_local;
+  TABLE_LIST *second_table= first_select->table_list.first->next_local;
 
   /* Skip first table, which is the table we are inserting in */
-  first_select->table_list.first= (uchar *) second_table;
+  first_select->table_list.first= second_table;
   thd->lex->select_lex.context.table_list=
     thd->lex->select_lex.context.first_name_resolution_table= second_table;
 
@@ -1886,7 +1885,7 @@ static bool mysql_test_insert_select(Prepared_statement *stmt,
     return 1;
 
   /* store it, because mysql_insert_select_prepare_tester change it */
-  first_local_table= (TABLE_LIST *)lex->select_lex.table_list.first;
+  first_local_table= lex->select_lex.table_list.first;
   DBUG_ASSERT(first_local_table != 0);
 
   res=
@@ -1894,7 +1893,7 @@ static bool mysql_test_insert_select(Prepared_statement *stmt,
                                     &mysql_insert_select_prepare_tester,
                                     OPTION_SETUP_TABLES_DONE);
   /* revert changes  made by mysql_insert_select_prepare_tester */
-  lex->select_lex.table_list.first= (uchar*) first_local_table;
+  lex->select_lex.table_list.first= first_local_table;
   return res;
 }
 
@@ -2404,10 +2403,10 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
       DBUG_ASSERT(sl->join == 0);
       ORDER *order;
       /* Fix GROUP list */
-      for (order= (ORDER *)sl->group_list.first; order; order= order->next)
+      for (order= sl->group_list.first; order; order= order->next)
         order->item= &order->item_ptr;
       /* Fix ORDER list */
-      for (order= (ORDER *)sl->order_list.first; order; order= order->next)
+      for (order= sl->order_list.first; order; order= order->next)
         order->item= &order->item_ptr;
 
       /* clear the no_error flag for INSERT/UPDATE IGNORE */
@@ -2451,7 +2450,7 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
     (multi-delete).  We do a full clean up, although at the moment all we
     need to clean in the tables of MULTI-DELETE list is 'table' member.
   */
-  for (TABLE_LIST *tables= (TABLE_LIST*) lex->auxiliary_table_list.first;
+  for (TABLE_LIST *tables= lex->auxiliary_table_list.first;
        tables;
        tables= tables->next_global)
   {
@@ -2945,7 +2944,9 @@ Execute_sql_statement::execute_server_code(THD *thd)
   if (alloc_query(thd, m_sql_text.str, m_sql_text.length))
     return TRUE;
 
-  Parser_state parser_state(thd, thd->query(), thd->query_length());
+  Parser_state parser_state;
+  if (parser_state.init(thd, thd->query(), thd->query_length()))
+    return TRUE;
 
   parser_state.m_lip.multi_statements= FALSE;
   lex_start(thd);
@@ -3185,14 +3186,23 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
   old_stmt_arena= thd->stmt_arena;
   thd->stmt_arena= this;
 
-  Parser_state parser_state(thd, thd->query(), thd->query_length());
+  Parser_state parser_state;
+  if (parser_state.init(thd, thd->query(), thd->query_length()))
+  {
+    thd->restore_backup_statement(this, &stmt_backup);
+    thd->restore_active_arena(this, &stmt_backup);
+    thd->stmt_arena= old_stmt_arena;
+    DBUG_RETURN(TRUE);
+  }
+
   parser_state.m_lip.stmt_prepare_mode= TRUE;
   parser_state.m_lip.multi_statements= FALSE;
+
   lex_start(thd);
 
   error= parse_sql(thd, & parser_state, NULL) ||
-         thd->is_error() ||
-         init_param_array(this);
+    thd->is_error() ||
+    init_param_array(this);
 
   lex->set_trg_event_type_for_tables();
 
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 10884a95b74..992fa8f6212 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -276,15 +276,15 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
       setup_tables_done_option changed for next rexecution
     */
     res= mysql_select(thd, &select_lex->ref_pointer_array,
-		      (TABLE_LIST*) select_lex->table_list.first,
+		      select_lex->table_list.first,
 		      select_lex->with_wild, select_lex->item_list,
 		      select_lex->where,
 		      select_lex->order_list.elements +
 		      select_lex->group_list.elements,
-		      (ORDER*) select_lex->order_list.first,
-		      (ORDER*) select_lex->group_list.first,
+		      select_lex->order_list.first,
+		      select_lex->group_list.first,
 		      select_lex->having,
-		      (ORDER*) lex->proc_list.first,
+		      lex->proc_list.first,
 		      select_lex->options | thd->variables.option_bits |
                       setup_tables_done_option,
 		      result, unit, select_lex);
@@ -2747,31 +2747,53 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds,
     /* 
        Build transitive closure for relation 'to be dependent on'.
        This will speed up the plan search for many cases with outer joins,
-       as well as allow us to catch illegal cross references/
+       as well as allow us to catch illegal cross references.
        Warshall's algorithm is used to build the transitive closure.
-       As we use bitmaps to represent the relation the complexity
-       of the algorithm is O((number of tables)^2). 
+       As we may restart the outer loop upto 'table_count' times, the
+       complexity of the algorithm is O((number of tables)^3).
+       However, most of the iterations will be shortcircuited when
+       there are no pedendencies to propogate.
     */
-    for (i= 0, s= stat ; i < table_count ; i++, s++)
+    for (i= 0 ; i < table_count ; i++)
     {
-      for (uint j= 0 ; j < table_count ; j++)
+      uint j;
+      table= stat[i].table;
+
+      if (!table->reginfo.join_tab->dependent)
+        continue;
+
+      /* Add my dependencies to other tables depending on me */
+      for (j= 0, s= stat ; j < table_count ; j++, s++)
       {
-        table= stat[j].table;
         if (s->dependent & table->map)
+        {
+          table_map was_dependent= s->dependent;
           s->dependent |= table->reginfo.join_tab->dependent;
+          /*
+            If we change dependencies for a table we already have
+            processed: Redo dependency propagation from this table.
+          */
+          if (i > j && s->dependent != was_dependent)
+          {
+            i = j-1;
+            break;
+          }
+        }
       }
-      if (outer_join & s->table->map)
-        s->table->maybe_null= 1;
     }
-    /* Catch illegal cross references for outer joins */
+
     for (i= 0, s= stat ; i < table_count ; i++, s++)
     {
+      /* Catch illegal cross references for outer joins */
       if (s->dependent & s->table->map)
       {
         join->tables=0;			// Don't use join->table
         my_message(ER_WRONG_OUTER_JOIN, ER(ER_WRONG_OUTER_JOIN), MYF(0));
         goto error;
       }
+
+      if (outer_join & s->table->map)
+        s->table->maybe_null= 1;
       s->key_dependent= s->dependent;
     }
   }
@@ -8824,6 +8846,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
   NESTED_JOIN *nested_join;
   TABLE_LIST *prev_table= 0;
   List_iterator<TABLE_LIST> li(*join_list);
+  bool straight_join= test(join->select_options & SELECT_STRAIGHT_JOIN);
   DBUG_ENTER("simplify_joins");
 
   /* 
@@ -8934,7 +8957,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
     if (prev_table)
     {
       /* The order of tables is reverse: prev_table follows table */
-      if (prev_table->straight)
+      if (prev_table->straight || straight_join)
         prev_table->dep_tables|= used_tables;
       if (prev_table->on_expr)
       {
@@ -17005,15 +17028,15 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
     thd->lex->current_select= first;
     unit->set_limit(unit->global_parameters);
     res= mysql_select(thd, &first->ref_pointer_array,
-			(TABLE_LIST*) first->table_list.first,
+			first->table_list.first,
 			first->with_wild, first->item_list,
 			first->where,
 			first->order_list.elements +
 			first->group_list.elements,
-			(ORDER*) first->order_list.first,
-			(ORDER*) first->group_list.first,
+			first->order_list.first,
+			first->group_list.first,
 			first->having,
-			(ORDER*) thd->lex->proc_list.first,
+			thd->lex->proc_list.first,
 			first->options | thd->variables.option_bits | SELECT_DESCRIBE,
 			result, unit, first);
   }
@@ -17316,7 +17339,7 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
   if (group_list.elements)
   {
     str->append(STRING_WITH_LEN(" group by "));
-    print_order(str, (ORDER *) group_list.first, query_type);
+    print_order(str, group_list.first, query_type);
     switch (olap)
     {
       case CUBE_TYPE:
@@ -17347,7 +17370,7 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
   if (order_list.elements)
   {
     str->append(STRING_WITH_LEN(" order by "));
-    print_order(str, (ORDER *) order_list.first, query_type);
+    print_order(str, order_list.first, query_type);
   }
 
   // limit
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 16a17744279..99073ced693 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2940,8 +2940,7 @@ fill_schema_show_cols_or_idxs(THD *thd, TABLE_LIST *tables,
   bool res;
   LEX_STRING tmp_lex_string, tmp_lex_string1, *db_name, *table_name;
   enum_sql_command save_sql_command= lex->sql_command;
-  TABLE_LIST *show_table_list= (TABLE_LIST*) tables->schema_select_lex->
-    table_list.first;
+  TABLE_LIST *show_table_list= tables->schema_select_lex->table_list.first;
   TABLE *table= tables->table;
   int error= 1;
   DBUG_ENTER("fill_schema_show");
@@ -3547,7 +3546,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
               goto err;
             if (make_table_list(thd, &sel, db_name, table_name))
               goto err;
-            TABLE_LIST *show_table_list= (TABLE_LIST*) sel.table_list.first;
+            TABLE_LIST *show_table_list= sel.table_list.first;
             lex->all_selects_list= &sel;
             lex->derived_tables= 0;
             lex->sql_command= SQLCOM_SHOW_FIELDS;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 5052e29ac30..dce23d1c09c 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4692,7 +4692,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
       table->next_global= 0;
       save_next_local= table->next_local;
       table->next_local= 0;
-      select->table_list.first= (uchar*)table;
+      select->table_list.first= table;
       /*
         Time zone tables and SP tables can be add to lex->query_tables list,
         so it have to be prepared.
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 9ce62d9f2a4..c3266b5cbe2 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -682,7 +682,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
   */
   old_field= new_field= table->field;
 
-  for (trg_field= (Item_trigger_field *)(lex->trg_table_fields.first);
+  for (trg_field= lex->trg_table_fields.first;
        trg_field; trg_field= trg_field->next_trg_field)
   {
     /*
@@ -1327,9 +1327,9 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
 
         thd->variables.sql_mode= (ulong)*trg_sql_mode;
 
-        Parser_state parser_state(thd,
-                                  trg_create_str->str,
-                                  trg_create_str->length);
+        Parser_state parser_state;
+        if (parser_state.init(thd, trg_create_str->str, trg_create_str->length))
+          goto err_with_lex_cleanup;
 
         Trigger_creation_ctx *creation_ctx=
           Trigger_creation_ctx::create(thd,
@@ -1443,7 +1443,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
         */
         triggers->trigger_fields[lex.trg_chistics.event]
                                 [lex.trg_chistics.action_time]=
-          (Item_trigger_field *)(lex.trg_table_fields.first);
+          lex.trg_table_fields.first;
         /*
           Also let us bind these objects to Field objects in table being
           opened.
@@ -1453,8 +1453,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
           SELECT)...
           Anyway some things can be checked only during trigger execution.
         */
-        for (Item_trigger_field *trg_field=
-               (Item_trigger_field *)(lex.trg_table_fields.first);
+        for (Item_trigger_field *trg_field= lex.trg_table_fields.first;
              trg_field;
              trg_field= trg_field->next_trg_field)
         {
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index a4d3f61f0e3..9ca4556524f 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -148,20 +148,19 @@ void
 st_select_lex_unit::init_prepare_fake_select_lex(THD *thd_arg) 
 {
   thd_arg->lex->current_select= fake_select_lex;
-  fake_select_lex->table_list.link_in_list((uchar *)&result_table_list,
-					   (uchar **)
-					   &result_table_list.next_local);
+  fake_select_lex->table_list.link_in_list(&result_table_list,
+                                           &result_table_list.next_local);
   fake_select_lex->context.table_list= 
     fake_select_lex->context.first_name_resolution_table= 
     fake_select_lex->get_table_list();
   if (!fake_select_lex->first_execution)
   {
-    for (ORDER *order= (ORDER *) global_parameters->order_list.first;
+    for (ORDER *order= global_parameters->order_list.first;
          order;
          order= order->next)
       order->item= &order->item_ptr;
   }
-  for (ORDER *order= (ORDER *)global_parameters->order_list.first;
+  for (ORDER *order= global_parameters->order_list.first;
        order;
        order=order->next)
   {
@@ -253,18 +252,18 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
     can_skip_order_by= is_union_select && !(sl->braces && sl->explicit_limit);
 
     saved_error= join->prepare(&sl->ref_pointer_array,
-                               (TABLE_LIST*) sl->table_list.first,
+                               sl->table_list.first,
                                sl->with_wild,
                                sl->where,
                                (can_skip_order_by ? 0 :
                                 sl->order_list.elements) +
                                sl->group_list.elements,
                                can_skip_order_by ?
-                               (ORDER*) 0 : (ORDER *)sl->order_list.first,
-                               (ORDER*) sl->group_list.first,
+                               NULL : sl->order_list.first,
+                               sl->group_list.first,
                                sl->having,
-                               (is_union_select ? (ORDER*) 0 :
-                                (ORDER*) thd_arg->lex->proc_list.first),
+                               (is_union_select ? NULL :
+                                thd_arg->lex->proc_list.first),
                                sl, this);
     /* There are no * in the statement anymore (for PS) */
     sl->with_wild= 0;
@@ -358,7 +357,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
     {
       ORDER *ord;
       Item_func::Functype ft=  Item_func::FT_FUNC;
-      for (ord= (ORDER*)global_parameters->order_list.first; ord; ord= ord->next)
+      for (ord= global_parameters->order_list.first; ord; ord= ord->next)
         if ((*ord->item)->walk (&Item::find_function_processor, FALSE, 
                                 (uchar *) &ft))
         {
@@ -420,12 +419,11 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
 	thd_arg->lex->current_select= fake_select_lex;
 	saved_error= fake_select_lex->join->
 	  prepare(&fake_select_lex->ref_pointer_array,
-		  (TABLE_LIST*) fake_select_lex->table_list.first,
+		  fake_select_lex->table_list.first,
 		  0, 0,
 		  fake_select_lex->order_list.elements,
-		  (ORDER*) fake_select_lex->order_list.first,
-		  (ORDER*) NULL, NULL,
-                  (ORDER*) NULL,
+		  fake_select_lex->order_list.first,
+		  NULL, NULL, NULL,
 		  fake_select_lex, this);
 	fake_select_lex->table_list.empty();
       }
@@ -601,8 +599,8 @@ bool st_select_lex_unit::exec()
                               &result_table_list,
                               0, item_list, NULL,
                               global_parameters->order_list.elements,
-                              (ORDER*)global_parameters->order_list.first,
-                              (ORDER*) NULL, NULL, (ORDER*) NULL,
+                              global_parameters->order_list.first,
+                              NULL, NULL, NULL,
                               fake_select_lex->options | SELECT_NO_UNLOCK,
                               result, this, fake_select_lex);
       }
@@ -624,8 +622,8 @@ bool st_select_lex_unit::exec()
                                 &result_table_list,
                                 0, item_list, NULL,
                                 global_parameters->order_list.elements,
-                                (ORDER*)global_parameters->order_list.first,
-                                (ORDER*) NULL, NULL, (ORDER*) NULL,
+                                global_parameters->order_list.first,
+                                NULL, NULL, NULL,
                                 fake_select_lex->options | SELECT_NO_UNLOCK,
                                 result, this, fake_select_lex);
         }
@@ -701,7 +699,7 @@ bool st_select_lex_unit::cleanup()
     if (global_parameters->order_list.elements)
     {
       ORDER *ord;
-      for (ord= (ORDER*)global_parameters->order_list.first; ord; ord= ord->next)
+      for (ord= global_parameters->order_list.first; ord; ord= ord->next)
         (*ord->item)->walk (&Item::cleanup_processor, 0, 0);
     }
   }
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 9adfe896c73..127368cef5c 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -408,7 +408,7 @@ int mysql_update(THD *thd,
       matching rows before updating the table!
     */
     if (used_index < MAX_KEY && old_covering_keys.is_set(used_index))
-      table->mark_columns_used_by_index(used_index);
+      table->add_read_columns_used_by_index(used_index);
     else
     {
       table->use_all_columns();
@@ -1288,7 +1288,7 @@ int multi_update::prepare(List<Item> &not_used_values,
 			  SELECT_LEX_UNIT *lex_unit)
 {
   TABLE_LIST *table_ref;
-  SQL_LIST update;
+  SQL_I_List<TABLE_LIST> update;
   table_map tables_to_update;
   Item_field *item;
   List_iterator_fast<Item> field_it(*fields);
@@ -1369,11 +1369,11 @@ int multi_update::prepare(List<Item> &not_used_values,
     leaf_table_count++;
     if (tables_to_update & table->map)
     {
-      TABLE_LIST *tl= (TABLE_LIST*) thd->memdup((char*) table_ref,
+      TABLE_LIST *tl= (TABLE_LIST*) thd->memdup(table_ref,
 						sizeof(*tl));
       if (!tl)
 	DBUG_RETURN(1);
-      update.link_in_list((uchar*) tl, (uchar**) &tl->next_local);
+      update.link_in_list(tl, &tl->next_local);
       tl->shared= table_count++;
       table->no_keyread=1;
       table->covering_keys.clear_all();
@@ -1394,7 +1394,7 @@ int multi_update::prepare(List<Item> &not_used_values,
 
 
   table_count=  update.elements;
-  update_tables= (TABLE_LIST*) update.first;
+  update_tables= update.first;
 
   tmp_tables = (TABLE**) thd->calloc(sizeof(TABLE *) * table_count);
   tmp_table_param = (TMP_TABLE_PARAM*) thd->calloc(sizeof(TMP_TABLE_PARAM) *
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 3a6866f4a7e..8cb4df36cd5 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -896,7 +896,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
                               view->algorithm != VIEW_ALGORITHM_TMPTABLE)))
   {
     /* TODO: change here when we will support UNIONs */
-    for (TABLE_LIST *tbl= (TABLE_LIST *)lex->select_lex.table_list.first;
+    for (TABLE_LIST *tbl= lex->select_lex.table_list.first;
 	 tbl;
 	 tbl= tbl->next_local)
     {
@@ -1015,7 +1015,7 @@ loop_out:
   */
   if (view->updatable_view &&
       !lex->select_lex.master_unit()->is_union() &&
-      !((TABLE_LIST*)lex->select_lex.table_list.first)->next_local &&
+      !(lex->select_lex.table_list.first)->next_local &&
       find_table_in_global_list(lex->query_tables->next_global,
 				lex->query_tables->db,
 				lex->query_tables->table_name))
@@ -1216,9 +1216,10 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
     char old_db_buf[NAME_LEN+1];
     LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) };
     bool dbchanged;
-    Parser_state parser_state(thd,
-                              table->select_stmt.str,
-                              table->select_stmt.length);
+    Parser_state parser_state;
+    if (parser_state.init(thd, table->select_stmt.str,
+                          table->select_stmt.length))
+        goto err;
 
     /* 
       Use view db name as thread default database, in order to ensure
@@ -1376,8 +1377,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
         This may change in future, for example if we enable merging of
         views with subqueries in select list.
       */
-      view_main_select_tables=
-        (TABLE_LIST*)lex->select_lex.table_list.first;
+      view_main_select_tables= lex->select_lex.table_list.first;
 
       /*
         Let us set proper lock type for tables of the view's main
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 9f20a4ccf71..2d5f7df6009 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -526,8 +526,7 @@ set_trigger_new_row(THD *thd, LEX_STRING *name, Item *val)
     Let us add this item to list of all Item_trigger_field
     objects in trigger.
   */
-  lex->trg_table_fields.link_in_list((uchar *) trg_fld,
-                                     (uchar **) &trg_fld->next_trg_field);
+  lex->trg_table_fields.link_in_list(trg_fld, &trg_fld->next_trg_field);
 
   return lex->sphead->add_instr(sp_fld);
 }
@@ -5117,7 +5116,7 @@ create_table_option:
             */
             TABLE_LIST *last_non_sel_table= lex->create_last_non_select_table;
             DBUG_ASSERT(last_non_sel_table->next_global ==
-                        (TABLE_LIST *)lex->create_info.merge_list.first);
+                        lex->create_info.merge_list.first);
             last_non_sel_table->next_global= 0;
             Lex->query_tables_last= &last_non_sel_table->next_global;
 
@@ -6158,8 +6157,7 @@ alter:
               MYSQL_YYABORT;
             lex->col_list.empty();
             lex->select_lex.init_order();
-            lex->select_lex.db=
-              ((TABLE_LIST*) lex->select_lex.table_list.first)->db;
+            lex->select_lex.db= (lex->select_lex.table_list.first)->db;
             bzero((char*) &lex->create_info,sizeof(lex->create_info));
             lex->create_info.db_type= 0;
             lex->create_info.default_table_charset= NULL;
@@ -7209,8 +7207,8 @@ select_from:
           opt_order_clause opt_limit_clause procedure_clause
           {
             Select->context.table_list=
-              Select->context.first_name_resolution_table= 
-                (TABLE_LIST *) Select->table_list.first;
+              Select->context.first_name_resolution_table=
+                Select->table_list.first;
           }
         | FROM DUAL_SYM where_clause opt_limit_clause
           /* oracle compatibility: oracle always requires FROM clause,
@@ -8902,9 +8900,8 @@ opt_gorder_clause:
         | order_clause
           {
             SELECT_LEX *select= Select;
-            select->gorder_list=
-              (SQL_LIST*) sql_memdup((char*) &select->order_list,
-                                     sizeof(st_sql_list));
+            select->gorder_list= new (YYTHD->mem_root)
+                                   SQL_I_List<ORDER>(select->order_list);
             if (select->gorder_list == NULL)
               MYSQL_YYABORT;
             select->order_list.empty();
@@ -9961,7 +9958,7 @@ procedure_clause:
             }
             lex->proc_list.elements=0;
             lex->proc_list.first=0;
-            lex->proc_list.next= (uchar**) &lex->proc_list.first;
+            lex->proc_list.next= &lex->proc_list.first;
             Item_field *item= new (YYTHD->mem_root)
                                 Item_field(&lex->current_select->context,
                                            NULL, NULL, $2.str);
@@ -11893,8 +11890,8 @@ simple_ident_q:
                 Let us add this item to list of all Item_trigger_field objects
                 in trigger.
               */
-              lex->trg_table_fields.link_in_list((uchar*) trg_fld,
-                                                 (uchar**) &trg_fld->next_trg_field);
+              lex->trg_table_fields.link_in_list(trg_fld,
+                                                 &trg_fld->next_trg_field);
 
               $$= trg_fld;
             }
@@ -11980,7 +11977,7 @@ field_ident:
           ident { $$=$1;}
         | ident '.' ident '.' ident
           {
-            TABLE_LIST *table= (TABLE_LIST*) Select->table_list.first;
+            TABLE_LIST *table= Select->table_list.first;
             if (my_strcasecmp(table_alias_charset, $1.str, table->db))
             {
               my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
@@ -11996,7 +11993,7 @@ field_ident:
           }
         | ident '.' ident
           {
-            TABLE_LIST *table= (TABLE_LIST*) Select->table_list.first;
+            TABLE_LIST *table= Select->table_list.first;
             if (my_strcasecmp(table_alias_charset, $1.str, table->alias))
             {
               my_error(ER_WRONG_TABLE_NAME, MYF(0), $1.str);
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 48a5cf06147..856f4c6f771 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2379,12 +2379,33 @@ static ulonglong read_timestamp(THD *thd)
 {
   return (ulonglong) thd->start_time;
 }
+
+
+static bool check_timestamp(sys_var *self, THD *thd, set_var *var)
+{
+  time_t val;
+
+  if (!var->value)
+    return FALSE;
+
+  val= (time_t) var->save_result.ulonglong_value;
+  if (val < (time_t) MY_TIME_T_MIN || val > (time_t) MY_TIME_T_MAX)
+  {
+    my_message(ER_UNKNOWN_ERROR, 
+               "This version of MySQL doesn't support dates later than 2038",
+               MYF(0));
+    return TRUE;
+  }
+  return FALSE;
+}
+
+
 static Sys_var_session_special Sys_timestamp(
        "timestamp", "Set the time for this client",
        sys_var::ONLY_SESSION, NO_CMD_LINE,
        VALID_RANGE(0, ~(time_t)0), BLOCK_SIZE(1),
-       NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0), ON_UPDATE(update_timestamp),
-       ON_READ(read_timestamp));
+       NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_timestamp), 
+       ON_UPDATE(update_timestamp), ON_READ(read_timestamp));
 
 static bool update_last_insert_id(THD *thd, set_var *var)
 {
diff --git a/sql/table.cc b/sql/table.cc
index b104c212593..3143db78520 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -61,6 +61,8 @@ static uint find_field(Field **fields, uchar *record, uint start, uint length);
 
 inline bool is_system_table_name(const char *name, uint length);
 
+static ulong get_form_pos(File file, uchar *head);
+
 /**************************************************************************
   Object_creation_ctx implementation.
 **************************************************************************/
@@ -702,7 +704,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
   disk_buff= 0;
 
   error= 3;
-  if (!(pos=get_form_pos(file,head,(TYPELIB*) 0)))
+  /* Position of the form in the form file. */
+  if (!(pos= get_form_pos(file, head)))
     goto err;                                   /* purecov: inspected */
 
   mysql_file_seek(file,pos,MY_SEEK_SET,MYF(0));
@@ -2092,52 +2095,46 @@ void free_field_buffers_larger_than(TABLE *table, uint32 size)
   }
 }
 
-	/* Find where a form starts */
-	/* if formname is NullS then only formnames is read */
+/**
+  Find where a form starts.
 
-ulong get_form_pos(File file, uchar *head, TYPELIB *save_names)
+  @param head The start of the form file.
+
+  @remark If formname is NULL then only formnames is read.
+
+  @retval The form position.
+*/
+
+static ulong get_form_pos(File file, uchar *head)
 {
-  uint a_length,names,length;
-  uchar *pos,*buf;
+  uchar *pos, *buf;
+  uint names, length;
   ulong ret_value=0;
   DBUG_ENTER("get_form_pos");
 
-  names=uint2korr(head+8);
-  a_length=(names+2)*sizeof(char *);		/* Room for two extra */
+  names= uint2korr(head+8);
 
-  if (!save_names)
-    a_length=0;
-  else
-    save_names->type_names=0;			/* Clear if error */
+  if (!(names= uint2korr(head+8)))
+    DBUG_RETURN(0);
 
-  if (names)
+  length= uint2korr(head+4);
+
+  mysql_file_seek(file, 64L, MY_SEEK_SET, MYF(0));
+
+  if (!(buf= (uchar*) my_malloc(length+names*4, MYF(MY_WME))))
+    DBUG_RETURN(0);
+
+  if (mysql_file_read(file, buf, length+names*4, MYF(MY_NABP)))
   {
-    length=uint2korr(head+4);
-    mysql_file_seek(file, 64L, MY_SEEK_SET, MYF(0));
-    if (!(buf= (uchar*) my_malloc((size_t) length+a_length+names*4,
-				  MYF(MY_WME))) ||
-        mysql_file_read(file, buf+a_length, (size_t) (length+names*4),
-                        MYF(MY_NABP)))
-    {						/* purecov: inspected */
-      x_free((uchar*) buf);			/* purecov: inspected */
-      DBUG_RETURN(0L);				/* purecov: inspected */
-    }
-    pos= buf+a_length+length;
-    ret_value=uint4korr(pos);
-  }
-  if (! save_names)
-  {
-    if (names)
-      my_free((uchar*) buf,MYF(0));
-  }
-  else if (!names)
-    bzero((char*) save_names,sizeof(save_names));
-  else
-  {
-    char *str;
-    str=(char *) (buf+a_length);
-    fix_type_pointers((const char ***) &buf,save_names,1,&str);
+    x_free(buf);
+    DBUG_RETURN(0);
   }
+
+  pos= buf+length;
+  ret_value= uint4korr(pos);
+
+  my_free(buf, MYF(0));
+
   DBUG_RETURN(ret_value);
 }
 
@@ -4439,6 +4436,27 @@ void TABLE::mark_columns_used_by_index(uint index)
 }
 
 
+/*
+  Add fields used by a specified index to the table's read_set.
+
+  NOTE:
+    The original state can be restored with
+    restore_column_maps_after_mark_index().
+*/
+
+void TABLE::add_read_columns_used_by_index(uint index)
+{
+  MY_BITMAP *bitmap= &tmp_set;
+  DBUG_ENTER("TABLE::add_read_columns_used_by_index");
+
+  set_keyread(TRUE);
+  bitmap_copy(bitmap, read_set);
+  mark_columns_used_by_index_no_reset(index, bitmap);
+  column_bitmaps_set(bitmap, write_set);
+  DBUG_VOID_RETURN;
+}
+
+
 /*
   Restore to use normal column maps after key read
 
diff --git a/sql/table.h b/sql/table.h
index 87044ac769b..cef547ae830 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1068,6 +1068,7 @@ public:
   void prepare_for_position(void);
   void mark_columns_used_by_index_no_reset(uint index, MY_BITMAP *map);
   void mark_columns_used_by_index(uint index);
+  void add_read_columns_used_by_index(uint index);
   void restore_column_maps_after_mark_index();
   void mark_auto_increment_column(void);
   void mark_columns_needed_for_update(void);
@@ -1362,7 +1363,7 @@ struct TABLE_LIST
   }
 
   /*
-    List of tables local to a subquery (used by SQL_LIST). Considers
+    List of tables local to a subquery (used by SQL_I_List). Considers
     views as leaves (unlike 'next_leaf' below). Created at parse time
     in st_select_lex::add_table_to_list() -> table_list.link_in_list().
   */
diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc
index 7696f28081d..79a6fd79d4c 100644
--- a/sql/thr_malloc.cc
+++ b/sql/thr_malloc.cc
@@ -24,8 +24,6 @@
 extern "C" {
   void sql_alloc_error_handler(void)
   {
-    sql_print_error("%s", ER(ER_OUT_OF_RESOURCES));
-
     THD *thd= current_thd;
     if (thd)
     {
@@ -53,6 +51,12 @@ extern "C" {
                                        NULL);
       }
     }
+
+    /* Skip writing to the error log to avoid mtr complaints */
+    DBUG_EXECUTE_IF("simulate_out_of_memory", return;);
+
+    sql_print_error("%s", ER(ER_OUT_OF_RESOURCES));
+
   }
 }
 
diff --git a/sql/unireg.cc b/sql/unireg.cc
index dbe4e8712ea..802e5b7429c 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -117,7 +117,6 @@ bool mysql_create_frm(THD *thd, const char *file_name,
   File file;
   ulong filepos, data_offset;
   uchar fileinfo[64],forminfo[288],*keybuff;
-  TYPELIB formnames;
   uchar *screen_buff;
   char buff[128];
 #ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -128,7 +127,7 @@ bool mysql_create_frm(THD *thd, const char *file_name,
   DBUG_ENTER("mysql_create_frm");
 
   DBUG_ASSERT(*fn_rext((char*)file_name)); // Check .frm extension
-  formnames.type_names=0;
+
   if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,0)))
     DBUG_RETURN(1);
   DBUG_ASSERT(db_file != NULL);
@@ -267,8 +266,15 @@ bool mysql_create_frm(THD *thd, const char *file_name,
   key_buff_length= uint4korr(fileinfo+47);
   keybuff=(uchar*) my_malloc(key_buff_length, MYF(0));
   key_info_length= pack_keys(keybuff, keys, key_info, data_offset);
-  (void) get_form_pos(file,fileinfo,&formnames);
-  if (!(filepos=make_new_entry(file,fileinfo,&formnames,"")))
+
+  /*
+    Ensure that there are no forms in this newly created form file.
+    Even if the form file exists, create_frm must truncate it to
+    ensure one form per form file.
+  */
+  DBUG_ASSERT(uint2korr(fileinfo+8) == 0);
+
+  if (!(filepos= make_new_entry(file, fileinfo, NULL, "")))
     goto err;
   maxlength=(uint) next_io_size((ulong) (uint2korr(forminfo)+1000));
   int2store(forminfo+2,maxlength);
diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c
index 0d641de3e15..bad02835d86 100644
--- a/storage/archive/archive_reader.c
+++ b/storage/archive/archive_reader.c
@@ -355,15 +355,14 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"set-auto-increment", 'A',
    "Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.",
-   (uchar**) &new_auto_increment,
-   (uchar**) &new_auto_increment,
+   &new_auto_increment, &new_auto_increment,
    0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"silent", 's',
    "Only print errors. One can use two -s to make archive_reader very silent.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"tmpdir", 't',
    "Path for temporary files.",
-   (uchar**) &opt_tmpdir,
+   &opt_tmpdir,
    0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V',
    "Print version and exit.",
diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c
index eb563638d36..5317da78ee4 100644
--- a/storage/myisam/ft_nlq_search.c
+++ b/storage/myisam/ft_nlq_search.c
@@ -123,7 +123,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
       goto do_skip;
     }
 #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
-    tmp_weight=*(float*)&subkeys;
+    ft_floatXget(tmp_weight, info->lastkey+info->lastkey_length-extra);
 #else
 #error
 #endif
diff --git a/storage/myisam/fulltext.h b/storage/myisam/fulltext.h
index 856e93e034d..853eb6362e6 100644
--- a/storage/myisam/fulltext.h
+++ b/storage/myisam/fulltext.h
@@ -24,8 +24,23 @@
 #define HA_FT_WLEN   4
 #define FT_SEGS      2
 
+/**
+  Accessor methods for the weight and the number of subkeys in a buffer.
+
+  The weight is of float type and subkeys number is of integer type. Both
+  are stored in the same position of the buffer and the stored object is
+  identified by the sign (bit): the weight value is positive whilst the
+  number of subkeys is negative.
+
+  In light of C's strict-aliasing rules, which roughly state that an object
+  must not be accessed through incompatible types, these methods are used to
+  avoid any problems arising from the type duality inside the buffer. The
+  values are retrieved using a character type which can access any object.
+*/
 #define ft_sintXkorr(A)    mi_sint4korr(A)
 #define ft_intXstore(T,A)  mi_int4store(T,A)
+#define ft_floatXget(V,M)  mi_float4get(V,M)
+
 
 extern const HA_KEYSEG ft_keysegs[FT_SEGS];
 
diff --git a/storage/myisam/mi_test1.c b/storage/myisam/mi_test1.c
index 728ac9514fd..742864fe241 100644
--- a/storage/myisam/mi_test1.c
+++ b/storage/myisam/mi_test1.c
@@ -536,21 +536,21 @@ static struct my_option my_long_options[] =
   {"debug", '#', "Undocumented",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"delete_rows", 'd', "Undocumented", (uchar**) &remove_count,
-   (uchar**) &remove_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
+  {"delete_rows", 'd', "Undocumented", &remove_count,
+   &remove_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
   {"help", '?', "Display help and exit",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"insert_rows", 'i', "Undocumented", (uchar**) &insert_count,
-   (uchar**) &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
+  {"insert_rows", 'i', "Undocumented", &insert_count,
+   &insert_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
   {"key_alpha", 'a', "Use a key of type HA_KEYTYPE_TEXT",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"key_binary_pack", 'B', "Undocumented",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"key_blob", 'b', "Undocumented",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"key_cache", 'K', "Undocumented", (uchar**) &key_cacheing,
-   (uchar**) &key_cacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"key_length", 'k', "Undocumented", (uchar**) &key_length, (uchar**) &key_length,
+  {"key_cache", 'K', "Undocumented", &key_cacheing,
+   &key_cacheing, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"key_length", 'k', "Undocumented", &key_length, &key_length,
    0, GET_UINT, REQUIRED_ARG, 6, 0, 0, 0, 0, 0},
   {"key_multiple", 'm', "Undocumented",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -561,21 +561,21 @@ static struct my_option my_long_options[] =
   {"key_varchar", 'w', "Test VARCHAR keys",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"null_fields", 'N', "Define fields with NULL",
-   (uchar**) &null_fields, (uchar**) &null_fields, 0, GET_BOOL, NO_ARG,
+   &null_fields, &null_fields, 0, GET_BOOL, NO_ARG,
    0, 0, 0, 0, 0, 0},
   {"row_fixed_size", 'S', "Undocumented",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"row_pointer_size", 'R', "Undocumented", (uchar**) &rec_pointer_size,
-   (uchar**) &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"row_pointer_size", 'R', "Undocumented", &rec_pointer_size,
+   &rec_pointer_size, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"silent", 's', "Undocumented",
-   (uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"skip_update", 'U', "Undocumented", (uchar**) &skip_update,
-   (uchar**) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"unique", 'C', "Undocumented", (uchar**) &opt_unique, (uchar**) &opt_unique, 0,
+   &silent, &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"skip_update", 'U', "Undocumented", &skip_update,
+   &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"unique", 'C', "Undocumented", &opt_unique, &opt_unique, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"update_rows", 'u', "Undocumented", (uchar**) &update_count,
-   (uchar**) &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
-  {"verbose", 'v', "Be more verbose", (uchar**) &verbose, (uchar**) &verbose, 0,
+  {"update_rows", 'u', "Undocumented", &update_count,
+   &update_count, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
+  {"verbose", 'v', "Be more verbose", &verbose, &verbose, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V', "Print version number and exit",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c
index 7c14ae37de2..74fa506a5b5 100644
--- a/storage/myisam/myisam_ftdump.c
+++ b/storage/myisam/myisam_ftdump.c
@@ -113,7 +113,7 @@ int main(int argc,char *argv[])
 
     subkeys=ft_sintXkorr(info->lastkey+keylen+1);
     if (subkeys >= 0)
-      weight=*(float*)&subkeys;
+      ft_floatXget(weight, info->lastkey+keylen+1);
 
 #ifdef HAVE_SNPRINTF
     snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index 612dd6f3ce1..11ec52fd123 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -168,7 +168,7 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"character-sets-dir", OPT_CHARSETS_DIR,
    "Directory where character sets are.",
-   (uchar**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"check", 'c',
    "Check table for errors.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -188,8 +188,8 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"data-file-length", 'D',
    "Max length of data file (when recreating data-file when it's full).",
-   (uchar**) &check_param.max_data_file_length,
-   (uchar**) &check_param.max_data_file_length,
+   &check_param.max_data_file_length,
+   &check_param.max_data_file_length,
    0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"extend-check", 'e',
    "If used when checking a table, ensure that the table is 100 percent consistent, which will take a long time. If used when repairing a table, try to recover every possible row from the data file. Normally this will also find a lot of garbage rows; Don't use this option with repair if you are not totally desperate.",
@@ -211,13 +211,13 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"keys-used", 'k',
    "Tell MyISAM to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts.",
-   (uchar**) &check_param.keys_in_use,
-   (uchar**) &check_param.keys_in_use,
+   &check_param.keys_in_use,
+   &check_param.keys_in_use,
    0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0},
   {"max-record-length", OPT_MAX_RECORD_LENGTH,
    "Skip rows bigger than this if myisamchk can't allocate memory to hold it",
-   (uchar**) &check_param.max_record_length,
-   (uchar**) &check_param.max_record_length,
+   &check_param.max_record_length,
+   &check_param.max_record_length,
    0, GET_ULL, REQUIRED_ARG, LONGLONG_MAX, 0, LONGLONG_MAX, 0, 0, 0},
   {"medium-check", 'm',
    "Faster than extend-check, but only finds 99.99% of all errors. Should be good enough for most cases.",
@@ -246,12 +246,12 @@ static struct my_option my_long_options[] =
 #endif
   {"set-auto-increment", 'A',
    "Force auto_increment to start at this or higher value. If no value is given, then sets the next auto_increment value to the highest used value for the auto key + 1.",
-   (uchar**) &check_param.auto_increment_value,
-   (uchar**) &check_param.auto_increment_value,
+   &check_param.auto_increment_value,
+   &check_param.auto_increment_value,
    0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"set-collation", OPT_SET_COLLATION,
    "Change the collation used by the index",
-   (uchar**) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"silent", 's',
    "Only print errors. One can use two -s to make myisamchk very silent.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -260,12 +260,12 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"sort-records", 'R',
    "Sort records according to an index. This makes your data much more localized and may speed up things. (It may be VERY slow to do a sort the first time!)",
-   (uchar**) &check_param.opt_sort_key,
-   (uchar**) &check_param.opt_sort_key,
+   &check_param.opt_sort_key,
+   &check_param.opt_sort_key,
    0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"tmpdir", 't',
    "Path for temporary files.",
-   (uchar**) &opt_tmpdir,
+   &opt_tmpdir,
    0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"update-state", 'U',
    "Mark tables as crashed if any errors were found.",
@@ -283,54 +283,54 @@ static struct my_option my_long_options[] =
    "Wait if table is locked.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   { "key_buffer_size", OPT_KEY_BUFFER_SIZE, "",
-    (uchar**) &check_param.use_buffers, (uchar**) &check_param.use_buffers, 0,
+    &check_param.use_buffers, &check_param.use_buffers, 0,
     GET_ULL, REQUIRED_ARG, USE_BUFFER_INIT, MALLOC_OVERHEAD,
     SIZE_T_MAX, MALLOC_OVERHEAD,  IO_SIZE, 0},
   { "key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE,  "",
-    (uchar**) &opt_key_cache_block_size,
-    (uchar**) &opt_key_cache_block_size, 0,
+    &opt_key_cache_block_size,
+    &opt_key_cache_block_size, 0,
     GET_LONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH,
     MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0},
   { "myisam_block_size", OPT_MYISAM_BLOCK_SIZE,  "",
-    (uchar**) &opt_myisam_block_size, (uchar**) &opt_myisam_block_size, 0,
+    &opt_myisam_block_size, &opt_myisam_block_size, 0,
     GET_LONG, REQUIRED_ARG, MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH,
     MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0},
   { "read_buffer_size", OPT_READ_BUFFER_SIZE, "",
-    (uchar**) &check_param.read_buffer_length,
-    (uchar**) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+    &check_param.read_buffer_length,
+    &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
     (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
     INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
   { "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "",
-    (uchar**) &check_param.write_buffer_length,
-    (uchar**) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+    &check_param.write_buffer_length,
+    &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
     (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
     INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
   { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",
-    (uchar**) &check_param.sort_buffer_length,
-    (uchar**) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+    &check_param.sort_buffer_length,
+    &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
     (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
     ULONG_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
   { "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
-    (uchar**) &check_param.sort_key_blocks,
-    (uchar**) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
+    &check_param.sort_key_blocks,
+    &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
     BUFFERS_WHEN_SORTING, 4L, 100L, 0L, 1L, 0},
-  { "decode_bits", OPT_DECODE_BITS, "", (uchar**) &decode_bits,
-    (uchar**) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
-  { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", (uchar**) &ft_min_word_len,
-    (uchar**) &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
+  { "decode_bits", OPT_DECODE_BITS, "", &decode_bits,
+    &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
+  { "ft_min_word_len", OPT_FT_MIN_WORD_LEN, "", &ft_min_word_len,
+    &ft_min_word_len, 0, GET_ULONG, REQUIRED_ARG, 4, 1, HA_FT_MAXCHARLEN,
     0, 1, 0},
-  { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (uchar**) &ft_max_word_len,
-    (uchar**) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
+  { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", &ft_max_word_len,
+    &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
     HA_FT_MAXCHARLEN, 0, 1, 0},
   { "ft_stopword_file", OPT_FT_STOPWORD_FILE,
     "Use stopwords from this file instead of built-in list.",
-    (uchar**) &ft_stopword_file, (uchar**) &ft_stopword_file, 0, GET_STR,
+    &ft_stopword_file, &ft_stopword_file, 0, GET_STR,
     REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"stats_method", OPT_STATS_METHOD,
    "Specifies how index statistics collection code should treat NULLs. "
    "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
    "\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
-   (uchar**) &myisam_stats_method_str, (uchar**) &myisam_stats_method_str, 0,
+   &myisam_stats_method_str, &myisam_stats_method_str, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c
index b2699d66f84..089e3480da6 100644
--- a/storage/myisam/myisamlog.c
+++ b/storage/myisam/myisamlog.c
@@ -382,18 +382,18 @@ static int examine_log(char * file_name, char **table_names)
 	       curr_file_info->show_name);
       if (my_b_read(&cache,(uchar*) head,2))
 	goto err;
+      buff= 0;
       file_info.name=0;
       file_info.show_name=0;
       file_info.record=0;
-      if (read_string(&cache,(uchar**) &file_info.name,
-		      (uint) mi_uint2korr(head)))
+      if (read_string(&cache, &buff, (uint) mi_uint2korr(head)))
 	goto err;
       {
 	uint i;
 	char *pos,*to;
 
 	/* Fix if old DOS files to new format */
-	for (pos=file_info.name; (pos=strchr(pos,'\\')) ; pos++)
+	for (pos=file_info.name=(char*)buff; (pos=strchr(pos,'\\')) ; pos++)
 	  *pos= '/';
 
 	pos=file_info.name;
@@ -692,7 +692,7 @@ static int read_string(IO_CACHE *file, register uchar* *to, register uint length
     *to= 0;
     DBUG_RETURN(1);
   }
-  *((char*) *to+length)= '\0';
+  *((uchar*) *to+length)= '\0';
   DBUG_RETURN (0);
 }				/* read_string */
 
diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c
index 1d8d2e2fcfe..18810a60166 100644
--- a/storage/myisam/myisampack.c
+++ b/storage/myisam/myisampack.c
@@ -265,10 +265,10 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"backup", 'b', "Make a backup of the table as table_name.OLD.",
-   (uchar**) &backup, (uchar**) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   &backup, &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"character-sets-dir", OPT_CHARSETS_DIR_MP,
-   "Directory where character sets are.", (uchar**) &charsets_dir,
-   (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   "Directory where character sets are.", &charsets_dir,
+   &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"force", 'f',
@@ -276,7 +276,7 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"join", 'j',
    "Join all given tables into 'new_table_name'. All tables MUST have identical layouts.",
-   (uchar**) &join_table, (uchar**) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+   &join_table, &join_table, 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},
@@ -290,8 +290,8 @@ static struct my_option my_long_options[] =
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V', "Output version information and exit.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"wait", 'w', "Wait and retry if table is in use.", (uchar**) &opt_wait,
-   (uchar**) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"wait", 'w', "Wait and retry if table is in use.", &opt_wait,
+   &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 9fc868a2ebe..63d20f127a1 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -1423,8 +1423,8 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
 	goto err;
 
       create_info->merge_list.elements++;
-      (*create_info->merge_list.next) = (uchar*) ptr;
-      create_info->merge_list.next= (uchar**) &ptr->next_local;
+      (*create_info->merge_list.next) = ptr;
+      create_info->merge_list.next= &ptr->next_local;
     }
     *create_info->merge_list.next=0;
   }
@@ -1446,7 +1446,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
 {
   char buff[FN_REFLEN];
   const char **table_names, **pos;
-  TABLE_LIST *tables= (TABLE_LIST*) create_info->merge_list.first;
+  TABLE_LIST *tables= create_info->merge_list.first;
   THD *thd= current_thd;
   size_t dirlgt= dirname_length(name);
   DBUG_ENTER("ha_myisammrg::create");
diff --git a/strings/decimal.c b/strings/decimal.c
index 42dc33e5ac6..99b7ccd3249 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -952,12 +952,12 @@ int decimal2double(decimal_t *from, double *to)
 
   rc = decimal2string(from, strbuf, &len, 0, 0, 0);
   end= strbuf + len;
-  
+
   DBUG_PRINT("info", ("interm.: %s", strbuf));
 
   *to= my_strtod(strbuf, &end, &error);
-             
-  DBUG_PRINT("info", ("result: %f (%lx)", *to, *(ulong *)to));
+
+  DBUG_PRINT("info", ("result: %f", *to));
 
   return (rc != E_DEC_OK) ? rc : (error ? E_DEC_OVERFLOW : E_DEC_OK);
 }
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index b518b617535..a490cac054d 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -19178,17 +19178,17 @@ static char **defaults_argv;
 
 static struct my_option client_test_long_options[] =
 {
-  {"basedir", 'b', "Basedir for tests.", (uchar**) &opt_basedir,
-   (uchar**) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"count", 't', "Number of times test to be executed", (uchar **) &opt_count,
-   (uchar **) &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
-  {"database", 'D', "Database to use", (uchar **) &opt_db, (uchar **) &opt_db,
+  {"basedir", 'b', "Basedir for tests.", &opt_basedir,
+   &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"count", 't', "Number of times test to be executed", &opt_count,
+   &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
+  {"database", 'D', "Database to use", &opt_db, &opt_db,
    0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
-   (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug", '#', "Output debug log", &default_dbug_option,
+   &default_dbug_option, 0, GET_STR, OPT_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", (uchar **) &opt_host, (uchar **) &opt_host,
+  {"host", 'h', "Connect to host", &opt_host, &opt_host,
    0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"password", 'p',
    "Password to use when connecting to server. If password is not given it's asked from the tty.",
@@ -19199,8 +19199,7 @@ static struct my_option client_test_long_options[] =
    "/etc/services, "
 #endif
    "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
-   (uchar **) &opt_port,
-   (uchar **) &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   &opt_port, &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"server-arg", 'A', "Send embedded server this as a parameter.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"show-tests", 'T', "Show all tests' names", 0, 0, 0, GET_NO_ARG, NO_ARG,
@@ -19209,23 +19208,23 @@ static struct my_option client_test_long_options[] =
    0},
 #ifdef HAVE_SMEM
   {"shared-memory-base-name", 'm', "Base name of shared memory.", 
-  (uchar**) &shared_memory_base_name, (uchar**)&shared_memory_base_name, 0, 
+  &shared_memory_base_name, (uchar**)&shared_memory_base_name, 0, 
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"socket", 'S', "Socket file to use for connection",
-   (uchar **) &opt_unix_socket, (uchar **) &opt_unix_socket, 0, GET_STR,
+   &opt_unix_socket, &opt_unix_socket, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"testcase", 'c',
    "May disable some code when runs as mysql-test-run testcase.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 #ifndef DONT_ALLOW_USER_CHANGE
-  {"user", 'u', "User for login if not current user", (uchar **) &opt_user,
-   (uchar **) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"user", 'u', "User for login if not current user", &opt_user,
+   &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"vardir", 'v', "Data dir for tests.", (uchar**) &opt_vardir,
-   (uchar**) &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"vardir", 'v', "Data dir for tests.", &opt_vardir,
+   &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"getopt-ll-test", 'g', "Option for testing bug in getopt library",
-   (uchar **) &opt_getopt_ll_test, (uchar **) &opt_getopt_ll_test, 0,
+   &opt_getopt_ll_test, &opt_getopt_ll_test, 0,
    GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/unittest/examples/Makefile.am b/unittest/examples/Makefile.am
index cfb22e678d4..3e64c7ceddc 100644
--- a/unittest/examples/Makefile.am
+++ b/unittest/examples/Makefile.am
@@ -20,4 +20,5 @@ AM_LDFLAGS         = -L$(top_builddir)/unittest/mytap
 
 LDADD              = -lmytap
 
-noinst_PROGRAMS    = simple-t skip-t todo-t skip_all-t no_plan-t core-t
+# We omit core-t here, since it will always fail.
+noinst_PROGRAMS    = simple-t skip-t todo-t skip_all-t no_plan-t
diff --git a/unittest/examples/no_plan-t.c b/unittest/examples/no_plan-t.c
index 06378e81218..9aeb5c7666a 100644
--- a/unittest/examples/no_plan-t.c
+++ b/unittest/examples/no_plan-t.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,14 +20,19 @@
 
 /*
   Sometimes, the number of tests is not known beforehand. In those
-  cases, the plan can be omitted and will instead be written at the
-  end of the test (inside exit_status()).
+  cases, you should invoke plan(NO_PLAN).
+  The plan will be printed at the end of the test (inside exit_status()).
 
   Use this sparingly, it is a last resort: planning how many tests you
   are going to run will help you catch that offending case when some
   tests are skipped for an unknown reason.
 */
 int main() {
+  /*
+    We recommend calling plan(NO_PLAN), but want to verify that
+    omitting the call works as well.
+    plan(NO_PLAN);
+  */
   ok(1, " ");
   ok(1, " ");
   ok(1, " ");
diff --git a/unittest/mytap/tap.c b/unittest/mytap/tap.c
index a7552b15eed..2f1747d7167 100644
--- a/unittest/mytap/tap.c
+++ b/unittest/mytap/tap.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@
 
    @ingroup MyTAP_Internal
  */
-static TEST_DATA g_test = { 0, 0, 0, "" };
+static TEST_DATA g_test = { NO_PLAN, 0, 0, "" };
 
 /**
    Output stream for test report message.
@@ -84,6 +84,7 @@ vemit_tap(int pass, char const *fmt, va_list ap)
           (fmt && *fmt) ? " - " : "");
   if (fmt && *fmt)
     vfprintf(tapout, fmt, ap);
+  fflush(tapout);
 }
 
 
@@ -106,6 +107,7 @@ static void
 emit_dir(const char *dir, const char *why)
 {
   fprintf(tapout, " # %s %s", dir, why);
+  fflush(tapout);
 }
 
 
@@ -118,6 +120,7 @@ static void
 emit_endl()
 {
   fprintf(tapout, "\n");
+  fflush(tapout);
 }
 
 static void
@@ -204,7 +207,10 @@ plan(int count)
     break;
   default:
     if (count > 0)
+    {
       fprintf(tapout, "1..%d\n", count);
+      fflush(tapout);
+    }
     break;
   }
 }
@@ -217,6 +223,7 @@ skip_all(char const *reason, ...)
   va_start(ap, reason);
   fprintf(tapout, "1..0 # skip ");
   vfprintf(tapout, reason, ap);
+  fflush(tapout);
   va_end(ap);
   exit(0);
 }
diff --git a/unittest/mytap/tap.h b/unittest/mytap/tap.h
index d8f617c88fb..1f6edfbba07 100644
--- a/unittest/mytap/tap.h
+++ b/unittest/mytap/tap.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -90,10 +90,9 @@ extern int skip_big_tests;
 /**
    Set number of tests that is planned to execute.
 
-   The function also accepts the predefined constant
-   <code>NO_PLAN</code>.  If the function is not called, it is as if
-   it was called with <code>NO_PLAN</code>, i.e., the test plan will
-   be printed after all the test lines.
+   The function also accepts the predefined constant <code>NO_PLAN</code>.
+   If invoked with this constant -- or not invoked at all --
+   the test plan will be printed after all the test lines.
 
    The plan() function will install signal handlers for all signals
    that generate a core, so if you want to override these signals, do