Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #4841 #4842

Open
wants to merge 1 commit into
base: v3.0
Choose a base branch
from
Open

Fix issue #4841 #4842

wants to merge 1 commit into from

Conversation

renecannao
Copy link
Contributor

Incorrectly attempt to use a collation with id larger than 255 during backend handshake

Problem:
When creating a backend connection, if the frontend connection has configured a collation with id larger than 255 (for example using SET NAMES utf8mb4 COLLATE utf8mb4_0900_as_ci; , ProxySQL may try to create a new connection using such collation. The problem is that at protocol level, during handshake only 1 byte can be used to configure the collation. That means that if ProxySQL sets a collation greater than 255 , only the less significant byte is used. Therefore even if ProxySQL believes that the backend connection will use the specified collation, mysql_real_connect() is using a different collation. For example, using collation 305 will lead to use collation 49 (305-256).

Solution:
When a collation id greater than 255 is detected, the default collation for that character set is used. ProxySQL will later issue a SET NAMES ... COLLATE to address the mismatch.

Incorrectly attempt to use a collation with id larger than 255 during backend handshake

Problem:
When creating a backend connection, if the frontend connection has configured a collation with id larger than 255 (for example using SET NAMES utf8mb4 COLLATE utf8mb4_0900_as_ci; , ProxySQL may try to create a new connection using such collation.
The problem is that at protocol level, during handshake only 1 byte can be used to configure the collation.
That means that if ProxySQL sets a collation greater than 255 , only the less significant byte is used.
Therefore even if ProxySQL believes that the backend connection will use the specified collation, mysql_real_connect() is using a different collation. For example, using collation 305 will lead to use collation 49 (305-256).

Solution:
When a collation id greater than 255 is detected, the default collation for that character set is used.
ProxySQL will later issue a SET NAMES ... COLLATE to address the mismatch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant