MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Sergei Golubchik Date:July 23 2009 12:48pm
Subject:Re: bzr commit into mysql-5.0-bugteam branch (gshchepa:2768)
Bug#38816
View as plain text  
Hi, Konstantin!

On Jul 22, Konstantin Osipov wrote:
> * Gleb Shchepa <gshchepa@stripped> [09/06/11 02:56]:
> >  2768 Gleb Shchepa	2009-06-11
> >       Bug #38816: kill + flush tables with read lock + stored
> >                   procedures causes crashes!
> >       
> === modified file 'sql/ha_innodb.cc'
> --- sql/ha_innodb.cc	2009-06-25 09:50:26 +0000
> +++ sql/ha_innodb.cc	2009-07-22 15:26:07 +0000
> @@ -588,11 +588,11 @@ innobase_mysql_print_thd(
>  	uint	max_query_len)	/* in: max query length to print, or 0 to
>  				   use the default max length */
>  {
> -	const THD*	thd;
> +	THD*		thd;
>          const Security_context *sctx;
>  	const char*	s;
>  
> -        thd = (const THD*) input_thd;
> +        thd = (THD*) input_thd;
>          /* We probably want to have original user as part of debug output. */
>          sctx = &thd->main_security_ctx;
>  
> @@ -619,6 +619,7 @@ innobase_mysql_print_thd(
>  		fputs(s, f);
>  	}
>  
> +	VOID(pthread_mutex_lock(&thd->LOCK_thd_data));
>  	if ((s = thd->query)) {
>  		/* 3100 is chosen because currently 3000 is the maximum
>  		   max_query_len we ever give this. */

minor comment - I've seen this first in Mats' patch - in principle
locking the mutex inside THD doesn't change it, so it should be possible
to lock it even if THD is declared const. C++ solution is the keyword
"mutable":

 class THD {
   ...
   mutable pthread_mutex_t LOCK_thd_data;
   ...
 }

and you won't need to pretend that the object will be modified when you
only want to read it under a mutex.

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, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring
Thread
bzr commit into mysql-5.0-bugteam branch (gshchepa:2768) Bug#38816Gleb Shchepa11 Jun
  • Re: bzr commit into mysql-5.0-bugteam branch (gshchepa:2768) Bug#38816Konstantin Osipov23 Jul
    • Re: bzr commit into mysql-5.0-bugteam branch (gshchepa:2768)Bug#38816Sergei Golubchik23 Jul
      • Re: bzr commit into mysql-5.0-bugteam branch (gshchepa:2768) Bug#38816Konstantin Osipov23 Jul