MDEV-24671, a test is consuming considerably more time:
The time difference is explained by the following:
MDEV-24671 typically saves 1 second of each lock wait timeout, and the default innodb_lock_wait_timeout is 50 seconds. If you invoke the test like
then it would complete 48 seconds sooner (5782ms for my attempt).
I determined that the time is being spent in the main thread, in close_connections():
During this time, the lock_wait() for the following is being waited for:
Only after the lock wait times out, the close_connections() will proceed to actually invoke innobase_end(). So, until that time, InnoDB is not given any signal that a shutdown has been requested.
If InnoDB knew about the shutdown, it could abort the lock wait earlier.
I initially suspected that this bug is not really caused by
MDEV-24671, that is, if a transaction was already waiting for a lock, it would remain in that state. But, it looks like even with a patch like this:
the test before
MDEV-24671 would finish only 2 seconds slower, and not end up waiting for innodb_lock_wait_timeout.
MDEV-24671, the wait is terminated by lock_wait_timeout_task(), which will wake up once per second and wake up any waiting threads:
Vladislav Vaintroub, can you help with this? You solved similar problems in
MDEV-16264. Could we have an innobase_hton->kill_level_changed(THD*) that is always invoked when thd_kill_level() would change?
I am pretty sure that we do want to give non-waiting transactions a chance to complete execution; invoking innobase_hton->close_connection or innobase_hton->kill_query in their current form ought to be out of the question.