mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
P_S 5.7.28
This commit is contained in:
@ -148,7 +148,7 @@ drop table if exists marker_multi_delete;
|
||||
use my_replicated_db;
|
||||
|
||||
insert into performance_schema.setup_actors
|
||||
values ('FOO', 'FOO', 'FOO');
|
||||
values ('FOO', 'FOO', 'FOO', 'YES', 'YES');
|
||||
|
||||
--error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
|
||||
delete my_tx_table.*, performance_schema.setup_actors.*
|
||||
@ -157,7 +157,7 @@ delete my_tx_table.*, performance_schema.setup_actors.*
|
||||
or performance_schema.setup_actors.role='FOO';
|
||||
|
||||
insert into performance_schema.setup_actors
|
||||
values ('BAR', 'BAR', 'BAR');
|
||||
values ('BAR', 'BAR', 'BAR', 'YES', 'YES');
|
||||
|
||||
--error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
|
||||
delete my_non_tx_table.*, performance_schema.setup_actors.*
|
||||
@ -166,7 +166,7 @@ delete my_non_tx_table.*, performance_schema.setup_actors.*
|
||||
or performance_schema.setup_actors.role='BAR';
|
||||
|
||||
insert into performance_schema.setup_actors
|
||||
values ('BAZ', 'BAZ', 'BAZ');
|
||||
values ('BAZ', 'BAZ', 'BAZ', 'YES', 'YES');
|
||||
|
||||
--error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
|
||||
delete my_bh_table.*, performance_schema.setup_actors.*
|
||||
@ -184,5 +184,5 @@ drop database my_replicated_db;
|
||||
# Restore performance_schema.setup_actors, damaged by this script
|
||||
|
||||
truncate table performance_schema.setup_actors;
|
||||
insert into performance_schema.setup_actors values ('%', '%', '%');
|
||||
insert into performance_schema.setup_actors values ('%', '%', '%', 'YES', 'YES');
|
||||
|
||||
|
@ -36,6 +36,12 @@ drop prepare dump_statements_host;
|
||||
drop prepare dump_statements_history;
|
||||
drop prepare dump_statements_global;
|
||||
|
||||
drop prepare dump_transactions_account;
|
||||
drop prepare dump_transactions_user;
|
||||
drop prepare dump_transactions_host;
|
||||
drop prepare dump_transactions_history;
|
||||
drop prepare dump_transactions_global;
|
||||
|
||||
drop prepare dump_users;
|
||||
drop prepare dump_hosts;
|
||||
drop prepare dump_accounts;
|
||||
@ -49,6 +55,7 @@ insert into performance_schema.setup_actors
|
||||
select * from test.setup_actors;
|
||||
drop table test.setup_actors;
|
||||
drop table test.t1;
|
||||
drop function test.f;
|
||||
|
||||
update performance_schema.threads set instrumented='YES';
|
||||
update performance_schema.setup_instruments set enabled='YES', timed='YES';
|
||||
|
@ -21,6 +21,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -30,7 +35,7 @@ execute dump_hosts;
|
||||
# The main thread does not count for BY_ACCOUNT / BY_HOST.
|
||||
# The user thread does count for BY_ACCOUNT, BY_HOST
|
||||
#
|
||||
# Each get_lock() causes 1 wait/synch/mutex/sql/LOCK_user_locks
|
||||
# Each uuid_short() causes 1 wait/synch/mutex/sql/LOCK_uuid_generator
|
||||
#
|
||||
# To avoid noise from main, the background threads are disabled.
|
||||
|
||||
@ -61,15 +66,23 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--connection con1
|
||||
|
||||
select get_lock("marker", 10);
|
||||
select release_lock("marker");
|
||||
select uuid_short() <> 1;
|
||||
select uuid_short() <> 1;
|
||||
start transaction;
|
||||
insert into test.t1 values ("marker");
|
||||
commit;
|
||||
select test.f(10,20);
|
||||
|
||||
--connection default
|
||||
|
||||
@ -96,6 +109,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -131,15 +149,23 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--connection con2
|
||||
|
||||
select get_lock("marker", 10);
|
||||
select release_lock("marker");
|
||||
select uuid_short() <> 1;
|
||||
select uuid_short() <> 1;
|
||||
start transaction;
|
||||
insert into test.t1 values ("marker");
|
||||
commit;
|
||||
select test.f(10,20);
|
||||
|
||||
--connection default
|
||||
|
||||
@ -166,6 +192,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -197,15 +228,23 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--connection con3
|
||||
|
||||
select get_lock("marker", 10);
|
||||
select release_lock("marker");
|
||||
select uuid_short() <> 1;
|
||||
select uuid_short() <> 1;
|
||||
start transaction;
|
||||
insert into test.t1 values ("marker");
|
||||
commit;
|
||||
select test.f(10,20);
|
||||
|
||||
--connection default
|
||||
|
||||
@ -232,6 +271,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -263,15 +307,23 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--connection con4
|
||||
|
||||
select get_lock("marker", 10);
|
||||
select release_lock("marker");
|
||||
select uuid_short() <> 1;
|
||||
select uuid_short() <> 1;
|
||||
start transaction;
|
||||
insert into test.t1 values ("marker");
|
||||
commit;
|
||||
select test.f(10,20);
|
||||
|
||||
--connection default
|
||||
|
||||
@ -298,6 +350,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -329,6 +386,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -360,6 +422,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -391,6 +458,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -422,6 +494,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -449,6 +526,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -474,6 +556,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -499,6 +586,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -524,6 +616,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -549,6 +646,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -574,6 +676,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -599,6 +706,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -624,6 +736,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -649,6 +766,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -674,6 +796,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -699,6 +826,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -724,6 +856,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -749,6 +886,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -774,6 +916,11 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
@ -799,13 +946,18 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.accounts;
|
||||
truncate performance_schema.events_transactions_summary_by_thread_by_event_name;
|
||||
|
||||
echo "================== ACCOUNTS truncated ==================";
|
||||
echo "================== TRANSACTIONS_BY_THREAD truncated ==================";
|
||||
|
||||
echo "================== Step 29 ==================";
|
||||
call dump_thread();
|
||||
@ -824,13 +976,18 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.users;
|
||||
truncate performance_schema.events_transactions_summary_by_account_by_event_name;
|
||||
|
||||
echo "================== USERS truncated ==================";
|
||||
echo "================== TRANSACTIONS_BY_ACCOUNT truncated ==================";
|
||||
|
||||
echo "================== Step 30 ==================";
|
||||
call dump_thread();
|
||||
@ -849,13 +1006,18 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.hosts;
|
||||
truncate performance_schema.events_transactions_summary_by_user_by_event_name;
|
||||
|
||||
echo "================== HOSTS truncated ==================";
|
||||
echo "================== TRANSACTIONS_BY_USER truncated ==================";
|
||||
|
||||
echo "================== Step 31 ==================";
|
||||
call dump_thread();
|
||||
@ -874,6 +1036,161 @@ execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.events_transactions_summary_by_host_by_event_name;
|
||||
|
||||
echo "================== TRANSACTIONS_BY_HOST truncated ==================";
|
||||
|
||||
echo "================== Step 32 ==================";
|
||||
call dump_thread();
|
||||
execute dump_waits_account;
|
||||
execute dump_waits_user;
|
||||
execute dump_waits_host;
|
||||
execute dump_waits_global;
|
||||
execute dump_waits_history;
|
||||
execute dump_stages_account;
|
||||
execute dump_stages_user;
|
||||
execute dump_stages_host;
|
||||
execute dump_stages_global;
|
||||
execute dump_stages_history;
|
||||
execute dump_statements_account;
|
||||
execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.events_transactions_summary_global_by_event_name;
|
||||
|
||||
echo "================== TRANSACTIONS_GLOBAL truncated ==================";
|
||||
|
||||
echo "================== Step 33 ==================";
|
||||
call dump_thread();
|
||||
execute dump_waits_account;
|
||||
execute dump_waits_user;
|
||||
execute dump_waits_host;
|
||||
execute dump_waits_global;
|
||||
execute dump_waits_history;
|
||||
execute dump_stages_account;
|
||||
execute dump_stages_user;
|
||||
execute dump_stages_host;
|
||||
execute dump_stages_global;
|
||||
execute dump_stages_history;
|
||||
execute dump_statements_account;
|
||||
execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.accounts;
|
||||
|
||||
echo "================== ACCOUNTS truncated ==================";
|
||||
|
||||
echo "================== Step 34 ==================";
|
||||
call dump_thread();
|
||||
execute dump_waits_account;
|
||||
execute dump_waits_user;
|
||||
execute dump_waits_host;
|
||||
execute dump_waits_global;
|
||||
execute dump_waits_history;
|
||||
execute dump_stages_account;
|
||||
execute dump_stages_user;
|
||||
execute dump_stages_host;
|
||||
execute dump_stages_global;
|
||||
execute dump_stages_history;
|
||||
execute dump_statements_account;
|
||||
execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.users;
|
||||
|
||||
echo "================== USERS truncated ==================";
|
||||
|
||||
echo "================== Step 35 ==================";
|
||||
call dump_thread();
|
||||
execute dump_waits_account;
|
||||
execute dump_waits_user;
|
||||
execute dump_waits_host;
|
||||
execute dump_waits_global;
|
||||
execute dump_waits_history;
|
||||
execute dump_stages_account;
|
||||
execute dump_stages_user;
|
||||
execute dump_stages_host;
|
||||
execute dump_stages_global;
|
||||
execute dump_stages_history;
|
||||
execute dump_statements_account;
|
||||
execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.hosts;
|
||||
|
||||
echo "================== HOSTS truncated ==================";
|
||||
|
||||
echo "================== Step 36 ==================";
|
||||
call dump_thread();
|
||||
execute dump_waits_account;
|
||||
execute dump_waits_user;
|
||||
execute dump_waits_host;
|
||||
execute dump_waits_global;
|
||||
execute dump_waits_history;
|
||||
execute dump_stages_account;
|
||||
execute dump_stages_user;
|
||||
execute dump_stages_host;
|
||||
execute dump_stages_global;
|
||||
execute dump_stages_history;
|
||||
execute dump_statements_account;
|
||||
execute dump_statements_user;
|
||||
execute dump_statements_host;
|
||||
execute dump_statements_global;
|
||||
execute dump_statements_history;
|
||||
execute dump_transactions_account;
|
||||
execute dump_transactions_user;
|
||||
execute dump_transactions_host;
|
||||
execute dump_transactions_global;
|
||||
execute dump_transactions_history;
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
@ -19,11 +19,16 @@
|
||||
# - events_statements_summary_by_account_by_event_name
|
||||
# - events_statements_summary_by_user_by_event_name
|
||||
# - events_statements_summary_by_host_by_event_name
|
||||
# - events_transactions_summary_by_thread_by_event_name
|
||||
# - events_transactions_summary_by_account_by_event_name
|
||||
# - events_transactions_summary_by_user_by_event_name
|
||||
# - events_transactions_summary_by_host_by_event_name
|
||||
#
|
||||
# Globally:
|
||||
# - events_waits_summary_global_by_event_name
|
||||
# - events_stages_summary_global_by_event_name
|
||||
# - events_statements_summary_global_by_event_name
|
||||
# - events_transactions_summary_global_by_event_name
|
||||
#
|
||||
# The tests are written with the following helpers:
|
||||
# - include/event_aggregate_setup.inc
|
||||
@ -90,6 +95,8 @@ drop table if exists test.t1;
|
||||
--enable_warnings
|
||||
|
||||
create table test.t1(a varchar(64));
|
||||
create function test.f(a int, b int) returns int
|
||||
return a+b;
|
||||
|
||||
create table test.setup_actors as
|
||||
select * from performance_schema.setup_actors;
|
||||
@ -111,14 +118,16 @@ update performance_schema.threads set instrumented='NO';
|
||||
update performance_schema.setup_instruments set enabled='NO', timed='NO';
|
||||
|
||||
update performance_schema.setup_instruments set enabled='YES', timed='YES'
|
||||
where name in ('wait/synch/mutex/sql/LOCK_user_locks',
|
||||
where name in ('wait/synch/mutex/sql/LOCK_connection_count',
|
||||
'wait/synch/mutex/sql/LOCK_uuid_generator',
|
||||
'wait/synch/rwlock/sql/LOCK_grant',
|
||||
'wait/io/file/sql/query_log',
|
||||
'idle');
|
||||
|
||||
update performance_schema.setup_instruments set enabled='YES', timed='YES'
|
||||
where name in ('stage/sql/Init', 'stage/sql/Init for update',
|
||||
'stage/sql/Checking permissions',
|
||||
where name in ('stage/sql/starting',
|
||||
'stage/sql/init',
|
||||
'stage/sql/checking permissions',
|
||||
'stage/sql/Opening tables',
|
||||
'stage/sql/Closing tables');
|
||||
|
||||
@ -128,7 +137,11 @@ update performance_schema.setup_instruments set enabled='YES', timed='YES'
|
||||
'statement/abstract/new_packet',
|
||||
'statement/abstract/Query',
|
||||
'statement/com/Quit',
|
||||
'statement/com/error');
|
||||
'statement/com/error',
|
||||
'statement/sp/freturn');
|
||||
|
||||
update performance_schema.setup_instruments set enabled='YES', timed='YES'
|
||||
where name in ('transaction');
|
||||
|
||||
# Start from a known clean state, to avoid noise from previous tests
|
||||
flush tables;
|
||||
@ -154,6 +167,13 @@ truncate performance_schema.events_statements_summary_by_host_by_event_name;
|
||||
truncate performance_schema.events_statements_summary_global_by_event_name;
|
||||
truncate performance_schema.events_statements_history_long;
|
||||
|
||||
truncate performance_schema.events_transactions_summary_by_thread_by_event_name;
|
||||
truncate performance_schema.events_transactions_summary_by_account_by_event_name;
|
||||
truncate performance_schema.events_transactions_summary_by_user_by_event_name;
|
||||
truncate performance_schema.events_transactions_summary_by_host_by_event_name;
|
||||
truncate performance_schema.events_transactions_summary_global_by_event_name;
|
||||
truncate performance_schema.events_transactions_history_long;
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists dump_thread;
|
||||
drop procedure if exists dump_one_thread;
|
||||
@ -180,7 +200,8 @@ begin
|
||||
if (my_thread_id is not null) then
|
||||
select username, event_name, count_star
|
||||
from performance_schema.events_waits_summary_by_thread_by_event_name
|
||||
where event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
|
||||
where event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
|
||||
'wait/synch/mutex/sql/LOCK_uuid_generator',
|
||||
'wait/synch/rwlock/sql/LOCK_grant',
|
||||
'wait/io/file/sql/query_log')
|
||||
and thread_id = my_thread_id
|
||||
@ -197,7 +218,8 @@ prepare dump_waits_account from
|
||||
"select user, host, event_name, count_star
|
||||
from performance_schema.events_waits_summary_by_account_by_event_name
|
||||
where user like \'user%\'
|
||||
and event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
|
||||
and event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
|
||||
'wait/synch/mutex/sql/LOCK_uuid_generator',
|
||||
'wait/synch/rwlock/sql/LOCK_grant',
|
||||
'wait/io/file/sql/query_log')
|
||||
order by user, host, event_name;";
|
||||
@ -206,7 +228,8 @@ prepare dump_waits_user from
|
||||
"select user, event_name, count_star
|
||||
from performance_schema.events_waits_summary_by_user_by_event_name
|
||||
where user like \'user%\'
|
||||
and event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
|
||||
and event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
|
||||
'wait/synch/mutex/sql/LOCK_uuid_generator',
|
||||
'wait/synch/rwlock/sql/LOCK_grant',
|
||||
'wait/io/file/sql/query_log')
|
||||
order by user, event_name;";
|
||||
@ -215,7 +238,8 @@ prepare dump_waits_host from
|
||||
"select host, event_name, count_star
|
||||
from performance_schema.events_waits_summary_by_host_by_event_name
|
||||
where host=\'localhost\'
|
||||
and event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
|
||||
and event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
|
||||
'wait/synch/mutex/sql/LOCK_uuid_generator',
|
||||
'wait/synch/rwlock/sql/LOCK_grant',
|
||||
'wait/io/file/sql/query_log')
|
||||
order by host, event_name;";
|
||||
@ -223,7 +247,8 @@ prepare dump_waits_host from
|
||||
prepare dump_waits_global from
|
||||
"select event_name, count_star
|
||||
from performance_schema.events_waits_summary_global_by_event_name
|
||||
where event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
|
||||
where event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
|
||||
'wait/synch/mutex/sql/LOCK_uuid_generator',
|
||||
'wait/synch/rwlock/sql/LOCK_grant',
|
||||
'wait/io/file/sql/query_log')
|
||||
order by event_name;";
|
||||
@ -231,7 +256,8 @@ prepare dump_waits_global from
|
||||
prepare dump_waits_history from
|
||||
"select event_name, count(event_name)
|
||||
from performance_schema.events_waits_history_long
|
||||
where event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
|
||||
where event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
|
||||
'wait/synch/mutex/sql/LOCK_uuid_generator',
|
||||
'wait/synch/rwlock/sql/LOCK_grant',
|
||||
'wait/io/file/sql/query_log')
|
||||
group by event_name order by event_name;";
|
||||
@ -240,7 +266,8 @@ prepare dump_stages_account from
|
||||
"select user, host, event_name, count_star
|
||||
from performance_schema.events_stages_summary_by_account_by_event_name
|
||||
where user like \'user%\'
|
||||
and event_name in ('stage/sql/init', 'stage/sql/Init for update',
|
||||
and event_name in ('stage/sql/starting',
|
||||
'stage/sql/init',
|
||||
'stage/sql/checking permissions',
|
||||
'stage/sql/Opening tables',
|
||||
'stage/sql/closing tables')
|
||||
@ -250,7 +277,8 @@ prepare dump_stages_user from
|
||||
"select user, event_name, count_star
|
||||
from performance_schema.events_stages_summary_by_user_by_event_name
|
||||
where user like \'user%\'
|
||||
and event_name in ('stage/sql/init', 'stage/sql/Init for update',
|
||||
and event_name in ('stage/sql/starting',
|
||||
'stage/sql/init',
|
||||
'stage/sql/checking permissions',
|
||||
'stage/sql/Opening tables',
|
||||
'stage/sql/closing tables')
|
||||
@ -260,7 +288,8 @@ prepare dump_stages_host from
|
||||
"select host, event_name, count_star
|
||||
from performance_schema.events_stages_summary_by_host_by_event_name
|
||||
where host=\'localhost\'
|
||||
and event_name in ('stage/sql/init', 'stage/sql/Init for update',
|
||||
and event_name in ('stage/sql/starting',
|
||||
'stage/sql/init',
|
||||
'stage/sql/checking permissions',
|
||||
'stage/sql/Opening tables',
|
||||
'stage/sql/closing tables')
|
||||
@ -269,7 +298,8 @@ prepare dump_stages_host from
|
||||
prepare dump_stages_global from
|
||||
"select event_name, count_star
|
||||
from performance_schema.events_stages_summary_global_by_event_name
|
||||
where event_name in ('stage/sql/init', 'stage/sql/Init for update',
|
||||
where event_name in ('stage/sql/starting',
|
||||
'stage/sql/init',
|
||||
'stage/sql/checking permissions',
|
||||
'stage/sql/Opening tables',
|
||||
'stage/sql/closing tables')
|
||||
@ -278,7 +308,8 @@ prepare dump_stages_global from
|
||||
prepare dump_stages_history from
|
||||
"select event_name, count(event_name)
|
||||
from performance_schema.events_stages_history_long
|
||||
where event_name in ('stage/sql/init', 'stage/sql/Init for update',
|
||||
where event_name in ('stage/sql/starting',
|
||||
'stage/sql/init',
|
||||
'stage/sql/checking permissions',
|
||||
'stage/sql/Opening tables',
|
||||
'stage/sql/closing tables')
|
||||
@ -291,7 +322,8 @@ prepare dump_statements_account from
|
||||
and event_name in ('statement/sql/select',
|
||||
'statement/sql/insert',
|
||||
'statement/com/Quit',
|
||||
'statement/com/error')
|
||||
'statement/com/error',
|
||||
'statement/sp/freturn')
|
||||
order by user, host, event_name;";
|
||||
|
||||
prepare dump_statements_user from
|
||||
@ -301,7 +333,8 @@ prepare dump_statements_user from
|
||||
and event_name in ('statement/sql/select',
|
||||
'statement/sql/insert',
|
||||
'statement/com/Quit',
|
||||
'statement/com/error')
|
||||
'statement/com/error',
|
||||
'statement/sp/freturn')
|
||||
order by user, event_name;";
|
||||
|
||||
prepare dump_statements_host from
|
||||
@ -311,7 +344,8 @@ prepare dump_statements_host from
|
||||
and event_name in ('statement/sql/select',
|
||||
'statement/sql/insert',
|
||||
'statement/com/Quit',
|
||||
'statement/com/error')
|
||||
'statement/com/error',
|
||||
'statement/sp/freturn')
|
||||
order by host, event_name;";
|
||||
|
||||
prepare dump_statements_global from
|
||||
@ -320,7 +354,8 @@ prepare dump_statements_global from
|
||||
where event_name in ('statement/sql/select',
|
||||
'statement/sql/insert',
|
||||
'statement/com/Quit',
|
||||
'statement/com/error')
|
||||
'statement/com/error',
|
||||
'statement/sp/freturn')
|
||||
order by event_name;";
|
||||
|
||||
prepare dump_statements_history from
|
||||
@ -329,7 +364,41 @@ prepare dump_statements_history from
|
||||
where event_name in ('statement/sql/select',
|
||||
'statement/sql/insert',
|
||||
'statement/com/Quit',
|
||||
'statement/com/error')
|
||||
'statement/com/error',
|
||||
'statement/sp/freturn')
|
||||
group by event_name order by event_name;";
|
||||
|
||||
prepare dump_transactions_account from
|
||||
"select user, host, event_name, count_star
|
||||
from performance_schema.events_transactions_summary_by_account_by_event_name
|
||||
where user like \'user%\'
|
||||
and event_name in ('transaction')
|
||||
order by user, host, event_name;";
|
||||
|
||||
prepare dump_transactions_user from
|
||||
"select user, event_name, count_star
|
||||
from performance_schema.events_transactions_summary_by_user_by_event_name
|
||||
where user like \'user%\'
|
||||
and event_name in ('transaction')
|
||||
order by user, event_name;";
|
||||
|
||||
prepare dump_transactions_host from
|
||||
"select host, event_name, count_star
|
||||
from performance_schema.events_transactions_summary_by_host_by_event_name
|
||||
where host=\'localhost\'
|
||||
and event_name in ('transaction')
|
||||
order by host, event_name;";
|
||||
|
||||
prepare dump_transactions_global from
|
||||
"select event_name, count_star
|
||||
from performance_schema.events_transactions_summary_global_by_event_name
|
||||
where event_name in ('transaction')
|
||||
order by event_name;";
|
||||
|
||||
prepare dump_transactions_history from
|
||||
"select event_name, count(event_name)
|
||||
from performance_schema.events_transactions_history_long
|
||||
where event_name in ('transaction')
|
||||
group by event_name order by event_name;";
|
||||
|
||||
prepare dump_users from
|
||||
|
@ -0,0 +1,45 @@
|
||||
# Tests for the performance schema
|
||||
|
||||
# ===========================================
|
||||
# HELPER include/memory_aggregate_cleanup.inc
|
||||
# ===========================================
|
||||
|
||||
--disable_query_log
|
||||
revoke all privileges, grant option from user1@localhost;
|
||||
revoke all privileges, grant option from user2@localhost;
|
||||
revoke all privileges, grant option from user3@localhost;
|
||||
revoke all privileges, grant option from user4@localhost;
|
||||
drop user user1@localhost;
|
||||
drop user user2@localhost;
|
||||
drop user user3@localhost;
|
||||
drop user user4@localhost;
|
||||
flush privileges;
|
||||
|
||||
drop procedure dump_thread;
|
||||
drop procedure dump_one_thread;
|
||||
|
||||
drop prepare dump_memory_account;
|
||||
drop prepare dump_memory_user;
|
||||
drop prepare dump_memory_host;
|
||||
drop prepare dump_memory_global;
|
||||
|
||||
drop prepare dump_users;
|
||||
drop prepare dump_hosts;
|
||||
drop prepare dump_accounts;
|
||||
|
||||
truncate table performance_schema.accounts;
|
||||
truncate table performance_schema.users;
|
||||
truncate table performance_schema.hosts;
|
||||
|
||||
truncate table performance_schema.setup_actors;
|
||||
insert into performance_schema.setup_actors
|
||||
select * from test.setup_actors;
|
||||
drop table test.setup_actors;
|
||||
|
||||
set global query_cache_size=0;
|
||||
|
||||
update performance_schema.threads set instrumented='YES';
|
||||
update performance_schema.setup_instruments set enabled='YES', timed='YES';
|
||||
|
||||
--enable_query_log
|
||||
|
506
mysql-test/suite/perfschema/include/memory_aggregate_load.inc
Normal file
506
mysql-test/suite/perfschema/include/memory_aggregate_load.inc
Normal file
@ -0,0 +1,506 @@
|
||||
# Tests for the performance schema
|
||||
|
||||
# ========================================
|
||||
# HELPER include/memory_aggregate_load.inc
|
||||
# ========================================
|
||||
|
||||
echo "================== Step 1 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
# Notes about this test
|
||||
#
|
||||
# get_lock("marker") causes the following memory allocation:
|
||||
# memory/sql/User_level_lock, 1 malloc, size 16 (size 8 for 32-bit systems).
|
||||
# release_lock("marker") causes the following memory free:
|
||||
# memory/sql/User_level_lock, 1 free, size 16 (size 8 for 32-bit systems).
|
||||
#
|
||||
# To avoid noise from main, the background threads are disabled.
|
||||
|
||||
connect (con1, localhost, user1, , );
|
||||
|
||||
echo "================== con1 connected ==================";
|
||||
|
||||
--connection default
|
||||
|
||||
# Wait for the connect to complete
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from performance_schema.threads
|
||||
where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user1';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
echo "================== Step 2 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--connection con1
|
||||
|
||||
set GLOBAL query_cache_size=1000*1024;
|
||||
select get_lock("marker_1", 10);
|
||||
select release_lock("marker_1");
|
||||
set @v1 = repeat("a", 1000);
|
||||
set @v2 = repeat("b", 2000);
|
||||
set @v3 = repeat("c", 4000);
|
||||
|
||||
echo "================== con1 marker ==================";
|
||||
|
||||
--connection default
|
||||
|
||||
# Wait for the payload to complete
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from performance_schema.events_waits_current
|
||||
where EVENT_NAME= 'idle';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
echo "================== Step 3 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
# Debugging helpers
|
||||
# select * from performance_schema.events_waits_history_long;
|
||||
# select PROCESSLIST_USER, PROCESSLIST_HOST, INSTRUMENTED from performance_schema.threads;
|
||||
|
||||
connect (con2, localhost, user2, , );
|
||||
|
||||
echo "================== con2 connected ==================";
|
||||
|
||||
--connection default
|
||||
|
||||
# Wait for the connect to complete
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from performance_schema.threads
|
||||
where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user2';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
echo "================== Step 4 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--connection con2
|
||||
|
||||
set GLOBAL query_cache_size=2000*1024;
|
||||
select get_lock("marker_2", 10);
|
||||
select release_lock("marker_2");
|
||||
set @v1 = repeat("a", 1000);
|
||||
set @v2 = repeat("b", 2000);
|
||||
set @v3 = repeat("c", 4000);
|
||||
|
||||
echo "================== con2 marker ==================";
|
||||
|
||||
--connection default
|
||||
|
||||
# Wait for the payload to complete
|
||||
let $wait_condition=
|
||||
select count(*) = 2 from performance_schema.events_waits_current
|
||||
where EVENT_NAME= 'idle';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
echo "================== Step 5 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate table performance_schema.memory_summary_by_thread_by_event_name;
|
||||
|
||||
echo "================== MEMORY_BY_THREAD truncated ==================";
|
||||
|
||||
echo "================== Step 5b ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
connect (con3, localhost, user3, , );
|
||||
|
||||
echo "================== con3 connected ==================";
|
||||
|
||||
--connection default
|
||||
|
||||
# Wait for the connect to complete
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from performance_schema.threads
|
||||
where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user3';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
echo "================== Step 6 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--connection con3
|
||||
|
||||
set GLOBAL query_cache_size=500*1024;
|
||||
select get_lock("marker_3", 10);
|
||||
select release_lock("marker_3");
|
||||
set @v1 = repeat("a", 1000);
|
||||
set @v2 = repeat("b", 2000);
|
||||
set @v3 = repeat("c", 4000);
|
||||
|
||||
echo "================== con3 marker ==================";
|
||||
|
||||
--connection default
|
||||
|
||||
# Wait for the payload to complete
|
||||
let $wait_condition=
|
||||
select count(*) = 3 from performance_schema.events_waits_current
|
||||
where EVENT_NAME= 'idle';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
echo "================== Step 7 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
connect (con4, localhost, user4, , );
|
||||
connect (con5, localhost, user4, , );
|
||||
|
||||
echo "================== con4/con5 (both user4) connected ==================";
|
||||
|
||||
--connection default
|
||||
|
||||
# Wait for the connects to complete
|
||||
let $wait_condition=
|
||||
select count(*) = 2 from performance_schema.threads
|
||||
where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user4';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
echo "================== Step 8 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--connection con4
|
||||
|
||||
set GLOBAL query_cache_size=4000*1024;
|
||||
select get_lock("marker_4", 10);
|
||||
select release_lock("marker_4");
|
||||
set @v1 = repeat("a", 1000);
|
||||
set @v2 = repeat("b", 2000);
|
||||
set @v3 = repeat("c", 4000);
|
||||
|
||||
--connection con5
|
||||
select get_lock("marker_5", 10);
|
||||
select release_lock("marker_5");
|
||||
set @v1 = repeat("a", 1000);
|
||||
set @v2 = repeat("b", 2000);
|
||||
set @v3 = repeat("c", 4000);
|
||||
|
||||
echo "================== con4/con5 marker ==================";
|
||||
|
||||
--connection default
|
||||
|
||||
# Wait for the payload to complete
|
||||
let $wait_condition=
|
||||
select count(*) = 5 from performance_schema.events_waits_current
|
||||
where EVENT_NAME= 'idle';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
echo "================== Step 9 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--disconnect con1
|
||||
--disconnect con5
|
||||
|
||||
--connection default
|
||||
|
||||
# Wait for the disconnects to complete
|
||||
let $wait_condition=
|
||||
select count(*) = 0 from performance_schema.threads
|
||||
where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user1';
|
||||
--source include/wait_condition.inc
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from performance_schema.threads
|
||||
where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user4';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
echo "================== con1/con5 disconnected ==================";
|
||||
|
||||
echo "================== Step 10 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--disconnect con2
|
||||
|
||||
--connection default
|
||||
|
||||
# Wait for the disconnect to complete
|
||||
let $wait_condition=
|
||||
select count(*) = 0 from performance_schema.threads
|
||||
where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user2';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
echo "================== con2 disconnected ==================";
|
||||
|
||||
echo "================== Step 11 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--disconnect con3
|
||||
|
||||
--connection default
|
||||
|
||||
# Wait for the disconnect to complete
|
||||
let $wait_condition=
|
||||
select count(*) = 0 from performance_schema.threads
|
||||
where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user3';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
echo "================== con3 disconnected ==================";
|
||||
|
||||
echo "================== Step 12 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--disconnect con4
|
||||
|
||||
--connection default
|
||||
|
||||
# Wait for the disconnect to complete
|
||||
let $wait_condition=
|
||||
select count(*) = 0 from performance_schema.threads
|
||||
where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user4';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
echo "================== con4 disconnected ==================";
|
||||
|
||||
echo "================== Step 13 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
--connection default
|
||||
|
||||
truncate performance_schema.memory_summary_by_thread_by_event_name;
|
||||
|
||||
echo "================== MEMORY_BY_THREAD truncated ==================";
|
||||
|
||||
echo "================== Step 14 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.memory_summary_by_account_by_event_name;
|
||||
|
||||
echo "================== MEMORY_BY_ACCOUNT truncated ==================";
|
||||
|
||||
echo "================== Step 15 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.memory_summary_by_user_by_event_name;
|
||||
|
||||
echo "================== MEMORY_BY_USER truncated ==================";
|
||||
|
||||
echo "================== Step 16 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.memory_summary_by_host_by_event_name;
|
||||
|
||||
echo "================== MEMORY_BY_HOST truncated ==================";
|
||||
|
||||
echo "================== Step 17 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.memory_summary_global_by_event_name;
|
||||
|
||||
echo "================== MEMORY_GLOBAL truncated ==================";
|
||||
|
||||
echo "================== Step 18 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.accounts;
|
||||
|
||||
echo "================== ACCOUNTS truncated ==================";
|
||||
|
||||
echo "================== Step 19 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.users;
|
||||
|
||||
echo "================== USERS truncated ==================";
|
||||
|
||||
echo "================== Step 20 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
||||
truncate performance_schema.hosts;
|
||||
|
||||
echo "================== HOSTS truncated ==================";
|
||||
|
||||
echo "================== Step 21 ==================";
|
||||
--vertical_results
|
||||
call dump_thread();
|
||||
execute dump_memory_account;
|
||||
execute dump_memory_user;
|
||||
execute dump_memory_host;
|
||||
execute dump_memory_global;
|
||||
--horizontal_results
|
||||
execute dump_accounts;
|
||||
execute dump_users;
|
||||
execute dump_hosts;
|
||||
|
207
mysql-test/suite/perfschema/include/memory_aggregate_setup.inc
Normal file
207
mysql-test/suite/perfschema/include/memory_aggregate_setup.inc
Normal file
@ -0,0 +1,207 @@
|
||||
# Tests for the performance schema
|
||||
|
||||
# =============
|
||||
# DOCUMENTATION
|
||||
# =============
|
||||
|
||||
# Verify how memory stats are aggregated into various tables
|
||||
#
|
||||
# In the thread dimension:
|
||||
# - memory_summary_by_thread_by_event_name
|
||||
# - memory_summary_by_account_by_event_name
|
||||
# - memory_summary_by_user_by_event_name
|
||||
# - memory_summary_by_host_by_event_name
|
||||
#
|
||||
# Globally:
|
||||
# - memory_summary_global_by_event_name
|
||||
#
|
||||
# The tests are written with the following helpers:
|
||||
# - include/memory_aggregate_setup.inc
|
||||
# - include/memory_aggregate_load.inc
|
||||
# - include/memory_aggregate_cleanup.inc
|
||||
#
|
||||
# Helpers are intended to be used as follows.
|
||||
#
|
||||
# A Typical test t/memory_aggregate_xxx.test will consist of:
|
||||
# --source ../include/memory_aggregate_setup.inc
|
||||
# --source ../include/memory_aggregate_load.inc
|
||||
# --source ../include/memory_aggregate_cleanup.inc
|
||||
# and a t/memory_aggregate_xxx-master.opt file
|
||||
#
|
||||
# Naming conventions for t/memory_aggregate_xxx.test are as follows:
|
||||
# t/memory_aggregate_<account><user><host>
|
||||
#
|
||||
# <account> corresponds to different sizing settings for
|
||||
# the variable performance-schema-accounts-size
|
||||
# - (blank): accounts-size sufficient to represent all records
|
||||
# - no_a: accounts-size set to 0
|
||||
#
|
||||
# <user> corresponds to different sizing settings for
|
||||
# the variable performance-schema-users-size
|
||||
# - (blank): users-size sufficient to represent all records
|
||||
# - no_u: users-size set to 0
|
||||
#
|
||||
# <host> corresponds to different sizing settings for
|
||||
# the variable performance-schema-hosts-size
|
||||
# - (blank): hosts-size sufficient to represent all records
|
||||
# - no_h: hosts-size set to 0
|
||||
|
||||
# =========================================
|
||||
# HELPER include/memory_aggregate_setup.inc
|
||||
# =========================================
|
||||
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_perfschema.inc
|
||||
--source include/no_protocol.inc
|
||||
--source ../include/wait_for_pfs_thread_count.inc
|
||||
|
||||
--disable_query_log
|
||||
|
||||
set @orig_sql_mode= @@sql_mode;
|
||||
set sql_mode= (select replace(@@sql_mode,'NO_AUTO_CREATE_USER',''));
|
||||
grant ALL on *.* to user1@localhost;
|
||||
grant ALL on *.* to user2@localhost;
|
||||
grant ALL on *.* to user3@localhost;
|
||||
grant ALL on *.* to user4@localhost;
|
||||
set sql_mode= @orig_sql_mode;
|
||||
|
||||
flush privileges;
|
||||
|
||||
# Purge old users, hosts, user/host from previous tests
|
||||
truncate table performance_schema.accounts;
|
||||
truncate table performance_schema.users;
|
||||
truncate table performance_schema.hosts;
|
||||
|
||||
# Save the setup
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists test.setup_actors;
|
||||
--enable_warnings
|
||||
|
||||
create table test.setup_actors as
|
||||
select * from performance_schema.setup_actors;
|
||||
|
||||
# Only instrument the user connections
|
||||
truncate table performance_schema.setup_actors;
|
||||
insert into performance_schema.setup_actors
|
||||
set host= 'localhost', user= 'user1', role= '%';
|
||||
insert into performance_schema.setup_actors
|
||||
set host= 'localhost', user= 'user2', role= '%';
|
||||
insert into performance_schema.setup_actors
|
||||
set host= 'localhost', user= 'user3', role= '%';
|
||||
insert into performance_schema.setup_actors
|
||||
set host= 'localhost', user= 'user4', role= '%';
|
||||
|
||||
update performance_schema.threads set instrumented='NO';
|
||||
|
||||
# Only instrument a few events of each kind
|
||||
update performance_schema.setup_instruments set enabled='NO', timed='NO';
|
||||
|
||||
update performance_schema.setup_instruments set enabled='YES', timed='YES'
|
||||
where name in ('memory/sql/user_var_entry::value',
|
||||
'memory/sql/User_level_lock',
|
||||
'memory/sql/Query_cache',
|
||||
'idle');
|
||||
|
||||
# Start from a known clean state, to avoid noise from previous tests
|
||||
flush tables;
|
||||
flush status;
|
||||
truncate performance_schema.memory_summary_by_thread_by_event_name;
|
||||
truncate performance_schema.memory_summary_by_account_by_event_name;
|
||||
truncate performance_schema.memory_summary_by_user_by_event_name;
|
||||
truncate performance_schema.memory_summary_by_host_by_event_name;
|
||||
truncate performance_schema.memory_summary_global_by_event_name;
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists dump_thread;
|
||||
drop procedure if exists dump_one_thread;
|
||||
--enable_warnings
|
||||
|
||||
delimiter $$;
|
||||
|
||||
create procedure dump_thread()
|
||||
begin
|
||||
call dump_one_thread('user1');
|
||||
call dump_one_thread('user2');
|
||||
call dump_one_thread('user3');
|
||||
call dump_one_thread('user4');
|
||||
end
|
||||
$$
|
||||
|
||||
create procedure dump_one_thread(in username varchar(64))
|
||||
begin
|
||||
declare my_thread_id int;
|
||||
|
||||
set my_thread_id = (select thread_id from performance_schema.threads
|
||||
where processlist_user=username LIMIT 1);
|
||||
|
||||
if (my_thread_id is not null) then
|
||||
select username,
|
||||
EVENT_NAME, COUNT_ALLOC, COUNT_FREE,
|
||||
SUM_NUMBER_OF_BYTES_ALLOC, SUM_NUMBER_OF_BYTES_FREE,
|
||||
LOW_COUNT_USED, CURRENT_COUNT_USED, HIGH_COUNT_USED,
|
||||
LOW_NUMBER_OF_BYTES_USED, CURRENT_NUMBER_OF_BYTES_USED, HIGH_NUMBER_OF_BYTES_USED
|
||||
from performance_schema.memory_summary_by_thread_by_event_name
|
||||
where event_name in ('memory/sql/user_var_entry::value',
|
||||
'memory/sql/User_level_lock',
|
||||
'memory/sql/Query_cache')
|
||||
and thread_id = my_thread_id
|
||||
order by event_name;
|
||||
else
|
||||
select username, "not found" as status;
|
||||
end if;
|
||||
end
|
||||
$$
|
||||
|
||||
delimiter ;$$
|
||||
|
||||
prepare dump_memory_account from
|
||||
"select *
|
||||
from performance_schema.memory_summary_by_account_by_event_name
|
||||
where user like \'user%\'
|
||||
and event_name in ('memory/sql/user_var_entry::value',
|
||||
'memory/sql/User_level_lock',
|
||||
'memory/sql/Query_cache')
|
||||
order by user, host, event_name;";
|
||||
|
||||
prepare dump_memory_user from
|
||||
"select *
|
||||
from performance_schema.memory_summary_by_user_by_event_name
|
||||
where user like \'user%\'
|
||||
and event_name in ('memory/sql/user_var_entry::value',
|
||||
'memory/sql/User_level_lock',
|
||||
'memory/sql/Query_cache')
|
||||
order by user, event_name;";
|
||||
|
||||
prepare dump_memory_host from
|
||||
"select *
|
||||
from performance_schema.memory_summary_by_host_by_event_name
|
||||
where host=\'localhost\'
|
||||
and event_name in ('memory/sql/user_var_entry::value',
|
||||
'memory/sql/User_level_lock',
|
||||
'memory/sql/Query_cache')
|
||||
order by host, event_name;";
|
||||
|
||||
prepare dump_memory_global from
|
||||
"select *
|
||||
from performance_schema.memory_summary_global_by_event_name
|
||||
where event_name in ('memory/sql/user_var_entry::value',
|
||||
'memory/sql/User_level_lock',
|
||||
'memory/sql/Query_cache')
|
||||
order by event_name;";
|
||||
|
||||
prepare dump_users from
|
||||
"select * from performance_schema.users where user is not null order by user;";
|
||||
|
||||
prepare dump_hosts from
|
||||
"select * from performance_schema.hosts where host is not null order by host;";
|
||||
|
||||
prepare dump_accounts from
|
||||
"select * from performance_schema.accounts where (user is not null) and (host is not null) order by user, host;";
|
||||
|
||||
--enable_query_log
|
||||
|
||||
# Make sure all the instrumentation is present
|
||||
show global status like "performance_schema_memory_classes_lost";
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
#
|
||||
# Deallocates all the prepared statements
|
||||
# created in prepares_stmts_setup.inc
|
||||
#
|
||||
|
||||
DEALLOCATE PREPARE st1;
|
||||
DEALLOCATE PREPARE st2;
|
||||
DEALLOCATE PREPARE st3;
|
||||
DEALLOCATE PREPARE st4;
|
||||
|
||||
DROP TABLE t1;
|
@ -0,0 +1,18 @@
|
||||
#
|
||||
# Execution of all the prepared statements created in
|
||||
# prepared_statements_setup.inc.
|
||||
#
|
||||
|
||||
SET @a = 3;
|
||||
SET @b = 4;
|
||||
EXECUTE st1 USING @a, @b;
|
||||
|
||||
#SET @table = 't1';
|
||||
EXECUTE st2;
|
||||
|
||||
SET @c=3;
|
||||
EXECUTE st3 using @c;
|
||||
|
||||
EXECUTE st4;
|
||||
|
||||
|
20
mysql-test/suite/perfschema/include/prepared_stmts_setup.inc
Normal file
20
mysql-test/suite/perfschema/include/prepared_stmts_setup.inc
Normal file
@ -0,0 +1,20 @@
|
||||
#
|
||||
# Creating various prepared statements.
|
||||
# HELPER include/prepared_stmts_setup.inc
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT NOT NULL);
|
||||
INSERT INTO t1 VALUES (4), (8), (11), (32), (80);
|
||||
|
||||
# Prepared statments
|
||||
|
||||
PREPARE st1 FROM 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse';
|
||||
|
||||
SET @table = 't1';
|
||||
SET @s = CONCAT('SELECT * FROM ', @table);
|
||||
PREPARE st2 FROM @s;
|
||||
|
||||
PREPARE st3 FROM 'INSERT INTO t1 SELECT * FROM t1 WHERE a<=?';
|
||||
|
||||
PREPARE st4 FROM
|
||||
'(SELECT a FROM t1) UNION (SELECT a+10 FROM t1) ORDER BY RAND()*0+a';
|
31
mysql-test/suite/perfschema/include/program_cleanup.inc
Normal file
31
mysql-test/suite/perfschema/include/program_cleanup.inc
Normal file
@ -0,0 +1,31 @@
|
||||
#
|
||||
# clean up of set-up created in
|
||||
# suite/perfschema/include/program_setup.inc
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE SampleProc1;
|
||||
DROP PROCEDURE SampleProc2;
|
||||
DROP PROCEDURE SampleProc3;
|
||||
DROP PROCEDURE SampleProc4;
|
||||
|
||||
DROP FUNCTION wt_avg;
|
||||
DROP FUNCTION fac;
|
||||
DROP FUNCTION append;
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
DROP TRIGGER trg2;
|
||||
DROP TRIGGER trg3;
|
||||
DROP TRIGGER trg4;
|
||||
DROP TRIGGER trg5;
|
||||
|
||||
DROP EVENT IF EXISTS e1;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t4;
|
||||
DROP TABLE table_t;
|
||||
|
||||
DROP DATABASE stored_programs;
|
||||
--enable_warnings
|
54
mysql-test/suite/perfschema/include/program_execution.inc
Normal file
54
mysql-test/suite/perfschema/include/program_execution.inc
Normal file
@ -0,0 +1,54 @@
|
||||
#
|
||||
# Execute the stored programs created in
|
||||
# suite/perfschema/include/program_setup.inc
|
||||
#
|
||||
|
||||
--echo #####################
|
||||
--echo # Executing queries #
|
||||
--echo #####################
|
||||
INSERT INTO t1 VALUES (10,20);
|
||||
CALL SampleProc1(30,40,50);
|
||||
SET @a=1;
|
||||
SELECT @a;
|
||||
CALL SampleProc2("Jwalamukhi",34);
|
||||
SELECT @a;
|
||||
CALL SampleProc3();
|
||||
CALL SampleProc4();
|
||||
SET @change=1;
|
||||
SELECT @change;
|
||||
UPDATE t2 SET id=22 WHERE name="Jwalamukhi";
|
||||
SELECT @change;
|
||||
SET @del=1;
|
||||
SELECT @del;
|
||||
DELETE FROM t1 WHERE i=76;
|
||||
SELECT @del;
|
||||
SELECT wt_avg(1, 12, 1990, 1121990);
|
||||
SELECT fac(5);
|
||||
SELECT append("Bolly", "wood");
|
||||
|
||||
--echo # Event
|
||||
|
||||
SET GLOBAL event_scheduler=ON;
|
||||
|
||||
CREATE TABLE table_t(a INT);
|
||||
DELIMITER |;
|
||||
CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND DO
|
||||
BEGIN
|
||||
INSERT INTO table_t VALUES(1);
|
||||
END|
|
||||
DELIMITER ;|
|
||||
|
||||
# Let e1 insert 1 record into the table table_t
|
||||
|
||||
--let $wait_condition= select count(*) = 1 from table_t
|
||||
--source include/wait_condition.inc
|
||||
SELECT * FROM table_t;
|
||||
|
||||
# Wait till the above one execution of event is instrumented.
|
||||
|
||||
--let $wait_condition= select count(*) = 1 from performance_schema.events_statements_history_long where object_type='EVENT'
|
||||
--source include/wait_condition.inc
|
||||
|
||||
SET GLOBAL event_scheduler=OFF;
|
||||
--source include/no_running_event_scheduler.inc
|
||||
|
@ -0,0 +1,21 @@
|
||||
#
|
||||
# clean up if set-up created in
|
||||
# suite/perfschema/include/program_nested_setup.inc
|
||||
#
|
||||
|
||||
DROP PROCEDURE c4;
|
||||
DROP PROCEDURE c3;
|
||||
DROP PROCEDURE c2;
|
||||
DROP PROCEDURE c1;
|
||||
DROP PROCEDURE inc;
|
||||
DROP PROCEDURE inc2;
|
||||
DROP PROCEDURE iotest;
|
||||
DROP FUNCTION mul;
|
||||
DROP FUNCTION inc;
|
||||
DROP FUNCTION fac;
|
||||
DROP FUNCTION fun;
|
||||
DROP PROCEDURE ifac;
|
||||
DROP TRIGGER trg;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
DROP DATABASE nested_sp;
|
@ -0,0 +1,22 @@
|
||||
#
|
||||
# Execute the nested stored programs created in
|
||||
# suite/include/perfschema/program_nested_setup.inc
|
||||
#
|
||||
|
||||
--echo #####################
|
||||
--echo # Executing queries #
|
||||
--echo #####################
|
||||
|
||||
CALL c1(42);
|
||||
SELECT * FROM t1;
|
||||
DELETE FROM t1;
|
||||
|
||||
CALL iotest("io1", "io2", 1);
|
||||
SELECT * FROM t1 ORDER BY data DESC;
|
||||
DELETE FROM t1;
|
||||
|
||||
SELECT fun(6,10);
|
||||
|
||||
INSERT INTO t1 VALUES (20,13);
|
||||
|
||||
SELECT * FROM t2;
|
87
mysql-test/suite/perfschema/include/program_nested_setup.inc
Normal file
87
mysql-test/suite/perfschema/include/program_nested_setup.inc
Normal file
@ -0,0 +1,87 @@
|
||||
#
|
||||
# SET-UP - Creation of various nested stored programs
|
||||
#
|
||||
|
||||
--source include/no_protocol.inc
|
||||
|
||||
--echo # SET-UP
|
||||
CREATE DATABASE nested_sp;
|
||||
USE nested_sp;
|
||||
|
||||
CREATE TABLE t1(
|
||||
id CHAR(16) NOT NULL DEFAULT '',
|
||||
data INT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE t2(
|
||||
n INT UNSIGNED NOT NULL,
|
||||
f BIGINT UNSIGNED
|
||||
);
|
||||
|
||||
--echo ############################
|
||||
--echo # Creating Stored Programs #
|
||||
--echo ############################
|
||||
DELIMITER |;
|
||||
|
||||
# Nested Stored Procedure - 1
|
||||
CREATE PROCEDURE c1(x INT)
|
||||
CALL c2("c", x)|
|
||||
CREATE PROCEDURE c2(s CHAR(16), x INT)
|
||||
CALL c3(x, s)|
|
||||
CREATE PROCEDURE c3(x INT, s CHAR(16))
|
||||
CALL c4("level", x, s)|
|
||||
CREATE PROCEDURE c4(l CHAR(8), x INT, s CHAR(16))
|
||||
INSERT INTO t1 VALUES (concat(l,s), x)|
|
||||
|
||||
# Nested Stored Procedure - 2
|
||||
CREATE PROCEDURE iotest(x1 CHAR(16), x2 CHAR(16), y INT)
|
||||
BEGIN
|
||||
CALL inc2(x2, y);
|
||||
INSERT INTO t1 VALUES (x1, y);
|
||||
END|
|
||||
CREATE PROCEDURE inc2(x CHAR(16), y INT)
|
||||
BEGIN
|
||||
CALL inc(y);
|
||||
INSERT INTO t1 VALUES (x, y);
|
||||
END|
|
||||
CREATE PROCEDURE inc(inout io INT)
|
||||
SET io = io + 1|
|
||||
|
||||
# Nested Stored Function
|
||||
CREATE FUNCTION mul(x INT, y INT) RETURNS INT
|
||||
RETURN x*y|
|
||||
CREATE FUNCTION inc(i INT) RETURNS INT
|
||||
RETURN i+1|
|
||||
CREATE FUNCTION fac(n INT UNSIGNED) RETURNS BIGINT UNSIGNED
|
||||
BEGIN
|
||||
DECLARE f BIGINT UNSIGNED DEFAULT 1;
|
||||
WHILE n > 1 DO
|
||||
SET f = f * n;
|
||||
SET n = n - 1;
|
||||
END WHILE;
|
||||
RETURN f;
|
||||
END|
|
||||
CREATE FUNCTION fun(i INT, u INT UNSIGNED) RETURNS DOUBLE
|
||||
RETURN mul(inc(i), fac(u))|
|
||||
#
|
||||
# A nested stored program
|
||||
#
|
||||
CREATE PROCEDURE ifac(n INT UNSIGNED)
|
||||
BEGIN
|
||||
DECLARE i BIGINT UNSIGNED DEFAULT 1;
|
||||
|
||||
IF n > 20 THEN
|
||||
SET n = 20; # bigint overflow otherwise
|
||||
END IF;
|
||||
WHILE i <= n DO
|
||||
BEGIN
|
||||
INSERT INTO t2 VALUES (i, fac(i));
|
||||
SET i = i + 1;
|
||||
END;
|
||||
END WHILE;
|
||||
END|
|
||||
CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW
|
||||
CALL ifac(10)|
|
||||
|
||||
DELIMITER ;|
|
||||
|
135
mysql-test/suite/perfschema/include/program_setup.inc
Normal file
135
mysql-test/suite/perfschema/include/program_setup.inc
Normal file
@ -0,0 +1,135 @@
|
||||
#
|
||||
# SET-UP - Creation of various non-nested stored programs
|
||||
#
|
||||
|
||||
--source include/no_protocol.inc
|
||||
|
||||
--echo # SET-UP
|
||||
|
||||
CREATE DATABASE stored_programs;
|
||||
USE stored_programs;
|
||||
|
||||
CREATE TABLE t1(
|
||||
i INT NOT NULL,
|
||||
j INT
|
||||
);
|
||||
|
||||
CREATE TABLE t2(
|
||||
name CHAR(16) NOT NULL DEFAULT '',
|
||||
id INT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE t3(
|
||||
d DATE,
|
||||
n INT,
|
||||
f DOUBLE,
|
||||
s VARCHAR(32)
|
||||
);
|
||||
|
||||
CREATE TABLE t4(
|
||||
`k` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`word` varchar(100) NOT NULL,
|
||||
`mean` varchar(300) NOT NULL,
|
||||
PRIMARY KEY (`k`)
|
||||
);
|
||||
|
||||
|
||||
--echo ############################
|
||||
--echo # Creating Stored Programs #
|
||||
--echo ############################
|
||||
|
||||
--echo # Stored Routine ( Procedure & Function )
|
||||
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE SampleProc1(x1 INT, x2 INT, y INT)
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (x1, y);
|
||||
INSERT INTO t1 VALUES (x2, y);
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE SampleProc2(x CHAR(16), y INT)
|
||||
BEGIN
|
||||
DECLARE z1, z2 INT;
|
||||
SET z1 = y;
|
||||
SET z2 = z1+2;
|
||||
INSERT INTO t2 VALUES (x, z2);
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE SampleProc3()
|
||||
BEGIN
|
||||
DECLARE ld DATE;
|
||||
DECLARE li INT;
|
||||
DECLARE lf DOUBLE;
|
||||
DECLARE ls VARCHAR(32);
|
||||
|
||||
SET ld = NULL, li = NULL, lf = NULL, ls = NULL;
|
||||
INSERT INTO t3 VALUES (ld, li, lf, ls);
|
||||
|
||||
INSERT INTO t3 (n, f, s) VALUES ((ld IS NULL), 1, "ld is null"),
|
||||
((li IS NULL), 1, "li is null"),
|
||||
((li = 0), NULL, "li = 0"),
|
||||
((lf IS NULL), 1, "lf is null"),
|
||||
((lf = 0), NULL, "lf = 0"),
|
||||
((ls IS NULL), 1, "ls is null");
|
||||
END|
|
||||
|
||||
|
||||
CREATE PROCEDURE SampleProc4()
|
||||
BEGIN
|
||||
DECLARE x INT;
|
||||
SET x = 1;
|
||||
WHILE x <= 2 DO
|
||||
INSERT INTO t4(word, mean) VALUES('a','a mean');
|
||||
SET x = x + 1;
|
||||
END WHILE;
|
||||
END|
|
||||
|
||||
CREATE FUNCTION append(s1 CHAR(8), s2 CHAR(8)) RETURNS CHAR(16)
|
||||
RETURN concat(s1, s2)|
|
||||
|
||||
CREATE FUNCTION wt_avg(n1 INT, n2 INT, n3 INT, n4 INT)
|
||||
RETURNS INT
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
DECLARE avg INT;
|
||||
SET avg = (n1+n2+n3*2+n4*4)/8;
|
||||
RETURN avg;
|
||||
END|
|
||||
|
||||
CREATE FUNCTION fac(n INT UNSIGNED) RETURNS BIGINT UNSIGNED
|
||||
BEGIN
|
||||
DECLARE f BIGINT UNSIGNED DEFAULT 1;
|
||||
WHILE n > 1 DO
|
||||
SET f = f * n;
|
||||
SET n = n - 1;
|
||||
END WHILE;
|
||||
RETURN f;
|
||||
END|
|
||||
|
||||
--echo # Triggers
|
||||
|
||||
# INSERT triggers
|
||||
CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
|
||||
BEGIN
|
||||
if isnull(new.j) then
|
||||
SET new.j:= new.i * 10;
|
||||
END if;
|
||||
END|
|
||||
|
||||
CREATE TRIGGER trg2 AFTER INSERT ON t2 FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE t1 SET i=new.id+i ;
|
||||
END|
|
||||
|
||||
# UPDATE trigger
|
||||
CREATE TRIGGER trg3 AFTER UPDATE ON t2 FOR EACH ROW
|
||||
SET @change:= @change + new.id - old.id|
|
||||
|
||||
# DELETE triggers
|
||||
CREATE TRIGGER trg4 BEFORE DELETE ON t1 FOR EACH ROW
|
||||
SET @del:= @del + 1|
|
||||
|
||||
CREATE TRIGGER trg5 AFTER DELETE ON t1 FOR EACH ROW
|
||||
SET @del:= @del + 8 + old.j|
|
||||
|
||||
DELIMITER ;|
|
@ -0,0 +1,20 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Auxiliary file used by transaction_gtid.test
|
||||
#
|
||||
# Invoked between transactions in order to reset the state:
|
||||
# - set GTID_NEXT to AUTOMATIC since this is required after
|
||||
# any transaction that has GTID_NEXT=UUID:NUMBER
|
||||
# - RESET MASTER in order to clear @@global.gtid_executed, so
|
||||
# that the same GTID can be executed again.
|
||||
# - truncate the performance_schema.events_transaction_* tables
|
||||
#
|
||||
# All this is done on the connection 'server_1'.
|
||||
|
||||
--disable_query_log
|
||||
--connection server_1
|
||||
RESET MASTER;
|
||||
TRUNCATE TABLE performance_schema.events_transactions_history;
|
||||
TRUNCATE TABLE performance_schema.events_transactions_current;
|
||||
--enable_query_log
|
||||
--connection default
|
@ -27,6 +27,14 @@ show create table events_statements_summary_by_thread_by_event_name;
|
||||
show create table events_statements_summary_by_user_by_event_name;
|
||||
show create table events_statements_summary_by_account_by_event_name;
|
||||
show create table events_statements_summary_global_by_event_name;
|
||||
show create table events_transactions_current;
|
||||
show create table events_transactions_history;
|
||||
show create table events_transactions_history_long;
|
||||
show create table events_transactions_summary_by_host_by_event_name;
|
||||
show create table events_transactions_summary_by_thread_by_event_name;
|
||||
show create table events_transactions_summary_by_user_by_event_name;
|
||||
show create table events_transactions_summary_by_account_by_event_name;
|
||||
show create table events_transactions_summary_global_by_event_name;
|
||||
show create table events_waits_current;
|
||||
show create table events_waits_history;
|
||||
show create table events_waits_history_long;
|
||||
@ -36,6 +44,12 @@ show create table events_waits_summary_by_thread_by_event_name;
|
||||
show create table events_waits_summary_by_user_by_event_name;
|
||||
show create table events_waits_summary_by_account_by_event_name;
|
||||
show create table events_waits_summary_global_by_event_name;
|
||||
show create table memory_summary_by_host_by_event_name;
|
||||
show create table memory_summary_by_thread_by_event_name;
|
||||
show create table memory_summary_by_user_by_event_name;
|
||||
show create table memory_summary_by_account_by_event_name;
|
||||
show create table memory_summary_global_by_event_name;
|
||||
show create table metadata_locks;
|
||||
show create table file_instances;
|
||||
show create table file_summary_by_event_name;
|
||||
show create table file_summary_by_instance;
|
||||
@ -53,6 +67,7 @@ show create table setup_timers;
|
||||
show create table socket_instances;
|
||||
show create table socket_summary_by_instance;
|
||||
show create table socket_summary_by_event_name;
|
||||
show create table table_handles;
|
||||
show create table table_io_waits_summary_by_index_usage;
|
||||
show create table table_io_waits_summary_by_table;
|
||||
show create table table_lock_waits_summary_by_table;
|
||||
|
125
mysql-test/suite/perfschema/include/show_aggregate.inc
Normal file
125
mysql-test/suite/perfschema/include/show_aggregate.inc
Normal file
@ -0,0 +1,125 @@
|
||||
############### suite/perfschema/include/show_aggregate.inc ####################
|
||||
# #
|
||||
# Gather status by thread, by user, by host, by account and global. #
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
--echo #=================
|
||||
--echo # Global results
|
||||
--echo #=================
|
||||
USE test;
|
||||
UPDATE test.status_results sr, performance_schema.global_status sg
|
||||
SET sr.stop = sg.variable_value
|
||||
WHERE sr.variable_name = sg.variable_name
|
||||
AND sg.variable_name IN ('handler_delete', 'handler_rollback');
|
||||
--echo
|
||||
--echo # Global deltas: END - START.
|
||||
UPDATE test.status_results sr
|
||||
SET sr.delta = sr.stop - sr.start;
|
||||
|
||||
#--echo DEBUG
|
||||
#SELECT * FROM test.status_results;
|
||||
#SELECT * from performance_schema.global_status where variable_name in ('handler_delete', 'handler_rollback');
|
||||
|
||||
--echo #=================
|
||||
--echo # Status by thread
|
||||
--echo #=================
|
||||
--echo # Thread results from CON1.
|
||||
UPDATE test.status_results sr, performance_schema.status_by_thread sbt
|
||||
SET sr.t1 = sbt.variable_value
|
||||
WHERE sr.variable_name = sbt.variable_name
|
||||
AND sbt.variable_name IN ('handler_delete', 'handler_rollback')
|
||||
AND sbt.thread_id = @con1_id;
|
||||
--echo
|
||||
--echo # Thread results from CON2.
|
||||
UPDATE test.status_results sr, performance_schema.status_by_thread sbt
|
||||
SET sr.t2 = sbt.variable_value
|
||||
WHERE sr.variable_name = sbt.variable_name
|
||||
AND sbt.variable_name IN ('handler_delete', 'handler_rollback')
|
||||
AND sbt.thread_id = @con2_id;
|
||||
--echo
|
||||
--echo # Thread results from CON3.
|
||||
UPDATE test.status_results sr, performance_schema.status_by_thread sbt
|
||||
SET sr.t3 = sbt.variable_value
|
||||
WHERE sr.variable_name = sbt.variable_name
|
||||
AND sbt.variable_name IN ('handler_delete', 'handler_rollback')
|
||||
AND sbt.thread_id = @con3_id;
|
||||
--echo
|
||||
--echo # Thread totals for 3 connections.
|
||||
UPDATE test.status_results sr
|
||||
SET sr.thread = sr.t1 + sr.t2 + sr.t3;
|
||||
|
||||
--echo #=================
|
||||
--echo # Status by user
|
||||
--echo #=================
|
||||
--echo # User1
|
||||
UPDATE test.status_results sr, performance_schema.status_by_user sbu
|
||||
SET sr.u1 = sbu.variable_value
|
||||
WHERE sr.variable_name = sbu.variable_name
|
||||
AND sbu.variable_name IN ('handler_delete', 'handler_rollback')
|
||||
AND sbu.user IN ('user1');
|
||||
--echo
|
||||
--echo # User2
|
||||
UPDATE test.status_results sr, performance_schema.status_by_user sbu
|
||||
SET sr.u2 = sbu.variable_value
|
||||
WHERE sr.variable_name = sbu.variable_name
|
||||
AND sbu.variable_name IN ('handler_delete', 'handler_rollback')
|
||||
AND sbu.user IN ('user2');
|
||||
--echo
|
||||
--echo # User3
|
||||
UPDATE test.status_results sr, performance_schema.status_by_user sbu
|
||||
SET sr.u3 = sbu.variable_value
|
||||
WHERE sr.variable_name = sbu.variable_name
|
||||
AND sbu.variable_name IN ('handler_delete', 'handler_rollback')
|
||||
AND sbu.user IN ('user3');
|
||||
--echo
|
||||
--echo # Status totals for 3 users.
|
||||
UPDATE test.status_results sr
|
||||
SET sr.user = sr.u1 + sr.u2 + sr.u3;
|
||||
|
||||
--echo #===========================
|
||||
--echo # Status by host (localhost)
|
||||
--echo #===========================
|
||||
--echo
|
||||
--echo # host1 = localhost
|
||||
UPDATE test.status_results sr, performance_schema.status_by_host sbh
|
||||
SET sr.h1 = sbh.variable_value
|
||||
WHERE sr.variable_name = sbh.variable_name
|
||||
AND sbh.variable_name IN ('handler_delete', 'handler_rollback')
|
||||
AND sbh.host IN ('localhost');
|
||||
--echo
|
||||
--echo # Status totals for 'localhost' only.
|
||||
UPDATE test.status_results sr
|
||||
SET sr.host = sr.h1 + sr.h2 + sr.h3;
|
||||
|
||||
--echo #==================
|
||||
--echo # Status by account
|
||||
--echo #==================
|
||||
--echo # User1@localhost
|
||||
UPDATE test.status_results sr, performance_schema.status_by_account sba
|
||||
SET sr.a1 = sba.variable_value
|
||||
WHERE sr.variable_name = sba.variable_name
|
||||
AND sba.variable_name IN ('handler_delete', 'handler_rollback')
|
||||
AND sba.user IN ('user1');
|
||||
--echo
|
||||
--echo # User2@localhost
|
||||
UPDATE test.status_results sr, performance_schema.status_by_account sba
|
||||
SET sr.a2 = sba.variable_value
|
||||
WHERE sr.variable_name = sba.variable_name
|
||||
AND sba.variable_name IN ('handler_delete', 'handler_rollback')
|
||||
AND sba.user IN ('user2');
|
||||
--echo
|
||||
--echo # User3@localhost
|
||||
UPDATE test.status_results sr, performance_schema.status_by_account sba
|
||||
SET sr.a3 = sba.variable_value
|
||||
WHERE sr.variable_name = sba.variable_name
|
||||
AND sba.variable_name IN ('handler_delete', 'handler_rollback')
|
||||
AND sba.user IN ('user3');
|
||||
--echo
|
||||
--echo
|
||||
--echo # Status totals for 3 accounts.
|
||||
UPDATE test.status_results sr
|
||||
SET sr.acct = sr.a1 + sr.a2 + sr.a3;
|
||||
|
||||
#--echo DEBUG
|
||||
#SELECT * FROM test.status_results;
|
29
mysql-test/suite/perfschema/include/show_plugin_verifier.inc
Normal file
29
mysql-test/suite/perfschema/include/show_plugin_verifier.inc
Normal file
@ -0,0 +1,29 @@
|
||||
--disable_warnings
|
||||
|
||||
--echo
|
||||
SHOW GLOBAL STATUS LIKE "example_%";
|
||||
--echo
|
||||
SHOW SESSION STATUS LIKE "example_%";
|
||||
--echo
|
||||
SHOW GLOBAL VARIABLES LIKE "example_%";
|
||||
--echo
|
||||
SHOW SESSION VARIABLES LIKE "example_%";
|
||||
--echo
|
||||
SELECT variable_name, variable_value FROM performance_schema.global_status WHERE variable_name LIKE "example_%";
|
||||
--echo
|
||||
SELECT variable_name, variable_value FROM performance_schema.session_status WHERE variable_name LIKE "example_%";
|
||||
--echo
|
||||
SELECT variable_name, variable_value FROM performance_schema.global_variables WHERE variable_name LIKE "example_%";
|
||||
--echo
|
||||
SELECT variable_name, variable_value FROM performance_schema.session_variables WHERE variable_name LIKE "example_%";
|
||||
|
||||
#
|
||||
# Force sync of local and global system variables.
|
||||
#
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
SELECT variable_name, variable_value FROM performance_schema.variables_by_thread WHERE variable_name LIKE "example_%";
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
|
||||
--enable_warnings
|
@ -0,0 +1,29 @@
|
||||
--disable_warnings
|
||||
|
||||
--echo
|
||||
SHOW GLOBAL STATUS LIKE "example_%";
|
||||
--echo
|
||||
SHOW SESSION STATUS LIKE "example_%";
|
||||
--echo
|
||||
SHOW GLOBAL VARIABLES LIKE "example_%";
|
||||
--echo
|
||||
SHOW SESSION VARIABLES LIKE "example_%";
|
||||
--echo
|
||||
SELECT variable_name, variable_value FROM information_schema.global_status WHERE variable_name LIKE "example_%";
|
||||
--echo
|
||||
SELECT variable_name, variable_value FROM information_schema.session_status WHERE variable_name LIKE "example_%";
|
||||
--echo
|
||||
SELECT variable_name, variable_value FROM information_schema.global_variables WHERE variable_name LIKE "example_%";
|
||||
--echo
|
||||
SELECT variable_name, variable_value FROM information_schema.session_variables WHERE variable_name LIKE "example_%";
|
||||
|
||||
#
|
||||
# Force sync of local and global system variables.
|
||||
#
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
SELECT variable_name, variable_value FROM performance_schema.variables_by_thread WHERE variable_name LIKE "example_%";
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
|
||||
--enable_warnings
|
@ -0,0 +1,29 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Auxiliary file used by transaction_gtid.test
|
||||
#
|
||||
# Invoked to check the contents of the
|
||||
# performance_schema.events_transaction_[current|history] tables and
|
||||
# write the result to the result log. This is executed on the
|
||||
# 'server_1' connection and shows only status of transactions on the
|
||||
# 'default' connection.
|
||||
|
||||
--connection server_1
|
||||
|
||||
--replace_result $server_uuid SERVER_UUID aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa A
|
||||
--let $history_result= `SELECT GTID FROM performance_schema.events_transactions_history WHERE THREAD_ID = $thread_id`
|
||||
if ($history_result == '')
|
||||
{
|
||||
--let $history_result= none
|
||||
}
|
||||
|
||||
--replace_result $server_uuid SERVER_UUID aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa A
|
||||
--let $current_result= `SELECT GTID FROM performance_schema.events_transactions_current WHERE THREAD_ID = $thread_id`
|
||||
if ($current_result == '')
|
||||
{
|
||||
--let $current_result= none
|
||||
}
|
||||
|
||||
--echo - history=$history_result current=$current_result
|
||||
|
||||
--connection default
|
@ -1,24 +0,0 @@
|
||||
|
||||
show variables like "table_definition_cache";
|
||||
show variables like "table_open_cache";
|
||||
show variables like "max_connections";
|
||||
# open_files_limit depends on OS configuration (ulimit -n)
|
||||
#show variables like "open_files_limit";
|
||||
show variables where
|
||||
`Variable_name` != "performance_schema_max_statement_classes" and
|
||||
`Variable_name` like "performance_schema%";
|
||||
show status like "%performance_schema%";
|
||||
|
||||
# Each test script should provide a different test.cnf file,
|
||||
# with different settings.
|
||||
# This output will show the sizes computed automatically.
|
||||
# Note that this output is very dependent on the platform.
|
||||
# The output of SHOW ENGINE PERFORMANCE_SCHEMA STATUS
|
||||
# is very dependent on the platform,
|
||||
# so it is not printed here to ensure stability of the .results files.
|
||||
# To troubleshoot the performance schema memory consumption at different
|
||||
# configuration settings, comment the following line.
|
||||
# Debug only:
|
||||
|
||||
# show engine performance_schema status;
|
||||
|
@ -7,13 +7,13 @@ select count(*) from performance_schema.setup_consumers;
|
||||
# wait/io/table/sql/handler is a native instrument
|
||||
# wait/lock/table/sql/handler is a native instrument
|
||||
# idle/io/socket is a native instrument
|
||||
select count(*) > 3 from performance_schema.setup_instruments;
|
||||
# wait/lock/metadata is a native instrument
|
||||
select count(*) > 4 from performance_schema.setup_instruments;
|
||||
select count(*) from performance_schema.setup_timers;
|
||||
|
||||
# Make sure we don't crash, no matter what the starting parameters are
|
||||
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
select * from performance_schema.accounts;
|
||||
select * from performance_schema.cond_instances;
|
||||
select * from performance_schema.events_stages_current;
|
||||
@ -33,6 +33,14 @@ select * from performance_schema.events_statements_summary_by_host_by_event_name
|
||||
select * from performance_schema.events_statements_summary_by_thread_by_event_name;
|
||||
select * from performance_schema.events_statements_summary_by_user_by_event_name;
|
||||
select * from performance_schema.events_statements_summary_global_by_event_name;
|
||||
select * from performance_schema.events_transactions_current;
|
||||
select * from performance_schema.events_transactions_history;
|
||||
select * from performance_schema.events_transactions_history_long;
|
||||
select * from performance_schema.events_transactions_summary_by_account_by_event_name;
|
||||
select * from performance_schema.events_transactions_summary_by_host_by_event_name;
|
||||
select * from performance_schema.events_transactions_summary_by_thread_by_event_name;
|
||||
select * from performance_schema.events_transactions_summary_by_user_by_event_name;
|
||||
select * from performance_schema.events_transactions_summary_global_by_event_name;
|
||||
select * from performance_schema.events_waits_current;
|
||||
select * from performance_schema.events_waits_history;
|
||||
select * from performance_schema.events_waits_history_long;
|
||||
@ -42,11 +50,22 @@ select * from performance_schema.events_waits_summary_by_instance;
|
||||
select * from performance_schema.events_waits_summary_by_thread_by_event_name;
|
||||
select * from performance_schema.events_waits_summary_by_user_by_event_name;
|
||||
select * from performance_schema.events_waits_summary_global_by_event_name;
|
||||
select * from performance_schema.memory_summary_by_account_by_event_name;
|
||||
select * from performance_schema.memory_summary_by_host_by_event_name;
|
||||
select * from performance_schema.memory_summary_by_thread_by_event_name;
|
||||
select * from performance_schema.memory_summary_by_user_by_event_name;
|
||||
select * from performance_schema.memory_summary_global_by_event_name;
|
||||
select * from performance_schema.file_instances;
|
||||
select * from performance_schema.file_summary_by_event_name;
|
||||
select * from performance_schema.file_summary_by_instance;
|
||||
select * from performance_schema.host_cache;
|
||||
select * from performance_schema.hosts;
|
||||
select * from performance_schema.memory_summary_by_account_by_event_name;
|
||||
select * from performance_schema.memory_summary_by_host_by_event_name;
|
||||
select * from performance_schema.memory_summary_by_thread_by_event_name;
|
||||
select * from performance_schema.memory_summary_by_user_by_event_name;
|
||||
select * from performance_schema.memory_summary_global_by_event_name;
|
||||
select * from performance_schema.metadata_locks;
|
||||
select * from performance_schema.mutex_instances;
|
||||
select * from performance_schema.objects_summary_global_by_type;
|
||||
select * from performance_schema.performance_timers;
|
||||
@ -61,13 +80,31 @@ select * from performance_schema.setup_timers;
|
||||
select * from performance_schema.socket_instances;
|
||||
select * from performance_schema.socket_summary_by_instance;
|
||||
select * from performance_schema.socket_summary_by_event_name;
|
||||
select * from performance_schema.table_handles;
|
||||
select * from performance_schema.table_io_waits_summary_by_index_usage;
|
||||
select * from performance_schema.table_io_waits_summary_by_table;
|
||||
select * from performance_schema.table_lock_waits_summary_by_table;
|
||||
select * from performance_schema.threads;
|
||||
select * from performance_schema.users;
|
||||
select * from performance_schema.replication_connection_configuration;
|
||||
select * from performance_schema.replication_connection_status;
|
||||
select * from performance_schema.replication_applier_configuration;
|
||||
select * from performance_schema.replication_applier_status;
|
||||
select * from performance_schema.replication_applier_status_by_coordinator;
|
||||
select * from performance_schema.replication_applier_status_by_worker;
|
||||
select * from performance_schema.global_status;
|
||||
select * from performance_schema.status_by_thread;
|
||||
select * from performance_schema.status_by_user;
|
||||
select * from performance_schema.status_by_host;
|
||||
select * from performance_schema.status_by_account;
|
||||
select * from performance_schema.session_status;
|
||||
select * from performance_schema.global_variables;
|
||||
select * from performance_schema.variables_by_thread;
|
||||
select * from performance_schema.session_variables;
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
||||
# This has a stable output, printing the result:
|
||||
show global variables like "performance_schema%";
|
||||
|
||||
# This has an unrepeatable output, it does depends too much on
|
||||
# - the platform hardware (sizeof structures, padding)
|
||||
@ -78,6 +115,6 @@ select * from performance_schema.users;
|
||||
|
||||
--disable_result_log
|
||||
show engine PERFORMANCE_SCHEMA status;
|
||||
show status like "performance_schema%";
|
||||
show global status like "performance_schema%";
|
||||
--enable_result_log
|
||||
|
||||
|
@ -2,6 +2,19 @@
|
||||
#
|
||||
|
||||
# See comments in include/table_aggregate_setup.inc
|
||||
#
|
||||
# Notes about the optimizer and query plans:
|
||||
# The following statement
|
||||
# SELECT * from t1 where b=5;
|
||||
# can be executed either:
|
||||
# - by using the index "index_b" on column b
|
||||
# - by using a full table scan and the where clause.
|
||||
# Which plan is used can be unpredictable.
|
||||
# To ensure that the index is really used,
|
||||
# so that table io against the index is measured,
|
||||
# the payload in this test uses:
|
||||
# SELECT * from t1 force index(index_b) where b=5;
|
||||
#
|
||||
|
||||
# Display the current setup used
|
||||
|
||||
@ -88,13 +101,34 @@ update test.t1 set d=d+1 where a=101;
|
||||
update test.t2 set d=d+1 where a=101;
|
||||
update test.t3 set d=d+1 where a=101;
|
||||
# select with index
|
||||
select * from test.t1 where b=5;
|
||||
select * from test.t2 where b=5;
|
||||
select * from test.t3 where b=5;
|
||||
select * from test.t1 force index(index_b) where b=5;
|
||||
select * from test.t2 force index(index_b) where b=5;
|
||||
select * from test.t3 force index(index_b) where b=5;
|
||||
|
||||
--connection default
|
||||
|
||||
echo "================== Step 3 ==================";
|
||||
echo "================== Step 3-A ==================";
|
||||
call dump_thread();
|
||||
execute dump_waits_account;
|
||||
execute dump_waits_user;
|
||||
execute dump_waits_host;
|
||||
execute dump_waits_global;
|
||||
execute dump_waits_history;
|
||||
execute dump_waits_index_io;
|
||||
execute dump_waits_table_io;
|
||||
execute dump_waits_table_lock;
|
||||
execute dump_objects_summary;
|
||||
|
||||
--connection con1
|
||||
|
||||
# This cause aggregation, so that index names are finally recorded
|
||||
flush tables;
|
||||
|
||||
echo "================== con1 FLUSH ==================";
|
||||
|
||||
--connection default
|
||||
|
||||
echo "================== Step 3-B ==================";
|
||||
call dump_thread();
|
||||
execute dump_waits_account;
|
||||
execute dump_waits_user;
|
||||
@ -147,9 +181,9 @@ update test.t1 set d=d+1 where a=201;
|
||||
update test.t2 set d=d+1 where a=201;
|
||||
update test.t3 set d=d+1 where a=201;
|
||||
# select with index
|
||||
select * from test.t1 where b=5;
|
||||
select * from test.t2 where b=5;
|
||||
select * from test.t3 where b=5;
|
||||
select * from test.t1 force index(index_b) where b=5;
|
||||
select * from test.t2 force index(index_b) where b=5;
|
||||
select * from test.t3 force index(index_b) where b=5;
|
||||
|
||||
--connection default
|
||||
|
||||
@ -202,9 +236,9 @@ update test.t1 set d=d+1 where a=301;
|
||||
update test.t2 set d=d+1 where a=301;
|
||||
update test.t3 set d=d+1 where a=301;
|
||||
# select with index
|
||||
select * from test.t1 where b=5;
|
||||
select * from test.t2 where b=5;
|
||||
select * from test.t3 where b=5;
|
||||
select * from test.t1 force index(index_b) where b=5;
|
||||
select * from test.t2 force index(index_b) where b=5;
|
||||
select * from test.t3 force index(index_b) where b=5;
|
||||
|
||||
--connection default
|
||||
|
||||
@ -257,9 +291,9 @@ update test.t1 set d=d+1 where a=401;
|
||||
update test.t2 set d=d+1 where a=401;
|
||||
update test.t3 set d=d+1 where a=401;
|
||||
# select with index
|
||||
select * from test.t1 where b=5;
|
||||
select * from test.t2 where b=5;
|
||||
select * from test.t3 where b=5;
|
||||
select * from test.t1 force index(index_b) where b=5;
|
||||
select * from test.t2 force index(index_b) where b=5;
|
||||
select * from test.t3 force index(index_b) where b=5;
|
||||
|
||||
--connection default
|
||||
|
||||
@ -494,4 +528,5 @@ execute dump_waits_table_lock;
|
||||
execute dump_objects_summary;
|
||||
|
||||
# On test failures, may help to track the root cause
|
||||
show status like "performance_schema%";
|
||||
show global status like "performance_schema%";
|
||||
|
||||
|
@ -222,7 +222,9 @@ prepare dump_waits_global from
|
||||
order by event_name;";
|
||||
|
||||
prepare dump_waits_history from
|
||||
"select event_name, count(event_name), object_type, object_schema, object_name
|
||||
"select event_name,
|
||||
sum(if(number_of_bytes is null, 1, number_of_bytes)) as 'count(event_name)',
|
||||
object_type, object_schema, object_name
|
||||
from performance_schema.events_waits_history_long
|
||||
where event_name in
|
||||
(\'wait/io/table/sql/handler\',
|
||||
@ -254,7 +256,7 @@ prepare dump_waits_table_lock from
|
||||
count_read_normal, count_read_with_shared_locks,
|
||||
count_read_high_priority, count_read_no_insert,
|
||||
count_read_external,
|
||||
count_write_delayed, count_write_low_priority,
|
||||
count_write_low_priority,
|
||||
count_write_external
|
||||
from performance_schema.table_lock_waits_summary_by_table
|
||||
where object_type='TABLE' and object_schema='test'
|
||||
|
12
mysql-test/suite/perfschema/include/transaction_cleanup.inc
Normal file
12
mysql-test/suite/perfschema/include/transaction_cleanup.inc
Normal file
@ -0,0 +1,12 @@
|
||||
# Tests for the performance schema
|
||||
|
||||
# ==========================================
|
||||
# HELPER include/transaction_cleanup.inc
|
||||
# ==========================================
|
||||
|
||||
DROP PROCEDURE clear_transaction_tables;
|
||||
DROP PROCEDURE clear_transaction_history;
|
||||
DROP PROCEDURE clear_statement_history;
|
||||
DROP PROCEDURE clear_history;
|
||||
DROP PROCEDURE transaction_verifier;
|
||||
|
@ -0,0 +1,145 @@
|
||||
# Tests for the performance schema
|
||||
|
||||
# =====================================================
|
||||
# HELPER include/transaction_nested_events_verifier.inc
|
||||
# =====================================================
|
||||
|
||||
--connection default
|
||||
--disable_query_log
|
||||
|
||||
# Poll till the activity of the actor connection con1 caused by the last
|
||||
# statement issued has finished.
|
||||
let $wait_timeout= 10;
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) > 0 FROM performance_schema.threads
|
||||
WHERE THREAD_ID = @con1_thread_id
|
||||
AND (PROCESSLIST_STATE = 'Sleep' OR PROCESSLIST_STATE IS NULL);
|
||||
--source include/wait_condition.inc
|
||||
if(!$success)
|
||||
{
|
||||
--echo The activity of connection con1 did not finish.
|
||||
SELECT thread_id , PROCESSLIST_id, PROCESSLIST_STATE, PROCESSLIST_INFO
|
||||
FROM performance_schema.threads
|
||||
WHERE thread_id = @con1_thread_id;
|
||||
--echo Abort.
|
||||
exit;
|
||||
}
|
||||
|
||||
--echo #========================================================================
|
||||
--echo # Verify
|
||||
--echo #========================================================================
|
||||
|
||||
SELECT event_id from performance_schema.events_transactions_history_long
|
||||
where (THREAD_ID = @con1_thread_id)
|
||||
order by event_id limit 1
|
||||
into @base_tx_event_id;
|
||||
|
||||
SELECT event_id from performance_schema.events_statements_history_long
|
||||
where (THREAD_ID = @con1_thread_id)
|
||||
order by event_id limit 1
|
||||
into @base_stmt_event_id;
|
||||
|
||||
select if(@base_tx_event_id < @base_stmt_event_id,
|
||||
@base_tx_event_id - 1,
|
||||
@base_stmt_event_id - 1)
|
||||
into @base_event_id;
|
||||
|
||||
# Debug helpers
|
||||
# set @base_event_id = 0;
|
||||
# select @base_tx_event_id, @base_stmt_event_id, @base_event_id;
|
||||
|
||||
--echo EVENTS_TRANSACTIONS_CURRENT
|
||||
--echo
|
||||
|
||||
--replace_column 1 thread_id
|
||||
|
||||
SELECT THREAD_ID,
|
||||
LPAD(EVENT_ID - @base_event_id, 11, ' ') as R_EVENT_ID,
|
||||
LPAD(END_EVENT_ID - @base_event_id, 11, ' ') as R_END_EVENT_ID,
|
||||
RPAD(EVENT_NAME, 11, ' ') 'EVENT_NAME ',
|
||||
RPAD(STATE, 11, ' ') 'STATE ',
|
||||
RPAD(ACCESS_MODE, 11, ' ') ACCESS_MODE,
|
||||
RPAD(ISOLATION_LEVEL, 16, ' ') 'ISOLATION_LEVEL ',
|
||||
RPAD(AUTOCOMMIT, 4, ' ') AUTO,
|
||||
LPAD(NESTING_EVENT_ID - @base_event_id, 19, ' ') as R_NESTING_EVENT_ID,
|
||||
RPAD(IFNULL(NESTING_EVENT_TYPE, 'NULL'), 18, ' ') NESTING_EVENT_TYPE
|
||||
FROM performance_schema.events_transactions_current
|
||||
WHERE ((THREAD_ID = @con1_thread_id) OR (@all_threads = 1))
|
||||
ORDER BY thread_id, event_id;
|
||||
|
||||
--echo
|
||||
--echo EVENTS_TRANSACTIONS_HISTORY_LONG
|
||||
--echo
|
||||
|
||||
--replace_column 1 thread_id
|
||||
|
||||
SELECT THREAD_ID,
|
||||
LPAD(EVENT_ID - @base_event_id, 11, ' ') as R_EVENT_ID,
|
||||
LPAD(END_EVENT_ID - @base_event_id, 11, ' ') as R_END_EVENT_ID,
|
||||
RPAD(EVENT_NAME, 11, ' ') 'EVENT_NAME ',
|
||||
RPAD(STATE, 11, ' ') 'STATE ',
|
||||
RPAD(ACCESS_MODE, 11, ' ') ACCESS_MODE,
|
||||
RPAD(ISOLATION_LEVEL, 16, ' ') 'ISOLATION_LEVEL ',
|
||||
RPAD(AUTOCOMMIT, 4, ' ') AUTO,
|
||||
LPAD(NESTING_EVENT_ID - @base_event_id, 19, ' ') as R_NESTING_EVENT_ID,
|
||||
RPAD(IFNULL(NESTING_EVENT_TYPE, 'NULL'), 18, ' ') NESTING_EVENT_TYPE
|
||||
FROM performance_schema.events_transactions_history_long
|
||||
WHERE ((THREAD_ID = @con1_thread_id) OR (@all_threads = 1))
|
||||
ORDER BY thread_id, event_id;
|
||||
|
||||
--echo
|
||||
--echo EVENTS_STATEMENTS_HISTORY_LONG
|
||||
--echo
|
||||
|
||||
--replace_column 1 thread_id
|
||||
|
||||
SELECT THREAD_ID,
|
||||
LPAD(EVENT_ID - @base_event_id, 11, ' ') as R_EVENT_ID,
|
||||
LPAD(END_EVENT_ID - @base_event_id, 11, ' ') as R_END_EVENT_ID,
|
||||
RPAD(EVENT_NAME, 30, ' ') 'EVENT_NAME ',
|
||||
RPAD(IFNULL(object_name, 'NULL'), 12, ' ') 'OBJECT_NAME ',
|
||||
LPAD(IFNULL(NESTING_EVENT_ID - @base_event_id, 'NULL'), 19, ' ') as R_NESTING_EVENT_ID,
|
||||
RPAD(IFNULL(NESTING_EVENT_TYPE, 'NULL'), 18, ' ') NESTING_EVENT_TYPE,
|
||||
LPAD(NESTING_EVENT_LEVEL, 5, ' ') LEVEL,
|
||||
SQL_TEXT
|
||||
FROM performance_schema.events_statements_history_long
|
||||
WHERE ((THREAD_ID = @con1_thread_id) OR (@all_threads = 1))
|
||||
ORDER BY thread_id, event_id;
|
||||
|
||||
--echo
|
||||
--echo ## Combined statement and transaction event history ordered by event id
|
||||
--echo
|
||||
--echo EVENTS_STATEMENTS_HISTORY_LONG + EVENTS_TRANSACTIONS_HISTORY_LONG
|
||||
--echo
|
||||
|
||||
--replace_column 1 thread_id
|
||||
|
||||
SELECT THREAD_ID,
|
||||
LPAD(EVENT_ID - @base_event_id, 11, ' ') as R_EVENT_ID,
|
||||
LPAD(END_EVENT_ID - @base_event_id, 11, ' ') as R_END_EVENT_ID,
|
||||
RPAD(EVENT_NAME, 25, ' ') 'EVENT_NAME ',
|
||||
LPAD(NESTING_EVENT_ID - @base_event_id, 19, ' ') as R_NESTING_EVENT_ID,
|
||||
RPAD(IFNULL(NESTING_EVENT_TYPE, 'NULL'), 18, ' ') NESTING_EVENT_TYPE,
|
||||
'<transaction started>' AS SQL_TXT
|
||||
FROM performance_schema.events_transactions_history_long t
|
||||
WHERE (t.thread_id = @con1_thread_id)
|
||||
UNION
|
||||
SELECT THREAD_ID,
|
||||
LPAD(EVENT_ID - @base_event_id, 11, ' ') as R_EVENT_ID,
|
||||
LPAD(END_EVENT_ID - @base_event_id, 11, ' ') as R_END_EVENT_ID,
|
||||
RPAD(EVENT_NAME, 25, ' ') 'EVENT_NAME ',
|
||||
LPAD(IFNULL(NESTING_EVENT_ID - @base_event_id, 'NULL'), 19, ' ') as R_NESTING_EVENT_ID,
|
||||
RPAD(IFNULL(NESTING_EVENT_TYPE, 'NULL'), 18, ' ') NESTING_EVENT_TYPE,
|
||||
SQL_TEXT
|
||||
FROM performance_schema.events_statements_history_long s
|
||||
WHERE ((s.thread_id = @con1_thread_id) OR (@all_threads = 1))
|
||||
ORDER BY thread_id, r_event_id;
|
||||
|
||||
--echo
|
||||
--echo ## Clear statement and transaction history
|
||||
--echo CALL test.clear_history();
|
||||
CALL test.clear_history();
|
||||
--enable_query_log
|
||||
--echo ## Reset db.t1
|
||||
DELETE FROM db.t1;
|
||||
--echo
|
231
mysql-test/suite/perfschema/include/transaction_setup.inc
Normal file
231
mysql-test/suite/perfschema/include/transaction_setup.inc
Normal file
@ -0,0 +1,231 @@
|
||||
# Tests for the performance schema
|
||||
|
||||
# ==========================================
|
||||
# HELPER include/transaction_setup.inc
|
||||
# ==========================================
|
||||
|
||||
#
|
||||
# UTILITY QUERIES
|
||||
#
|
||||
let $get_thread_id=
|
||||
SELECT thread_id INTO @my_thread_id
|
||||
FROM performance_schema.threads
|
||||
WHERE processlist_id = connection_id();
|
||||
|
||||
let $disable_instruments=
|
||||
UPDATE performance_schema.setup_instruments
|
||||
SET enabled='no', timed='no'
|
||||
WHERE name IN ('transaction');
|
||||
|
||||
let $enable_instruments=
|
||||
UPDATE performance_schema.setup_instruments
|
||||
SET enabled='yes', timed='yes'
|
||||
WHERE name IN ('transaction');
|
||||
|
||||
let $def_count = -1;
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS clear_transaction_tables;
|
||||
--enable_warnings
|
||||
|
||||
--disable_result_log
|
||||
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE clear_transaction_tables()
|
||||
BEGIN
|
||||
truncate table performance_schema.events_transactions_current;
|
||||
truncate table performance_schema.events_transactions_history;
|
||||
truncate table performance_schema.events_transactions_history_long;
|
||||
truncate table performance_schema.events_transactions_summary_by_thread_by_event_name;
|
||||
truncate table performance_schema.events_transactions_summary_by_account_by_event_name;
|
||||
truncate table performance_schema.events_transactions_summary_by_host_by_event_name;
|
||||
truncate table performance_schema.events_transactions_summary_by_user_by_event_name;
|
||||
truncate table performance_schema.events_transactions_summary_global_by_event_name;
|
||||
END$$
|
||||
|
||||
CREATE PROCEDURE clear_transaction_history()
|
||||
BEGIN
|
||||
truncate table performance_schema.events_transactions_current;
|
||||
truncate table performance_schema.events_transactions_history;
|
||||
truncate table performance_schema.events_transactions_history_long;
|
||||
END$$
|
||||
|
||||
CREATE PROCEDURE clear_statement_history()
|
||||
BEGIN
|
||||
truncate table performance_schema.events_statements_current;
|
||||
truncate table performance_schema.events_statements_history;
|
||||
truncate table performance_schema.events_statements_history_long;
|
||||
END$$
|
||||
|
||||
CREATE PROCEDURE clear_history()
|
||||
BEGIN
|
||||
truncate table performance_schema.events_statements_current;
|
||||
truncate table performance_schema.events_statements_history;
|
||||
truncate table performance_schema.events_statements_history_long;
|
||||
truncate table performance_schema.events_transactions_current;
|
||||
truncate table performance_schema.events_transactions_history;
|
||||
truncate table performance_schema.events_transactions_history_long;
|
||||
END$$
|
||||
|
||||
CREATE PROCEDURE transaction_verifier(IN i_table INT,
|
||||
IN i_thread_id INT,
|
||||
IN i_event_name VARCHAR(64),
|
||||
IN i_state VARCHAR(32),
|
||||
IN i_xid_format_id INT,
|
||||
IN i_xid_gtrid VARCHAR(130),
|
||||
IN i_xid_bqual VARCHAR(130),
|
||||
IN i_xa_state VARCHAR(64),
|
||||
IN i_gtid VARCHAR(64),
|
||||
IN i_access_mode VARCHAR(32),
|
||||
IN i_isolation_level VARCHAR(64),
|
||||
IN i_autocommit VARCHAR(16),
|
||||
IN i_savepoints INT,
|
||||
IN i_rb_savepoint INT,
|
||||
IN i_rel_savepoint INT,
|
||||
IN i_expected INT)
|
||||
BEGIN
|
||||
DECLARE table_name VARCHAR(64);
|
||||
SET @thread_id = i_thread_id;
|
||||
SET @event_id = 0;
|
||||
SET @event_name = i_event_name;
|
||||
SET @state = i_state;
|
||||
SET @xid_format_id = i_xid_format_id;
|
||||
SET @xid_gtrid = i_xid_gtrid;
|
||||
SET @xid_bqual = i_xid_bqual;
|
||||
SET @xa_state = i_xa_state;
|
||||
SET @gtid = i_gtid;
|
||||
SET @access_mode = i_access_mode;
|
||||
SET @isolation_level = i_isolation_level;
|
||||
SET @autocommit = i_autocommit;
|
||||
SET @savepoints = i_savepoints;
|
||||
SET @rb_savepoint = i_rb_savepoint;
|
||||
SET @rel_savepoint = i_rel_savepoint;
|
||||
SET @expected = i_expected;
|
||||
|
||||
#
|
||||
# Build verification query based upon input parameters
|
||||
#
|
||||
|
||||
IF i_table = 0 THEN
|
||||
SET table_name = 'performance_schema.events_transactions_current';
|
||||
ELSEIF i_table = 1 THEN
|
||||
SET table_name = 'performance_schema.events_transactions_history';
|
||||
ELSEIF i_table = 2 THEN
|
||||
SET table_name = 'performance_schema.events_transactions_history_long';
|
||||
ELSE
|
||||
SET table_name = 'performance_schema.events_transactions_history';
|
||||
END IF;
|
||||
|
||||
SET @query = CONCAT('SELECT COUNT(*) INTO @actual FROM ', table_name, ' WHERE');
|
||||
|
||||
IF i_thread_id != 0 THEN
|
||||
SET @query = CONCAT(@query, ' (thread_id = @thread_id)');
|
||||
END IF;
|
||||
IF i_event_name != '' THEN
|
||||
SET @query = CONCAT(@query, ' AND (event_name = @event_name)');
|
||||
END IF;
|
||||
IF i_state != '' THEN
|
||||
SET @query = CONCAT(@query, ' AND (state = @state)');
|
||||
END IF;
|
||||
IF i_xid_format_id != '' THEN
|
||||
SET @query = CONCAT(@query, ' AND (xid_format_id = @xid_format_id)');
|
||||
END IF;
|
||||
IF i_xid_gtrid != '' THEN
|
||||
SET @query = CONCAT(@query, ' AND (xid_gtrid = @xid_gtrid)');
|
||||
END IF;
|
||||
IF i_xid_bqual != '' THEN
|
||||
SET @query = CONCAT(@query, ' AND (xid_bqual = @xid_bqual)');
|
||||
END IF;
|
||||
IF i_xa_state != '' THEN
|
||||
SET @query = CONCAT(@query, ' AND (xa_state = @xa_state)');
|
||||
END IF;
|
||||
IF i_gtid = 'NULL' THEN
|
||||
SET @query = CONCAT(@query, ' AND (gtid IS NULL)');
|
||||
ELSEIF i_gtid != '' THEN
|
||||
SET @query = CONCAT(@query, ' AND (gtid = @gtid)');
|
||||
END IF;
|
||||
IF i_access_mode != '' THEN
|
||||
SET @query = CONCAT(@query, ' AND (access_mode = @access_mode)');
|
||||
END IF;
|
||||
IF i_isolation_level != '' THEN
|
||||
SET @query = CONCAT(@query, ' AND (isolation_level = @isolation_level)');
|
||||
END IF;
|
||||
IF i_autocommit != '' THEN
|
||||
SET @query = CONCAT(@query, ' AND (autocommit = @autocommit)');
|
||||
END IF;
|
||||
IF i_savepoints != 0 THEN
|
||||
SET @query = CONCAT(@query, ' AND (number_of_savepoints = @savepoints)');
|
||||
END IF;
|
||||
IF i_rb_savepoint != 0 THEN
|
||||
SET @query = CONCAT(@query, ' AND (number_of_rollback_to_savepoint = @rb_savepoint)');
|
||||
END IF;
|
||||
IF i_rel_savepoint != 0 THEN
|
||||
SET @query = CONCAT(@query, ' AND (number_of_release_savepoint = @rel_savepoint)');
|
||||
END IF;
|
||||
|
||||
SET @query = CONCAT(@query, ' ORDER BY event_id;');
|
||||
|
||||
## DEBUG ## SELECT * FROM performance_schema.events_transactions_history ORDER BY event_id;
|
||||
## SELECT @query AS "QUERY";
|
||||
PREPARE stmt1 FROM @query;
|
||||
EXECUTE stmt1;
|
||||
DEALLOCATE PREPARE stmt1;
|
||||
|
||||
SELECT LPAD(@actual, 6, ' ') AS "ACTUAL", LPAD(@expected, 8, ' ') AS "EXPECTED";
|
||||
|
||||
IF @actual != @expected THEN
|
||||
SELECT "" AS "ERROR: Row count mismatch";
|
||||
SELECT @query AS "VERIFIER QUERY:";
|
||||
SELECT "";
|
||||
|
||||
SET @columns = ' LPAD(@thread_id, 9, " ") AS thread_id,';
|
||||
SET @columns = CONCAT(@columns, ' LPAD(@event_id, 10, " ") AS "..event_id",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(@event_name, 11, " ") AS "event_name ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(@state, 11, " ") AS "state ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(@xid_format_id, 15, " ") AS "xid_format_id ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(@xid_gtrid, 15, " ") AS "xid_gtrid ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(@xid_bqual, 15, " ") AS "xid_bqual ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(@xa_state, 12, " ") AS "xa_state ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(@gtid, 38, " ") AS "gtid ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(@access_mode, 11, " ") AS access_mode,');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(@isolation_level, 16, " ") AS "isolation_level ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(@autocommit, 10, " ") AS autocommit,');
|
||||
SET @columns = CONCAT(@columns, ' LPAD(@savepoints, 10, " ") AS savepoints,');
|
||||
SET @columns = CONCAT(@columns, ' LPAD(@rb_savepoint, 21, " ") AS rollback_to_savepoint,');
|
||||
SET @columns = CONCAT(@columns, ' LPAD(@rel_savepoint, 17, " ") AS release_savepoint');
|
||||
SET @query2 = CONCAT('SELECT', ' LPAD(@expected, 13, " ") AS ROWS_EXPECTED, ', @columns, ';');
|
||||
# SET @query2 = CONCAT('SELECT " " AS EXPECTED, ', @columns, ';');
|
||||
PREPARE stmt2 FROM @query2;
|
||||
EXECUTE stmt2;
|
||||
DEALLOCATE PREPARE stmt2;
|
||||
|
||||
SET @columns = ' LPAD(thread_id, 9, " ") AS thread_id,';
|
||||
SET @columns = CONCAT(@columns, ' LPAD(event_id, 10, " ") AS "..event_id",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(event_name, 11, " ") AS "event_name ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(state, 11, " ") AS "state ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(IFNULL(xid_format_id, "NULL"), 15, " ") AS "xid_format_id ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(IFNULL(xid_gtrid, "NULL"), 15, " ") AS "xid_gtrid ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(IFNULL(xid_bqual, "NULL"), 15, " ") AS "xid_bqual ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(IFNULL(xa_state, "NULL"), 12, " ") AS "xa_state ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(IFNULL(gtid, "NULL"), 38, " ") AS "gtid ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(access_mode, 11, " ") AS access_mode,');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(isolation_level, 16, " ") AS "isolation_level ",');
|
||||
SET @columns = CONCAT(@columns, ' RPAD(autocommit, 10, " ") AS autocommit,');
|
||||
SET @columns = CONCAT(@columns, ' LPAD(number_of_savepoints, 10, " ") AS savepoints,');
|
||||
SET @columns = CONCAT(@columns, ' LPAD(number_of_rollback_to_savepoint, 21, " ") AS rollback_to_savepoint,');
|
||||
SET @columns = CONCAT(@columns, ' LPAD(number_of_release_savepoint, 17, " ") AS release_savepoint');
|
||||
# SET @query3 = CONCAT('SELECT " " AS "ACTUAL ", ', @columns, ' FROM ', table_name, ' ORDER BY event_id;');
|
||||
SET @query3 = CONCAT('SELECT', ' LPAD(@actual, 13, " ") AS "ROWS_ACTUAL ",', @columns, ' FROM ', table_name, ' ORDER BY event_id;');
|
||||
PREPARE stmt3 FROM @query3;
|
||||
EXECUTE stmt3;
|
||||
DEALLOCATE PREPARE stmt3;
|
||||
|
||||
END IF;
|
||||
END$$
|
||||
|
||||
DELIMITER ;$$
|
||||
|
||||
--enable_result_log
|
||||
|
||||
|
||||
|
@ -14,3 +14,4 @@
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/err_file
|
||||
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
|
||||
|
||||
--source include/mysql_upgrade_cleanup.inc
|
@ -14,7 +14,7 @@ let $wait_condition=
|
||||
# Because instrumentation is optional, we use "<=" here.
|
||||
|
||||
let $wait_condition=
|
||||
select count(*) <= 1 from performance_schema.threads
|
||||
select count(*) <= 2 from performance_schema.threads
|
||||
where `TYPE`='FOREGROUND';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
|
Reference in New Issue
Block a user