| 1 |
#------------------------------------------------------------- |
| 2 |
# Tests for PERFORMANCE_SCHEMA stored programs instrumentation |
| 3 |
#------------------------------------------------------------- |
| 4 |
|
| 5 |
# |
| 6 |
# Test case to show the behaviour of stored program instrumentation |
| 7 |
# when values of the system variables performance_schema_max_program_instances & |
| 8 |
# performance_schema_max_statement_stack are less than the statistics collected. |
| 9 |
# The status of the lost instrumentation is shown through the status variables |
| 10 |
# performance_schema_program_lost & performance_schema_nested_statement_lost |
| 11 |
# |
| 12 |
|
| 13 |
# Restarting the server at the begining of the test. |
| 14 |
# This is to avoid the instrumentation of extra SPs called by MTR |
| 15 |
# These additional stored programs which will be added might cause |
| 16 |
# result content mismatch failure. |
| 17 |
|
| 18 |
# clang/UBSAN needs to override the small thread stack in our -master.opt |
| 19 |
--disable_query_log |
| 20 |
call mtr.add_suppression("option 'thread_stack':"); |
| 21 |
--enable_query_log |
| 22 |
|
| 23 |
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; |
| 24 |
--exec echo "wait" > $restart_file |
| 25 |
--shutdown_server |
| 26 |
--source include/wait_until_disconnected.inc |
| 27 |
--exec echo "restart:--performance_schema_max_program_instances=7 --performance_schema_max_statement_stack=2 --thread_stack=655360">$restart_file |
| 28 |
--enable_reconnect |
| 29 |
--source include/wait_until_connected_again.inc |
| 30 |
|
| 31 |
--source ../include/start_server_common.inc |
| 32 |
|
| 33 |
# Values of variables server variables |
| 34 |
show global variables like "performance_schema_max_program_instances"; |
| 35 |
show global variables like "performance_schema_max_statement_stack"; |
| 36 |
|
| 37 |
--echo ##################### |
| 38 |
--echo # Setup |
| 39 |
--echo ##################### |
| 40 |
--source suite/perfschema/include/program_nested_setup.inc |
| 41 |
|
| 42 |
# Truncate summary table |
| 43 |
TRUNCATE performance_schema.events_statements_summary_by_program; |
| 44 |
SELECT OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA FROM |
| 45 |
performance_schema.events_statements_summary_by_program |
| 46 |
WHERE OBJECT_SCHEMA='nested_sp' ORDER BY OBJECT_NAME; |
| 47 |
# Flush status now |
| 48 |
Flush status; |
| 49 |
show global status like "%performance_schema_program_lost%"; |
| 50 |
show global status like "%performance_schema_nested_statement_lost%"; |
| 51 |
|
| 52 |
--echo ##################### |
| 53 |
--echo # Executing Queries |
| 54 |
--echo ##################### |
| 55 |
--source suite/perfschema/include/program_nested_execution.inc |
| 56 |
|
| 57 |
--echo ########################################### |
| 58 |
--echo # Quering PS statement summary table # |
| 59 |
--echo ########################################### |
| 60 |
|
| 61 |
SELECT OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA |
| 62 |
FROM performance_schema.events_statements_summary_by_program |
| 63 |
WHERE OBJECT_SCHEMA='nested_sp' ORDER BY OBJECT_NAME; |
| 64 |
|
| 65 |
# Now check the lost status |
| 66 |
show global status like "%performance_schema_program_lost%"; |
| 67 |
show global status like "%performance_schema_nested_statement_lost%"; |
| 68 |
|
| 69 |
--echo ##################### |
| 70 |
--echo # Cleanup |
| 71 |
--echo ##################### |
| 72 |
--source suite/perfschema/include/program_nested_cleanup.inc |
| 73 |
|
| 74 |
--echo # Restore default settings |
| 75 |
--let $restart_parameters = restart: |
| 76 |
--source include/restart_mysqld.inc |
| 77 |
|