Bug #27499 DROP TABLE race with SHOW TABLE STATUS
Submitted: 28 Mar 2007 14:06 Modified: 24 Apr 2007 17:13
Reporter: David Phillips Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Locking Severity:S3 (Non-critical)
Version:5.0.37, 5.1 OS:Linux (SuSE Linux 9.3)
Assigned to: Sergei Glukhov CPU Architecture:Any

[28 Mar 2007 14:06] David Phillips
Description:
A race condition DROP TABLE causes SHOW TABLE STATUS to show the table as not existing.  All fields except NAME are NULL and COMMENT says "Table 'test.foo' doesn't exist".

I was using SHOW TABLE STATUS to check for the issue with InnoDB getting confused about .frm files after a crash (affected tables show a NULL engine), but because of this bug I will need to find a different method.

How to repeat:
thread 1: while true; do mysql -e 'SHOW TABLE STATUS WHERE engine IS NULL\G' test; done

thread 2: while true; do mysql -e 'CREATE TABLE foo (x int); DROP TABLE foo;' test; done

*************************** 1. row ***************************
           Name: foo
         Engine: NULL
        Version: NULL
     Row_format: NULL
           Rows: NULL
 Avg_row_length: NULL
    Data_length: NULL
Max_data_length: NULL
   Index_length: NULL
      Data_free: NULL
 Auto_increment: NULL
    Create_time: NULL
    Update_time: NULL
     Check_time: NULL
      Collation: NULL
       Checksum: NULL
 Create_options: NULL
        Comment: Table 'test.foo' doesn't exist
[29 Mar 2007 9:48] Sveta Smirnova
Thank you for the report.

Verified as described.
[10 Apr 2007 12:48] Timour Katchaounov
This bug is possibly related to BUG#27516 with respect to locking.
[18 Apr 2007 7:31] 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/24755

ChangeSet@1.2457, 2007-04-18 12:29:01+05:00, gluh@mysql.com +1 -0
  Bug#27499 DROP TABLE race with SHOW TABLE STATUS
  Hide error for not existing table
[19 Apr 2007 11:52] 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/24897

ChangeSet@1.2457, 2007-04-19 16:49:21+05:00, gluh@mysql.com +1 -0
  Bug#27499 DROP TABLE race with SHOW TABLE STATUS
  They can drop table after table names list creation and before table opening.
  We open non existing table and get ER_NO_SUCH_TABLE error.
  In this case we do not store the record into I_S table and clear error.
[21 Apr 2007 15:19] Bugs System
Pushed into 5.1.18-beta
[21 Apr 2007 15:20] Bugs System
Pushed into 5.0.42
[24 Apr 2007 17:13] Paul DuBois
Noted in 5.0.42, 5.1.18 changelogs.

A race condition between DROP TABLE and SHOW TABLE STATUS could cause
the latter to display incorrect information.