Debian Codegraph @

mysql-test/suite/rpl/t/rpl_late_abort.test

raw
1 # Scenario:
2 # SigCon connects to slave and creates some lock on a record,
3 # and tries to commit, but pauses just before a check for is_aborted.
4 # Master changes the same record
5 # Applier thread (which is boosted to High Priority) tries to modify
6 # the same row Master has modified, but observes the lock created by
7 # SigCon, and decides to abort SigCon.
8 # SigCon becomes unpaused, notices it should abort.
9 # There was a bug in that SigCon client observed success, despite
10 # the transaction being aborted.
11
12 # no need to rerun this test three times
13 --source include/have_binlog_format_mixed.inc
14
15 --source include/have_debug.inc
16 --source include/have_debug_sync.inc
17 --source include/master-slave.inc
18
19 --source include/rpl_connection_slave.inc
20 SET GLOBAL DEBUG="+d,dbug_set_high_prio_sql_thread";
21
22 # now applier thread starts with high prio
23 # since we are now setting the internal flag
24 --source include/stop_slave_sql.inc
25 --source include/start_slave_sql.inc
26
27 --source include/rpl_connection_master.inc
28
29 ####### MASTER #######
30 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
31 INSERT INTO t1 VALUES (0);
32
33 ####### SIGCON #######
34 --let $rpl_connection_name= sigcon
35 --let $rpl_server_number= 2
36 --source include/rpl_connect.inc
37
38 --echo [connection sigcon]
39 --let $sync_slave_connection= sigcon
40 --source include/sync_slave_sql_with_master.inc
41
42
43 BEGIN;
44 SELECT c1 FROM t1 WHERE c1=0 FOR UPDATE;
45 SET DEBUG_SYNC='trx_commit_for_mysql_checks_for_aborted WAIT_FOR waiting1';
46 --send COMMIT
47
48 ####### SLAVE #######
49 --source include/rpl_connection_slave.inc
50 # Wait until sigcon reaches the ha_innobase_update_row_done debug sync point.
51 --let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: trx_commit_for_mysql_checks_for_aborted'
52 --source include/wait_condition.inc
53
54 ####### MASTER #######
55 --source include/rpl_connection_master.inc
56 UPDATE t1 SET c1=1 WHERE c1=0;
57
58 ####### SLAVE #######
59 --source include/rpl_connection_slave.inc
60 --sleep 3
61 # Now signal the waiting thread on sigcon to resume
62 # and it should end up in an error stating that it
63 # was aborted
64 SET DEBUG_SYNC='now SIGNAL waiting1';
65 # Wait for c1 in t1 to be 1
66 --let $wait_condition=SELECT COUNT(*)=1 FROM t1 WHERE c1=1
67 --source include/wait_condition.inc
68
69
70 ####### SIGCON #######
71 --echo [connection sigcon]
72 --let $rpl_connection_name= sigcon
73 --source include/rpl_connection.inc
74 --reap
75
76 --disconnect sigcon
77
78 ####### SLAVE #######
79 --connection master
80 --let $sync_slave_connection= slave
81 --source include/sync_slave_sql_with_master.inc
82
83 --let $assert_text= 'There is a 1 in t1'
84 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
85 --source include/assert.inc
86
87 --let $assert_text= 'There is no 0 in t1'
88 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 0, count, 1] = 0
89 --source include/assert.inc
90
91 --let $assert_text= 'There is no 99 in t1'
92 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 99, count, 1] = 0
93 --source include/assert.inc
94
95 # Clean up.
96 --connection master
97 DROP TABLE t1;
98 --source include/sync_slave_sql_with_master.inc
99
100 # resetting the applier thread
101 --source include/stop_slave_sql.inc
102 SET GLOBAL DEBUG="-d,dbug_set_high_prio_sql_thread";
103 --source include/start_slave_sql.inc
104
105 --source include/rpl_end.inc