List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:January 26 2012 7:04pm
Subject:bzr push into mysql-trunk branch (chris.powers:3791 to 3793) Bug#13440472
View as plain text  
 3793 Christopher Powers	2012-01-26
      Bug#13440472 MANY VALGRIND FAILURES ON DAILY-TRUNK
      
      Added one more suppression

    modified:
      mysql-test/valgrind.supp
 3792 Christopher Powers	2012-01-26
      Bug#13440472 MANY VALGRIND FAILURES ON DAILY-TRUNK
        
      Deallocate the array of PFS instrument configuration values during
      server shutdown to avoid Valgrind errors.

    modified:
      sql/mysqld.cc
      storage/perfschema/pfs_server.cc
 3791 Christopher Powers	2012-01-26 [merge]
      local merge

    renamed:
      mysql-test/suite/sys_vars/r/innodb_sort_buf_size_basic.result => mysql-test/suite/sys_vars/r/innodb_sort_buffer_size_basic.result
      mysql-test/suite/sys_vars/t/innodb_sort_buf_size_basic.test => mysql-test/suite/sys_vars/t/innodb_sort_buffer_size_basic.test
    modified:
      mysql-test/include/range.inc
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/optimizer_debug_sync.result
      mysql-test/r/plugin.result
      mysql-test/r/range_all.result
      mysql-test/r/range_icp.result
      mysql-test/r/range_icp_mrr.result
      mysql-test/r/range_mrr.result
      mysql-test/r/range_mrr_cost.result
      mysql-test/r/range_none.result
      mysql-test/t/optimizer_debug_sync.test
      mysql-test/t/plugin.test
      mysql-test/t/temp_table.test
      sql/handler.cc
      sql/handler.h
      sql/item.cc
      sql/opt_explain.cc
      sql/opt_range.cc
      storage/example/ha_example.cc
      storage/innobase/btr/btr0btr.cc
      storage/innobase/btr/btr0cur.cc
      storage/innobase/buf/buf0buf.cc
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/ibuf/ibuf0ibuf.cc
      storage/innobase/include/btr0btr.h
      storage/innobase/include/mtr0log.ic
      storage/innobase/lock/lock0lock.cc
      storage/innobase/page/page0page.cc
      storage/innobase/row/row0ins.cc
      storage/innobase/row/row0sel.cc
      storage/innobase/row/row0umod.cc
      storage/innobase/row/row0upd.cc
      storage/innobase/srv/srv0srv.cc
      storage/innobase/trx/trx0purge.cc
      storage/innobase/trx/trx0rec.cc
      mysql-test/suite/sys_vars/r/innodb_sort_buffer_size_basic.result
      mysql-test/suite/sys_vars/t/innodb_sort_buffer_size_basic.test
=== modified file 'mysql-test/valgrind.supp'
--- a/mysql-test/valgrind.supp	2011-12-09 08:32:03 +0000
+++ b/mysql-test/valgrind.supp	2012-01-26 19:03:55 +0000
@@ -826,6 +826,16 @@
 }
 
 {
+   missing shutdown_performance_schema 11
+   Memcheck:Leak
+   fun:malloc
+   fun:my_malloc
+   fun:init_dynamic_array2
+   fun:_Z11mysqld_mainiPPc
+   fun:(below main)
+}
+
+{
    Bug 59874 Valgrind warning in InnoDB compression code
    Memcheck:Cond
    fun:*

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2012-01-25 10:07:23 +0000
+++ b/sql/mysqld.cc	2012-01-26 17:49:01 +0000
@@ -1526,10 +1526,7 @@ static void mysqld_exit(int exit_code)
   clean_up_mutexes();
   clean_up_error_log_mutex();
 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
-  /*
-    Bug#56666 needs to be fixed before calling:
-    shutdown_performance_schema();
-  */
+  shutdown_performance_schema();
 #endif
   my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
   exit(exit_code); /* purecov: inspected */

=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc	2012-01-24 23:42:36 +0000
+++ b/storage/perfschema/pfs_instr_class.cc	2012-01-25 22:37:55 +0000
@@ -47,7 +47,13 @@
 */
 my_bool pfs_enabled= TRUE;
 
-DYNAMIC_ARRAY pfs_instr_init_array;
+/**
+  PFS_INSTRUMENT option settings array and associated state variable to
+  serialize access during shutdown.
+ */
+DYNAMIC_ARRAY pfs_instr_config_array;
+int pfs_instr_config_state= PFS_INSTR_CONFIG_NOT_INITIALIZED;
+
 static void configure_instr_class(PFS_instr_class *entry);
 
 static void init_instr_class(PFS_instr_class *klass,
@@ -619,10 +625,10 @@ static void configure_instr_class(PFS_in
 {
   uint match_length= 0; /* length of matching pattern */
 
-  for (uint i= 0; i < pfs_instr_init_array.elements; i++)
+  for (uint i= 0; i < pfs_instr_config_array.elements; i++)
   {
-    PFS_instr_init* e;
-    get_dynamic(&pfs_instr_init_array, (uchar*)&e, i);
+    PFS_instr_config* e;
+    get_dynamic(&pfs_instr_config_array, (uchar*)&e, i);
 
     /**
       Compare class name to all configuration entries. In case of multiple

=== modified file 'storage/perfschema/pfs_instr_class.h'
--- a/storage/perfschema/pfs_instr_class.h	2012-01-24 23:42:36 +0000
+++ b/storage/perfschema/pfs_instr_class.h	2012-01-25 22:37:55 +0000
@@ -87,7 +87,7 @@ enum PFS_class_type
 };
 
 /** User-defined instrument configuration. */
-struct PFS_instr_init
+struct PFS_instr_config
 {
   /* Instrument name. */
   char *m_name;
@@ -99,7 +99,12 @@ struct PFS_instr_init
   bool m_timed;
 };
 
-extern DYNAMIC_ARRAY pfs_instr_init_array;
+extern DYNAMIC_ARRAY pfs_instr_config_array;
+extern int pfs_instr_config_state;
+
+static const int PFS_INSTR_CONFIG_NOT_INITIALIZED= 0;
+static const int PFS_INSTR_CONFIG_ALLOCATED= 1;
+static const int PFS_INSTR_CONFIG_DEALLOCATED= 2;
 
 struct PFS_thread;
 

=== modified file 'storage/perfschema/pfs_server.cc'
--- a/storage/perfschema/pfs_server.cc	2012-01-24 23:42:36 +0000
+++ b/storage/perfschema/pfs_server.cc	2012-01-26 17:49:01 +0000
@@ -46,6 +46,7 @@ static void destroy_pfs_thread(void *key
 C_MODE_END
 
 static void cleanup_performance_schema(void);
+void cleanup_instrument_config(void);
 
 struct PSI_bootstrap*
 initialize_performance_schema(const PFS_global_param *param)
@@ -65,6 +66,7 @@ initialize_performance_schema(const PFS_
 
   init_timers();
   PFS_atomic::init();
+
   init_event_name_sizing(param);
   register_global_classes();
 
@@ -150,6 +152,8 @@ static void destroy_pfs_thread(void *key
 
 static void cleanup_performance_schema(void)
 {
+  cleanup_instrument_config();
+/*  Disabled: Bug#5666
   cleanup_instruments();
   cleanup_sync_class();
   cleanup_thread_class();
@@ -174,12 +178,14 @@ static void cleanup_performance_schema(v
   cleanup_account();
   cleanup_account_hash();
   PFS_atomic::cleanup();
+*/
 }
 
 void shutdown_performance_schema(void)
 {
   pfs_initialized= false;
   cleanup_performance_schema();
+#if 0
   /*
     Be careful to not delete un-initialized keys,
     this would affect key 0, which is THR_KEY_mysys,
@@ -190,6 +196,7 @@ void shutdown_performance_schema(void)
     pthread_key_delete(THR_PFS);
     THR_PFS_initialized= false;
   }
+#endif
 }
 
 /**
@@ -198,7 +205,21 @@ void shutdown_performance_schema(void)
 */
 void init_pfs_instrument_array()
 {
-  my_init_dynamic_array(&pfs_instr_init_array, sizeof(PFS_instr_init*), 10, 10);
+  my_init_dynamic_array(&pfs_instr_config_array, sizeof(PFS_instr_config*), 10, 10);
+  pfs_instr_config_state=  PFS_INSTR_CONFIG_ALLOCATED;
+}
+
+/**
+  Deallocate the PFS_INSTRUMENT array. Use an atomic compare-and-swap to ensure
+  that it is deallocated only once in the chaotic environment of server shutdown.
+*/
+void cleanup_instrument_config()
+{
+  int desired_state= PFS_INSTR_CONFIG_ALLOCATED;
+  
+  /* Ignore if another thread has already deallocated the array */
+  if (my_atomic_cas32(&pfs_instr_config_state, &desired_state, PFS_INSTR_CONFIG_DEALLOCATED))
+    delete_dynamic(&pfs_instr_config_array);
 }
 
 /**
@@ -217,12 +238,12 @@ int add_pfs_instr_to_array(const char* n
   int value_length= strlen(value);
 
   /* Allocate structure plus string buffers plus null terminators */
-  PFS_instr_init* e = (PFS_instr_init*)my_malloc(sizeof(PFS_instr_init)
+  PFS_instr_config* e = (PFS_instr_config*)my_malloc(sizeof(PFS_instr_config)
                        + name_length + 1 + value_length + 1, MYF(MY_WME));
   if (!e) return 1;
   
   /* Copy the instrument name */
-  e->m_name= (char*)e + sizeof(PFS_instr_init);
+  e->m_name= (char*)e + sizeof(PFS_instr_config);
   memcpy(e->m_name, name, name_length);
   e->m_name_length= name_length;
   e->m_name[name_length]= '\0';
@@ -258,7 +279,7 @@ int add_pfs_instr_to_array(const char* n
   }
 
   /* Add to the array of default startup options */
-  if (insert_dynamic(&pfs_instr_init_array, &e))
+  if (insert_dynamic(&pfs_instr_config_array, &e))
   {
     my_free(e);
     return 1;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (chris.powers:3791 to 3793) Bug#13440472Christopher Powers30 Jan