← Back to team overview

maria-developers team mailing list archive

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

 

Hi, Sergey!

On May 09, Sergey Vojtovich wrote:
> > > @@ -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.

Oh, ok.

> > 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?

If it isn't, why are you eliminating Hash_set?

Regards,
Sergei


Follow ups

References