[MXS-372] Setting client character set after connection has no effect Created: 2015-09-17  Updated: 2015-12-01  Resolved: 2015-12-01

Status: Closed
Project: MariaDB MaxScale
Component/s: mariadbbackend
Affects Version/s: 1.2.0
Fix Version/s: 1.2.1

Type: Bug Priority: Major
Reporter: Woody Gilk Assignee: Johan Wikman
Resolution: Not a Bug Votes: 0
Labels: None

Attachments: PNG File Screen Shot 2015-09-16 at 2.19.00 PM.png    

 Description   

As seen in this code the client settings are copied on connect and are not updated once the connection is made. The following PHP script can be used to show how this causes an unexpected state.

This is very hard to reproduce, but we were able to do it by inserting ISO-8859-1 extended ASCII character (hex 96) into a table and then using this PHP script to show that the output is not the same as when the character set is "utf8".

<?php
 
$conn = new mysqli();
 
$conn->real_connect($servername, $username, $password, $database);
 
$conn->set_charset("utf8");
 
$r = $conn->query("SELECT notes FROM users WHERE id=3;");
$q = $r->fetch_assoc();
 
print_r($q);

I've also attached a screenshot of TCP debugging that shows the failure to set the character set after the fact when running the above script.



 Comments   
Comment by Dipti Joshi (Inactive) [ 2015-09-17 ]

shadowhand Which version of MaxSale did you use this PHP script against ?

Comment by Woody Gilk [ 2015-09-17 ]

maxscale-1.2.0-x86_64-ubuntu_trusty

Comment by markus makela [ 2015-11-26 ]

To my understanding, PHP:s mysqli does the character set change as a SET NAMES ... query. The connection flags are not used after the initial handshake so it doesn't matter if they aren't updated after the connection is made. Changing the character set after the connection is made is done completely on the server side and doesn't need to be tracked.

If a connection fails and it would be recovered by the readwritesplit router, it will use the initial handshake charset and repeat any SET NAMES queries before marking it as OK for use.

Comment by Johan Wikman [ 2015-12-01 ]

This does not seem to be a bug. Please try with 1.2.1 and if you are certain it is a MaxScale issue, please re-open this one or create a new one.

Generated at Thu Feb 08 03:58:48 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.