#At file:///Users/malff/BZR_TREE/mysql-next-mr-wl4895/ based on revid:marc.alff@stripped
3154 Marc Alff 2010-06-02 [merge]
merge mysql-next-mr --> mysql-next-mr-wl4895
added:
mysql-test/include/mysqlbinlog_raw_mode.inc
mysql-test/r/mysqlbinlog_raw_mode.result
mysql-test/r/mysqlbinlog_raw_mode_win.result
mysql-test/t/mysqlbinlog_raw_mode.test
mysql-test/t/mysqlbinlog_raw_mode_win.test
modified:
client/Makefile.am
client/client_priv.h
client/mysqlbinlog.cc
=== modified file 'client/Makefile.am'
--- a/client/Makefile.am 2010-05-19 13:00:23 +0000
+++ b/client/Makefile.am 2010-05-20 17:20:23 +0000
@@ -57,14 +57,10 @@ mysql_LDADD = @readline_link@ @TERMCAP
$(LDADD) $(CXXLDFLAGS)
mysqladmin_SOURCES = mysqladmin.cc
-mysqlbinlog_SOURCES = mysqlbinlog.cc \
- $(top_srcdir)/mysys/mf_tempdir.c \
- $(top_srcdir)/mysys/my_new.cc \
- $(top_srcdir)/mysys/my_bit.c \
- $(top_srcdir)/mysys/my_bitmap.c \
- $(top_srcdir)/mysys/my_vle.c \
- $(top_srcdir)/mysys/base64.c
-mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
+mysqlbinlog_SOURCES = mysqlbinlog.cc
+mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
+ $(LIBMYSQLCLIENT_LA) @CLIENT_EXTRA_LDFLAGS@ \
+ $(top_builddir)/mysys/libmysys.a
mysqldump_SOURCES= mysqldump.c \
my_user.c \
=== modified file 'client/client_priv.h'
--- a/client/client_priv.h 2010-03-31 14:05:33 +0000
+++ b/client/client_priv.h 2010-05-11 10:37:34 +0000
@@ -84,6 +84,7 @@ enum options_client
OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
OPT_WRITE_BINLOG, OPT_DUMP_DATE,
OPT_INIT_COMMAND,
+ OPT_RAW_OUTPUT, OPT_WAIT_SERVER_ID, OPT_STOP_NEVER,
OPT_MAX_CLIENT_OPTION
};
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc 2010-04-22 15:07:50 +0000
+++ b/client/mysqlbinlog.cc 2010-05-28 07:26:32 +0000
@@ -32,6 +32,8 @@
#include <my_time.h>
/* That one is necessary for defines of OPTION_NO_FOREIGN_KEY_CHECKS etc */
#include "sql_priv.h"
+#include <signal.h>
+#include <my_dir.h>
#include "log_event.h"
#include "sql_common.h"
@@ -51,6 +53,7 @@ ulong open_files_limit;
uint test_flags = 0;
static uint opt_protocol= 0;
static FILE *result_file;
+char **defaults_argv;
#ifndef DBUG_OFF
static const char* default_dbug_option = "d:t:o,/tmp/mysqlbinlog.trace";
@@ -60,7 +63,7 @@ static const char *load_default_groups[]
static void error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
static void warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
-static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0;
+static bool one_database=0, disable_log_bin= 0;
static bool opt_hexdump= 0;
const char *base64_output_mode_names[]=
{"NEVER", "AUTO", "ALWAYS", "UNSPEC", "DECODE-ROWS", NullS};
@@ -70,10 +73,13 @@ TYPELIB base64_output_mode_typelib=
static enum_base64_output_mode opt_base64_output_mode= BASE64_OUTPUT_UNSPEC;
static const char *opt_base64_output_mode_str= NullS;
static const char* database= 0;
+static const char* output_file= 0;
static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
static my_bool debug_info_flag, debug_check_flag;
-static my_bool force_if_open_opt= 1;
+static my_bool force_if_open_opt= 1, raw_mode= 0;
+static my_bool to_last_remote_log= 0, stop_never= 0;
static ulonglong offset = 0;
+static ulonglong stop_never_server_id= 1;
static const char* host = 0;
static int port= 0;
static uint my_end_arg;
@@ -125,6 +131,10 @@ static Exit_status dump_remote_log_entri
static Exit_status dump_log_entries(const char* logname);
static Exit_status safe_connect();
+static void force_quit(int param);
+static void quit(Exit_status retval);
+static void init_signals(void);
+static int args_post_process(void);
class Load_log_processor
{
@@ -1081,6 +1091,14 @@ static struct my_option my_long_options[
{"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,
0, 0},
+ {"raw", OPT_RAW_OUTPUT, "Requires -R. Output raw binlog data instead of SQL \
+statements, output is to log files.",
+ (uchar**) &raw_mode, (uchar**) &raw_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+ 0, 0},
+ {"result-file", 'r', "Direct output to a given file. With --raw this is a \
+prefix for the file names. Cannot use with --result-dir.",
+ (uchar**) &output_file, (uchar**) &output_file, 0, GET_STR, REQUIRED_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,
@@ -1128,6 +1146,15 @@ static struct my_option my_long_options[
"(you should probably use quotes for your shell to set it properly).",
(uchar**) &stop_datetime_str, (uchar**) &stop_datetime_str,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"stop-never", OPT_STOP_NEVER, "Wait for more data from the server \
+instead of stopping at the end of the last log. Implicitly sets \
+--to-last-log but instead of stopping at the end of the last log it continues \
+to wait till the server disconnects.",
+ (uchar**) &stop_never, (uchar**) &stop_never, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"stop-never-slave-server-id", OPT_WAIT_SERVER_ID,
+ "The slave server ID used for stop-never", (uchar**) &stop_never_server_id,
+ (uchar**) &stop_never_server_id, 0, GET_ULONG, REQUIRED_ARG, 65535, 1, 65535, 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.",
@@ -1317,10 +1344,6 @@ get_one_option(int optid, const struct m
else
tty_password=1;
break;
- case 'r':
- if (!(result_file = my_fopen(argument, O_WRONLY | O_BINARY, MYF(MY_WME))))
- exit(1);
- break;
case 'R':
remote_opt= 1;
break;
@@ -1352,6 +1375,10 @@ get_one_option(int optid, const struct m
case 'V':
print_version();
exit(0);
+ case OPT_STOP_NEVER:
+ /* wait-for-data implicitly sets to-last-log */
+ to_last_remote_log= 1;
+ break;
case '?':
usage();
exit(0);
@@ -1436,7 +1463,10 @@ static Exit_status dump_log_entries(cons
Set safe delimiter, to dump things
like CREATE PROCEDURE safely
*/
- fprintf(result_file, "DELIMITER /*!*/;\n");
+ if (!raw_mode)
+ {
+ fprintf(result_file, "DELIMITER /*!*/;\n");
+ }
strmov(print_event_info.delimiter, "/*!*/;");
print_event_info.verbose= short_form ? 0 : verbose;
@@ -1445,8 +1475,11 @@ static Exit_status dump_log_entries(cons
dump_local_log_entries(&print_event_info, logname));
/* Set delimiter back to semicolon */
- fprintf(result_file, "DELIMITER ;\n");
- strmov(print_event_info.delimiter, ";");
+ if (!raw_mode)
+ {
+ fprintf(result_file, "DELIMITER ;\n");
+ strmov(print_event_info.delimiter, ";");
+ }
return rc;
}
@@ -1546,9 +1579,11 @@ static Exit_status dump_remote_log_entri
uchar buf[128];
ulong len;
uint logname_len;
+ uint server_id;
NET* net;
my_off_t old_off= start_position_mot;
char fname[FN_REFLEN+1];
+ char log_file_name[FN_REFLEN+1];
Exit_status retval= OK_CONTINUE;
DBUG_ENTER("dump_remote_log_entries");
@@ -1578,7 +1613,14 @@ static Exit_status dump_remote_log_entri
DBUG_RETURN(ERROR_STOP);
}
logname_len = (uint) tlen;
- int4store(buf + 6, 0);
+ /*
+ Fake a server ID to log continously.
+ This will show as a slave on the mysql server.
+ */
+ server_id= ((to_last_remote_log && stop_never) ?
+ stop_never_server_id : 0);
+
+ int4store(buf + 6, server_id);
memcpy(buf + 10, logname, logname_len);
if (simple_command(mysql, COM_BINLOG_DUMP, buf, logname_len + 10, 1))
{
@@ -1601,20 +1643,28 @@ static Exit_status dump_remote_log_entri
break; // end of data
DBUG_PRINT("info",( "len: %lu net->read_pos[5]: %d\n",
len, net->read_pos[5]));
- if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
- len - 1, &error_msg,
- glob_description_event)))
- {
- error("Could not construct log event object: %s", error_msg);
- DBUG_RETURN(ERROR_STOP);
- }
/*
- If reading from a remote host, ensure the temp_buf for the
- Log_event class is pointing to the incoming stream.
+ In raw mode We only need the full event details if it is a
+ ROTATE_EVENT or FORMAT_DESCRIPTION_EVENT
*/
- ev->register_temp_buf((char *) net->read_pos + 1);
- Log_event_type type= ev->get_type_code();
+ Log_event_type type= (Log_event_type) *(((const char*) net->read_pos + 1) + EVENT_TYPE_OFFSET);
+ if (!raw_mode || (type == ROTATE_EVENT) ||
+ (type == FORMAT_DESCRIPTION_EVENT))
+ {
+ if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
+ len - 1, &error_msg,
+ glob_description_event)))
+ {
+ error("Could not construct log event object: %s", error_msg);
+ DBUG_RETURN(ERROR_STOP);
+ }
+ /*
+ If reading from a remote host, ensure the temp_buf for the
+ Log_event class is pointing to the incoming stream.
+ */
+ ev->register_temp_buf((char *) net->read_pos + 1);
+ }
if (glob_description_event->binlog_version >= 3 ||
(type != LOAD_EVENT && type != CREATE_FILE_EVENT))
{
@@ -1637,6 +1687,19 @@ static Exit_status dump_remote_log_entri
part of our log) and then we will stop when we receive the fake one
soon.
*/
+ if (raw_mode)
+ {
+ if (output_file != 0)
+ {
+ my_snprintf(log_file_name, sizeof(log_file_name), "%s%s",
+ output_file, rev->new_log_ident);
+ }
+ else
+ {
+ strmov(log_file_name, rev->new_log_ident);
+ }
+ }
+
if (rev->when == 0)
{
if (!to_last_remote_log)
@@ -1666,10 +1729,45 @@ static Exit_status dump_remote_log_entri
don't increment old_off. Real Format_description_log_event always
starts from BIN_LOG_HEADER_SIZE position.
*/
- if (old_off != BIN_LOG_HEADER_SIZE)
- len= 1; // fake event, don't increment old_off
+ // fake event when not in raw mode, don't increment old_off
+ if ((old_off != BIN_LOG_HEADER_SIZE) && (!raw_mode))
+ len= 1;
+ if (raw_mode)
+ {
+ my_fclose(result_file, MYF(0));
+ if (!(result_file = my_fopen(log_file_name, O_WRONLY | O_BINARY,
+ MYF(MY_WME))))
+ {
+ error("Could not create log file '%s'", log_file_name);
+ DBUG_RETURN(ERROR_STOP);
+ }
+ fprintf(result_file,"%s", BINLOG_MAGIC);
+ /*
+ Need to handle these events correctly in raw mode too
+ or this could get messy
+ */
+ delete glob_description_event;
+ glob_description_event= (Format_description_log_event*) ev;
+ print_event_info->common_header_len= glob_description_event->common_header_len;
+ ev->temp_buf= 0;
+ ev= 0;
+ }
+ }
+
+ if (raw_mode)
+ {
+ my_fwrite(result_file, net->read_pos + 1 , len - 1, MYF(0));
+ if (ev)
+ {
+ ev->temp_buf=0;
+ delete ev;
+ }
}
- Exit_status retval= process_event(print_event_info, ev, old_off, logname);
+ else
+ {
+ retval= process_event(print_event_info, ev, old_off, logname);
+ }
+
if (retval != OK_CONTINUE)
DBUG_RETURN(retval);
}
@@ -1679,7 +1777,6 @@ static Exit_status dump_remote_log_entri
const char *old_fname= le->fname;
uint old_len= le->fname_len;
File file;
- Exit_status retval;
if ((file= load_processor.prepare_new_file_for_old_format(le,fname)) < 0)
DBUG_RETURN(ERROR_STOP);
@@ -2012,16 +2109,61 @@ end:
return retval;
}
+/* Post processing of arguments to check for conflicts and other setups */
+static int args_post_process(void)
+{
+ DBUG_ENTER("args_post_process");
+ MY_STAT stat_info;
+ int err;
+
+ if ((raw_mode != 0) && (one_database != 0))
+ {
+ warning("The --database option is ignored with --raw mode");
+ }
+
+ if ((remote_opt == 0) && (raw_mode != 0))
+ {
+ error("You need to set --read-from-remote-server for --raw mode");
+ DBUG_RETURN(ERROR_STOP);
+ }
+
+ if ((raw_mode) && (stop_position != (ulonglong)(~(my_off_t)0)))
+ {
+ warning("The --stop-position option is ignored in raw mode");
+ }
+
+ if ((raw_mode) && (stop_datetime != MY_TIME_T_MAX))
+ {
+ warning("The --stop-datetime option is ignored in raw mode");
+ }
+
+ /*
+ Make this last of the post-option tests so we don't exit with a
+ file open
+ */
+
+ if ((output_file != 0) && (!raw_mode))
+ {
+ if (!(result_file = my_fopen(output_file, O_WRONLY | O_BINARY, MYF(MY_WME))))
+ {
+ error("Could not create log file '%s'", output_file);
+ DBUG_RETURN(ERROR_STOP);
+ }
+ }
+ DBUG_RETURN(OK_CONTINUE);
+}
+
int main(int argc, char** argv)
{
- char **defaults_argv;
- Exit_status retval= OK_CONTINUE;
+ Exit_status retval= OK_STOP;
ulonglong save_stop_position;
MY_INIT(argv[0]);
DBUG_ENTER("main");
DBUG_PROCESS(argv[0]);
+ init_signals();
+
my_init_time(); // for time functions
if (load_defaults("my", load_default_groups, &argc, &argv))
@@ -2032,10 +2174,14 @@ int main(int argc, char** argv)
if (!argc)
{
usage();
- free_defaults(defaults_argv);
- exit(1);
+ quit(ERROR_STOP);
}
+ /* Check for argument conflicts and do any post-processing */
+ if (args_post_process() == ERROR_STOP)
+ quit(ERROR_STOP);
+
+
if (opt_base64_output_mode == BASE64_OUTPUT_UNSPEC)
opt_base64_output_mode= BASE64_OUTPUT_AUTO;
@@ -2057,27 +2203,30 @@ int main(int argc, char** argv)
else
load_processor.init_by_cur_dir();
- fprintf(result_file,
- "/*!40019 SET @@session.max_insert_delayed_threads=0*/;\n");
-
- if (disable_log_bin)
+ if (!raw_mode)
+ {
fprintf(result_file,
- "/*!32316 SET @OLD_SQL_LOG_BIN=@@SQL_LOG_BIN, SQL_LOG_BIN=0*/;\n");
+ "/*!40019 SET @@session.max_insert_delayed_threads=0*/;\n");
- /*
- In mysqlbinlog|mysql, don't want mysql to be disconnected after each
- transaction (which would be the case with GLOBAL.COMPLETION_TYPE==2).
- */
- fprintf(result_file,
- "/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,"
- "COMPLETION_TYPE=0*/;\n");
+ if (disable_log_bin)
+ fprintf(result_file,
+ "/*!32316 SET @OLD_SQL_LOG_BIN=@@SQL_LOG_BIN, SQL_LOG_BIN=0*/;\n");
- if (charset)
+ /*
+ In mysqlbinlog|mysql, don't want mysql to be disconnected after each
+ transaction (which would be the case with GLOBAL.COMPLETION_TYPE==2).
+ */
fprintf(result_file,
- "\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;"
- "\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;"
- "\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;"
- "\n/*!40101 SET NAMES %s */;\n", charset);
+ "/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,"
+ "COMPLETION_TYPE=0*/;\n");
+
+ if (charset)
+ fprintf(result_file,
+ "\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;"
+ "\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;"
+ "\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;"
+ "\n/*!40101 SET NAMES %s */;\n", charset);
+ }
for (save_stop_position= stop_position, stop_position= ~(my_off_t)0 ;
(--argc >= 0) ; )
@@ -2091,36 +2240,57 @@ int main(int argc, char** argv)
start_position= BIN_LOG_HEADER_SIZE;
}
- /*
- Issue a ROLLBACK in case the last printed binlog was crashed and had half
- of transaction.
- */
- fprintf(result_file,
+ if (!raw_mode)
+ {
+ /*
+ Issue a ROLLBACK in case the last printed binlog was crashed and had half
+ of transaction.
+ */
+ fprintf(result_file,
"# End of log file\nROLLBACK /* added by mysqlbinlog */;\n"
"/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;\n");
- if (disable_log_bin)
- fprintf(result_file, "/*!32316 SET SQL_LOG_BIN=@OLD_SQL_LOG_BIN*/;\n");
+ if (disable_log_bin)
+ fprintf(result_file, "/*!32316 SET SQL_LOG_BIN=@OLD_SQL_LOG_BIN*/;\n");
- if (charset)
- fprintf(result_file,
- "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n"
- "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n"
- "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
+ if (charset)
+ fprintf(result_file,
+ "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n"
+ "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n"
+ "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
+ }
if (tmpdir.list)
free_tmpdir(&tmpdir);
+ quit(retval);
+}
+
+/* Catch all these signals so that we can close files safely when exiting */
+static void init_signals(void)
+{
+ int signals[] = {SIGINT,SIGTERM};
+
+ for (uint i=0 ; i < sizeof(signals)/sizeof(int) ; i++)
+ signal(signals[i], force_quit);
+}
+
+static void force_quit(int param)
+{
+ quit(OK_STOP);
+}
+
+static void quit(Exit_status retval)
+{
if (result_file != stdout)
my_fclose(result_file, MYF(0));
cleanup();
- free_defaults(defaults_argv);
+ if (defaults_argv)
+ free_defaults(defaults_argv);
my_free_open_file_info();
load_processor.destroy();
/* We cannot free DBUG, it is used in global destructors after exit(). */
my_end(my_end_arg | MY_DONT_FREE_DBUG);
exit(retval == ERROR_STOP ? 1 : 0);
- /* Keep compilers happy. */
- DBUG_RETURN(retval == ERROR_STOP ? 1 : 0);
}
/*
=== added file 'mysql-test/include/mysqlbinlog_raw_mode.inc'
--- a/mysql-test/include/mysqlbinlog_raw_mode.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/mysqlbinlog_raw_mode.inc 2010-05-21 21:48:20 +0000
@@ -0,0 +1,388 @@
+# Tests for new raw mode features in mysqlbinlog, row mode
+# TODO: Test --wait-for-data
+
+# Delete all the binary logs
+reset master;
+
+# we need this for getting fixed timestamps inside of this test
+set timestamp=1000000000;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+CREATE TABLE t1 (c01 BIT);
+INSERT INTO t1 VALUES (0);
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+
+CREATE TABLE t1 (c01 BIT(7));
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (16);
+INSERT INTO t1 VALUES (32);
+INSERT INTO t1 VALUES (64);
+INSERT INTO t1 VALUES (127);
+DELETE FROM t1 WHERE c01=127;
+UPDATE t1 SET c01=15 WHERE c01=16;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a BIT(20), b CHAR(2));
+INSERT INTO t1 VALUES (b'00010010010010001001', 'ab');
+DROP TABLE t1;
+
+CREATE TABLE t1 (c02 BIT(64));
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (128);
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (c03 TINYINT);
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t1 VALUES (-128);
+UPDATE t1 SET c03=2 WHERE c03=1;
+DELETE FROM t1 WHERE c03=-128;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c04 TINYINT UNSIGNED);
+INSERT INTO t1 VALUES (128), (255);
+UPDATE t1 SET c04=2 WHERE c04=1;
+DELETE FROM t1 WHERE c04=255;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c06 BOOL);
+INSERT INTO t1 VALUES (TRUE);
+DELETE FROM t1 WHERE c06=TRUE;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c07 SMALLINT);
+INSERT INTO t1 VALUES (1234);
+DELETE FROM t1 WHERE c07=1234;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c08 SMALLINT UNSIGNED);
+INSERT INTO t1 VALUES (32768), (65535);
+UPDATE t1 SET c08=2 WHERE c08=32768;
+DELETE FROM t1 WHERE c08=65535;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c10 MEDIUMINT);
+INSERT INTO t1 VALUES (12345);
+DELETE FROM t1 WHERE c10=12345;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c11 MEDIUMINT UNSIGNED);
+INSERT INTO t1 VALUES (8388608), (16777215);
+UPDATE t1 SET c11=2 WHERE c11=8388608;
+DELETE FROM t1 WHERE c11=16777215;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c13 INT);
+INSERT INTO t1 VALUES (123456);
+DELETE FROM t1 WHERE c13=123456;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c14 INT UNSIGNED);
+INSERT INTO t1 VALUES (2147483648), (4294967295);
+UPDATE t1 SET c14=2 WHERE c14=2147483648;
+DELETE FROM t1 WHERE c14=4294967295;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c16 BIGINT);
+INSERT INTO t1 VALUES (1234567890);
+DELETE FROM t1 WHERE c16=1234567890;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c17 BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (9223372036854775808), (18446744073709551615);
+UPDATE t1 SET c17=2 WHERE c17=9223372036854775808;
+DELETE FROM t1 WHERE c17=18446744073709551615;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c19 FLOAT);
+INSERT INTO t1 VALUES (123.2234);
+DELETE FROM t1 WHERE c19>123;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c22 DOUBLE);
+INSERT INTO t1 VALUES (123434.22344545);
+DELETE FROM t1 WHERE c22>123434;
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c25 DECIMAL(10,5));
+INSERT INTO t1 VALUES (124.45);
+INSERT INTO t1 VALUES (-543.21);
+DELETE FROM t1 WHERE c25=124.45;
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c28 DATE);
+INSERT INTO t1 VALUES ('2001-02-03');
+DELETE FROM t1 WHERE c28='2001-02-03';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c29 DATETIME);
+INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
+DELETE FROM t1 WHERE c29='2001-02-03 10:20:30';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c30 TIMESTAMP);
+INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
+DELETE FROM t1 WHERE c30='2001-02-03 10:20:30';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c31 TIME);
+INSERT INTO t1 VALUES ('11:22:33');
+DELETE FROM t1 WHERE c31='11:22:33';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c32 YEAR);
+INSERT INTO t1 VALUES ('2001');
+DELETE FROM t1 WHERE c32=2001;
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c33 CHAR);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c33='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c34 CHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c34='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c35 CHAR(1));
+INSERT INTO t1 VALUES ('b');
+DELETE FROM t1 WHERE c35='b';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c36 CHAR(255));
+INSERT INTO t1 VALUES (repeat('c',255));
+DELETE FROM t1 WHERE c36>'c';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c37 NATIONAL CHAR);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c37='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c38 NATIONAL CHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c38='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c39 NATIONAL CHAR(1));
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c39='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c40 NATIONAL CHAR(255));
+INSERT INTO t1 VALUES (repeat('a', 255));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
+DELETE FROM t1 WHERE c40>'a';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c45 VARCHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c45='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c46 VARCHAR(1));
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c46='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c47 VARCHAR(255));
+INSERT INTO t1 VALUES (repeat('a',255));
+DELETE FROM t1 WHERE c47>'a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c48 VARCHAR(261));
+INSERT INTO t1 VALUES (repeat('a',261));
+DELETE FROM t1 WHERE c48>'a';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c49 NATIONAL VARCHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c49='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c50 NATIONAL VARCHAR(1));
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c50='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c51 NATIONAL VARCHAR(255));
+INSERT INTO t1 VALUES (repeat('a',255));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
+DELETE FROM t1 WHERE c51>'a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c52 NATIONAL VARCHAR(261));
+INSERT INTO t1 VALUES (repeat('a',261));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 261));
+DELETE FROM t1 WHERE c52>'a';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c57 BINARY);
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c57='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c58 BINARY(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c58='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c59 BINARY(1));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c59='a';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c60 BINARY(255));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES (repeat('a\0',120));
+DELETE FROM t1 WHERE c60<0x02;
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c61 VARBINARY(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c61='';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c62 VARBINARY(1));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c62=0x02;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c63 VARBINARY(255));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES (repeat('a\0',120));
+DELETE FROM t1 WHERE c63=0x02;
+DROP TABLE t1;
+
+#
+flush logs;
+
+CREATE TABLE t1 (c65 TINYBLOB);
+INSERT INTO t1 VALUES ('tinyblob1');
+DELETE FROM t1 WHERE c65='tinyblob1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c68 BLOB);
+INSERT INTO t1 VALUES ('blob1');
+DELETE FROM t1 WHERE c68='blob1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c71 MEDIUMBLOB);
+INSERT INTO t1 VALUES ('mediumblob1');
+DELETE FROM t1 WHERE c71='mediumblob1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c74 LONGBLOB);
+INSERT INTO t1 VALUES ('longblob1');
+DELETE FROM t1 WHERE c74='longblob1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c66 TINYTEXT);
+INSERT INTO t1 VALUES ('tinytext1');
+DELETE FROM t1 WHERE c66='tinytext1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c69 TEXT);
+INSERT INTO t1 VALUES ('text1');
+DELETE FROM t1 WHERE c69='text1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c72 MEDIUMTEXT);
+INSERT INTO t1 VALUES ('mediumtext1');
+DELETE FROM t1 WHERE c72='mediumtext1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (c75 LONGTEXT);
+INSERT INTO t1 VALUES ('longtext1');
+DELETE FROM t1 WHERE c75='longtext1';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c77 ENUM('a','b','c'));
+INSERT INTO t1 VALUES ('b');
+DELETE FROM t1 WHERE c77='b';
+DROP TABLE t1;
+
+#
+
+CREATE TABLE t1 (c78 SET('a','b','c','d','e','f'));
+INSERT INTO t1 VALUES ('a,b');
+INSERT INTO t1 VALUES ('a,c');
+INSERT INTO t1 VALUES ('b,c');
+INSERT INTO t1 VALUES ('a,b,c');
+INSERT INTO t1 VALUES ('a,b,c,d');
+INSERT INTO t1 VALUES ('a,b,c,d,e');
+INSERT INTO t1 VALUES ('a,b,c,d,e,f');
+DELETE FROM t1 WHERE c78='a,b';
+DROP TABLE t1;
+
+#
+# Check multi-table update
+#
+CREATE TABLE t1 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
+CREATE TABLE t2 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
+INSERT INTO t1 SET a=1;
+INSERT INTO t1 SET b=1;
+INSERT INTO t2 SET a=1;
+INSERT INTO t2 SET b=1;
+UPDATE t1, t2 SET t1.a=10, t2.a=20;
+DROP TABLE t1,t2;
+
+flush logs;
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+# Test reading one file in raw mode
+--exec $MYSQL_BINLOG --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001
+--diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
+--remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000001
+
+# Test reading all files in raw mode
+# Don't test the end file since this is still open with mysqld so will be different
+--exec $MYSQL_BINLOG --raw --read-from-remote-server --to-last-log --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001
+--diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
+--diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000002 $MYSQLD_DATADIR/master-bin.000002
+
+--remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000001
+--remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000002
+--remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000003
+
+
+# Test output to different filename
+--exec $MYSQL_BINLOG --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQLTEST_VARDIR/tmp/server1- master-bin.000001
+--diff_files $MYSQLTEST_VARDIR/tmp/server1-master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
+--remove_file $MYSQLTEST_VARDIR/tmp/server1-master-bin.000001
=== added file 'mysql-test/r/mysqlbinlog_raw_mode.result'
--- a/mysql-test/r/mysqlbinlog_raw_mode.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/mysqlbinlog_raw_mode.result 2010-05-21 21:48:20 +0000
@@ -0,0 +1,280 @@
+reset master;
+set timestamp=1000000000;
+drop table if exists t1;
+CREATE TABLE t1 (c01 BIT);
+INSERT INTO t1 VALUES (0);
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c01 BIT(7));
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (16);
+INSERT INTO t1 VALUES (32);
+INSERT INTO t1 VALUES (64);
+INSERT INTO t1 VALUES (127);
+DELETE FROM t1 WHERE c01=127;
+UPDATE t1 SET c01=15 WHERE c01=16;
+DROP TABLE t1;
+CREATE TABLE t1 (a BIT(20), b CHAR(2));
+INSERT INTO t1 VALUES (b'00010010010010001001', 'ab');
+DROP TABLE t1;
+CREATE TABLE t1 (c02 BIT(64));
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (128);
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111');
+DROP TABLE t1;
+CREATE TABLE t1 (c03 TINYINT);
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t1 VALUES (-128);
+UPDATE t1 SET c03=2 WHERE c03=1;
+DELETE FROM t1 WHERE c03=-128;
+DROP TABLE t1;
+CREATE TABLE t1 (c04 TINYINT UNSIGNED);
+INSERT INTO t1 VALUES (128), (255);
+UPDATE t1 SET c04=2 WHERE c04=1;
+DELETE FROM t1 WHERE c04=255;
+DROP TABLE t1;
+CREATE TABLE t1 (c06 BOOL);
+INSERT INTO t1 VALUES (TRUE);
+DELETE FROM t1 WHERE c06=TRUE;
+DROP TABLE t1;
+CREATE TABLE t1 (c07 SMALLINT);
+INSERT INTO t1 VALUES (1234);
+DELETE FROM t1 WHERE c07=1234;
+DROP TABLE t1;
+CREATE TABLE t1 (c08 SMALLINT UNSIGNED);
+INSERT INTO t1 VALUES (32768), (65535);
+UPDATE t1 SET c08=2 WHERE c08=32768;
+DELETE FROM t1 WHERE c08=65535;
+DROP TABLE t1;
+CREATE TABLE t1 (c10 MEDIUMINT);
+INSERT INTO t1 VALUES (12345);
+DELETE FROM t1 WHERE c10=12345;
+DROP TABLE t1;
+CREATE TABLE t1 (c11 MEDIUMINT UNSIGNED);
+INSERT INTO t1 VALUES (8388608), (16777215);
+UPDATE t1 SET c11=2 WHERE c11=8388608;
+DELETE FROM t1 WHERE c11=16777215;
+DROP TABLE t1;
+CREATE TABLE t1 (c13 INT);
+INSERT INTO t1 VALUES (123456);
+DELETE FROM t1 WHERE c13=123456;
+DROP TABLE t1;
+CREATE TABLE t1 (c14 INT UNSIGNED);
+INSERT INTO t1 VALUES (2147483648), (4294967295);
+UPDATE t1 SET c14=2 WHERE c14=2147483648;
+DELETE FROM t1 WHERE c14=4294967295;
+DROP TABLE t1;
+CREATE TABLE t1 (c16 BIGINT);
+INSERT INTO t1 VALUES (1234567890);
+DELETE FROM t1 WHERE c16=1234567890;
+DROP TABLE t1;
+CREATE TABLE t1 (c17 BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (9223372036854775808), (18446744073709551615);
+UPDATE t1 SET c17=2 WHERE c17=9223372036854775808;
+DELETE FROM t1 WHERE c17=18446744073709551615;
+DROP TABLE t1;
+CREATE TABLE t1 (c19 FLOAT);
+INSERT INTO t1 VALUES (123.2234);
+DELETE FROM t1 WHERE c19>123;
+DROP TABLE t1;
+CREATE TABLE t1 (c22 DOUBLE);
+INSERT INTO t1 VALUES (123434.22344545);
+DELETE FROM t1 WHERE c22>123434;
+DROP TABLE t1;
+CREATE TABLE t1 (c25 DECIMAL(10,5));
+INSERT INTO t1 VALUES (124.45);
+INSERT INTO t1 VALUES (-543.21);
+DELETE FROM t1 WHERE c25=124.45;
+DROP TABLE t1;
+CREATE TABLE t1 (c28 DATE);
+INSERT INTO t1 VALUES ('2001-02-03');
+DELETE FROM t1 WHERE c28='2001-02-03';
+DROP TABLE t1;
+CREATE TABLE t1 (c29 DATETIME);
+INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
+DELETE FROM t1 WHERE c29='2001-02-03 10:20:30';
+DROP TABLE t1;
+CREATE TABLE t1 (c30 TIMESTAMP);
+INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
+DELETE FROM t1 WHERE c30='2001-02-03 10:20:30';
+DROP TABLE t1;
+CREATE TABLE t1 (c31 TIME);
+INSERT INTO t1 VALUES ('11:22:33');
+DELETE FROM t1 WHERE c31='11:22:33';
+DROP TABLE t1;
+CREATE TABLE t1 (c32 YEAR);
+INSERT INTO t1 VALUES ('2001');
+DELETE FROM t1 WHERE c32=2001;
+DROP TABLE t1;
+CREATE TABLE t1 (c33 CHAR);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c33='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c34 CHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c34='';
+DROP TABLE t1;
+CREATE TABLE t1 (c35 CHAR(1));
+INSERT INTO t1 VALUES ('b');
+DELETE FROM t1 WHERE c35='b';
+DROP TABLE t1;
+CREATE TABLE t1 (c36 CHAR(255));
+INSERT INTO t1 VALUES (repeat('c',255));
+DELETE FROM t1 WHERE c36>'c';
+DROP TABLE t1;
+CREATE TABLE t1 (c37 NATIONAL CHAR);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c37='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c38 NATIONAL CHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c38='';
+DROP TABLE t1;
+CREATE TABLE t1 (c39 NATIONAL CHAR(1));
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c39='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c40 NATIONAL CHAR(255));
+INSERT INTO t1 VALUES (repeat('a', 255));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
+DELETE FROM t1 WHERE c40>'a';
+DROP TABLE t1;
+CREATE TABLE t1 (c45 VARCHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c45='';
+DROP TABLE t1;
+CREATE TABLE t1 (c46 VARCHAR(1));
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c46='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c47 VARCHAR(255));
+INSERT INTO t1 VALUES (repeat('a',255));
+DELETE FROM t1 WHERE c47>'a';
+DROP TABLE t1;
+CREATE TABLE t1 (c48 VARCHAR(261));
+INSERT INTO t1 VALUES (repeat('a',261));
+DELETE FROM t1 WHERE c48>'a';
+DROP TABLE t1;
+CREATE TABLE t1 (c49 NATIONAL VARCHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c49='';
+DROP TABLE t1;
+CREATE TABLE t1 (c50 NATIONAL VARCHAR(1));
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c50='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c51 NATIONAL VARCHAR(255));
+INSERT INTO t1 VALUES (repeat('a',255));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
+DELETE FROM t1 WHERE c51>'a';
+DROP TABLE t1;
+CREATE TABLE t1 (c52 NATIONAL VARCHAR(261));
+INSERT INTO t1 VALUES (repeat('a',261));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 261));
+DELETE FROM t1 WHERE c52>'a';
+DROP TABLE t1;
+CREATE TABLE t1 (c57 BINARY);
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c57='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c58 BINARY(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c58='';
+DROP TABLE t1;
+CREATE TABLE t1 (c59 BINARY(1));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c59='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c60 BINARY(255));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES (repeat('a\0',120));
+DELETE FROM t1 WHERE c60<0x02;
+DROP TABLE t1;
+CREATE TABLE t1 (c61 VARBINARY(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c61='';
+DROP TABLE t1;
+CREATE TABLE t1 (c62 VARBINARY(1));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c62=0x02;
+DROP TABLE t1;
+CREATE TABLE t1 (c63 VARBINARY(255));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES (repeat('a\0',120));
+DELETE FROM t1 WHERE c63=0x02;
+DROP TABLE t1;
+flush logs;
+CREATE TABLE t1 (c65 TINYBLOB);
+INSERT INTO t1 VALUES ('tinyblob1');
+DELETE FROM t1 WHERE c65='tinyblob1';
+DROP TABLE t1;
+CREATE TABLE t1 (c68 BLOB);
+INSERT INTO t1 VALUES ('blob1');
+DELETE FROM t1 WHERE c68='blob1';
+DROP TABLE t1;
+CREATE TABLE t1 (c71 MEDIUMBLOB);
+INSERT INTO t1 VALUES ('mediumblob1');
+DELETE FROM t1 WHERE c71='mediumblob1';
+DROP TABLE t1;
+CREATE TABLE t1 (c74 LONGBLOB);
+INSERT INTO t1 VALUES ('longblob1');
+DELETE FROM t1 WHERE c74='longblob1';
+DROP TABLE t1;
+CREATE TABLE t1 (c66 TINYTEXT);
+INSERT INTO t1 VALUES ('tinytext1');
+DELETE FROM t1 WHERE c66='tinytext1';
+DROP TABLE t1;
+CREATE TABLE t1 (c69 TEXT);
+INSERT INTO t1 VALUES ('text1');
+DELETE FROM t1 WHERE c69='text1';
+DROP TABLE t1;
+CREATE TABLE t1 (c72 MEDIUMTEXT);
+INSERT INTO t1 VALUES ('mediumtext1');
+DELETE FROM t1 WHERE c72='mediumtext1';
+DROP TABLE t1;
+CREATE TABLE t1 (c75 LONGTEXT);
+INSERT INTO t1 VALUES ('longtext1');
+DELETE FROM t1 WHERE c75='longtext1';
+DROP TABLE t1;
+CREATE TABLE t1 (c77 ENUM('a','b','c'));
+INSERT INTO t1 VALUES ('b');
+DELETE FROM t1 WHERE c77='b';
+DROP TABLE t1;
+CREATE TABLE t1 (c78 SET('a','b','c','d','e','f'));
+INSERT INTO t1 VALUES ('a,b');
+INSERT INTO t1 VALUES ('a,c');
+INSERT INTO t1 VALUES ('b,c');
+INSERT INTO t1 VALUES ('a,b,c');
+INSERT INTO t1 VALUES ('a,b,c,d');
+INSERT INTO t1 VALUES ('a,b,c,d,e');
+INSERT INTO t1 VALUES ('a,b,c,d,e,f');
+DELETE FROM t1 WHERE c78='a,b';
+DROP TABLE t1;
+CREATE TABLE t1 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
+CREATE TABLE t2 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
+INSERT INTO t1 SET a=1;
+INSERT INTO t1 SET b=1;
+INSERT INTO t2 SET a=1;
+INSERT INTO t2 SET b=1;
+UPDATE t1, t2 SET t1.a=10, t2.a=20;
+DROP TABLE t1,t2;
+flush logs;
+CREATE TABLE raw_mode_exit (exit_code INT);
+SELECT ((@id := id) - id) from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
+((@id := id) - id)
+0
+kill @id;
+DROP TABLE raw_mode_exit;
+End of tests
=== added file 'mysql-test/r/mysqlbinlog_raw_mode_win.result'
--- a/mysql-test/r/mysqlbinlog_raw_mode_win.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/mysqlbinlog_raw_mode_win.result 2010-05-21 21:48:20 +0000
@@ -0,0 +1,274 @@
+reset master;
+set timestamp=1000000000;
+drop table if exists t1;
+CREATE TABLE t1 (c01 BIT);
+INSERT INTO t1 VALUES (0);
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c01 BIT(7));
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (16);
+INSERT INTO t1 VALUES (32);
+INSERT INTO t1 VALUES (64);
+INSERT INTO t1 VALUES (127);
+DELETE FROM t1 WHERE c01=127;
+UPDATE t1 SET c01=15 WHERE c01=16;
+DROP TABLE t1;
+CREATE TABLE t1 (a BIT(20), b CHAR(2));
+INSERT INTO t1 VALUES (b'00010010010010001001', 'ab');
+DROP TABLE t1;
+CREATE TABLE t1 (c02 BIT(64));
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (128);
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111');
+DROP TABLE t1;
+CREATE TABLE t1 (c03 TINYINT);
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t1 VALUES (-128);
+UPDATE t1 SET c03=2 WHERE c03=1;
+DELETE FROM t1 WHERE c03=-128;
+DROP TABLE t1;
+CREATE TABLE t1 (c04 TINYINT UNSIGNED);
+INSERT INTO t1 VALUES (128), (255);
+UPDATE t1 SET c04=2 WHERE c04=1;
+DELETE FROM t1 WHERE c04=255;
+DROP TABLE t1;
+CREATE TABLE t1 (c06 BOOL);
+INSERT INTO t1 VALUES (TRUE);
+DELETE FROM t1 WHERE c06=TRUE;
+DROP TABLE t1;
+CREATE TABLE t1 (c07 SMALLINT);
+INSERT INTO t1 VALUES (1234);
+DELETE FROM t1 WHERE c07=1234;
+DROP TABLE t1;
+CREATE TABLE t1 (c08 SMALLINT UNSIGNED);
+INSERT INTO t1 VALUES (32768), (65535);
+UPDATE t1 SET c08=2 WHERE c08=32768;
+DELETE FROM t1 WHERE c08=65535;
+DROP TABLE t1;
+CREATE TABLE t1 (c10 MEDIUMINT);
+INSERT INTO t1 VALUES (12345);
+DELETE FROM t1 WHERE c10=12345;
+DROP TABLE t1;
+CREATE TABLE t1 (c11 MEDIUMINT UNSIGNED);
+INSERT INTO t1 VALUES (8388608), (16777215);
+UPDATE t1 SET c11=2 WHERE c11=8388608;
+DELETE FROM t1 WHERE c11=16777215;
+DROP TABLE t1;
+CREATE TABLE t1 (c13 INT);
+INSERT INTO t1 VALUES (123456);
+DELETE FROM t1 WHERE c13=123456;
+DROP TABLE t1;
+CREATE TABLE t1 (c14 INT UNSIGNED);
+INSERT INTO t1 VALUES (2147483648), (4294967295);
+UPDATE t1 SET c14=2 WHERE c14=2147483648;
+DELETE FROM t1 WHERE c14=4294967295;
+DROP TABLE t1;
+CREATE TABLE t1 (c16 BIGINT);
+INSERT INTO t1 VALUES (1234567890);
+DELETE FROM t1 WHERE c16=1234567890;
+DROP TABLE t1;
+CREATE TABLE t1 (c17 BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (9223372036854775808), (18446744073709551615);
+UPDATE t1 SET c17=2 WHERE c17=9223372036854775808;
+DELETE FROM t1 WHERE c17=18446744073709551615;
+DROP TABLE t1;
+CREATE TABLE t1 (c19 FLOAT);
+INSERT INTO t1 VALUES (123.2234);
+DELETE FROM t1 WHERE c19>123;
+DROP TABLE t1;
+CREATE TABLE t1 (c22 DOUBLE);
+INSERT INTO t1 VALUES (123434.22344545);
+DELETE FROM t1 WHERE c22>123434;
+DROP TABLE t1;
+CREATE TABLE t1 (c25 DECIMAL(10,5));
+INSERT INTO t1 VALUES (124.45);
+INSERT INTO t1 VALUES (-543.21);
+DELETE FROM t1 WHERE c25=124.45;
+DROP TABLE t1;
+CREATE TABLE t1 (c28 DATE);
+INSERT INTO t1 VALUES ('2001-02-03');
+DELETE FROM t1 WHERE c28='2001-02-03';
+DROP TABLE t1;
+CREATE TABLE t1 (c29 DATETIME);
+INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
+DELETE FROM t1 WHERE c29='2001-02-03 10:20:30';
+DROP TABLE t1;
+CREATE TABLE t1 (c30 TIMESTAMP);
+INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
+DELETE FROM t1 WHERE c30='2001-02-03 10:20:30';
+DROP TABLE t1;
+CREATE TABLE t1 (c31 TIME);
+INSERT INTO t1 VALUES ('11:22:33');
+DELETE FROM t1 WHERE c31='11:22:33';
+DROP TABLE t1;
+CREATE TABLE t1 (c32 YEAR);
+INSERT INTO t1 VALUES ('2001');
+DELETE FROM t1 WHERE c32=2001;
+DROP TABLE t1;
+CREATE TABLE t1 (c33 CHAR);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c33='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c34 CHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c34='';
+DROP TABLE t1;
+CREATE TABLE t1 (c35 CHAR(1));
+INSERT INTO t1 VALUES ('b');
+DELETE FROM t1 WHERE c35='b';
+DROP TABLE t1;
+CREATE TABLE t1 (c36 CHAR(255));
+INSERT INTO t1 VALUES (repeat('c',255));
+DELETE FROM t1 WHERE c36>'c';
+DROP TABLE t1;
+CREATE TABLE t1 (c37 NATIONAL CHAR);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c37='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c38 NATIONAL CHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c38='';
+DROP TABLE t1;
+CREATE TABLE t1 (c39 NATIONAL CHAR(1));
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c39='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c40 NATIONAL CHAR(255));
+INSERT INTO t1 VALUES (repeat('a', 255));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
+DELETE FROM t1 WHERE c40>'a';
+DROP TABLE t1;
+CREATE TABLE t1 (c45 VARCHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c45='';
+DROP TABLE t1;
+CREATE TABLE t1 (c46 VARCHAR(1));
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c46='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c47 VARCHAR(255));
+INSERT INTO t1 VALUES (repeat('a',255));
+DELETE FROM t1 WHERE c47>'a';
+DROP TABLE t1;
+CREATE TABLE t1 (c48 VARCHAR(261));
+INSERT INTO t1 VALUES (repeat('a',261));
+DELETE FROM t1 WHERE c48>'a';
+DROP TABLE t1;
+CREATE TABLE t1 (c49 NATIONAL VARCHAR(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c49='';
+DROP TABLE t1;
+CREATE TABLE t1 (c50 NATIONAL VARCHAR(1));
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c50='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c51 NATIONAL VARCHAR(255));
+INSERT INTO t1 VALUES (repeat('a',255));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
+DELETE FROM t1 WHERE c51>'a';
+DROP TABLE t1;
+CREATE TABLE t1 (c52 NATIONAL VARCHAR(261));
+INSERT INTO t1 VALUES (repeat('a',261));
+INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 261));
+DELETE FROM t1 WHERE c52>'a';
+DROP TABLE t1;
+CREATE TABLE t1 (c57 BINARY);
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c57='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c58 BINARY(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c58='';
+DROP TABLE t1;
+CREATE TABLE t1 (c59 BINARY(1));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c59='a';
+DROP TABLE t1;
+CREATE TABLE t1 (c60 BINARY(255));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES (repeat('a\0',120));
+DELETE FROM t1 WHERE c60<0x02;
+DROP TABLE t1;
+CREATE TABLE t1 (c61 VARBINARY(0));
+INSERT INTO t1 VALUES ('');
+DELETE FROM t1 WHERE c61='';
+DROP TABLE t1;
+CREATE TABLE t1 (c62 VARBINARY(1));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES ('a');
+DELETE FROM t1 WHERE c62=0x02;
+DROP TABLE t1;
+CREATE TABLE t1 (c63 VARBINARY(255));
+INSERT INTO t1 VALUES (0x00);
+INSERT INTO t1 VALUES (0x02);
+INSERT INTO t1 VALUES (repeat('a\0',120));
+DELETE FROM t1 WHERE c63=0x02;
+DROP TABLE t1;
+flush logs;
+CREATE TABLE t1 (c65 TINYBLOB);
+INSERT INTO t1 VALUES ('tinyblob1');
+DELETE FROM t1 WHERE c65='tinyblob1';
+DROP TABLE t1;
+CREATE TABLE t1 (c68 BLOB);
+INSERT INTO t1 VALUES ('blob1');
+DELETE FROM t1 WHERE c68='blob1';
+DROP TABLE t1;
+CREATE TABLE t1 (c71 MEDIUMBLOB);
+INSERT INTO t1 VALUES ('mediumblob1');
+DELETE FROM t1 WHERE c71='mediumblob1';
+DROP TABLE t1;
+CREATE TABLE t1 (c74 LONGBLOB);
+INSERT INTO t1 VALUES ('longblob1');
+DELETE FROM t1 WHERE c74='longblob1';
+DROP TABLE t1;
+CREATE TABLE t1 (c66 TINYTEXT);
+INSERT INTO t1 VALUES ('tinytext1');
+DELETE FROM t1 WHERE c66='tinytext1';
+DROP TABLE t1;
+CREATE TABLE t1 (c69 TEXT);
+INSERT INTO t1 VALUES ('text1');
+DELETE FROM t1 WHERE c69='text1';
+DROP TABLE t1;
+CREATE TABLE t1 (c72 MEDIUMTEXT);
+INSERT INTO t1 VALUES ('mediumtext1');
+DELETE FROM t1 WHERE c72='mediumtext1';
+DROP TABLE t1;
+CREATE TABLE t1 (c75 LONGTEXT);
+INSERT INTO t1 VALUES ('longtext1');
+DELETE FROM t1 WHERE c75='longtext1';
+DROP TABLE t1;
+CREATE TABLE t1 (c77 ENUM('a','b','c'));
+INSERT INTO t1 VALUES ('b');
+DELETE FROM t1 WHERE c77='b';
+DROP TABLE t1;
+CREATE TABLE t1 (c78 SET('a','b','c','d','e','f'));
+INSERT INTO t1 VALUES ('a,b');
+INSERT INTO t1 VALUES ('a,c');
+INSERT INTO t1 VALUES ('b,c');
+INSERT INTO t1 VALUES ('a,b,c');
+INSERT INTO t1 VALUES ('a,b,c,d');
+INSERT INTO t1 VALUES ('a,b,c,d,e');
+INSERT INTO t1 VALUES ('a,b,c,d,e,f');
+DELETE FROM t1 WHERE c78='a,b';
+DROP TABLE t1;
+CREATE TABLE t1 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
+CREATE TABLE t2 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
+INSERT INTO t1 SET a=1;
+INSERT INTO t1 SET b=1;
+INSERT INTO t2 SET a=1;
+INSERT INTO t2 SET b=1;
+UPDATE t1, t2 SET t1.a=10, t2.a=20;
+DROP TABLE t1,t2;
+flush logs;
+End of tests
=== added file 'mysql-test/t/mysqlbinlog_raw_mode.test'
--- a/mysql-test/t/mysqlbinlog_raw_mode.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/mysqlbinlog_raw_mode.test 2010-05-21 21:48:20 +0000
@@ -0,0 +1,28 @@
+--source include/have_log_bin.inc
+--source include/not_windows.inc
+
+-- source include/mysqlbinlog_raw_mode.inc
+
+# Test --stop-never
+# If exit code is good or bad then entry in raw_mode_exit table will be created
+# Anything above exit code 1 is bad. We wait for this
+CREATE TABLE raw_mode_exit (exit_code INT);
+--system `$MYSQL_BINLOG --raw --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001 ; [ \$? -le 1 ]` && $MYSQL -e "use test; INSERT INTO raw_mode_exit VALUES (1);" &
+
+let $wait_condition= SELECT id from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
+--source include/wait_condition.inc
+--diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
+--diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000002 $MYSQLD_DATADIR/master-bin.000002
+
+SELECT ((@id := id) - id) from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
+# Test killing from mysql server
+kill @id;
+--let $wait_condition= SELECT count(*) = 1 FROM raw_mode_exit WHERE exit_code = 1;
+--source include/wait_condition.inc
+
+DROP TABLE raw_mode_exit;
+--remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000001
+--remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000002
+--remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000003
+
+--echo End of tests
=== added file 'mysql-test/t/mysqlbinlog_raw_mode_win.test'
--- a/mysql-test/t/mysqlbinlog_raw_mode_win.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/mysqlbinlog_raw_mode_win.test 2010-05-21 21:48:20 +0000
@@ -0,0 +1,10 @@
+-- source include/have_log_bin.inc
+-- source include/windows.inc
+
+#
+# WL#4783
+#
+
+-- source include/mysqlbinlog_raw_mode.inc
+
+-- echo End of tests
Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20100602084635-ynmvfwe713m4kp15.bundle
| Thread |
|---|
| • bzr commit into mysql-next-mr-wl4895 branch (marc.alff:3154) | Marc Alff | 2 Jun |