• Brandon Nesterenko's avatar
    MDEV-30619: Parallel Slave SQL Thread Can Update Seconds_Behind_Master with Active Workers · 063f4ac2
    Brandon Nesterenko authored
    MDEV-31749 sporadic assert in MDEV-30619 new test
    
    If the workers of a parallel replica are busy (potentially with long
    queues), but the SQL thread has no events left to distribute (so it
    goes idle), then the next event that comes from the primary will
    update mi->last_master_timestamp with its timestamp, even if the
    workers have not yet finished.
    
    This patch changes the parallel replica logic which updates
    last_master_timestamp after idling from using solely sql_thread_caught_up
    (added in MDEV-29639) to using the latter with rli queued/dequeued
    event counters.
    That is, if  the queued count is equal to the dequeued count, it
    means all events have been processed and the replica is considered
    idle when the driver thread has also distributed all events.
    
    Low level details of the commit include
    - to make a more generalized test for Seconds_Behind_Master on
      the parallel replica, rpl_delayed_parallel_slave_sbm.test
      is renamed to rpl_parallel_sbm.test for this purpose.
    - pause_sql_thread_on_next_event usage was removed
      with the MDEV-30619 fixes. Rather than remove it, we adapt it
      to the needs of this test case
    - added test case to cover SBM spike of relay log read and LMT
      update that was fixed by MDEV-29639
    - rpl_seconds_behind_master_spike.test is made to use
      the negate_clock_diff_with_master debug eval.
    
    Reviewed By:
    ============
    Andrei Elkin <andrei.elkin@mariadb.com>
    063f4ac2
rpl_parallel_sbm.test 7.37 KB