Skip to content

Commit c20b55e

Browse files
committed
WL7639 Ndb Active Active Manageability improvements
Implementation of ndb_slave_conflict_role control variable. This control variable allows the slave role in a future asymmetric conflict detection algorithm to be modified online. No conflict algorithm supports this control yet. The roles are : NONE, SECONDARY, PRIMARY, PASS. The role can only be changed when the slave SQL thread is not running.
1 parent 5379584 commit c20b55e

8 files changed

+562
-2
lines changed

mysql-test/suite/ndb/r/ndb_basic.result

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ ndb_recv_thread_cpu_mask #
135135
ndb_report_thresh_binlog_epoch_slip #
136136
ndb_report_thresh_binlog_mem_usage #
137137
ndb_show_foreign_key_mock_tables #
138+
ndb_slave_conflict_role #
138139
ndb_table_no_logging #
139140
ndb_table_temporary #
140141
ndb_use_copying_alter_table #
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
include/master-slave.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 master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5+
[connection master]
6+
show global variables like 'ndb_slave_conflict_role';
7+
Variable_name Value
8+
ndb_slave_conflict_role NONE
9+
Slave_SQL_Running = 'Yes'
10+
stop slave sql_thread;
11+
Slave_SQL_Running = 'No'
12+
Show set-to-same state is ok
13+
set global ndb_slave_conflict_role = NONE;
14+
Now transition through all status, including set-to-self
15+
set global ndb_slave_conflict_role = "PRIMARY";
16+
show global variables like 'ndb_slave_conflict_role';
17+
Variable_name Value
18+
ndb_slave_conflict_role PRIMARY
19+
set global ndb_slave_conflict_role = "PRIMARY";
20+
set global ndb_slave_conflict_role = "SECONDARY";
21+
show global variables like 'ndb_slave_conflict_role';
22+
Variable_name Value
23+
ndb_slave_conflict_role SECONDARY
24+
set global ndb_slave_conflict_role = "SECONDARY";
25+
set global ndb_slave_conflict_role = "NONE";
26+
set global ndb_slave_conflict_role = "SECONDARY";
27+
set global ndb_slave_conflict_role = "PRIMARY";
28+
set global ndb_slave_conflict_role = "NONE";
29+
set global ndb_slave_conflict_role = "PASS";
30+
show global variables like 'ndb_slave_conflict_role';
31+
Variable_name Value
32+
ndb_slave_conflict_role PASS
33+
set global ndb_slave_conflict_role = "PASS";
34+
set global ndb_slave_conflict_role = "NONE";
35+
Now test illegal transitions
36+
set global ndb_slave_conflict_role = "PRIMARY";
37+
set global ndb_slave_conflict_role = "PASS";
38+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from PRIMARY to PASS failed : Invalid role change.
39+
show global variables like 'ndb_slave_conflict_role';
40+
Variable_name Value
41+
ndb_slave_conflict_role PRIMARY
42+
set global ndb_slave_conflict_role = "SECONDARY";
43+
set global ndb_slave_conflict_role = "PASS";
44+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from SECONDARY to PASS failed : Invalid role change.
45+
show global variables like 'ndb_slave_conflict_role';
46+
Variable_name Value
47+
ndb_slave_conflict_role SECONDARY
48+
set global ndb_slave_conflict_role = "NONE";
49+
set global ndb_slave_conflict_role = "PASS";
50+
set global ndb_slave_conflict_role = "PRIMARY";
51+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from PASS to PRIMARY failed : Invalid role change.
52+
show global variables like 'ndb_slave_conflict_role';
53+
Variable_name Value
54+
ndb_slave_conflict_role PASS
55+
set global ndb_slave_conflict_role = "SECONDARY";
56+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from PASS to SECONDARY failed : Invalid role change.
57+
show global variables like 'ndb_slave_conflict_role';
58+
Variable_name Value
59+
ndb_slave_conflict_role PASS
60+
set global ndb_slave_conflict_role = "NONE";
61+
Now test transitions not possible due to
62+
Slave SQL thread running
63+
start slave sql_thread;
64+
Slave_SQL_Running = 'Yes'
65+
From NONE
66+
set global ndb_slave_conflict_role = "NONE";
67+
set global ndb_slave_conflict_role = "PRIMARY";
68+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from NONE to PRIMARY failed : Cannot change role while Slave SQL thread is running. Use STOP SLAVE first.
69+
show global variables like 'ndb_slave_conflict_role';
70+
Variable_name Value
71+
ndb_slave_conflict_role NONE
72+
set global ndb_slave_conflict_role = "SECONDARY";
73+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from NONE to SECONDARY failed : Cannot change role while Slave SQL thread is running. Use STOP SLAVE first.
74+
show global variables like 'ndb_slave_conflict_role';
75+
Variable_name Value
76+
ndb_slave_conflict_role NONE
77+
set global ndb_slave_conflict_role = "PASS";
78+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from NONE to PASS failed : Cannot change role while Slave SQL thread is running. Use STOP SLAVE first.
79+
show global variables like 'ndb_slave_conflict_role';
80+
Variable_name Value
81+
ndb_slave_conflict_role NONE
82+
stop slave sql_thread;
83+
From PRIMARY
84+
set global ndb_slave_conflict_role = "PRIMARY";
85+
start slave sql_thread;
86+
set global ndb_slave_conflict_role = "PRIMARY";
87+
set global ndb_slave_conflict_role = "SECONDARY";
88+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from PRIMARY to SECONDARY failed : Cannot change role while Slave SQL thread is running. Use STOP SLAVE first.
89+
show global variables like 'ndb_slave_conflict_role';
90+
Variable_name Value
91+
ndb_slave_conflict_role PRIMARY
92+
set global ndb_slave_conflict_role = "NONE";
93+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from PRIMARY to NONE failed : Cannot change role while Slave SQL thread is running. Use STOP SLAVE first.
94+
show global variables like 'ndb_slave_conflict_role';
95+
Variable_name Value
96+
ndb_slave_conflict_role PRIMARY
97+
set global ndb_slave_conflict_role = "PASS";
98+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from PRIMARY to PASS failed : Invalid role change.
99+
show global variables like 'ndb_slave_conflict_role';
100+
Variable_name Value
101+
ndb_slave_conflict_role PRIMARY
102+
stop slave sql_thread;
103+
From SECONDARY
104+
set global ndb_slave_conflict_role = "SECONDARY";
105+
start slave sql_thread;
106+
set global ndb_slave_conflict_role = "SECONDARY";
107+
set global ndb_slave_conflict_role = "PRIMARY";
108+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from SECONDARY to PRIMARY failed : Cannot change role while Slave SQL thread is running. Use STOP SLAVE first.
109+
show global variables like 'ndb_slave_conflict_role';
110+
Variable_name Value
111+
ndb_slave_conflict_role SECONDARY
112+
set global ndb_slave_conflict_role = "NONE";
113+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from SECONDARY to NONE failed : Cannot change role while Slave SQL thread is running. Use STOP SLAVE first.
114+
show global variables like 'ndb_slave_conflict_role';
115+
Variable_name Value
116+
ndb_slave_conflict_role SECONDARY
117+
set global ndb_slave_conflict_role = "PASS";
118+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from SECONDARY to PASS failed : Invalid role change.
119+
show global variables like 'ndb_slave_conflict_role';
120+
Variable_name Value
121+
ndb_slave_conflict_role SECONDARY
122+
stop slave sql_thread;
123+
From PASS
124+
set global ndb_slave_conflict_role = "NONE";
125+
set global ndb_slave_conflict_role = "PASS";
126+
start slave sql_thread;
127+
set global ndb_slave_conflict_role = "PASS";
128+
set global ndb_slave_conflict_role = "PRIMARY";
129+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from PASS to PRIMARY failed : Invalid role change.
130+
show global variables like 'ndb_slave_conflict_role';
131+
Variable_name Value
132+
ndb_slave_conflict_role PASS
133+
set global ndb_slave_conflict_role = "SECONDARY";
134+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from PASS to SECONDARY failed : Invalid role change.
135+
show global variables like 'ndb_slave_conflict_role';
136+
Variable_name Value
137+
ndb_slave_conflict_role PASS
138+
set global ndb_slave_conflict_role = "NONE";
139+
ERROR HY000: Error when executing command SET GLOBAL ndb_slave_conflict_role: Role change from PASS to NONE failed : Cannot change role while Slave SQL thread is running. Use STOP SLAVE first.
140+
show global variables like 'ndb_slave_conflict_role';
141+
Variable_name Value
142+
ndb_slave_conflict_role PASS
143+
stop slave sql_thread;
144+
set global ndb_slave_conflict_role = "NONE";
145+
Test some aliases for role names
146+
set global ndb_slave_conflict_role = PR;
147+
show global variables like 'ndb_slave_conflict_role';
148+
Variable_name Value
149+
ndb_slave_conflict_role PRIMARY
150+
set global ndb_slave_conflict_role = S;
151+
show global variables like 'ndb_slave_conflict_role';
152+
Variable_name Value
153+
ndb_slave_conflict_role SECONDARY
154+
set global ndb_slave_conflict_role = N;
155+
show global variables like 'ndb_slave_conflict_role';
156+
Variable_name Value
157+
ndb_slave_conflict_role NONE
158+
set global ndb_slave_conflict_role = PA;
159+
show global variables like 'ndb_slave_conflict_role';
160+
Variable_name Value
161+
ndb_slave_conflict_role PASS
162+
set global ndb_slave_conflict_role = 0;
163+
show global variables like 'ndb_slave_conflict_role';
164+
Variable_name Value
165+
ndb_slave_conflict_role NONE
166+
set global ndb_slave_conflict_role = 2;
167+
show global variables like 'ndb_slave_conflict_role';
168+
Variable_name Value
169+
ndb_slave_conflict_role PRIMARY
170+
set global ndb_slave_conflict_role = 1;
171+
show global variables like 'ndb_slave_conflict_role';
172+
Variable_name Value
173+
ndb_slave_conflict_role SECONDARY
174+
set global ndb_slave_conflict_role = 0;
175+
show global variables like 'ndb_slave_conflict_role';
176+
Variable_name Value
177+
ndb_slave_conflict_role NONE
178+
set global ndb_slave_conflict_role = 3;
179+
show global variables like 'ndb_slave_conflict_role';
180+
Variable_name Value
181+
ndb_slave_conflict_role PASS
182+
set global ndb_slave_conflict_role = NON;
183+
start slave sql_thread;
184+
include/rpl_end.inc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
--source include/have_ndb.inc
2+
--source suite/ndb_rpl/ndb_master-slave.inc
3+
4+
connection slave;
5+
6+
show global variables like 'ndb_slave_conflict_role';
7+
8+
#show slave status;
9+
10+
--let $status_items=Slave_SQL_Running
11+
--source include/show_slave_status.inc
12+
stop slave sql_thread;
13+
--source include/show_slave_status.inc
14+
15+
--echo Show set-to-same state is ok
16+
set global ndb_slave_conflict_role = NONE;
17+
18+
--echo Now transition through all status, including set-to-self
19+
set global ndb_slave_conflict_role = "PRIMARY";
20+
show global variables like 'ndb_slave_conflict_role';
21+
set global ndb_slave_conflict_role = "PRIMARY";
22+
set global ndb_slave_conflict_role = "SECONDARY";
23+
show global variables like 'ndb_slave_conflict_role';
24+
set global ndb_slave_conflict_role = "SECONDARY";
25+
set global ndb_slave_conflict_role = "NONE";
26+
set global ndb_slave_conflict_role = "SECONDARY";
27+
set global ndb_slave_conflict_role = "PRIMARY";
28+
set global ndb_slave_conflict_role = "NONE";
29+
set global ndb_slave_conflict_role = "PASS";
30+
show global variables like 'ndb_slave_conflict_role';
31+
set global ndb_slave_conflict_role = "PASS";
32+
set global ndb_slave_conflict_role = "NONE";
33+
34+
35+
--echo Now test illegal transitions
36+
set global ndb_slave_conflict_role = "PRIMARY";
37+
--error 1220
38+
set global ndb_slave_conflict_role = "PASS";
39+
show global variables like 'ndb_slave_conflict_role';
40+
41+
42+
set global ndb_slave_conflict_role = "SECONDARY";
43+
--error 1220
44+
set global ndb_slave_conflict_role = "PASS";
45+
show global variables like 'ndb_slave_conflict_role';
46+
47+
48+
set global ndb_slave_conflict_role = "NONE";
49+
set global ndb_slave_conflict_role = "PASS";
50+
--error 1220
51+
set global ndb_slave_conflict_role = "PRIMARY";
52+
show global variables like 'ndb_slave_conflict_role';
53+
54+
--error 1220
55+
set global ndb_slave_conflict_role = "SECONDARY";
56+
show global variables like 'ndb_slave_conflict_role';
57+
58+
set global ndb_slave_conflict_role = "NONE";
59+
60+
--echo Now test transitions not possible due to
61+
--echo Slave SQL thread running
62+
63+
start slave sql_thread;
64+
--source include/show_slave_status.inc
65+
66+
--echo From NONE
67+
set global ndb_slave_conflict_role = "NONE";
68+
--error 1220
69+
set global ndb_slave_conflict_role = "PRIMARY";
70+
show global variables like 'ndb_slave_conflict_role';
71+
72+
--error 1220
73+
set global ndb_slave_conflict_role = "SECONDARY";
74+
show global variables like 'ndb_slave_conflict_role';
75+
76+
--error 1220
77+
set global ndb_slave_conflict_role = "PASS";
78+
show global variables like 'ndb_slave_conflict_role';
79+
80+
stop slave sql_thread;
81+
82+
--echo From PRIMARY
83+
set global ndb_slave_conflict_role = "PRIMARY";
84+
85+
start slave sql_thread;
86+
87+
set global ndb_slave_conflict_role = "PRIMARY";
88+
--error 1220
89+
set global ndb_slave_conflict_role = "SECONDARY";
90+
show global variables like 'ndb_slave_conflict_role';
91+
--error 1220
92+
set global ndb_slave_conflict_role = "NONE";
93+
show global variables like 'ndb_slave_conflict_role';
94+
--error 1220
95+
set global ndb_slave_conflict_role = "PASS";
96+
show global variables like 'ndb_slave_conflict_role';
97+
98+
stop slave sql_thread;
99+
100+
--echo From SECONDARY
101+
set global ndb_slave_conflict_role = "SECONDARY";
102+
103+
start slave sql_thread;
104+
105+
set global ndb_slave_conflict_role = "SECONDARY";
106+
--error 1220
107+
set global ndb_slave_conflict_role = "PRIMARY";
108+
show global variables like 'ndb_slave_conflict_role';
109+
--error 1220
110+
set global ndb_slave_conflict_role = "NONE";
111+
show global variables like 'ndb_slave_conflict_role';
112+
--error 1220
113+
set global ndb_slave_conflict_role = "PASS";
114+
show global variables like 'ndb_slave_conflict_role';
115+
116+
stop slave sql_thread;
117+
118+
--echo From PASS
119+
set global ndb_slave_conflict_role = "NONE";
120+
set global ndb_slave_conflict_role = "PASS";
121+
122+
start slave sql_thread;
123+
124+
set global ndb_slave_conflict_role = "PASS";
125+
--error 1220
126+
set global ndb_slave_conflict_role = "PRIMARY";
127+
show global variables like 'ndb_slave_conflict_role';
128+
--error 1220
129+
set global ndb_slave_conflict_role = "SECONDARY";
130+
show global variables like 'ndb_slave_conflict_role';
131+
--error 1220
132+
set global ndb_slave_conflict_role = "NONE";
133+
show global variables like 'ndb_slave_conflict_role';
134+
135+
stop slave sql_thread;
136+
137+
set global ndb_slave_conflict_role = "NONE";
138+
139+
--echo Test some aliases for role names
140+
141+
set global ndb_slave_conflict_role = PR;
142+
show global variables like 'ndb_slave_conflict_role';
143+
144+
set global ndb_slave_conflict_role = S;
145+
show global variables like 'ndb_slave_conflict_role';
146+
147+
set global ndb_slave_conflict_role = N;
148+
show global variables like 'ndb_slave_conflict_role';
149+
150+
set global ndb_slave_conflict_role = PA;
151+
show global variables like 'ndb_slave_conflict_role';
152+
153+
set global ndb_slave_conflict_role = 0;
154+
show global variables like 'ndb_slave_conflict_role';
155+
156+
set global ndb_slave_conflict_role = 2;
157+
show global variables like 'ndb_slave_conflict_role';
158+
159+
set global ndb_slave_conflict_role = 1;
160+
show global variables like 'ndb_slave_conflict_role';
161+
162+
set global ndb_slave_conflict_role = 0;
163+
show global variables like 'ndb_slave_conflict_role';
164+
165+
set global ndb_slave_conflict_role = 3;
166+
show global variables like 'ndb_slave_conflict_role';
167+
168+
set global ndb_slave_conflict_role = NON;
169+
170+
start slave sql_thread;
171+
172+
--source include/rpl_end.inc

0 commit comments

Comments
 (0)