Thank you for your help! If the status of the bug report you submitted changes,
you will be notified. You may return here and check on the status or update
your report at any time. That URL for your bug report is:
http://bugs.mysql.com/110232.
Description:
I am recently testing the parameter "log_slow_extra" in MySQL 8.0.32. During my testing, I am trying to see some number in "Killed: " counter. But, it seems not getting updated.
I tried to kill / terminate the SQL query in different ways. But, there is no change in "Killed: " counter.
from doc, https://dev.mysql.com/doc/refman/8.0/en/slow-query-log.html
Errno: error_number
The statement error number, or 0 if no error occurred.
Killed: N
If the statement was terminated, the error number indicating why, or 0 if the statement terminated normally.
How to repeat:
Scenerio 1: ( terminate the query itself )
--------------------------------------------
mysql> SELECT /*+ MAX_EXECUTION_TIME(200) */ count(*) FROM test;
ERROR 1317 (70100): Query execution was interrupted
from slow log,
# Time: 2023-02-28T10:44:40.189599Z
# User@Host: root[root] @ localhost [] Id: 9
# Query_time: 0.238536 Lock_time: 0.000016 Rows_sent: 0 Rows_examined: 0 Thread_id: 9 Errno: 1317 Killed: 0 Bytes_received: 63 Bytes_sent: 83 Read_first: 0 Read_last: 0 Read_key: 0 Read_next: 0 Read_prev: 0 Read_rnd: 0 Read_rnd_next: 0 Sort_merge_passes: 0 Sort_range_count: 0 Sort_rows: 0 Sort_scan_count: 0 Created_tmp_disk_tables: 0 Created_tmp_tables: 0 Start: 2023-02-28T10:44:39.951063Z End: 2023-02-28T10:44:40.189599Z
SET timestamp=1677581079;
SELECT /*+ MAX_EXECUTION_TIME(200) */ count(*) FROM test;
As you see above, I can see the "Errno: " counter updated. But, "Killed: " counter not updated.
Scenerio 2: ( Manually KILL the query )
-----------------------------------------
mysql> update sri.test set name='killed';
-- query aborted
ERROR 1317 (70100): Query execution was interrupted
from slow log,
# Time: 2023-02-28T11:07:33.979372Z
# User@Host: root[root] @ localhost [] Id: 16
# Query_time: 79.549593 Lock_time: 3.051690 Rows_sent: 0 Rows_examined: 2745264 Thread_id: 16 Errno: 1317 Killed: 0 Bytes_received: 40 Bytes_sent: 44 Read_first: 1 Read_last: 0 Read_key: 1 Read_next: 0 Read_prev: 0 Read_rnd: 0 Read_rnd_next: 2745265 Sort_merge_passes: 0 Sort_range_count: 0 Sort_rows: 0 Sort_scan_count: 0 Created_tmp_disk_tables: 0 Created_tmp_tables: 0 Start: 2023-02-28T11:06:14.429779Z End: 2023-02-28T11:07:33.979372Z
SET timestamp=1677582374;
update sri.test set name='killed';
As you see above, I can see the "Errno: " counter updated. But, "Killed: " counter not updated.
Suggested fix:
When killing the Query, it would be great if we see the "Killed: " counter updated.
Thanks!