* Jon Olav Hauglid <Jon.Hauglid@stripped> [09/06/23 16:30]:
> 2804 Jon Olav Hauglid 2009-06-23
> Bug#42546 Backup: RESTORE fails, thinking it finds an existing table
>
> The problem occured when a MDL locking conflict happened for a non-existent
Please always check your patch for the coding style and
spurious changes before submitting for review.
You can do it before committing, by doing bzr diff, and then
looking at the diff.
It's a good habit to read your diff before committing it,
you can find quite a few things yourself this way.
> === modified file 'sql/sql_table.cc'
> --- a/sql/sql_table.cc 2009-06-02 11:46:19 +0000
> +++ b/sql/sql_table.cc 2009-06-23 12:08:59 +0000
> @@ -4001,7 +4001,7 @@ static bool lock_table_name_if_not_cache
> const char *table_name,
> MDL_request **mdl_request)
> {
> - bool conflict;
> + bool conflict;
>
> if (!(*mdl_request= MDL_request::create(0, db, table_name, thd->mem_root)))
> return TRUE;
> @@ -4019,7 +4019,7 @@ static bool lock_table_name_if_not_cache
> /* Probably OOM. */
> return TRUE;
> }
> - else
> + else
> *mdl_request= NULL;
Spurious end whitespace.
> }
> else
> @@ -4069,27 +4069,58 @@ bool mysql_create_table(THD *thd, const
>
> if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
> {
> - if (lock_table_name_if_not_cached(thd, db, table_name,
> &target_mdl_request))
> + /*
> + Take exclusive metadata lock on the table name. If we are in LOCK TABLES
> mode,
> + we cannot wait in case of lock conflict for fear of deadlock.
> + */
> + if (thd->locked_tables_mode)
> {
> - result= TRUE;
> - goto unlock;
> + if (lock_table_name_if_not_cached(thd, db, table_name,
> &target_mdl_request))
> + {
> + result= TRUE;
> + goto unlock;
Use of tabs. Also some end whitespace.
In my vim color scheme, trailing whitespace is highlighted.
You could perhaps achieve the same in Emacs -- ask around people
using emacs.
The review for the patch itself will go in a separate mail.
Thank you for working on this bug,
--
kostja