Debian Codegraph @

mysql-test/suite/group_replication/t/gr_async_channel_transaction_retry.test

raw
1 ################################################################################
2 # === Purpose ===
3 # This test validates that, in a cluster group replication,
4 # a transaction retry on a transaction that is being applied through an
5 # asynchronous channel on a replica-cluster group primary should successfully
6 # execute the retried transaction.
7 #
8 # === Implementation ===
9 # 00. The test requires two servers: server1 and 2
10 # 01. Setup source-replica
11 # 02. Setup replica as replica-cluster primary
12 # 03. Initial setup on the source
13 # 04. Generate commit_order_deadlock on replica-cluster primary so that
14 # transaction will be retried
15 # 05. Cleaning up
16 ################################################################################
17
18 --source include/big_test.inc
19 --source include/have_debug_sync.inc
20 --source include/have_group_replication_xcom_communication_stack.inc
21 --source include/force_restart.inc
22
23 --echo
24 --echo ############################################################
25 --echo # 01. Setup source-replica
26 --source include/uninstall_group_replication_plugin.inc
27 --source include/master-slave.inc
28
29 --echo
30 --echo ############################################################
31 --echo # 02. Setup replica as replica-cluster primary
32 --source include/rpl_connection_slave.inc
33
34 --let $allow_rpl_inited= 1
35 --let $_group_replication_local_address= localhost:$SERVER_GR_PORT_1
36 --let $_group_replication_group_seeds= localhost:$SERVER_GR_PORT_1,localhost:$SERVER_GR_PORT_2
37 --let $restart_parameters=restart:--group_replication_group_name=$group_replication_group_name --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_bootstrap_group=1 --group_replication_start_on_boot=1 --group_replication_single_primary_mode=1 --group_replication_enforce_update_everywhere_checks=0 --skip_slave_start=0
38 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
39 --source include/restart_mysqld.inc
40
41 --let $rpl_server_number= 2
42 --source include/rpl_reconnect.inc
43
44 --source include/rpl_connection_slave.inc
45
46 --let $group_replication_member_state= ONLINE
47 --source include/gr_wait_for_member_state.inc
48
49 --echo
50 --echo ############################################################
51 --echo # 03. Initial setup on the source
52 --source include/rpl_connection_master.inc
53
54 CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT, INDEX(c2)) ENGINE = InnoDB;
55 INSERT INTO t1 VALUES
56 (1, NULL),
57 (2, 2),
58 (3, NULL),
59 (4, 4),
60 (5, NULL),
61 (6, 6);
62
63 CREATE TABLE t2(a INT PRIMARY KEY);
64
65 --source include/sync_slave_sql_with_master.inc
66
67 --let $rpl_diff_statement = SELECT * FROM t1, t2
68 --let $mts_spco_gd_transaction_retries = 10
69 --source extra/rpl_tests/mts_spco_generate_deadlock_setup.inc
70
71 --echo
72 --echo ############################################################
73 --echo # 04. Generate commit_order_deadlock on replica-cluster
74 --echo # primary so that transaction will be retried
75 --source include/rpl_connection_master.inc
76 INSERT INTO t1 VALUES(13, 13);
77
78 --let $mts_spco_gd_trx_blocking_worker_1 = INSERT INTO t1 VALUES(14, NULL)
79 --let $mts_spco_gd_trx_assigned_worker_2 = INSERT INTO t1 VALUES(15, NULL)
80 --let $mts_spco_gd_trx_blocking_client = SET GLOBAL read_only = ON
81 --let $mts_spco_gd_trx_to_client_unblocking_workers = SET GLOBAL read_only = OFF
82 --source extra/rpl_tests/mts_spco_generate_deadlock.inc
83
84 --echo
85 --echo ############################################################
86 --echo # 05. Cleanup
87 --let $restart_parameters=restart:--skip_slave_start=0
88 --source include/kill_and_restart_mysqld.inc
89
90 --let $rpl_server_number= 2
91 --source include/rpl_reconnect.inc
92
93 --source include/rpl_connection_slave.inc
94 --source include/start_slave_sql.inc
95
96 --source include/rpl_connection_master.inc
97 DROP TABLE t1;
98 DROP TABLE t2;
99
100 --source include/install_group_replication_plugin.inc
101 --source include/rpl_end.inc
102
103 --source extra/rpl_tests/mts_spco_generate_deadlock_cleanup.inc