Bug #104624 Add an option to mysql client to disable CLIENT_QUERY_ATTRIBUTES capability
Submitted: 14 Aug 2021 1:16 Modified: 30 Aug 2021 11:42
Reporter: Kaige Ye (OCA) Email Updates:
Status: Won't fix Impact on me:
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:8.0.26 OS:Linux
Assigned to: CPU Architecture:Any
Tags: Contribution

[14 Aug 2021 1:16] Kaige Ye
CLIENT_QUERY_ATTRIBUTES capability is set by default since 8.0.23, but I didn't find any option to disable it.

The reason why I want to disable it is currently Wireshark can't recognize COM_QUERY payload with query attributes. Here is an example, with CLIENT_QUERY_ATTRIBUTES being set, a `show databases` query request packet would be looks like:

11 00 00 00 03 00 01 73 68 6f 77 20 64 61 74 61 62 61 73 65 73
-------- -- -- -- --  s  h  o  w     d  a  t  a  b  a  s  e  s
               #X #Y

#X and #Y bytes are used for query attributes. Before query attributes beding added, the packet should looks like:

0f 00 00 00 03       73 68 6f 77 20 64 61 74 61 62 61 73 65 73
-------- -- --        s  h  o  w     d  a  t  a  b  a  s  e  s
The latest Wireshark works fine with the second but not the first. Work should be done in Wireshark part to recognize the first, but it would be nice we can unset this capability by mysql client. 

How to repeat:
Use Wireshark to capture network packet.

$ mysql
mysql> show database;

check the query payload in Wireshark.

Suggested fix:
I have a PR for this purpose: https://github.com/mysql/mysql-server/pull/359
[14 Aug 2021 7:42] MySQL Verification Team
Hello Kaige Ye,

Thank you very much for your patch contribution, we appreciate it!
In order for us to continue the process of reviewing your contribution to MySQL, please send us a signed copy of the Oracle Contributor Agreement (OCA) as outlined in http://www.oracle.com/technetwork/community/oca-486395.html

Signing an OCA needs to be done only once and it's valid for all other Oracle governed Open Source projects as well.

Getting a signed/approved OCA on file will help us facilitate your contribution - this one, and others in the future.  

Please let me know, if you have any questions.

Thank you for your interest in MySQL.

[14 Aug 2021 8:30] Kaige Ye
Hi Umesh,

I'd like to sign OCA again, but I got this warning:

"The provided value for the GitHub username already exists. Please provide a different one."

I have signed OCA a few days ago, while it's under reviewing I guess, I want to change the E-mail. I withdrawed the apply and changed my E-mail, I got the warning above when I resubmit. Could you please help me to proceed?

[14 Aug 2021 11:14] MySQL Verification Team
Hello Kaige Ye,

If you have already signed OCA then there is no need to re-sign again with different email etc. Let us wait for few days and it would reflect. Thank you.

[27 Aug 2021 13:06] OCA Admin
Contribution submitted via Github - add query-attributes options to mysql client 
(*) Contribution by Kaige Ye (Github YKG, mysql-server/pull/359#issuecomment-906864053): 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_712690712.txt (text/plain), 4.91 KiB.

[27 Aug 2021 14:01] MySQL Verification Team
Thank you for your contribution.

[30 Aug 2021 11:42] Georgi Kodinov
Query attributes are here to stay. If the newer client causes trouble for you with wireshark may I suggest you'd use an older client instead?
Plus in the diff submitted there's some layering issues: e.g. client apps should be manipulating the internals of the MYSQL data structure directly.