• Sujatha's avatar
    MDEV-25958: rpl_semi_sync_fail_over.test fails in buildbot · 475f69b9
    Sujatha authored
    Analysis:
    ========
    In case multi binlog truncation scenario debug sync points are in the
    following order.
    
    Two inserts are done on master as shown below.
    
    INSERT INTO t1 VALUES (4, REPEAT("x", 4100)
    commit_after_release_LOCK_after_binlog_sync
    
    INSERT INTO t1 VALUES (5, REPEAT("x", 4100)
    commit_after_release_LOCK_log
    
    First insert debug sync ensures that transaction is synced to binlog and
    not committed but it reached slave through semi sync.
    
    Second insert debug sync ensures that transaction is synced to binlog and
    not committed. It doesn't ensure that 'INSERT 5' reached slave.
    
    Most of the times INSERT 5 reaches slave, hence when it is promoted as
    master it sends 4,5 to slave. But occasionally 5 may not reach slave in
    those cases post recovery master will have only 4. When row 6 is inserted
    Master has 4-6 and Slave has 4,5,6.
    
    This results in test failure.
    
    Fix:
    ===
    For the first insert use 'commit_before_get_LOCK_commit_ordered' debug sync
    point, it will ensure that binlog was sent to slave and slave has
    acknowledged the receipt. Now enable debug code such that when the next
    transaction is written to binary log, dump thread will read and send it
    across the network and notify the server to be get killed. Insert row 5
    and wait for notification from dump thread. Kill the server. This ensures
    that both 4 and 5 have reached the semi-sync slave.
    
    Added a new test case:
    Insert two rows on master such that first is present in master's binlog and
    reached semi sync slave. Second insert should be flushed to binlog but not
    sent to slave. Now crash and fail over to slave. The promoted master will send
    the extra transaction to slave.
    475f69b9
rpl_semi_sync_fail_over.result 9.19 KB