| 1 |
# Tests for PERFORMANCE_SCHEMA |
| 2 |
|
| 3 |
--source include/have_log_bin.inc |
| 4 |
--source include/not_embedded.inc |
| 5 |
--source include/have_perfschema.inc |
| 6 |
--source include/master-slave.inc |
| 7 |
|
| 8 |
--disable_warnings |
| 9 |
drop table if exists test.t1; |
| 10 |
--sync_slave_with_master |
| 11 |
reset master; |
| 12 |
--enable_warnings |
| 13 |
|
| 14 |
create table test.t1(a int); |
| 15 |
drop table test.t1; |
| 16 |
|
| 17 |
--source include/show_binlog_events.inc |
| 18 |
|
| 19 |
# Notes |
| 20 |
# |
| 21 |
# The point of this test is to make sure code is properly instrumented, |
| 22 |
# for replication threads. |
| 23 |
# Each time an ID is assigned to a replication thread, |
| 24 |
# visible in the INFORMATION_SCHEMA.PROCESSLIST table, |
| 25 |
# the same PROCESSLIST_ID should be visible in table performance_schema.threads |
| 26 |
|
| 27 |
connection master; |
| 28 |
-- echo "============ Performance schema on master ============" |
| 29 |
|
| 30 |
# Read the ID of the binlog dump connection, |
| 31 |
# as exposed in PROCESSLIST. |
| 32 |
--disable_cursor_protocol |
| 33 |
--enable_prepare_warnings |
| 34 |
select ID from INFORMATION_SCHEMA.PROCESSLIST |
| 35 |
where COMMAND = "Binlog Dump" |
| 36 |
into @master_dump_pid; |
| 37 |
--disable_prepare_warnings |
| 38 |
--enable_cursor_protocol |
| 39 |
|
| 40 |
select COMMAND, STATE |
| 41 |
from INFORMATION_SCHEMA.PROCESSLIST |
| 42 |
where ID = @master_dump_pid; |
| 43 |
|
| 44 |
# Make sure the performance schema also knows this PROCESSLIST_ID |
| 45 |
select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE |
| 46 |
from performance_schema.threads |
| 47 |
where PROCESSLIST_ID = @master_dump_pid; |
| 48 |
|
| 49 |
sync_slave_with_master; |
| 50 |
-- echo "============ Performance schema on slave ============" |
| 51 |
|
| 52 |
# Read the ID of the SLAVE IO thread, |
| 53 |
# as exposed in PROCESSLIST. |
| 54 |
--disable_cursor_protocol |
| 55 |
--enable_prepare_warnings |
| 56 |
select ID from INFORMATION_SCHEMA.PROCESSLIST |
| 57 |
where STATE like "Waiting for master to send event%" |
| 58 |
into @slave_io_pid; |
| 59 |
--disable_prepare_warnings |
| 60 |
--enable_cursor_protocol |
| 61 |
|
| 62 |
select COMMAND, STATE |
| 63 |
from INFORMATION_SCHEMA.PROCESSLIST |
| 64 |
where ID = @slave_io_pid; |
| 65 |
|
| 66 |
# Make sure the performance schema also knows this PROCESSLIST_ID |
| 67 |
select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE |
| 68 |
from performance_schema.threads |
| 69 |
where PROCESSLIST_ID = @slave_io_pid; |
| 70 |
|
| 71 |
# Read the ID of the SLAVE SQL thread, |
| 72 |
# as exposed in PROCESSLIST. |
| 73 |
--disable_cursor_protocol |
| 74 |
--enable_prepare_warnings |
| 75 |
select ID from INFORMATION_SCHEMA.PROCESSLIST |
| 76 |
where STATE like "Slave has read all relay log%" |
| 77 |
into @slave_sql_pid; |
| 78 |
--disable_prepare_warnings |
| 79 |
--enable_cursor_protocol |
| 80 |
|
| 81 |
select COMMAND, STATE |
| 82 |
from INFORMATION_SCHEMA.PROCESSLIST |
| 83 |
where ID = @slave_sql_pid; |
| 84 |
|
| 85 |
# Make sure the performance schema also knows this PROCESSLIST_ID |
| 86 |
select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE |
| 87 |
from performance_schema.threads |
| 88 |
where PROCESSLIST_ID = @slave_sql_pid; |
| 89 |
|
| 90 |
--echo # |
| 91 |
--echo # MDEV-33031 Assertion failure upon reading from performance schema with binlog enabled |
| 92 |
--echo # |
| 93 |
select variable_name, variable_value from performance_schema.status_by_thread |
| 94 |
where variable_name like '%impossible%'; # should not crash |
| 95 |
|
| 96 |
--source include/rpl_end.inc |
| 97 |
|