Debian Codegraph @

mysql-test/suite/perfschema/t/idx_error_log.test

raw
1 # Performance schema tests generally depend on specific query plans
2 # and behavior, and much of the perfschema suite is therefore disabled
3 # if the hypergraph optimizer is active.
4 --source include/not_hypergraph.inc
5
6 # Tests for PERFORMANCE_SCHEMA
7
8 #setup
9 let $select_column = ERROR_CODE;
10 let $table = performance_schema.error_log;
11
12 SELECT logged INTO @startup
13 FROM performance_schema.error_log
14 WHERE error_code="MY-010116" ORDER BY logged DESC LIMIT 1;
15
16 ###########################################################################
17 # Test index on LOGGED, THREAD_ID, PRIO, ERROR_CODE, SUBSYSTEM
18 ###########################################################################
19
20 let $column_count = 1;
21
22 let $col1 = LOGGED;
23 let $col1_act = @startup;
24 --source ../include/idx_explain_error_log.inc
25
26 let $col1 = THREAD_ID;
27 let $col1_act = "0";
28 --source ../include/idx_explain_error_log.inc
29
30 let $col1 = PRIO;
31 let $col1_act = "System";
32 --source ../include/idx_explain_error_log.inc
33
34 let $col1 = ERROR_CODE;
35 let $col1_act = "MY-010116";
36 --source ../include/idx_explain_error_log.inc
37
38 let $col1 = SUBSYSTEM;
39 let $col1_act = "Server";
40 --source ../include/idx_explain_error_log.inc
41
42 --echo
43 --echo #
44 --echo # read key
45 --echo #
46
47 let $col1 = LOGGED;
48 let $col1_act = @startup;
49
50 FLUSH STATUS;
51 let $count1 = query_get_value(SHOW SESSION STATUS LIKE "handler_read_key", Value, 1);
52
53 --disable_result_log
54 eval SELECT COUNT($select_column) FROM $table WHERE $col1 = $col1_act;
55 --enable_result_log
56
57 let $count2 = query_get_value(SHOW SESSION STATUS LIKE "handler_read_key", Value, 1);
58
59 if ($count1 < $count2)
60 {
61 --echo OK: handler_read_key incremented
62 }
63 if ($count1 >= $count2)
64 {
65 --echo ***ERROR*** handler_read_key: Before= $count1, After= $count2
66 }