Bug #16406 Events: DROP DATABASE doesn't automatically drop events
Submitted: 12 Jan 2006 3:51 Modified: 2 Mar 2006 21:24
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:5.1.6-alpha-debug OS:Linux (linux)
Assigned to: Andrey Hristov CPU Architecture:Any

[12 Jan 2006 3:51] Peter Gulutzan
Description:
If I drop a database, then the objects inside the database
should be dropped too. That does happen for other objects.
It doesn't happen for events.

How to repeat:

mysql> create database db88;
Query OK, 1 row affected (0.05 sec)

mysql> create event db88.e_13 on schedule every 1 second do set @a = 5;
Query OK, 1 row affected (0.00 sec)

mysql> select count(*) from mysql.event where name = 'e_13';
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.00 sec)

mysql> drop database db88;
Query OK, 0 rows affected (0.00 sec)

mysql> select count(*) from mysql.event where name = 'e_13';
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.01 sec)
[9 Feb 2006 12:14] 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/2360
[9 Feb 2006 13:20] 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/2363
[14 Feb 2006 17:16] Andrey Hristov
When closed, please close bug #17373, which will be fixed by the changes in the scheduler.
[15 Feb 2006 9:05] Andrey Hristov
When closing look at bug#17404 and probably close it. The new executor from this patch should fix the problem.
[15 Feb 2006 19:59] 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/2676
[15 Feb 2006 23:45] 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/2697
[16 Feb 2006 4:23] 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/2704
[16 Feb 2006 15:25] Andrey Hristov
Fixed as part of 5.1.7 . Improves the stability of the scheduler.
[21 Feb 2006 2:15] Paul DuBois
Noted in 5.1.7 changelog.

          <literal>DROP DATABASE</literal> did not drop events for the
          database. (Bug #16406)
[21 Feb 2006 16:50] Peter Gulutzan
I have placed this bug back in "verified" state because
mysqld displays an error.

Using 5.0.18 built 2006-02-21 with BUILD/compile-pentium-debug, I say:

mysql> create database db5;
Query OK, 1 row affected (0.01 sec)

mysql> use db5;
Database changed
mysql> create event e on schedule every 1 second do drop database db5;
Query OK, 1 row affected (0.00 sec)

mysql> set global event_scheduler = 1;
Query OK, 0 rows affected (0.00 sec)

Okay. But on the mysqld screen, I see an "error":

060221  9:44:11 [Note] SCHEDULER: Executing event db5.e of
 root@localhost [EXPR:1]
Error: Freeing unallocated data at line 900, 'sql_db.cc'
060221  9:44:11 [Note] SCHEDULER: Executed event db5.e of root@localhost  [EXPR:1]. RetCode=0
[1 Mar 2006 1:18] Andrey Hristov
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/3288
[2 Mar 2006 21:24] Andrey Hristov
Fixed. No need to document, already documented.