[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.139.86.53: ~ $
# Tests for the performance schema

# =============
# DOCUMENTATION
# =============

# Verify how events are aggregated into various tables
#
# In the thread dimension:
# - events_waits_summary_by_thread_by_event_name
# - events_waits_summary_by_account_by_event_name
# - events_waits_summary_by_user_by_event_name
# - events_waits_summary_by_host_by_event_name
# - events_stages_summary_by_thread_by_event_name
# - events_stages_summary_by_account_by_event_name
# - events_stages_summary_by_user_by_event_name
# - events_stages_summary_by_host_by_event_name
# - events_statements_summary_by_thread_by_event_name
# - events_statements_summary_by_account_by_event_name
# - events_statements_summary_by_user_by_event_name
# - events_statements_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
#
# The tests are written with the following helpers:
# - include/event_aggregate_setup.inc
# - include/event_aggregate_load.inc
# - include/event_aggregate_cleanup.inc
#
# Helpers are intended to be used as follows.
#
# A Typical test t/event_aggregate_xxx.test will consist of:
# --source ../include/event_aggregate_setup.inc
# --source ../include/event_aggregate_load.inc
# --source ../include/event_aggregate_cleanup.inc
# and a t/event_aggregate_xxx-master.opt file
#
# Naming conventions for t/event_aggregate_xxx.test are as follows:
# t/event_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/event_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

grant ALL on *.* to user1@localhost;
grant ALL on *.* to user2@localhost;
grant ALL on *.* to user3@localhost;
grant ALL on *.* to user4@localhost;

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;
drop table if exists test.t1;
--enable_warnings

create table test.t1(a varchar(64));

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 ('wait/synch/mutex/sql/LOCK_connection_count',
                 'wait/synch/mutex/sql/LOCK_user_locks',
                 '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/checking permissions',
                 'stage/sql/Opening tables',
                 'stage/sql/closing tables');

update performance_schema.setup_instruments set enabled='YES', timed='YES'
  where name in ('statement/sql/select',
                 'statement/sql/insert',
                 'statement/abstract/new_packet',
                 'statement/abstract/Query',
                 'statement/com/Quit',
                 'statement/com/error');

# Start from a known clean state, to avoid noise from previous tests
flush tables;
flush status;
truncate performance_schema.events_waits_summary_by_thread_by_event_name;
truncate performance_schema.events_waits_summary_by_account_by_event_name;
truncate performance_schema.events_waits_summary_by_user_by_event_name;
truncate performance_schema.events_waits_summary_by_host_by_event_name;
truncate performance_schema.events_waits_summary_global_by_event_name;
truncate performance_schema.events_waits_history_long;

truncate performance_schema.events_stages_summary_by_thread_by_event_name;
truncate performance_schema.events_stages_summary_by_account_by_event_name;
truncate performance_schema.events_stages_summary_by_user_by_event_name;
truncate performance_schema.events_stages_summary_by_host_by_event_name;
truncate performance_schema.events_stages_summary_global_by_event_name;
truncate performance_schema.events_stages_history_long;

truncate performance_schema.events_statements_summary_by_thread_by_event_name;
truncate performance_schema.events_statements_summary_by_account_by_event_name;
truncate performance_schema.events_statements_summary_by_user_by_event_name;
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;

--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);

  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_connection_count',
                           'wait/synch/mutex/sql/LOCK_user_locks',
                           'wait/synch/rwlock/sql/LOCK_grant',
                           'wait/io/file/sql/query_log')
      and thread_id = my_thread_id
      order by event_name;
  else
    select username, "not found" as status;
  end if;
end
$$

delimiter ;$$

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_connection_count',
                     'wait/synch/mutex/sql/LOCK_user_locks',
                     'wait/synch/rwlock/sql/LOCK_grant',
                     'wait/io/file/sql/query_log')
  order by user, host, event_name;";

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_connection_count',
                     'wait/synch/mutex/sql/LOCK_user_locks',
                     'wait/synch/rwlock/sql/LOCK_grant',
                     'wait/io/file/sql/query_log')
  order by user, event_name;";

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_connection_count',
                     'wait/synch/mutex/sql/LOCK_user_locks',
                     'wait/synch/rwlock/sql/LOCK_grant',
                     'wait/io/file/sql/query_log')
  order by host, event_name;";

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_connection_count',
                       'wait/synch/mutex/sql/LOCK_user_locks',
                       'wait/synch/rwlock/sql/LOCK_grant',
                       'wait/io/file/sql/query_log')
  order by event_name;";

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_connection_count',
                       'wait/synch/mutex/sql/LOCK_user_locks',
                       'wait/synch/rwlock/sql/LOCK_grant',
                       'wait/io/file/sql/query_log')
  group by event_name order by event_name;";

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/checking permissions',
                     'stage/sql/Opening tables',
                     'stage/sql/closing tables')
  order by user, host, event_name;";

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/checking permissions',
                     'stage/sql/Opening tables',
                     'stage/sql/closing tables')
  order by user, event_name;";

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/checking permissions',
                     'stage/sql/Opening tables',
                     'stage/sql/closing tables')
  order by host, event_name;";

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/checking permissions',
                       'stage/sql/Opening tables',
                       'stage/sql/closing tables')
  order by event_name;";

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/checking permissions',
                       'stage/sql/Opening tables',
                       'stage/sql/closing tables')
  group by event_name order by event_name;";

prepare dump_statements_account from
  "select user, host, event_name, count_star
  from performance_schema.events_statements_summary_by_account_by_event_name
  where user like \'user%\'
  and event_name in ('statement/sql/select',
                     'statement/sql/insert',
                     'statement/com/Quit',
                     'statement/com/error')
  order by user, host, event_name;";

prepare dump_statements_user from
  "select user, event_name, count_star
  from performance_schema.events_statements_summary_by_user_by_event_name
  where user like \'user%\'
  and event_name in ('statement/sql/select',
                     'statement/sql/insert',
                     'statement/com/Quit',
                     'statement/com/error')
  order by user, event_name;";

prepare dump_statements_host from
  "select host, event_name, count_star
  from performance_schema.events_statements_summary_by_host_by_event_name
  where host=\'localhost\'
  and event_name in ('statement/sql/select',
                     'statement/sql/insert',
                     'statement/com/Quit',
                     'statement/com/error')
  order by host, event_name;";

prepare dump_statements_global from
  "select event_name, count_star
  from performance_schema.events_statements_summary_global_by_event_name
  where event_name in ('statement/sql/select',
                       'statement/sql/insert',
                       'statement/com/Quit',
                       'statement/com/error')
  order by event_name;";

prepare dump_statements_history from
  "select event_name, count(event_name)
  from performance_schema.events_statements_history_long
  where event_name in ('statement/sql/select',
                       'statement/sql/insert',
                       'statement/com/Quit',
                       'statement/com/error')
  group by event_name 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

Filemanager

Name Type Size Permission Actions
binlog_edge_common.inc File 5.46 KB 0644
binlog_ok_common.inc File 3.9 KB 0644
cleanup_helper.inc File 356 B 0644
connection_cleanup.inc File 794 B 0644
connection_load.inc File 6.1 KB 0644
connection_setup.inc File 3.01 KB 0644
digest_cleanup.inc File 387 B 0644
digest_execution.inc File 3.96 KB 0644
digest_setup.inc File 618 B 0644
disable_instruments.inc File 548 B 0644
enable_instruments.inc File 549 B 0644
event_aggregate_cleanup.inc File 1.62 KB 0644
event_aggregate_load.inc File 24.49 KB 0644
event_aggregate_setup.inc File 13.05 KB 0644
have_aligned_memory.inc File 548 B 0644
hostcache_dump.inc File 1.13 KB 0644
hostcache_set_state.inc File 651 B 0644
privilege.inc File 4.91 KB 0644
rpl_statements_truncate.inc File 683 B 0644
schema.inc File 2.54 KB 0644
setup_helper.inc File 1.1 KB 0644
sizing_auto.inc File 958 B 0644
socket_check1.inc File 4.63 KB 0644
socket_event.inc File 6.94 KB 0644
socket_event_dbg.inc File 2.95 KB 0644
socket_ipv6.inc File 2.98 KB 0644
socket_summary_check.inc File 8.18 KB 0644
socket_summary_check_dbg.inc File 8.37 KB 0644
stage_cleanup.inc File 915 B 0644
stage_setup.inc File 3.86 KB 0644
start_server_common.inc File 4.29 KB 0644
table_aggregate_cleanup.inc File 1.52 KB 0644
table_aggregate_load.inc File 13.96 KB 0644
table_aggregate_setup.inc File 8.82 KB 0644
table_io_basic_dml.inc File 1.1 KB 0644
table_io_cleanup_helper.inc File 336 B 0644
table_io_result_helper.inc File 702 B 0644
table_io_setup_helper.inc File 1.76 KB 0644
upgrade_check.inc File 435 B 0644
wait_for_pfs_thread_count.inc File 710 B 0644
wait_till_sleep.inc File 590 B 0644