Bug #39339 How to stop the replication slave when temporary tables are used
Submitted: 9 Sep 2008 12:02 Modified: 22 Sep 2008 1:22
Reporter: Axel Schwenke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S2 (Serious)
Version:5.0+ OS:Any
Assigned to: Jon Stephens CPU Architecture:Any

[9 Sep 2008 12:02] Axel Schwenke
Description:
The procedure outlined in the manual here: http://dev.mysql.com/doc/refman/5.0/en/replication-features-temptables.html is wrong. Specifically the combination of steps 1. and 4. is wrong:

> 1. Issue a STOP SLAVE statement.
>
> 4. If the value is not 0, restart the slave SQL thread with START SLAVE SQL_THREAD.

The problem is this: step 1. stops the I/O thread, but step 4. does not start it again. If there is a DROP TEMPORARY TABLE statement in the masters binlog, it will not make it to the slave. Temporary table will never be closed on the slave. The procedure will not terminate :(

How to repeat:
- open a temporary table on the master
- while the temp table is still open, start the procedure from the manual
- now drop the temporary table on the master
- it will not vanish from the slave until you (re)start the I/O thread

Suggested fix:
The procedure should be:

1. STOP SLAVE SQL_THREAD
...
[22 Sep 2008 1:22] Jon Stephens
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.