Bug #21785 Server crashes after rename of the log table
Submitted: 22 Aug 2006 13:59 Modified: 7 Nov 2006 18:50
Reporter: Petr Chardin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:MySQL 5-1 OS:Linux (Suse 10.0)
Assigned to: Petr Chardin CPU Architecture:Any

[22 Aug 2006 13:59] Petr Chardin
Description:
Server crashes after issuing the following set of commands:

use mysql;
select * from general_log;
RENAME TABLE general_log TO renamed_general_log;
flush logs;
flush logs;

How to repeat:
see above

Suggested fix:
Disallow rename of the log tables
[22 Aug 2006 14:24] MySQL Verification Team
5.1 Back trace on Suse 10 32-bits

Attachment: bt-21785.txt (text/plain), 4.08 KiB.

[22 Aug 2006 14:27] MySQL Verification Team
Thank you for the bug report. Verified as described (back trace attached).
[7 Sep 2006 7:43] 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/11518

ChangeSet@1.2285, 2006-09-07 11:30:47+04:00, petr@mysql.com +6 -0
  Fix for Bug #17544 "Cannot do atomic log rotate" and
  Bug #21785 "Server crashes after rename of the log table"
  
  From now on, one should use RENAME to perform a log table
  rotation (this should also be reflected in the manual).
  
  Here is a sample:
  
  use mysql;
  CREATE TABLE IF NOT EXISTS general_log2 LIKE general_log;
  RENAME TABLE general_log TO general_log_backup, general_log2 TO general_log;
  
  The rules for Rename of the log tables are following:
        IF   1. Log tables are enabled
        AND  2. Rename operates on the log table and nothing is being
                renamed to the log table.
        DO   3. Throw an error message.
        ELSE 4. Perform rename.
  
  The very RENAME query will go the the old (backup) table. This is
  consistent with the behavoiur we have with binlog ROTATE LOGS
  statement.
[7 Nov 2006 18:50] Paul DuBois
Noted in 5.1.13 changelog.