Bug #110232 "Killed" counter is not updated with "log_slow_extra" enabled
Submitted: 28 Feb 2023 11:10 Modified: 1 Mar 2023 9:11
Reporter: Sri Sakthivel Durai Pandian Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:MySQL 8.0.32 OS:Ubuntu (22.04)
Assigned to: CPU Architecture:ARM

[28 Feb 2023 11:10] Sri Sakthivel Durai Pandian
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!
[28 Feb 2023 15:00] MySQL Verification Team
Hi Mr. Pandian,

Thank you for your bug report.

However , .........

MySQL Enterprise Audit  is a commercial product/plugin and using community Bugs DB is not an appropriate place to report issues against this product/plugin. If you are Oracle customer, please open SR and we will assist you via our Support team.

Thank you very much.

Not a bug.
[1 Mar 2023 9:11] MySQL Verification Team
Hello Pandian,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh
[1 Mar 2023 9:30] MySQL Verification Team
Related - Bug #98220