Commit 3cc56cb5 authored by Davi Arnaut's avatar Davi Arnaut

Bug#42643: InnoDB does not support replication of TRUNCATE TABLE

Post-merge fix: Pass the right parameter type to open_and_lock_tables.
Passing FALSE ensures that derived table handling is disabled, truncate
only operates on base tables.
parent 2d3e5019
...@@ -351,7 +351,7 @@ static bool open_and_lock_table_for_truncate(THD *thd, TABLE_LIST *table_ref, ...@@ -351,7 +351,7 @@ static bool open_and_lock_table_for_truncate(THD *thd, TABLE_LIST *table_ref,
the MDL lock taken above and otherwise there is no way to the MDL lock taken above and otherwise there is no way to
wait for FLUSH TABLES in deadlock-free fashion. wait for FLUSH TABLES in deadlock-free fashion.
*/ */
if (open_and_lock_tables(thd, table_ref, TL_WRITE, if (open_and_lock_tables(thd, table_ref, FALSE,
MYSQL_OPEN_IGNORE_FLUSH | MYSQL_OPEN_IGNORE_FLUSH |
MYSQL_OPEN_SKIP_TEMPORARY)) MYSQL_OPEN_SKIP_TEMPORARY))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
...@@ -406,7 +406,7 @@ bool mysql_truncate_table(THD *thd, TABLE_LIST *table_ref) ...@@ -406,7 +406,7 @@ bool mysql_truncate_table(THD *thd, TABLE_LIST *table_ref)
table and delete all rows. In such a manner this can in fact table and delete all rows. In such a manner this can in fact
open several tables if it's a temporary MyISAMMRG table. open several tables if it's a temporary MyISAMMRG table.
*/ */
if (open_and_lock_tables(thd, table_ref, TL_WRITE, if (open_and_lock_tables(thd, table_ref, FALSE,
MYSQL_OPEN_TEMPORARY_ONLY)) MYSQL_OPEN_TEMPORARY_ONLY))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
class THD; class THD;
class TABLE_LIST; struct TABLE_LIST;
bool mysql_truncate_table(THD *thd, TABLE_LIST *table_ref); bool mysql_truncate_table(THD *thd, TABLE_LIST *table_ref);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment