← 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 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.

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_requests.push_front(&table->mdl_request);
>    }

Regards,
Sergei


Follow ups