1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fixed crash in aria recovery when using bulk insert

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.
This commit is contained in:
Monty
2020-05-26 20:04:47 +03:00
parent 0c1f97b3ab
commit 403dacf6a9
7 changed files with 89 additions and 19 deletions

View File

@ -4164,6 +4164,19 @@ int handler::ha_repair(THD* thd, HA_CHECK_OPT* check_opt)
}
/**
End bulk insert
*/
int handler::ha_end_bulk_insert()
{
DBUG_ENTER("handler::ha_end_bulk_insert");
DBUG_EXECUTE_IF("crash_end_bulk_insert",
{ extra(HA_EXTRA_FLUSH) ; DBUG_SUICIDE();});
estimation_rows_to_insert= 0;
DBUG_RETURN(end_bulk_insert());
}
/**
Bulk update row: public interface.