[Commits] Rev 2937: MWL#74: Fix memory leak now that LOCK_uuid_generator in my_uuid.c and mysqld.cc are now distinct. in http://bazaar.launchpad.net/~maria-captains/maria/5.1

knielsen at knielsen-hq.org knielsen at knielsen-hq.org
Tue Nov 16 12:57:05 EET 2010


At http://bazaar.launchpad.net/~maria-captains/maria/5.1

------------------------------------------------------------
revno: 2937
revision-id: knielsen at knielsen-hq.org-20101116105703-nc2tvgon5hvpaq29
parent: knielsen at knielsen-hq.org-20101115193634-l07rfwtey8xpkrdo
committer: knielsen at knielsen-hq.org
branch nick: work-5.1-mwl74
timestamp: Tue 2010-11-16 11:57:03 +0100
message:
  MWL#74: Fix memory leak now that LOCK_uuid_generator in my_uuid.c and mysqld.cc are now distinct.
  Fix is to add missing call to my_uuid_end().
  Also rename mysqld.cc version to avoid confusion of the two.
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2010-10-19 13:58:35 +0000
+++ b/sql/item_func.cc	2010-11-16 10:57:03 +0000
@@ -6125,8 +6125,8 @@ void uuid_short_init()
 longlong Item_func_uuid_short::val_int()
 {
   ulonglong val;
-  pthread_mutex_lock(&LOCK_uuid_generator);
+  pthread_mutex_lock(&LOCK_short_uuid_generator);
   val= uuid_value++;
-  pthread_mutex_unlock(&LOCK_uuid_generator);
+  pthread_mutex_unlock(&LOCK_short_uuid_generator);
   return (longlong) val;
 }

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2010-11-02 15:22:57 +0000
+++ b/sql/mysql_priv.h	2010-11-16 10:57:03 +0000
@@ -2016,7 +2016,7 @@ extern FILE *stderror_file;
 extern pthread_key(MEM_ROOT**,THR_MALLOC);
 extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open, LOCK_lock_db,
        LOCK_mapped_file,LOCK_user_locks, LOCK_status,
-       LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator,
+       LOCK_error_log, LOCK_delayed_insert, LOCK_short_uuid_generator,
        LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
        LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock,
        LOCK_global_system_variables, LOCK_user_conn,

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-11-07 12:25:29 +0000
+++ b/sql/mysqld.cc	2010-11-16 10:57:03 +0000
@@ -693,7 +693,7 @@ pthread_mutex_t LOCK_mysql_create_db, LO
                 LOCK_crypt, LOCK_bytes_sent, LOCK_bytes_received,
                 LOCK_global_system_variables,
                 LOCK_user_conn, LOCK_slave_list, LOCK_active_mi,
-                LOCK_connection_count, LOCK_uuid_generator;
+                LOCK_connection_count, LOCK_short_uuid_generator;
 /**
   The below lock protects access to two global server variables:
   max_prepared_stmt_count and prepared_stmt_count. These variables
@@ -1405,6 +1405,7 @@ void clean_up(bool print_message)
 #ifdef HAVE_REPLICATION
   end_slave_list();
 #endif
+  my_uuid_end();
   delete binlog_filter;
   delete rpl_filter;
 #ifndef EMBEDDED_LIBRARY
@@ -1511,7 +1512,7 @@ static void clean_up_mutexes()
   (void) rwlock_destroy(&LOCK_sys_init_connect);
   (void) rwlock_destroy(&LOCK_sys_init_slave);
   (void) pthread_mutex_destroy(&LOCK_global_system_variables);
-  (void) pthread_mutex_destroy(&LOCK_uuid_generator);
+  (void) pthread_mutex_destroy(&LOCK_short_uuid_generator);
   (void) rwlock_destroy(&LOCK_system_variables_hash);
   (void) pthread_mutex_destroy(&LOCK_global_read_lock);
   (void) pthread_mutex_destroy(&LOCK_prepared_stmt_count);
@@ -3755,7 +3756,7 @@ static int init_thread_environment()
   (void) my_rwlock_init(&LOCK_system_variables_hash, NULL);
   (void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST);
   (void) pthread_mutex_init(&LOCK_prepared_stmt_count, MY_MUTEX_INIT_FAST);
-  (void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST);
+  (void) pthread_mutex_init(&LOCK_short_uuid_generator, MY_MUTEX_INIT_FAST);
   (void) pthread_mutex_init(&LOCK_connection_count, MY_MUTEX_INIT_FAST);
 #ifdef HAVE_OPENSSL
   (void) pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST);



More information about the commits mailing list