From 544781ad888c388cff6e4d7917585f1173df19f8 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 21 Dec 2007 10:13:54 +0200 Subject: Bug #31359 change_master sets group_master_log_pos twice, ignores future_group_master_log_p There was a redundant assignement. However, that's the only artifact. Wrt to future_group_master_log_position, there is no issue. The counter is supposed to be set at Log_event::exec_event(). It's used only by Innodb for recovery purposes. sql/sql_repl.cc: removing a redundant line which arrived with the revision 1.102.1.7. --- sql/sql_repl.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sql/sql_repl.cc') diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 903d254db8f..90eea8d322f 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1229,9 +1229,6 @@ bool change_master(THD* thd, MASTER_INFO* mi) DBUG_RETURN(TRUE); } } - mi->rli.group_master_log_pos = mi->master_log_pos; - DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos)); - /* Coordinates in rli were spoilt by the 'if (need_relay_log_purge)' block, so restore them to good values. If we left them to ''/0, that would work; @@ -1243,6 +1240,7 @@ bool change_master(THD* thd, MASTER_INFO* mi) That's why we always save good coords in rli. */ mi->rli.group_master_log_pos= mi->master_log_pos; + DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos)); strmake(mi->rli.group_master_log_name,mi->master_log_name, sizeof(mi->rli.group_master_log_name)-1); -- cgit v1.2.1 From 40d89c44ea03dcd3ad069bb59883272fc0a52b19 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 21 Dec 2007 22:34:43 +0200 Subject: BUG#30435 loading large LOAD DATA INFILE breaks slave with read_buffer_size set on master BUG#33413 show binlog events fails if binlog has event size of close to max_allowed_packet The size of Append_block replication event was determined solely by read_buffer_size whereas the rest of replication code deals with max_allowed_packet. When the former parameter was set to larger than the latter there were two artifacts: the master could not read events from binlog; show master events did not show. Fixed with - fragmenting the used io-cached buffer into pieces each size of less than max_allowed_packet (bug#30435) - incrementing show-binlog-events handling thread's max_allowed_packet with the max estimated for the replication header size include/my_sys.h: accessor-macros added in order not to mess with the io cache's implementation details in code that merely exploits the io-cache. sql/sql_repl.cc: BUG#33413: incrementing thd->variables.max_allowed_packet with the max estimation for the replication header size (from bug#19402); refactoring log_loaded_block() to fragment the io_cache buffer in case read_buffer_size > max_allowed_packet. mysql-test/r/rpl_loaddata_map.result: New BitKeeper file ``mysql-test/r/rpl_loaddata_map.result'' mysql-test/t/rpl_loaddata_map-master.opt: specific options to trigger BUG#30435, BUG#33413 situations mysql-test/t/rpl_loaddata_map-slave.opt: max_allowed_packet to be compatible with the master's version. mysql-test/t/rpl_loaddata_map.test: regression tests for two bugs. --- sql/sql_repl.cc | 69 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 25 deletions(-) (limited to 'sql/sql_repl.cc') diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 903d254db8f..c1ba33ce27d 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1355,6 +1355,11 @@ bool mysql_show_binlog_events(THD* thd) if ((file=open_binlog(&log, linfo.log_file_name, &errmsg)) < 0) goto err; + /* + to account binlog event header size + */ + thd->variables.max_allowed_packet += MAX_LOG_EVENT_HEADER; + pthread_mutex_lock(log_lock); /* @@ -1365,7 +1370,6 @@ bool mysql_show_binlog_events(THD* thd) This code will fail on a mixed relay log (one which has Format_desc then Rotate then Format_desc). */ - ev = Log_event::read_log_event(&log,(pthread_mutex_t*)0,description_event); if (ev) { @@ -1556,37 +1560,52 @@ err: DBUG_RETURN(TRUE); } - +/** + Load data's io cache specific hook to be executed + before a chunk of data is being read into the cache's buffer + The fuction instantianates and writes into the binlog + replication events along LOAD DATA processing. + + @param file pointer to io-cache + @return 0 +*/ int log_loaded_block(IO_CACHE* file) { + DBUG_ENTER("log_loaded_block"); LOAD_FILE_INFO *lf_info; - uint block_len ; - - /* file->request_pos contains position where we started last read */ - char* buffer = (char*) file->request_pos; - if (!(block_len = (char*) file->read_end - (char*) buffer)) - return 0; - lf_info = (LOAD_FILE_INFO*) file->arg; + uint block_len; + /* buffer contains position where we started last read */ + char* buffer= my_b_get_buffer_start(file); + uint max_event_size= current_thd->variables.max_allowed_packet; + lf_info= (LOAD_FILE_INFO*) file->arg; if (lf_info->last_pos_in_file != HA_POS_ERROR && - lf_info->last_pos_in_file >= file->pos_in_file) + lf_info->last_pos_in_file >= my_b_get_pos_in_file(file)) return 0; - lf_info->last_pos_in_file = file->pos_in_file; - if (lf_info->wrote_create_file) - { - Append_block_log_event a(lf_info->thd, lf_info->thd->db, buffer, - block_len, lf_info->log_delayed); - mysql_bin_log.write(&a); - } - else + + for (block_len= my_b_get_bytes_in_buffer(file); block_len > 0; + buffer += min(block_len, max_event_size), + block_len -= min(block_len, max_event_size)) { - Begin_load_query_log_event b(lf_info->thd, lf_info->thd->db, - buffer, block_len, - lf_info->log_delayed); - mysql_bin_log.write(&b); - lf_info->wrote_create_file = 1; - DBUG_SYNC_POINT("debug_lock.created_file_event",10); + lf_info->last_pos_in_file= my_b_get_pos_in_file(file); + if (lf_info->wrote_create_file) + { + Append_block_log_event a(lf_info->thd, lf_info->thd->db, buffer, + min(block_len, max_event_size), + lf_info->log_delayed); + mysql_bin_log.write(&a); + } + else + { + Begin_load_query_log_event b(lf_info->thd, lf_info->thd->db, + buffer, + min(block_len, max_event_size), + lf_info->log_delayed); + mysql_bin_log.write(&b); + lf_info->wrote_create_file= 1; + DBUG_SYNC_POINT("debug_lock.created_file_event",10); + } } - return 0; + DBUG_RETURN(0); } #endif /* HAVE_REPLICATION */ -- cgit v1.2.1 From 7e555be488181ca12bb533d847a704c68f3adfb0 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 6 Jan 2008 20:16:28 +0800 Subject: Replace one overlooked return with DBUG_RETURN in function log_loaded_block --- sql/sql_repl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_repl.cc') diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 7787a0980fd..f2312afa878 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1578,7 +1578,7 @@ int log_loaded_block(IO_CACHE* file) lf_info= (LOAD_FILE_INFO*) file->arg; if (lf_info->last_pos_in_file != HA_POS_ERROR && lf_info->last_pos_in_file >= my_b_get_pos_in_file(file)) - return 0; + DBUG_RETURN(0); for (block_len= my_b_get_bytes_in_buffer(file); block_len > 0; buffer += min(block_len, max_event_size), -- cgit v1.2.1 From 34b9c6f50403001eaf1114d2f6241b6e0938cc5d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Jan 2008 07:19:29 +0100 Subject: Fixes to make code compile on Windows. sql/sql_repl.cc: Adding cast to remove compile error on Windows platform. --- sql/sql_repl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_repl.cc') diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index f2312afa878..5bbff69f197 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1573,7 +1573,7 @@ int log_loaded_block(IO_CACHE* file) LOAD_FILE_INFO *lf_info; uint block_len; /* buffer contains position where we started last read */ - char* buffer= my_b_get_buffer_start(file); + char* buffer= (char*) my_b_get_buffer_start(file); uint max_event_size= current_thd->variables.max_allowed_packet; lf_info= (LOAD_FILE_INFO*) file->arg; if (lf_info->last_pos_in_file != HA_POS_ERROR && -- cgit v1.2.1