| 1 |
--echo # |
| 2 |
--echo # Various tests to help QA WL#13681 - performance_schema.error_log |
| 3 |
--echo # |
| 4 |
--echo |
| 5 |
|
| 6 |
# We need debug features so we can add specific messages to the error log |
| 7 |
# in a defined way. If you need to add a test case that does not rely on debug |
| 8 |
# features, add it to error_log.test instead! |
| 9 |
--source include/have_debug.inc |
| 10 |
|
| 11 |
--echo |
| 12 |
--echo # Use a sink (and only that sink) that has no pfs.error_log support |
| 13 |
|
| 14 |
INSTALL COMPONENT 'file://component_log_sink_test'; |
| 15 |
SET @@global.log_error_services="log_filter_internal;log_sink_test"; |
| 16 |
|
| 17 |
SET @@session.debug="+d,parser_stmt_to_error_log_with_system_prio"; |
| 18 |
SELECT "Hello World"; |
| 19 |
|
| 20 |
--echo # Must have been unable to add to pfs.error_log |
| 21 |
SELECT COUNT(*)=0 |
| 22 |
FROM performance_schema.error_log |
| 23 |
WHERE logged>=@startup AND data='Parser saw: SELECT "Hello World"'; |
| 24 |
|
| 25 |
--echo |
| 26 |
--echo # when starting with only a sink that does not support adding to |
| 27 |
--echo # pfs.error_log and that has no log-parser, the table should be empty |
| 28 |
--echo # after start-up: |
| 29 |
--let LOG_FILE=$MYSQLTEST_VARDIR/tmp/wl13681.err |
| 30 |
--let $log_services="log_filter_internal;log_sink_test" |
| 31 |
--let restart_parameters="restart: --log-error-services=$log_services --log-error=$LOG_FILE" |
| 32 |
--replace_result $LOG_FILE LOG_FILE |
| 33 |
--source include/restart_mysqld.inc |
| 34 |
SELECT COUNT(*)=0 |
| 35 |
FROM performance_schema.error_log; |
| 36 |
|
| 37 |
# reset to default services so we can UNINSTALL the test-sink |
| 38 |
SET @@global.log_error_services=DEFAULT; |
| 39 |
|
| 40 |
# remove test sink |
| 41 |
DELETE FROM mysql.component |
| 42 |
WHERE component_urn='file://component_log_sink_test'; |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
--echo |
| 47 |
--echo # Now add a specific row to the table and show it's there |
| 48 |
--echo # a) with error-log file |
| 49 |
|
| 50 |
--let restart_parameters="restart: --log-error=$LOG_FILE" |
| 51 |
--replace_result $LOG_FILE LOG_FILE |
| 52 |
--source include/restart_mysqld.inc |
| 53 |
SELECT logged INTO @startup |
| 54 |
FROM performance_schema.error_log |
| 55 |
WHERE error_code="MY-010116" |
| 56 |
ORDER BY logged DESC LIMIT 1; |
| 57 |
|
| 58 |
SET @@session.debug="+d,parser_stmt_to_error_log_with_system_prio"; |
| 59 |
|
| 60 |
SELECT "Hello World"; |
| 61 |
|
| 62 |
SELECT COUNT(*)=1 |
| 63 |
FROM performance_schema.error_log |
| 64 |
WHERE logged>=@startup AND data='Parser saw: SELECT "Hello World"'; |
| 65 |
|
| 66 |
--echo # b) without error-log file |
| 67 |
--let restart_parameters="restart: " |
| 68 |
--source include/restart_mysqld.inc |
| 69 |
SELECT logged INTO @startup |
| 70 |
FROM performance_schema.error_log |
| 71 |
WHERE error_code="MY-010116" |
| 72 |
ORDER BY logged DESC LIMIT 1; |
| 73 |
|
| 74 |
--echo # Should fail, we should not see entries from the previous run's |
| 75 |
--echo # error log file as we started without reading it. |
| 76 |
SELECT error_code,data |
| 77 |
FROM performance_schema.error_log |
| 78 |
WHERE logged>=@startup AND data='Parser saw: SELECT "Hello World"'; |
| 79 |
|
| 80 |
--echo # But there should be entries in the table from start-up. |
| 81 |
SELECT COUNT(*)>1 FROM performance_schema.error_log; |
| 82 |
|
| 83 |
--echo # Now let's re-add our entry. |
| 84 |
SET @@session.debug="+d,parser_stmt_to_error_log_with_system_prio"; |
| 85 |
SELECT "Hello World"; |
| 86 |
|
| 87 |
--echo # And now finally, it should be available in the table. |
| 88 |
SELECT error_code,data |
| 89 |
FROM performance_schema.error_log |
| 90 |
WHERE logged>=@startup AND data='Parser saw: SELECT "Hello World"'; |
| 91 |
|
| 92 |
--echo |
| 93 |
--echo # clean up |
| 94 |
SET @@session.debug="-d,parser_stmt_to_error_log_with_system_prio"; |
| 95 |
--remove_file $LOG_FILE |
| 96 |
|
| 97 |
--echo |
| 98 |
--echo # Done! |