mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug#57609 performance_schema does not work with lower_case_table_names
Before this fix, the performance schema tables were defined in UPPERCASE. This was incompatible with the lowercase_table_names option, and caused issues with the install / upgrade process, when changing the lower case table names setting *after* the install or upgrade. With this fix, all performance schema tables are exposed with lowercase names. As a result, the name of the performance schema table is always lowercase, no matter how / if / when the lowercase_table_names setting if changed.
This commit is contained in:
@ -25,19 +25,19 @@
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
update performance_schema.SETUP_INSTRUMENTS set enabled = 'NO';
|
||||
update performance_schema.SETUP_CONSUMERS set enabled = 'NO';
|
||||
update performance_schema.setup_instruments set enabled = 'NO';
|
||||
update performance_schema.setup_consumers set enabled = 'NO';
|
||||
|
||||
# Cleanup statistics
|
||||
truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
|
||||
truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE;
|
||||
truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
|
||||
truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
|
||||
truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
|
||||
truncate table performance_schema.file_summary_by_event_name;
|
||||
truncate table performance_schema.file_summary_by_instance;
|
||||
truncate table performance_schema.events_waits_summary_global_by_event_name;
|
||||
truncate table performance_schema.events_waits_summary_by_instance;
|
||||
truncate table performance_schema.events_waits_summary_by_thread_by_event_name;
|
||||
|
||||
# Start recording data
|
||||
update performance_schema.SETUP_CONSUMERS set enabled = 'YES';
|
||||
update performance_schema.SETUP_INSTRUMENTS
|
||||
update performance_schema.setup_consumers set enabled = 'YES';
|
||||
update performance_schema.setup_instruments
|
||||
set enabled = 'YES', timed = 'YES';
|
||||
|
||||
|
||||
@ -49,27 +49,27 @@ create table t1 (
|
||||
insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8);
|
||||
|
||||
# Stop recording data, so the select below don't add noise.
|
||||
update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO';
|
||||
update performance_schema.setup_instruments SET enabled = 'NO';
|
||||
# Disable all consumers, for long standing waits
|
||||
update performance_schema.SETUP_CONSUMERS set enabled = 'NO';
|
||||
update performance_schema.setup_consumers set enabled = 'NO';
|
||||
|
||||
# Helper to debug
|
||||
set @dump_all=FALSE;
|
||||
|
||||
# Note that in general:
|
||||
# - COUNT/SUM/MAX(FILE_SUMMARY_BY_EVENT_NAME) >=
|
||||
# COUNT/SUM/MAX(FILE_SUMMARY_BY_INSTANCE).
|
||||
# - MIN(FILE_SUMMARY_BY_EVENT_NAME) <=
|
||||
# MIN(FILE_SUMMARY_BY_INSTANCE).
|
||||
# - COUNT/SUM/MAX(file_summary_by_event_name) >=
|
||||
# COUNT/SUM/MAX(file_summary_by_instance).
|
||||
# - MIN(file_summary_by_event_name) <=
|
||||
# MIN(file_summary_by_instance).
|
||||
# There will be equality only when file instances are not removed,
|
||||
# aka when a file is not deleted from the file system,
|
||||
# because doing so removes a row in FILE_SUMMARY_BY_INSTANCE.
|
||||
# because doing so removes a row in file_summary_by_instance.
|
||||
|
||||
# Likewise:
|
||||
# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) >=
|
||||
# COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_INSTANCE)
|
||||
# - MIN(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) <=
|
||||
# MIN(EVENTS_WAITS_SUMMARY_BY_INSTANCE)
|
||||
# - COUNT/SUM/MAX(events_waits_summary_global_by_event_name) >=
|
||||
# COUNT/SUM/MAX(events_waits_summary_by_instance)
|
||||
# - MIN(events_waits_summary_global_by_event_name) <=
|
||||
# MIN(events_waits_summary_by_instance)
|
||||
# There will be equality only when an instrument instance
|
||||
# is not removed, which is next to impossible to predictably guarantee
|
||||
# in the server.
|
||||
@ -77,18 +77,18 @@ set @dump_all=FALSE;
|
||||
# will cause a mysql_mutex_destroy on myisam/MYISAM_SHARE::intern_lock.
|
||||
# Another example, a thread terminating will cause a mysql_mutex_destroy
|
||||
# on sql/LOCK_delete
|
||||
# Both cause a row to be deleted from EVENTS_WAITS_SUMMARY_BY_INSTANCE.
|
||||
# Both cause a row to be deleted from events_waits_summary_by_instance.
|
||||
|
||||
# Likewise:
|
||||
# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) >=
|
||||
# COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME)
|
||||
# - MIN(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) <=
|
||||
# MIN(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME)
|
||||
# - COUNT/SUM/MAX(events_waits_summary_global_by_event_name) >=
|
||||
# COUNT/SUM/MAX(events_waits_summary_by_thread_by_event_name)
|
||||
# - MIN(events_waits_summary_global_by_event_name) <=
|
||||
# MIN(events_waits_summary_by_thread_by_event_name)
|
||||
# There will be equality only when no thread is removed,
|
||||
# that is if no thread disconnects, or no sub thread (for example insert
|
||||
# delayed) ever completes.
|
||||
# A thread completing will cause rows in
|
||||
# EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME to be removed.
|
||||
# events_waits_summary_by_thread_by_event_name to be removed.
|
||||
|
||||
--echo "Verifying file aggregate consistency"
|
||||
|
||||
@ -101,29 +101,29 @@ set @dump_all=FALSE;
|
||||
# If any of these queries returns data, the test failed.
|
||||
|
||||
SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ)
|
||||
FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e
|
||||
JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
|
||||
FROM performance_schema.file_summary_by_event_name AS e
|
||||
JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME)
|
||||
GROUP BY EVENT_NAME
|
||||
HAVING (e.COUNT_READ <> SUM(i.COUNT_READ))
|
||||
OR @dump_all;
|
||||
|
||||
SELECT EVENT_NAME, e.COUNT_WRITE, SUM(i.COUNT_WRITE)
|
||||
FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e
|
||||
JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
|
||||
FROM performance_schema.file_summary_by_event_name AS e
|
||||
JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME)
|
||||
GROUP BY EVENT_NAME
|
||||
HAVING (e.COUNT_WRITE <> SUM(i.COUNT_WRITE))
|
||||
OR @dump_all;
|
||||
|
||||
SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_READ, SUM(i.SUM_NUMBER_OF_BYTES_READ)
|
||||
FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e
|
||||
JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
|
||||
FROM performance_schema.file_summary_by_event_name AS e
|
||||
JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME)
|
||||
GROUP BY EVENT_NAME
|
||||
HAVING (e.SUM_NUMBER_OF_BYTES_READ <> SUM(i.SUM_NUMBER_OF_BYTES_READ))
|
||||
OR @dump_all;
|
||||
|
||||
SELECT EVENT_NAME, e.SUM_NUMBER_OF_BYTES_WRITE, SUM(i.SUM_NUMBER_OF_BYTES_WRITE)
|
||||
FROM performance_schema.FILE_SUMMARY_BY_EVENT_NAME AS e
|
||||
JOIN performance_schema.FILE_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
|
||||
FROM performance_schema.file_summary_by_event_name AS e
|
||||
JOIN performance_schema.file_summary_by_instance AS i USING (EVENT_NAME)
|
||||
GROUP BY EVENT_NAME
|
||||
HAVING (e.SUM_NUMBER_OF_BYTES_WRITE <> SUM(i.SUM_NUMBER_OF_BYTES_WRITE))
|
||||
OR @dump_all;
|
||||
@ -131,23 +131,23 @@ OR @dump_all;
|
||||
--echo "Verifying waits aggregate consistency (instance)"
|
||||
|
||||
SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT)
|
||||
FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
|
||||
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
|
||||
FROM performance_schema.events_waits_summary_global_by_event_name AS e
|
||||
JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME)
|
||||
GROUP BY EVENT_NAME
|
||||
HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT))
|
||||
OR @dump_all;
|
||||
|
||||
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT)
|
||||
FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
|
||||
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
|
||||
FROM performance_schema.events_waits_summary_global_by_event_name AS e
|
||||
JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME)
|
||||
GROUP BY EVENT_NAME
|
||||
HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT))
|
||||
AND (MIN(i.MIN_TIMER_WAIT) != 0)
|
||||
OR @dump_all;
|
||||
|
||||
SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT)
|
||||
FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
|
||||
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
|
||||
FROM performance_schema.events_waits_summary_global_by_event_name AS e
|
||||
JOIN performance_schema.events_waits_summary_by_instance AS i USING (EVENT_NAME)
|
||||
GROUP BY EVENT_NAME
|
||||
HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT))
|
||||
OR @dump_all;
|
||||
@ -155,16 +155,16 @@ OR @dump_all;
|
||||
--echo "Verifying waits aggregate consistency (thread)"
|
||||
|
||||
SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT)
|
||||
FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
|
||||
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
|
||||
FROM performance_schema.events_waits_summary_global_by_event_name AS e
|
||||
JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t
|
||||
USING (EVENT_NAME)
|
||||
GROUP BY EVENT_NAME
|
||||
HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT))
|
||||
OR @dump_all;
|
||||
|
||||
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT)
|
||||
FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
|
||||
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
|
||||
FROM performance_schema.events_waits_summary_global_by_event_name AS e
|
||||
JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t
|
||||
USING (EVENT_NAME)
|
||||
GROUP BY EVENT_NAME
|
||||
HAVING (e.MIN_TIMER_WAIT > MIN(t.MIN_TIMER_WAIT))
|
||||
@ -172,8 +172,8 @@ AND (MIN(t.MIN_TIMER_WAIT) != 0)
|
||||
OR @dump_all;
|
||||
|
||||
SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT)
|
||||
FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
|
||||
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
|
||||
FROM performance_schema.events_waits_summary_global_by_event_name AS e
|
||||
JOIN performance_schema.events_waits_summary_by_thread_by_event_name AS t
|
||||
USING (EVENT_NAME)
|
||||
GROUP BY EVENT_NAME
|
||||
HAVING (e.MAX_TIMER_WAIT < MAX(t.MAX_TIMER_WAIT))
|
||||
@ -182,8 +182,8 @@ OR @dump_all;
|
||||
|
||||
# Cleanup
|
||||
|
||||
update performance_schema.SETUP_CONSUMERS set enabled = 'YES';
|
||||
update performance_schema.SETUP_INSTRUMENTS
|
||||
update performance_schema.setup_consumers set enabled = 'YES';
|
||||
update performance_schema.setup_instruments
|
||||
set enabled = 'YES', timed = 'YES';
|
||||
|
||||
drop table test.t1;
|
||||
|
Reference in New Issue
Block a user