Commit ebb2a3f5 authored by Venkatesh Duggirala's avatar Venkatesh Duggirala

Problem: IO thread fails to connect to master if servers are configured with

special character sets like utf16, utf32, ucs2.

Analysis: MySQL server does not support few special character sets like
  utf16,utf32 and ucs2 as "client's character set"(eg: utf16,utf32, ucs2).
  It is known limitation listed in the documentation
  http://dev.mysql.com/doc/refman/5.5/en/charset-connection.html.

  The default value for default-character-set parameter is 'auto'
  which means that if the server's character set is not supported,
  then server automatically changes client's character set to
  predefined character-set which is 'latin1' in the current code.

  Eg:
  $ ./mysql -uroot -S$SOCKET_FILE --default-character-set=utf16
  ERROR 1231 (42000): Variable 'character_set_client' can't be set to the value of 'utf16'

  $ ./mysql -uroot -S$SOCKET_FILE will be successfully connected to
  server with 'latin1' as default client side character set.

  When IO thread is trying to connect to Master, it sets server's character
  set as client's character set. When Slave server is started with these
  special character sets, IO thread (which is like a connection to Master)
  fails because of the above said limitation.

 Fix: Now even IO thread also behaves the same as a regular client behaves.
  i.e., If server's character set is not supported as client's character set,
  then set default's client character set(latin1) as client's character set.
parent 23321f62
include/master-slave.inc
[connection master]
CREATE TABLE t1(i VARCHAR(20));
INSERT INTO t1 VALUES (0xFFFF);
include/diff_tables.inc [master:t1, slave:t1]
DROP TABLE t1;
include/rpl_end.inc
################################################################################
# Bug#19855907 IO THREAD AUTHENTICATION ISSUE WITH SOME CHARACTER SETS
# Problem: IO thread fails to connect to master if servers are configured with
# special character sets like utf16, utf32, ucs2.
#
# Analysis: MySQL server does not support few special character sets like
# utf16,utf32 and ucs2 as "client's character set"(eg: utf16,utf32, ucs2).
# When IO thread is trying to connect to Master, it sets server's character
# set as client's character set. When Slave server is started with these
# special character sets, IO thread (a connection to Master) fails because
# of the above said reason.
#
# Fix: If server's character set is not supported as client's character set,
# then set default's client character set(latin1) as client's character set.
###############################################################################
--source include/master-slave.inc
CREATE TABLE t1(i VARCHAR(20));
INSERT INTO t1 VALUES (0xFFFF);
--sync_slave_with_master
--let diff_tables=master:t1, slave:t1
--source include/diff_tables.inc
# Cleanup
--connection master
DROP TABLE t1;
--source include/rpl_end.inc
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -4280,7 +4280,23 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, ...@@ -4280,7 +4280,23 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
} }
#endif #endif
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname); /*
If server's default charset is not supported (like utf16, utf32) as client
charset, then set client charset to 'latin1' (default client charset).
*/
if (is_supported_parser_charset(default_charset_info))
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname);
else
{
sql_print_information("'%s' can not be used as client character set. "
"'%s' will be used as default client character set "
"while connecting to master.",
default_charset_info->csname,
default_client_charset_info->csname);
mysql_options(mysql, MYSQL_SET_CHARSET_NAME,
default_client_charset_info->csname);
}
/* This one is not strictly needed but we have it here for completeness */ /* This one is not strictly needed but we have it here for completeness */
mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir); mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment