[MXS-4898] MaxScale sends wrong character set (session tracking) Created: 2023-12-14  Updated: 2024-01-24  Resolved: 2024-01-02

Status: Closed
Project: MariaDB MaxScale
Component/s: Core
Affects Version/s: 23.08.3
Fix Version/s: 23.08.5

Type: Bug Priority: Major
Reporter: Georg Richter Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MXS-4955 Character set 'utf8mb3' is not supported Closed
Sprint: MXS-SPRINT-198, MXS-SPRINT-199

 Description   

If client sends a character set during connection handshake, MaxScale sends a different character set in connection handshake ok packet.

Code:

static int test_maxscale_charset(MYSQL *unused __attribute__(unused))
{
  const char *cs_test= "latin2";
  MYSQL *mysql= mysql_init(NULL);
  mysql_options(mysql, MYSQL_SET_CHARSET_NAME, cs_test);
 
  FAIL_IF(!my_test_connect(mysql, hostname, username,
                             password, schema, port, socketname, 0), 
         mysql_error(mysql));
  diag("Character set changed from %s to %s", cs_test, mysql_character_set_name(mysql));
  FAIL_IF(strcmp(mysql_character_set_name(mysql), cs_test), "Wrong character set name");
 
  mysql_close(mysql);
  return OK; 
}

Output:

# Character set changed from latin2 to utf8mb4
# Error: Wrong character set name



 Comments   
Comment by markus makela [ 2023-12-14 ]

The values being sent should either be removed or changed to character_set_server and collation_server. Changing them to the server values isn't as useful since client's wouldn't use them and correctly implementing the client character set and collation values is not trivial.

Comment by markus makela [ 2023-12-19 ]

An alternative approach is to just replace the values in character_set_client, character_set_connection, character_set_results and collation_connection with the character set and collation names that the client is requesting. This would require reading information_schema.COLLATIONS and then storing that result. The only problem with this approach is that the collations for the given character set can be overridden with character_set_collations which may make MaxScale behave differently than a direct MariaDB connection would IF we assume that the server has implemented MDEV-31609.

Generated at Thu Feb 08 04:31:57 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.