Debian Codegraph @

mysql-test/suite/group_replication/r/gr_switch_primary_timeout_begin_transactions_rollback.result

raw
1 include/group_replication.inc
2 Warnings:
3 Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4 Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
5 [connection server1]
6
7 # 1. Setup group of 2 servers, M1(primary) and M2(secondary).
8 CREATE TABLE t1(c1 int primary key);
9 include/start_and_bootstrap_group_replication.inc
10 [connection server2]
11 include/start_group_replication.inc
12
13 # 2. Execute change primary from server2(secondary) and block the operation.
14 [connection server2]
15 SET @@GLOBAL.DEBUG= '+d,group_replication_block_primary_action_validation';
16 SELECT group_replication_set_as_primary("SERVER2_UUID", 1);;
17 [connection server1]
18
19 # 3. Execute transaction on server1(primary), transactions should fail.
20 [connection server1]
21 INSERT INTO t1 values(1);
22 ERROR HY000: All queries have been blocked while function 'group_replication_set_as_primary()' is executing. Please refer timeout parameter of function 'group_replication_set_as_primary()'.
23 CREATE TABLE t2(c1 int primary key);
24 ERROR HY000: All queries have been blocked while function 'group_replication_set_as_primary()' is executing. Please refer timeout parameter of function 'group_replication_set_as_primary()'.
25 CREATE TABLE t1(c1 int primary key);
26 ERROR HY000: All queries have been blocked while function 'group_replication_set_as_primary()' is executing. Please refer timeout parameter of function 'group_replication_set_as_primary()'.
27 SELECT c1 FROM t1;
28 ERROR HY000: All queries have been blocked while function 'group_replication_set_as_primary()' is executing. Please refer timeout parameter of function 'group_replication_set_as_primary()'.
29 DO group_replication_enable_member_action("mysql_disable_super_read_only_if_primary", "AFTER_PRIMARY_ELECTION");
30 ERROR HY000: All queries have been blocked while function 'group_replication_set_as_primary()' is executing. Please refer timeout parameter of function 'group_replication_set_as_primary()'.
31 SELECT group_replication_enable_member_action("mysql_disable_super_read_only_if_primary", "AFTER_PRIMARY_ELECTION");
32 ERROR HY000: All queries have been blocked while function 'group_replication_set_as_primary()' is executing. Please refer timeout parameter of function 'group_replication_set_as_primary()'.
33
34 # 4. Execute commands which are unaffected with
35 # group_replication_set_as_primary() in execution.
36 DO SLEEP(1);
37 SELECT SLEEP(1);
38 SLEEP(1)
39 0
40 SELECT COUNT(*) from performance_schema.replication_group_members;
41 COUNT(*)
42 2
43 SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE='debug sync point: now';
44 COUNT(*)=0
45 1
46 Warnings:
47 Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
48 SELECT COUNT(*)=1 FROM sys.version;
49 COUNT(*)=1
50 1
51
52 # 5. Unblock change primary from server2 and reap the operation.
53 [connection server_2]
54 SET DEBUG_SYNC= "now SIGNAL signal.primary_action_continue";
55 [connection server2]
56 group_replication_set_as_primary("SERVER2_UUID", 1)
57 Primary server switched to: SERVER2_UUID
58
59 # 6. Assert primary changed.
60 # Assert data is not present on M1 and M2.
61 [connection server2]
62 include/gr_assert_primary_member.inc
63 [connection server1]
64 include/gr_assert_secondary_member.inc
65 include/assert.inc ['There is no value 1 in table t1']
66 include/assert.inc ['Check table t2 does not exist.']
67 include/diff_tables.inc [server1:test.t1, server2:test.t1]
68
69 # 7. Execute change primary from server2(primary) and block the operation.
70 [connection server2]
71 SELECT group_replication_set_as_primary("SERVER1_UUID", 1);;
72 [connection server_2]
73
74 # 8. Execute transaction on server2(primary), transactions should fail.
75 [connection server_2]
76 INSERT INTO t1 values(1);
77 ERROR HY000: All queries have been blocked while function 'group_replication_set_as_primary()' is executing. Please refer timeout parameter of function 'group_replication_set_as_primary()'.
78 CREATE TABLE t2(c1 int primary key);
79 ERROR HY000: All queries have been blocked while function 'group_replication_set_as_primary()' is executing. Please refer timeout parameter of function 'group_replication_set_as_primary()'.
80 CREATE TABLE t1(c1 int primary key);
81 ERROR HY000: All queries have been blocked while function 'group_replication_set_as_primary()' is executing. Please refer timeout parameter of function 'group_replication_set_as_primary()'.
82 SELECT c1 FROM t1;
83 ERROR HY000: All queries have been blocked while function 'group_replication_set_as_primary()' is executing. Please refer timeout parameter of function 'group_replication_set_as_primary()'.
84 DO group_replication_enable_member_action("mysql_disable_super_read_only_if_primary", "AFTER_PRIMARY_ELECTION");
85 ERROR HY000: All queries have been blocked while function 'group_replication_set_as_primary()' is executing. Please refer timeout parameter of function 'group_replication_set_as_primary()'.
86 SELECT group_replication_enable_member_action("mysql_disable_super_read_only_if_primary", "AFTER_PRIMARY_ELECTION");
87 ERROR HY000: All queries have been blocked while function 'group_replication_set_as_primary()' is executing. Please refer timeout parameter of function 'group_replication_set_as_primary()'.
88
89 # 9. Execute commands which are not stopped.
90 DO SLEEP(1);
91 SELECT SLEEP(1);
92 SLEEP(1)
93 0
94 SELECT COUNT(*) from performance_schema.replication_group_members;
95 COUNT(*)
96 2
97 SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE='debug sync point: now';
98 COUNT(*)=0
99 1
100 Warnings:
101 Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead
102 SELECT COUNT(*)=1 FROM sys.version;
103 COUNT(*)=1
104 1
105
106 # 10. Unblock change primary from server2 and reap the operation.
107 SET DEBUG_SYNC= "now SIGNAL signal.primary_action_continue";
108 [connection server2]
109 group_replication_set_as_primary("SERVER1_UUID", 1)
110 Primary server switched to: SERVER1_UUID
111
112 # 11. Assert primary changed.
113 # Assert data is not present on M1 and M2.
114 [connection server1]
115 include/gr_assert_primary_member.inc
116 [connection server2]
117 include/gr_assert_secondary_member.inc
118 include/assert.inc ['There is no value 1 in table t1']
119 include/assert.inc ['Check table t2 does not exist.']
120 include/diff_tables.inc [server1:test.t1, server2:test.t1]
121
122 # 12. Cleanup.
123 [connection server1]
124 DROP TABLE t1;
125 [connection server2]
126 SET DEBUG_SYNC= 'RESET';
127 SET @@GLOBAL.DEBUG= '-d,group_replication_block_primary_action_validation';
128 include/group_replication_end.inc