Bug #38810 Backup: crash if trigger and event with same name
Submitted: 14 Aug 2008 20:20 Modified: 30 Oct 2008 19:42
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:6.0.7-alpha-debug OS:Linux (SUSE 10 32-bit)
Assigned to: Øystein Grøvlen CPU Architecture:Any
Triage: Triaged: D1 (Critical)

[14 Aug 2008 20:20] Peter Gulutzan
Description:
I create a database, a table, a trigger X, and an event X.
I backup.
I restore.
Crash.

How to repeat:
mysql> create database d3;
Query OK, 1 row affected (0.01 sec)

mysql> use d3;
Database changed
mysql> create table t (s1 int);
Query OK, 0 rows affected (0.07 sec)

mysql> create trigger X before insert on t for each row set @a=5;
Query OK, 0 rows affected (0.00 sec)

mysql> create event X on schedule every 1 second do set @a=5;
Query OK, 0 rows affected (0.00 sec)

mysql> backup database d3 to '26';
+-----------+
| backup_id |
+-----------+
| 1         |
+-----------+
1 row in set (1.02 sec)

mysql> drop database d3;
Query OK, 1 row affected (0.00 sec)

mysql> restore from '26';
ERROR 2013 (HY000): Lost connection to MySQL server during query
[14 Aug 2008 21:24] Miguel Solorzano
Thank you for the bug report.

thd: 0x3645470
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
00B8FED4    mysqld.exe!_NMSG_WRITE()[crt0msg.c:195]
00B7C00A    mysqld.exe!abort()[abort.c:44]
00B76C32    mysqld.exe!_assert()[assert.c:306]
008EE908    mysqld.exe!Backup_restore_ctx::restore_triggers_and_events()[kernel.cc:901]
008EEE86    mysqld.exe!Backup_restore_ctx::do_restore()[kernel.cc:1007]
008ED2B0    mysqld.exe!execute_backup_command()[kernel.cc:195]
0065F1B7    mysqld.exe!mysql_execute_command()[sql_parse.cc:2266]
006680BD    mysqld.exe!mysql_parse()[sql_parse.cc:5845]
0065D3D5    mysqld.exe!dispatch_command()[sql_parse.cc:1120]
0065CC0D    mysqld.exe!do_command()[sql_parse.cc:807]
0076CBE7    mysqld.exe!handle_one_connection()[sql_connect.cc:1153]
008497CD    mysqld.exe!pthread_start()[my_winthread.c:86]
00B7F607    mysqld.exe!_threadstart()[thread.c:196]
7C80B713    kernel32.dll!GetModuleFileNameA()
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 03678F3A=CREATE TABLE `t` (
  `s1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
thd->thread_id=1
thd->killed=NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
[13 Oct 2008 12:28] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/56116

2707 oystein.grovlen@sun.com	2008-10-13
      BUG#38810 Backup: crash if trigger and event with same name
      Issue: Server crashes when restoring a backup image of a database
      with trigger and event with the same names.
      Cause: Dependency table is indexed by name.  Hence, trigger is not added when
      event with same name has already been inserted.
      Fix: Add type id to the key for the dependency table.
[21 Oct 2008 12:41] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/56681

2712 oystein.grovlen@sun.com	2008-10-21
      BUG#38810 Backup: crash if trigger and event with same name
      Issue: Server crashes when restoring a backup image of a database
             with trigger and event with the same names.
      Cause: Dependency table is indexed by name.  Hence, trigger is not added when
             event with same name has already been inserted.
      Fix: Add type id to the key for the dependency table.
[23 Oct 2008 20:23] Chuck Bell
Patch approved with explanation and new bug.
[24 Oct 2008 7:46] Rafal Somla
Good to push.
[24 Oct 2008 8:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/56970

2715 oystein.grovlen@sun.com	2008-10-24
      BUG#38810 Backup: crash if trigger and event with same name
      Issue: Server crashes when restoring a backup image of a database
             with trigger and event with the same names.
      Cause: Dependency table is indexed by name.  Hence, trigger is not added when
             event with same name has already been inserted.
      Fix: Add type id to the key for the dependency table.
[24 Oct 2008 8:20] Øystein Grøvlen
Patch pushed into mysql-6.0-backup (revision 2715)
[30 Oct 2008 12:45] Bugs System
Pushed into 6.0.8-alpha  (revid:oystein.grovlen@sun.com-20081024081118-nfa8im1minwdzvw4) (version source revid:rafal.somla@sun.com-20081024092045-7084gvpu1dgbi5el) (pib:5)
[30 Oct 2008 19:42] Paul Dubois
Noted in 6.0.8 changelog.

RESTORE crashed if a trigger and an event had the same name.