• Kristian Nielsen's avatar
    MDEV-31273: Refactor MYSQL_BIN_LOG::write_cache() · 24c923d4
    Kristian Nielsen authored
    Preparatory patch for pre-computing binlog checksums outside of holding
    LOCK_log.
    
    The existing code for MYSQL_BIN_LOG::write_cache() was needlessly complex
    and very hard to understand and modify for handling the new case where
    pre-computed checksums are already present in the IO_CACHE.
    
    Greatly simplify the logic by replacing the (implicit) state machine with
    direct code that pulls the events one by one from the IO_CACHE. This removes
    a lot of state flags and avoids duplicate code for handling full vs. split
    headers.
    
    This also removes the need for the CacheWriter class. As a bonus, this fixes
    the bug that CacheWriter::write() was completely ignoring write errors. No
    other functional changes are done with this patch, only code cleanup.
    Reviewed-by: default avatarMonty <monty@mariadb.org>
    Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
    24c923d4
log.cc 376 KB