Skip to content

Commit eda45b1

Browse files
committed
BUG#20455917: GROUP REPLICATION APPLIER CHANNEL IS NOT LISTED ON ALL REPLICATION P_S TABLES
Group Replication applier channel was not being listed on all replication performance schema tables, what was causing some status values not to be accessible. This was happening because Group Replication applier channel doesn't have a regular Master_info object, since it doesn't have a IO thread. Applier data comes from group communication toolkit and not from a point-to-point connection from a master. On this patch we ensure that Group Replication applier channel is listed on all replication performance schema tables by adding the channel with a fake master hostname "<NULL>".
1 parent 5336d42 commit eda45b1

11 files changed

+153
-206
lines changed

include/mysql/plugin_group_replication.h

+2-8
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ enum enum_member_state {
2727
MEMBER_STATE_RECOVERING
2828
};
2929

30-
enum enum_applier_status {
31-
APPLIER_STATE_RUNNING= 1,
32-
APPLIER_STATE_STOP,
33-
APPLIER_STATE_ERROR
34-
};
35-
3630
typedef struct st_group_replication_connection_status_info
3731
{
3832
char* channel_name;
@@ -103,7 +97,7 @@ struct st_mysql_group_replication
10397
@note The caller is responsible to free memory from the info structure and
10498
from all its fields.
10599
*/
106-
bool (*get_group_members_info)(uint index, GROUP_REPLICATION_GROUP_MEMBERS_INFO *info);
100+
bool (*get_group_members_info)(unsigned int index, GROUP_REPLICATION_GROUP_MEMBERS_INFO *info);
107101

108102
/*
109103
This function is used to fetch information for group replication members statistics.
@@ -118,7 +112,7 @@ struct st_mysql_group_replication
118112
/*
119113
Get number of group replication members.
120114
*/
121-
uint (*get_members_number_info)();
115+
unsigned int (*get_members_number_info)();
122116
};
123117

124118
#endif

mysql-test/include/rpl_end.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ if ($rpl_group_replication)
117117
--source include/rpl_connection.inc
118118

119119
--let $_group_replication_member_state= `SELECT SERVICE_STATE FROM performance_schema.replication_connection_status connection_status WHERE connection_status.group_name="$group_replication_group_name"`
120-
if ($_group_replication_member_state != 'OFF')
120+
if ($_group_replication_member_state == 'ON')
121121
{
122122
--source include/stop_group_replication.inc
123123
}

mysql-test/suite/rpl/t/rpl_wait_for_executed_gtid_set.test

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
#
1313

1414
--let $rpl_gtid_utils= 1
15-
--source include/master-slave.inc
1615
--source include/have_log_bin.inc
1716
--source include/have_gtid.inc
17+
--source include/master-slave.inc
1818

1919
--connection slave
20-
--let $master_uuid= query_get_value(select SOURCE_UUID from performance_schema.replication_connection_status, SOURCE_UUID, 1)
20+
--let $master_uuid= query_get_value(select SOURCE_UUID from performance_schema.replication_connection_status WHERE service_state = 'ON', SOURCE_UUID, 1)
2121
--connection master
2222

2323
--let $uuid= 8a94f357-aab4-11df-86ab-c80aa9429560

mysql-test/suite/rpl/t/rpl_wait_for_executed_gtid_set_no_timeout.test

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
#
88

99
--let $rpl_gtid_utils= 1
10-
--source include/master-slave.inc
1110
--source include/have_log_bin.inc
1211
--source include/have_gtid.inc
12+
--source include/master-slave.inc
1313

1414
connection slave;
15-
--let $master_uuid= query_get_value(select SOURCE_UUID from performance_schema.replication_connection_status, SOURCE_UUID, 1)
15+
--let $master_uuid= query_get_value(select SOURCE_UUID from performance_schema.replication_connection_status WHERE service_state = 'ON', SOURCE_UUID, 1)
1616
--connection master
1717

1818
--let $uuid= 8a94f357-aab4-11df-86ab-c80aa9429560

mysql-test/suite/rpl/t/rpl_wait_for_executed_gtid_set_with_sleep.test

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
# verify that the wait function does not return immediately.
77
#
88

9-
--source include/master-slave.inc
109
--source include/have_log_bin.inc
1110
--source include/have_gtid.inc
11+
--source include/master-slave.inc
1212

1313
--connection slave
14-
--let $master_uuid= query_get_value(select SOURCE_UUID from performance_schema.replication_connection_status, SOURCE_UUID, 1)
14+
--let $master_uuid= query_get_value(select SOURCE_UUID from performance_schema.replication_connection_status WHERE service_state = 'ON', SOURCE_UUID, 1)
1515

1616
--connection master
1717

sql/rpl_group_replication.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ get_connection_status_info(GROUP_REPLICATION_CONNECTION_STATUS_INFO *info)
8686

8787
bool
8888
Group_replication_handler::
89-
get_group_members_info(uint index, GROUP_REPLICATION_GROUP_MEMBERS_INFO *info)
89+
get_group_members_info(unsigned int index, GROUP_REPLICATION_GROUP_MEMBERS_INFO *info)
9090
{
9191
if (plugin_handle)
9292
return plugin_handle->get_group_members_info(index, info);
@@ -102,7 +102,7 @@ get_group_member_stats_info(GROUP_REPLICATION_GROUP_MEMBER_STATS_INFO *info)
102102
return true;
103103
}
104104

105-
uint Group_replication_handler::get_members_number_info()
105+
unsigned int Group_replication_handler::get_members_number_info()
106106
{
107107
if (plugin_handle)
108108
return plugin_handle->get_members_number_info();
@@ -198,7 +198,7 @@ bool get_group_replication_connection_status_info(GROUP_REPLICATION_CONNECTION_S
198198
return true;
199199
}
200200

201-
bool get_group_replication_group_members_info(uint index, GROUP_REPLICATION_GROUP_MEMBERS_INFO *info)
201+
bool get_group_replication_group_members_info(unsigned int index, GROUP_REPLICATION_GROUP_MEMBERS_INFO *info)
202202
{
203203
if (group_replication_handler)
204204
return group_replication_handler->get_group_members_info(index, info);
@@ -212,7 +212,7 @@ bool get_group_replication_group_member_stats_info(GROUP_REPLICATION_GROUP_MEMBE
212212
return true;
213213
}
214214

215-
uint get_group_replication_members_number_info()
215+
unsigned int get_group_replication_members_number_info()
216216
{
217217
if (group_replication_handler)
218218
return group_replication_handler->get_members_number_info();

sql/rpl_group_replication.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class Group_replication_handler
3838
bool is_running();
3939
int set_retrieved_certification_info(View_change_log_event *view_change_event);
4040
bool get_connection_status_info(GROUP_REPLICATION_CONNECTION_STATUS_INFO *info);
41-
bool get_group_members_info(uint index, GROUP_REPLICATION_GROUP_MEMBERS_INFO *info);
41+
bool get_group_members_info(unsigned int index, GROUP_REPLICATION_GROUP_MEMBERS_INFO *info);
4242
bool get_group_member_stats_info(GROUP_REPLICATION_GROUP_MEMBER_STATS_INFO* info);
43-
uint get_members_number_info();
43+
unsigned int get_members_number_info();
4444

4545
private:
4646
std::string plugin_name;
@@ -62,9 +62,9 @@ bool is_group_replication_running();
6262
int set_group_replication_retrieved_certification_info(View_change_log_event *view_change_event);
6363

6464
bool get_group_replication_connection_status_info(GROUP_REPLICATION_CONNECTION_STATUS_INFO *info);
65-
bool get_group_replication_group_members_info(uint index, GROUP_REPLICATION_GROUP_MEMBERS_INFO *info);
65+
bool get_group_replication_group_members_info(unsigned int index, GROUP_REPLICATION_GROUP_MEMBERS_INFO *info);
6666
bool get_group_replication_group_member_stats_info(GROUP_REPLICATION_GROUP_MEMBER_STATS_INFO* info);
67-
uint get_group_replication_members_number_info();
67+
unsigned int get_group_replication_members_number_info();
6868

6969

7070
#endif /* RPL_GROUP_REPLICATION_INCLUDED */

sql/rpl_msr.cc

+11
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,17 @@ bool Multisource_info::delete_mi(const char* channel_name)
162162
}
163163

164164

165+
bool Multisource_info::is_group_replication_channel_name(const char* channel,
166+
bool is_applier)
167+
{
168+
if (is_applier)
169+
return !strcmp(channel, group_replication_channel_names[0]);
170+
else
171+
return !strcmp(channel, group_replication_channel_names[0]) ||
172+
!strcmp(channel, group_replication_channel_names[1]);
173+
}
174+
175+
165176
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
166177

167178
bool Multisource_info::add_mi_to_rpl_pfs_mi(Master_info *mi)

sql/rpl_msr.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,15 @@ class Multisource_info
247247
/**
248248
Returns if a channel name is one of the reserved group replication names
249249
250-
@param channel the channel name to test
250+
@param channel the channel name to test
251+
@param is_applier compare only with applier name
251252
252253
@return
253254
@retval true the name is a reserved name
254255
@retval false non reserved name
255256
*/
256-
inline bool is_group_replication_channel_name(const char* channel)
257-
{
258-
return !strcmp(channel, group_replication_channel_names[0]) ||
259-
!strcmp(channel, group_replication_channel_names[1]);
260-
}
257+
bool is_group_replication_channel_name(const char* channel,
258+
bool is_applier= false);
261259

262260
/**
263261
Forward iterators to initiate traversing of a map.

0 commit comments

Comments
 (0)