| 1 |
# |
| 2 |
# Various tests to help QA WL#13681 - performance_schema.error_log |
| 3 |
# |
| 4 |
|
| 5 |
|
| 6 |
# Use a sink (and only that sink) that has no pfs.error_log support |
| 7 |
INSTALL COMPONENT 'file://component_log_sink_test'; |
| 8 |
SET @@global.log_error_services="log_filter_internal;log_sink_test"; |
| 9 |
Warnings: |
| 10 |
Note 4002 None of the log-sinks selected in @@global.log_error_services supports writing to the performance schema. The server will not be able to make the current runs' error events available in performance_schema.error_log. To change this, add a log-sink that supports the performance schema to @@global.log_error_services. |
| 11 |
SET @@session.debug="+d,parser_stmt_to_error_log_with_system_prio"; |
| 12 |
SELECT "Hello World"; |
| 13 |
Hello World |
| 14 |
Hello World |
| 15 |
# Must have been unable to add to pfs.error_log |
| 16 |
SELECT COUNT(*)=0 |
| 17 |
FROM performance_schema.error_log |
| 18 |
WHERE logged>=@startup AND data='Parser saw: SELECT "Hello World"'; |
| 19 |
COUNT(*)=0 |
| 20 |
1 |
| 21 |
|
| 22 |
# when starting with only a sink that does not support adding to |
| 23 |
# pfs.error_log and that has no log-parser, the table should be empty |
| 24 |
# after start-up: |
| 25 |
# restart: --log-error-services=log_filter_internal;log_sink_test --log-error=LOG_FILE |
| 26 |
SELECT COUNT(*)=0 |
| 27 |
FROM performance_schema.error_log; |
| 28 |
COUNT(*)=0 |
| 29 |
1 |
| 30 |
SET @@global.log_error_services=DEFAULT; |
| 31 |
DELETE FROM mysql.component |
| 32 |
WHERE component_urn='file://component_log_sink_test'; |
| 33 |
|
| 34 |
# Now add a specific row to the table and show it's there |
| 35 |
# a) with error-log file |
| 36 |
# restart: --log-error=LOG_FILE |
| 37 |
SELECT logged INTO @startup |
| 38 |
FROM performance_schema.error_log |
| 39 |
WHERE error_code="MY-010116" |
| 40 |
ORDER BY logged DESC LIMIT 1; |
| 41 |
SET @@session.debug="+d,parser_stmt_to_error_log_with_system_prio"; |
| 42 |
SELECT "Hello World"; |
| 43 |
Hello World |
| 44 |
Hello World |
| 45 |
SELECT COUNT(*)=1 |
| 46 |
FROM performance_schema.error_log |
| 47 |
WHERE logged>=@startup AND data='Parser saw: SELECT "Hello World"'; |
| 48 |
COUNT(*)=1 |
| 49 |
1 |
| 50 |
# b) without error-log file |
| 51 |
# restart: |
| 52 |
SELECT logged INTO @startup |
| 53 |
FROM performance_schema.error_log |
| 54 |
WHERE error_code="MY-010116" |
| 55 |
ORDER BY logged DESC LIMIT 1; |
| 56 |
# Should fail, we should not see entries from the previous run's |
| 57 |
# error log file as we started without reading it. |
| 58 |
SELECT error_code,data |
| 59 |
FROM performance_schema.error_log |
| 60 |
WHERE logged>=@startup AND data='Parser saw: SELECT "Hello World"'; |
| 61 |
error_code data |
| 62 |
# But there should be entries in the table from start-up. |
| 63 |
SELECT COUNT(*)>1 FROM performance_schema.error_log; |
| 64 |
COUNT(*)>1 |
| 65 |
1 |
| 66 |
# Now let's re-add our entry. |
| 67 |
SET @@session.debug="+d,parser_stmt_to_error_log_with_system_prio"; |
| 68 |
SELECT "Hello World"; |
| 69 |
Hello World |
| 70 |
Hello World |
| 71 |
# And now finally, it should be available in the table. |
| 72 |
SELECT error_code,data |
| 73 |
FROM performance_schema.error_log |
| 74 |
WHERE logged>=@startup AND data='Parser saw: SELECT "Hello World"'; |
| 75 |
error_code data |
| 76 |
MY-010000 Parser saw: SELECT "Hello World" |
| 77 |
|
| 78 |
# clean up |
| 79 |
SET @@session.debug="-d,parser_stmt_to_error_log_with_system_prio"; |
| 80 |
|
| 81 |
# Done! |