Debian Codegraph @

mysql-test/suite/binlog/r/binlog_recover_async_rollback_trx.result

raw
1 CREATE TABLE t1 (id int primary key, data int) ENGINE = InnoDB;
2 INSERT INTO t1 VALUES (0, 1);
3 #
4 # 1. Check DML in prepared state can rollback correctly.
5 #
6 connect con1, localhost, root,,;
7 SET debug_sync = "ha_commit_trans_after_prepare SIGNAL prepared1 WAIT_FOR continue";
8 INSERT INTO t1 VALUES(1, 1);;
9 connect con2, localhost, root,,;
10 SET debug_sync = "now WAIT_FOR prepared1";
11 SET debug_sync = "ha_commit_trans_after_prepare SIGNAL prepared2 WAIT_FOR continue";
12 UPDATE t1 SET data = data + 1 WHERE id = 0;
13 connection default;
14 SET debug_sync = "now WAIT_FOR prepared2";
15 # Kill the server
16 disconnect con1;
17 disconnect con2;
18 # restart
19 # Expect (0, 1)
20 SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
21 SELECT * FROM t1;
22 id data
23 0 1
24 INSERT INTO t1 VALUES(1, 1);
25 UPDATE t1 SET data = data + 1 WHERE id = 0;
26 # Expect (0, 2), (1, 1)
27 SELECT * FROM t1;
28 id data
29 0 2
30 1 1
31 #
32 # 2. Test that innodb shutdown as expected if any error happens before
33 # normal rollback task is started. In the situation, rollback task
34 # should be started at preshutdown accordingly to rollback or
35 # deregister all recovered active transactions.
36 #
37 INSERT INTO t1 SELECT seq + 2, 1 FROM seq_1_to_1024;
38 BEGIN;
39 UPDATE t1 SET data = 10;
40 SET GLOBAL innodb_log_checkpoint_now = 1;
41 # Kill the server
42 # restart: --innodb-read-only
43 SELECT count(*) FROM information_schema.innodb_trx;
44 count(*)
45 1
46 # Kill the server
47 # restart: --innodb-read-only
48 SELECT count(*) FROM information_schema.innodb_trx;
49 count(*)
50 1
51 # restart
52 DROP TABLE t1;