mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
47fae7f08f
Now when a table is dropped the statistics on the table is removed from the statistical tables. If the table is altered in such a way that a column is dropped or the type of the column is changed then statistics on the column is removed from the table column_stat. It also triggers removal of the statistics on the indexes who use this column as its component. Added procedures that changes the names of the tables or columns in the statistical tables for. These procedures are used when tables/columns are renamed. Also partly re-factored the code that introduced the persistent statistical tables. Added test cases into statistics.test to cover the new code.
60 lines
1.8 KiB
Text
60 lines
1.8 KiB
Text
# Tests for PERFORMANCE_SCHEMA
|
|
|
|
--source include/not_embedded.inc
|
|
--source include/have_perfschema.inc
|
|
|
|
# Setup
|
|
|
|
update performance_schema.setup_instruments set enabled='NO';
|
|
update performance_schema.setup_instruments set enabled='YES'
|
|
where name like "wait/io/file/myisam/%";
|
|
|
|
update performance_schema.setup_consumers
|
|
set enabled='YES';
|
|
|
|
truncate table performance_schema.events_waits_history_long;
|
|
|
|
# Reset lost counters to a known state
|
|
flush status;
|
|
|
|
# Code to test
|
|
|
|
--disable_warnings
|
|
drop table if exists test.no_index_tab;
|
|
--enable_warnings
|
|
|
|
create table test.no_index_tab ( a varchar(255), b int ) engine=myisam;
|
|
insert into no_index_tab set a = 'foo', b = 1;
|
|
insert into no_index_tab set a = 'foo', b = 1;
|
|
insert into no_index_tab set a = 'foo', b = 1;
|
|
|
|
# Verification
|
|
# Note that mi_create.c contains mysql_file_tell() calls in debug only,
|
|
# so the result are filtered to remove 'tell'.
|
|
# Note that even after setting other instruments to enabled='NO'
|
|
# and truncating the events_waits_history_long table,
|
|
# some events -- that were already started but not completed --
|
|
# for other instruments could still be added in the history.
|
|
# To protect against that, an extra where clause
|
|
# "and event_name like "wait/io/file/myisam/%"
|
|
# is added to the select to filter out the result.
|
|
|
|
select event_name,
|
|
left(source, locate(":", source)) as short_source,
|
|
operation, number_of_bytes,
|
|
substring(object_name, locate("no_index_tab", object_name)) as short_name
|
|
from performance_schema.events_waits_history_long
|
|
where operation not like "tell"
|
|
and event_name like "wait/io/file/myisam/%"
|
|
having short_name <> ""
|
|
order by thread_id, event_id;
|
|
|
|
# In case of failures, this will tell if file io are lost.
|
|
show status like 'performance_schema_%';
|
|
|
|
# Cleanup
|
|
|
|
update performance_schema.setup_instruments set enabled='YES';
|
|
|
|
drop table test.no_index_tab;
|
|
|