• Marko Mäkelä's avatar
    MDEV-15914: Restore MLOG_UNDO_INSERT · 76c62bc6
    Marko Mäkelä authored
    trx_undof_page_add_undo_rec_log(): Write the MLOG_UNDO_INSERT
    record instead of the equivalent MLOG_2BYTES and MLOG_WRITE_STRING.
    This essentially reverts commit 9ee8917d.
    
    In MariaDB 10.3, I attempted to simplify the crash recovery code
    by making use of lower-level redo log records. It turns out that
    we must keep the redo log parsing code in order to allow crash-upgrade
    from older MariaDB versions (MDEV-14848).
    
    Now, it further turns out that the InnoDB redo log record format is
    suboptimal for logging multiple changes to a single page. This simple
    change to the redo logging of undo log significantly affects the
    INSERT and UPDATE performance.
    
    Essentially, we wrote
    	(space_id,page_number,MLOG_2BYTES,2 bytes)
    	(space_id,page_number,MLOG_WRITE_STRING,N+4 bytes)
    instead of the previously written
    	(space_id,page_number,MLOG_UNDO_INSERT,N+2 bytes)
    
    The added redo log volume caused a single-threaded INSERT
    (without innodb_adaptive_hash_index) of
    1,000,000 rows to consume 11 seconds instead of 9 seconds,
    and a subsequent UPDATE of 30,000,000 rows to consume 64 seconds
    instead of 58 seconds. If we omitted all redo logging for the
    undo log, the INSERT would consume only 4 seconds.
    76c62bc6
trx0rec.h 13.1 KB