Bug #82771 MySQL Shell doesn't set connection attributes
Submitted: 28 Aug 2016 19:21 Modified: 5 Oct 2017 11:43
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Document Store: MySQL Shell Severity:S3 (Non-critical)
Version:1.0.4, 1.0.5 OS:Any
Assigned to: CPU Architecture:Any
Tags: connection attributes

[28 Aug 2016 19:21] Daniël van Eeden
Description:
mysql shell doesn't set connection attributes.

It should set program_name=mysqlsh and _os, _pid, etc.

See also:
https://dev.mysql.com/doc/refman/5.7/en/performance-schema-connection-attribute-tables.htm...

How to repeat:
mysql-sql> SELECT * FROM performance_schema.session_connect_attrs WHERE PROCESSLIST_ID=CONNECTION_ID();
Empty set (0.00 sec)
[30 Aug 2016 9:54] MySQL Verification Team
Hello Daniël,

Thank you for the report.
I've just upgraded one of the old instance and installed 5.7.14, MySQL-Shell 1.0.4 and getting those details(only weird thing is it says 5.7.13 for _client_version).

root@bugs:~# apt-get install mysql-community-server
.
root@bugs:~# apt-get install mysql-shell
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  mysql-shell
0 upgraded, 1 newly installed, 0 to remove and 187 not upgraded.
Need to get 3,245 kB of archives.
After this operation, 13.9 MB of additional disk space will be used.
Get:1 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-tools-preview mysql-shell amd64 1.0.4-1ubuntu14.04 [3,245 kB]
Fetched 3,245 kB in 15s (214 kB/s)                                             
Selecting previously unselected package mysql-shell:amd64.
(Reading database ... 211529 files and directories currently installed.)
Preparing to unpack .../mysql-shell_1.0.4-1ubuntu14.04_amd64.deb ...
Unpacking mysql-shell:amd64 (1.0.4-1ubuntu14.04) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up mysql-shell:amd64 (1.0.4-1ubuntu14.04) ...
.
root@bugs:~# mysqlsh -u root -h localhost --classic --dba enableXProtocol
Creating a Classic Session to root@localhost:3306
Enter password:
No default schema selected.

enableXProtocol: Installing plugin mysqlx...
enableXProtocol: done

root@bugs:~# mysqlsh -u user --sqlc -e "show plugins"
Enter password:
+----------------------------+----------+--------------------+-----------+---------+
| Name                       | Status   | Type               | Library   | License |
+----------------------------+----------+--------------------+-----------+---------+
| binlog                     | ACTIVE   | STORAGE ENGINE     | null      | GPL     |
.

| mysqlx                     | ACTIVE   | DAEMON             | mysqlx.so | GPL     |
+----------------------------+----------+--------------------+-----------+---------+
root@bugs:~# mysqlsh -u user --sqlc -e "SELECT * FROM performance_schema.session_connect_attrs WHERE PROCESSLIST_ID=CONNECTION_ID();"
Enter password:
+----------------+-----------------+------------+------------------+
| PROCESSLIST_ID | ATTR_NAME       | ATTR_VALUE | ORDINAL_POSITION |
+----------------+-----------------+------------+------------------+
|              6 | _os             | Linux      |                0 |
|              6 | _client_name    | libmysql   |                1 |
|              6 | _pid            | 5762       |                2 |
|              6 | _client_version | 5.7.13     |                3 |
|              6 | _platform       | x86_64     |                4 |
+----------------+-----------------+------------+------------------+
root@bugs:~# 
root@bugs:~# dpkg -l|grep -i mysql-
ii  mysql-apt-config                                      0.7.3-1                                             all          Auto configuration for MySQL APT Repo.
ii  mysql-client                                          5.7.14-1ubuntu14.04                                 amd64        MySQL Client meta package depending on latest version
ii  mysql-common                                          5.7.14-1ubuntu14.04                                 amd64        MySQL Common
ii  mysql-community-client                                5.7.14-1ubuntu14.04                                 amd64        MySQL Client
ii  mysql-community-server                                5.7.14-1ubuntu14.04                                 amd64        MySQL Server
ii  mysql-connector-python                                2.0.4-1ubuntu14.04                                  all          MySQL database driver written in Python
ii  mysql-shell:amd64                                     1.0.4-1ubuntu14.04                                  amd64        MySQL Shell
ii  mysql-utilities                                       1.5.6-1ubuntu14.04                                  all          Collection of scripts for managing MySQL servers

Thanks,
Umesh
[25 Sep 2016 16:25] Daniël van Eeden
Verified with 1.0.5 client and 8.0.0 server:

mysql-sql> SELECT * FROM performance_schema.session_connect_attrs WHERE PROCESSLIST_ID=CONNECTION_ID();
+----------------+-----------------+------------+------------------+
| PROCESSLIST_ID | ATTR_NAME       | ATTR_VALUE | ORDINAL_POSITION |
+----------------+-----------------+------------+------------------+
|             44 | _os             | Linux      |                0 |
|             44 | _client_name    | libmysql   |                1 |
|             44 | _pid            | 13104      |                2 |
|             44 | _client_version | 5.7.14     |                3 |
|             44 | _platform       | x86_64     |                4 |
+----------------+-----------------+------------+------------------+
5 rows in set (0.00 sec)

This is with --sqlc 3306 (mysql)

But when I use --sql and connect to port 33060 (mysqlx):
mysql-sql> SELECT * FROM performance_schema.session_connect_attrs WHERE PROCESSLIST_ID=CONNECTION_ID();
Empty set (0.00 sec)

mysql-sql> SELECT * FROM performance_schema.session_connect_attrs;
Empty set (0.00 sec)
[26 Sep 2016 13:15] MySQL Verification Team
Thank you, Daniël!
[5 Oct 2017 11:43] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL Shell 8.0.4, and documentation change made in 
https://dev.mysql.com/doc/refman/8.0/en/performance-schema-connection-attribute-tables.htm...