Bug #27654 Need a way to disable reading of charsets files in client
Submitted: 4 Apr 2007 17:49 Modified: 2 Oct 2009 19:07
Reporter: Andy Salnikov (OCA) Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Charsets Severity:S4 (Feature request)
Version:5.0, 5.1, 6.0 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: Contribution

[4 Apr 2007 17:49] Andy Salnikov
Description:
Hi,

we would like to have a way to completely disable reading of the external 
charset files by mysql client. 

We use libmysqlclient provided by the third party as a part of some external
package. That libmysqlclient is compiled for the central installation at
the organization which provides the complete package, which happens to be on
AFS file system. Because the path to the charsets is hardwired into the 
library itself the client always tries to read the charset files from that
directory. Even though the AFS directory can be accessed at our site it is 
very inefficient because that organization is physically on the other side 
of the globe. Even worse, some machines on our network are behind firewall
and they cannot access the whole AFS, only our local portion of it. Those 
clients experience long timeouts (5 minutes) when trying to read anything 
from off-site AFS servers.

What we think would be very useful for us is a run-time option to disable 
reading of the external charsets. We cannot use my.ini for that purpose, 
so one possible option for this would be some environment variable. 
Alternative to that would be to specify charsets path at runtime using 
also the environment varible (or maybe using one envvar to either disable 
charsets completely or use alternative directory for charsets). 

Would something like this be possible to add to future versions?

Andy.

How to repeat:
1. On the UNIX machine with AFS installed build mysql with home on AFS, e.g.:

./configure --prefix=/afs/cern.ch/sw/lcg/external/mysql/5.0.18/slc3_ia32_gcc323
make

2. install it in a different place:

make install DESTDIR=/tmp/mysql-on-afs/

3. disable AFS ports (7000) in firewall, action depends on firewall software

4. try to run any client app with the library installed at point 3, it should 
  hang on access to 
  /afs/cern.ch/sw/lcg/external/mysql/5.0.18/slc3_ia32_gcc323/share/mysql/charsets/Index.xml

Suggested fix:
Introduce run-time configuration option (env. variable) to either disable 
loading of charsets completely or redirecting client to a different directory
with charsets
[16 Apr 2007 19:23] Andy Salnikov
Proposed patch to extend the configuration options for character sets

Attachment: patch.diff (text/plain), 11.22 KiB.

[16 Apr 2007 19:30] Andy Salnikov
Hi, I am sending a patch which adds a configuration option and run-time option 
to change the behavior w.r.t. external character sets. It adds one option to configure:

  --disable-external-charsets    do not read any external charset

and one environment variable MYSQL_EXTERNAL_CHARSETS which controls how mysql
searches for the directory with external charsets. Here is what I have added 
to mysql.info:

---------------------------------------------------------------------------

When mysql is built with the -disable-external-charsets configure option 
it normally does not read any external character sets from 
`SHAREDIR/charsets/Index'. This can be changed at run time with either 
-character-sets-dir option or environment variable MYSQL_EXTERNAL_CHARSETS:

   * If -character-sets-dir option is used, either on command line or in 
     option file, then its value is always used for the path to external 
     character sets.  This does not depend on whether 
     -disable-external-charsets was used or not during configure.

   * If environment variable MYSQL_EXTERNAL_CHARSETS is set to `yes' 
     then `SHAREDIR/charsets' is used as path to external character sets. 
     This does not depend on whether -disable-external-charsets was used 
     or not during configure.

   * If environment variable MYSQL_EXTERNAL_CHARSETS is set to `no' then 
     no external character sets are loaded.  This also does not depend on 
     whether -disable-external-charsets was used or not during configure.

   * If environment variable MYSQL_EXTERNAL_CHARSETS is set to anything 
     else then its value is used for the path to external character sets. 
     This does not depend on whether -disable-external-charsets was 
     used or not during configure.

   * If environment variable MYSQL_EXTERNAL_CHARSETS is not set then 
     the library configured with -disable-external-charsets does not 
     load external character set, and the library configured without
     -disable-external-charsets (default) loads character sets from 
     `SHAREDIR/charsets'.

---------------------------------------------------------------------------

The patch is based on 5.0.18 but should probably work OK on more recent 
releases too. 

we would be extremely greatful if something like this could be added to standard mysql releases.

Andy.
[17 Apr 2007 9:46] Sergei Golubchik
Why you cannot use my.ini ?
[17 Apr 2007 16:54] Andy Salnikov
The problem with my.ini is that nobody is actually using it. I understand that 
reading defaults from my.ini needs special coding on the client side, it is not
part of the default library initialization done through my_init(). Of course 
it's done for all native mysql applications, but for other clients it's rarely 
done, at least the third-party library that are working with does not read any
defaults from my.ini or provides any other way to transparently configure mysql
options.

Another serious problem with my.ini - it's impossible to manage it in the 
presence of multiple installations and multiple versions of the mysql. 
Server my.ini is probably OK as it is a part of the single server management, 
but client-side my.ini never worked for me at large scale.
[2 May 2007 17:00] Andy Salnikov
Did anybody from developers have a chance to look at the patch? I'd like to hear the verdict if possible :)

Andy.
[14 Jan 2008 5:08] Andy Salnikov
Did anybody have a chance to look at the patch?
[29 Sep 2008 6:28] Susanne Ebrecht
Many thanks for writing a feature request. We will discuss this.
[8 Jun 2009 22:56] liz drachnik
Hello Andy - 

In order for us to continue the process of reviewing your contribution to MySQL - We need you to review and sign the Sun|MySQL contributor agreement (the "SCA")

The process is explained here: 
http://forge.mysql.com/wiki/Sun_Contributor_Agreement

Getting a signed/approved SCA on file will help us facilitate your contribution-- this one, and others in the future.

Thank you ! 

Liz Drachnik  - Program Manager - MySQL
[2 Oct 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".