Debian Codegraph @

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

raw
1 ###############################################################################
2 #
3 # When the group is in **single-primary** mode and the user causes a
4 # change to **multi-primary** mode the group must:
5 # - 1: Update everywhere checks must be set to True on all members.
6 # - 2: All members must be writable, so read_only mode should be False
7 # - 3: When all members are writable, any transactional conflict must abort
8 #
9 # Test:
10 # 0. This test requires two servers in single primary mode
11 # 1. Create table to test the transaction conflict
12 # 2. Execute action to switch to multi primary mode
13 # 3. Assert on server2 that super_read_only is disabled and
14 # group_replication_enforce_update_everywhere_checks is enabled
15 # 4. Assert on server1 that super_read_only is disabled and
16 # group_replication_enforce_update_everywhere_checks is enabled
17 # 5. Execute two transactions in parallel and confirm that will trigger
18 # a conflict
19 # 6. Cleanup
20 #
21 ###############################################################################
22
23 --source include/have_debug_sync.inc
24 --source include/have_group_replication_plugin.inc
25 --let $rpl_skip_group_replication_start= 1
26 --let $rpl_group_replication_single_primary_mode=1
27 --source include/group_replication.inc
28
29 --let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
30
31 --source include/start_and_bootstrap_group_replication.inc
32
33 --source include/gr_assert_primary_member.inc
34
35 --echo
36 --echo # 1. Create table to test the transaction conflict
37
38 CREATE TABLE t1(a int primary key);
39
40 --let $rpl_connection_name= server2
41 --source include/rpl_connection.inc
42 --source include/start_group_replication.inc
43
44 --echo
45 --echo # 2. Execute action to switch to multi primary mode
46
47 SELECT group_replication_switch_to_multi_primary_mode();
48
49 --echo
50 --echo # 3. Assert on server2 that super_read_only is disabled and
51 --echo # group_replication_enforce_update_everywhere_checks is enabled
52
53 --source include/gr_assert_multi_primary_mode.inc
54
55 --echo
56 --echo # 4. Assert on server1 that super_read_only is disabled and
57 --echo # group_replication_enforce_update_everywhere_checks is enabled
58
59 --let $rpl_connection_name= server1
60 --source include/rpl_connection.inc
61
62 --source include/gr_assert_multi_primary_mode.inc
63
64 --echo
65 --echo # 5. Execute two transactions in parallel and confirm that will trigger
66 --echo # a conflict
67
68 --let $local_server_connection1=server1
69 --let $local_server_connection2=server_1
70 --let $remote_server_connection=server2
71 --let $local_transaction=INSERT INTO t1 VALUES(3)
72 --let $remote_transaction=INSERT INTO t1 VALUES (3)
73 --let $conflict_test=1
74 --source include/gr_parallel_local_and_remote_transactions.inc
75
76 --echo
77 --echo # 6. Cleanup
78
79 DROP TABLE t1;
80
81 --let $rpl_group_replication_reset_persistent_vars=1
82 --source include/group_replication_end.inc