Debian Codegraph @

mysql-test/suite/binlog/t/binlog_truncate_kill.test

raw
1 ###############################################################################
2 # Bug#17942050:KILL OF TRUNCATE TABLE WILL LEAD TO BINARY LOG WRITTEN WHILE
3 # ROWS REMAINS
4 #
5 # Problem:
6 # ========
7 # When truncate table fails while using transactional based engines even
8 # though the operation errors out we still continue and log it to binlog.
9 # Because of this master has data but the truncate will be written to binary
10 # log which will cause inconsistency.
11 #
12 # Test:
13 # =====
14 # Make master to wait in "open_table" call during the execution of truncate
15 # table command and kill the truncate table from other connection. This causes
16 # open table to return an error saying truncate failed during open table. This
17 # statement should not be binlogged.
18 ###############################################################################
19 --source include/have_innodb.inc
20 --source include/have_debug_sync.inc
21 --source include/have_binlog_format_statement.inc
22 RESET MASTER;
23 --connection default
24 CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, a INT, b INT) ENGINE=INNODB;
25 INSERT INTO t1(a, b) VALUES(1,2),(2,4),(3,6),(4,8),(5,10);
26 SET DEBUG_SYNC = "open_and_process_table signal truncate_before_lock wait_for forever";
27 --send TRUNCATE t1
28
29 connect(con1,localhost,root,,);
30 SET DEBUG_SYNC = "now wait_for truncate_before_lock";
31 # Wait for one connection to reach open_and_process_table.
32 --let $show_statement= SHOW PROCESSLIST
33 --let $field= State
34 --let $condition= 'debug sync point: open_and_process_table';
35 --source include/wait_show_condition.inc
36
37 SELECT ((@id := id) - id) FROM information_schema.processlist WHERE processlist.info LIKE '%TRUNCATE t1%' AND state LIKE '%open_and_process_table%';
38 # Test killing from mysql server
39 KILL QUERY @id;
40
41 connection default;
42 --ERROR ER_QUERY_INTERRUPTED
43 --reap
44
45 connection con1;
46 --source include/show_binlog_events.inc
47
48 disconnect con1;
49 --source include/wait_until_disconnected.inc
50 connection default;
51
52 SELECT * FROM t1;
53
54 DROP TABLE t1;
55 SET DEBUG_SYNC= 'RESET';