List:Commits« Previous MessageNext Message »
From:Ramil Kalimullin Date:November 20 2008 1:07pm
Subject:bzr commit into mysql-6.0 branch (ramil:2939)
View as plain text  
#At file:///home/ram/mysql/mysql-6.0-bugteam/

 2939 Ramil Kalimullin	2008-11-20 [merge]
      Auto-merge
modified:
  sql/item_func.cc
  sql/item_func.h

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2008-11-18 13:20:58 +0000
+++ b/sql/item_func.cc	2008-11-20 13:06:31 +0000
@@ -3889,11 +3889,14 @@ static user_var_entry *get_variable(HASH
 
 bool Item_func_set_user_var::set_entry(THD *thd, bool create_if_not_exists)
 {
-  if (thd == entry_thd && entry)
+  if (entry && thd->thread_id == entry_thread_id)
     goto end; // update entry->update_query_id for PS
-  entry_thd= thd;
   if (!(entry= get_variable(&thd->user_vars, name, create_if_not_exists)))
+  {
+    entry_thread_id= 0;
     return TRUE;
+  }
+  entry_thread_id= thd->thread_id;
   /* 
      Remember the last query which updated it, this way a query can later know
      if this variable is a constant item in the query (it is if update_query_id

=== modified file 'sql/item_func.h'
--- a/sql/item_func.h	2008-10-10 12:04:46 +0000
+++ b/sql/item_func.h	2008-11-20 13:06:31 +0000
@@ -1294,16 +1294,16 @@ class Item_func_set_user_var :public Ite
   enum Item_result cached_result_type;
   user_var_entry *entry;
   /*
-    The entry_thd variable is used:
+    The entry_thread_id variable is used:
     1) to skip unnecessary updates of the entry field (see above);
     2) to reset the entry field that was initialized in the other thread
        (for example, an item tree of a trigger that updates user variables
-       may be shared between several connections, and the entry_thd field
+       may be shared between several connections, and the entry_thread_id field
        prevents updates of one connection user variables from a concurrent
        connection calling the same trigger that initially updated some
        user variable it the first connection context).
   */
-  THD *entry_thd;
+  my_thread_id entry_thread_id;
   char buffer[MAX_FIELD_WIDTH];
   String value;
   my_decimal decimal_buff;
@@ -1320,7 +1320,7 @@ public:
   LEX_STRING name; // keep it public
   Item_func_set_user_var(LEX_STRING a,Item *b)
     :Item_func(b), cached_result_type(INT_RESULT),
-     entry(NULL), entry_thd(NULL), name(a)
+     entry(NULL), entry_thread_id(0), name(a)
   {}
   enum Functype functype() const { return SUSERVAR_FUNC; }
   double val_real();

Thread
bzr commit into mysql-6.0 branch (ramil:2939)Ramil Kalimullin20 Nov