← Back to team overview

maria-developers team mailing list archive

Re: Rev 4056: MDEV-5616 - Deadlock between CREATE/DROP FUNCTION and SELECT from view

 

Hi Sergei,

thanks for your comments.

On Thu, Feb 13, 2014 at 12:36:51PM +0100, Sergei Golubchik wrote:
> Hi, Sergey!
> 
> Ok to push.
> A couple of comments below.
> 
> On Feb 07, Sergey Vojtovich wrote:
> > revno: 4056
> > revision-id: svoj@xxxxxxxxxxx-20140207100451-8pnzn85pjjwvwfs4
> > parent: elenst@xxxxxxxxxxxxxx-20140205102537-7ern5gfca6a6ojg3
> > committer: Sergey Vojtovich <svoj@xxxxxxxxxxx>
> > branch nick: 5.5-mdev5616
> > timestamp: Fri 2014-02-07 14:04:51 +0400
> > message:
> >   MDEV-5616 - Deadlock between CREATE/DROP FUNCTION and SELECT from view
> >   
> >   Deadlock happened due to mixed lock order.
> >   CREATE/DROP function: wrlock(THR_LOCK_udf) -> lock(LOCK_open)
> >   SELECT from view: lock(LOCK_open) -> rdlock(THR_LOCK_udf)
> >   
> >   Fixed CREATE/DROP function so that LOCK_open does not intersect with
> >   wrlock(THR_LOCK_udf).
> >   
> >   10.0 is not affected: it doesn't hold LOCK_open while opening view.
> 
> I'm pretty sure it'll auto-merge and nobody will remember this warning
> at that time. So this patch will be in 10.0.
> 
> Perhaps you should add
> 
> #if MYSQL_VERSION_ID > 50600
> #error don't merge into 10.0
> #endif
> 
> ?
> Or, may be, it's not a big deal to have it in 10.0...
I believe it is a good idea to have it in 10.0: the less lock relationships we
have - the better.

> 
> > === modified file 'sql/sql_udf.cc'
> > --- a/sql/sql_udf.cc	2012-03-27 23:04:46 +0000
> > +++ b/sql/sql_udf.cc	2014-02-07 10:04:51 +0000
> > @@ -466,7 +467,11 @@ int mysql_create_function(THD *thd,udf_f
> >    if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
> >      thd->clear_current_stmt_binlog_format_row();
> >  
> > +  tables.init_one_table("mysql", 5, "func", 4, "func", TL_WRITE);
> 
> I know it's a old line that you've moved and it's a matter of taste
> anyway, so up to you, but generally I prefer to see STRING_WITH_LEN
> here. It 1) makes a certain class of typos impossible; 2) documents the
> code, one doesn't need to think what these 4 and 5 stand for.
Will do.

Thanks,
Sergey


References