mariadb/storage
Marko Mäkelä 8a86df37ef MDEV-31088 Server freeze due to innodb_change_buffering
A 3-thread deadlock has been frequently observed when using
innodb_change_buffering!=none and innodb_file_per_table=0:

(1) ibuf_merge_or_delete_for_page() holding an exclusive latch on the block
and waiting for an exclusive tablespace latch in fseg_page_is_allocated()
(2) btr_free_but_not_root() in fseg_free_step() waiting for an
exclusive tablespace latch
(3) fsp_alloc_free_page() holding the exclusive tablespace latch and waiting
for a latch on the block, which it is reallocating for something else

While this was reproduced using innodb_file_per_table=0, this hang should
be theoretically possible in .ibd files as well, when the recovery or
cleanup of a failed DROP INDEX or ADD INDEX is executing concurrently
with something that involves page allocation.

ibuf_merge_or_delete_for_page(): Avoid invoking fseg_page_is_allocated()
when block==nullptr. The call was redundant in this case, and it could
cause deadlocks due to latching order violation.

ibuf_read_merge_pages(): Acquire an exclusive tablespace latch
before invoking buf_page_get_gen(), which may cause
fseg_page_is_allocated() to be invoked in ibuf_merge_or_delete_for_page().

Note: This will not fix all latching order violations in this area!
Deadlocks involving ibuf_merge_or_delete_for_page(block!=nullptr) are
still possible if the caller is not acquiring an exclusive tablespace latch
upfront. This would be the case in any read operation that involves a
change buffer merge, such as SELECT, CHECK TABLE, or any DML operation that
cannot be buffered in the change buffer.
2023-06-02 10:44:34 +03:00
..
archive Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
blackhole Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
columnstore Merge branch '10.5' into 10.6 2023-01-31 09:31:42 +01:00
connect Merge 10.5 into 10.6 2023-04-25 13:10:33 +03:00
csv
example Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
federated Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
federatedx Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
heap Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
innobase MDEV-31088 Server freeze due to innodb_change_buffering 2023-06-02 10:44:34 +03:00
maria Merge 10.5 into 10.6 2023-04-11 16:15:19 +03:00
mroonga Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
myisam Merge 10.5 into 10.6 2023-05-23 12:25:39 +03:00
myisammrg Merge 10.5 into 10.6 2023-05-23 12:25:39 +03:00
oqgraph Merge 10.5 into 10.6 2022-01-18 12:59:50 +02:00
perfschema Merge branch '10.5' into 10.6 2023-05-03 09:51:25 +02:00
rocksdb Merge branch '10.5' into 10.6 2023-05-04 18:47:11 +02:00
sequence Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
sphinx Merge branch '10.5' into 10.6 2022-11-02 14:33:20 +01:00
spider Merge 10.5 into 10.6 2023-05-23 12:25:39 +03:00
test_sql_discovery Merge 10.5 into 10.6 2022-09-20 16:53:20 +03:00