Bug #69761 P_S.HOSTS table contents include NULL hosts
Submitted: 17 Jul 2013 0:35 Modified: 17 Jul 2013 17:56
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.6.12 OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[17 Jul 2013 0:35] Todd Farmer
Description:
The manual describes the contents of this table as "a row for each host from which clients have connected to the MySQL server".  That's clearly not the case, as it seems to include all threads (connection-related or not):

mysql> SELECT * FROM performance_schema.hosts;
+-----------+---------------------+-------------------+
| HOST      | CURRENT_CONNECTIONS | TOTAL_CONNECTIONS |
+-----------+---------------------+-------------------+
| NULL      |                  19 |                22 |
| localhost |                   1 |                14 |
+-----------+---------------------+-------------------+
2 rows in set (0.00 sec)

mysql> SELECT COUNT(*), processlist_host
    -> FROM performance_schema.threads
    -> GROUP BY processlist_host;
+----------+------------------+
| COUNT(*) | processlist_host |
+----------+------------------+
|       19 | NULL             |
|        1 | localhost        |
+----------+------------------+
2 rows in set (0.00 sec)

It seems as though internal processes should be excluded from the HOSTS table, but if that's not the case, the documentation should be updated to reflect its inclusion.

How to repeat:
SELECT * FROM performance_schema.hosts;

Suggested fix:
Exclude internal threads from HOSTS table, or update documentation.
[17 Jul 2013 7:50] Marc ALFF
Internal threads are aggregated with a NULL USER and HOST.
This is expected and not a server bug.

Changing category to doc
[17 Jul 2013 17:56] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

Updated hosts.HOST description:

The host name from which the client connected, or NULL for an
internal thread. 

Updated users.USER description:

The client user name for the connection, or NULL for an internal
thread.