Bug #68781 FEDERATED should define connection attributes to identify itself
Submitted: 26 Mar 2013 17:04 Modified: 14 Apr 2015 17:00
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Federated storage engine Severity:S4 (Feature request)
Version:5.6.10 OS:Any
Assigned to: CPU Architecture:Any

[26 Mar 2013 17:04] Todd Farmer
Description:
The standard MySQL clients (mysql, mysqldump, etc.) expose the program name via program_name connection attributes as of 5.6.10:

mysql> SELECT * FROM performance_schema.session_connect_attrs
    -> WHERE processlist_id = CONNECTION_ID();
+----------------+-----------------+------------+------------------+
| PROCESSLIST_ID | ATTR_NAME       | ATTR_VALUE | ORDINAL_POSITION |
+----------------+-----------------+------------+------------------+
|             94 | _os             | Win32      |                0 |
|             94 | _client_name    | libmysql   |                1 |
|             94 | _pid            | 6120       |                2 |
|             94 | _thread         | 4740       |                3 |
|             94 | _platform       | x86        |                4 |
|             94 | program_name    | mysql      |                5 |
|             94 | _client_version | 5.6.10     |                6 |
+----------------+-----------------+------------+------------------+
7 rows in set (0.08 sec)

The FEDERATED storage engine, which also uses libmysql, does not set a program_name to identify itself:

mysql>  SELECT * FROM performance_schema.session_connect_attrs
    ->   WHERE processlist_id IN
    ->     ( SELECT processlist_id
    ->        FROM performance_schema.session_connect_attrs
    ->        WHERE attr_name = '_client_name'
    ->        AND attr_value = 'libmysql'
    ->     )
    ->   AND processlist_id NOT IN
    ->     ( SELECT processlist_id
    ->        FROM performance_schema.session_connect_attrs
    ->        WHERE attr_name = 'program_name'
    ->     );
+----------------+-----------------+------------+------------------+
| PROCESSLIST_ID | ATTR_NAME       | ATTR_VALUE | ORDINAL_POSITION |
+----------------+-----------------+------------+------------------+
|              8 | _os             | Win32      |                0 |
|              8 | _client_name    | libmysql   |                1 |
|              8 | _pid            | 2240       |                2 |
|              8 | _thread         | 5808       |                3 |
|              8 | _platform       | x86        |                4 |
|              8 | _client_version | 5.6.10     |                5 |
+----------------+-----------------+------------+------------------+
6 rows in set (0.06 sec)

How to repeat:
1.  Create FEDERATED table.
2.  Query the FEDERATED table to establish the connection on the target server.
3.  Observe that performance_schema.session_connect_attrs table does not show program_name for the associated connection.

Suggested fix:
Add connection attribute for FEDERATED:

program_name: FEDERATED
[14 Apr 2015 17:00] Paul Dubois
Noted in 5.7.8, 5.8.0 changelogs.

Connections for the FEDERATED storage engine now set the program_name
session connection attribute to federated to permit identification of
the connection source.