• Marko Mäkelä's avatar
    MDEV-14407 Assertion failure during rollback · db253057
    Marko Mäkelä authored
    Rollback attempted to dereference DB_ROLL_PTR=0, which cannot possibly
    be a valid undo log pointer. A safe canonical value would be
    roll_ptr_t(1) << ROLL_PTR_INSERT_FLAG_POS
    which is what was chosen in MDEV-12288.
    
    This bug was reproduced in 10.3 only. Potentially, the problem could
    have been introduced by MDEV-11415, which suppresses undo logging for
    ALGORITHM=COPY operations. In those operations, we should actually
    have written the safe value of DB_ROLL_PTR instead of writing 0.
    However, the test in commit 5421e3ae
    demonstrates that access to the rebuilt table by earlier-started
    transactions should actually have been refused with ER_TABLE_DEF_CHANGED.
    
    btr_cur_ins_lock_and_undo(): When undo logging is disabled, use the
    safe value of DB_ROLL_PTR.
    
    btr_cur_optimistic_insert(): Validate the DB_TRX_ID,DB_ROLL_PTR before
    inserting into a clustered index leaf page.
    
    ins_node_t::sys_buf[]: Replaces row_id_buf and trx_id_buf and some
    heap usage.
    
    row_ins_alloc_sys_fields(): Initialize ins_node_t::sys_buf[].
    
    trx_undo_page_report_modify(): Assert that the DB_ROLL_PTR is not 0.
    
    trx_undo_get_undo_rec_low(): Assert that the roll_ptr is valid before
    trying to dereference it.
    
    dict_index_t::is_primary(): Check if the index is the primary key.
    db253057
row0ins.h 9.42 KB