maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #12155
Re: 5c26e91f755: Cleanup close_all_tables_for_name()
Sergei,
On Thu, Apr 02, 2020 at 11:43:26AM +0200, Sergei Golubchik wrote:
> Hi, Sergey!
>
> On Apr 01, Sergey Vojtovich wrote:
> > revision-id: 5c26e91f755 (mariadb-10.5.0-70-g5c26e91f755)
> > parent(s): 6daf451415f
> > author: Sergey Vojtovich <svoj@xxxxxxxxxxx>
> > committer: Sergey Vojtovich <svoj@xxxxxxxxxxx>
> > timestamp: 2019-12-25 20:24:25 +0400
> > message:
> >
> > Cleanup close_all_tables_for_name()
> >
> > close_all_tables_for_name() is always preceded by
> > wait_while_table_is_used(), which makes tdc_remove_table() redundant.
> > The only (now fixed) exception was close_cached_tables().
> >
> > Part of MDEV-17882 - Cleanup refresh version
> >
> > diff --git a/sql/sql_base.cc b/sql/sql_base.cc
> > index 60e2b9957a4..9494c0b7bd2 100644
> > --- a/sql/sql_base.cc
> > +++ b/sql/sql_base.cc
> > @@ -391,13 +391,12 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables,
> > if (! table)
> > continue;
> >
> > - if (thd->mdl_context.upgrade_shared_lock(table->mdl_ticket, MDL_EXCLUSIVE,
> > - timeout))
> > + if (wait_while_table_is_used(thd, table,
> > + HA_EXTRA_PREPARE_FOR_FORCED_CLOSE))
>
> the comment just above this block says
>
> /*
> If we are under LOCK TABLES, we need to reopen the tables without
> opening a door for any concurrent threads to sneak in and get
> lock on our tables. To achieve this we use exclusive metadata
> locks.
> */
>
> how do you achieve it now without the MDL_EXCLUSIVE ?
Well, I didn't remove upgrade to MDL_EXCLUSIVE. It is now done by
wait_while_table_is_used().
Regards,
Sergey
Follow ups
References