Bug #71714 Select query locking the table
Submitted: 14 Feb 2014 5:36 Modified: 14 Feb 2014 5:57
Reporter: Anupam Gupta Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Locking Severity:S1 (Critical)
Version:mysql 5.5.17 OS:Any
Assigned to: CPU Architecture:Any
Tags: Select query locking the table

[14 Feb 2014 5:36] Anupam Gupta
Description:
i am facing issue in the mysql data pooling...i have client server architecture, 
server and client are bosth acessing the same table.
lets say the table name is t1.
t1 contain pool of random numbers , the server software continually count the table t1 every 100 milliseconds and if the count is below 1k it regenerate the random numbers. the client application lock the table  t1 with write lock and download set of random number and then unlock tables.
i am facing issue when client is trying to lock table the table t1 is already locked hence its keep on waiting since server is locking the table by its select count(1) query. kindly give me solution to solve this problem.
i am using the following query on server
select count(1) from t1 where status='unused';
on client :
show open tables where in_use>0;
lock table t1 write;
--download numbers
unlock tables;
my client is always stuck in state:>show open tables where in_use>0;
since the server is acessing the table and it gets always 1 records in the above query.

How to repeat:
t1 contain pool of random numbers , the server software continually count the table t1 every 100 milliseconds and if the count is below 1k it regenerate the random numbers. the client application lock the table  t1 with write lock and download set of random number and then unlock tables.
i am facing issue when client is trying to lock table the table t1 is already locked hence its keep on waiting since server is locking the table by its select count(1) query. kindly give me solution to solve this problem.
i am using the following query on server
select count(1) from t1 where status='unused';
on client :
show open tables where in_use>0;
lock table t1 write;
--download numbers
unlock tables;
my client is always stuck in state:>show open tables where in_use>0;
since the server is acessing the table and it gets always 1 records in the above query
[14 Feb 2014 5:57] MySQL Verification Team
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug.

Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/

Thank you for your interest in MySQL.

What exactly is the bug?