From: Marc Alff Date: December 1 2010 7:08pm Subject: bzr push into mysql-trunk-bugfixing branch (marc.alff:3402) List-Archive: http://lists.mysql.com/commits/125698 Message-Id: <201012011910.oB1JAH9l008301@rcsinet13.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3402 Marc Alff 2010-12-01 [merge] Local merge added: mysql-test/suite/perfschema/r/dml_threads.result mysql-test/suite/perfschema/r/thread_cache.result mysql-test/suite/perfschema/t/dml_threads.test mysql-test/suite/perfschema/t/thread_cache.test modified: BUILD/build_mccge.sh mysql-test/suite/perfschema/include/privilege.inc mysql-test/suite/perfschema/r/dml_cond_instances.result mysql-test/suite/perfschema/r/dml_ews_by_instance.result mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result mysql-test/suite/perfschema/r/dml_file_instances.result mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result mysql-test/suite/perfschema/r/dml_mutex_instances.result mysql-test/suite/perfschema/r/dml_rwlock_instances.result mysql-test/suite/perfschema/r/misc.result mysql-test/suite/perfschema/r/myisam_file_io.result mysql-test/suite/perfschema/r/privilege.result mysql-test/suite/perfschema/t/dml_cond_instances.test mysql-test/suite/perfschema/t/dml_ews_by_instance.test mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test mysql-test/suite/perfschema/t/dml_file_instances.test mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test mysql-test/suite/perfschema/t/dml_mutex_instances.test mysql-test/suite/perfschema/t/dml_rwlock_instances.test mysql-test/suite/perfschema/t/misc.test mysql-test/suite/perfschema/t/myisam_file_io.test storage/perfschema/ha_perfschema.cc storage/perfschema/ha_perfschema.h storage/perfschema/pfs_engine_table.cc storage/perfschema/table_setup_actors.cc storage/perfschema/table_setup_consumers.cc storage/perfschema/table_setup_instruments.cc storage/perfschema/table_setup_timers.cc storage/perfschema/table_threads.cc === modified file 'storage/perfschema/pfs_instr.cc' --- a/storage/perfschema/pfs_instr.cc 2010-11-16 06:27:18 +0000 +++ b/storage/perfschema/pfs_instr.cc 2010-12-01 08:33:53 +0000 @@ -1057,7 +1057,7 @@ PFS_table* create_table(PFS_table_share { pfs->m_identity= identity; pfs->m_share= share; - share->m_refcount++; + share->inc_refcount(); pfs->m_wait_stat.m_control_flag= &flag_events_waits_summary_by_instance; pfs->m_wait_stat.m_parent= &share->m_wait_stat; === modified file 'storage/perfschema/pfs_instr_class.cc' --- a/storage/perfschema/pfs_instr_class.cc 2010-11-16 06:27:18 +0000 +++ b/storage/perfschema/pfs_instr_class.cc 2010-12-01 08:33:53 +0000 @@ -788,7 +788,7 @@ search: { PFS_table_share *pfs; pfs= *entry; - pfs->m_refcount++ ; + pfs->inc_refcount() ; lf_hash_search_unpin(pins); return pfs; } @@ -835,7 +835,7 @@ search: reset_single_stat_link(&pfs->m_wait_stat); pfs->m_enabled= enabled; pfs->m_timed= timed; - pfs->m_refcount= 1; + pfs->init_refcount(); int res; res= lf_hash_insert(&table_share_hash, pins, &pfs); @@ -879,7 +879,7 @@ search: */ void purge_table_share(PFS_thread *thread, PFS_table_share *pfs) { - if (pfs->m_refcount == 1) + if (pfs->get_refcount() == 1) { LF_PINS* pins= get_table_share_hash_pins(thread); if (likely(pins != NULL)) === modified file 'storage/perfschema/pfs_instr_class.h' --- a/storage/perfschema/pfs_instr_class.h 2010-11-16 06:27:18 +0000 +++ b/storage/perfschema/pfs_instr_class.h 2010-12-01 08:33:53 +0000 @@ -146,11 +146,32 @@ struct PFS_table_share_key /** Instrumentation metadata for a table share. */ struct PFS_table_share { +public: enum_object_type get_object_type() { return (enum_object_type) m_key.m_hash_key[0]; } + inline void init_refcount(void) + { + PFS_atomic::store_32(& m_refcount, 1); + } + + inline int get_refcount(void) + { + return PFS_atomic::load_32(& m_refcount); + } + + inline void inc_refcount(void) + { + PFS_atomic::add_32(& m_refcount, 1); + } + + inline void dec_refcount(void) + { + PFS_atomic::add_32(& m_refcount, -1); + } + /** Internal lock. */ pfs_lock m_lock; /** Search key. */ @@ -170,8 +191,10 @@ struct PFS_table_share /** True if this table instrument is timed. */ bool m_timed; bool m_purge; + +private: /** Number of opened table handles. */ - uint m_refcount; + int m_refcount; }; /** No bundle (reason: useless for push emails).