Bug #71733 I cannot get result of performance_schema.socket_instances

Submitted: 16 Feb 2014 6:39 Modified: 21 Feb 2014 4:24
Reporter: 徹 赤松 Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S3 (Non-critical)
Version:5.7.3 OS:Linux
Assigned to: CPU Architecture:Any
Tags: m_version_state, performance_schema, pfs->m_lock.is_populated(), socket_instances

[16 Feb 2014 6:39] 徹 赤松
Description:
I am useing mysql version 5.7.3-m13 now.
I cannot get result of performance_schema.socket_instances.

mysql> select * from performance_schema.socket_instances;
Empty set (0.00 sec)

I can get result of performance_schema.socket_summary_by_event_name
mysql> select event_name from performance_schema.socket_summary_by_event_name;
+----------------------------------------+
| event_name                             |
+----------------------------------------+
| wait/io/socket/sql/server_tcpip_socket |
| wait/io/socket/sql/server_unix_socket  |
| wait/io/socket/sql/client_connection   |
+----------------------------------------+
3 rows in set (0.00 sec)

I checked is_populated() function in storage/perfschema/table_socket_instances.cc file.
   116      if (pfs->m_lock.is_populated())
   134    if (! pfs->m_lock.is_populated())

Return value of pfs->m_lock.is_populated() function always 0, so cannot make_row().

So, I checked is_populated() function in storage/perfschema/pfs_lock.h
    82    volatile uint32 m_version_state;
    :
    91    /** Returns true if the record contains values that can be read. */
    92    bool is_populated(void)
    93    {
    94      uint32 copy= m_version_state; /* non volatile copy, and dirty read */
    95      return ((copy & STATE_MASK) == PFS_LOCK_ALLOCATED);
    96    }

I found m_version_state value is Zero.

Same result socket_summary_by_instance.
mysql> select event_name from performance_schema.socket_summary_by_instance;
Empty set (0.00 sec)

Please check and I am pleased if you can reply. 

How to repeat:
mysql> select * from performance_schema.socket_instances;
Empty set (0.00 sec)
[17 Feb 2014 8:31] MySQL Verification Team
Hi,

Thank you for the report.
Imho this is not a bug, because the socket_instances table relies on PERFORMANCE_SCHEMA instrumentation which is not on by default.

May be if you can enable it at run time(see update in below test) or at start up(–performance_schema_instrument=wait/io/socket/sql/client_connection=counted )? Could you check and confirm? 

mysql> select * from performance_schema.setup_instruments where name LIKE '%socket%';
+--------------------------------------------------+---------+-------+
| NAME                                             | ENABLED | TIMED |
+--------------------------------------------------+---------+-------+
| wait/synch/mutex/sql/LOCK_socket_listener_active | NO      | NO    |
| wait/synch/cond/sql/COND_socket_listener_active  | NO      | NO    |
| wait/io/socket/sql/server_tcpip_socket           | NO      | NO    |
| wait/io/socket/sql/server_unix_socket            | NO      | NO    |
| wait/io/socket/sql/client_connection             | NO      | NO    |
+--------------------------------------------------+---------+-------+

mysql> select * from performance_schema.socket_instances;
Empty set (0.00 sec)

// Update at runtime

mysql> UPDATE performance_schema.setup_instruments
    -> SET enabled = 'YES'
    -> WHERE name LIKE 'wait/io/socket/sql/client_connection';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from performance_schema.socket_instances;
Empty set (0.00 sec)

mysql> \q
Bye

// Try with new connection

mysql-5.7.4]#  bin/mysql -uroot -p -S /tmp/master/mysql.sock
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
..

mysql> select * from performance_schema.socket_instances;
+--------------------------------------+-----------------------+-----------+-----------+----+------+--------+
| EVENT_NAME                           | OBJECT_INSTANCE_BEGIN | THREAD_ID | SOCKET_ID | IP | PORT | STATE  |
+--------------------------------------+-----------------------+-----------+-----------+----+------+--------+
| wait/io/socket/sql/client_connection |              45105216 |        23 |        33 |    |    0 | ACTIVE |
+--------------------------------------+-----------------------+-----------+-----------+----+------+--------+
1 row in set (0.00 sec)
[20 Feb 2014 20:20] 徹 赤松
Dir Umesh Umesh, thank you.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.