1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Backport of:

----------------------------------------------------------
revno: 2617.69.24
committer: Konstantin Osipov <kostja@sun.com>
branch nick: 5.4-42546
timestamp: Fri 2009-08-14 19:22:05 +0400
message:
  A pre-requisite for a fix for Bug#42546 "Backup: RESTORE fails, thinking it
  finds an existing table"
  Back-port from WL 148 "Foreign keys" feature tree a patch
  that introduced Prelocking_strategy class -- a way to parameterize
  open_tables() behaviour, implemented by Dmitry Lenev.

(Part of WL#4284).

sql/sql_base.cc:
  Implement different prelocking strategies. Use an instance of
  prelocking_strategy in open_tables().
sql/sql_class.h:
  Add declarations for class Prelocking_strategy.
sql/sql_lex.h:
  Add a helper method to access last table of the global table list
  (lex->query_tables).
sql/sql_parse.cc:
  Use a special prelocking strategy when locking tables for LOCK TABLES.
sql/sql_table.cc:
  Use normal open_and_lock_tables_derived() in ALTER TABLE.
sql/sql_yacc.yy:
  Modify the grammar to not pollute the global table list with tables
  that should not be opened.
This commit is contained in:
Konstantin Osipov
2009-12-08 17:13:12 +03:00
parent 97d2a9233b
commit 302352723e
12 changed files with 790 additions and 418 deletions

View File

@ -3342,9 +3342,14 @@ end_with_restore_list:
thd->options|= OPTION_TABLE_LOCK;
thd->in_lock_tables=1;
res= (open_and_lock_tables_derived(thd, all_tables, FALSE,
MYSQL_OPEN_TAKE_UPGRADABLE_MDL) ||
thd->locked_tables_list.init_locked_tables(thd));
{
Lock_tables_prelocking_strategy lock_tables_prelocking_strategy;
res= (open_and_lock_tables_derived(thd, all_tables, FALSE,
MYSQL_OPEN_TAKE_UPGRADABLE_MDL,
&lock_tables_prelocking_strategy) ||
thd->locked_tables_list.init_locked_tables(thd));
}
thd->in_lock_tables= 0;