mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 18:20:07 +01:00
ffe7f19fa6
The purpose of this task is to ensure that CREATE TRIGGER is atomic When a trigger is created, we first create a trigger_name.TRN file and then create or update the table_name.TRG files. This is done by creating .TRN~ and .TRG~ files and replacing (or creating) the result files. The new logic is - Log CREATE TRIGGER to DDL log, with a marker if old trigger existsted - If old .TRN or .TRG files exists, make backup copies of these - Create the new .TRN and .TRG files as before - Remove the backups Crash recovery - If query has been logged to binary log: - delete any left over backup files - else - Delete any old .TRN~ or .TRG~ files - If there was orignally some triggers (old .TRG file existed) - If we crashed before creating all backup files - Delete existing backup files - else - Restore backup files - end - Delete .TRN and .TRG file (as there was no triggers before One benefit of the new code is that CREATE OR REPLACE TRIGGER is now totally atomic even if there existed an old trigger: Either the old trigger will be replaced or the old one will be left untouched. Other things: - If sql_create_definition_file() would fail, there could be memory leaks in CREATE TRIGGER, DROP TRIGGER or CREATE OR REPLACE TRIGGER. This is now fixed.
19 lines
748 B
Text
19 lines
748 B
Text
To debug a the ddl_recovery code in a failing ddl_recovery test one could do
|
|
the following:
|
|
|
|
- Add # before --exec echo "restart" ...
|
|
- Force $e (engine), $c (crash point) and $r (crash position) to the values
|
|
where things goes wrong. See comments in alter_table.test for how to do this.
|
|
- start mariadbd in a debugger
|
|
|
|
run the following in the debugger
|
|
(Replace 'atomic.create_trigger' with the failing test case)
|
|
|
|
#break ha_recover
|
|
#break MYSQL_BIN_LOG::recover
|
|
#break MYSQL_BIN_LOG::open
|
|
|
|
break ddl_log_close_binlogged_events
|
|
break ddl_log_execute_action
|
|
break ddl_log_execute_recovery
|
|
run --datadir=/my/maria-10.6/mysql-test/var/log/atomic.create_trigger/mysqld.1/data --log-basename=master --log-bin-index=mysqld-bin.index --debug --log-bin
|