Re: Incorrect locking for global_query_id

Tor Didriksen <[email protected]> Tue, 06 May 2014 08:27:11 +0200
Newsgroups gmane.comp.db.mysql.devel
Message-ID <[email protected]>
On 2014-05-06 01:12, Stewart Smith wrote:
> So, the Register link for creating a bugs.mysql.com account still
> doesn't work, so i'm filing a bug here:
>
>
> Found in MySQl 5.6.17,
>
> In sql/sp_head.cc:
>
> bool sp_head::execute_function(THD *thd, Item **argp, uint argcount,
>
> We have this code:
>
>      mysql_mutex_lock(&LOCK_thread_count);
>      q= global_query_id;
>      mysql_mutex_unlock(&LOCK_thread_count);
>
>
> Which is incorrect.

This goes all the way back to 5.0, when it was in fact correct.
That mutex was used to protect all sorts of things, including 
global_query_id.

Seems like it was broken sometime during development of 6.0
which never materialized as a product,
but parts of it were backported to 5.5

>
> It should at least by a my_atomic_load64 with the appropriate lock
> things around it.

Which is what we do in 5.7

> I haven't looked at if the mysql_bin.log.start_union_events(thd, q+1) is
> correct or not.
>
>

-- didrik



-- 
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe:    http://lists.mysql.com/internals