• Kristian Nielsen's avatar
    MDEV-22351: InnoDB may report incorrect binlog position information after RESET MASTER · 398dc1fd
    Kristian Nielsen authored
    From MariaDB 10.3.5, the saved binlog position is stored in multiple
    entries in each rseg header, and during recovery the most recent of
    them is selected as the postion to recover. The comparison between
    different entries is by comparing the binlog file name and offset.
    This fails if the binlog file name changes to something that compares
    smaller, which can happen from RESET MASTER (which goes back to the
    suffix .000001) or from renaming the basename of the binlog. As a
    result, the wrong position can be recovered after RESET MASTER or
    binlog rename.
    
    This commit writes an 8-byte incrementing version number with each
    position entry. The version is allocated during
    innobase_commit_ordered(), which ensures that a higher version number
    will correspond to a more recent commit. The recovered position is
    then the entry with the highest version number.
    
    If starting on a database written by earlier server version, the code
    falls back to the old methods of comparing position entries.
    Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
    398dc1fd
trx0rseg.cc 24.6 KB