# At a local mysql-trunk-runtime repository of davi
3027 Davi Arnaut 2010-05-27
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.
@ sql/sql_truncate.cc
Pass FALSE to disable derived table handling. This was probably
reminiscent of the use of open_n_lock_single_table, which
can't be used as in some cases (e.g. merge) more than one
table will be opened.
@ sql/sql_truncate.h
TABLE_LIST is a struct.
modified:
sql/sql_truncate.cc
sql/sql_truncate.h
=== modified file 'sql/sql_truncate.cc'
--- a/sql/sql_truncate.cc 2010-05-27 20:40:54 +0000
+++ b/sql/sql_truncate.cc 2010-05-27 21:11:55 +0000
@@ -351,7 +351,7 @@ static bool open_and_lock_table_for_trun
the MDL lock taken above and otherwise there is no way to
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_SKIP_TEMPORARY))
DBUG_RETURN(TRUE);
@@ -406,7 +406,7 @@ bool mysql_truncate_table(THD *thd, TABL
table and delete all rows. In such a manner this can in fact
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))
DBUG_RETURN(TRUE);
=== modified file 'sql/sql_truncate.h'
--- a/sql/sql_truncate.h 2010-05-25 20:01:38 +0000
+++ b/sql/sql_truncate.h 2010-05-27 21:11:55 +0000
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
class THD;
-class TABLE_LIST;
+struct TABLE_LIST;
bool mysql_truncate_table(THD *thd, TABLE_LIST *table_ref);
Attachment: [text/bzr-bundle] bzr/davi.arnaut@sun.com-20100527211155-nbl1r2jawzq38w9g.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk-runtime branch (davi:3027) Bug#42643 | Davi Arnaut | 27 May |