You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MDEV-29930 Lock order inversion in ibuf_remove_free_page()
The function ibuf_remove_free_page() was waiting for ibuf_mutex
while holding ibuf.index->lock. This constitutes a lock order
inversion and may cause InnoDB to hang when innodb_change_buffering
is enabled and ibuf_merge_or_delete_for_page() is being executed
concurrently.
In fact, there is no need for ibuf_remove_free_page() to reacquire
ibuf_mutex if we make ibuf.seg_size and ibuf.free_list_len
protected by the ibuf.index root page latch rather than ibuf_mutex.
ibuf.seg_size: Instead of ibuf_mutex, let the ibuf.index root page latch
protect this field, just like ibuf.empty.
ibuf.free_list_len: Document that modifications are protected by
the ibuf.index root page latch.
ibuf_init_at_db_start(): Acquire the root page latch before updating
ibuf.seg_size.
ibuf_data_enough_free_for_insert(), ibuf_data_too_much_free():
Note that ibuf.free_list_len is not fully protected.
ibuf_remove_free_page(): Acquire the ibuf.index root page latch before
accessing ibuf.free_list_len. Simplify the way how the root page latch
is released and reacquired. Acquire and release ibuf_mutex only once.
ibuf_print(): Acquire the ibuf.index root page latch before reading
ibuf.free_list_len and ibuf.seg_size.
0 commit comments