Bug #21966 Strange warnings on create like/repair of the log tables
Submitted: 1 Sep 2006 13:39 Modified: 7 Nov 2006 18:28
Reporter: Petr Chardin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:5.1 OS:Linux (Linux)
Assigned to: Petr Chardin CPU Architecture:Any

[1 Sep 2006 13:39] Petr Chardin
Description:
Incorrect warnings occur on repair of the log table

How to repeat:
mysql> repair table general_log;
+-------------------+--------+----------+----------+
| Table             | Op     | Msg_type | Msg_text |
+-------------------+--------+----------+----------+
| mysql.general_log | repair | status   | OK       | 
+-------------------+--------+----------+----------+
1 row in set, 1 warning (0.04 sec)

mysql> show warnings;
+-------+------+----------------------------------------------------------------+
| Level | Code | Message                                                        |
+-------+------+----------------------------------------------------------------+
| Error | 1542 | You can't write-lock a log table. Only read access is possible | 
+-------+------+----------------------------------------------------------------+
1 row in set (0.00 sec)
[1 Sep 2006 20:47] MySQL Verification Team
Thank you for the bug report.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.1.12-beta-debug-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> repair table general_log;
+-------------------+--------+----------+----------+
| Table             | Op     | Msg_type | Msg_text |
+-------------------+--------+----------+----------+
| mysql.general_log | repair | status   | OK       | 
+-------------------+--------+----------+----------+
1 row in set, 1 warning (0.00 sec)

mysql> show warnings;
+-------+------+----------------------------------------------------------------+
| Level | Code | Message                                                        |
+-------+------+----------------------------------------------------------------+
| Error | 1542 | You can't write-lock a log table. Only read access is possible | 
+-------+------+----------------------------------------------------------------+
1 row in set (0.00 sec)
[5 Sep 2006 13:49] Petr Chardin
Same warnings occur during Create table like general[/slow]_log
[11 Sep 2006 20:03] 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/11717

ChangeSet@1.2286, 2006-09-11 23:51:14+04:00, petr@mysql.com +12 -0
  Fix for Bug #21966 "Strange warnings on create like/repair of the log tables"
  The fix solves two problems:
  1) Makes REPAIR of the log table exclusive operation (as it should be), thus
     eliminating lock-related warnings. and
  2) Updates CREATE LIKE TABLE to use usual read lock on the source table rather
     then name lock, which is too restrictive. This way we get rid of another
     log table-related warning, which occured because of the above fact
     (as a side-effect, name lock resulted in a warning).
[15 Sep 2006 9:34] 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/12000

ChangeSet@1.2307, 2006-09-15 13:21:14+04:00, petr@mysql.com +13 -0
  Fix for Bug #17544 "Cannot do atomic log rotate",
  Bug #21785 "Server crashes after rename of the log table" and
  Bug #21966 "Strange warnings on create like/repair of the log
              tables"
  
  According to the patch, 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.
  
  Other problems, which are solved by the patch are:
  
  1) Now REPAIR of the log table is exclusive operation (as it should be), this
     also eliminates lock-related warnings. and
  2) CREATE LIKE TABLE now usese usual read lock on the source table rather
     then name lock, which is too restrictive. This way we get rid of another
     log table-related warning, which occured because of the above fact
     (as a side-effect, name lock resulted in a warning).
[2 Oct 2006 22:01] 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/12969

ChangeSet@1.2307, 2006-10-03 01:47:11+04:00, petr@mysql.com +15 -0
  Fix for Bug #17544 "Cannot do atomic log rotate",
  Bug #21785 "Server crashes after rename of the log table" and
  Bug #21966 "Strange warnings on create like/repair of the log
              tables"
  
  According to the patch, 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.
  
  Other problems, which are solved by the patch are:
  
  1) Now REPAIR of the log table is exclusive operation (as it should be), this
     also eliminates lock-related warnings. and
  2) CREATE LIKE TABLE now usese usual read lock on the source table rather
     then name lock, which is too restrictive. This way we get rid of another
     log table-related warning, which occured because of the above fact
     (as a side-effect, name lock resulted in a warning).
[13 Oct 2006 13: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/13657

ChangeSet@1.2307, 2006-10-13 17:26:46+04:00, petr@mysql.com +15 -0
  Fix for Bug #17544 "Cannot do atomic log rotate",
  Bug #21785 "Server crashes after rename of the log table" and
  Bug #21966 "Strange warnings on create like/repair of the log
              tables"
  
  According to the patch, 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.
  
  Other problems, which are solved by the patch are:
  
  1) Now REPAIR of the log table is exclusive operation (as it should be), this
     also eliminates lock-related warnings. and
  2) CREATE LIKE TABLE now usese usual read lock on the source table rather
     then name lock, which is too restrictive. This way we get rid of another
     log table-related warning, which occured because of the above fact
     (as a side-effect, name lock resulted in a warning).
[25 Oct 2006 12:59] Petr Chardin
pushed to 5.1-runtime
[7 Nov 2006 18:28] Paul DuBois
Noted in 5.1.13 changelog.

Incorrect warnings occurred for use of CREATE TABLE ... LIKE or 
REPAIR TABLE with the log tables.