Skip to content

Commit 75d9631

Browse files
author
Jaideep Karande
committed
WL#10380: Group Replication: Monitoring improvements
Description: This worklog goal is to improve Group Replication by introducing additional columns in existing performance schema. Schema after code changes: For table - performance_schema.replication_group_member_stats New suggested columns: Field Type Null Key Default Description MEMBER_ROLE char(64) NO NULL Member role in a group; can be any of the PRIMARY or SECONDARY MEMBER_VERSION char(64) NO NULL The MySQL version of the member. NOTE: Columns will be added in same sequence as listed above. For table - performance_schema.replication_group_member_stats New suggested columns: Field Type Null Key Default Description COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE bigint(20) unsigned NO NULL Transactions waiting apply, received from group. COUNT_TRANSACTIONS_REMOTE_APPLIED bigint(20) unsigned NO NULL Transactions applied, received from group. COUNT_TRANSACTIONS_LOCAL_PROPOSED bigint(20) unsigned No NULL Number of local transaction requested by member to Group Replication Plugin for commit. COUNT_TRANSACTIONS_LOCAL_ROLLBACK bigint(20) unsigned No NULL Number of transaction originated from local member but rolledback at GROUP level NOTE: Columns will be added in same sequence as listed above.
1 parent d2332f3 commit 75d9631

File tree

63 files changed

+1804
-204
lines changed

Some content is hidden

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

63 files changed

+1804
-204
lines changed

include/mysql/plugin_group_replication.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
2222
*/
2323

2424
#include <mysql/plugin.h>
25-
#define MYSQL_GROUP_REPLICATION_INTERFACE_VERSION 0x0101
25+
#define MYSQL_GROUP_REPLICATION_INTERFACE_VERSION 0x0102
2626

2727
/*
2828
Callbacks for get_connection_status_info function.
@@ -59,6 +59,8 @@ typedef struct st_group_replication_group_members_callbacks
5959
void (*set_member_host)(void* const context, const char& value, size_t length);
6060
void (*set_member_port)(void* const context, unsigned int value);
6161
void (*set_member_state)(void* const context, const char& value, size_t length);
62+
void (*set_member_role)(void* const context, const char& value, size_t length);
63+
void (*set_member_version)(void* const context, const char& value, size_t length);
6264
} GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS;
6365

6466
/*
@@ -82,6 +84,10 @@ typedef struct st_group_replication_member_stats_callbacks
8284
void (*set_transactions_certified)(void* const context, unsigned long long int value);
8385
void (*set_transactions_conflicts_detected)(void* const context, unsigned long long int value);
8486
void (*set_transactions_rows_in_validation)(void* const context, unsigned long long int value);
87+
void (*set_transactions_remote_applier_queue)(void* const context, unsigned long long int value);
88+
void (*set_transactions_remote_applied)(void* const context, unsigned long long int value);
89+
void (*set_transactions_local_proposed)(void* const context, unsigned long long int value);
90+
void (*set_transactions_local_rollback)(void* const context, unsigned long long int value);
8591
} GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS;
8692

8793
struct st_mysql_group_replication
@@ -123,6 +129,8 @@ struct st_mysql_group_replication
123129
/*
124130
This function is used to fetch information for group replication members.
125131
132+
@param index Row index for which information needs to be fetched
133+
126134
@param callbacks The set of callbacks and its context used to set the
127135
information on caller.
128136
@@ -136,14 +144,17 @@ struct st_mysql_group_replication
136144
/*
137145
This function is used to fetch information for group replication members statistics.
138146
147+
@param index Row index for which information needs to be fetched
148+
139149
@param callbacks The set of callbacks and its context used to set the
140150
information on caller.
141151
142152
@note The caller is responsible to free memory from the info structure and
143153
from all its fields.
144154
*/
145155
bool (*get_group_member_stats_info)
146-
(const GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS& callbacks);
156+
(unsigned int index,
157+
const GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS& callbacks);
147158

148159
/*
149160
Get number of group replication members.

mysql-test/r/dd_upgrade_partition.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ call mtr.add_suppression("InnoDB: Unable to delete statistics for table mysql.")
2727
call mtr.add_suppression("Column count of performance_schema.replication_connection_status is wrong. Expected 20, found 11*");
2828
call mtr.add_suppression("Column count of performance_schema.replication_applier_status_by_coordinator is wrong. Expected 15, found 6.*");
2929
call mtr.add_suppression("Column count of performance_schema.replication_applier_status_by_worker is wrong. Expected 16, found 8.*");
30+
call mtr.add_suppression("Column count of performance_schema.replication_group_members is wrong. Expected 7, found 5.*");
31+
call mtr.add_suppression("Column count of performance_schema.replication_group_member_stats is wrong. Expected 13, found 9.*");
3032
call mtr.add_suppression("Column count of performance_schema.threads is wrong. Expected 18, found 17.*");
3133
# Copy the remote tablespace & DB zip files from suite location to working location.
3234
# Check that the file exists in the working folder.

mysql-test/r/dd_upgrade_test.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ call mtr.add_suppression("InnoDB: Unable to delete statistics for table mysql.")
2828
call mtr.add_suppression("Column count of performance_schema.replication_applier_status_by_worker is wrong. Expected 16, found 8.");
2929
call mtr.add_suppression("Column count of performance_schema.replication_applier_status_by_coordinator is wrong. Expected 15, found 6.");
3030
call mtr.add_suppression("Column count of performance_schema.replication_connection_status is wrong. Expected 20, found 11.");
31+
call mtr.add_suppression("Column count of performance_schema.replication_group_members is wrong. Expected 7, found 5.");
32+
call mtr.add_suppression("Column count of performance_schema.replication_group_member_stats is wrong. Expected 13, found 9.");
3133
call mtr.add_suppression("\\[Warning\\] InnoDB: Parent table of FTS auxiliary table.*");
3234
# Copy the remote tablespace & DB zip files from suite location to working location.
3335
# Check that the file exists in the working folder.

mysql-test/suite/perfschema/r/dml_replication_group_member_stats.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
SELECT * FROM performance_schema.replication_group_member_stats
22
LIMIT 1;
3-
CHANNEL_NAME VIEW_ID MEMBER_ID COUNT_TRANSACTIONS_IN_QUEUE COUNT_TRANSACTIONS_CHECKED COUNT_CONFLICTS_DETECTED COUNT_TRANSACTIONS_ROWS_VALIDATING TRANSACTIONS_COMMITTED_ALL_MEMBERS LAST_CONFLICT_FREE_TRANSACTION
3+
CHANNEL_NAME VIEW_ID MEMBER_ID COUNT_TRANSACTIONS_IN_QUEUE COUNT_TRANSACTIONS_CHECKED COUNT_CONFLICTS_DETECTED COUNT_TRANSACTIONS_ROWS_VALIDATING TRANSACTIONS_COMMITTED_ALL_MEMBERS LAST_CONFLICT_FREE_TRANSACTION COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE COUNT_TRANSACTIONS_REMOTE_APPLIED COUNT_TRANSACTIONS_LOCAL_PROPOSED COUNT_TRANSACTIONS_LOCAL_ROLLBACK
44
SELECT * FROM performance_schema.replication_group_member_stats
55
WHERE channel_name='FOO';
6-
CHANNEL_NAME VIEW_ID MEMBER_ID COUNT_TRANSACTIONS_IN_QUEUE COUNT_TRANSACTIONS_CHECKED COUNT_CONFLICTS_DETECTED COUNT_TRANSACTIONS_ROWS_VALIDATING TRANSACTIONS_COMMITTED_ALL_MEMBERS LAST_CONFLICT_FREE_TRANSACTION
6+
CHANNEL_NAME VIEW_ID MEMBER_ID COUNT_TRANSACTIONS_IN_QUEUE COUNT_TRANSACTIONS_CHECKED COUNT_CONFLICTS_DETECTED COUNT_TRANSACTIONS_ROWS_VALIDATING TRANSACTIONS_COMMITTED_ALL_MEMBERS LAST_CONFLICT_FREE_TRANSACTION COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE COUNT_TRANSACTIONS_REMOTE_APPLIED COUNT_TRANSACTIONS_LOCAL_PROPOSED COUNT_TRANSACTIONS_LOCAL_ROLLBACK
77
INSERT INTO performance_schema.replication_group_member_stats
88
SET channel_name='FOO', node_id=1;
99
ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'replication_group_member_stats'

mysql-test/suite/perfschema/r/idx_replication_group_member_stats.result

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ replication_group_member_stats CREATE TABLE `replication_group_member_stats` (
99
`COUNT_CONFLICTS_DETECTED` bigint(20) unsigned NOT NULL,
1010
`COUNT_TRANSACTIONS_ROWS_VALIDATING` bigint(20) unsigned NOT NULL,
1111
`TRANSACTIONS_COMMITTED_ALL_MEMBERS` longtext NOT NULL,
12-
`LAST_CONFLICT_FREE_TRANSACTION` text NOT NULL
12+
`LAST_CONFLICT_FREE_TRANSACTION` text NOT NULL,
13+
`COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE` bigint(20) unsigned NOT NULL,
14+
`COUNT_TRANSACTIONS_REMOTE_APPLIED` bigint(20) unsigned NOT NULL,
15+
`COUNT_TRANSACTIONS_LOCAL_PROPOSED` bigint(20) unsigned NOT NULL,
16+
`COUNT_TRANSACTIONS_LOCAL_ROLLBACK` bigint(20) unsigned NOT NULL
1317
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
1418
select * from INFORMATION_SCHEMA.STATISTICS
1519
where TABLE_SCHEMA = "performance_schema"

mysql-test/suite/perfschema/r/idx_replication_group_members.result

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ replication_group_members CREATE TABLE `replication_group_members` (
55
`MEMBER_ID` char(36) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
66
`MEMBER_HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
77
`MEMBER_PORT` int(11) DEFAULT NULL,
8-
`MEMBER_STATE` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
8+
`MEMBER_STATE` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
9+
`MEMBER_ROLE` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
10+
`MEMBER_VERSION` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
911
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
1012
select * from INFORMATION_SCHEMA.STATISTICS
1113
where TABLE_SCHEMA = "performance_schema"

mysql-test/suite/perfschema/r/table_schema.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,8 @@ def performance_schema replication_group_members MEMBER_ID 2 NULL NO char 36 108
10311031
def performance_schema replication_group_members MEMBER_HOST 3 NULL NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references
10321032
def performance_schema replication_group_members MEMBER_PORT 4 NULL YES int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references
10331033
def performance_schema replication_group_members MEMBER_STATE 5 NULL NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) select,insert,update,references
1034+
def performance_schema replication_group_members MEMBER_ROLE 6 NULL NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) select,insert,update,references
1035+
def performance_schema replication_group_members MEMBER_VERSION 7 NULL NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) select,insert,update,references
10341036
def performance_schema replication_group_member_stats CHANNEL_NAME 1 NULL NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references
10351037
def performance_schema replication_group_member_stats VIEW_ID 2 NULL NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references
10361038
def performance_schema replication_group_member_stats MEMBER_ID 3 NULL NO char 36 108 NULL NULL NULL utf8 utf8_bin char(36) select,insert,update,references
@@ -1040,6 +1042,10 @@ def performance_schema replication_group_member_stats COUNT_CONFLICTS_DETECTED 6
10401042
def performance_schema replication_group_member_stats COUNT_TRANSACTIONS_ROWS_VALIDATING 7 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references
10411043
def performance_schema replication_group_member_stats TRANSACTIONS_COMMITTED_ALL_MEMBERS 8 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select,insert,update,references
10421044
def performance_schema replication_group_member_stats LAST_CONFLICT_FREE_TRANSACTION 9 NULL NO text 65535 65535 NULL NULL NULL utf8 utf8_general_ci text select,insert,update,references
1045+
def performance_schema replication_group_member_stats COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE 10 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references
1046+
def performance_schema replication_group_member_stats COUNT_TRANSACTIONS_REMOTE_APPLIED 11 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references
1047+
def performance_schema replication_group_member_stats COUNT_TRANSACTIONS_LOCAL_PROPOSED 12 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references
1048+
def performance_schema replication_group_member_stats COUNT_TRANSACTIONS_LOCAL_ROLLBACK 13 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references
10431049
def performance_schema rwlock_instances NAME 1 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) MUL select,insert,update,references
10441050
def performance_schema rwlock_instances OBJECT_INSTANCE_BEGIN 2 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned PRI select,insert,update,references
10451051
def performance_schema rwlock_instances WRITE_LOCKED_BY_THREAD_ID 3 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned MUL select,insert,update,references

mysql-test/t/dd_upgrade_partition.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ call mtr.add_suppression("InnoDB: Unable to delete statistics for table mysql.")
4141
call mtr.add_suppression("Column count of performance_schema.replication_connection_status is wrong. Expected 20, found 11*");
4242
call mtr.add_suppression("Column count of performance_schema.replication_applier_status_by_coordinator is wrong. Expected 15, found 6.*");
4343
call mtr.add_suppression("Column count of performance_schema.replication_applier_status_by_worker is wrong. Expected 16, found 8.*");
44+
call mtr.add_suppression("Column count of performance_schema.replication_group_members is wrong. Expected 7, found 5.*");
45+
call mtr.add_suppression("Column count of performance_schema.replication_group_member_stats is wrong. Expected 13, found 9.*");
4446
call mtr.add_suppression("Column count of performance_schema.threads is wrong. Expected 18, found 17.*");
4547

4648
# Set different paths for --datadir

mysql-test/t/dd_upgrade_test.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ call mtr.add_suppression("InnoDB: Unable to delete statistics for table mysql.")
3939
call mtr.add_suppression("Column count of performance_schema.replication_applier_status_by_worker is wrong. Expected 16, found 8.");
4040
call mtr.add_suppression("Column count of performance_schema.replication_applier_status_by_coordinator is wrong. Expected 15, found 6.");
4141
call mtr.add_suppression("Column count of performance_schema.replication_connection_status is wrong. Expected 20, found 11.");
42+
call mtr.add_suppression("Column count of performance_schema.replication_group_members is wrong. Expected 7, found 5.");
43+
call mtr.add_suppression("Column count of performance_schema.replication_group_member_stats is wrong. Expected 13, found 9.");
4244
call mtr.add_suppression("\\[Warning\\] InnoDB: Parent table of FTS auxiliary table.*");
4345
# Set different paths for --datadir
4446
let $MYSQLD_DATADIR1 = $MYSQL_TMP_DIR/data57;

rapid/plugin/group_replication/include/certifier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ class Certifier: public Certifier_interface
722722
Update method to store the count of the positively and negatively
723723
certified transaction on a particular group member.
724724
*/
725-
void update_certified_transaction_count(bool result);
725+
void update_certified_transaction_count(bool result, bool local_transaction);
726726
};
727727

728728
/*

rapid/plugin/group_replication/include/member_info.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ class Group_member_info: public Plugin_gcs_message
216216
*/
217217
Group_member_role get_role();
218218

219+
/**
220+
@return the member role type code in string
221+
*/
222+
const char* get_member_role_string();
223+
219224
/**
220225
@return the member plugin version
221226
*/

rapid/plugin/group_replication/include/member_version.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#ifndef MEMBER_VERSION_INCLUDED
1717
#define MEMBER_VERSION_INCLUDED
1818

19+
#include <string>
20+
1921
#include "my_inttypes.h"
2022

2123
class Member_version
@@ -28,6 +30,10 @@ class Member_version
2830
*/
2931
uint32 get_version() const;
3032

33+
/**
34+
@return returns the member version in string format.
35+
*/
36+
const std::string get_version_string() const;
3137
/**
3238
@return returns the major version (Major.v.v)
3339
*/

0 commit comments

Comments
 (0)