• Kristian Nielsen's avatar
    Fix accumulation of old rows in mysql.gtid_slave_pos · 2f4a0c5b
    Kristian Nielsen authored
    This would happen especially in optimistic parallel replication, where there
    is a good chance that a transaction will be rolled back (due to conflicts)
    after it has executed record_gtid(). If the transaction did any deletions of
    old rows as part of record_gtid(), those deletions will be undone as well.
    And the code did not properly ensure that the deletions would be re-tried.
    
    This patch makes record_gtid() remember the list of deletions done as part
    of a transaction. Then in rpl_slave_state::update() when the changes have
    been committed, we discard the list. However, in case of error and rollback,
    in cleanup_context() we will instead put the list back into
    rpl_global_gtid_slave_state so that the deletions will be re-tried later.
    
    Probably fixes part of the cause of MDEV-12147 as well.
    Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
    2f4a0c5b
rpl_parallel_optimistic.test 17 KB