• Monty's avatar
    Fixed crash in aria recovery when using bulk insert · 403dacf6
    Monty authored
    MDEV-20578 Got error 126 when executing undo undo_key_delete
    upon Aria crash recovery
    
    The crash happens in this scenario:
    - Table with unique keys and non unique keys
    - Batch insert (LOAD DATA or INSERT ... SELECT) with REPLACE
    - Some insert succeeds followed by duplicate key error
    
    In the above scenario the table gets corrupted.
    
    The bug was that we don't generate any undo entry for the
    failed insert as the whole insert can be ignored by undo.
    The code did however not take into account that when bulk
    insert is used, we would write cached keys to the file on
    failure and undo would wrongly ignore these.
    
    Fixed by moving the writing of the cache keys after we write
    the aborted-insert event to the log.
    403dacf6
bulk_insert_crash.test 1.07 KB