mirror of
https://github.com/MariaDB/server.git
synced 2025-08-31 22:22:30 +03:00
MDEV-7818: Deadlock occurring with parallel replication and FTWRL
Problem is that FLUSH TABLES WITH READ LOCK first blocks threads from starting new commits, then waits for running commits to complete. But in-order parallel replication needs commits to happen in a particular order, so this can easily deadlock. To fix this problem, this patch introduces a way to temporarily pause the parallel replication worker threads. Before starting FTWRL, we let all worker threads complete in-progress transactions, and then wait. Then we proceed to take the global read lock. Once the lock is obtained, we unpause the worker threads. Now commits are blocked from starting by the global read lock, so the deadlock will no longer occur.
This commit is contained in:
@@ -6,6 +6,7 @@ user1 statement/sql/flush flush tables with read lock
|
||||
username event_name nesting_event_type
|
||||
username event_name nesting_event_type
|
||||
user1 stage/sql/init STATEMENT
|
||||
user1 stage/sql/init STATEMENT
|
||||
user1 stage/sql/query end STATEMENT
|
||||
user1 stage/sql/closing tables STATEMENT
|
||||
user1 stage/sql/freeing items STATEMENT
|
||||
|
Reference in New Issue
Block a user