summaryrefslogtreecommitdiff
path: root/storage/perfschema
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@oracle.com>2013-01-02 11:00:55 +0100
committerMarc Alff <marc.alff@oracle.com>2013-01-02 11:00:55 +0100
commit7a846307655842090a30e47e118346485b7d5839 (patch)
tree2adf3a4f46ce6266f19b6220b419e5e08c9c00f9 /storage/perfschema
parent5905fb4ba244fe9b080675542381b9ecdb46934c (diff)
downloadmariadb-git-7a846307655842090a30e47e118346485b7d5839.tar.gz
Bug#16060864 SEGMENTATION FAULT IN PERFORMANCE_SCHEMA WITH HISTORY SIZE 0
Before this fix, configuring the server with: - performance_schema_events_waits_history_size=0 - performance_schema_events_waits_history_long_size=0 could cause a crash in the performance schema. These settings to 0 are intended to be valid and supported, and are in fact working properly in mysql 5.6 and up already. This fix backports the code fix and test cases from mysql 5.6 to the mysql 5.5 release.
Diffstat (limited to 'storage/perfschema')
-rw-r--r--storage/perfschema/pfs_events_waits.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/storage/perfschema/pfs_events_waits.cc b/storage/perfschema/pfs_events_waits.cc
index b6cadf9e61c..a941f815dca 100644
--- a/storage/perfschema/pfs_events_waits.cc
+++ b/storage/perfschema/pfs_events_waits.cc
@@ -93,6 +93,9 @@ static inline void copy_events_waits(PFS_events_waits *dest,
*/
void insert_events_waits_history(PFS_thread *thread, PFS_events_waits *wait)
{
+ if (unlikely(events_waits_history_per_thread == 0))
+ return;
+
uint index= thread->m_waits_history_index;
/*
@@ -120,6 +123,9 @@ void insert_events_waits_history(PFS_thread *thread, PFS_events_waits *wait)
*/
void insert_events_waits_history_long(PFS_events_waits *wait)
{
+ if (unlikely(events_waits_history_long_size == 0))
+ return;
+
uint index= PFS_atomic::add_u32(&events_waits_history_long_index, 1);
index= index % events_waits_history_long_size;