Skip to content

Commit 9743d00

Browse files
mkaruzaJan Lindström
authored andcommitted
MDEV-27246 Implement a method to add IPs to allowlist for Galera Cluster node addresses that can make SST/IST requests
Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
1 parent b3372d6 commit 9743d00

21 files changed

+480
-17
lines changed

mysql-test/suite/galera/r/galera_defaults.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ AND VARIABLE_NAME NOT IN (
2020
)
2121
ORDER BY VARIABLE_NAME;
2222
VARIABLE_NAME VARIABLE_VALUE
23+
WSREP_ALLOWLIST
2324
WSREP_AUTO_INCREMENT_CONTROL ON
2425
WSREP_CAUSAL_READS ON
2526
WSREP_CERTIFICATION_RULES strict

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@
1313
--source include/force_restart.inc
1414

1515
# Make sure that the test is operating on the right version of galera library.
16-
--let $galera_version=26.4.7
16+
--let $galera_version=26.4.11
1717
source ../wsrep/include/check_galera_version.inc;
1818

1919
# Global Variables
2020

21-
SELECT COUNT(*) `expect 50` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
22-
2321
SELECT VARIABLE_NAME, VARIABLE_VALUE
2422
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
2523
WHERE VARIABLE_NAME LIKE 'wsrep_%'
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
connection node_2;
2+
connection node_1;
3+
SELECT COUNT(*) = 3 FROM mysql.wsrep_allowlist;
4+
COUNT(*) = 3
5+
1
6+
connection node_2;
7+
SELECT COUNT(*) = 3 FROM mysql.wsrep_allowlist;
8+
COUNT(*) = 3
9+
1
10+
connection node_3;
11+
SET @@global.wsrep_desync = 1;
12+
SET SESSION wsrep_sync_wait = 0;
13+
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
14+
connection node_1;
15+
DELETE FROM mysql.wsrep_allowlist WHERE ip LIKE '127.0.0.3';
16+
SELECT COUNT(*) = 2 FROM mysql.wsrep_allowlist;
17+
COUNT(*) = 2
18+
1
19+
connection node_2;
20+
SELECT COUNT(*) = 2 FROM mysql.wsrep_allowlist;
21+
COUNT(*) = 2
22+
1
23+
connection node_3;
24+
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
25+
SET @@global.wsrep_desync = 0;
26+
connection node_1;
27+
INSERT INTO mysql.wsrep_allowlist(ip) VALUES ('127.0.0.3');
28+
connection node_3;
29+
# restart
30+
connection node_1;
31+
CALL mtr.add_suppression('WSREP: Connection not allowed');
32+
connection node_2;
33+
CALL mtr.add_suppression('WSREP: Connection not allowed');
34+
connection node_3;
35+
CALL mtr.add_suppression('WSREP: Ignoring lack of quorum');
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
!include ../galera_3nodes.cnf
2+
3+
[mysqld]
4+
wsrep_sst_method=rsync
5+
6+
[mysqld.1]
7+
wsrep_allowlist="127.0.0.1,127.0.0.2,127.0.0.3"
8+
9+
[mysqld.2]
10+
wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=127.0.0.2;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
11+
12+
# Variable is only used on bootstrap node, so this will be ignored
13+
wsrep_allowlist="127.0.0.1,127.0.0.2,127.0.0.3,127.0.0.4,127.0.0.5"
14+
15+
wsrep_node_address=127.0.0.2
16+
wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
17+
wsrep_node_incoming_address=127.0.0.2:@mysqld.2.port
18+
wsrep_sst_receive_address='127.0.0.2:@mysqld.2.#sst_port'
19+
20+
[mysqld.3]
21+
wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=127.0.0.3;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_quorum=TRUE;pc.wait_prim=FALSE'
22+
23+
wsrep_node_address=127.0.0.3
24+
wsrep_sst_receive_address=127.0.0.3:@mysqld.3.#sst_port
25+
wsrep_node_incoming_address=127.0.0.3:@mysqld.3.port
26+
wsrep_sst_receive_address='127.0.0.3:@mysqld.3.#sst_port'
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
--source include/galera_cluster.inc
2+
--source include/have_innodb.inc
3+
4+
# Check that `wsrep_allowlist` variable is loaded
5+
SELECT COUNT(*) = 3 FROM mysql.wsrep_allowlist;
6+
7+
--connection node_2
8+
# Check that non-bootstrap nodes doesn't populate `mysql.wsrep_allowlist`
9+
SELECT COUNT(*) = 3 FROM mysql.wsrep_allowlist;
10+
11+
--let $galera_connection_name = node_3
12+
--let $galera_server_number = 3
13+
--source include/galera_connect.inc
14+
15+
--connection node_3
16+
# Desync and disconnect node 3 from the PC:
17+
SET @@global.wsrep_desync = 1;
18+
SET SESSION wsrep_sync_wait = 0;
19+
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
20+
21+
--connection node_1
22+
# Wait until node 3 disappears from the PC:
23+
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
24+
--source include/wait_condition.inc
25+
26+
# Delete node ip (127.0.0.3) from allowlist
27+
DELETE FROM mysql.wsrep_allowlist WHERE ip LIKE '127.0.0.3';
28+
29+
SELECT COUNT(*) = 2 FROM mysql.wsrep_allowlist;
30+
31+
--connection node_2
32+
SELECT COUNT(*) = 2 FROM mysql.wsrep_allowlist;
33+
34+
--connection node_3
35+
# Reconnect node 2 to the PC:
36+
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
37+
38+
# We should reach Primary with cluster size = 1 because of `pc.ignore_quorum=TRUE and pc.wait_prim=FALSE` used in configuration
39+
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
40+
--source include/wait_condition.inc
41+
42+
# Resync should pass:
43+
SET @@global.wsrep_desync = 0;
44+
45+
# Shutdown node
46+
--source include/shutdown_mysqld.inc
47+
48+
--connection node_1
49+
# Allow node 3 could be reconnected to cluster
50+
INSERT INTO mysql.wsrep_allowlist(ip) VALUES ('127.0.0.3');
51+
52+
--connection node_3
53+
--source include/start_mysqld.inc
54+
--source include/wait_until_connected_again.inc
55+
56+
--connection node_1
57+
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
58+
--source include/wait_condition.inc
59+
60+
CALL mtr.add_suppression('WSREP: Connection not allowed');
61+
62+
--connection node_2
63+
CALL mtr.add_suppression('WSREP: Connection not allowed');
64+
65+
--connection node_3
66+
CALL mtr.add_suppression('WSREP: Ignoring lack of quorum');

mysql-test/suite/sys_vars/r/sysvars_wsrep.result

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
select * from information_schema.system_variables
22
where variable_name like 'wsrep%'
33
order by variable_name;
4+
VARIABLE_NAME WSREP_ALLOWLIST
5+
SESSION_VALUE NULL
6+
GLOBAL_VALUE
7+
GLOBAL_VALUE_ORIGIN COMPILE-TIME
8+
DEFAULT_VALUE
9+
VARIABLE_SCOPE GLOBAL
10+
VARIABLE_TYPE VARCHAR
11+
VARIABLE_COMMENT Allowed IP addresses split by comma delimiter
12+
NUMERIC_MIN_VALUE NULL
13+
NUMERIC_MAX_VALUE NULL
14+
NUMERIC_BLOCK_SIZE NULL
15+
ENUM_VALUE_LIST NULL
16+
READ_ONLY YES
17+
COMMAND_LINE_ARGUMENT REQUIRED
18+
GLOBAL_VALUE_PATH NULL
419
VARIABLE_NAME WSREP_AUTO_INCREMENT_CONTROL
520
SESSION_VALUE NULL
621
GLOBAL_VALUE ON

mysql-test/suite/wsrep/r/variables.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ wsrep_thread_count 2
8888
# variables
8989
SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep%" ORDER BY VARIABLE_NAME;
9090
VARIABLE_NAME
91+
WSREP_ALLOWLIST
9192
WSREP_AUTO_INCREMENT_CONTROL
9293
WSREP_CAUSAL_READS
9394
WSREP_CERTIFICATION_RULES

mysql-test/suite/wsrep/r/variables_debug.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ wsrep_thread_count 2
8989
# variables
9090
SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep%" ORDER BY VARIABLE_NAME;
9191
VARIABLE_NAME
92+
WSREP_ALLOWLIST
9293
WSREP_AUTO_INCREMENT_CONTROL
9394
WSREP_CAUSAL_READS
9495
WSREP_CERTIFICATION_RULES

mysql-test/suite/wsrep/t/variables.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--source include/have_innodb.inc
44
--source include/galera_no_debug_sync.inc
55

6-
--let $galera_version=26.4.9
6+
--let $galera_version=26.4.11
77
source include/check_galera_version.inc;
88

99
source include/galera_variables_ok.inc;

mysql-test/suite/wsrep/t/variables_debug.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
--source include/have_debug_sync.inc
66
--source include/galera_have_debug_sync.inc
77

8-
--let $galera_version=26.4.9
8+
--let $galera_version=26.4.11
99
source include/check_galera_version.inc;
1010

1111
source include/galera_variables_ok.inc;

0 commit comments

Comments
 (0)