• Kristian Nielsen's avatar
    MDEV-7818: Deadlock occurring with parallel replication and FTWRL · ba025501
    Kristian Nielsen authored
    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.
    ba025501
rpl_parallel.h 12.3 KB