Description:
The concurrent test from 'How to repeat' section reports that the server returns an error like
CREATE TRIGGER tr AFTER INSERT ON t2 FOR EACH ROW SET @a=1 failed: 7 Error on rename of './test/tr.TRN~' to './test/tr.TRN' (Errcode: 2 - No such file or directory)
Further attempt to deal with the trigger reveals problems. The trigger can be seen via SHOW TRIGGERS:
MySQL [test]> show triggers;
+---------+--------+-------+-----------+--------+---------+------------------------+----------------+----------------------+----------------------+--------------------+
| Trigger | Event | Table | Statement | Timing | Created | sql_mode | Definer | character_set_client | collation_connection | Database Collation |
+---------+--------+-------+-----------+--------+---------+------------------------+----------------+----------------------+----------------------+--------------------+
| tr | INSERT | t1 | SET @a=1 | AFTER | NULL | NO_ENGINE_SUBSTITUTION | root@127.0.0.1 | latin1 | latin1_swedish_ci | latin1_swedish_ci |
+---------+--------+-------+-----------+--------+---------+------------------------+----------------+----------------------+----------------------+--------------------+
1 row in set (0.00 sec)
but not via SHOW CREATE TRIGGER:
MySQL [test]> show create trigger tr;
ERROR 1360 (HY000): Trigger does not exist
It can't be dropped, either.
All that because the trigger information went out of sync.
The TRN file says the trigger belongs to t2:
$ cat tr.TRN
TYPE=TRIGGERNAME
trigger_table=t2
but the TRG file belongs to t1:
$ ls -l *.TRG
-rw-rw---- 1 elenst elenst 255 Sep 30 19:02 t1.TRG
It's obviously an old problem, but I can't find the corresponding bug report. I'll appreciate if you point at one.
How to repeat:
# Grammar 1.yy
query_init:
CREATE TABLE IF NOT EXISTS t1 (i INT); CREATE TABLE t2 LIKE t1;
my_table:
t1 | t2 ;
query:
CREATE TRIGGER tr AFTER INSERT ON my_table FOR EACH ROW SET @a=1
| DROP TRIGGER tr
;
# End of grammar
# Command line
perl ./runall.pl --grammar=1.yy --threads=2 --skip-gendata --duration=60 --queries=100M --basedir=<basedir> --vardir=<vardir>