On Feb 26, 2009, at 4:16 AM, Sergei Golubchik wrote:
> Hi, Alexey!
>
> On Feb 26, Alexey Kopytov wrote:
>> Hi Sergei,
>>
>> Sergei Golubchik wrote:
>>> Hi, Alexey!
>>> On Feb 25, Alexey Kopytov wrote:
>>>> #At file:///Users/kaa/src/bzr/bugteam/bug40552/my51-bug40552/
>>>> based on
>>>> revid:azundris@stripped
>>>>
>>>> 2812 Alexey Kopytov 2009-02-25
>>>> Fix for bug #40552: Race condition around default_directories
>>>> in load_defaults()
>>>> load_defaults(),
>>>> my_search_option_files() and my_print_default_files()
>>>> utilized a
>>>> global variable containing a pointer to thread local
>>>> memory. This
>>>> could lead to race conditions when those functions were
>>>> called with
>>>> high concurrency. Fixed by changing the
>>>> interface of
>>>> the said functions to avoid the necessity for using a global
>>>> variable.
>>> Not a good idea. load_defaults() is de facto part of the API, we
>>> should
>>> try to avoid chaning the prototype.
>>
>> First, I don't see a way to avoid that w/o introducing new locks.
>> Second, I don't see how changing the load_defaults() prototype
>> could affect
>> anyone. Yes, it's a part of the mysys "API", but how many programs
>> outside
>> of our source tree use it? Please clarify why you think it's a bad
>> idea.
>
> No, I mean it's a part of the client API. It's documented in the books
> and examples (just google for it), as it's the only way for the
> clients
> to implement the compatible command-line option handling.
For example, it's documented here: http://www.kitebird.com/mysql-book/
(The link to Chapter 7 downloads a PDF of the chapter that describes
how to use load_defaults().)
+1 Serg's point that this is the only way to implement MySQL program
option parsing like MySQL programs do it -- so you cannot just change
it without breaking all third-party programs that use it.
> I wouldn't care about the prototype stability if it would be only used
> by our tools.
>
> As for the "a way to avoid"...
>
> For example, rename load_defaults() to my_load_defaults(), fix it your
> way - with an argument - and create a new load_defauls() function with
> the old prototype, that calls my_load_defaults() with this argument
> being global default_directories.
>
> Regards / Mit vielen GrЭъen,
> Sergei
>
> --
> __ ___ ___ ____ __
> / |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
> / /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server
> Architect
> /_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB MЭnchen
> 161028
> <___/ Sonnenallee 1, 85551 Kirchheim-
> Heimstetten
> GeschДftsfЭhrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
> Vorsitzender des Aufsichtsrates: Martin HДring
>
> --
> MySQL Code Commits Mailing List
> For list archives: http://lists.mysql.com/commits
> To unsubscribe: http://lists.mysql.com/commits?unsub=1
>
--
Paul DuBois
Sun Microsystems / MySQL Documentation Team
Madison, Wisconsin, USA
www.mysql.com