Bug #68782 Replication connection should set program_name attribute
Submitted: 26 Mar 2013 17:27 Modified: 9 Jul 2015 15:50
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version:5.6.10 OS:Any
Assigned to: CPU Architecture:Any

[26 Mar 2013 17:27] Todd Farmer
Same as Bug#68781, but for replication connection.

The replication connection uses libmysql, which exposes standard (reserved) attributes.  Unlike standard libmysql-based clients (mysql, mysqldump, etc.), though, it does not set program_name.  This would be useful to identify the type of client for P_S and audit purposes.

How to repeat:
1.  Create a master-slave setup, start replication.
2.  Query the performance_schema.session_connect_attrs table and observe the connection attributes for the slave connection.

Suggested fix:
Have slave send connection attribute:

program_name: replication_slave
[25 Mar 2015 15:08] Sven Sandberg
Posted by developer:
I agree we should fix this. However, shouldn't program_name be 'mysqld'? I see that mysqlbinlog uses 'mysqlbinlog' and the client uses 'mysql'.

What's the next step - shall I assign the bug to someone in the replication team so we can take it from here?
[25 Mar 2015 15:19] Todd Farmer
I think it needs to indicate "replication" because there are other mysqld processes which may connect (e.g., FEDERATED).
[24 Apr 2015 14:14] Daniël van Eeden
Somewhat related:
Bug #76828 	Expose slave details via PS on a master
Bug #76829 	Expose slave version in SHOW SLAVE HOSTS
[25 Apr 2015 12:31] Daniël van Eeden
When using multisource it could also send the name of the channel.
[27 Apr 2015 18:45] OCA Admin
Contribution submitted via Github - Fix for RFE Bug68782 
(*) Contribution by Daniël van Eeden (Github dveeden, mysql-server/pull/6#issuecomment-96369282): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_34106589.txt (text/plain), 1.75 KiB.

[9 Jul 2015 15:50] David Moss
Thanks for your feedback. The following was noted in the 5.7.8 changelog:
The replication connection now sends the program_name attribute, “mysqld”, in line with the behavior of other client connections. In addition, a _client_role attribute has been added and is set to “binary_log_listener”, to clarify the replication connection's role, as well as the _client_replication_channel_name attribute, which is set to the replication channel's name. Similarly, mysqlbinlog now sets _client_role to “binary_log_listener”. These changes are exposed through the session_connect_attrs Performance Schema table.