Bug #100606 Unecesary call to "SET NAMES 'utf8' COLLATE 'utf8_general_ci'"
| Submitted: | 21 Aug 2020 16:01 | Modified: | 10 Jun 2021 21:13 |
|---|---|---|---|
| Reporter: | Marc Fletcher (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S2 (Serious) |
| Version: | 8.0.21 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Contribution | ||
[21 Aug 2020 16:01]
Marc Fletcher
[21 Aug 2020 16:11]
Marc Fletcher
PR raised to expedite the merging of this into the next release - https://github.com/mysql/mysql-connector-j/pull/54
[28 Aug 2020 9:42]
MySQL Verification Team
Hello Marc, Thank you for the report and contribution. regards, Umesh
[29 Sep 2020 18:40]
OCA Admin
Contribution submitted via Github - Bug #100606 - Unecesary call to "SET NAMES 'utf8' COLLATE 'utf8_general_ci'" (*) Contribution by Marc Fletcher (Github MarcFletcher, mysql-connector-j/pull/54): Please see the bug report available at - https://bugs.mysql.com/bug.php?id=100606 The OCA has been completed and 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_471721305.txt (text/plain), 2.21 KiB.
[4 Mar 2021 20:13]
Frederic Descamps
Hi Marc, My name is Frédéric Descamps (@lefred), Community Manager and I would like to let you know that our development team is processing your contribution. Thank you for using and helping MySQL. Regards,
[10 Jun 2021 21:13]
Daniel So
Posted by developer: Added the following entry to the Connector/J 8.0.26 changelog: "Connector/J issued unnecessary SET NAMES statements to set collation just to the server's own setting, which caused performance degradation. To fix this and other problems, a new mechanism for negotiating the character set and collation for communication between the server and Connector/J has been introduced; see Using Character Sets and Unicode for details. Thanks to Marc Fletcher for contributing to the fix."
[28 Jul 2021 19:19]
Brett Kail
This change appears to cause a similar bug to https://bugs.mysql.com/bug.php?id=95139 , which reports that cacheServerConfiguration=true (as enabled by useConfigs=maxPerformance) breaks encoding handling. Specifically, this logic: https://github.com/mysql/mysql-connector-j/blob/8.0.26/src/main/core-impl/java/com/mysql/c... ...causes all sessions to share the same server configuration HashMap, and then this logic: https://github.com/mysql/mysql-connector-j/blob/8.0.26/src/main/core-impl/java/com/mysql/c... ...means that the "SET character_set_results = NULL" command is executed for the first connection to a URL in a JVM, but the .put() prevents that command from being executed for second and subsequent connections to the same URL. The same shared server configuration map exists in 8.0.25, but this logic: https://github.com/mysql/mysql-connector-j/blob/8.0.25/src/main/core-impl/java/com/mysql/c... ...is setting a different (local.character_set_results) variable than it checks (character_set_results), so in practice it always runs. Perhaps the NativeSession.loadServerVariables logic should cache an unmodifiable map and create a mutable copy before calling setServerVariables? In the meantime, we have disabled cacheServerConfiguration=false (the improvements from this bug means we no longer have the per-connection "SET NAMES" but now have a per-connection "SELECT").
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.063 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.