mariadb/mysql-test/suite/binlog/t
Davi Arnaut 4f18083b08 Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
The problem was that TRUNCATE TABLE didn't take a exclusive
lock on a table if it resorted to truncating via delete of
all rows in the table. Specifically for InnoDB tables, this
could break proper isolation as InnoDB ends up aborting some
granted locks when truncating a table.

The solution is to take a exclusive metadata lock before
TRUNCATE TABLE can proceed. This guarantees that no other
transaction is using the table.

Incompatible change: Truncate via delete no longer fails
if sql_safe_updates is activated (this was a undocumented
side effect).

libmysqld/CMakeLists.txt:
  Add new files to the build list.
libmysqld/Makefile.am:
  Add new files to the build list.
mysql-test/extra/binlog_tests/binlog_truncate.test:
  Add test case for Bug#42643
mysql-test/include/mix1.inc:
  Update test case as TRUNCATE TABLE now grabs a exclusive lock.
  Ensure that TRUNCATE waits for granted locks on the table.
mysql-test/suite/binlog/t/binlog_truncate_innodb.test:
  As with other data modifying statements, TRUNCATE is still not
  possible in a transaction with isolation level READ COMMITTED
  or READ UNCOMMITED. It would be possible to implement so, but
  it is not worth the effort.
mysql-test/suite/binlog/t/binlog_truncate_myisam.test:
  Test under different binlog formats.
mysql-test/suite/binlog/t/disabled.def:
  Re-enable test case.
mysql-test/t/innodb_bug38231.test:
  Truncate no longer works with row-level locks.
mysql-test/t/mdl_sync.test:
  Ensure that a acquired lock is not given up due to a conflict.
mysql-test/t/partition_innodb_semi_consistent.test:
  End transaction as to release metadata locks.
mysql-test/t/truncate.test:
  A metadata lock is now taken before the object is verified.
sql/CMakeLists.txt:
  Add new files to the build list.
sql/Makefile.am:
  Add new files to the build list.
sql/datadict.cc:
  Introduce a new file specific for data dictionary operations.
sql/datadict.h:
  Add header file.
sql/sql_base.cc:
  Rename data dictionary function.
sql/sql_bitmap.h:
  Include dependency.
sql/sql_delete.cc:
  Move away from relying on mysql_delete() to delete all rows of
  a table. Thus, move any bits related to truncate to sql_truncate.cc
sql/sql_delete.h:
  Remove parameter.
sql/sql_parse.cc:
  Add protection against the global read lock -- a intention
  exclusive lock can be acquired in the truncate path.
sql/sql_show.cc:
  Add sync point for testing scenarios where a pending flush
  is ignored.
sql/sql_truncate.cc:
  Acquire a shared metadata lock before accessing table metadata.
  Upgrade the lock to a exclusive one if the table can be re-created.
  Rework binlog rules to better reflect the requirements.
sql/sql_yacc.yy:
  Set appropriate lock types for table to be truncated.
sql/table.h:
  Move to data dictionary header.
2010-05-25 17:01:38 -03:00
..
binlog_base64_flag.test BUG#37426: RBR breaks for CHAR() UTF-8 fields > 85 chars 2008-06-30 22:11:18 +02:00
binlog_database.test Bug#32435: 2007-11-16 15:55:22 +01:00
binlog_delete_and_flush_index.test BUG#34582: FLUSH LOGS does not close and reopen the binlog index 2009-10-20 09:39:40 +01:00
binlog_format_switch_in_tmp_table.test Bug #45855 row events in binlog after switch from binlog_fmt=mix to stmt with open tmp tbl 2010-01-26 17:41:15 +08:00
binlog_grant.test WL#4738 streamline/simplify @@variable creation process 2009-12-22 10:35:56 +01:00
binlog_implicit_commit.test Bug #37221: SET AUTOCOMMIT=1 does not commit binary log 2009-09-23 13:20:48 +02:00
binlog_incident-master.opt Bug #44442: Incident events are silent in mysqlbinlog output 2009-05-11 13:32:38 +02:00
binlog_incident.test merging 5.1 main -> rpl+2. Some manual work required mostly due to bug46640 2009-11-06 18:35:04 +02:00
binlog_index.test Post-push fix for BUG#45292. 2009-12-08 16:03:19 +00:00
binlog_innodb.test Manual merge 5.1-rep+2 to 5.1-rep+3 2009-10-18 11:57:38 +08:00
binlog_innodb_row.test Post-push fix for BUG#51251. 2010-03-09 23:41:21 +00:00
binlog_killed.test BUG#50670: Slave stops with error code 1644 2010-04-28 14:47:49 +02:00
binlog_killed_simulate-master.opt bug#27571 merging. Fixing offsets and moving tests to the corrent 2007-10-31 11:48:49 +02:00
binlog_killed_simulate.test WL#2687 WL#5072 BUG#40278 BUG#47175 2009-11-03 19:02:56 +00:00
binlog_max_extension.test BUG#40611: MySQL cannot make a binary log after sequential number 2009-11-22 03:59:48 +00:00
binlog_mix_innodb_stat.test Bug#37312: Make test binlog_{row,stm}_innodb_stat more robust 2008-09-08 16:23:55 -04:00
binlog_multi_engine.test BUG#50670: Slave stops with error code 1644 2010-04-28 14:47:49 +02:00
binlog_old_versions.test Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.1 2008-02-07 12:38:13 +01:00
binlog_row_binlog-master.opt A follow-up on WL#5154 and WL#5182: remove forgotten options. 2010-03-03 22:22:02 +03:00
binlog_row_binlog.test WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_row_ctype_cp932.test WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_row_ctype_ucs.test WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_row_drop_tbl.test Backport of revno ## 2617.31.1, 2617.31.3, 2617.31.4, 2617.31.5, 2009-12-05 02:02:48 +03:00
binlog_row_drop_tmp_tbl.test WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_row_innodb_stat-master.opt WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_row_innodb_stat.test WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_row_insert_select.test WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_row_mix_innodb_myisam-master.opt WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_row_mix_innodb_myisam.test Post-merge fixes to make tests pass. 2008-01-11 13:25:26 +01:00
binlog_row_mysqlbinlog_db_filter.test Bug #46998 mysqlbinlog can't output BEGIN even if the database is included in a transaction 2009-09-30 10:31:25 +08:00
binlog_row_mysqlbinlog_verbose.test Attempt to fix Windows testcase output issue 2009-10-14 21:25:11 +08:00
binlog_sql_mode.test BUG#39526 sql_mode not retained in binary log for CREATE PROCEDURE 2009-02-28 09:35:18 +08:00
binlog_start_comment.test Merge 5.0 -> 5.1 2008-09-30 15:32:35 -04:00
binlog_statement_insert_delayed.test BUG#50670: Slave stops with error code 1644 2010-04-28 14:47:49 +02:00
binlog_stm_binlog-master.opt A follow-up on WL#5154 and WL#5182: remove forgotten options. 2010-03-03 22:22:02 +03:00
binlog_stm_binlog.test WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_stm_blackhole.test WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_stm_ctype_cp932.test WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_stm_ctype_ucs.test WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_stm_do_db-master.opt BUG#42829: binlogging enabled for all schemas regardless of 2009-09-24 15:52:52 +01:00
binlog_stm_do_db.test merging 5.1->rep+2->rep+3 2009-12-02 14:17:07 +02:00
binlog_stm_drop_tbl.test Backport of revno ## 2617.31.1, 2617.31.3, 2617.31.4, 2617.31.5, 2009-12-05 02:02:48 +03:00
binlog_stm_drop_tmp_tbl.test WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_stm_innodb_stat-master.opt WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_stm_innodb_stat.test Bug#37312: Make test binlog_{row,stm}_innodb_stat more robust 2008-09-08 16:23:55 -04:00
binlog_stm_insert_select.test WL#3933 Split main test suite to rpl, rpl_ndb and ndb 2007-06-27 14:28:02 +02:00
binlog_stm_mix_innodb_myisam-master.opt Manual merge of patch for Bug#46364 from mysql-next-mr-bugfixing. 2010-02-02 10:56:42 +03:00
binlog_stm_mix_innodb_myisam.test BUG#47995: Mark system functions as unsafe 2009-11-18 15:50:31 +01:00
binlog_stm_ps.test BUG#50670: Slave stops with error code 1644 2010-04-28 14:47:49 +02:00
binlog_stm_row.test BUG#50670: Slave stops with error code 1644 2010-04-28 14:47:49 +02:00
binlog_stm_unsafe_warning-master.opt Bug#46265: Can not disable warning about unsafe statements for binary logging 2009-07-31 10:00:35 -03:00
binlog_stm_unsafe_warning.test BUG#50670: Slave stops with error code 1644 2010-04-28 14:47:49 +02:00
binlog_stm_user_variables.test BUG#49562: SBR out of sync when using numeric data types + user 2010-01-19 23:16:22 +00:00
binlog_switch_inside_trans.test BUG#51277 SUPER_ACL should be checked unconditionally (binlog_format and binlog_direct) 2010-02-24 12:45:15 +00:00
binlog_tmp_table.test BUG#50670: Slave stops with error code 1644 2010-04-28 14:47:49 +02:00
binlog_truncate_innodb-master.opt Bug #36763 2009-02-06 17:06:41 +01:00
binlog_truncate_innodb.test Bug#42643: InnoDB does not support replication of TRUNCATE TABLE 2010-05-25 17:01:38 -03:00
binlog_truncate_myisam.test Bug#42643: InnoDB does not support replication of TRUNCATE TABLE 2010-05-25 17:01:38 -03:00
binlog_unsafe-master.opt Postfix after merge 2009-11-15 11:30:58 +08:00
binlog_unsafe.test BUG#50670: Slave stops with error code 1644 2010-04-28 14:47:49 +02:00
binlog_write_error.test Merge next-mr -> next-4284. 2010-02-04 23:15:47 +03:00
disabled.def Bug#42643: InnoDB does not support replication of TRUNCATE TABLE 2010-05-25 17:01:38 -03:00