← Back to team overview

maria-developers team mailing list archive

Re: 0520a00: MDEV-7964 - delete_dynamic() takes 0.12% in OLTP RO

 

Hi Sergei,

On Fri, May 08, 2015 at 09:21:48PM +0200, Sergei Golubchik wrote:
> Hi, Sergey!
> 
> On Apr 16, svoj@xxxxxxxxxxx wrote:
> > revision-id: 0520a009c7139c940ab92345054bf0dba7808b11
> > parent(s): eb059cd41e5553597f81fd90ad55c07d76d317ce
> > committer: Sergey Vojtovich
> > branch nick: mariadb
> > timestamp: 2015-04-16 18:38:26 +0400
> > message:
> > 
> > MDEV-7964 - delete_dynamic() takes 0.12% in OLTP RO
> ... 
> > diff --git a/sql/sql_base.cc b/sql/sql_base.cc
> > index 0e9f668..d36de7f 100644
> > --- a/sql/sql_base.cc
> > +++ b/sql/sql_base.cc
> > @@ -4240,9 +4233,17 @@ thr_lock_type read_lock_type_for_table(THD *thd,
> >        DBUG_RETURN(true);
> >      }
> >  
> > -    if (! (flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK) &&
> > -        schema_set.insert(table))
> > -      DBUG_RETURN(TRUE);
> > +    /* Scoped locks: Take intention exclusive locks on all involved schemas. */
> > +    if (!(flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK))
> > +    {
> > +      MDL_request *schema_request= new (thd->mem_root) MDL_request;
> > +      if (schema_request == NULL)
> > +        DBUG_RETURN(TRUE);
> > +      schema_request->init(MDL_key::SCHEMA, table->db, "",
> > +                           MDL_INTENTION_EXCLUSIVE,
> > +                           MDL_TRANSACTION);
> > +      mdl_requests.push_front(schema_request);
> > +    }
> 
> As far as I understand, the Hash_set was used here to make only one MDL
> request per schema. Now if you'll have 10 tables all in one schema,
> you'll make push 10 MDL requests instead of one.
It was probably supposed to, but since Hash_set is non-unique it didn't do
anything useful. That is we would get 10 MDL request with old code too.

> Which may be fine, if MDL subsystem places only one lock in this case
> (iirc, it does). But what is cheaper - collapse identical schemas into
> one mdl request here (with Hash_set) or let mdl sort it out later?
MDL doesn't eliminate them, but rather clones compatible requests.
Performance wise it will be slower in certain cases, but since this is DDL
is performance that important?

Thanks,
Sergey


Follow ups

References