Bug #9207 inconsistence with lock and desc
Submitted: 15 Mar 2005 22:06 Modified: 24 Mar 2005 19:33
Reporter: Martin Friebe (Gold Quality Contributor) (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.10 OS:Any (*)
Assigned to: Sergei Golubchik CPU Architecture:Any

[15 Mar 2005 22:06] Martin Friebe
Description:

lock a table, the client holding the lock, can only execute "desc " or "show index from" for the locked table (I would take that as correct).

Other clients can execute the 2 commands for any table, including the one which is locked.

I found those commands doNOT obbey the lock in ther processes:
desc
show columns from
show index from
show create table

How to repeat:
create database db1;
use db1; create table t1a (a int); create table t1b (a int);

lock table t1a WRITE;

reset query cache;
desc t1a;
# works

reset query cache;
desc t1b;
# error table locked (correct)

# use another client (while the current client continues to hold the lock)
use db1;
reset query cache;
desc t1a;
# works (why, this is locke by the other client)

reset query cache;
desc t1b;
# works (correct, not locked by other client)

unlock tables; #client 1
drop database db1; drop database db2;

Suggested fix:

if it is not possible to do
 desc non_locked_table; # in a client holdong a lock

then decide if it should be possible to do
 desc table_locked_by_other_process;
[24 Mar 2005 19:33] Sergei Golubchik
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/

Additional info:

We cannot change locking behaviour in 4.1 - it's the stable branch.
But in 5.0 it is not possible to do 'DESC table' if the table is locked by another client.