Bug #9291 table_locks_waited not incremented properly on windows xp
Submitted: 19 Mar 2005 1:14 Modified: 20 Mar 2005 9:37
Reporter: Harrison Fisk Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.10a OS:Windows (Windows XP SP2)
Assigned to: CPU Architecture:Any

[19 Mar 2005 1:14] Harrison Fisk
Description:
The table_locks_waited variable doesn't seem to incremented properly under Windows XP.  Instead it increments table_locks_immediate even if it had to wait to acquire the lock.  It does seem to work fine on Mac OS X, so I presume it is a windows specific bug.

How to repeat:
Start two connections, I will call one 'con1' and the other 'con2'.

con1> use world;
con2> use world;

con1> flush status;
con1> show status like 'table_lock%';
-- should both be 0

con1> lock tables country read;

-- this should hang
con2> lock tables country write;

con1> unlock tables;
con2> unlock tables;

con1> show status like 'table_lock%';
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| Table_locks_immediate | 2     |
| Table_locks_waited    | 0     |
+-----------------------+-------+
2 rows in set (0.00 sec)

-- This should be 1 and 1
-- It shows up properly from testing under Mac OS X.3

Suggested fix:
Fix the code that chooses whether to increment table_locks_immediate and table_locks_waited to work with windows.
[19 Mar 2005 23:29] Hartmut Holzgraefe
Also not reproducable on linux
[20 Mar 2005 9:37] MySQL Verification Team
I wasn't able to repeat on XP with 4.1.11 built from BK 1 week older:

c:\mysql\bin>mysql -uroot world --prompt="con1>"
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 4.1.11-debug

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

con1>flush status;
Query OK, 0 rows affected (0.01 sec)

con1>show status like 'table_lock%';
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| Table_locks_immediate | 0     |
| Table_locks_waited    | 0     |
+-----------------------+-------+
2 rows in set (0.00 sec)

con1>lock tables country read;
Query OK, 0 rows affected (0.00 sec)

con1>unlock tables;
Query OK, 0 rows affected (0.00 sec)

con1>show status like 'table_lock%';
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| Table_locks_immediate | 1     |
| Table_locks_waited    | 1     |
+-----------------------+-------+
2 rows in set (0.00 sec)

con1>

c:\mysql\bin>mysql -uroot world --prompt="con2>"
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 4.1.11-debug

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

con2>lock tables country write;
Query OK, 0 rows affected (16.22 sec)

con2>unlock tables;
Query OK, 0 rows affected (0.00 sec)

con2>

Notice I followed the sequence as reported, above just I pasted
individually every screen.