3509 Marc Alff 2012-05-14
Table io / table lock cleanup for global statistics
modified:
storage/perfschema/pfs.cc
storage/perfschema/pfs_events_waits.cc
storage/perfschema/pfs_instr_class.cc
storage/perfschema/pfs_instr_class.h
storage/perfschema/pfs_server.cc
storage/perfschema/pfs_visitor.cc
3508 Marc Alff 2012-05-14 [merge]
Merge mysql-trunk --> mysql-trunk-pfs-tuning
modified:
mysql-test/include/index_merge1.inc
mysql-test/include/index_merge2.inc
mysql-test/include/index_merge_ror.inc
mysql-test/r/blackhole.result
mysql-test/r/explain_json_all.result
mysql-test/r/explain_json_none.result
mysql-test/r/index_merge_innodb.result
mysql-test/r/innodb_explain_json_non_select_all.result
mysql-test/r/innodb_explain_json_non_select_none.result
mysql-test/r/myisam_explain_json_non_select_all.result
mysql-test/r/myisam_explain_json_non_select_none.result
mysql-test/r/partition_binlog.result
mysql-test/r/subquery_sj_mat_nosj.result
mysql-test/r/subquery_sj_none.result
mysql-test/r/subquery_sj_none_bka.result
mysql-test/r/subquery_sj_none_bka_nixbnl.result
mysql-test/r/subquery_sj_none_bkaunique.result
mysql-test/suite/innodb/r/innodb_stats_rename_table_if_exists.result
mysql-test/suite/innodb/t/innodb_stats_rename_table_if_exists.test
mysql-test/suite/rpl/r/rpl_corruption.result
mysql-test/suite/rpl/t/rpl_corruption.test
mysql-test/t/blackhole.test
mysql-test/t/partition_binlog.test
sql/opt_explain.cc
sql/opt_explain_format.h
sql/opt_explain_traditional.cc
sql/opt_range.cc
storage/innobase/dict/dict0stats.cc
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/handler0alter.cc
storage/innobase/include/dict0stats.h
=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc 2012-05-04 08:29:12 +0000
+++ b/storage/perfschema/pfs.cc 2012-05-14 10:23:12 +0000
@@ -890,44 +890,67 @@ static inline int mysql_mutex_lock(...)
@subsection IMPL_WAIT_TABLE Table waits
@verbatim
- table_locker(Th, Tb)
+ table_locker(Thread Th, Table Tb, Event = io or lock)
|
| [1]
|
-1a |-> pfs_table(Tb) =====>> [B], [C], [D]
+1a |-> pfs_table(Tb) =====>> [A], [B], [C]
| |
| | [2]
| |
- | |-> pfs_table_share(Tb.share) =====>> [C], [D]
+ | |-> pfs_table_share(Tb.share) =====>> [B], [C]
+ | |
+ | | [3]
+ | |
+ | |-> global_table_io_stat =====>> [C]
+ | |
+ | |-> global_table_lock_stat =====>> [C]
|
-1b |-> pfs_thread(Th).event_name(io|lock) =====>> [A]
+1b |-> pfs_thread(Th).event_name(E) =====>> [D], [E], [F], [G]
| |
- | ...
+ | | [ 4-RESET]
+ | |
+ | |-> pfs_account(U, H).event_name(E) =====>> [E], [F], [G]
+ | . |
+ | . | [5-RESET]
+ | . |
+ | .....+-> pfs_user(U).event_name(E) =====>> [F]
+ | . |
+ | .....+-> pfs_host(H).event_name(E) =====>> [G]
|
-1c |-> pfs_thread(Th).waits_current(W) =====>> [E]
+1c |-> pfs_thread(Th).waits_current(W) =====>> [H]
|
-1d |-> pfs_thread(Th).waits_history(W) =====>> [F]
+1d |-> pfs_thread(Th).waits_history(W) =====>> [I]
|
-1e |-> waits_history_long(W) =====>> [G]
+1e |-> waits_history_long(W) =====>> [J]
@endverbatim
Implemented as:
- [1] @c start_table_io_wait_v1(), @c end_table_io_wait_v1()
- [2] @c close_table_v1()
- - [A] EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME,
- @c table_ews_by_thread_by_event_name::make_row()
- - [B] EVENTS_WAITS_SUMMARY_BY_INSTANCE,
+ - [3] @c drop_table_share_v1()
+ - [4] @c TRUNCATE TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+ - [5] @c TRUNCATE TABLE EVENTS_WAITS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME
+ - [A] EVENTS_WAITS_SUMMARY_BY_INSTANCE,
@c table_events_waits_summary_by_instance::make_table_row()
+ - [B] OBJECTS_SUMMARY_GLOBAL_BY_TYPE,
+ @c table_os_global_by_type::make_row()
- [C] EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME,
@c table_ews_global_by_event_name::make_table_io_row(),
@c table_ews_global_by_event_name::make_table_lock_row()
- - [D] OBJECTS_SUMMARY_GLOBAL_BY_TYPE,
- @c table_os_global_by_type::make_row()
- - [E] EVENTS_WAITS_CURRENT,
+ - [D] EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME,
+ @c table_ews_by_thread_by_event_name::make_row()
+ - [E] EVENTS_WAITS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME,
+ @c table_ews_by_user_by_account_name::make_row()
+ - [F] EVENTS_WAITS_SUMMARY_BY_USER_BY_EVENT_NAME,
+ @c table_ews_by_user_by_event_name::make_row()
+ - [G] EVENTS_WAITS_SUMMARY_BY_HOST_BY_EVENT_NAME,
+ @c table_ews_by_host_by_event_name::make_row()
+ - [H] EVENTS_WAITS_CURRENT,
@c table_events_waits_common::make_row()
- - [F] EVENTS_WAITS_HISTORY,
+ - [I] EVENTS_WAITS_HISTORY,
@c table_events_waits_common::make_row()
- - [G] EVENTS_WAITS_HISTORY_LONG,
+ - [J] EVENTS_WAITS_HISTORY_LONG,
@c table_events_waits_common::make_row()
@section IMPL_STAGE Implementation for stages aggregates
=== modified file 'storage/perfschema/pfs_events_waits.cc'
--- a/storage/perfschema/pfs_events_waits.cc 2011-11-18 16:49:29 +0000
+++ b/storage/perfschema/pfs_events_waits.cc 2012-05-14 10:23:12 +0000
@@ -238,6 +238,9 @@ void reset_events_waits_global()
for ( ; stat < stat_last; stat++)
stat->reset();
+
+ global_table_io_stat.reset();
+ global_table_lock_stat.reset();
}
void reset_table_waits_by_table()
=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc 2012-05-03 08:22:40 +0000
+++ b/storage/perfschema/pfs_instr_class.cc 2012-05-14 10:23:12 +0000
@@ -135,9 +135,11 @@ static PFS_thread_class *thread_class_ar
*/
PFS_table_share *table_share_array= NULL;
-PFS_instr_class global_table_io_class;
-PFS_instr_class global_table_lock_class;
-PFS_instr_class global_idle_class;
+PFS_ALIGNED PFS_table_io_stat global_table_io_stat;
+PFS_ALIGNED PFS_table_lock_stat global_table_lock_stat;
+PFS_ALIGNED PFS_instr_class global_table_io_class;
+PFS_ALIGNED PFS_instr_class global_table_lock_class;
+PFS_ALIGNED PFS_instr_class global_idle_class;
/** Class-timer map */
enum_timer_name *class_timers[] =
@@ -1352,17 +1354,27 @@ search:
void PFS_table_share::aggregate_io(void)
{
uint safe_key_count= sanitize_index_count(m_key_count);
- uint index= global_table_io_class.m_event_name_index;
- PFS_single_stat *table_io_total= & global_instr_class_waits_array[index];
- m_table_stat.sum_io(table_io_total, safe_key_count);
+ PFS_table_io_stat *from_stat;
+ PFS_table_io_stat *from_stat_last;
+ PFS_table_io_stat sum_io;
+
+ /* Aggregate stats for each index, if any */
+ from_stat= & m_table_stat.m_index_stat[0];
+ from_stat_last= from_stat + safe_key_count;
+ for ( ; from_stat < from_stat_last ; from_stat++)
+ sum_io.aggregate(from_stat);
+
+ /* Aggregate stats for the table */
+ sum_io.aggregate(& m_table_stat.m_index_stat[MAX_INDEXES]);
+
+ /* Add this table stats to the global sink. */
+ global_table_io_stat.aggregate(& sum_io);
m_table_stat.fast_reset_io();
}
void PFS_table_share::aggregate_lock(void)
{
- uint index= global_table_lock_class.m_event_name_index;
- PFS_single_stat *table_lock_total= & global_instr_class_waits_array[index];
- m_table_stat.sum_lock(table_lock_total);
+ global_table_lock_stat.aggregate(& m_table_stat.m_lock_stat);
m_table_stat.fast_reset_lock();
}
=== modified file 'storage/perfschema/pfs_instr_class.h'
--- a/storage/perfschema/pfs_instr_class.h 2012-05-03 08:22:40 +0000
+++ b/storage/perfschema/pfs_instr_class.h 2012-05-14 10:23:12 +0000
@@ -325,6 +325,11 @@ private:
int m_refcount;
};
+/** Statistics for dropped table io. */
+extern PFS_table_io_stat global_table_io_stat;
+/** Statistics for dropped table lock. */
+extern PFS_table_lock_stat global_table_lock_stat;
+
inline uint sanitize_index_count(uint count)
{
if (likely(count <= MAX_INDEXES))
=== modified file 'storage/perfschema/pfs_server.cc'
--- a/storage/perfschema/pfs_server.cc 2012-03-02 10:00:10 +0000
+++ b/storage/perfschema/pfs_server.cc 2012-05-14 10:23:12 +0000
@@ -55,6 +55,8 @@ initialize_performance_schema(const PFS_
pfs_initialized= false;
PFS_table_stat::g_reset_template.reset();
+ global_table_io_stat.reset();
+ global_table_lock_stat.reset();
if (! param->m_enabled)
{
=== modified file 'storage/perfschema/pfs_visitor.cc'
--- a/storage/perfschema/pfs_visitor.cc 2012-03-23 10:09:24 +0000
+++ b/storage/perfschema/pfs_visitor.cc 2012-05-14 10:23:12 +0000
@@ -959,13 +959,8 @@ PFS_object_wait_visitor::~PFS_object_wai
void PFS_object_wait_visitor::visit_global()
{
- uint index;
-
- index= global_table_io_class.m_event_name_index;
- m_stat.aggregate(& global_instr_class_waits_array[index]);
-
- index= global_table_lock_class.m_event_name_index;
- m_stat.aggregate(& global_instr_class_waits_array[index]);
+ global_table_io_stat.sum(& m_stat);
+ global_table_lock_stat.sum(& m_stat);
}
void PFS_object_wait_visitor::visit_table_share(PFS_table_share *pfs)
@@ -992,8 +987,7 @@ PFS_table_io_wait_visitor::~PFS_table_io
void PFS_table_io_wait_visitor::visit_global()
{
- uint index= global_table_io_class.m_event_name_index;
- m_stat.aggregate(& global_instr_class_waits_array[index]);
+ global_table_io_stat.sum(& m_stat);
}
void PFS_table_io_wait_visitor::visit_table_share(PFS_table_share *pfs)
@@ -1100,8 +1094,7 @@ PFS_table_lock_wait_visitor::~PFS_table_
void PFS_table_lock_wait_visitor::visit_global()
{
- uint index= global_table_lock_class.m_event_name_index;
- m_stat.aggregate(& global_instr_class_waits_array[index]);
+ global_table_lock_stat.sum(& m_stat);
}
void PFS_table_lock_wait_visitor::visit_table_share(PFS_table_share *pfs)
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3508 to 3509) | Marc Alff | 16 May |