1# Performance schema test template
2
3# How to use this script in a test case
4# =====================================
5#
6# The general table io test template is as follows
7#
8# --source include/not_embedded.inc
9# --source include/have_perfschema.inc
10# --source ../include/table_io_setup_helper.inc
11# ... more setup scripts as needed ...
12# update performance_schema.setup_consumers set enabled='YES';
13# ... test payload here ...
14# ... optionally, add this insert between statements
15# ... to make the final output more readable
16# insert into test.marker set a=1;
17# ... more test payload here ...
18# ... optionaly, add the following line (by default, only "test" is dumped) ...
19# let $schema_to_dump="db1", "db2", "db3";
20# --source ../include/table_io_result_helper.inc
21# Optional: Repeat several times
22#    update performance_schema.setup_consumers set enabled='YES';
23#    ... test payload here ...
24#    --source ../include/table_io_result_helper.inc
25# ... cleanup
26# --source ../include/table_io_cleanup_helper.inc
27#
28# (end of template)
29
30# Setup
31
32--disable_warnings
33drop table if exists test.marker;
34--enable_warnings
35
36# To be used in the test payload,
37# insert into marker makes the test output easier to read,
38# to separate table io events between statements.
39create table test.marker(a int);
40
41update performance_schema.setup_consumers set enabled='NO';
42
43update performance_schema.setup_instruments set enabled='NO';
44update performance_schema.setup_instruments set enabled='YES'
45  where name like "wait/io/table/%";
46
47truncate table performance_schema.events_waits_history_long;
48
49# Reset lost counters to a known state
50flush status;
51
52# Make sure there is room to instrument tables from this test.
53flush tables;
54
55# By default, dump table io only for test.
56# A test can overide this
57let $schema_to_dump="test";
58
59