Bug #93202 connector/net doesn't need to run SHOW VARIABLES

Submitted: 15 Nov 2018 7:06 Modified: 19 Jun 2019 16:50
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S5 (Performance)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any

[15 Nov 2018 7:06] Shane Bester
Description:
Same request as in:
 https://bugs.mysql.com/bug.php?id=93201

Please do not run SHOW VARIABLES.
Rather use SELECT @@varname;  alternative syntax.

How to repeat:
Look at how serverProps gets populated,  and how it is actually used.
Check method public virtual void Configure(MySqlConnection connection)
in C/NET Driver.cs.

It'll call LoadServerProperties at least once (depending on pool size/CacheServerProperties).

Yet, look when serverProps is referenced on the lines:

string licenseType = serverProps["license"];
MaxPacketSize = Convert.ToInt64(serverProps["max_allowed_packet"]);
serverProps.TryGetValue("character_set_client", out clientCharSet);
serverProps.TryGetValue("character_set_connection", out connCharSet);
string mode = Connection.driver.Property("sql_mode");
int caseSetting = Int32.Parse(connection.driver.Property("lower_case_table_names"));

Suggested fix:
Please optimize this code to avoid SHOW VARIABLES at any cost.
How about this instead:

SELECT @@max_allowed_packet, @@license, @@character_set_client, @@character_set_connection, @@lower_case_table_names, @@sql_mode;
[15 Nov 2018 9:13] MySQL Verification Team
Hello Shane,

Thank you for the report.
Observed this with VS 2017 and C/NET 8.0.13.

Regards,
Umesh
[19 Jun 2019 16:50] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Connector/NET  6.10.9 and 8.0.17 release, and here's the changelog entry:

Connector/NET connections executed SHOW VARIABLES unnecessarily.

Thank you for the bug report.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.072 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.