From 9eb64ec5c034c2935047a75773d754a4258c3832 Mon Sep 17 00:00:00 2001 From: Andrei Elkin <andrei.elkin@oracle.com> Date: Tue, 26 Mar 2013 19:24:01 +0200 Subject: Bug#16541422 LOG-SLAVE-UPDATES + REPLICATE-WILD-IGNORE-TABLE FAILS FOR USER VARIABLES At logging a first Query referring a user var, the slave missed to log the user var. It appears that at execution of a Uservar event the slaver applier thought of the variable as already logged. The reason of misjudgement is in coincidence of query id:s: of one that the thread holds at Uservar execution and another one that the thread sees at the Query applying. While the two are naturally different in the regular execution branch (as two computational events are separated as individual events), in the deferred applying case the User var execution effectively belongs to its Query processing. Fixed with storing the Uservar parsing time (where desicion to defer is taken) query id to temporarily substitute with it the actual query id at the Uservar execution time (along with its query). Such manipulation mimics behaviour of the regular applying branch. sql/log_event.cc: Storing the Uservar parsing time query id into a new member of the event to to temporarily substitute with it the actual thread id at the Uservar execution time. sql/log_event.h: Storage for keeping query-id in User-var intance is added. --- sql/log_event.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'sql/log_event.cc') diff --git a/sql/log_event.cc b/sql/log_event.cc index 7d2a80fdaf9..f962f897984 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5721,7 +5721,7 @@ User_var_log_event(const char* buf, uint event_len, const Format_description_log_event* description_event) :Log_event(buf, description_event) #ifndef MYSQL_CLIENT - , deferred(false) + , deferred(false), query_id(0) #endif { bool error= false; @@ -5967,11 +5967,16 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) { Item *it= 0; CHARSET_INFO *charset; + query_id_t sav_query_id; /* memorize orig id when deferred applying */ if (rli->deferred_events_collecting) { - set_deferred(); + set_deferred(current_thd->query_id); return rli->deferred_events->add(this); + } else if (is_deferred()) + { + sav_query_id= current_thd->query_id; + current_thd->query_id= query_id; /* recreating original time context */ } if (!(charset= get_charset(charset_number, MYF(MY_WME)))) @@ -6045,6 +6050,8 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) e->update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT, 0); if (!is_deferred()) free_root(thd->mem_root,0); + else + current_thd->query_id= sav_query_id; /* restore current query's context */ return 0; } -- cgit v1.2.1 From 84bd6fec76d6b93d189725b535979996f9c2cb00 Mon Sep 17 00:00:00 2001 From: Nuno Carvalho <nuno.carvalho@oracle.com> Date: Wed, 27 Mar 2013 11:19:29 +0000 Subject: BUG#16541422: LOG-SLAVE-UPDATES + REPLICATE-WILD-IGNORE-TABLE FAILS FOR USER VARIABLES Fixed possible uninitialized variable. --- sql/log_event.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/log_event.cc') diff --git a/sql/log_event.cc b/sql/log_event.cc index f962f897984..fe93eb665cf 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5967,7 +5967,7 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) { Item *it= 0; CHARSET_INFO *charset; - query_id_t sav_query_id; /* memorize orig id when deferred applying */ + query_id_t sav_query_id= 0; /* memorize orig id when deferred applying */ if (rli->deferred_events_collecting) { -- cgit v1.2.1 From d054027c4bfabdfa1cdbb58ee9aa34557eacbb45 Mon Sep 17 00:00:00 2001 From: Sujatha Sivakumar <sujatha.sivakumar@oracle.com> Date: Thu, 28 Mar 2013 14:14:39 +0530 Subject: Bug#14324766:PARTIALLY WRITTEN INSERT STATEMENT IN BINLOG NO ERRORS REPORTED Problem: ======= Errors from my_b_fill are ignored. MYSQL_BIN_LOG::write_cache code assumes that 0 returned from my_b_fill always means end-of-cache, but that is incorrect. It can result in error and the error is ignored. Other callers of my_b_fill don't check for error: my_b_copy_to_file, maybe my_b_gets. Fix: === An error handler is already present to check the "cache" error that is reported during "MYSQL_BIN_LOG::write_cache" call. Hence error handlers are added for "my_b_copy_to_file" and "my_b_gets". During my_b_fill() function call, when the cache read fails info->error= -1 is set. Hence a check for "info->error" is added for the above to callers upon their return. mysys/mf_iocache2.c: Added a check for "cache->error" and simulation of cache read failure mysys/my_read.c: Simulation of read failure sql/log_event.cc: Added debug simulation sql/sql_repl.cc: Added a check for cache error --- sql/log_event.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql/log_event.cc') diff --git a/sql/log_event.cc b/sql/log_event.cc index fe93eb665cf..16388fbbef7 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -9196,6 +9196,8 @@ Write_rows_log_event::do_exec_row(const Relay_log_info *const rli) #ifdef MYSQL_CLIENT void Write_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info) { + DBUG_EXECUTE_IF("simulate_cache_read_error", + {DBUG_SET("+d,simulate_my_b_fill_error");}); Rows_log_event::print_helper(file, print_event_info, "Write_rows"); } #endif -- cgit v1.2.1