Commit fd434bca authored by Andrei Elkin's avatar Andrei Elkin

merge from 5.1

parents 5bfb832c 0a31d4f4
...@@ -5848,7 +5848,7 @@ User_var_log_event(const char* buf, uint event_len, ...@@ -5848,7 +5848,7 @@ User_var_log_event(const char* buf, uint event_len,
const Format_description_log_event* description_event) const Format_description_log_event* description_event)
:Log_event(buf, description_event) :Log_event(buf, description_event)
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
, deferred(false) , deferred(false), query_id(0)
#endif #endif
{ {
bool error= false; bool error= false;
...@@ -6121,11 +6121,16 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -6121,11 +6121,16 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
{ {
Item *it= 0; Item *it= 0;
CHARSET_INFO *charset; CHARSET_INFO *charset;
query_id_t sav_query_id; /* memorize orig id when deferred applying */
if (rli->deferred_events_collecting) if (rli->deferred_events_collecting)
{ {
set_deferred(); set_deferred(current_thd->query_id);
return rli->deferred_events->add(this); 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)))) if (!(charset= get_charset(charset_number, MYF(MY_WME))))
...@@ -6201,6 +6206,8 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -6201,6 +6206,8 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
(flags & User_var_log_event::UNSIGNED_F)); (flags & User_var_log_event::UNSIGNED_F));
if (!is_deferred()) if (!is_deferred())
free_root(thd->mem_root, 0); free_root(thd->mem_root, 0);
else
current_thd->query_id= sav_query_id; /* restore current query's context */
return 0; return 0;
} }
......
...@@ -2605,6 +2605,7 @@ public: ...@@ -2605,6 +2605,7 @@ public:
uchar flags; uchar flags;
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
bool deferred; bool deferred;
query_id_t query_id;
User_var_log_event(THD* thd_arg, char *name_arg, uint name_len_arg, User_var_log_event(THD* thd_arg, char *name_arg, uint name_len_arg,
char *val_arg, ulong val_len_arg, Item_result type_arg, char *val_arg, ulong val_len_arg, Item_result type_arg,
uint charset_number_arg, uchar flags_arg) uint charset_number_arg, uchar flags_arg)
...@@ -2629,7 +2630,11 @@ public: ...@@ -2629,7 +2630,11 @@ public:
and which case the applier adjusts execution path. and which case the applier adjusts execution path.
*/ */
bool is_deferred() { return deferred; } bool is_deferred() { return deferred; }
void set_deferred() { deferred= true; } /*
In case of the deffered applying the variable instance is flagged
and the parsing time query id is stored to be used at applying time.
*/
void set_deferred(query_id_t qid) { deferred= true; query_id= qid; }
#endif #endif
bool is_valid() const { return name != 0; } bool is_valid() const { return name != 0; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment