← Back to team overview

maria-developers team mailing list archive

Re: SHOW PROFILE enhancements for Windows



>>>>> "Alex" == Alex Budovski <abudovski@xxxxxxxxx> writes:

Alex> Hi,
>> I looked at the original bug report and can't see how this bug fix
>> have anything to the with the real problem.
>> I have now done a proper fix for this. Can you please test that things
>> reported in http://bugs.mysql.com/bug.php?id=31173 now works
>> on windows ?

Alex> Yes, looks like the change works. Thanks for fixing it!

Thanks for checking!

>>> === modified file 'mysys/my_thr_init.c'
>>> --- mysys/my_thr_init.c       2010-01-29 10:45:51 +0000
>>> +++ mysys/my_thr_init.c       2010-01-29 14:32:36 +0000
>>> @@ -317,7 +317,7 @@
>>>    /*
>>>      Skip initialization if the thread specific variable is already initialized
>>>    */
>>> -  if (THR_KEY_mysys.id)
>>> +  if (THR_KEY_mysys.init)
>>>      goto end;
>>>    tmp= &THR_KEY_mysys;
>>>  #endif
>> I don't see checking the id would not work, as the id is guaranteed to
>> always be > 0

Alex> Hmm.. If I recall correctly, id was in fact 0 when I ran it through a debugger.

Alex> The reason I think the field was incorrect is because the function does

Alex>   tmp->init= 1;

Alex> to signify that the thread-local variable has been initialized. (Where
Alex> tmp == &THR_KEY_mysys).

Alex> But the check to prevent re-initialization checks a completely
Alex> different field (id), and when I was debugging it, was 0 at the time,
Alex> causing the code to be entered again.

Just before the init code we have:

  tmp->id= ++thread_id;

Which should guarantee that id is always > 0 (as there is no way
thread_id will roll over).

The reason why we checked mysys.id, is probably that originally we
had only the id field.  We didn't change the test when we added the
init field as the test should always work.


>> I am now applying all your changes except the above, as a diff but
>> with your comments, to MariaDB 5.1.  I will push it later today.

Alex> Thanks a lot!

Done and pushed, as you probably saw.