mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug #11764779 (former 57649)
FLUSH TABLES under FLUSH TABLES <list> WITH READ LOCK leads to assert failure. This assert was triggered if a statement tried up upgrade a metadata lock with an active FLUSH TABLE <list> WITH READ LOCK. The assert checks that the connection already holds a global intention exclusive metadata lock. However, FLUSH TABLE <list> WITH READ LOCK does not acquire this lock in order to be compatible with FLUSH TABLES WITH READ LOCK. Therefore any metadata lock upgrade caused the assert to be triggered. This patch fixes the problem by preventing metadata lock upgrade if the connection has an active FLUSH TABLE <list> WITH READ LOCK. ER_TABLE_NOT_LOCKED_FOR_WRITE will instead be reported to the client. Test case added to flush.test.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2004-2005 MySQL AB, 2008-2009 Sun Microsystems, Inc
|
||||
/* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -467,8 +467,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
|
||||
if (thd->locked_tables_mode)
|
||||
{
|
||||
/* Under LOCK TABLES we must only accept write locked tables. */
|
||||
if (!(tables->table= find_table_for_mdl_upgrade(thd->open_tables,
|
||||
tables->db,
|
||||
if (!(tables->table= find_table_for_mdl_upgrade(thd, tables->db,
|
||||
tables->table_name,
|
||||
FALSE)))
|
||||
goto end;
|
||||
|
Reference in New Issue
Block a user