Debian Codegraph @

mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test

raw
1 --source include/have_innodb.inc
2 # Testing group commit by crashing a few times.
3 # Test adapted from the Facebook patch: lp:mysqlatfacebook
4 --source include/not_embedded.inc
5 # Don't test this under valgrind, memory leaks will occur
6 --source include/not_valgrind.inc
7
8 # Binary must be compiled with debug for crash to occur
9 --source include/have_debug.inc
10 --source include/have_log_bin.inc
11
12 CREATE TABLE t1(a CHAR(255),
13 b CHAR(255),
14 c CHAR(255),
15 d CHAR(255),
16 id INT,
17 PRIMARY KEY(id)) ENGINE=InnoDB;
18 create table t2 like t1;
19 delimiter //;
20 create procedure setcrash(IN i INT)
21 begin
22 CASE i
23 WHEN 1 THEN SET SESSION debug_dbug="d,crash_commit_after_prepare";
24 WHEN 2 THEN SET SESSION debug_dbug="d,crash_commit_after_log";
25 WHEN 3 THEN SET SESSION debug_dbug="d,crash_commit_before_unlog";
26 WHEN 4 THEN SET SESSION debug_dbug="d,crash_commit_after";
27 WHEN 5 THEN SET SESSION debug_dbug="d,crash_commit_before";
28 ELSE BEGIN END;
29 END CASE;
30 end //
31 delimiter ;//
32 # Avoid getting a crashed mysql.proc table.
33 FLUSH TABLES;
34
35 let $numtests = 5;
36
37 let $numinserts = 10;
38 while ($numinserts)
39 {
40 dec $numinserts;
41 eval INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', 1+$numinserts);
42 }
43
44 --enable_reconnect
45
46 while ($numtests)
47 {
48 SET binlog_format= mixed;
49 RESET MASTER;
50
51 START TRANSACTION;
52 insert into t1 select * from t2;
53 # Write file to make mysql-test-run.pl expect crash
54 --write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
55
56 eval call setcrash($numtests);
57
58 # Run the crashing query
59 --error 2006,2013
60 COMMIT;
61
62 # Poll the server waiting for it to be back online again.
63 --source include/wait_until_connected_again.inc
64
65 # table and binlog should be in sync.
66 SELECT * FROM t1 ORDER BY id;
67 --replace_column 2 # 5 #
68 SHOW BINLOG EVENTS LIMIT 4,1;
69
70 delete from t1;
71
72 dec $numtests;
73 }
74
75 # final cleanup
76 DROP TABLE t1;
77 DROP TABLE t2;
78 DROP PROCEDURE setcrash;