Commit 6b19cd56 authored by Andrei Elkin's avatar Andrei Elkin

merge from 5.1

parents 61b1d076 c7303ae5
......@@ -5848,7 +5848,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;
......@@ -6121,11 +6121,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))))
......@@ -6201,6 +6206,8 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
(flags & User_var_log_event::UNSIGNED_F));
if (!is_deferred())
free_root(thd->mem_root, 0);
else
current_thd->query_id= sav_query_id; /* restore current query's context */
return 0;
}
......
......@@ -2605,6 +2605,7 @@ class User_var_log_event: public Log_event
uchar flags;
#ifdef MYSQL_SERVER
bool deferred;
query_id_t query_id;
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,
uint charset_number_arg, uchar flags_arg)
......@@ -2629,7 +2630,11 @@ class User_var_log_event: public Log_event
and which case the applier adjusts execution path.
*/
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
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