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

Backport of:

----------------------------------------------------------
revno: 2630.4.26
committer: Konstantin Osipov <konstantin@mysql.com>
branch nick: mysql-6.0-prelocked_mode-to-push
timestamp: Fri 2008-06-06 23:19:04 +0400
message:
  WL#3726: work on review comments.
  Remove thd->locked_tables. Always store MYSQL_LOCK instances in
  thd->lock.
  Rename thd->prelocked_mode to thd->locked_tables_mode.
  Use thd->locked_tables_mode to determine if we
  are under LOCK TABLES. Update the code to not assume that
  if thd->lock is set, LOCK TABLES mode is off.
  Review comments.
This commit is contained in:
Konstantin Osipov
2009-12-01 17:39:03 +03:00
parent 801ef812ba
commit 1523cea6e9
22 changed files with 208 additions and 213 deletions

View File

@ -383,7 +383,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
LOCK_open is not enough because global read lock is held without holding
LOCK_open).
*/
if (!thd->locked_tables &&
if (!thd->locked_tables_mode &&
!(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))
DBUG_RETURN(TRUE);
@ -444,7 +444,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
/* Keep consistent with respect to other DDL statements */
mysql_ha_rm_tables(thd, tables);
if (thd->locked_tables)
if (thd->locked_tables_mode)
{
/* Under LOCK TABLES we must only accept write locked tables. */
if (!(tables->table= find_write_locked_table(thd->open_tables, tables->db,
@ -493,7 +493,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
table->triggers->drop_trigger(thd, tables, &stmt_query));
/* Under LOCK TABLES we must reopen the table to activate the trigger. */
if (!result && thd->locked_tables)
if (!result && thd->locked_tables_mode)
{
/* Make table suitable for reopening */
close_data_files_and_leave_as_placeholders(thd, tables->db,
@ -527,7 +527,7 @@ end:
locks. Otherwise call to close_thread_tables() will take care about both
TABLE instance created by reopen_name_locked_table() and metadata lock.
*/
if (thd->locked_tables && tables && tables->table)
if (thd->locked_tables_mode && tables && tables->table)
mdl_downgrade_exclusive_lock(&thd->mdl_context,
tables->table->mdl_lock_data);