← Back to team overview

maria-developers team mailing list archive

Re: 17540ad: MDEV-15890 Strange error message if you try to FLUSH TABLES <view> after LOCK TABLES <view>.


Hi, Alexey!

On Sep 03, Alexey Botchkov wrote:
> revision-id: 17540adc625ff4ac0f00aa10796cb6e763838d18 (mariadb-10.1.35-25-g17540ad)
> parent(s): 34e026f35a7fbeeaec412547ee207c880944ae68
> committer: Alexey Botchkov
> timestamp: 2018-09-03 16:49:46 +0400
> message:
> MDEV-15890 Strange error message if you try to FLUSH TABLES <view> after LOCK TABLES <view>.
> LOCK view WRITE shouldn't block FLUSH view.
> So we set the view's mdl_request type to it's tables.
> diff --git a/sql/sql_view.cc b/sql/sql_view.cc
> index 6bd6b6a..d7a2a6b 100644
> --- a/sql/sql_view.cc
> +++ b/sql/sql_view.cc
> @@ -1534,8 +1534,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
>        for (tbl= view_main_select_tables; tbl; tbl= tbl->next_local)
>        {
>          tbl->lock_type= table->lock_type;
> -        tbl->mdl_request.set_type((tbl->lock_type >= TL_WRITE_ALLOW_WRITE) ?
> -                                  MDL_SHARED_WRITE : MDL_SHARED_READ);
> +        tbl->mdl_request.set_type(table->mdl_request.type);
>        }

I agree it's looks like a proper fix.

But I'm a bit cautious about possible side effects.

A more conservative fix would be only change the lock level for

  tbl->lock_type == TL_NO_READ_WRITE ? TL_NO_READ_WRITE :

(or with an if(), for readability). But I don't see whether it'll make
any difference as compared to your fix.

Please, run all tests locally, and I mean *all*, big, ps, embedded.
And see if you can think of any cases where this change would cause a
change in behavior.

After that - ok to push!

Chief Architect MariaDB
and security@xxxxxxxxxxx