Debian Codegraph @

mysql-test/suite/galera/t/mdev_18730.test

raw
1 #
2 # Test scenario:
3 #
4 # Run an autocommit INSERT and stop the execution after the INSERT
5 # has released commit order critical section. On another connection,
6 # run SR transaction which will store one fragment into streaming log.
7 # If the bug is present, the fragment streaming log commit may
8 # out of order, and completing INSERT may cause assertion in debug build.
9 #
10 # Note that due to nature of this bug, it is may not be possible
11 # to construct fully deterministic test case which will crash the
12 # server each time if the bug is present, but will work with fix.
13 #
14
15 --source include/galera_cluster.inc
16 --source include/have_log_bin.inc
17 --source include/have_debug_sync.inc
18
19 CREATE TABLE t1 (f1 INT PRIMARY KEY);
20
21 # Control connection for controlling node_1 debug sync points
22 --let $galera_connection_name = ctrl
23 --let $galera_server_number = 1
24 --source include/galera_connect.inc
25
26 # Another connection for SR transaction
27 --let $galera_connection_name = node_1_sr
28 --let $galera_server_number = 1
29 --source include/galera_connect.inc
30
31 # Set up sync point and send INSERT
32 --connection node_1
33 SET DEBUG_SYNC = "wsrep_after_commit_order_leave SIGNAL acol_reached WAIT_FOR acol_continue";
34 --send INSERT INTO t1 VALUES (1)
35
36 # Wait until INSERT releases commit order
37 --connection ctrl
38 SET DEBUG_SYNC = "now WAIT_FOR acol_reached";
39
40 # Streaming transaction, will replicate fragment for each row separately.
41 --connection node_1_sr
42 SET SESSION wsrep_sync_wait = 0;
43 SET SESSION wsrep_trx_fragment_unit = 'rows';
44 SET SESSION wsrep_trx_fragment_size = 1;
45
46 START TRANSACTION;
47 --send INSERT INTO t1 VALUES (2)
48
49 --connection ctrl
50 # Now let the thread node_1 continue after a one second sleep.
51 # The sleep while not completely deterministic, will allow the SR
52 # insert to complete the commit out of order in most of the cases if
53 # the bug is present, leading to assertion in debug build.
54 --sleep 1
55 SET DEBUG_SYNC = "now SIGNAL acol_continue";
56
57 --connection node_1
58 --reap
59 --connection node_1_sr
60 --reap
61 ROLLBACK;
62
63 --connection ctrl
64 SET DEBUG_SYNC = "RESET";
65 --disconnect ctrl
66 --disconnect node_1_sr
67
68 --connection node_1
69 DROP TABLE t1;
70
71 --source include/galera_end.inc