List:Commits« Previous MessageNext Message »
From:antony Date:May 5 2007 1:44am
Subject:bk commit into 5.1 tree (acurtis:1.2504)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of antony. When antony does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-05-04 16:44:07-07:00, acurtis@stripped +2 -0
  WL#2936
    Move copying of global variables into thd.variables into plugin_thdvar_init().
    plugin_thdvar_init() may be called multiple times when THD::change_user() is called.
    This fixes a plugin ref-count leak when running the test mysql_client_test

  sql/sql_class.cc@stripped, 2007-05-04 16:43:58-07:00, acurtis@stripped +1 -2
    wl2936
      Initialize thd.variables to zero in constructor.
      Move copying of global variables into thd.variables into plugin_thdvar_init()

  sql/sql_plugin.cc@stripped, 2007-05-04 16:43:58-07:00, acurtis@stripped +14 -2
    wl2936
      Move copying of global variables into thd.variables into plugin_thdvar_init().
      plugin_thdvar_init() may be called multiple times when THD::change_user() is called.
      This fixes a plugin ref-count leak when running the test mysql_client_test

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	acurtis
# Host:	ltamd64.xiphis.org
# Root:	/home/antony/work2/mysql-5.1-engines.valgrind

--- 1.333/sql/sql_class.cc	2007-05-04 16:44:22 -07:00
+++ 1.334/sql/sql_class.cc	2007-05-04 16:44:22 -07:00
@@ -345,6 +345,7 @@
   time_after_lock=(time_t) 0;
   current_linfo =  0;
   slave_thread = 0;
+  bzero(&variables, sizeof(variables));
   thread_id= variables.pseudo_thread_id= 0;
   one_shot_set= 0;
   file_id = 0;
@@ -455,8 +456,6 @@
 void THD::init(void)
 {
   pthread_mutex_lock(&LOCK_global_system_variables);
-  variables= global_system_variables;
-  variables.table_plugin= NULL;
   plugin_thdvar_init(this);
   variables.time_format= date_time_format_copy((THD*) 0,
 					       variables.time_format);

--- 1.62/sql/sql_plugin.cc	2007-05-04 16:44:22 -07:00
+++ 1.63/sql/sql_plugin.cc	2007-05-04 16:44:22 -07:00
@@ -2303,14 +2303,26 @@
 
 void plugin_thdvar_init(THD *thd)
 {
+  plugin_ref old_table_plugin= thd->variables.table_plugin;
+  DBUG_ENTER("plugin_thdvar_init");
+  
+  thd->variables.table_plugin= NULL;
+  cleanup_variables(thd, &thd->variables);
+  
+  thd->variables= global_system_variables;
+  thd->variables.table_plugin= NULL;
+
   /* we are going to allocate these lazily */
   thd->variables.dynamic_variables_version= 0;
   thd->variables.dynamic_variables_size= 0;
   thd->variables.dynamic_variables_ptr= 0;
 
-  DBUG_ASSERT(!(thd->variables.table_plugin));
+  pthread_mutex_lock(&LOCK_plugin);  
   thd->variables.table_plugin=
-        my_plugin_lock(NULL, &global_system_variables.table_plugin);
+        my_intern_plugin_lock(NULL, global_system_variables.table_plugin);
+  intern_plugin_unlock(NULL, old_table_plugin);
+  pthread_mutex_unlock(&LOCK_plugin);
+  DBUG_VOID_RETURN;
 }
 
 
Thread
bk commit into 5.1 tree (acurtis:1.2504)antony5 May