Bug #25082 | default database change on trigger execution breaks replication | ||
---|---|---|---|
Submitted: | 14 Dec 2006 21:28 | Modified: | 11 Apr 2007 1:40 |
Reporter: | Kolbe Kegel | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Stored Routines | Severity: | S2 (Serious) |
Version: | 5.0.30 | OS: | Any |
Assigned to: | Alexander Nozdrin | CPU Architecture: | Any |
Tags: | replication, triggers |
[14 Dec 2006 21:28]
Kolbe Kegel
[14 Dec 2006 21:48]
Kolbe Kegel
Andrei pointed out that it's not necessary to set up the replicate-wild-do-table rule to repeat this, since apparently the slave will allow the replication thread to set the default to a database that doesn't exist, as long as that database is not needed to satisfy any DML or DDL operations. So, this problem can be repeated without any replicate-* rules, as long as the "db1" database does not exist on the slave.
[17 Dec 2006 15:31]
Andrei Elkin
The reason of the failure is error procuded by mysql_change_db called by epilog of trigger's execution to restore the default db. On slave, currently it's acceptable not to have such db where there would be no operations executed. However trigger's handling is not aware of where execution has been passed to it from.
[23 Mar 2007 22:25]
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/22844 ChangeSet@1.2489, 2007-03-23 16:33:31+03:00, anozdrin@booka.opbmk +8 -0 Fix BUG#25082: default database change on trigger execution breaks replication. Basically, the problem was that we could not switch back to the database that does not exist anymore. The fix is to always succeed changing database if we are called from stored-routine execution.
[27 Mar 2007 17:51]
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/23056 ChangeSet@1.2422, 2007-03-27 21:55:01+04:00, anozdrin@alik.opbmk +8 -0 Fix for BUG#25082: default database change on trigger execution breaks replication. When a stored routine is executed, we switch current database to the database, in which the routine has been created. When the stored routine finishes, we switch back to the original database. The problem was that if the original database does not exist (anymore) after routine execution, we raised an error. The fix is to report a warning, and switch to the NULL database.
[3 Apr 2007 23:24]
Konstantin Osipov
Pushed into 5.0.40 and 5.1.18
[11 Apr 2007 1:40]
Paul DuBois
Noted in 5.0.40, 5.1.18 changelogs. Restoration of the default database after stored routine or trigger execution on a slave could cause replication to stop if the database no longer existed.
[18 Apr 2007 15:46]
Bugs System
Pushed into 5.1.18-beta
[18 Apr 2007 15:47]
Bugs System
Pushed into 5.0.42
[26 Apr 2007 19:29]
Paul DuBois
Moved the 5.0.40 changelog entry to 5.0.42.