Bug #71298 "Waiting to get readlock" stage is not used in 5.6 any more
Submitted: 5 Jan 2014 12:31 Modified: 7 Feb 2014 2:19
Reporter: Valeriy Kravchuk Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S3 (Non-critical)
Version:5.6.15 OS:Any
Assigned to: Marc ALFF CPU Architecture:Any
Tags: performance_schema, setup_instruments

[5 Jan 2014 12:31] Valeriy Kravchuk
Description:
Manual page that describes instruments naming for PERFORMANCE_SCHEMA says (see http://dev.mysql.com/doc/refman/5.6/en/performance-schema-instrument-naming.html):

"Stage instruments have names of the form stage/code_area/stage_name, where code_area is a value such as sql or myisam, and stage_name indicates the stage of statement processing, such as Sorting result or Sending data. Stages correspond to the thread states displayed by SHOW PROCESSLIST or that are visible in the INFORMATION_SCHEMA.PROCESSLIST table."

I've checked all pages related to thread states explanation under http://dev.mysql.com/doc/refman/5.6/en/thread-information.html, but had not found any description for the following state:

mysql> select * from performance_schema.setup_instruments where name like 'stage/sql%readlock%';
+-----------------------------------+---------+-------+
| NAME                              | ENABLED | TIMED |
+-----------------------------------+---------+-------+
| stage/sql/Waiting to get readlock | YES     | YES   |
+-----------------------------------+---------+-------+
1 row in set (0.00 sec)

Just do not see "readlock" without space inside anywhere. Google search for "site:dev.mysql.com stage/sql/Waiting to get readlock" helps to find out this page, http://dev.mysql.com/doc/refman/5.5/en/general-thread-states.html, that explains:

"This state was removed in MySQL 5.5.8; Waiting for global read lock is used instead."

How to repeat:
Find this stage of SQL statement execution listed in setup_instruments:

mysql> select * from performance_schema.setup_instruments where name like 'stage/sql%readlock%';
+-----------------------------------+---------+-------+
| NAME                              | ENABLED | TIMED |
+-----------------------------------+---------+-------+
| stage/sql/Waiting to get readlock | YES     | YES   |
+-----------------------------------+---------+-------+
1 row in set (0.00 sec)

Then try to find description for this stage (thread status) in the manual for MySQL 5.6. 

Suggested fix:
It seems this thread state was removed in MySQL 5.5.8 and is replaced by "Waiting for global read lock": 

mysql> select * from performance_schema.setup_instruments where name like 'stage/sql%read lock%';
+----------------------------------------+---------+-------+
| NAME                                   | ENABLED | TIMED |
+----------------------------------------+---------+-------+
| stage/sql/Waiting for global read lock | YES     | YES   |
+----------------------------------------+---------+-------+
1 row in set (0.00 sec)

Please, fix PERFORMANCE_SCHEMA and remove this extra stage, "stage/sql/Waiting to get readlock" that is no longer used from setup_instruments etc.
[6 Jan 2014 12:30] MySQL Verification Team
Hello Valeriy,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh
[6 Jan 2014 12:31] MySQL Verification Team
// 5.6.16 - affected too
[7 Feb 2014 2:19] Paul DuBois
Noted in 5.7.4 changelog.

The Performance Schema "stage/sql/Waiting to get readlock" instrument
is no longer used and has been removed.
[29 Mar 2014 18:21] Laurynas Biveinis
An entry for this bug is in 5.6.17 release notes, but the bug has not been fixed there, bug 72160.