List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:November 26 1999 2:36am
Subject:Re: 3.23.6a Bug Report
View as plain text  
>>>>> "Joe" == Joe Kislo <kislo@stripped> writes:

<cut>

Joe> Thanks,
Joe> -----
>> Description:
Joe> If you have two disjoint processes aquire a write table lock on the same
Joe> table, and one of them drops the table from the database, the mysql
Joe> database
Joe> server crashes

Joe> I have been able to repeat this on 3.22.25 and 3.22.27, on both x86
Joe> linux
Joe> 2.2.x and sparc solaris 7.

>> How-To-Repeat:
Joe>         Create two tables
Joe>         establish two mysql connections [in different windows]
Joe>         aquire write lock on both tables in both windows [using 1 sql
Joe> command]
Joe>         one will get the locks, and one will have to wait
Joe>         have the one which got the lock, drop one of the tables it has a
Joe> lock on
Joe>         the Mysql server will immediatly crash, and both connections
Joe> will be
Joe> lost

>> Fix:
Joe>         None, server crashes.  It's corrupted my tables a couple times
Joe> now.

Better fix:

(/my/monty/sql-3.22) diff -c /my/monty/master/mysql-3.22.26a/sql/sql_base.cc .
*** /my/monty/master/mysql-3.22.26a/sql/sql_base.cc     Sun Aug  8 20:26:45 1999
--- ./sql_base.cc       Fri Nov 26 02:13:06 1999
***************
*** 698,705 ****
      next=table->next;
      if (!tables || (!db_stat && reopen_table(thd,table,1)))
      {
-       VOID(hash_delete(&open_cache,(byte*) table));
        my_error(ER_CANT_REOPEN_TABLE,MYF(0),table->table_name);
        error=1;
      }
      else
--- 698,705 ----
      next=table->next;
      if (!tables || (!db_stat && reopen_table(thd,table,1)))
      {
        my_error(ER_CANT_REOPEN_TABLE,MYF(0),table->table_name);
+       VOID(hash_delete(&open_cache,(byte*) table));
        error=1;
      }
      else

Regards,
Monty

PS: Why are are you locking a table that you are going to delete?
    This isn't normally a really good solution...
Thread
3.23.6a Bug ReportStephen Taranto25 Nov
  • Re: 3.23.6a Bug Reportsinisa25 Nov
  • 3.23.6a Bug ReportMichael Widenius25 Nov
  • Re: 3.23.6a Bug ReportJoe Kislo25 Nov
    • Re: 3.23.6a Bug ReportMichael Widenius26 Nov
    • Re: 3.23.6a Bug ReportMichael Widenius26 Nov