Skip to content

Commit bc4ddeb

Browse files
WL#9852: XCom transport abstraction
XCom is a communication framework with a PAXOS implementation that supports MySQL Group Replication. It can be conceptually divided into two sections: The PAXOS algorithm and a Communication infrastructure. Although keeping the Communication infrastructure under our control had given us an important advantage in terms of performance and fine tuning, it doubles our work in areas where the server is already mature (Secure Communications, Fragmentation). We reused existing Server facilities in order to establish connections among GCS group members. That allowed us to create authenticated and secure connections with MySQL protocol. RB: 25153
1 parent 9ce4d45 commit bc4ddeb

File tree

517 files changed

+13661
-3303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

517 files changed

+13661
-3303
lines changed

include/my_command.h

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ enum enum_server_command {
9393
COM_BINLOG_DUMP_GTID,
9494
COM_RESET_CONNECTION, /**< See @ref page_protocol_com_reset_connection */
9595
COM_CLONE,
96+
COM_SUBSCRIBE_GROUP_REPLICATION_STREAM,
9697
/* don't forget to update const char *command_name[] in sql_parse.cc */
9798

9899
/* Must be last */

include/mysql.h.pp

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
COM_BINLOG_DUMP_GTID,
8787
COM_RESET_CONNECTION,
8888
COM_CLONE,
89+
COM_SUBSCRIBE_GROUP_REPLICATION_STREAM,
8990
COM_END
9091
};
9192
#include "my_compress.h"

include/mysql/plugin_audit.h.pp

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
COM_BINLOG_DUMP_GTID,
172172
COM_RESET_CONNECTION,
173173
COM_CLONE,
174+
COM_SUBSCRIBE_GROUP_REPLICATION_STREAM,
174175
COM_END
175176
};
176177
#include "my_sqlcommand.h"

include/mysql/plugin_group_replication.h

+3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ struct GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS {
8383
size_t length);
8484
void (*set_member_version)(void *const context, const char &value,
8585
size_t length);
86+
void (*set_member_incoming_communication_protocol)(void *const context,
87+
const char &value,
88+
size_t length);
8689
};
8790

8891
/*

include/mysql/thread_type.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ enum enum_thread_type {
4545
SYSTEM_THREAD_DD_RESTART = 1024,
4646
SYSTEM_THREAD_SERVER_INITIALIZE = 2048,
4747
SYSTEM_THREAD_INIT_FILE = 4096,
48-
SYSTEM_THREAD_SERVER_UPGRADE = 8192
48+
SYSTEM_THREAD_SERVER_UPGRADE = 8192,
49+
SYSTEM_THREAD_GROUP_REPLICATION_CONNECTION = 16384
4950
};
5051

5152
#endif /* THREAD_TYPE_INCLUDED */

include/sql_common.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ struct MEM_ROOT;
4848
extern "C" {
4949
#endif
5050

51-
extern const char *unknown_sqlstate;
51+
#ifdef IMPORT_UNKNOWN_SQLSTATE
52+
__declspec(dllimport)
53+
#endif
54+
extern const char *unknown_sqlstate;
5255
extern const char *cant_connect_sqlstate;
5356
extern const char *not_error_sqlstate;
5457

mysql-test/collections/coverage.ignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
plugin/x/tests/driver/
77
unittest/gunit/xplugin
8+
unittest/gunit/libmysqlgcs
89
extra/protobuf
910
extra/icu
1011
extra/zstd

mysql-test/collections/default.push

+3-10
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,13 @@
77
#
88
# Non-Windows platforms
99
#
10-
perl mysql-test-run.pl --timer --testcase-timeout=30 --suite-timeout=300 --debug-server --force --comment=all-default-debug --vardir=var-all-default --skip-combinations --unit-tests-report --no-skip --exclude-platform=windows --skip-ndb
11-
10+
perl mysql-test-run.pl --timer --testcase-timeout=30 --suite-timeout=300 --debug-server --force --comment=all-default-debug --vardir=var-all-default --skip-combinations --unit-tests-report --no-skip --exclude-platform=windows
1211
#
1312
# Windows - run RPL separately with 8 threads
1413
#
15-
perl mysql-test-run.pl --timer --testcase-timeout=30 --suite-timeout=300 --debug-server --force --comment=all-default-debug --vardir=var-all-default --skip-combinations --skip-rpl --unit-tests-report --no-skip --platform=windows --skip-ndb
14+
perl mysql-test-run.pl --timer --testcase-timeout=30 --suite-timeout=300 --debug-server --force --comment=all-default-debug --vardir=var-all-default --skip-combinations --skip-rpl --unit-tests-report --no-skip --platform=windows
1615
perl mysql-test-run.pl --timer --testcase-timeout=30 --suite-timeout=300 --debug-server --force --parallel=8 --comment=rpl-suites --vardir=var-rpl-suites --skip-combinations --suite=rpl,rpl_gtid,rpl_nogtid --platform=windows
17-
18-
#
19-
# Run all Ndb tests separately.
20-
# For builds without Ndb support no tests will be attempted.
21-
#
22-
perl mysql-test-run.pl --timer --testcase-timeout=30 --suite-timeout=300 --debug-server --force --comment=ndb --vardir=var-ndb --skip-combinations --no-skip --with-ndb-only
23-
2416
#
2517
# Group Replication
2618
perl mysql-test-run.pl --timer --force --parallel=6 --comment=group_replication --vardir=var-group_replication --suite=group_replication
19+

mysql-test/collections/default.weekly

+7
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,20 @@ perl mysql-test-run.pl --timer --force --parallel=6 --comment=group_replication_
191191

192192
#GR with group_replication_ssl_mode = REQUIRED
193193
perl mysql-test-run.pl --timer --force --parallel=6 --comment=group_replication_ssl_mode_required --vardir=var-gr_ssl_mode_required --suite=group_replication --big-test --testcase-timeout=60 --suite-timeout=360 --mysqld=--loose-group_replication_ssl_mode=REQUIRED
194+
195+
#GR with group_replication_ssl_mode = REQUIRED and MySQL Stack
196+
perl mysql-test-run.pl --timer --force --parallel=6 --comment=group_replication_ssl_mode_required_mysql --vardir=var-gr_ssl_mode_required_mysql --suite=group_replication --big-test --testcase-timeout=60 --suite-timeout=360 --mysqld=--loose-group_replication_ssl_mode=REQUIRED --mysqld=--loose-group_replication_communication_stack=MySQL
197+
194198
#
195199
# b) DEBUG
196200
#
197201

198202
#GR with loose-group_replication_gtid_assignment_block_size=1 on debug build
199203
perl mysql-test-run.pl --timer --debug-server --force --parallel=6 --comment=group_replication_gtid_assignment_block_size_1-debug --vardir=var-gr_gtid_assignment_block_size_1-debug --suite=group_replication --big-test --testcase-timeout=60 --suite-timeout=360 --mysqld=--loose-group_replication_gtid_assignment_block_size=1
200204

205+
#GR with MySQL Stack on debug build
206+
perl mysql-test-run.pl --timer --debug-server --force --parallel=6 --comment=group_replication_mysql-debug --vardir=var-group_replication_mysql-debug --suite=group_replication --big-test --testcase-timeout=60 --suite-timeout=360 --mysqld=--loose-group_replication_communication_stack=MySQL
207+
201208
#GR with MTS on debug build
202209
perl mysql-test-run.pl --timer --debug-server --force --parallel=6 --comment=group_replication_parallel_applier-debug --vardir=var-gr_parallel_applier-debug --suite=group_replication --big-test --testcase-timeout=60 --suite-timeout=360 --mysqld=--replica-parallel-workers=4 --mysqld=--replica-parallel-type=logical_clock --mysqld=--replica_preserve_commit_order=ON
203210
perl mysql-test-run.pl --timer --debug-server --force --parallel=6 --comment=group_replication_ssl_mode_required-debug --vardir=var-gr_ssl_mode_required-debug --suite=group_replication --big-test --testcase-timeout=60 --suite-timeout=360 --mysqld=--loose-group_replication_ssl_mode=REQUIRED

mysql-test/collections/disabled.def

+10
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,13 @@ sys_vars.innodb_log_writer_threads_basic : Bug#32129814 SYS_VARS.INNODB_LOG_WRIT
9494
sysschema.v_wait_classes_global_by_avg_latency : BUG#21550054 Test fails too often.
9595

9696
# x plugin suite tests
97+
98+
# Group Replication tests.
99+
100+
# These will only run in XCom because of the following issue:
101+
group_replication.gr_join_with_suspect_member : BUG#31704262 XCOM CREATES NODES WITH PAST GHOST VIEWS
102+
group_replication.gr_leave_with_suspect_member : BUG#31704262 XCOM CREATES NODES WITH PAST GHOST VIEWS
103+
group_replication.gr_majority_loss_restored_after_timeout : BUG#31704262 XCOM CREATES NODES WITH PAST GHOST VIEWS
104+
group_replication.gr_suspect_member_resumes_after_crash_join_retries : BUG#32458239 GR_SUSPECT_MEMBER_RESUMES_AFTER_CRASH_JOIN_RETRIES IS NOT STABLE
105+
group_replication.gr_majority_loss_5_to_2 @windows : Bug#32860569 SPORADIC GROUP REPLICATION MAJORITY TEST FAILURES IN WINDOWS
106+
group_replication.gr_majority_loss_5_to_2_recovery @windows : Bug#32860569 SPORADIC GROUP REPLICATION MAJORITY TEST FAILURES IN WINDOWS

mysql-test/include/gr_configuration.inc

+20-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ if ($group_replication_group_name == "")
1616
# Save current connection.
1717
--let $_old_connection= $CURRENT_CONNECTION
1818

19+
#check which stack are we using
20+
--let $have_xcom_stack= `SELECT @@group_replication_communication_stack LIKE 'XCOM'`
1921

2022
# Default values
2123
--let $_group_replication_group_seeds=
@@ -50,7 +52,15 @@ while ($_rpl_server <= $_rpl_server_max)
5052
--let $_rpl_server= $_rpl_gcs_server_number
5153
while ($_rpl_server)
5254
{
53-
--let $_rpl_gcs_server_port= \$SERVER_GR_PORT_$_rpl_server
55+
--let $_rpl_gcs_server_port=
56+
if ($have_xcom_stack)
57+
{
58+
--let $_rpl_gcs_server_port= \$SERVER_GR_PORT_$_rpl_server
59+
}
60+
if (!$have_xcom_stack)
61+
{
62+
--let $_rpl_gcs_server_port= \$SERVER_MYPORT_$_rpl_server
63+
}
5464

5565
# Append comma to list of addresses.
5666
if ($_group_replication_group_seeds != "")
@@ -86,7 +96,15 @@ while ($_rpl_server)
8696
}
8797

8898
# Local address.
89-
--let $_rpl_gcs_server_port= \$SERVER_GR_PORT_$_rpl_server
99+
--let $_rpl_gcs_server_port=
100+
if ($have_xcom_stack)
101+
{
102+
--let $_rpl_gcs_server_port= \$SERVER_GR_PORT_$_rpl_server
103+
}
104+
if (!$have_xcom_stack)
105+
{
106+
--let $_rpl_gcs_server_port= \$SERVER_MYPORT_$_rpl_server
107+
}
90108
--let $_group_replication_local_address= $_rpl_gcs_server_address:$_rpl_gcs_server_port
91109

92110
# Set configuration on server.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ==== Purpose ====
2+
#
3+
# Ensure that group replication is running using MySQL protocol stack
4+
#
5+
6+
--let $_have_mysql_stack= `SELECT @@group_replication_communication_stack LIKE 'MYSQL'`
7+
if (!$_have_mysql_stack)
8+
{
9+
--skip Test requires MySQL Protocol Stack configured in Group Replication
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ==== Purpose ====
2+
#
3+
# Ensure that group replication is running using MySQL protocol stack
4+
#
5+
6+
--let $_have_xcom_stack= `SELECT @@group_replication_communication_stack LIKE 'XCOM'`
7+
if (!$_have_xcom_stack)
8+
{
9+
--skip Test requires XCom Protocol Stack configured in Group Replication
10+
}

mysql-test/include/mtr_warnings.sql

+7-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ INSERT INTO global_suppressions VALUES
197197
("slave SQL thread aborted"),
198198
("Slave: .*Duplicate entry"),
199199

200-
/*
200+
/*
201201
innodb_dedicated_server warning which raised if innodb_buffer_pool_size,
202202
innodb_log_file_size or innodb_flush_method is specified.
203203
*/
@@ -312,6 +312,12 @@ INSERT INTO global_suppressions VALUES
312312
("Members removed from the group.*"),
313313
("Error while sending message for group replication recovery"),
314314
("Slave SQL for channel 'group_replication_recovery': ... The slave coordinator and worker threads are .*"),
315+
("A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001160 - Got an error writing communication packets.*"),
316+
("A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001158 - Got an error reading communication packets.*"),
317+
("Failed to establish MySQL client connection in Group Replication.*."),
318+
("\\[GCS\\] client closed the signalling connection .*"),
319+
("\\[GCS\\] local_server: client closed the signalling connection.*"),
320+
("\\[GCS\\] local_server: error reading from the signalling connection.*"),
315321

316322
/*
317323
Warnings/errors related to SSL connection by mysqlx

mysql-test/include/spawn_monitoring_process.inc

+14-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
let $have_windows = `SELECT CONVERT(@@version_compile_os using latin1) IN ("Win32", "Win64", "Windows")`;
2121

2222
if (!$have_windows) {
23-
2423
--disable_query_log
2524
SET SESSION sql_log_bin= 0;
2625
SET @auto_increment_increment_save= @@SESSION.auto_increment_increment;
@@ -40,10 +39,24 @@ if (!$have_windows) {
4039
ORDER BY VARIABLE_NAME;
4140
if($rpl_group_replication)
4241
{
42+
--let $gr_ssl_disabled= `SELECT @@group_replication_ssl_mode LIKE 'DISABLED'`
43+
if(!$gr_ssl_disabled) {
44+
INSERT INTO test.r_vars (var_name, var_value)
45+
SELECT * FROM performance_schema.global_variables
46+
WHERE VARIABLE_NAME LIKE 'ssl_ca'
47+
OR VARIABLE_NAME LIKE 'ssl_cert'
48+
OR VARIABLE_NAME LIKE 'ssl_key'
49+
ORDER BY VARIABLE_NAME;
50+
}
51+
4352
INSERT INTO test.r_vars (var_name, var_value)
4453
SELECT * FROM performance_schema.global_variables
4554
WHERE VARIABLE_NAME LIKE 'group_replication_ssl_mode'
4655
OR VARIABLE_NAME LIKE 'group_replication_gtid_assignment_block_size'
56+
OR VARIABLE_NAME LIKE 'group_replication_ssl_mode'
57+
OR VARIABLE_NAME LIKE 'group_replication_recovery_ssl_ca'
58+
OR VARIABLE_NAME LIKE 'group_replication_recovery_ssl_cert'
59+
OR VARIABLE_NAME LIKE 'group_replication_recovery_ssl_key'
4760
ORDER BY VARIABLE_NAME;
4861
}
4962
--let $suite_mysqld_settings=

mysql-test/r/events_bugs.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ USE test;
570570
SHOW GRANTS FOR CURRENT_USER;
571571
Grants for root@localhost
572572
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `root`@`localhost` WITH GRANT OPTION
573-
GRANT APPLICATION_PASSWORD_ADMIN,AUDIT_ADMIN,BACKUP_ADMIN,BINLOG_ADMIN,BINLOG_ENCRYPTION_ADMIN,CLONE_ADMIN,CONNECTION_ADMIN,ENCRYPTION_KEY_ADMIN,FLUSH_OPTIMIZER_COSTS,FLUSH_STATUS,FLUSH_TABLES,FLUSH_USER_RESOURCES,GROUP_REPLICATION_ADMIN,INNODB_REDO_LOG_ARCHIVE,INNODB_REDO_LOG_ENABLE,PERSIST_RO_VARIABLES_ADMIN,REPLICATION_APPLIER,REPLICATION_SLAVE_ADMIN,RESOURCE_GROUP_ADMIN,RESOURCE_GROUP_USER,ROLE_ADMIN,SERVICE_CONNECTION_ADMIN,SESSION_VARIABLES_ADMIN,SET_USER_ID,SHOW_ROUTINE,SYSTEM_USER,SYSTEM_VARIABLES_ADMIN,TABLE_ENCRYPTION_ADMIN,XA_RECOVER_ADMIN ON *.* TO `root`@`localhost` WITH GRANT OPTION
573+
GRANT APPLICATION_PASSWORD_ADMIN,AUDIT_ADMIN,BACKUP_ADMIN,BINLOG_ADMIN,BINLOG_ENCRYPTION_ADMIN,CLONE_ADMIN,CONNECTION_ADMIN,ENCRYPTION_KEY_ADMIN,FLUSH_OPTIMIZER_COSTS,FLUSH_STATUS,FLUSH_TABLES,FLUSH_USER_RESOURCES,GROUP_REPLICATION_ADMIN,GROUP_REPLICATION_STREAM,INNODB_REDO_LOG_ARCHIVE,INNODB_REDO_LOG_ENABLE,PERSIST_RO_VARIABLES_ADMIN,REPLICATION_APPLIER,REPLICATION_SLAVE_ADMIN,RESOURCE_GROUP_ADMIN,RESOURCE_GROUP_USER,ROLE_ADMIN,SERVICE_CONNECTION_ADMIN,SESSION_VARIABLES_ADMIN,SET_USER_ID,SHOW_ROUTINE,SYSTEM_USER,SYSTEM_VARIABLES_ADMIN,TABLE_ENCRYPTION_ADMIN,XA_RECOVER_ADMIN ON *.* TO `root`@`localhost` WITH GRANT OPTION
574574
GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
575575
SET GLOBAL event_scheduler = ON;
576576
CREATE TABLE events_test.event_log

0 commit comments

Comments
 (0)