summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-02-16 10:03:25 +0200
committerunknown <monty@mysql.com>2004-02-16 10:03:25 +0200
commita07e48eca04b1564da9868f229ba5d958994db69 (patch)
tree44dc172194086edaeef7da9c9ed059171579a886 /sql/log_event.cc
parent5b2c3126277a8eedab5bcc8a9b0ce7386ccc3dbe (diff)
downloadmariadb-git-a07e48eca04b1564da9868f229ba5d958994db69.tar.gz
After merge fixes
Added more DBUG statements Ensure that we are comparing end space with BINARY strings Use 'any_db' instead of '' to mean any database. (For HANDLER command) Only strip ' ' when comparing CHAR, not other space-like characters (like \t) BitKeeper/deleted/.del-ctype_tis620.result-old~3578ceb0b8284685: Delete: mysql-test/r/ctype_tis620.result-old BitKeeper/deleted/.del-ctype_tis620.test-old~ffb1bbd2935d1aba: Delete: mysql-test/t/ctype_tis620.test-old client/mysqlbinlog.cc: Added DBUG statements Added call of my_end() to free all used memory on exit heap/hp_info.c: After merge fixes heap/hp_open.c: After merge fixes include/heap.h: After merge fixes include/m_ctype.h: Use pchar instead of 'int' for character parameters. Added 'my_binary_compare()' include/m_string.h: Fixed wrong define innobase/ibuf/ibuf0ibuf.c: After merge fixes innobase/srv/srv0start.c: After merge fixes mysql-test/r/alter_table.result: Fixed results after merge mysql-test/r/auto_increment.result: Fixed results after merge mysql-test/r/bdb.result: Fixed results after merge mysql-test/r/binary.result: Fixed results after merge mysql-test/r/create.result: Fixed results after merge mysql-test/r/ctype_mb.result: Fixed results after merge mysql-test/r/ctype_tis620.result: Fixed results after merge mysql-test/r/ctype_utf8.result: Fixed results after merge mysql-test/r/delete.result: Fixed results after merge mysql-test/r/func_compress.result: Fixed results after merge mysql-test/r/func_gconcat.result: Fixed results after merge mysql-test/r/func_group.result: Fixed results after merge mysql-test/r/func_str.result: Fixed results after merge mysql-test/r/innodb.result: Fixed results after merge mysql-test/r/insert.result: Fixed results after merge mysql-test/r/insert_select.result: Fixed results after merge mysql-test/r/key.result: Fixed results after merge mysql-test/r/loaddata.result: Fixed results after merge mysql-test/r/lock.result: Fixed results after merge mysql-test/r/myisam.result: Fixed results after merge mysql-test/r/null.result: Fixed results after merge mysql-test/r/null_key.result: Fixed results after merge mysql-test/r/order_by.result: Fixed results after merge mysql-test/r/query_cache.result: Fixed results after merge mysql-test/r/range.result: Fixed results after merge mysql-test/r/rpl_multi_delete.result: Fixed results after merge mysql-test/r/rpl_until.result: Fixed results after merge mysql-test/r/subselect.result: Fixed results after merge mysql-test/r/subselect_innodb.result: Fixed results after merge mysql-test/r/type_blob.result: Fixed results after merge mysql-test/r/type_datetime.result: Fixed results after merge mysql-test/r/type_decimal.result: Fixed results after merge mysql-test/r/type_enum.result: Fixed results after merge mysql-test/r/type_float.result: Fixed results after merge mysql-test/r/type_ranges.result: Fixed results after merge mysql-test/r/type_time.result: Fixed results after merge mysql-test/r/type_timestamp.result: Fixed results after merge mysql-test/r/type_uint.result: Fixed results after merge mysql-test/r/type_year.result: Fixed results after merge mysql-test/r/variables.result: Fixed results after merge mysql-test/r/warnings.result: Fixed results after merge mysql-test/t/case.test: Fixed shifted error messages mysql-test/t/create.test: Fixed shifted error messages mysql-test/t/ctype_collate.test: Fixed shifted error messages mysql-test/t/ctype_tis620.test: Merge with 4.0 ctype_tis620 test mysql-test/t/delete.test: Fixed shifted error messages mysql-test/t/derived.test: Fixed shifted error messages mysql-test/t/fulltext.test: Fixed shifted error messages mysql-test/t/func_in.test: Fixed shifted error messages mysql-test/t/func_str.test: Fixed shifted error messages mysql-test/t/func_test.test: Fixed shifted error messages mysql-test/t/grant.test: Fixed shifted error messages mysql-test/t/innodb.test: Change to 4.1 syntax mysql-test/t/key_cache.test: Fixed shifted error messages mysql-test/t/myisam.test: New test of blob and end space mysql-test/t/row.test: Fixed shifted error messages mysql-test/t/rpl_until.test: Fixed shifted error messages mysql-test/t/subselect.test: Fixed shifted error messages mysql-test/t/subselect_innodb.test: Fix test to take into account foreign key constraints mysql-test/t/union.test: Fixed shifted error messages mysql-test/t/user_var.test: Fixed shifted error messages mysql-test/t/variables.test: Fixed shifted error messages mysys/my_handler.c: Merge with 4.0 code sql/ha_heap.cc: After merge fixes sql/handler.cc: After merge fixes sql/item.cc: After merge fixes sql/item_cmpfunc.cc: Ensure that we are comparing end space with BINARY strings sql/item_cmpfunc.h: Ensure that we are comparing end space with BINARY strings sql/log_event.cc: More DBUG statements Ensure that we use all options to LOAD DATA in replication sql/opt_range.cc: After merge fixes sql/sql_db.cc: After merge fixes sql/sql_handler.cc: After merge fixes Use 'any_db' instead of '' to mean 'no database comparison' sql/sql_parse.cc: After merge fixes sql/sql_select.cc: After merge fixes Added function comment for setup_group() sql/sql_string.cc: Added stringcmp() for binary comparison. Added function comments for sortcmp() and stringcmp() sql/sql_string.h: Added stringcmp() sql/sql_table.cc: After merge fixes sql/sql_update.cc: After merge fixes sql/sql_yacc.yy: Use 'any_db' instead of '' to mean any database. Using "" causes a 'wrong db name' error. strings/ctype-big5.c: Strip only end space, not other space characters. strings/ctype-bin.c: Removed some not needed functions. Added function comments Don't remove end space in comparisons Change my_wildcmp_bin() to be 'identical' with other similar code strings/ctype-czech.c: Strip only end space, not other space characters. strings/ctype-gbk.c: Strip only end space, not other space characters. strings/ctype-latin1.c: Strip only end space, not other space characters. strings/ctype-mb.c: Strip only end space, not other space characters. strings/ctype-simple.c: Strip only end space, not other space characters. strings/ctype-sjis.c: Strip only end space, not other space characters. strings/ctype-tis620.c: Added usage of my_instr_simple. This needs to be cleaned up! strings/ctype-utf8.c: Strip only end space, not other space characters. strings/ctype-win1250ch.c: Strip only end space, not other space characters. Fixed indentation strings/strto.c: Code cleanup
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc140
1 files changed, 64 insertions, 76 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 84757a0a1f2..f64f740da30 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB
+/* Copyright (C) 2000-2004 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -290,6 +290,8 @@ Log_event::Log_event(const char* buf, bool old_format)
int Log_event::exec_event(struct st_relay_log_info* rli)
{
+ DBUG_ENTER("Log_event::exec_event");
+
/*
rli is null when (as far as I (Guilhem) know)
the caller is
@@ -342,7 +344,7 @@ int Log_event::exec_event(struct st_relay_log_info* rli)
rli->last_master_timestamp= when;
}
}
- return 0;
+ DBUG_RETURN(0);
}
@@ -592,11 +594,13 @@ Error in Log_event::read_log_event(): '%s', data_len: %d, event_type: %d",
Log_event* Log_event::read_log_event(const char* buf, int event_len,
const char **error, bool old_format)
{
+ DBUG_ENTER("Log_event::read_log_event");
+
if (event_len < EVENT_LEN_OFFSET ||
(uint) event_len != uint4korr(buf+EVENT_LEN_OFFSET))
{
*error="Sanity check failed"; // Needed to free buffer
- return NULL; // general sanity check - will fail on a partial read
+ DBUG_RETURN(NULL); // general sanity check - will fail on a partial read
}
Log_event* ev = NULL;
@@ -658,16 +662,16 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len,
if (!force_opt)
{
*error= "Found invalid event in binary log";
- return 0;
+ DBUG_RETURN(0);
}
ev= new Unknown_log_event(buf, old_format);
#else
*error= "Found invalid event in binary log";
- return 0;
+ DBUG_RETURN(0);
#endif
}
ev->cached_event_len = event_len;
- return ev;
+ DBUG_RETURN(ev);
}
#ifdef MYSQL_CLIENT
@@ -1249,38 +1253,21 @@ void Load_log_event::pack_info(Protocol *protocol)
memcpy(pos, table_name, table_name_len);
pos+= table_name_len;
- if (sql_ex.field_term_len)
- {
- pos= strmov(pos, " FIELDS TERMINATED BY ");
- pos= pretty_print_str(pos, sql_ex.field_term, sql_ex.field_term_len);
- }
-
- if (sql_ex.enclosed_len)
- {
- if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
- pos= strmov(pos, " OPTIONALLY ");
- pos= strmov(pos, " ENCLOSED BY ");
- pos= pretty_print_str(pos, sql_ex.enclosed, sql_ex.enclosed_len);
- }
+ /* We have to create all optinal fields as the default is not empty */
+ pos= strmov(pos, " FIELDS TERMINATED BY ");
+ pos= pretty_print_str(pos, sql_ex.field_term, sql_ex.field_term_len);
+ if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
+ pos= strmov(pos, " OPTIONALLY ");
+ pos= strmov(pos, " ENCLOSED BY ");
+ pos= pretty_print_str(pos, sql_ex.enclosed, sql_ex.enclosed_len);
- if (sql_ex.escaped_len)
- {
- pos= strmov(pos, " ESCAPED BY ");
- pos= pretty_print_str(pos, sql_ex.escaped, sql_ex.escaped_len);
- }
-
- bool line_lexem_added= false;
- if (sql_ex.line_term_len)
- {
- pos= strmov(pos, " LINES TERMINATED BY ");
- pos= pretty_print_str(pos, sql_ex.line_term, sql_ex.line_term_len);
- line_lexem_added= true;
- }
+ pos= strmov(pos, " ESCAPED BY ");
+ pos= pretty_print_str(pos, sql_ex.escaped, sql_ex.escaped_len);
+ pos= strmov(pos, " LINES TERMINATED BY ");
+ pos= pretty_print_str(pos, sql_ex.line_term, sql_ex.line_term_len);
if (sql_ex.line_start_len)
{
- if (!line_lexem_added)
- pos= strmov(pos," LINES");
pos= strmov(pos, " STARTING BY ");
pos= pretty_print_str(pos, sql_ex.line_start, sql_ex.line_start_len);
}
@@ -1455,9 +1442,10 @@ Load_log_event::Load_log_event(const char *buf, int event_len,
field_lens(0), field_block_len(0),
table_name(0), db(0), fname(0), local_fname(FALSE)
{
- if (!event_len) // derived class, will call copy_log_event() itself
- return;
- copy_log_event(buf, event_len, old_format);
+ DBUG_ENTER("Load_log_event");
+ if (event_len) // derived class, will call copy_log_event() itself
+ copy_log_event(buf, event_len, old_format);
+ DBUG_VOID_RETURN;
}
@@ -1472,6 +1460,8 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
char* buf_end = (char*)buf + event_len;
uint header_len= old_format ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
const char* data_head = buf + header_len;
+ DBUG_ENTER("Load_log_event::copy_log_event");
+
slave_proxy_id= thread_id= uint4korr(data_head + L_THREAD_ID_OFFSET);
exec_time = uint4korr(data_head + L_EXEC_TIME_OFFSET);
skip_lines = uint4korr(data_head + L_SKIP_LINES_OFFSET);
@@ -1484,19 +1474,19 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
get_data_body_offset());
if ((int) event_len < body_offset)
- return 1;
+ DBUG_RETURN(1);
/*
Sql_ex.init() on success returns the pointer to the first byte after
the sql_ex structure, which is the start of field lengths array.
*/
if (!(field_lens=(uchar*)sql_ex.init((char*)buf + body_offset,
- buf_end,
- buf[EVENT_TYPE_OFFSET] != LOAD_EVENT)))
- return 1;
-
+ buf_end,
+ buf[EVENT_TYPE_OFFSET] != LOAD_EVENT)))
+ DBUG_RETURN(1);
+
data_len = event_len - body_offset;
if (num_fields > data_len) // simple sanity check against corruption
- return 1;
+ DBUG_RETURN(1);
for (uint i = 0; i < num_fields; i++)
field_block_len += (uint)field_lens[i] + 1;
@@ -1506,7 +1496,7 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
fname = db + db_len + 1;
fname_len = strlen(fname);
// null termination is accomplished by the caller doing buf[event_len]=0
- return 0;
+ DBUG_RETURN(0);
}
@@ -1524,6 +1514,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
void Load_log_event::print(FILE* file, bool short_form, char* last_db,
bool commented)
{
+ DBUG_ENTER("Load_log_event::print");
if (!short_form)
{
print_header(file);
@@ -1555,42 +1546,26 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db,
fprintf(file," IGNORE ");
fprintf(file, "INTO TABLE %s ", table_name);
- if (sql_ex.field_term)
- {
- fprintf(file, " FIELDS TERMINATED BY ");
- pretty_print_str(file, sql_ex.field_term, sql_ex.field_term_len);
- }
+ fprintf(file, " FIELDS TERMINATED BY ");
+ pretty_print_str(file, sql_ex.field_term, sql_ex.field_term_len);
- if (sql_ex.enclosed)
- {
- if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
- fprintf(file," OPTIONALLY ");
- fprintf(file, " ENCLOSED BY ");
- pretty_print_str(file, sql_ex.enclosed, sql_ex.enclosed_len);
- }
+ if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
+ fprintf(file," OPTIONALLY ");
+ fprintf(file, " ENCLOSED BY ");
+ pretty_print_str(file, sql_ex.enclosed, sql_ex.enclosed_len);
- if (sql_ex.escaped)
- {
- fprintf(file, " ESCAPED BY ");
- pretty_print_str(file, sql_ex.escaped, sql_ex.escaped_len);
- }
+ fprintf(file, " ESCAPED BY ");
+ pretty_print_str(file, sql_ex.escaped, sql_ex.escaped_len);
- bool line_lexem_added= false;
- if (sql_ex.line_term)
- {
- fprintf(file," LINES TERMINATED BY ");
- pretty_print_str(file, sql_ex.line_term, sql_ex.line_term_len);
- line_lexem_added= true;
- }
+ fprintf(file," LINES TERMINATED BY ");
+ pretty_print_str(file, sql_ex.line_term, sql_ex.line_term_len);
+
if (sql_ex.line_start)
{
- if (!line_lexem_added)
- fprintf(file," LINES");
fprintf(file," STARTING BY ");
pretty_print_str(file, sql_ex.line_start, sql_ex.line_start_len);
}
-
if ((long) skip_lines > 0)
fprintf(file, " IGNORE %ld LINES", (long) skip_lines);
@@ -1611,6 +1586,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db,
}
fprintf(file, ";\n");
+ DBUG_VOID_RETURN;
}
#endif /* MYSQL_CLIENT */
@@ -1877,8 +1853,11 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len,
// The caller will ensure that event_len is what we have at EVENT_LEN_OFFSET
int header_size = (old_format) ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
uint ident_offset;
+ DBUG_ENTER("Rotate_log_event");
+
if (event_len < header_size)
- return;
+ DBUG_VOID_RETURN;
+
buf += header_size;
if (old_format)
{
@@ -1897,8 +1876,9 @@ Rotate_log_event::Rotate_log_event(const char* buf, int event_len,
ident_offset,
(uint) ident_len,
MYF(MY_WME))))
- return;
+ DBUG_VOID_RETURN;
alloced = 1;
+ DBUG_VOID_RETURN;
}
@@ -2593,7 +2573,9 @@ Create_file_log_event(THD* thd_arg, sql_exchange* ex,
fake_base(0),block(block_arg),block_len(block_len_arg),
file_id(thd_arg->file_id = mysql_bin_log.next_file_id())
{
+ DBUG_ENTER("Create_file_log_event");
sql_ex.force_new_format();
+ DBUG_VOID_RETURN;
}
#endif /* !MYSQL_CLIENT */
@@ -2650,8 +2632,10 @@ Create_file_log_event::Create_file_log_event(const char* buf, int len,
:Load_log_event(buf,0,old_format),fake_base(0),block(0),inited_from_old(0)
{
int block_offset;
+ DBUG_ENTER("Create_file_log_event");
+
if (copy_log_event(buf,len,old_format))
- return;
+ DBUG_VOID_RETURN;
if (!old_format)
{
file_id = uint4korr(buf + LOG_EVENT_HEADER_LEN +
@@ -2669,6 +2653,7 @@ Create_file_log_event::Create_file_log_event(const char* buf, int len,
sql_ex.force_new_format();
inited_from_old = 1;
}
+ DBUG_VOID_RETURN;
}
@@ -2821,11 +2806,13 @@ Append_block_log_event::Append_block_log_event(THD* thd_arg, const char* db_arg,
Append_block_log_event::Append_block_log_event(const char* buf, int len)
:Log_event(buf, 0),block(0)
{
+ DBUG_ENTER("Append_block_log_event");
if ((uint)len < APPEND_BLOCK_EVENT_OVERHEAD)
- return;
+ DBUG_VOID_RETURN;
file_id = uint4korr(buf + LOG_EVENT_HEADER_LEN + AB_FILE_ID_OFFSET);
block = (char*)buf + APPEND_BLOCK_EVENT_OVERHEAD;
block_len = len - APPEND_BLOCK_EVENT_OVERHEAD;
+ DBUG_VOID_RETURN;
}
@@ -2888,6 +2875,7 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
char *p= slave_load_file_stem(fname, file_id, server_id);
int fd;
int error = 1;
+ DBUG_ENTER("Append_block_log_event::exec_event");
memcpy(p, ".data", 6);
if ((fd = my_open(fname, O_WRONLY|O_APPEND|O_BINARY, MYF(MY_WME))) < 0)
@@ -2905,7 +2893,7 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
err:
if (fd >= 0)
my_close(fd, MYF(0));
- return error ? error : Log_event::exec_event(rli);
+ DBUG_RETURN(error ? error : Log_event::exec_event(rli));
}
#endif