Commit a96b4282 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-26755 innodb.undo_truncate: ilink::assert_linked(): Assertion `prev != 0 && next != 0' failed

close_connections() in mysqld.cc sends a signal to all threads.
But InnoDB is too busy purging, doesn't react immediately.
close_connections() waits 20 seconds, which isn't enough in this
particular case, and then unlinks all threads from
the list and forcibly closes their vio connection.

InnoDB background  threads have no vio connection to close, but
they're unlinked all the same. So when later they finally notice
the shutdown request and try to unlink themselves, they fail to
assert that they're still linked.

Fix: don't assert_linked, as another thread can unlink this THD anytime
parent 4ba74785
...@@ -4557,12 +4557,10 @@ inline void add_to_active_threads(THD *thd) ...@@ -4557,12 +4557,10 @@ inline void add_to_active_threads(THD *thd)
/* /*
This should be called when you want to delete a thd that was not This should be called when you want to delete a thd that was not
running any queries. running any queries.
This function will assert that the THD is linked.
*/ */
inline void unlink_not_visible_thd(THD *thd) inline void unlink_not_visible_thd(THD *thd)
{ {
thd->assert_linked();
mysql_mutex_lock(&LOCK_thread_count); mysql_mutex_lock(&LOCK_thread_count);
thd->unlink(); thd->unlink();
mysql_mutex_unlock(&LOCK_thread_count); mysql_mutex_unlock(&LOCK_thread_count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment